update: 代码发布改为使用系统运行模式发布

This commit is contained in:
千反田丷 2021-12-13 16:40:23 +08:00
parent df75e83e94
commit df5342e1fe
4 changed files with 83 additions and 2 deletions

View File

@ -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<void> {
const psDevSlnSys = ctx.get('psdevslnsys');
return window.withProgress({ location: ProgressLocation.Notification, title: '系统发布' }, progress => {
// 加载可刷新的模板
const promise = new Promise<readonly SystemRunPickItem[]>(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')}> 系统代码发布`);
}

View File

@ -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';

View File

@ -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<string, string>;
/**
* Creates an instance of TemplatePickItem.
* @author chitanda
* @date 2021-12-07 11:12:30
* @param {Record<string, string>} run
*/
constructor(run: Record<string, string>) {
this.data = run;
this.label = run.pssystemrunname;
this.description = `服务:${run.pssyssfpubname}`;
this.detail = `应用:${run.pssysappname}`;
}
}

View File

@ -67,6 +67,36 @@ export class CoreAPI {
return [];
}
/**
*
*
* @author chitanda
* @date 2021-12-13 10:12:40
* @static
* @return {*} {Promise<any[]>}
*/
static async curSystemRuns(): Promise<any[]> {
if (ctx.completed === false) {
await ctx.waitCompleted();
}
try {
const config: AxiosRequestConfig<unknown> = {
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
*