From 6ba9c5188af3b78a51cb8cff10a9cbe6bfcb8a09 Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Wed, 23 Sep 2020 10:40:40 -0700 Subject: [PATCH] improve orphaned resources edit panel --- .../project-details/project-details.scss | 8 + .../project-details/project-details.tsx | 140 +++++++++++------- 2 files changed, 97 insertions(+), 51 deletions(-) diff --git a/ui/src/app/settings/components/project-details/project-details.scss b/ui/src/app/settings/components/project-details/project-details.scss index 4bacc7c3b63f6..fb7fe46f7d42f 100644 --- a/ui/src/app/settings/components/project-details/project-details.scss +++ b/ui/src/app/settings/components/project-details/project-details.scss @@ -1,3 +1,5 @@ +@import 'node_modules/argo-ui/src/styles/config'; + .project-details { .white-box__details-row .fa-times { position: absolute; @@ -9,4 +11,10 @@ .select.argo-field { padding: 0; } + + .white-box { + .help-tip { + color: $argo-color-gray-6; + } + } } \ No newline at end of file diff --git a/ui/src/app/settings/components/project-details/project-details.tsx b/ui/src/app/settings/components/project-details/project-details.tsx index c63588c11b07b..dd5522ff73503 100644 --- a/ui/src/app/settings/components/project-details/project-details.tsx +++ b/ui/src/app/settings/components/project-details/project-details.tsx @@ -1,10 +1,11 @@ -import {AutocompleteField, FormField, NotificationsApi, NotificationType, SlidingPanel, Tabs, Tooltip} from 'argo-ui'; +import {AutocompleteField, FormField, HelpIcon, NotificationsApi, NotificationType, SlidingPanel, Tabs, Tooltip} from 'argo-ui'; +import classNames from 'classnames'; import * as PropTypes from 'prop-types'; import * as React from 'react'; import {FormApi, Text} from 'react-form'; import {RouteComponentProps} from 'react-router'; -import {DataLoader, EditablePanel, ErrorNotification, Page, Query} from '../../../shared/components'; +import {CheckboxField, DataLoader, EditablePanel, ErrorNotification, Page, Query} from '../../../shared/components'; import {AppContext, Consumer} from '../../../shared/context'; import {Project, ResourceKinds} from '../../../shared/models'; import {CreateJWTTokenParams, DeleteJWTTokenParams, ProjectRoleParams, services} from '../../../shared/services'; @@ -848,60 +849,105 @@ export class ProjectDetails extends React.Component +

+ Enabled +

+

+ {' '} + Application warning conditions are {proj.spec.orphanedResources.warn ? 'enabled' : 'disabled'}. +

{(proj.spec.orphanedResources.ignore || []).length > 0 ? ( - (proj.spec.orphanedResources.ignore || []).map((resource, i) => ( -
-
{resource.group}
-
{resource.kind}
-
{resource.name}
+ +

Resources Ignore List

+
+
Group
+
Kind
+
Name
- )) + {(proj.spec.orphanedResources.ignore || []).map((resource, i) => ( +
+
{resource.group}
+
{resource.kind}
+
{resource.name}
+
+ ))} +
) : ( -

Orphaned Resource Ignore list is empty.

+

Resource ignore list is empty.

)} -

Orphaned Resource warning is {proj.spec.orphanedResources.warn ? 'enabled' : 'disabled'}.

) : ( -

Orphaned Resources monitoring is disabled

+

+ Disabled +

) } edit={formApi => formApi.values.spec.orphanedResources ? ( - {(formApi.values.spec.orphanedResources.ignore || []).map((_: Project, i: number) => ( -
-
- -
-
- -
-
- formApi.setValue('spec.orphanedResources', null)}> + DISABLE + +
+
+ Enable application warning conditions? + +
+
+ +
+
+ +
+ Resources Ignore List + +
+
+
Group
+
Kind
+
Name
+
+ {((formApi.values.spec.orphanedResources.ignore || []).length === 0 &&
Ignore list is empty
) || + formApi.values.spec.orphanedResources.ignore.map((_: Project, i: number) => ( +
+
+ +
+
+ +
+
+ +
+ formApi.setValue('spec.orphanedResources.ignore', removeEl(formApi.values.spec.orphanedResources.ignore, i))} />
- formApi.setValue('spec.orphanedResources.ignore', removeEl(formApi.values.spec.orphanedResources.ignore, i))} - /> -
- ))} + ))} +
- - ) : ( - )