Skip to content

Commit ed16e19

Browse files
committed
wip
1 parent 40f73b0 commit ed16e19

File tree

7 files changed

+77
-8
lines changed

7 files changed

+77
-8
lines changed

packages/entities/entities-redis-configurations/src/components/ClusterNodes.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<FieldArrayCardContainer
1111
v-for="(node, index) of nodes"
1212
:key="`${index}`"
13+
:disabled="readonly"
1314
@remove-item="removeItem(index)"
1415
>
1516
<div class="cluster-node-items">
@@ -20,6 +21,7 @@
2021
info: t('form.fields.cluster_node_ip.tooltip'),
2122
tooltipAttributes: { maxWidth: '400' },
2223
}"
24+
:readonly="readonly"
2325
required
2426
/>
2527
<KInput
@@ -29,12 +31,14 @@
2931
info: t('form.fields.cluster_node_port.tooltip'),
3032
tooltipAttributes: { maxWidth: '400' },
3133
}"
34+
:readonly="readonly"
3235
type="number"
3336
/>
3437
</div>
3538
</FieldArrayCardContainer>
3639
<KButton
3740
appearance="tertiary"
41+
:disabled="readonly"
3842
@click="addItem"
3943
>
4044
<AddCircleIcon />
@@ -52,6 +56,10 @@ import composables from '../composables'
5256
import type { ClusterNode, Identifiable } from '../types'
5357
import { genDefaultClusterNode } from '../helpers'
5458
59+
defineProps<{
60+
readonly?: boolean
61+
}>()
62+
5563
const nodes = defineModel<Identifiable<ClusterNode>[]>({ required: true })
5664
5765
const { i18n: { t } } = composables.useI18n()

packages/entities/entities-redis-configurations/src/components/FieldArrayCardContainer.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<KButton
88
appearance="tertiary"
99
class="array-card-remove-button"
10+
:disabled="disabled"
1011
@click="$emit('remove-item')"
1112
>
1213
<TrashIcon />
@@ -30,6 +31,10 @@ defineProps({
3031
type: Number,
3132
default: undefined,
3233
},
34+
disabled: {
35+
type: Boolean,
36+
default: false,
37+
},
3338
})
3439
3540
defineEmits<{

packages/entities/entities-redis-configurations/src/components/RedisConfigurationForm.vue

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
>
2222
<KSelect
2323
v-model="form.fields.mode"
24+
:disabled="isEdit"
2425
:items="typeOptions"
2526
:label="t('form.fields.type.label')"
27+
:readonly="form.readonly"
2628
required
2729
>
2830
<template #selected-item-template="{ item }">
@@ -39,6 +41,7 @@
3941
v-model.trim="form.fields.name"
4042
:label="t('form.fields.name.label')"
4143
:placeholder="t('form.fields.name.placeholder')"
44+
:readonly="form.readonly"
4245
required
4346
/>
4447
</EntityFormSection>
@@ -55,6 +58,7 @@
5558
info: t('form.fields.sentinel_master.tooltip'),
5659
tooltipAttributes: { maxWidth: '400' },
5760
}"
61+
:readonly="form.readonly"
5862
/>
5963
<KSelect
6064
v-model="form.fields.sentinel_role"
@@ -64,18 +68,24 @@
6468
info: t('form.fields.sentinel_role.tooltip'),
6569
tooltipAttributes: { maxWidth: '400' },
6670
}"
71+
:readonly="form.readonly"
72+
/>
73+
<SentinelNodes
74+
v-model="form.fields.sentinel_nodes"
75+
:readonly="form.readonly"
6776
/>
68-
<SentinelNodes v-model="form.fields.sentinel_nodes" />
6977
<KInput
7078
v-model.trim="form.fields.sentinel_username"
7179
:label="t('form.fields.sentinel_username.label')"
7280
:label-attributes="{
7381
info: t('form.fields.sentinel_username.tooltip'),
7482
tooltipAttributes: { maxWidth: '400' },
7583
}"
84+
:readonly="form.readonly"
7685
/>
7786
<VaultSecretPickerProvider
7887
class="secret-picker-provider"
88+
:disabled="form.readonly"
7989
:update="v => form.fields.sentinel_username = v"
8090
:value="form.fields.sentinel_username"
8191
@open="(value, update) => setUpVaultSecretPicker(value, update)"
@@ -87,10 +97,12 @@
8797
info: t('form.fields.sentinel_password.tooltip'),
8898
tooltipAttributes: { maxWidth: '400' },
8999
}"
100+
:readonly="form.readonly"
90101
type="password"
91102
/>
92103
<VaultSecretPickerProvider
93104
class="secret-picker-provider"
105+
:disabled="form.readonly"
94106
:update="v => form.fields.sentinel_password = v"
95107
:value="form.fields.sentinel_password"
96108
@open="(value, update) => setUpVaultSecretPicker(value, update)"
@@ -102,14 +114,18 @@
102114
:description="t('form.sections.cluster.description')"
103115
:title="t('form.sections.cluster.title')"
104116
>
105-
<ClusterNodes v-model="form.fields.cluster_nodes" />
117+
<ClusterNodes
118+
v-model="form.fields.cluster_nodes"
119+
:readonly="form.readonly"
120+
/>
106121
<KInput
107122
v-model="form.fields.cluster_max_redirections"
108123
:label="t('form.fields.cluster_max_redirections.label')"
109124
:label-attributes="{
110125
info: t('form.fields.cluster_max_redirections.tooltip'),
111126
tooltipAttributes: { maxWidth: '400' },
112127
}"
128+
:readonly="form.readonly"
113129
type="number"
114130
/>
115131
</EntityFormSection>
@@ -126,7 +142,7 @@
126142
info: t('form.fields.host.tooltip'),
127143
tooltipAttributes: { maxWidth: '400' },
128144
}"
129-
required
145+
:readonly="form.readonly"
130146
/>
131147
<KInput
132148
v-if="form.fields.mode === Mode.HOST_PORT_OPEN_SOURCE || form.fields.mode === Mode.HOST_PORT_ENTERPRISE"
@@ -136,12 +152,14 @@
136152
info: t('form.fields.port.tooltip'),
137153
tooltipAttributes: { maxWidth: '400' },
138154
}"
155+
:readonly="form.readonly"
139156
type="number"
140157
/>
141158

