Skip to content

Commit

Permalink
Fix: Portal updates to match new hatchery changes (#1374)
Browse files Browse the repository at this point in the history
* Fix: Portal updates to match new hatchery changes
* Ensure workspace launch is disabled only in commons where paymodels are available
  • Loading branch information
nss10 authored Aug 7, 2023
1 parent 01e38f5 commit f02c112
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Workspace/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class Workspace extends React.Component {
path: `${workspaceTerminateUrl}`,
method: 'POST',
}).then(() => {
this.checkWorkspaceStatus();
this.checkWorkspaceStatus({ triggerPayModelCall: true });
});
});
}
Expand Down Expand Up @@ -360,7 +360,7 @@ class Workspace extends React.Component {
}
}

checkWorkspaceStatus = async () => {
checkWorkspaceStatus = async (args) => {
if (this.state.interval) {
clearInterval(this.state.interval);
}
Expand All @@ -370,6 +370,13 @@ class Workspace extends React.Component {
if (this.workspaceStates.includes(data.status)) {
const workspaceLaunchStepsConfig = this.getWorkspaceLaunchSteps(data);
let workspaceStatus = data.status;
if (args?.triggerPayModelCall && workspaceStatus === 'Not Found') {
this.getWorkspacePayModel().then((payModelData) => {
this.setState({
payModel: payModelData,
});
});
}
if (workspaceLaunchStepsConfig && workspaceLaunchStepsConfig.currentStepsStatus === 'error') {
workspaceStatus = 'Stopped';
}
Expand Down Expand Up @@ -510,7 +517,7 @@ class Workspace extends React.Component {
const showExternalLoginsHintBanner = this.state.externalLoginOptions.length > 0
&& this.state.externalLoginOptions.some((option) => !option.refresh_token_expiration);
const isPayModelAboveLimit = this.state.payModel.current_pay_model?.request_status === 'above limit';
const isPaymodelNeededToLaunch = this.state.payModel.length > 0 && this.state.payModel.current_pay_model == null;
const isPaymodelNeededToLaunch = Object.keys(this.state.payModel).length > 0 && this.state.payModel.current_pay_model == null;
return (
<div
className={`workspace ${this.state.workspaceIsFullpage ? 'workspace--fullpage' : ''}`}
Expand Down

0 comments on commit f02c112

Please sign in to comment.