From 5789d14a2abfd4a50906655982f2912e334dcc86 Mon Sep 17 00:00:00 2001 From: Victor Plakyda Date: Thu, 5 Aug 2021 17:07:33 +0300 Subject: [PATCH 01/21] Application retry prefill & validation Signed-off-by: pashavictorovich --- ui/src/app/shared/models.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/src/app/shared/models.ts b/ui/src/app/shared/models.ts index b7870411bf2f7..9c90fd1edd54b 100644 --- a/ui/src/app/shared/models.ts +++ b/ui/src/app/shared/models.ts @@ -232,6 +232,7 @@ export interface Automated { export interface SyncPolicy { automated?: Automated; syncOptions?: string[]; + retry?: RetryStrategy } export interface Info { From 039eeb4535461da1b7d24f8ed8a34c6ae329ec09 Mon Sep 17 00:00:00 2001 From: Victor Plakyda Date: Fri, 30 Jul 2021 14:17:01 +0300 Subject: [PATCH 02/21] Retry strategy, Application + Applications Signed-off-by: Victor Plakyda Signed-off-by: pashavictorovich --- .../application-retry-options.scss | 9 ++++ .../application-retry-options.tsx | 45 +++++++++++++++++++ .../applications-sync-panel.tsx | 8 +++- ui/src/app/shared/models.ts | 11 +++++ .../shared/services/applications-service.ts | 5 ++- 5 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 ui/src/app/applications/components/application-retry-options/application-retry-options.scss create mode 100644 ui/src/app/applications/components/application-retry-options/application-retry-options.tsx diff --git a/ui/src/app/applications/components/application-retry-options/application-retry-options.scss b/ui/src/app/applications/components/application-retry-options/application-retry-options.scss new file mode 100644 index 0000000000000..bf5926f5ce765 --- /dev/null +++ b/ui/src/app/applications/components/application-retry-options/application-retry-options.scss @@ -0,0 +1,9 @@ +.application-retry-options { + + &__item { + margin: 12px 0; + padding-top: 12px; + position: relative; + padding-left: 0; + } +} \ No newline at end of file diff --git a/ui/src/app/applications/components/application-retry-options/application-retry-options.tsx b/ui/src/app/applications/components/application-retry-options/application-retry-options.tsx new file mode 100644 index 0000000000000..713f4bff7fd6c --- /dev/null +++ b/ui/src/app/applications/components/application-retry-options/application-retry-options.tsx @@ -0,0 +1,45 @@ +import * as React from 'react'; +import {FormApi, Text} from 'react-form'; +import {FormField} from 'argo-ui'; +import {NumberField} from '../../../shared/components'; + +require('./application-retry-options.scss'); + + + +function buildFormItem(label: string, propertyPath: string, component: React.ComponentType, formApi: FormApi, componentProps?: Record) { + return +} + +const onlyPositiveValidation = { + min:'1', + step:'1' +} + +const retryOptions: Array<(formApi: FormApi) => React.ReactNode> = [ + formApi => buildFormItem('Limit', 'retryStrategy.limit', NumberField, formApi, onlyPositiveValidation), + formApi => buildFormItem('Duration', 'retryStrategy.backoff.duration', Text, formApi), + formApi => buildFormItem('Max Duration', 'retryStrategy.backoff.maxDuration', Text, formApi), + formApi => buildFormItem('Factor', 'retryStrategy.backoff.factor', NumberField, formApi, onlyPositiveValidation), +]; + + +export const ApplicationRetryOptions = ({ formApi }: { formApi: FormApi }) => { + + return
+ {retryOptions.map((render, i) => ( +
+ {render(formApi)} +
+ ))} +
+} \ No newline at end of file diff --git a/ui/src/app/applications/components/applications-sync-panel/applications-sync-panel.tsx b/ui/src/app/applications/components/applications-sync-panel/applications-sync-panel.tsx index 5f50de44b5ebf..6f8d5583a164d 100644 --- a/ui/src/app/applications/components/applications-sync-panel/applications-sync-panel.tsx +++ b/ui/src/app/applications/components/applications-sync-panel/applications-sync-panel.tsx @@ -5,6 +5,7 @@ import {CheckboxField, ProgressPopup} from '../../../shared/components'; import {Consumer} from '../../../shared/context'; import * as models from '../../../shared/models'; import {services} from '../../../shared/services'; +import {ApplicationRetryOptions} from '../application-retry-options/application-retry-options'; import {ApplicationManualSyncFlags, ApplicationSyncOptions, SyncFlags} from '../application-sync-options/application-sync-options'; import {ComparisonStatusIcon, HealthStatusIcon, OperationPhaseIcon} from '../utils'; @@ -59,7 +60,8 @@ export const ApplicationsSyncPanel = ({show, apps, hide}: {show: boolean; apps: syncFlags.DryRun || false, syncStrategy, null, - params.syncOptions + params.syncOptions, + params.retryStrategy ) .catch(e => { ctx.notifications.show({ @@ -94,6 +96,10 @@ export const ApplicationsSyncPanel = ({show, apps, hide}: {show: boolean; apps: }} /> +
+ + +