Skip to content

Commit

Permalink
Merge branch 'main' into refactor-remove-swagger-ui
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Malone <[email protected]>
  • Loading branch information
MasonM committed Oct 30, 2024
2 parents d706239 + 3df5183 commit d31d969
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 259 deletions.
8 changes: 8 additions & 0 deletions cmd/argo/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ If your server is behind an ingress with a path (running "argo server --base-hre
cli.SetLogLevel(logLevel)
cmdutil.SetGLogLevel(glogLevel)
log.WithField("version", argo.GetVersion()).Debug("CLI version")

// Disable printing of usage string on errors, except for argument validation errors
// (i.e. when the "Args" function returns an error).
//
// This is set here instead of directly in "command" because Cobra
// executes PersistentPreRun after performing argument validation:
// https://github.com/spf13/cobra/blob/3a5efaede9d389703a792e2f7bfe3a64bc82ced9/command.go#L939-L957
cmd.SilenceUsage = true
}
command.PersistentFlags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.PersistentFlags().IntVar(&glogLevel, "gloglevel", 0, "Set the glog logging level")
Expand Down
2 changes: 1 addition & 1 deletion docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This document outlines environment variables that can be used to customize behav
| `OPERATION_DURATION_METRIC_BUCKET_COUNT` | `int` | `6` | The number of buckets to collect the metric for the operation duration. |
| `POD_NAMES` | `string` | `v2` | Whether to have pod names contain the template name (v2) or be the node id (v1) - should be set the same for Argo Server. |
| `RECENTLY_STARTED_POD_DURATION` | `time.Duration` | `10s` | The duration of a pod before the pod is considered to be recently started. |
| `RECENTLY_DELETED_POD_DURATION` | `time.Duration` | `10s` | The duration of a pod before the pod is considered to be recently deleted. |
| `RECENTLY_DELETED_POD_DURATION` | `time.Duration` | `2m` | The duration of a pod before the pod is considered to be recently deleted. |
| `RETRY_BACKOFF_DURATION` | `time.Duration` | `10ms` | The retry back-off duration when retrying API calls. |
| `RETRY_BACKOFF_FACTOR` | `float` | `2.0` | The retry back-off factor when retrying API calls. |
| `RETRY_BACKOFF_STEPS` | `int` | `5` | The retry back-off steps when retrying API calls. |
Expand Down
5 changes: 0 additions & 5 deletions pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2409,11 +2409,6 @@ func (n NodeStatus) IsExitNode() bool {
return strings.HasSuffix(n.DisplayName, ".onExit")
}

// IsPodDeleted returns whether node is error with pod deleted.
func (n NodeStatus) IsPodDeleted() bool {
return n.Phase == NodeError && n.Message == "pod deleted"
}

