From be645db4c12e0c1feb11b629df3e81af65027a14 Mon Sep 17 00:00:00 2001 From: Bikash <31549600+tulsiojha@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:59:21 +0530 Subject: [PATCH] Helm related fixes (#338) * fixed helm manual url input issue * fixed ts issues * added managed by helm in secret --- gql-queries-generator/doc/queries.graphql | 22 +-- .../page-components/secret-resource-v2.tsx | 35 ++++- .../secret.$secret/resources.tsx | 23 +++- .../$environment+/secret.$secret/route.tsx | 9 +- .../services/exposed-service.tsx | 130 ++++++++++++++++++ .../services/handle-intercept-service.tsx | 22 +-- .../services/services-resource-v2.tsx | 56 ++++---- .../workloads+/apps/handle-intercept.tsx | 1 + .../$environment+/workloads+/apps/network.tsx | 5 +- .../$helmchart+/settings+/values/route.tsx | 80 +++++------ .../helm-utils/use-fetch-helmcharts.tsx | 2 +- .../workloads+/new-helm-chart/route.tsx | 44 +++--- .../$account+/new-managed-service/_index.tsx | 31 ++--- .../managed-service-layout-v2.tsx | 100 +++++++------- .../console/server/gql/queries/app-queries.ts | 18 +-- .../cluster-managed-services-queries.ts | 28 +--- .../server/gql/queries/secret-queries.ts | 12 +- .../gql/queries/service-binding-queries.ts | 44 ++++-- src/generated/gql/sdl.graphql | 24 ++-- src/generated/gql/server.ts | 43 +++--- 20 files changed, 459 insertions(+), 270 deletions(-) create mode 100644 src/apps/console/routes/_main+/$account+/env+/$environment+/services/exposed-service.tsx diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index c51017d02..5d9ac45d0 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -1033,6 +1033,7 @@ query consoleGetApp($envName: String!, $name: String!) { portMappings { devicePort appPort + protocol } } nodeSelector @@ -1215,6 +1216,7 @@ query consoleListApps($envName: String!, $pq: CursorPaginationIn, $search: Searc portMappings { appPort devicePort + protocol } toDevice } @@ -1668,6 +1670,7 @@ query consoleListSecrets($envName: String!, $search: SearchSecrets, $pq: CursorP } creationTime displayName + createdByHelm stringData environmentName isReadyOnly @@ -1714,6 +1717,7 @@ query consoleGetSecret($envName: String!, $name: String!) { environmentName immutable markedForDeletion + createdByHelm metadata { annotations creationTimestamp @@ -3037,19 +3041,11 @@ query consoleGetClusterMSv($name: String!) { recordVersion spec { msvcSpec { - nodeSelector serviceTemplate { apiVersion kind spec } - tolerations { - effect - key - operator - tolerationSeconds - value - } } targetNamespace } @@ -3116,19 +3112,11 @@ query consoleListClusterMSvs($pagination: CursorPaginationIn, $search: SearchClu recordVersion spec { msvcSpec { - nodeSelector serviceTemplate { apiVersion kind spec } - tolerations { - effect - key - operator - tolerationSeconds - value - } } targetNamespace } @@ -4525,7 +4513,7 @@ query consoleListServiceBinding($envName: String!, $pagination: CursorPagination interceptStatus { intercepted portMappings { - containerPort + devicePort servicePort } toAddr diff --git a/src/apps/console/page-components/secret-resource-v2.tsx b/src/apps/console/page-components/secret-resource-v2.tsx index 2c15311ea..663739421 100644 --- a/src/apps/console/page-components/secret-resource-v2.tsx +++ b/src/apps/console/page-components/secret-resource-v2.tsx @@ -27,6 +27,7 @@ import ListV2 from '../components/listV2'; import ResourceExtraAction from '../components/resource-extra-action'; import { useConsoleApi } from '../server/gql/api-provider'; import { ISecrets } from '../server/gql/queries/secret-queries'; +import { Chip } from '@kloudlite/design-system/atoms/chips'; const RESOURCE_NAME = 'secret'; type BaseType = ExtractNodeType; @@ -48,12 +49,21 @@ const parseItem = (item: BaseType) => { author: `Updated by ${titleCase(parseUpdateOrCreatedBy(item))}`, time: parseUpdateOrCreatedOn(item), }, + createdByHelm: item.createdByHelm, }; }; -const ExtraButton = ({ onDelete }: { onDelete: () => void }) => { +const ExtraButton = ({ + onDelete, + item, +}: { + onDelete: () => void; + item: BaseType; +}) => { + console.log(item); return ( { onDelete(item); }} + item={item} /> ) } @@ -165,11 +176,17 @@ const ListView = ({ name: 'name', className: listClass.title, }, + { + render: () => 'Managed by', + name: 'managedBy', + className: 'flex-1 min-w-[30px] flex items-center justify-center', + }, { render: () => 'Entries', name: 'entries', className: 'flex-1 min-w-[30px] flex items-center justify-center', }, + { render: () => 'Updated', name: 'updated', @@ -182,7 +199,7 @@ const ListView = ({ }, ], rows: items.map((i) => { - const { name, id, entries, updateInfo } = parseItem(i); + const { name, id, entries, updateInfo, createdByHelm } = parseItem(i); return { onClick: () => { onClick(i); @@ -193,6 +210,12 @@ const ListView = ({ name: { render: () => , }, + managedBy: { + render: () => + createdByHelm ? ( + + ) : null, + }, entries: { render: () => , }, @@ -209,7 +232,7 @@ const ListView = ({ ? { action: { render: () => ( - onDelete(i)} /> + onDelete(i)} item={i} /> ), }, } @@ -233,7 +256,7 @@ const SecretResourcesV2 = ({ linkComponent = null, }: Omit) => { const [showDeleteDialog, setShowDeleteDialog] = useState( - null + null, ); const api = useConsoleApi(); @@ -245,9 +268,9 @@ const SecretResourcesV2 = ({ useWatchReload( items.map((i) => { return `account:${account}.environment:${environment}.secret:${parseName( - i + i, )}`; - }) + }), ); const props: IResource = { diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/resources.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/resources.tsx index 4aaf9cd9c..15cdd29c1 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/resources.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/resources.tsx @@ -17,6 +17,9 @@ import { IShowDialog, } from '~/console/components/types.d'; import Handle from './handle'; +import { ISecret, ISecrets } from '~/console/server/gql/queries/secret-queries'; +import { ExtractNodeType } from '~/console/server/r-utils/common'; +import { NN } from '~/root/lib/types/common'; // const RESOURCE_NAME = 'secret'; @@ -26,6 +29,7 @@ interface IResourceBase { deleteItem: (item: ICSBase) => void; restoreItem: (item: ICSBase) => void; searchText: string; + orgItem: ISecret; } interface IShowSecretDialog extends Omit { @@ -51,13 +55,15 @@ type OnAction = ({ type IExtraButton = { onAction: OnAction; item: [string, ICSValueExtended]; + orgItem: ISecret; }; -const ExtraButton = ({ onAction, item }: IExtraButton) => { +const ExtraButton = ({ onAction, item, orgItem }: IExtraButton) => { const iconSize = 16; return item[1].newvalue || item[1].delete ? ( { /> ) : ( { +const ListView = ({ items, onAction, onShow, orgItem }: IResource) => { return ( { ), }, action: { - render: () => , + render: () => ( + + ), }, }, }; @@ -238,6 +251,7 @@ const SecretItemResources = ({ deleteItem, editItem, restoreItem, + orgItem, }: IResourceBase) => { const [showSecret, setShowSecret] = useState({ show: false, @@ -259,7 +273,7 @@ const SecretItemResources = ({ return true; } return false; - }) + }), ); }, [searchText, modifiedItems]); @@ -281,6 +295,7 @@ const SecretItemResources = ({ deleteItem, editItem, restoreItem, + orgItem, onShow, onAction: ({ action, item }) => { const data = { diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/route.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/route.tsx index 6f6371ef6..8d6cb02dc 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/route.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/route.tsx @@ -81,7 +81,7 @@ const ConfigBody = ({ secret }: { secret: ISecret }) => { newvalue: null, }, }; - }, {}) + }, {}), ); } catch { // @@ -97,7 +97,7 @@ const ConfigBody = ({ secret }: { secret: ISecret }) => { (mi) => mi.delete || mi.insert || - (mi.newvalue != null && mi.newvalue !== mi.value) + (mi.newvalue != null && mi.newvalue !== mi.value), ).length; }; @@ -123,7 +123,7 @@ const ConfigBody = ({ secret }: { secret: ISecret }) => { data: modifiedItems, }) } - disabled={success} + disabled={success || !!secret.createdByHelm} /> {changesCount() > 0 && !success && (