Skip to content

Commit 0352653

Browse files
committed
fix: ui lint
Signed-off-by: Noam Gal <[email protected]>
1 parent f67b756 commit 0352653

File tree

7 files changed

+20
-14
lines changed

7 files changed

+20
-14
lines changed

ui/src/app/shared/pod-name.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ describe('pod names', () => {
2828
});
2929

3030
test('getPodName', () => {
31-
const node = {
31+
const node = ({
3232
name: 'nodename',
3333
id: '1',
3434
templateName: shortTemplateName
35-
} as unknown as NodeStatus;
36-
const wf = {
35+
} as unknown) as NodeStatus;
36+
const wf = ({
3737
metadata: {
3838
name: shortWfName,
3939
annotations: {
4040
[ANNOTATION_KEY_POD_NAME_VERSION]: POD_NAME_V1
4141
}
4242
}
43-
} as unknown as Workflow;
43+
} as unknown) as Workflow;
4444

4545
const v1podName = node.id;
4646
const v2podName = `${shortWfName}-${shortTemplateName}-${createFNVHash(node.name)}`;
@@ -63,7 +63,7 @@ describe('pod names', () => {
6363
test('getTemplateNameFromNode', () => {
6464
// case: no template ref or template name
6565
// expect fallback to empty string
66-
const node = {} as unknown as NodeStatus;
66+
const node = ({} as unknown) as NodeStatus;
6767
expect(getTemplateNameFromNode(node)).toEqual('');
6868

6969
// case: template ref defined but no template name defined

ui/src/app/shared/pod-name.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function getPodName(workflow: Workflow, node: NodeStatus): string {
2121
const workflowName = workflow.metadata.name;
2222
// convert containerSet node name to its corresponding pod node name by removing the ".<containerName>" postfix
2323
// this part is from workflow/controller/container_set_template.go#executeContainerSet; the inverse never happens in the back-end, so is unique to the front-end
24-
const podNodeName = node.type == 'Container' ? node.name.replace(/\.[^/.]+$/, '') : node.name;
24+
const podNodeName = node.type === 'Container' ? node.name.replace(/\.[^/.]+$/, '') : node.name;
2525
if (workflowName === podNodeName) {
2626
return workflowName;
2727
}
@@ -43,7 +43,7 @@ export function ensurePodNamePrefixLength(prefix: string): string {
4343
}
4444

4545
return prefix;
46-
};
46+
}
4747

4848
export const createFNVHash = (input: string): number => {
4949
let hashint = 2166136261;

ui/src/app/shared/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const Utils = {
8484

8585
fixLocalStorageString(x: string): string {
8686
// empty string is valid, so we cannot use `truthy`
87-
if (x == null || x == 'null' || x == 'undefined') {
87+
if (x == null || x === 'null' || x === 'undefined') {
8888
return undefined; // explicitly return undefined
8989
}
9090
return x;

ui/src/app/workflows/components/resubmit-workflow-panel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {Checkbox} from 'argo-ui';
22
import React, {useContext, useState} from 'react';
33
import {Parameter, ResubmitOpts, Workflow} from '../../../models';
4-
import {Context} from '../../shared/context';
54
import {uiUrl} from '../../shared/base';
65
import {ErrorNotice} from '../../shared/components/error-notice';
76
import {ParametersInput} from '../../shared/components/parameters-input/parameters-input';
7+
import {Context} from '../../shared/context';
88
import {services} from '../../shared/services';
99
import {Utils} from '../../shared/utils';
1010

ui/src/app/workflows/components/retry-workflow-panel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {Checkbox} from 'argo-ui';
22
import React, {useContext, useState} from 'react';
33
import {Parameter, RetryOpts, Workflow} from '../../../models';
4-
import {Context} from '../../shared/context';
54
import {uiUrl} from '../../shared/base';
65
import {ErrorNotice} from '../../shared/components/error-notice';
76
import {ParametersInput} from '../../shared/components/parameters-input/parameters-input';
7+
import {Context} from '../../shared/context';
88
import {services} from '../../shared/services';
99
import {Utils} from '../../shared/utils';
1010

ui/src/app/workflows/components/submit-workflow-panel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {Select} from 'argo-ui';
22
import React, {useContext, useMemo, useState} from 'react';
33
import {Parameter, Template} from '../../../models';
4-
import {Context} from '../../shared/context';
54
import {uiUrl} from '../../shared/base';
65
import {ErrorNotice} from '../../shared/components/error-notice';
76
import {ParametersInput} from '../../shared/components/parameters-input/parameters-input';
87
import {TagsInput} from '../../shared/components/tags-input/tags-input';
8+
import {Context} from '../../shared/context';
99
import {services} from '../../shared/services';
1010
import {Utils} from '../../shared/utils';
1111

ui/src/app/workflows/components/workflow-details/workflow-details.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ export function WorkflowDetails({history, location, match}: RouteComponentProps<
196196
popup
197197
.confirm('Confirm', () => <DeleteCheck isWfInDB={isArchivedWorkflow(workflow)} isWfInCluster={isWorkflowInCluster(workflow)} />)
198198
.then(async yes => {
199-
if (!yes) return;
199+
if (!yes) {
200+
return;
201+
}
200202

201203
const allPromises = [];
202204
if (isWorkflowInCluster(workflow)) {
@@ -218,7 +220,9 @@ export function WorkflowDetails({history, location, match}: RouteComponentProps<
218220
setSidePanel('retry');
219221
} else {
220222
popup.confirm('Confirm', `Are you sure you want to ${workflowOperation.title.toLowerCase()} this workflow?`).then(yes => {
221-
if (!yes) return;
223+
if (!yes) {
224+
return;
225+
}
222226

223227
workflowOperation.action(workflow).catch(setError);
224228
});
@@ -466,7 +470,9 @@ export function WorkflowDetails({history, location, match}: RouteComponentProps<
466470

467471
function renderResumePopup() {
468472
return popup.confirm('Confirm', renderSuspendNodeOptions).then(yes => {
469-
if (!yes) return;
473+
if (!yes) {
474+
return;
475+
}
470476

471477
updateOutputParametersForNodeIfRequired()
472478
.then(resumeNode)

0 commit comments

Comments
 (0)