func (n NodeStatus) Succeeded() bool {
return n.Phase == NodeSucceeded
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ func (s *CLISuite) TestWorkflowLint() {
RunCli([]string{"lint", "--kinds", "wf", "testdata/workflow-template-nested-template.yaml"}, func(t *testing.T, output string, err error) {
require.Error(t, err)
assert.Contains(t, output, "found nothing to lint in the specified paths, failing...")
assert.NotContains(t, output, "Usage:")
})
})
s.Run("All Kinds", func() {
Expand Down Expand Up @@ -1095,6 +1096,7 @@ func (s *CLISuite) TestTemplateCommands() {
s.Run("LintWithoutArgs", func() {
s.Given().RunCli([]string{"template", "lint"}, func(t *testing.T, output string, err error) {
require.Error(t, err)
assert.Contains(t, output, "Error: requires at least 1 arg(s), only received 0")
assert.Contains(t, output, "Usage:")
})
})
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@typescript-eslint/parser": "^6.10.0",
"babel-jest": "^29.7.0",
"copy-webpack-plugin": "^12.0.1",
"esbuild-loader": "^4.0.2",
"esbuild-loader": "^4.2.2",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
Expand Down
6 changes: 1 addition & 5 deletions ui/src/shared/components/editors/key-value-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface KeyValues {
[key: string]: string;
}

export function KeyValueEditor({onChange, keyValues, hide}: {keyValues: KeyValues; onChange: (value: KeyValues) => void; hide?: (key: string) => boolean}) {
export function KeyValueEditor({onChange, keyValues = {}, hide}: {keyValues: KeyValues; onChange: (value: KeyValues) => void; hide?: (key: string) => boolean}) {
const [name, setName] = useState('');
const [value, setValue] = useState('');

Expand Down Expand Up @@ -62,7 +62,3 @@ export function KeyValueEditor({onChange, keyValues, hide}: {keyValues: KeyValue
</>
);
}

KeyValueEditor.defaultProps = {
keyValues: {}
};
14 changes: 6 additions & 8 deletions ui/src/shared/components/graph/graph-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ interface Props {
onNodeSelect?: (id: Node) => void;
}

const defaultNodeSize = 64;

const merge = (a: {[key: string]: boolean}, b: {[key: string]: boolean}) => b && Object.assign(Object.assign({}, b), a);

export function GraphPanel(props: Props) {
const storage = new ScopedLocalStorage('graph/' + props.storageScope);
const [nodeSize, setNodeSize] = useState<number>(storage.getItem('nodeSize', props.nodeSize));
const [nodeSize, setNodeSize] = useState<number>(storage.getItem('nodeSize', props.nodeSize || defaultNodeSize));
const [horizontal, setHorizontal] = useState<boolean>(storage.getItem('horizontal', !!props.horizontal));
const [fast, setFast] = useState<boolean>(storage.getItem('fast', false));
const [nodeGenres, setNodeGenres] = useState<INodeSelectionMap>(storage.getItem('nodeGenres', props.nodeGenres));
Expand All @@ -52,7 +54,7 @@ export function GraphPanel(props: Props) {
const [checkAll, setCheckAll] = useState<boolean>(true);
const [nodeSearchKeyword, setNodeSearchKeyword] = useState<string>('');

useEffect(() => storage.setItem('nodeSize', nodeSize, props.nodeSize), [nodeSize]);
useEffect(() => storage.setItem('nodeSize', nodeSize, props.nodeSize || defaultNodeSize), [nodeSize]);
useEffect(() => storage.setItem('horizontal', horizontal, props.horizontal), [horizontal]);
useEffect(() => storage.setItem('fast', fast, false), [fast]);
useEffect(() => storage.setItem('nodeGenres', nodeGenres, props.nodeGenres), [nodeGenres, props.nodeGenres]);
Expand Down Expand Up @@ -261,13 +263,13 @@ export function GraphPanel(props: Props) {
)}
<GraphIcon icon={label.icon} progress={label.progress} nodeSize={nodeSize} />
{props.hideNodeTypes || (
<text y={nodeSize * 0.33} className='type' fontSize={(12 * nodeSize) / GraphPanel.defaultProps.nodeSize}>
<text y={nodeSize * 0.33} className='type' fontSize={(12 * nodeSize) / defaultNodeSize}>
{label.genre}
</text>
)}
</g>
<g transform={`translate(0,${(nodeSize * 3) / 4})`}>
<text className='node-label' fontSize={(18 * nodeSize) / GraphPanel.defaultProps.nodeSize}>
<text className='node-label' fontSize={(18 * nodeSize) / defaultNodeSize}>
{formatLabel(label.label)}
</text>
</g>
Expand All @@ -280,7 +282,3 @@ export function GraphPanel(props: Props) {
</div>
);
}

GraphPanel.defaultProps = {
nodeSize: 64
};
4 changes: 2 additions & 2 deletions ui/src/workflows/components/workflow-dag/workflow-dag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export class WorkflowDag extends React.Component<WorkflowDagProps, WorkflowDagRe
this.state = {
expandNodes: new Set(),
showArtifacts: localStorage.getItem('showArtifacts') !== 'false',
showInvokingTemplateName: localStorage.getItem('showInvokingTemplateName') !== 'false',
showTemplateRefsGrouping: localStorage.getItem('showTemplateRefsGrouping') !== 'false'
showInvokingTemplateName: localStorage.getItem('showInvokingTemplateName') === 'true',
showTemplateRefsGrouping: localStorage.getItem('showTemplateRefsGrouping') === 'true'
};
}

Expand Down
Loading

0 comments on commit d31d969

Please sign in to comment.