diff --git a/ui/src/dashboards/components/DashboardImportFromTemplateOverlay.tsx b/ui/src/dashboards/components/DashboardImportFromTemplateOverlay.tsx index d97467ec22..a96036d278 100644 --- a/ui/src/dashboards/components/DashboardImportFromTemplateOverlay.tsx +++ b/ui/src/dashboards/components/DashboardImportFromTemplateOverlay.tsx @@ -64,6 +64,9 @@ class DashboardImportFromTemplateOverlay extends PureComponent< } render() { + const { + params: {orgID}, + } = this.props const {selectedTemplateSummary} = this.state return ( @@ -75,7 +78,7 @@ class DashboardImportFromTemplateOverlay extends PureComponent< />
- + {this.templates} @@ -140,16 +143,6 @@ class DashboardImportFromTemplateOverlay extends PureComponent< ] } - private get orgName(): string { - const { - params: {orgID}, - orgs, - } = this.props - return orgs.find(org => { - return org.id === orgID - }).name - } - private get variableItems(): JSX.Element[] { return this.state.variables.map(v => { return

{v}

diff --git a/ui/src/organizations/components/OrgTemplateFetcher.tsx b/ui/src/organizations/components/OrgTemplateFetcher.tsx index 4aa48e37f8..bae837d52e 100644 --- a/ui/src/organizations/components/OrgTemplateFetcher.tsx +++ b/ui/src/organizations/components/OrgTemplateFetcher.tsx @@ -21,20 +21,20 @@ interface DispatchProps { } interface OwnProps { - orgName: string + orgID: string } type Props = StateProps & DispatchProps & OwnProps const OrgTemplateFetcher: FunctionComponent = ({ - orgName, + orgID, templatesStatus, onGetTemplatesForOrg, children, }) => { useEffect(() => { if (templatesStatus === RemoteDataState.NotStarted) { - onGetTemplatesForOrg(orgName) + onGetTemplatesForOrg(orgID) } }, [templatesStatus]) diff --git a/ui/src/organizations/containers/OrgTemplatesIndex.tsx b/ui/src/organizations/containers/OrgTemplatesIndex.tsx index ce5af28ae3..7a062f97d9 100644 --- a/ui/src/organizations/containers/OrgTemplatesIndex.tsx +++ b/ui/src/organizations/containers/OrgTemplatesIndex.tsx @@ -60,7 +60,7 @@ class OrgTemplatesIndex extends Component { url="templates" title="Templates" > - + { return template } -export const getTemplatesForOrg = (orgName: string) => async dispatch => { +export const getTemplatesForOrg = (orgID: string) => async dispatch => { dispatch(setTemplatesStatus(RemoteDataState.Loading)) - const items = await client.templates.getAll(orgName) + const items = await client.templates.getAll(orgID) dispatch(populateTemplateSummaries(items)) }