Skip to content

Commit f02c112

Browse files
authored
Fix: Portal updates to match new hatchery changes (#1374)
* Fix: Portal updates to match new hatchery changes * Ensure workspace launch is disabled only in commons where paymodels are available
1 parent 01e38f5 commit f02c112

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Workspace/index.jsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class Workspace extends React.Component {
328328
path: `${workspaceTerminateUrl}`,
329329
method: 'POST',
330330
}).then(() => {
331-
this.checkWorkspaceStatus();
331+
this.checkWorkspaceStatus({ triggerPayModelCall: true });
332332
});
333333
});
334334
}
@@ -360,7 +360,7 @@ class Workspace extends React.Component {
360360
}
361361
}
362362

363-
checkWorkspaceStatus = async () => {
363+
checkWorkspaceStatus = async (args) => {
364364
if (this.state.interval) {
365365
clearInterval(this.state.interval);
366366
}
@@ -370,6 +370,13 @@ class Workspace extends React.Component {
370370
if (this.workspaceStates.includes(data.status)) {
371371
const workspaceLaunchStepsConfig = this.getWorkspaceLaunchSteps(data);
372372
let workspaceStatus = data.status;
373+
if (args?.triggerPayModelCall && workspaceStatus === 'Not Found') {
374+
this.getWorkspacePayModel().then((payModelData) => {
375+
this.setState({
376+
payModel: payModelData,
377+
});
378+
});
379+
}
373380
if (workspaceLaunchStepsConfig && workspaceLaunchStepsConfig.currentStepsStatus === 'error') {
374381
workspaceStatus = 'Stopped';
375382
}
@@ -510,7 +517,7 @@ class Workspace extends React.Component {
510517
const showExternalLoginsHintBanner = this.state.externalLoginOptions.length > 0
511518
&& this.state.externalLoginOptions.some((option) => !option.refresh_token_expiration);
512519
const isPayModelAboveLimit = this.state.payModel.current_pay_model?.request_status === 'above limit';
513-
const isPaymodelNeededToLaunch = this.state.payModel.length > 0 && this.state.payModel.current_pay_model == null;
520+
const isPaymodelNeededToLaunch = Object.keys(this.state.payModel).length > 0 && this.state.payModel.current_pay_model == null;
514521
return (
515522
<div
516523
className={`workspace ${this.state.workspaceIsFullpage ? 'workspace--fullpage' : ''}`}

0 commit comments

Comments
 (0)