Merge branch 'master' into preview
This commit is contained in:
commit
bb2c79afa5
2
.env
2
.env
@ -6,7 +6,7 @@ VITE_APP_TITLE=Snail Job
|
||||
|
||||
VITE_APP_DESC=A flexible, reliable, and fast platform for distributed task retry and distributed task scheduling.
|
||||
|
||||
VITE_APP_VERSION=1.4.0-beta1
|
||||
VITE_APP_VERSION=1.4.0
|
||||
|
||||
VITE_APP_DEFAULT_TOKEN=SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { groupConfigStatusRecord, yesOrNoRecord } from '@/constants/business';
|
||||
import { $t } from '@/locales';
|
||||
import { tagColor } from '@/utils/common';
|
||||
|
||||
defineOptions({
|
||||
name: 'GroupDetailDrawer'
|
||||
});
|
||||
@ -17,6 +17,31 @@ defineProps<Props>();
|
||||
const visible = defineModel<boolean>('visible', {
|
||||
default: false
|
||||
});
|
||||
|
||||
const { copy, isSupported } = useClipboard();
|
||||
|
||||
async function handleCopy(source?: string) {
|
||||
if (!isSupported) {
|
||||
window.$message?.error('您的浏览器不支持 Clipboard API');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await copy(source);
|
||||
} else {
|
||||
const range = document.createRange();
|
||||
range.selectNode(document.getElementById('tokenDetailInput')!);
|
||||
const selection = window.getSelection();
|
||||
if (selection?.rangeCount) selection.removeAllRanges();
|
||||
selection?.addRange(range);
|
||||
document.execCommand('copy');
|
||||
}
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -26,7 +51,17 @@ const visible = defineModel<boolean>('visible', {
|
||||
{{ rowData?.groupName }}
|
||||
</NDescriptionsItem>
|
||||
|
||||
<NDescriptionsItem :label="$t('page.groupConfig.token')" :span="1">{{ rowData?.token }}</NDescriptionsItem>
|
||||
<NDescriptionsItem :span="1">
|
||||
<template #label>
|
||||
<div class="flex items-center gap-2">
|
||||
<span>{{ $t('page.groupConfig.token') }}</span>
|
||||
<NButton type="default" text @click="handleCopy(rowData?.token)">
|
||||
<icon-ic:round-content-copy class="text-icon" />
|
||||
</NButton>
|
||||
</div>
|
||||
</template>
|
||||
<span id="tokenDetailInput">{{ rowData?.token }}</span>
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem :label="$t('page.groupConfig.groupStatus')" :span="1">
|
||||
<NTag :type="tagColor(rowData?.groupStatus!)">{{ $t(groupConfigStatusRecord[rowData?.groupStatus!]) }}</NTag>
|
||||
</NDescriptionsItem>
|
||||
|
@ -172,7 +172,16 @@ async function handleCopy(source: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
await copy(source);
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await copy(source);
|
||||
} else {
|
||||
const range = document.createRange();
|
||||
range.selectNode(document.getElementById('tokenOperateInput')!);
|
||||
const selection = window.getSelection();
|
||||
if (selection?.rangeCount) selection.removeAllRanges();
|
||||
selection?.addRange(range);
|
||||
document.execCommand('copy');
|
||||
}
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
</script>
|
||||
@ -206,6 +215,7 @@ async function handleCopy(source: string) {
|
||||
<NFormItem :label="$t('page.groupConfig.token')" path="token">
|
||||
<NInputGroup>
|
||||
<NInput
|
||||
id="tokenOperateInput"
|
||||
v-model:value="model.token"
|
||||
:maxlength="64"
|
||||
:placeholder="$t('page.groupConfig.form.token')"
|
||||
|
@ -32,7 +32,16 @@ async function handleCopy(source: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
await copy(source);
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await copy(source);
|
||||
} else {
|
||||
const input = document.createElement('input');
|
||||
input.value = source;
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(input);
|
||||
}
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,16 @@ async function handleCopy(source: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
await copy(source);
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await copy(source);
|
||||
} else {
|
||||
const range = document.createRange();
|
||||
range.selectNode(document.getElementById('uniqueIdInput')!);
|
||||
const selection = window.getSelection();
|
||||
if (selection?.rangeCount) selection.removeAllRanges();
|
||||
selection?.addRange(range);
|
||||
document.execCommand('copy');
|
||||
}
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
</script>
|
||||
@ -135,6 +144,7 @@ async function handleCopy(source: string) {
|
||||
<NFormItem :label="$t('page.namespace.uniqueId')" path="uniqueId">
|
||||
<NInputGroup>
|
||||
<NInput
|
||||
id="uniqueIdInput"
|
||||
v-model:value="model.uniqueId"
|
||||
:disabled="props.operateType === 'edit'"
|
||||
:placeholder="$t('page.namespace.form.uniqueId')"
|
||||
|
@ -20,7 +20,7 @@ const visible = defineModel<boolean>('visible', {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DetailDrawer v-model="visible" :title="$t('page.retryLog.detail')" :width="['50%', '90%']">
|
||||
<DetailDrawer v-model="visible" :title="$t('page.retryTask.detail')" :width="['50%', '90%']">
|
||||
<NTabs type="segment" animated>
|
||||
<NTabPane :name="0" :tab="$t('page.log.info')">
|
||||
<NDescriptions label-placement="top" bordered :column="2">
|
||||
|
Loading…
Reference in New Issue
Block a user