Merge branch 'v2-dev' into v2-plugin

pull/370/head
xiaojunnuo 2025-04-10 11:48:45 +08:00
commit 1150f62927
12 changed files with 102 additions and 49 deletions

View File

@ -64,6 +64,7 @@ export type PluginDefine = Registrable & {
};
};
needPlus?: boolean;
showRunStrategy?: boolean;
};
export type ITaskPlugin = {

View File

@ -48,11 +48,21 @@ export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
inputMap[item[0]] = item[1];
});
merge(define, { input: inputMap, autowire: autowires, output: outputs });
const defaultConfig = {
showRunStrategy: false,
default: {
strategy: {
runStrategy: 1, // 0:正常执行1:成功后跳过
},
},
};
define = merge(defaultConfig, define, { input: inputMap, autowire: autowires, output: outputs });
Reflect.defineMetadata(PLUGIN_CLASS_KEY, define, target);
target.define = define;
pluginRegistry.register(define.name, {
define,
target,

View File

@ -9,9 +9,9 @@ export type { CertInfo };
@IsTaskPlugin({
name: "CertApplyUpload",
icon: "ph:certificate",
title: "证书手动上传",
title: "商用证书托管",
group: pluginGroups.cert.key,
desc: "在证书仓库手动上传后触发部署证书",
desc: "手动上传自定义证书后,自动部署(每次证书有更新,都需要手动上传一次)",
default: {
strategy: {
runStrategy: RunStrategy.AlwaysRun,

View File

@ -162,8 +162,9 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
},
uploadCert: {
order: 2,
text: "上传证书部署",
text: "商用证书托管",
type: "primary",
title: "手动上传自有证书,执行自动部署(证书有更新时,都需要手动上传一次)",
icon: "ion:cloud-upload-outline",
click() {
openUploadCreateDialog();

View File

@ -98,7 +98,7 @@
<fs-form-item v-if="item.show !== false" v-model="currentStep.input[key]" :item="item" :get-context-fn="getScopeFunc" />
</template>
<fs-form-item v-model="currentStep.strategy.runStrategy" :item="runStrategyProps" :get-context-fn="getScopeFunc" />
<fs-form-item v-if="currentPlugin.showRunStrategy" v-model="currentStep.strategy.runStrategy" :item="runStrategyProps" :get-context-fn="getScopeFunc" />
</a-form>
</div>
<template #footer>
@ -396,9 +396,9 @@ export default {
render: () => {
return (
<div>
<div class="color-green">一般保持默认即可</div>
<div>正常运行每次都运行证书任务需要每次都运行</div>
<div>成功后跳过该任务成功一次之后跳过不重复执行证书变化之后才会再次运行</div>
<div class="green">保持默认即可</div>
</div>
);
},

View File

@ -6,7 +6,7 @@ typeorm:
default:
type: mysql # mariadb
host: localhost
port: 3306
port: 3309
username: root
password: root
database: certd

View File

@ -93,7 +93,7 @@
"mitt": "^3.0.1",
"mwts": "^1.3.0",
"mwtsc": "^1.15.1",
"mysql": "^2.18.1",
"mysql2": "^3.14.0",
"nanoid": "^5.0.7",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.16",

View File

@ -43,7 +43,7 @@ export class RoleService extends BaseService<RoleEntity> {
async getByUserIds(ids: any) {
return await this.userRoleService.find({
where: {
userId: In(ids),
userId: In<number>(ids) as any,
},
});
}
@ -131,6 +131,7 @@ export class RoleService extends BaseService<RoleEntity> {
async delete(id: any) {
const idArr = this.resolveIdArr(id);
//@ts-ignore
const urs = await this.userRoleService.find({ where: { roleId: In(idArr) } });
if (urs.length > 0) {
throw new Error('该角色已被用户使用,无法删除');

View File

@ -15,6 +15,7 @@ const defaultFilePrefix = 'db-backup';
icon: 'lucide:database-backup',
desc: '仅支持备份SQLite数据库',
group: pluginGroups.other.key,
showRunStrategy: true,
default: {
strategy: {
runStrategy: RunStrategy.AlwaysRun,

View File

@ -12,6 +12,7 @@ export type CustomScriptContext = {
icon: 'ri:javascript-line',
desc: '【仅管理员】运行自定义js脚本执行',
group: pluginGroups.other.key,
showRunStrategy:true,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,

View File

@ -6,6 +6,7 @@ import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput
icon: 'ri:rest-time-line',
desc: '等待一段时间',
group: pluginGroups.other.key,
showRunStrategy:true,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,

View File

@ -507,7 +507,7 @@ importers:
version: 1.15.1
typeorm:
specifier: ^0.3.20
version: 0.3.21(better-sqlite3@11.8.1)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
version: 0.3.21(better-sqlite3@11.8.1)(mysql2@3.14.0)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
devDependencies:
'@types/chai':
specifier: ^4.3.3
@ -596,7 +596,7 @@ importers:
version: 2.8.1
typeorm:
specifier: ^0.3.11
version: 0.3.21(better-sqlite3@11.8.1)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
version: 0.3.21(better-sqlite3@11.8.1)(mysql2@3.14.0)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
typescript:
specifier: ^5.4.2
version: 5.8.2
@ -805,7 +805,7 @@ importers:
version: 1.11.13
typeorm:
specifier: ^0.3.20
version: 0.3.21(better-sqlite3@11.8.1)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
version: 0.3.21(better-sqlite3@11.8.1)(mysql2@3.14.0)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
wechatpay-node-v3:
specifier: ^2.2.1
version: 2.2.1
@ -1611,9 +1611,9 @@ importers:
mwtsc:
specifier: ^1.15.1
version: 1.15.1
mysql:
specifier: ^2.18.1
version: 2.18.1
mysql2:
specifier: ^3.14.0
version: 3.14.0
nanoid:
specifier: ^5.0.7
version: 5.1.3
@ -1661,7 +1661,7 @@ importers:
version: 4.0.1045(encoding@0.1.13)
typeorm:
specifier: ^0.3.20
version: 0.3.21(better-sqlite3@11.8.1)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
version: 0.3.21(better-sqlite3@11.8.1)(mysql2@3.14.0)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2))
uuid:
specifier: ^10.0.0
version: 10.0.0
@ -5476,6 +5476,10 @@ packages:
aws-sign2@0.7.0:
resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==}
aws-ssl-profiles@1.1.2:
resolution: {integrity: sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==}
engines: {node: '>= 6.0.0'}
aws4@1.13.2:
resolution: {integrity: sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==}
@ -5714,9 +5718,6 @@ packages:
better-sqlite3@11.8.1:
resolution: {integrity: sha512-9BxNaBkblMjhJW8sMRZxnxVTRgbRmssZW0Oxc1MPBTfiR+WW21e2Mk4qu8CzrcZb1LwPCnFsfDEzq+SNcBU8eg==}
bignumber.js@9.0.0:
resolution: {integrity: sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==}
bignumber.js@9.1.2:
resolution: {integrity: sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==}
@ -6745,6 +6746,10 @@ packages:
delegates@1.0.0:
resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==}
denque@2.1.0:
resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}
engines: {node: '>=0.10'}
depd@1.1.2:
resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==}
engines: {node: '>= 0.6'}
@ -7639,6 +7644,9 @@ packages:
resolution: {integrity: sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==}
engines: {node: '>=14'}
generate-function@2.3.1:
resolution: {integrity: sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==}
gensync@1.0.0-beta.2:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
@ -8394,6 +8402,9 @@ packages:
resolution: {integrity: sha512-N3w1tFaRfk3UrPfqeRyD+GYDASU3W5VinKhlORy8EWVf/sIdDL9GAcew85XmktCfH+ngG7SRXEVDoO18WMdB/Q==}
engines: {node: '>=0.10.0'}
is-property@1.0.2:
resolution: {integrity: sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==}
is-reference@1.2.1:
resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==}
@ -9080,6 +9091,14 @@ packages:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
lru-cache@7.18.3:
resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==}
engines: {node: '>=12'}
lru.min@1.1.2:
resolution: {integrity: sha512-Nv9KddBcQSlQopmBHXSsZVY5xsdlZkdH/Iey0BlcBYggMd4two7cZnKOK9vmy3nY0O5RGH99z1PCeTpPqszUYg==}
engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'}
lucide-vue-next@0.477.0:
resolution: {integrity: sha512-C7azIKO7aJKf5MD7OIzV7NRDtnjXH3KSXfyJgGqRIMemuMzW/9esuMxDXIXDhBZcJgRtXMUN0FcJwOJZQ8SywA==}
peerDependencies:
@ -9514,13 +9533,17 @@ packages:
resolution: {integrity: sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==}
engines: {node: '>=12.0.0'}
mysql@2.18.1:
resolution: {integrity: sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==}
engines: {node: '>= 0.6'}
mysql2@3.14.0:
resolution: {integrity: sha512-8eMhmG6gt/hRkU1G+8KlGOdQi2w+CgtNoD1ksXZq9gQfkfDsX4LHaBwTe1SY0Imx//t2iZA03DFnyYKPinxSRw==}
engines: {node: '>= 8.0'}
mz@2.7.0:
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
named-placeholders@1.1.3:
resolution: {integrity: sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==}
engines: {node: '>=12.0.0'}
namespace-emitter@2.0.1:
resolution: {integrity: sha512-N/sMKHniSDJBjfrkbS/tpkPj4RAbvW3mr8UAzvlMHyun93XEm83IAvhWtJVHo+RHn/oO8Job5YN4b+wRjSVp5g==}
@ -10917,9 +10940,6 @@ packages:
readable-stream@1.0.34:
resolution: {integrity: sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==}
readable-stream@2.3.7:
resolution: {integrity: sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==}
readable-stream@2.3.8:
resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}
@ -11282,6 +11302,9 @@ packages:
engines: {node: '>=10'}
hasBin: true
seq-queue@0.0.5:
resolution: {integrity: sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q==}
serialize-javascript@6.0.2:
resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==}
@ -11565,8 +11588,8 @@ packages:
resolution: {integrity: sha512-+fLpbAbWkQ+d0JEchJT/NrRRXbYRNbG15gFpANx73EwxQB1PRjj+k/OI0GTU0J63g8ikGkJECQp9z8XEJZvPRw==}
engines: {node: '>=14'}
sqlstring@2.3.1:
resolution: {integrity: sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==}
sqlstring@2.3.3:
resolution: {integrity: sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==}
engines: {node: '>= 0.6'}
sse-decoder@1.0.0:
@ -18336,6 +18359,8 @@ snapshots:
aws-sign2@0.7.0: {}
aws-ssl-profiles@1.1.2: {}
aws4@1.13.2: {}
axios-mock-adapter@1.22.0(axios@1.8.2):
@ -18876,8 +18901,6 @@ snapshots:
bindings: 1.5.0
prebuild-install: 7.1.3
bignumber.js@9.0.0: {}
bignumber.js@9.1.2: {}
bin-links@4.0.4:
@ -20017,6 +20040,8 @@ snapshots:
delegates@1.0.0: {}
denque@2.1.0: {}
depd@1.1.2: {}
depd@2.0.0: {}
@ -20591,13 +20616,13 @@ snapshots:
resolve: 1.22.10
semver: 6.3.1
eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8):
eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8):
dependencies:
eslint: 7.32.0
prettier: 2.8.8
prettier-linter-helpers: 1.0.0
optionalDependencies:
eslint-config-prettier: 8.10.0(eslint@8.57.0)
eslint-config-prettier: 8.10.0(eslint@7.32.0)
eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@8.57.0)(prettier@2.8.8):
dependencies:
@ -21209,6 +21234,10 @@ snapshots:
- encoding
- supports-color
generate-function@2.3.1:
dependencies:
is-property: 1.0.2
gensync@1.0.0-beta.2: {}
get-caller-file@2.0.5: {}
@ -22027,6 +22056,8 @@ snapshots:
is-primitive@2.0.0:
optional: true
is-property@1.0.2: {}
is-reference@1.2.1:
dependencies:
'@types/estree': 1.0.6
@ -22785,6 +22816,10 @@ snapshots:
dependencies:
yallist: 4.0.0
lru-cache@7.18.3: {}
lru.min@1.1.2: {}
lucide-vue-next@0.477.0(vue@3.5.13(typescript@5.8.2)):
dependencies:
vue: 3.5.13(typescript@5.8.2)
@ -23301,7 +23336,7 @@ snapshots:
eslint: 7.32.0
eslint-config-prettier: 8.10.0(eslint@7.32.0)
eslint-plugin-node: 11.1.0(eslint@7.32.0)
eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8)
eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8)
execa: 5.1.1
inquirer: 7.3.3
json5: 2.2.3
@ -23327,12 +23362,17 @@ snapshots:
mylas@2.1.13: {}
mysql@2.18.1:
mysql2@3.14.0:
dependencies:
bignumber.js: 9.0.0
readable-stream: 2.3.7
safe-buffer: 5.1.2
sqlstring: 2.3.1
aws-ssl-profiles: 1.1.2
denque: 2.1.0
generate-function: 2.3.1
iconv-lite: 0.6.3
long: 5.3.1
lru.min: 1.1.2
named-placeholders: 1.1.3
seq-queue: 0.0.5
sqlstring: 2.3.3
mz@2.7.0:
dependencies:
@ -23340,6 +23380,10 @@ snapshots:
object-assign: 4.1.1
thenify-all: 1.6.0
named-placeholders@1.1.3:
dependencies:
lru-cache: 7.18.3
namespace-emitter@2.0.1: {}
nan@2.22.2:
@ -24850,16 +24894,6 @@ snapshots:
isarray: 0.0.1
string_decoder: 0.10.31
readable-stream@2.3.7:
dependencies:
core-util-is: 1.0.3
inherits: 2.0.4
isarray: 1.0.0
process-nextick-args: 2.0.1
safe-buffer: 5.1.2
string_decoder: 1.1.1
util-deprecate: 1.0.2
readable-stream@2.3.8:
dependencies:
core-util-is: 1.0.3
@ -25274,6 +25308,8 @@ snapshots:
semver@7.7.1: {}
seq-queue@0.0.5: {}
serialize-javascript@6.0.2:
dependencies:
randombytes: 2.1.0
@ -25605,7 +25641,7 @@ snapshots:
sql-highlight@6.0.0: {}
sqlstring@2.3.1: {}
sqlstring@2.3.3: {}
sse-decoder@1.0.0: {}
@ -26418,7 +26454,7 @@ snapshots:
typedarray@0.0.6: {}
typeorm@0.3.21(better-sqlite3@11.8.1)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2)):
typeorm@0.3.21(better-sqlite3@11.8.1)(mysql2@3.14.0)(pg@8.13.3)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.80)(typescript@5.8.2)):
dependencies:
'@sqltools/formatter': 1.2.5
ansis: 3.17.0
@ -26436,6 +26472,7 @@ snapshots:
yargs: 17.7.2
optionalDependencies:
better-sqlite3: 11.8.1
mysql2: 3.14.0
pg: 8.13.3
ts-node: 10.9.2(@types/node@18.19.80)(typescript@5.8.2)
transitivePeerDependencies: