mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 09:20:18 +08:00
feat: display cross-version installation status in app detail modal
- Replaced single `currentAppIsInstalled` boolean with `currentAppSparkInstalled` and `currentAppApmInstalled` in global store. - Updated `checkAppInstalled` logic in `App.vue` to fetch the installation status for both Spark and APM versions via `ipcRenderer`. - Passed both flags to `AppDetailModal.vue` as props. - Enhanced `AppDetailModal.vue` to compute the "install" button text dynamically: if viewing Spark and APM is installed, it displays `(已安装apm版)`; if viewing APM and Spark is installed, it displays `(已安装spark版)`. The button is also disabled in these scenarios to prevent duplicate cross-version installations.
This commit is contained in:
@@ -3,7 +3,8 @@ import pino from "pino";
|
||||
import {
|
||||
APM_STORE_STATS_BASE_URL,
|
||||
currentApp,
|
||||
currentAppIsInstalled,
|
||||
currentAppSparkInstalled,
|
||||
currentAppApmInstalled,
|
||||
} from "../global/storeConfig";
|
||||
import { APM_STORE_BASE_URL } from "../global/storeConfig";
|
||||
import { downloads } from "../global/downloadStatus";
|
||||
@@ -138,9 +139,18 @@ export const handleRemove = (appObj?: App) => {
|
||||
|
||||
window.ipcRenderer.on("remove-complete", (_event, log: DownloadResult) => {
|
||||
if (log.success) {
|
||||
currentAppIsInstalled.value = false;
|
||||
if (log.origin === "spark") {
|
||||
currentAppSparkInstalled.value = false;
|
||||
} else {
|
||||
currentAppApmInstalled.value = false;
|
||||
}
|
||||
} else {
|
||||
currentAppIsInstalled.value = true;
|
||||
// We could potentially restore the value, but if remove failed, it should still be installed.
|
||||
if (log.origin === "spark") {
|
||||
currentAppSparkInstalled.value = true;
|
||||
} else {
|
||||
currentAppApmInstalled.value = true;
|
||||
}
|
||||
console.error("卸载失败:", log.message);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user