diff --git a/src/containers/SideNav/SideNav.js b/src/containers/SideNav/SideNav.js index 61f8c6be41..ce2b5658ed 100644 --- a/src/containers/SideNav/SideNav.js +++ b/src/containers/SideNav/SideNav.js @@ -32,7 +32,7 @@ import { getSelectedNamespace, isReadOnly } from '../../reducers'; -import { getCustomResource } from '../../api'; +import { getInstallProperties } from '../../api'; import './SideNav.scss'; @@ -48,7 +48,7 @@ class SideNav extends Component { this.props.selectNamespace(match.params.namespace); } - this.checkTriggersInstalled(); + this.fetchDashboardInfo(); } componentDidUpdate(prevProps) { @@ -66,6 +66,27 @@ class SideNav extends Component { } } + async fetchDashboardInfo() { + try { + const dashboardInfo = await getInstallProperties(); + const isTriggersInstalled = dashboardInfo.TriggersNamespace && dashboardInfo.TriggersVersion; + this.setState({ isTriggersInstalled }); + } catch (error) {} + } + + // checkTriggersInstalled() { + // getCustomResource({ + // group: 'apiextensions.k8s.io', + // version: 'v1beta1', + // type: 'customresourcedefinitions', + // name: 'eventlisteners.triggers.tekton.dev' + // }) + // .then(() => { + // this.setState({ isTriggersInstalled: true }); + // }) + // .catch(() => {}); + // } + setPath(path) { const { history, location } = this.props; history.push(path + location.search); @@ -150,19 +171,6 @@ class SideNav extends Component { history.push('/'); }; - checkTriggersInstalled() { - getCustomResource({ - group: 'apiextensions.k8s.io', - version: 'v1beta1', - type: 'customresourcedefinitions', - name: 'eventlisteners.triggers.tekton.dev' - }) - .then(() => { - this.setState({ isTriggersInstalled: true }); - }) - .catch(() => {}); - } - render() { const { extensions, intl, namespace } = this.props; const { isTriggersInstalled } = this.state;