Skip to content

Commit

Permalink
Use install properties to check if triggers is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-edouard.breteche committed May 12, 2020
1 parent 57082bc commit f6c91f5
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/containers/SideNav/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
getSelectedNamespace,
isReadOnly
} from '../../reducers';
import { getCustomResource } from '../../api';
import { getInstallProperties } from '../../api';

import './SideNav.scss';

Expand All @@ -48,7 +48,7 @@ class SideNav extends Component {
this.props.selectNamespace(match.params.namespace);
}

this.checkTriggersInstalled();
this.fetchDashboardInfo();
}

componentDidUpdate(prevProps) {
Expand Down Expand Up @@ -150,17 +150,15 @@ 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(() => {});
async fetchDashboardInfo() {
try {
const dashboardInfo = await getInstallProperties();
const isTriggersInstalled =
dashboardInfo.TriggersNamespace && dashboardInfo.TriggersVersion;
this.setState({ isTriggersInstalled });
} catch (error) {
this.setState({ isTriggersInstalled: false });
}
}

render() {
Expand Down

0 comments on commit f6c91f5

Please sign in to comment.