mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-09 05:26:36 +08:00
修复依赖安装状态流转
This commit is contained in:
parent
a7f97bd729
commit
f305d45225
|
@ -15,7 +15,7 @@ export class Dependence {
|
||||||
this.status =
|
this.status =
|
||||||
typeof options.status === 'number' && DependenceStatus[options.status]
|
typeof options.status === 'number' && DependenceStatus[options.status]
|
||||||
? options.status
|
? options.status
|
||||||
: DependenceStatus.installing;
|
: DependenceStatus.queued;
|
||||||
this.type = options.type || DependenceTypes.nodejs;
|
this.type = options.type || DependenceTypes.nodejs;
|
||||||
this.timestamp = new Date().toString();
|
this.timestamp = new Date().toString();
|
||||||
this.name = options.name;
|
this.name = options.name;
|
||||||
|
|
|
@ -26,13 +26,6 @@ export interface AppToken {
|
||||||
|
|
||||||
export type AppScope = 'envs' | 'crons' | 'configs' | 'scripts' | 'logs';
|
export type AppScope = 'envs' | 'crons' | 'configs' | 'scripts' | 'logs';
|
||||||
|
|
||||||
export enum CrontabStatus {
|
|
||||||
'running',
|
|
||||||
'idle',
|
|
||||||
'disabled',
|
|
||||||
'queued',
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AppInstance extends Model<App, App>, App {}
|
interface AppInstance extends Model<App, App>, App {}
|
||||||
export const AppModel = sequelize.define<AppInstance>('App', {
|
export const AppModel = sequelize.define<AppInstance>('App', {
|
||||||
name: { type: DataTypes.STRING, unique: 'name' },
|
name: { type: DataTypes.STRING, unique: 'name' },
|
||||||
|
|
|
@ -105,11 +105,7 @@ export default class DependenceService {
|
||||||
isInstall: boolean = true,
|
isInstall: boolean = true,
|
||||||
force: boolean = false,
|
force: boolean = false,
|
||||||
) {
|
) {
|
||||||
docs.forEach(async (dep) => {
|
docs.forEach((dep) => {
|
||||||
const status = isInstall
|
|
||||||
? DependenceStatus.installing
|
|
||||||
: DependenceStatus.removing;
|
|
||||||
await DependenceModel.update({ status }, { where: { id: dep.id } });
|
|
||||||
this.installOrUninstallDependencies(
|
this.installOrUninstallDependencies(
|
||||||
[dep],
|
[dep],
|
||||||
isInstall,
|
isInstall,
|
||||||
|
@ -161,6 +157,13 @@ export default class DependenceService {
|
||||||
resolve(null);
|
resolve(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const depIds = dependencies.map((x) => x.id) as number[];
|
||||||
|
const status = isInstall
|
||||||
|
? DependenceStatus.installing
|
||||||
|
: DependenceStatus.removing;
|
||||||
|
await DependenceModel.update({ status }, { where: { id: depIds } });
|
||||||
|
|
||||||
const socketMessageType = !force
|
const socketMessageType = !force
|
||||||
? 'installDependence'
|
? 'installDependence'
|
||||||
: 'uninstallDependence';
|
: 'uninstallDependence';
|
||||||
|
@ -171,7 +174,6 @@ export default class DependenceService {
|
||||||
: unInstallDependenceCommandTypes
|
: unInstallDependenceCommandTypes
|
||||||
)[dependencies[0].type as any];
|
)[dependencies[0].type as any];
|
||||||
const actionText = isInstall ? '安装' : '删除';
|
const actionText = isInstall ? '安装' : '删除';
|
||||||
const depIds = dependencies.map((x) => x.id) as number[];
|
|
||||||
const startTime = dayjs();
|
const startTime = dayjs();
|
||||||
|
|
||||||
const message = `开始${actionText}依赖 ${depNames},开始时间 ${startTime.format(
|
const message = `开始${actionText}依赖 ${depNames},开始时间 ${startTime.format(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user