|
1 | 1 | <template>
|
2 |
| - <BkDropdownItem |
3 |
| - v-db-console="'redis.haClusterManage.extractKey'" |
4 |
| - @click="handleShowExtract(selected)"> |
| 2 | + <BkDropdownItem v-db-console="'redis.haClusterManage.extractKey'"> |
5 | 3 | <BkButton
|
6 | 4 | v-bk-tooltips="{
|
7 | 5 | disabled: !batchOperationDisabled,
|
|
10 | 8 | }"
|
11 | 9 | class="opration-button"
|
12 | 10 | :disabled="batchOperationDisabled"
|
13 |
| - text> |
| 11 | + text |
| 12 | + @click="handleToToolbox(TicketTypes.REDIS_KEYS_EXTRACT, selected)"> |
14 | 13 | {{ t('提取Key') }}
|
15 | 14 | </BkButton>
|
16 | 15 | </BkDropdownItem>
|
17 |
| - <BkDropdownItem |
18 |
| - v-db-console="'redis.haClusterManage.deleteKey'" |
19 |
| - @click="handlShowDeleteKeys(selected)"> |
| 16 | + <BkDropdownItem v-db-console="'redis.haClusterManage.deleteKey'"> |
20 | 17 | <BkButton
|
21 | 18 | v-bk-tooltips="{
|
22 | 19 | disabled: !batchOperationDisabled,
|
|
25 | 22 | }"
|
26 | 23 | class="opration-button"
|
27 | 24 | :disabled="batchOperationDisabled"
|
28 |
| - text> |
| 25 | + text |
| 26 | + @click="handleToToolbox(TicketTypes.REDIS_KEYS_DELETE, selected)"> |
29 | 27 | {{ t('删除Key') }}
|
30 | 28 | </BkButton>
|
31 | 29 | </BkDropdownItem>
|
32 |
| - <BkDropdownItem |
33 |
| - v-db-console="'redis.haClusterManage.backup'" |
34 |
| - @click="handleShowBackup(selected)"> |
| 30 | + <BkDropdownItem v-db-console="'redis.haClusterManage.backup'"> |
35 | 31 | <BkButton
|
36 | 32 | v-bk-tooltips="{
|
37 | 33 | disabled: !batchOperationDisabled,
|
|
40 | 36 | }"
|
41 | 37 | class="opration-button"
|
42 | 38 | :disabled="batchOperationDisabled"
|
43 |
| - text> |
| 39 | + text |
| 40 | + @click="handleToToolbox(TicketTypes.REDIS_BACKUP, selected)"> |
44 | 41 | {{ t('备份') }}
|
45 | 42 | </BkButton>
|
46 | 43 | </BkDropdownItem>
|
47 |
| - <BkDropdownItem |
48 |
| - v-db-console="'redis.haClusterManage.dbClear'" |
49 |
| - @click="handleShowPurge(selected)"> |
| 44 | + <BkDropdownItem v-db-console="'redis.haClusterManage.dbClear'"> |
50 | 45 | <BkButton
|
51 | 46 | v-bk-tooltips="{
|
52 | 47 | disabled: !batchOperationDisabled,
|
|
55 | 50 | }"
|
56 | 51 | class="opration-button"
|
57 | 52 | :disabled="batchOperationDisabled"
|
58 |
| - text> |
| 53 | + text |
| 54 | + @click="handleToToolbox(TicketTypes.REDIS_PURGE, selected)"> |
59 | 55 | {{ t('清档') }}
|
60 | 56 | </BkButton>
|
61 | 57 | </BkDropdownItem>
|
|
119 | 115 | {{ t('删除') }}
|
120 | 116 | </BkButton>
|
121 | 117 | </BkDropdownItem>
|
122 |
| - <!-- 提取 keys --> |
123 |
| - <ExtractKeys |
124 |
| - v-model:is-show="extractState.isShow" |
125 |
| - :data="extractState.data" |
126 |
| - @success="handleExtractKeysSuccess" /> |
127 |
| - <!-- 删除 keys --> |
128 |
| - <DeleteKeys |
129 |
| - v-model:is-show="deleteKeyState.isShow" |
130 |
| - :data="deleteKeyState.data" |
131 |
| - @success="handleDeleteKeysSuccess" /> |
132 |
| - <!-- 备份 --> |
133 |
| - <RedisBackup |
134 |
| - v-model:is-show="backupState.isShow" |
135 |
| - :data="backupState.data" |
136 |
| - @success="handleBackupSuccess" /> |
137 |
| - <!-- 清档 --> |
138 |
| - <RedisPurge |
139 |
| - v-model:is-show="purgeState.isShow" |
140 |
| - :data="purgeState.data" |
141 |
| - @success="handlePurgeSuccess" /> |
142 | 118 | <ClusterBatchAddTag
|
143 | 119 | v-model:is-show="showClusterBatchAddTag"
|
144 | 120 | :selected="selected"
|
|
158 | 134 |
|
159 | 135 | import ClusterBatchAddTag from '@views/db-manage/common/cluster-batch-add-tag/Index.vue';
|
160 | 136 | import ClusterBatchRemoveTag from '@views/db-manage/common/cluster-batch-remove-tag/Index.vue';
|
161 |
| - import { useOperateClusterBasic } from '@views/db-manage/common/hooks'; |
162 |
| - import { useShowBackup } from '@views/db-manage/common/redis-backup/hooks/useShowBackup'; |
163 |
| - import RedisBackup from '@views/db-manage/common/redis-backup/Index.vue'; |
164 |
| - import { useShowDeleteKeys } from '@views/db-manage/common/redis-delete-keys/hooks/useShowDeleteKeys'; |
165 |
| - import DeleteKeys from '@views/db-manage/common/redis-delete-keys/Index.vue'; |
166 |
| - import { useShowExtractKeys } from '@views/db-manage/common/redis-extract-keys/hooks/useShowExtractKeys'; |
167 |
| - import ExtractKeys from '@views/db-manage/common/redis-extract-keys/Index.vue'; |
168 |
| - import { useShowPurge } from '@views/db-manage/common/redis-purge/hooks/useShowPurge'; |
169 |
| - import RedisPurge from '@views/db-manage/common/redis-purge/Index.vue'; |
| 137 | + import { useOperateClusterBasic, useRedisClusterListToToolbox } from '@views/db-manage/common/hooks'; |
170 | 138 |
|
171 | 139 | interface Props {
|
172 | 140 | selected: RedisModel[];
|
|
177 | 145 | defineOptions({
|
178 | 146 | name: ClusterTypes.REDIS_INSTANCE,
|
179 | 147 | });
|
| 148 | +
|
180 | 149 | const props = defineProps<Props>();
|
181 | 150 | const emits = defineEmits<Emits>();
|
182 |
| - const sideSliderShow = defineModel<boolean>('side-slider-show', { |
183 |
| - required: true, |
184 |
| - }); |
185 | 151 |
|
186 | 152 | const { t } = useI18n();
|
187 |
| - const { handleShow: handleShowExtract, state: extractState } = useShowExtractKeys(); |
188 |
| - const { handleShow: handlShowDeleteKeys, state: deleteKeyState } = useShowDeleteKeys(); |
189 |
| - const { handleShow: handleShowBackup, state: backupState } = useShowBackup(); |
190 |
| - const { handleShow: handleShowPurge, state: purgeState } = useShowPurge(); |
| 153 | + const { handleToToolbox } = useRedisClusterListToToolbox(); |
| 154 | +
|
191 | 155 | const { handleDeleteCluster, handleDisableCluster, handleEnableCluster } = useOperateClusterBasic(
|
192 | 156 | ClusterTypes.REDIS_INSTANCE,
|
193 | 157 | {
|
|
226 | 190 | props.selected.every((data) => data.permission[`${data.db_type}_edit` as keyof typeof data.permission]),
|
227 | 191 | );
|
228 | 192 |
|
229 |
| - watch( |
230 |
| - () => [extractState.isShow, deleteKeyState.isShow, backupState.isShow, purgeState.isShow], |
231 |
| - () => { |
232 |
| - sideSliderShow.value = extractState.isShow || deleteKeyState.isShow || backupState.isShow || purgeState.isShow; |
233 |
| - }, |
234 |
| - ); |
235 |
| -
|
236 | 193 | const handleSuccess = () => {
|
237 | 194 | emits('success');
|
238 | 195 | };
|
239 |
| -
|
240 |
| - const handleExtractKeysSuccess = () => { |
241 |
| - extractState.isShow = false; |
242 |
| - handleSuccess(); |
243 |
| - }; |
244 |
| -
|
245 |
| - const handleDeleteKeysSuccess = () => { |
246 |
| - deleteKeyState.isShow = false; |
247 |
| - handleSuccess(); |
248 |
| - }; |
249 |
| -
|
250 |
| - const handleBackupSuccess = () => { |
251 |
| - backupState.isShow = false; |
252 |
| - handleSuccess(); |
253 |
| - }; |
254 |
| -
|
255 |
| - const handlePurgeSuccess = () => { |
256 |
| - purgeState.isShow = false; |
257 |
| - handleSuccess(); |
258 |
| - }; |
259 | 196 | </script>
|
0 commit comments