Skip to content

Commit

Permalink
fix: status error
Browse files Browse the repository at this point in the history
  • Loading branch information
icebergtsn committed Oct 28, 2024
1 parent 47a5fee commit e75285c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
16 changes: 8 additions & 8 deletions frontend/src/components/appcard/InstallButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ async function onSuspend() {
}
switch (props.item?.status) {
case APP_STATUS.suspend:
case APP_STATUS.running:
appStore.suspendApp(props.item, props.development);
break;
}
Expand Down Expand Up @@ -427,7 +427,6 @@ async function onSuspendTips() {
.then((res) => {
if (res) {
console.log('click ok');
appStore.uninstallApp(props.item, props.development);
} else {
console.log('click cancel');
}
Expand Down Expand Up @@ -550,19 +549,20 @@ function updateUI() {
border.value = '1px solid transparent';
status.value = t('app.installed');
break;
case APP_STATUS.resuming:
case APP_STATUS.waiting:
isLoading.value = true;
status.value = '';
textColor.value = white.value;
backgroundColor.value = blueDefault.value;
border.value = '1px solid transparent';
break;
case APP_STATUS.resuming:
backgroundColor.value = blueAlpha.value;
textColor.value = blueDefault.value;
border.value = '1px solid transparent';
status.value = t('app.resuming');
break;
// case APP_STATUS.resuming:
// backgroundColor.value = blueAlpha.value;
// textColor.value = blueDefault.value;
// border.value = '1px solid transparent';
// status.value = t('app.resuming');
// break;
case APP_STATUS.suspend:
backgroundColor.value = blueAlpha.value;
textColor.value = blueDefault.value;
Expand Down
36 changes: 19 additions & 17 deletions frontend/src/stores/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,17 @@ export const useAppStore = defineStore('app', {
},

async updateAppEntranceBySocket(app) {
const install = this.installApps.find((item) => item.name == app.id);
const install = this.installApps.find((item) => item.id == app.id);
if (install) {
install.entrances = app.entrances;
if (
app.state === APP_STATUS.suspend ||
app.state === APP_STATUS.resuming
app.state === APP_STATUS.resuming ||
app.state === APP_STATUS.running
) {
install.entrances = app.entrances;
install.status = app.state;
this._notificationData(app, false);
console.log('=====>', install);
this._notificationData(install, false);
}
}
},
Expand Down Expand Up @@ -413,12 +415,12 @@ export const useAppStore = defineStore('app', {
app.status = APP_STATUS.uninstalled;
refresh = true;
}
if (
operation === OPERATE_ACTION.suspend &&
op_status === OPERATE_STATUS.completed
) {
app.status = APP_STATUS.suspend;
}
// if (
// operation === OPERATE_ACTION.suspend &&
// op_status === OPERATE_STATUS.completed
// ) {
// app.status = APP_STATUS.suspend;
// }
if (
operation === OPERATE_ACTION.upgrade &&
op_status === OPERATE_STATUS.processing
Expand All @@ -438,12 +440,12 @@ export const useAppStore = defineStore('app', {
app.status = APP_STATUS.running;
refresh = true;
}
if (
operation === OPERATE_ACTION.resume &&
op_status === OPERATE_STATUS.completed
) {
app.status = APP_STATUS.running;
}
// if (
// operation === OPERATE_ACTION.resume &&
// op_status === OPERATE_STATUS.completed
// ) {
// app.status = APP_STATUS.running;
// }
if (
operation === OPERATE_ACTION.uninstall &&
op_status === OPERATE_STATUS.completed
Expand Down Expand Up @@ -822,7 +824,7 @@ export const useAppStore = defineStore('app', {
console.log('install delete ' + app.name);
} else {
this.installApps.splice(index, 1, app);
console.log('install replace ' + app.name);
console.log('install replace ', app);
}
} else {
if (app.status === APP_STATUS.running) {
Expand Down

0 comments on commit e75285c

Please sign in to comment.