Skip to content

Commit 33b90e3

Browse files
authored
feat: Webhook URL default hidden display (#11803)
1 parent e1e2b97 commit 33b90e3

1 file changed

Lines changed: 80 additions & 4 deletions

File tree

  • frontend/src/views/setting/alert/setting

frontend/src/views/setting/alert/setting/index.vue

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,22 @@
158158
{{ weComConfig.config.displayName }}
159159
</el-form-item>
160160
<el-form-item :label="$t('xpack.alert.webhookUrl')" prop="url">
161-
{{ weComConfig.config.url }}
161+
<div class="webhook-field">
162+
<template v-if="weComUrlVisible">
163+
<el-tooltip :content="weComConfig.config.url" placement="top" effect="dark">
164+
<span class="webhook-text">
165+
{{ weComConfig.config.url }}
166+
</span>
167+
</el-tooltip>
168+
</template>
169+
<template v-else>
170+
<span class="webhook-text">****************</span>
171+
</template>
172+
<el-icon class="webhook-icon" @click="weComUrlVisible = !weComUrlVisible">
173+
<Hide v-if="!weComUrlVisible" />
174+
<View v-else />
175+
</el-icon>
176+
</div>
162177
</el-form-item>
163178
</el-form>
164179
</div>
@@ -208,7 +223,26 @@
208223
{{ dingTalkConfig.config.displayName }}
209224
</el-form-item>
210225
<el-form-item :label="$t('xpack.alert.webhookUrl')" prop="url">
211-
{{ dingTalkConfig.config.url }}
226+
<div class="webhook-field">
227+
<template v-if="dingTalkUrlVisible">
228+
<el-tooltip
229+
:content="dingTalkConfig.config.url"
230+
placement="top"
231+
effect="dark"
232+
>
233+
<span class="webhook-text">
234+
{{ dingTalkConfig.config.url }}
235+
</span>
236+
</el-tooltip>
237+
</template>
238+
<template v-else>
239+
<span class="webhook-text">****************</span>
240+
</template>
241+
<el-icon class="webhook-icon" @click="dingTalkUrlVisible = !dingTalkUrlVisible">
242+
<Hide v-if="!dingTalkUrlVisible" />
243+
<View v-else />
244+
</el-icon>
245+
</div>
212246
</el-form-item>
213247
</el-form>
214248
</div>
@@ -258,7 +292,26 @@
258292
{{ feiShuConfig.config.displayName }}
259293
</el-form-item>
260294
<el-form-item :label="$t('xpack.alert.webhookUrl')" prop="url">
261-
{{ feiShuConfig.config.url }}
295+
<div class="webhook-field">
296+
<template v-if="feiShuUrlVisible">
297+
<el-tooltip
298+
:content="feiShuConfig.config.url"
299+
placement="top"
300+
effect="dark"
301+
>
302+
<span class="webhook-text">
303+
{{ feiShuConfig.config.url }}
304+
</span>
305+
</el-tooltip>
306+
</template>
307+
<template v-else>
308+
<span class="webhook-text">****************</span>
309+
</template>
310+
<el-icon class="webhook-icon" @click="feiShuUrlVisible = !feiShuUrlVisible">
311+
<Hide v-if="!feiShuUrlVisible" />
312+
<View v-else />
313+
</el-icon>
314+
</div>
262315
</el-form-item>
263316
</el-form>
264317
</div>
@@ -318,10 +371,11 @@
318371
</template>
319372

320373
<script lang="ts" setup>
321-
import { computed, onMounted, ref } from 'vue';
374+
import { computed, onMounted, ref, Ref } from 'vue';
322375
import { GlobalStore } from '@/store';
323376
import { ListAlertConfigs, DeleteAlertConfig, UpdateAlertConfig } from '@/api/modules/alert';
324377
import { ElMessageBox, FormInstance } from 'element-plus';
378+
import { View, Hide } from '@element-plus/icons-vue';
325379
import Phone from '@/views/setting/alert/setting/phone/index.vue';
326380
import SendTimeRange from '@/views/setting/alert/setting/time-range/index.vue';
327381
import i18n from '@/lang';
@@ -432,6 +486,10 @@ const defaultFeiShuConfig: Alert.WebhookConfig = {
432486
};
433487
const feiShuConfig = ref<Alert.WebhookConfig>({ ...defaultFeiShuConfig });
434488
489+
const weComUrlVisible = ref(false);
490+
const dingTalkUrlVisible = ref(false);
491+
const feiShuUrlVisible = ref(false);
492+
435493
const config = ref<Alert.AlertConfigInfo>({
436494
id: 0,
437495
type: '',
@@ -635,4 +693,22 @@ onMounted(async () => {
635693
margin-bottom: 0 !important;
636694
}
637695
}
696+
.webhook-field {
697+
display: inline-flex;
698+
align-items: center;
699+
gap: 6px;
700+
max-width: 100%;
701+
}
702+
.webhook-text {
703+
max-width: 100%;
704+
word-break: break-all;
705+
white-space: normal;
706+
}
707+
.webhook-icon {
708+
cursor: pointer;
709+
color: var(--el-text-color-secondary);
710+
}
711+
.webhook-icon:hover {
712+
color: var(--el-color-primary);
713+
}
638714
</style>

0 commit comments

Comments
 (0)