142159
<KCheckbox
143160
v-if="form.fields.mode === Mode.HOST_PORT_ENTERPRISE"
144161
v-model="form.fields.connection_is_proxied"
162+
:disabled="form.readonly"
145163
:label="t('form.fields.connection_is_proxied.label')"
146164
:label-attributes="{
147165
info: t('form.fields.connection_is_proxied.tooltip'),
@@ -157,6 +175,7 @@
157175
info: t('form.fields.timeout.tooltip'),
158176
tooltipAttributes: { maxWidth: '400' },
159177
}"
178+
:readonly="form.readonly"
160179
type="number"
161180
/>
162181

@@ -167,6 +186,7 @@
167186
info: t('form.fields.database.tooltip'),
168187
tooltipAttributes: { maxWidth: '400' },
169188
}"
189+
:readonly="form.readonly"
170190
type="number"
171191
/>
172192
<KInput
@@ -176,9 +196,11 @@
176196
info: t('form.fields.username.tooltip'),
177197
tooltipAttributes: { maxWidth: '400' },
178198
}"
199+
:readonly="form.readonly"
179200
/>
180201
<VaultSecretPickerProvider
181202
class="secret-picker-provider"
203+
:disabled="form.readonly"
182204
:update="v => form.fields.username = v"
183205
:value="form.fields.username"
184206
@open="(value, update) => setUpVaultSecretPicker(value, update)"
@@ -190,10 +212,12 @@
190212
info: t('form.fields.password.tooltip'),
191213
tooltipAttributes: { maxWidth: '400' },
192214
}"
215+
:readonly="form.readonly"
193216
type="password"
194217
/>
195218
<VaultSecretPickerProvider
196219
class="secret-picker-provider"
220+
:disabled="form.readonly"
197221
:update="v => form.fields.password = v"
198222
:value="form.fields.password"
199223
@open="(value, update) => setUpVaultSecretPicker(value, update)"
@@ -207,11 +231,13 @@
207231
<KCheckbox
208232
v-model="form.fields.ssl"
209233
:description="t('form.fields.ssl.description')"
234+
:disabled="form.readonly"
210235
:label="t('form.fields.ssl.label')"
211236
/>
212237
<KCheckbox
213238
v-model="form.fields.ssl_verify"
214239
:description="t('form.fields.ssl_verify.description')"
240+
:disabled="form.readonly"
215241
:label="t('form.fields.ssl_verify.label')"
216242
/>
217243
<KInput
@@ -221,6 +247,7 @@
221247
info: t('form.fields.server_name.tooltip'),
222248
tooltipAttributes: { maxWidth: '400' },
223249
}"
250+
:readonly="form.readonly"
224251
/>
225252
</EntityFormSection>
226253

