Skip to content

Commit 436da94

Browse files
committed
feat(service-variables): enhance service variables management with new tabs and external secrets integration
1 parent 0474939 commit 436da94

File tree

6 files changed

+85
-21
lines changed

6 files changed

+85
-21
lines changed

apps/console-v5/src/routeTree.gen.ts

Lines changed: 52 additions & 4 deletions
Large diffs are not rendered by default.

apps/console-v5/src/routes/_authenticated/organization/$organizationId/project/$projectId/environment/$environmentId/service/$serviceId/variables.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { createFileRoute, useParams } from '@tanstack/react-router'
22
import { Suspense, useState } from 'react'
33
import { match } from 'ts-pattern'
4-
import { useDeployService, useService } from '@qovery/domains/services/feature'
4+
import {
5+
BuiltInTab,
6+
CustomTab,
7+
EXTERNAL_SECRETS_USE_CASES,
8+
ExternalSecretsTab,
9+
type ExternalSecretsUseCaseId,
10+
useDeployService,
11+
useService,
12+
} from '@qovery/domains/services/feature'
513
import { Heading, Icon, LoaderSpinner, Navbar, Section } from '@qovery/shared/ui'
614
import { useDocumentTitle } from '@qovery/shared/util-hooks'
7-
import { BuiltInTab } from './variables-built-in-tab'
8-
import { CustomTab } from './variables-custom-tab'
9-
import { ExternalSecretsTab } from './variables-external-secrets-tab'
15+
import { useUseCasePage } from '../../../../../../../../../../app/components/use-cases/use-case-context'
1016

1117
type VariableTab = 'custom' | 'external-secrets' | 'built-in'
1218

@@ -21,6 +27,11 @@ function RouteComponent() {
2127
useDocumentTitle('Service - Variables')
2228

2329
const [activeTab, setActiveTab] = useState<VariableTab>('custom')
30+
const { selectedCaseId } = useUseCasePage({
31+
pageId: 'service-variables-external-secrets',
32+
options: EXTERNAL_SECRETS_USE_CASES,
33+
defaultCaseId: 'filled',
34+
})
2435

2536
const { data: service } = useService({
2637
environmentId,
@@ -104,7 +115,9 @@ function RouteComponent() {
104115
toasterCallback={toasterCallback}
105116
/>
106117
)}
107-
{activeTab === 'external-secrets' && <ExternalSecretsTab />}
118+
{activeTab === 'external-secrets' && (
119+
<ExternalSecretsTab selectedCaseId={selectedCaseId as ExternalSecretsUseCaseId} />
120+
)}
108121
{activeTab === 'built-in' && scope && (
109122
<BuiltInTab
110123
scope={scope}

libs/domains/services/feature/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ export * from './lib/service-deployment-list/service-deployment-list-skeleton'
6666
export * from './lib/pod-details/pod-details'
6767
export * from './lib/force-unlock-modal/force-unlock-modal'
6868
export * from './lib/application-settings-resources/application-settings-resources'
69+
export * from './lib/service-variables-tabs/service-variables-built-in-tab'
70+
export * from './lib/service-variables-tabs/service-variables-custom-tab'
71+
export * from './lib/service-variables-tabs/service-variables-external-secrets-tab'

apps/console-v5/src/routes/_authenticated/organization/$organizationId/project/$projectId/environment/$environmentId/service/$serviceId/variables-built-in-tab.tsx renamed to libs/domains/services/feature/src/lib/service-variables-tabs/service-variables-built-in-tab.tsx

File renamed without changes.

apps/console-v5/src/routes/_authenticated/organization/$organizationId/project/$projectId/environment/$environmentId/service/$serviceId/variables-custom-tab.tsx renamed to libs/domains/services/feature/src/lib/service-variables-tabs/service-variables-custom-tab.tsx

File renamed without changes.

apps/console-v5/src/routes/_authenticated/organization/$organizationId/project/$projectId/environment/$environmentId/service/$serviceId/variables-external-secrets-tab.tsx renamed to libs/domains/services/feature/src/lib/service-variables-tabs/service-variables-external-secrets-tab.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ import {
3535
useModalConfirmation,
3636
} from '@qovery/shared/ui'
3737
import { pluralize, twMerge } from '@qovery/shared/util-js'
38-
import {
39-
type UseCaseOption,
40-
useUseCasePage,
41-
} from '../../../../../../../../../../app/components/use-cases/use-case-context'
4238

4339
const { Table } = TablePrimitives
4440

41+
export type ExternalSecretsUseCaseId =
42+
| 'filled'
43+
| 'secret-manager-addon-not-detected'
44+
| 'secret-manager-addon-no-manager'
45+
| 'secret-manager-addon-not-redeployed'
46+
| 'empty'
47+
4548
interface ExternalSecret {
4649
id: string
4750
name: string
@@ -131,7 +134,7 @@ const FAKE_SECRETS: ExternalSecret[] = [
131134

132135
const EMPTY_SECRETS: ExternalSecret[] = []
133136

134-
const EXTERNAL_SECRETS_USE_CASES: UseCaseOption[] = [
137+
export const EXTERNAL_SECRETS_USE_CASES: { id: ExternalSecretsUseCaseId; label: string }[] = [
135138
{ id: 'filled', label: 'Filled' },
136139
{ id: 'secret-manager-addon-not-detected', label: 'Secret manager add-on not detected' },
137140
{ id: 'secret-manager-addon-no-manager', label: 'Secret manager add-on with no manager' },
@@ -486,14 +489,11 @@ function AttachSecretsModal({ selectedCount, onClose, onAttach }: AttachSecretsM
486489
)
487490
}
488491

489-
export function ExternalSecretsTab() {
490-
const useCaseOptions = EXTERNAL_SECRETS_USE_CASES
491-
const { selectedCaseId } = useUseCasePage({
492-
pageId: 'service-variables-external-secrets',
493-
options: useCaseOptions,
494-
defaultCaseId: 'filled',
495-
})
492+
interface ExternalSecretsTabProps {
493+
selectedCaseId?: ExternalSecretsUseCaseId
494+
}
496495

496+
export function ExternalSecretsTab({ selectedCaseId = 'filled' }: ExternalSecretsTabProps) {
497497
const baseSecrets = useMemo(
498498
() =>
499499
match(selectedCaseId)

0 commit comments

Comments
 (0)