kitowall 6.10.0 → 6.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/workshop.js +29 -19
- package/package.json +1 -1
package/dist/core/workshop.js
CHANGED
|
@@ -1126,18 +1126,24 @@ async function workshopCoexistenceStatus() {
|
|
|
1126
1126
|
return { ok: true, snapshot, current };
|
|
1127
1127
|
}
|
|
1128
1128
|
async function workshopStop(options) {
|
|
1129
|
-
|
|
1129
|
+
const state = readActiveState();
|
|
1130
1130
|
const hadActive = !!state;
|
|
1131
1131
|
const stopped = [];
|
|
1132
1132
|
let shouldRestore = false;
|
|
1133
|
+
const monitor = options?.monitor;
|
|
1134
|
+
const stopAll = !!options?.all || !monitor;
|
|
1133
1135
|
if (state?.instances) {
|
|
1134
|
-
if (options?.
|
|
1135
|
-
const
|
|
1136
|
+
if (monitor && !options?.all) {
|
|
1137
|
+
const nextState = {
|
|
1138
|
+
...state,
|
|
1139
|
+
instances: { ...state.instances }
|
|
1140
|
+
};
|
|
1141
|
+
const inst = nextState.instances[monitor];
|
|
1136
1142
|
if (killPid(inst?.pid))
|
|
1137
|
-
stopped.push(
|
|
1138
|
-
delete
|
|
1139
|
-
if (Object.keys(
|
|
1140
|
-
writeActiveState(
|
|
1143
|
+
stopped.push(monitor);
|
|
1144
|
+
delete nextState.instances[monitor];
|
|
1145
|
+
if (Object.keys(nextState.instances).length > 0) {
|
|
1146
|
+
writeActiveState(nextState);
|
|
1141
1147
|
}
|
|
1142
1148
|
else {
|
|
1143
1149
|
clearActiveState();
|
|
@@ -1145,30 +1151,34 @@ async function workshopStop(options) {
|
|
|
1145
1151
|
}
|
|
1146
1152
|
}
|
|
1147
1153
|
else {
|
|
1148
|
-
for (const [monitor, inst] of Object.entries(state.instances)) {
|
|
1149
|
-
if (killPid(inst?.pid))
|
|
1150
|
-
stopped.push(monitor);
|
|
1151
|
-
}
|
|
1152
|
-
clearActiveState();
|
|
1153
1154
|
shouldRestore = true;
|
|
1155
|
+
stopped.push(...Object.keys(state.instances));
|
|
1154
1156
|
}
|
|
1155
1157
|
}
|
|
1156
|
-
else if (
|
|
1158
|
+
else if (stopAll) {
|
|
1159
|
+
shouldRestore = true;
|
|
1160
|
+
}
|
|
1161
|
+
// Use the same handoff strategy as "Repair": first restore the static stack,
|
|
1162
|
+
// then tear down rendercore/live processes so the user is not left with a gap.
|
|
1163
|
+
if (shouldRestore) {
|
|
1164
|
+
await (0, init_1.initKitowall)({ namespace: 'kitowall', apply: true, force: true });
|
|
1157
1165
|
await stopKnownLiveProcesses();
|
|
1158
1166
|
clearActiveState();
|
|
1159
|
-
|
|
1167
|
+
const coexist = await workshopCoexistenceExit();
|
|
1168
|
+
return {
|
|
1169
|
+
ok: true,
|
|
1170
|
+
stopped_instances: stopped,
|
|
1171
|
+
restored_units: coexist.restored,
|
|
1172
|
+
had_active: hadActive
|
|
1173
|
+
};
|
|
1160
1174
|
}
|
|
1161
1175
|
if (options?.all) {
|
|
1162
1176
|
await stopKnownLiveProcesses();
|
|
1163
1177
|
}
|
|
1164
|
-
const coexist = shouldRestore ? await workshopCoexistenceExit() : { ok: true, restored: [] };
|
|
1165
|
-
if (shouldRestore) {
|
|
1166
|
-
await (0, init_1.initKitowall)({ namespace: 'kitowall', apply: true, force: true });
|
|
1167
|
-
}
|
|
1168
1178
|
return {
|
|
1169
1179
|
ok: true,
|
|
1170
1180
|
stopped_instances: stopped,
|
|
1171
|
-
restored_units:
|
|
1181
|
+
restored_units: [],
|
|
1172
1182
|
had_active: hadActive
|
|
1173
1183
|
};
|
|
1174
1184
|
}
|