|
|
@@ -293,12 +293,22 @@ class Home extends Component<PropsType, StateType> {
|
|
|
this.getMetadata();
|
|
|
}
|
|
|
|
|
|
+ async checkIfProjectHasBilling(projectId: number) {
|
|
|
+ const res = await api.getHasBilling(
|
|
|
+ "<token>",
|
|
|
+ {},
|
|
|
+ { project_id: projectId }
|
|
|
+ );
|
|
|
+ this.context.setHasBillingEnabled(res.data?.has_billing);
|
|
|
+ }
|
|
|
+
|
|
|
// TODO: Need to handle the following cases. Do a deep rearchitecture (Prov -> Dashboard?) if need be:
|
|
|
// 1. Make sure clicking cluster in drawer shows cluster-dashboard
|
|
|
// 2. Make sure switching projects shows appropriate initial view (dashboard || provisioner)
|
|
|
// 3. Make sure initializing from URL (DO oauth) displays the appropriate initial view
|
|
|
componentDidUpdate(prevProps: PropsType) {
|
|
|
if (prevProps.currentProject?.id !== this.props.currentProject?.id) {
|
|
|
+ this.checkIfProjectHasBilling(this?.context?.currentProject?.id);
|
|
|
api
|
|
|
.getUsage(
|
|
|
"<token>",
|