@@ -236,6 +263,7 @@
236263
info: t('form.fields.keepalive_backlog.tooltip'),
237264
tooltipAttributes: { maxWidth: '400' },
238265
}"
266+
:readonly="form.readonly"
239267
type="number"
240268
/>
241269
<KInput
@@ -245,6 +273,7 @@
245273
info: t('form.fields.keepalive_pool_size.tooltip'),
246274
tooltipAttributes: { maxWidth: '400' },
247275
}"
276+
:readonly="form.readonly"
248277
type="number"
249278
/>
250279
</EntityFormSection>
@@ -257,16 +286,19 @@
257286
<KInput
258287
v-model="form.fields.read_timeout"
259288
:label="t('form.fields.read_timeout.label')"
289+
:readonly="form.readonly"
260290
type="number"
261291
/>
262292
<KInput
263293
v-model="form.fields.send_timeout"
264294
:label="t('form.fields.send_timeout.label')"
295+
:readonly="form.readonly"
265296
type="number"
266297
/>
267298
<KInput
268299
v-model="form.fields.connect_timeout"
269300
:label="t('form.fields.connect_timeout.label')"
301+
:readonly="form.readonly"
270302
type="number"
271303
/>
272304
</EntityFormSection>
@@ -357,7 +389,10 @@ const {
357389
form,
358390
canSubmit,
359391
payload,
360-
} = useRedisConfigurationForm()
392+
isEdit,
393+
} = useRedisConfigurationForm({
394+
partialId: props.partialId,
395+
})
361396
</script>
362397

363398
<style lang="scss" scoped>

packages/entities/entities-redis-configurations/src/components/SentinelNodes.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<FieldArrayCardContainer
1111
v-for="(node, index) of nodes"
1212
:key="node.id"
13+
:disabled="readonly"
1314
@remove-item="removeItem(index)"
1415
>
1516
<div class="sentinel-node-items">
@@ -20,6 +21,7 @@
2021
info: t('form.fields.sentinel_node_host.tooltip'),
2122
tooltipAttributes: { maxWidth: '400' },
2223
}"
24+
:readonly="readonly"
2325
required
2426
/>
2527
<KInput
@@ -29,12 +31,14 @@
2931
info: t('form.fields.sentinel_node_port.tooltip'),
3032
tooltipAttributes: { maxWidth: '400' },
3133
}"
34+
:readonly="readonly"
3235
type="number"
3336
/>
3437
</div>
3538
</FieldArrayCardContainer>
3639
<KButton
3740
appearance="tertiary"
41+
:disabled="readonly"
3842
@click="addItem"
3943
>
4044
<AddCircleIcon />
@@ -52,6 +56,10 @@ import composables from '../composables'
5256
import type { Identifiable, SentinelNode } from '../types'
5357
import { genDefaultSentinelNode } from '../helpers'
5458
59+
defineProps<{
60+
readonly?: boolean
61+
}>()
62+
5563
const nodes = defineModel<Identifiable<SentinelNode>[]>({ required: true })
5664
5765
const { i18n: { t } } = composables.useI18n()

packages/entities/entities-redis-configurations/src/composables/useRedisConfigurationForm.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import { shallowCopyWithoutId } from '../helpers'
55

66
import type { RedisConfigurationFormState } from '../types'
77

8-
export const useRedisConfigurationForm = () => {
8+
export type Options = {
9+
partialId?: string
10+
}
11+
12+
export const useRedisConfigurationForm = (options: Options) => {
13+
const { partialId } = options
14+
const isEdit = !!partialId
915
const form = reactive<RedisConfigurationFormState>({
1016
fields: {
1117
name: '',
@@ -139,5 +145,6 @@ export const useRedisConfigurationForm = () => {
139145
form,
140146
canSubmit,
141147
payload,
148+
isEdit,
142149
}
143150
}

packages/entities/entities-redis-configurations/src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"tooltip": "Sentinel password to authenticate with a Redis Sentinel instance. If undefined, no AUTH commands are sent to Redis Sentinels."
109109
},
110110
"cluster_node_ip": {
111-
"label": "Ip",
111+
"label": "IP",
112112
"tooltip": "A string representing a host name, such as example.com."
113113
},
114114
"cluster_node_port": {

packages/entities/entities-vaults/src/components/VaultSecretPickerProvider.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
>
77
<template #cta>
88
<span
9-
class="vault-secret-picker-provider-action"
10-
@click="() => emit('open', props.value, props.update)"
9+
:class="{ 'vault-secret-picker-provider-action': true, 'disabled': props.disabled }"
10+
@click="() => !props.disabled && emit('open', props.value, props.update)"
1111
>
1212
{{ t('vault_secret_picker.provider.cta') }}
1313
</span>
@@ -21,6 +21,7 @@ import composables from '../composables'
2121
2222
type Props = {
2323
value: string
24+
disabled?: boolean
2425
update: (value: string) => void
2526
}
2627
@@ -41,6 +42,11 @@ const { i18n: { t }, i18nT } = composables.useI18n()
4142
&-action {
4243
color: $kui-color-text-primary;
4344
cursor: pointer;
45+
46+
&.disabled {
47+
color: $kui-color-text-disabled;
48+
cursor: not-allowed;
49+
}
4450
}
4551
}
4652
</style>

0 commit comments

Comments
 (0)