feat: 合并开发分支

This commit is contained in:
xlsea 2024-05-24 14:35:20 +08:00
commit d551686723
10 changed files with 56 additions and 45 deletions

4
.env
View File

@ -4,6 +4,8 @@ VITE_APP_DESC=A flexible, reliable, and fast platform for distributed task retry
VITE_APP_VERSION=1.0.0-beta2
VITE_APP_DEFAULT_TOKEN=SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj
# the prefix of the icon name
VITE_ICON_PREFIX=icon
@ -46,3 +48,5 @@ VITE_SOURCE_MAP=N
# Used to differentiate storage across different domains
VITE_STORAGE_PREFIX=

View File

@ -40,7 +40,7 @@ defineExpose({
</script>
<template>
<NPopover trigger="click" placement="bottom-start">
<NPopover class="cron-popover" trigger="click" placement="bottom-start">
<template #trigger>
<NInput v-bind="attrs" v-model:value="cron" />
</template>
@ -49,10 +49,7 @@ defineExpose({
</template>
<style>
.n-popover {
.cron-popover {
padding: 0 !important;
}
.n-popover .n-popover-shared .n-popover-arrow-wrapper .n-popover-arrow {
}
</style>

View File

@ -1,4 +1,4 @@
import{d as e,l as t,Y as a,Z as n,u as l,f as o,w as i,o as s,j as u,_ as d,k as r,$ as c,a0 as p,F as g,a1 as m,a2 as v,a3 as f,a4 as y,a5 as h,a6 as b,n as C,a7 as k,a8 as _,a9 as w,G as N,O as x,aa as S,B as V,ab as T,r as I,c as O,S as E}from"./vue--_kkPoVD.js";import{d as U,s as j,c as M,a as $}from"./pinia-_F_MrjSh.js";import{m as R,W as D,C as P,a as A,b as L,S as B,M as F,I as Y,L as z,_ as W,c as q,d as K,R as J,D as G,e as H,f as X,g as Z,B as Q,h as ee,i as te,j as ae,T as ne,k as le,P as oe,U as ie,l as se,n as ue,o as de,p as re,q as ce,r as pe,s as ge,t as me,u as ve,F as fe,v as ye,w as he,x as be,y as Ce,z as ke,A as _e,E as we,G as Ne,H as xe,J as Se,K as Ve,N as Te,O as Ie,Q as Oe,V as Ee,X as Ue,Y as je,Z as Me,$ as $e}from"./antdv-3leNc9CG.js";import{C as Re,j as De,o as Pe}from"./codemirror-tLd6xVyG.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const a of e)if("childList"===a.type)for(const e of a.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const Ae=U("main",{state:()=>({id:"",type:0,mode:"development",token:"",nameSpaceId:"",groupName:"",jobList:[]}),persist:!0,getters:{ID:e=>e.id,TYPE:e=>e.type,TOKEN:e=>e.token,NAME_SPACE_ID:e=>e.nameSpaceId,GROUP_NAME:e=>e.groupName,JOB_LIST:e=>e.jobList},actions:{clear(){this.id="",this.type=0,this.mode="development",this.token="",this.nameSpaceId="",this.groupName="",this.jobList=[]},setId(e){this.id=e},setType(e){this.type=e},setMode(e){this.mode=e},setToken(e){e&&(this.token=e.replace(/"|\\/g,""))},setNameSpaceId(e){e&&(this.nameSpaceId=e.replace(/"|\\/g,""))},setGroupName(e){this.groupName=e},setJobList(e){this.jobList=e}}}),Le=(e,t="get",a,n)=>{const l=Ae(),{token:o,nameSpaceId:i,mode:s}=j(l);return new Promise(((l,u)=>{fetch(("production"===s.value?"/snail-job":"/proxy-default")+e,{signal:n,method:t,headers:{"Content-Type":"application/json","Snail-Job-Auth":o.value,"Snail-Job-Namespace-Id":i.value},body:a?JSON.stringify(a):null}).then((e=>e.json())).then((e=>{1===e.status?(e.page&&l(e),l(e.data)):(R.error(e.message||"未知错误,请联系管理员"),u())})).catch((()=>{u()}))}))};
import{d as e,l as t,Y as a,Z as n,u as l,f as o,w as i,o as s,j as u,_ as d,k as r,$ as c,a0 as p,F as g,a1 as m,a2 as v,a3 as f,a4 as y,a5 as h,a6 as b,n as C,a7 as k,a8 as _,a9 as w,G as N,O as x,aa as S,B as V,ab as T,r as I,c as O,S as E}from"./vue--_kkPoVD.js";import{d as U,s as j,c as M,a as $}from"./pinia-_F_MrjSh.js";import{m as R,W as D,C as P,a as A,b as L,S as B,M as F,I as Y,L as z,_ as W,c as q,d as K,R as J,D as G,e as H,f as X,g as Z,B as Q,h as ee,i as te,j as ae,T as ne,k as le,P as oe,U as ie,l as se,n as ue,o as de,p as re,q as ce,r as pe,s as ge,t as me,u as ve,F as fe,v as ye,w as he,x as be,y as Ce,z as ke,A as _e,E as we,G as Ne,H as xe,J as Se,K as Ve,N as Te,O as Ie,Q as Oe,V as Ee,X as Ue,Y as je,Z as Me,$ as $e}from"./antdv-3leNc9CG.js";import{C as Re,j as De,o as Pe}from"./codemirror-tLd6xVyG.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const a of e)if("childList"===a.type)for(const e of a.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const Ae=U("main",{state:()=>({id:"",type:0,mode:"development",token:"",nameSpaceId:"",groupName:"",jobList:[]}),persist:!0,getters:{ID:e=>e.id,TYPE:e=>e.type,TOKEN:e=>e.token,NAME_SPACE_ID:e=>e.nameSpaceId,GROUP_NAME:e=>e.groupName,JOB_LIST:e=>e.jobList},actions:{clear(){this.id="",this.type=0,this.mode="development",this.token="",this.nameSpaceId="",this.groupName="",this.jobList=[]},setId(e){this.id=e},setType(e){this.type=e},setMode(e){this.mode=e},setToken(e){e&&(this.token=e.replace(/"|\\/g,""))},setNameSpaceId(e){e&&(this.nameSpaceId=e.replace(/"|\\/g,""))},setGroupName(e){this.groupName=e},setJobList(e){this.jobList=e}}}),Le=(e,t="get",a,n)=>{const l=Ae(),{token:o,nameSpaceId:i}=j(l);return new Promise(((l,s)=>{fetch("/snail-job"+e,{signal:n,method:t,headers:{"Content-Type":"application/json","Snail-Job-Auth":o.value,"Snail-Job-Namespace-Id":i.value},body:a?JSON.stringify(a):null}).then((e=>e.json())).then((e=>{1===e.status?(e.page&&l(e),l(e.data)):(R.error(e.message||"未知错误,请联系管理员"),s())})).catch((()=>{s()}))}))};
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Easy Retry</title>
<script type="module" crossorigin src="./assets/index-QMlLtH5y.js"></script>
<script type="module" crossorigin src="./assets/index-Z7Fd-PmT.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vue--_kkPoVD.js">
<link rel="modulepreload" crossorigin href="./assets/pinia-_F_MrjSh.js">
<link rel="modulepreload" crossorigin href="./assets/antdv-3leNc9CG.js">
@ -15,7 +15,6 @@
<body>
<div id="app"></div>
</body>
</html>

View File

@ -66,7 +66,7 @@ export function getServiceBaseURL(env: Env.ImportMeta, isProxy: boolean) {
*/
function createProxyPattern(key?: App.Service.OtherBaseURLKey) {
if (!key) {
return '/proxy-default';
return '/snail-job';
}
return `/proxy-${key}`;

View File

@ -52,7 +52,7 @@ const model: Model = reactive(createDefaultModel());
function createDefaultModel(): Model {
return {
groupName: '',
token: generateToken(32),
token: import.meta.env.VITE_APP_DEFAULT_TOKEN || '',
groupStatus: 1,
description: '',
idGeneratorMode: 2,

View File

@ -351,11 +351,7 @@ watch(visible, () => {
<NGrid cols="2 s:1 m:2" responsive="screen" x-gap="20">
<NGi>
<NFormItem :label="$t('page.jobTask.triggerType')" path="triggerType">
<TriggerType
v-model:value="model.triggerType"
:placeholder="$t('page.jobTask.form.triggerType')"
@update:value="model.triggerInterval = ''"
/>
<TriggerType v-model:value="model.triggerType" :placeholder="$t('page.jobTask.form.triggerType')" />
</NFormItem>
</NGi>
<NGi>

View File

@ -28,13 +28,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
taskBatchStatus: null
},
columns: () => [
// {
// type: 'selection',
// align: 'center',
// width: 48
// },
{
key: 'index',
key: 'id',
title: $t('common.index'),
align: 'center',
width: 120

View File

@ -81,7 +81,7 @@ onActivated(() => {
<iframe
ref="iframeRef"
class="size-full"
:src="`${mode === 'prod' ? baseUrl : ''}/lib/index.html?id=${id}&mode=${mode}&x1c2Hdd6=${value}`"
:src="`${mode === 'prod' ? baseUrl : '/'}lib/index.html?id=${id}&mode=${mode}&x1c2Hdd6=${value}`"
/>
</NSpin>
</template>

View File

@ -1,5 +1,5 @@
<script setup lang="tsx">
import { NButton, NButtonGroup, NPopconfirm, NPopover, NTag } from 'naive-ui';
import { NButton, NDropdown, NPopconfirm, NTag } from 'naive-ui';
import { useRouter } from 'vue-router';
import {
fetchDelWorkflow,
@ -38,7 +38,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
// width: 48
// },
{
key: 'index',
key: 'id',
title: $t('common.index'),
align: 'center',
width: 120
@ -129,17 +129,50 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
fixed: 'right',
width: 200,
render: row => {
const options = [
{
label: $t('common.execute'),
key: 'execute',
click: () => execute(row.id!)
},
{
type: 'divider',
key: 'd1'
},
{
label: $t('common.copy'),
key: 'copy',
click: () => copy(row.id!)
},
{
type: 'divider',
key: 'd2'
},
{
label: $t('common.batchList'),
key: 'batchList',
click: () => batch(row.id!)
}
];
function onSelect(key: string) {
options.filter(o => o.key === key)[0].click!();
}
return (
<div class="flex-center gap-8px">
<NButton type="warning" ghost size="small" onClick={() => edit(row.id!)}>
<NButton text type="warning" ghost size="small" onClick={() => edit(row.id!)}>
{$t('common.edit')}
</NButton>
<n-divider vertical />
{hasAuth('R_ADMIN') ? (
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
{{
default: () => $t('common.confirmDelete'),
trigger: () => (
<NButton type="error" ghost size="small">
<NButton text type="error" ghost size="small">
{$t('common.delete')}
</NButton>
)
@ -149,30 +182,17 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
''
)}
<NPopover trigger="click" placement="bottom" raw show-arrow={false} class="b-rd-6px bg-#fff dark:bg-#000">
<n-divider vertical />
<NDropdown trigger="click" show-arrow={false} options={options} size="small" on-select={onSelect}>
{{
trigger: () => (
<NButton type="primary" ghost size="small">
default: () => (
<NButton text type="primary" ghost size="small">
更多
</NButton>
),
default: () => (
<div>
<NButtonGroup vertical>
<NButton type="primary" ghost size="small" onClick={() => execute(row.id!)}>
{$t('common.execute')}
</NButton>
<NButton type="primary" ghost size="small" onClick={() => copy(row.id!)}>
{$t('common.copy')}
</NButton>
<NButton type="success" ghost size="small" onClick={() => batch(row.id!)}>
{$t('common.batchList')}
</NButton>
</NButtonGroup>
</div>
)
}}
</NPopover>
</NDropdown>
</div>
);
}