From df5342e1fe1d53c7593ce08a733e950c41d65b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E5=8F=8D=E7=94=B0=E4=B8=B7?= <26603306@qq.com> Date: Mon, 13 Dec 2021 16:40:23 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BB=A3=E7=A0=81=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8=E7=B3=BB=E7=BB=9F=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=A8=A1=E5=BC=8F=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/system/publish.ts | 22 +++++++++++-- src/entities/index.ts | 1 + .../quick-pick-item/sys-run-pick-item.ts | 32 +++++++++++++++++++ src/service/core-api/core-api.service.ts | 30 +++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 src/entities/quick-pick-item/sys-run-pick-item.ts diff --git a/src/commands/system/publish.ts b/src/commands/system/publish.ts index 37d5c1f..b920319 100644 --- a/src/commands/system/publish.ts +++ b/src/commands/system/publish.ts @@ -1,6 +1,7 @@ import { commands, ProgressLocation, window } from 'vscode'; import { CommandConst } from '../../constants'; import { ctx } from '../../context'; +import { SystemRunPickItem } from '../../entities'; import { CoreAPI } from '../../service'; /** @@ -18,11 +19,28 @@ export class SystemPublishCommand { protected async execute(): Promise { const psDevSlnSys = ctx.get('psdevslnsys'); - return window.withProgress({ location: ProgressLocation.Notification, title: '系统发布' }, progress => { + // 加载可刷新的模板 + const promise = new Promise(async resolve => { + const arr: SystemRunPickItem[] = []; + const sysRuns = await CoreAPI.curSystemRuns(); + sysRuns.forEach(item => { + arr.push(new SystemRunPickItem(item)); + }); + resolve(arr); + }); + // 选择模板 + const sysRun = await window.showQuickPick(promise, { + title: '代码发布', + placeHolder: '请选择需要运行的发布模式', + }); + if (!sysRun) { + return; + } + return window.withProgress({ location: ProgressLocation.SourceControl, title: '系统发布' }, progress => { return new Promise(resolve => { setTimeout(async () => { progress.report({ message: '正在建立发布任务...' }); - const res = await CoreAPI.cli('ExecuteSysCLICmd', { pstscmdname: 'devsys_pubcode', psdevslnsysid: psDevSlnSys }); + const res = await CoreAPI.cli('ExecuteSysCLICmd', { pstscmdname: 'devsys_pubcode', psdevslnsysid: psDevSlnSys, data: { sysrun: sysRun.data.pssystemrunname } }); if (res) { window.showInformationMessage(`已建立 <${ctx.get('psdevslnsysname')}> 系统代码发布`); } diff --git a/src/entities/index.ts b/src/entities/index.ts index c0cfda0..84ca0a3 100644 --- a/src/entities/index.ts +++ b/src/entities/index.ts @@ -1,3 +1,4 @@ export { PSMosFile } from './mos-file/ps-mos-file'; export { MosFilePickItem } from './quick-pick-item/mos-file-pick-item'; export { TemplatePickItem } from './quick-pick-item/template-pick-item'; +export { SystemRunPickItem } from './quick-pick-item/sys-run-pick-item'; diff --git a/src/entities/quick-pick-item/sys-run-pick-item.ts b/src/entities/quick-pick-item/sys-run-pick-item.ts new file mode 100644 index 0000000..c1ed32a --- /dev/null +++ b/src/entities/quick-pick-item/sys-run-pick-item.ts @@ -0,0 +1,32 @@ +import { QuickPickItem } from 'vscode'; + +/** + * 系统运行选项 + * + * @author chitanda + * @date 2021-12-13 15:12:27 + * @export + * @class SystemRunPickItem + * @implements {QuickPickItem} + */ +export class SystemRunPickItem implements QuickPickItem { + readonly label: string; + readonly description?: string | undefined; + readonly detail?: string | undefined; + readonly picked?: boolean | undefined; + readonly alwaysShow?: boolean | undefined; + readonly data: Record; + + /** + * Creates an instance of TemplatePickItem. + * @author chitanda + * @date 2021-12-07 11:12:30 + * @param {Record} run + */ + constructor(run: Record) { + this.data = run; + this.label = run.pssystemrunname; + this.description = `服务:${run.pssyssfpubname}`; + this.detail = `应用:${run.pssysappname}`; + } +} diff --git a/src/service/core-api/core-api.service.ts b/src/service/core-api/core-api.service.ts index dc606bd..c270876 100644 --- a/src/service/core-api/core-api.service.ts +++ b/src/service/core-api/core-api.service.ts @@ -67,6 +67,36 @@ export class CoreAPI { return []; } + /** + * 查询当前系统运行 + * + * @author chitanda + * @date 2021-12-13 10:12:40 + * @static + * @return {*} {Promise} + */ + static async curSystemRuns(): Promise { + if (ctx.completed === false) { + await ctx.waitCompleted(); + } + try { + const config: AxiosRequestConfig = { + headers: { + 'psdevslnsys': ctx.get('psdevslnsys') as string, + 'content-type': 'application/json;charset=UTF-8', + }, + }; + const path = `${this.getAddress()}/pssystemruns/fetchcursys`; + const res = await Fetch.get(path, { n_psdevslnid_eq: ctx.get('psdevsln'), size: 1000, page: 0 }, config); + if (res) { + return res.data; + } + } catch (err) { + showErrInfo(err); + } + return []; + } + /** * 获取 core api 服务域 *