Merge branch 'master' into preview
This commit is contained in:
commit
32c324df5f
2
.env
2
.env
@ -4,7 +4,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.2.0-beta2
|
||||
VITE_APP_VERSION=1.2.0
|
||||
|
||||
VITE_APP_DEFAULT_TOKEN=SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj
|
||||
|
||||
|
@ -4,6 +4,7 @@ import { NButton, NCode, NTag } from 'naive-ui';
|
||||
import hljs from 'highlight.js/lib/core';
|
||||
import json from 'highlight.js/lib/languages/json';
|
||||
import { ref, render } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { taskStatusRecord, taskStatusRecordOptions } from '@/constants/business';
|
||||
import { $t } from '@/locales';
|
||||
import { isNotNull, parseArgsJson, translateOptions } from '@/utils/common';
|
||||
@ -251,6 +252,18 @@ const { columns, searchParams, columnChecks, data, getData, loading, mobilePagin
|
||||
title: $t('page.jobBatch.jobTask.createDt'),
|
||||
align: 'left',
|
||||
minWidth: 130
|
||||
},
|
||||
{
|
||||
key: 'duration',
|
||||
title: $t('page.jobBatch.duration'),
|
||||
align: 'center',
|
||||
width: 120,
|
||||
render: row => {
|
||||
if (row.taskStatus === 3) {
|
||||
return Math.round(dayjs(row.updateDt).diff(dayjs(row.createDt)) / 1000);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
6
src/typings/api.d.ts
vendored
6
src/typings/api.d.ts
vendored
@ -125,7 +125,7 @@ declare namespace Api {
|
||||
interface LoginToken {
|
||||
id: string;
|
||||
mode: string;
|
||||
role: String;
|
||||
role: string;
|
||||
token: string;
|
||||
refreshToken: string;
|
||||
createDt: string;
|
||||
@ -934,7 +934,7 @@ declare namespace Api {
|
||||
>;
|
||||
|
||||
type ExportWorkflow = Common.CommonRecord<{
|
||||
workflowIds: String[];
|
||||
workflowIds: string[];
|
||||
}> &
|
||||
WorkflowSearchParams;
|
||||
|
||||
@ -1072,6 +1072,8 @@ declare namespace Api {
|
||||
children: JobTaskTree[];
|
||||
/** 是否存在下级 */
|
||||
isLeaf: boolean;
|
||||
/** 执行时长(virtual) */
|
||||
duration?: number;
|
||||
}>;
|
||||
|
||||
type JobTaskTree = {
|
||||
|
@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||
import { $t } from '@/locales';
|
||||
import { translateOptions, translateOptions2 } from '@/utils/common';
|
||||
@ -29,6 +30,7 @@ const visible = defineModel<boolean>('visible', {
|
||||
default: false
|
||||
});
|
||||
|
||||
const { copy, isSupported } = useClipboard();
|
||||
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||
const { defaultRequiredRule } = useFormRules();
|
||||
|
||||
@ -160,6 +162,20 @@ watch(visible, () => {
|
||||
restoreValidation();
|
||||
}
|
||||
});
|
||||
|
||||
async function handleCopy(source: string) {
|
||||
if (!isSupported) {
|
||||
window.$message?.error('您的浏览器不支持 Clipboard API');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
await copy(source);
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -196,9 +212,17 @@ watch(visible, () => {
|
||||
:placeholder="$t('page.groupConfig.form.token')"
|
||||
:disabled="props.operateType === 'edit'"
|
||||
/>
|
||||
<NTooltip trigger="hover">
|
||||
<NTooltip v-if="props.operateType === 'edit'" trigger="hover">
|
||||
<template #trigger>
|
||||
<NButton type="default" ghost :disabled="props.operateType === 'edit'" @click="setToken">
|
||||
<NButton type="default" ghost @click="handleCopy(model.token)">
|
||||
<icon-ic:round-content-copy class="text-icon" />
|
||||
</NButton>
|
||||
</template>
|
||||
复制
|
||||
</NTooltip>
|
||||
<NTooltip v-else trigger="hover">
|
||||
<template #trigger>
|
||||
<NButton type="default" ghost @click="setToken">
|
||||
<icon-ic-round-refresh class="text-icon" />
|
||||
</NButton>
|
||||
</template>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm } from 'naive-ui';
|
||||
import { NButton, NPopconfirm, NPopover } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { fetchDeleteNamespace, fetchGetNamespaceList } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
@ -14,12 +15,27 @@ import NamespaceSearch from './modules/namespace-search.vue';
|
||||
const appStore = useAppStore();
|
||||
const authStore = useAuthStore();
|
||||
const namespaceId = ref<string>(localStg.get('namespaceId')!);
|
||||
const { copy, isSupported } = useClipboard();
|
||||
|
||||
const handleChange = (uniqueId: string) => {
|
||||
namespaceId.value = uniqueId;
|
||||
authStore.setNamespaceId(uniqueId);
|
||||
};
|
||||
|
||||
async function handleCopy(source: string) {
|
||||
if (!isSupported) {
|
||||
window.$message?.error('您的浏览器不支持 Clipboard API');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
await copy(source);
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
|
||||
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
|
||||
apiFn: fetchGetNamespaceList,
|
||||
apiParams: {
|
||||
@ -59,7 +75,19 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'uniqueId',
|
||||
title: $t('page.namespace.uniqueId'),
|
||||
align: 'left',
|
||||
width: 180
|
||||
width: 180,
|
||||
render: row => (
|
||||
<NPopover>
|
||||
{{
|
||||
trigger: () => (
|
||||
<NButton text type="primary" onClick={() => handleCopy(row.uniqueId)}>
|
||||
{row.uniqueId}
|
||||
</NButton>
|
||||
),
|
||||
default: () => <span>点击复制</span>
|
||||
}}
|
||||
</NPopover>
|
||||
)
|
||||
},
|
||||
{
|
||||
key: 'createDt',
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { nanoid } from '@sa/utils';
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
||||
import { $t } from '@/locales';
|
||||
@ -26,6 +27,7 @@ interface Emits {
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const { copy, isSupported } = useClipboard();
|
||||
const authStore = useAuthStore();
|
||||
const visible = defineModel<boolean>('visible', {
|
||||
default: false
|
||||
@ -111,6 +113,20 @@ watch(visible, () => {
|
||||
restoreValidation();
|
||||
}
|
||||
});
|
||||
|
||||
async function handleCopy(source: string) {
|
||||
if (!isSupported) {
|
||||
window.$message?.error('您的浏览器不支持 Clipboard API');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
await copy(source);
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -123,9 +139,17 @@ watch(visible, () => {
|
||||
:disabled="props.operateType === 'edit'"
|
||||
:placeholder="$t('page.namespace.form.uniqueId')"
|
||||
/>
|
||||
<NTooltip trigger="hover">
|
||||
<NTooltip v-if="props.operateType === 'edit'" trigger="hover">
|
||||
<template #trigger>
|
||||
<NButton type="default" ghost :disabled="props.operateType === 'edit'" @click="setUniqueId">
|
||||
<NButton type="default" ghost @click="handleCopy(model.uniqueId)">
|
||||
<icon-ic:round-content-copy class="text-icon" />
|
||||
</NButton>
|
||||
</template>
|
||||
复制
|
||||
</NTooltip>
|
||||
<NTooltip v-else trigger="hover">
|
||||
<template #trigger>
|
||||
<NButton type="default" ghost @click="setUniqueId">
|
||||
<icon-ic-round-refresh class="text-icon" />
|
||||
</NButton>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user