@orsetra/shared-ui 1.5.17 → 1.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,8 +14,9 @@ export interface EnvironmentPickerDialogProps {
|
|
|
14
14
|
onOpenChange: (open: boolean) => void
|
|
15
15
|
projectName: string
|
|
16
16
|
fetchEnvironments: (projectName: string) => Promise<{ envs: Environment[] }>
|
|
17
|
-
onSelect: (envName: string) => void
|
|
17
|
+
onSelect: (envName: string, envAlias: string) => void
|
|
18
18
|
excludeEnvs?: string[]
|
|
19
|
+
includeEnvs?: string[]
|
|
19
20
|
title?: string
|
|
20
21
|
description?: string
|
|
21
22
|
}
|
|
@@ -27,6 +28,7 @@ export function EnvironmentPickerDialog({
|
|
|
27
28
|
fetchEnvironments,
|
|
28
29
|
onSelect,
|
|
29
30
|
excludeEnvs = [],
|
|
31
|
+
includeEnvs,
|
|
30
32
|
title = "Select an environment",
|
|
31
33
|
description,
|
|
32
34
|
}: EnvironmentPickerDialogProps) {
|
|
@@ -41,8 +43,10 @@ export function EnvironmentPickerDialog({
|
|
|
41
43
|
setLoading(true)
|
|
42
44
|
try {
|
|
43
45
|
const response = await fetchEnvironments(projectName)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
let all = response.envs || []
|
|
47
|
+
if (includeEnvs) all = all.filter((e) => includeEnvs.includes(e.name))
|
|
48
|
+
else if (excludeEnvs.length) all = all.filter((e) => !excludeEnvs.includes(e.name))
|
|
49
|
+
setEnvironments(all)
|
|
46
50
|
} catch {
|
|
47
51
|
// silent
|
|
48
52
|
} finally {
|
|
@@ -76,7 +80,7 @@ export function EnvironmentPickerDialog({
|
|
|
76
80
|
type="button"
|
|
77
81
|
className={`w-full text-left px-4 py-3 hover:bg-ibm-gray-10 transition-colors flex items-center gap-3 ${index !== environments.length - 1 ? "border-b border-ibm-gray-20" : ""}`}
|
|
78
82
|
onClick={() => {
|
|
79
|
-
onSelect(env.name)
|
|
83
|
+
onSelect(env.name, env.alias || env.name)
|
|
80
84
|
onOpenChange(false)
|
|
81
85
|
}}
|
|
82
86
|
>
|