Skip to content

Commit

Permalink
fix: properly update starting sub-steps
Browse files Browse the repository at this point in the history
  • Loading branch information
akurinnoy authored and akurinnoy committed Aug 7, 2023
1 parent d7ab6b4 commit 3948320
Show file tree
Hide file tree
Showing 13 changed files with 510 additions and 414 deletions.
3 changes: 3 additions & 0 deletions packages/dashboard-frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ module.exports = {
'vscode-languageserver-protocol/lib/common/utils/is',
'vscode-languageserver-protocol/lib/main': 'vscode-languageserver-protocol/lib/node/main',
},
modulePathIgnorePatterns: [
'__mocks__/index.tsx',
],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.test.json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class StartingStepStartWorkspace extends ProgressStep<Props, State> {
return true;
}

// show/hide spinner near the step title
if (this.props.hasChildren !== nextProps.hasChildren) {
return true;
}

const workspace = this.findTargetWorkspace(this.props);
const nextWorkspace = this.findTargetWorkspace(nextProps);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Starting steps, checking workspace conditions snapshot - condition failed 1`] = `
<div>
<div
data-testid="isError"
/>
<div
data-testid="distance"
>
1
</div>
<span
className="done"
data-testid="step-title"
>
Something happened
</span>
</div>
`;

exports[`Starting steps, checking workspace conditions snapshot - condition in-progress 1`] = `
<div>
<div
data-testid="distance"
>
0
</div>
<span
className="progress"
data-testid="step-title"
>
Preparing networking
</span>
</div>
`;

exports[`Starting steps, checking workspace conditions snapshot - condition ready 1`] = `
<div>
<div
data-testid="distance"
>
1
</div>
<span
className="done"
data-testid="step-title"
>
Networking ready
</span>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright (c) 2018-2023 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/

import { ConditionType } from '../../../utils';

export const conditionChangedTo: {
[key: string]: [condition: ConditionType, prevCondition: ConditionType | undefined];
} = {
inProgress1: [
{
status: 'False',
type: 'Started',
},
undefined,
],
inProgress2: [
{
status: 'False',
type: 'Started',
},
{
status: 'False',
type: 'Started',
},
],

done1: [
{
status: 'True',
type: 'Started',
},
{
status: 'False',
type: 'Started',
},
],
done2: [
{
status: 'Unknown',
type: 'Started',
},
{
status: 'True',
type: 'Started',
},
],

fail1: [
{
status: 'Unknown',
type: 'Started',
},
{
status: 'False',
type: 'Started',
},
],
fail2: [
{
status: 'False',
type: 'Started',
message: 'Workspace stopped due to error',
},
{
status: 'Unknown',
type: 'Started',
},
],
fail3: [
{
status: 'True',
type: 'Started',
reason: 'Failed',
},
undefined,
],
};

export const conditionStatusFalse: ConditionType = {
message: 'Preparing networking',
status: 'False',
type: 'RoutingReady',
};
export const conditionStatusTrue: ConditionType = {
message: 'Networking ready',
status: 'True',
type: 'RoutingReady',
};
export const conditionError: ConditionType = {
status: 'True',
type: 'FailedStart',
reason: 'Failure',
message: 'Something happened',
};
export const conditionStatusUnknown: ConditionType = {
status: 'Unknown',
type: 'RoutingReady',
};
Loading

0 comments on commit 3948320

Please sign in to comment.