scheduler cleanup
3clyp50 committed
Dec 29, 2025 at 13:33 UTC
7d1df7eaeb92422355d996279c67455ce8b6eca7
5 files changed
+20
-75
webui/components/modals/scheduler/scheduler-modal-store.js
deleted
-35
@@ -1,35 +0,0 @@
1
-import { createStore } from "/js/AlpineStore.js";
2
-import { store as schedulerStore } from "/components/modals/scheduler/scheduler-store.js";
3
-
4
-const model = {
5
- closePromise: null,
6
-
7
- async open(options = {}) {
8
- // Open modal
9
- this.closePromise = window.openModal("modals/scheduler/scheduler-modal.html");
10
-
11
- // Setup cleanup on modal close
12
- if (this.closePromise?.then) {
13
- this.closePromise.then(() => this.cleanup());
14
- }
15
-
16
- // Notify scheduler store that modal opened
17
- schedulerStore.onTabActivated?.();
18
-
19
- // If taskId provided, show detail after load
20
- if (options.taskId) {
21
- setTimeout(async () => {
22
- await schedulerStore.fetchTasks({ manual: true });
23
- schedulerStore.showTaskDetail(options.taskId);
24
- }, 200);
25
- }
26
- },
27
-
28
- cleanup() {
29
- schedulerStore.onModalClosed?.();
30
- this.closePromise = null;
31
- },
32
-};
33
-
34
-export const store = createStore("schedulerModal", model);
35
-
webui/components/modals/scheduler/scheduler-modal.html
+14
-4
@@ -2,14 +2,18 @@
2
<head>
3
<title>Task Scheduler</title>
4
<script type="module">
5
- import { store } from "/components/modals/scheduler/scheduler-modal-store.js";
5
+ import { store } from "/components/modals/scheduler/scheduler-store.js";
6
</script>
7
</head>
8
<body>
9
- <div x-data>
10
- <template x-if="$store.schedulerModal">
9
+ <div x-data x-init="$store.schedulerStore.onTabActivated()" x-destroy="$store.schedulerStore.onModalClosed()">
10
+ <template x-if="$store.schedulerStore">
11
<div class="scheduler-modal-content">
12
- <x-component path="modals/scheduler/scheduler-settings.html"></x-component>
12
+ <div id="scheduler-settings-root" class="scheduler-dashboard">
13
+ <div class="scheduler-dashboard-description">Manage scheduled tasks and automated processes for Agent Zero.</div>
14
+ <x-component path="modals/scheduler/scheduler-task-editor.html"></x-component>
15
+ <x-component path="modals/scheduler/scheduler-task-list.html"></x-component>
16
+ </div>
17
</div>
18
</template>
19
</div>
@@ -21,6 +25,12 @@
25
height: 100%;
26
min-height: 400px;
27
}
28
+ .scheduler-dashboard {
29
+ padding: 0;
30
+ }
31
+ .scheduler-dashboard-description {
32
+ padding: 1rem 1rem;
33
+ }
34
</style>
35
</body>
36
</html>
webui/components/modals/scheduler/scheduler-settings.html
deleted
-27
@@ -1,27 +0,0 @@
1
-<html>
2
-<head>
3
- <script type="module">
4
- import { store } from "/components/modals/scheduler/scheduler-store.js";
5
- </script>
6
-</head>
7
-<body>
8
-<div x-data>
9
- <template x-if="$store.schedulerStore">
10
- <div id="scheduler-settings-root" class="scheduler-dashboard">
11
- <div class="scheduler-dashboard-description">Manage scheduled tasks and automated processes for Agent Zero.</div>
12
- <x-component path="modals/scheduler/scheduler-task-editor.html"></x-component>
13
- <x-component path="modals/scheduler/scheduler-task-list.html"></x-component>
14
- </div>
15
- </template>
16
-</div>
17
-
18
-<style>
19
- .scheduler-dashboard {
20
- padding: 0;
21
- }
22
- .scheduler-dashboard-description {
23
- padding: 1rem 1rem;
24
- }
25
-</style>
26
-</body>
27
-</html>
webui/components/modals/scheduler/scheduler-store.js
+4
-2
@@ -964,11 +964,13 @@ const schedulerStoreModel = {
964
window.closeModal();
965
},
966
967
- editFromDetail() {
967
+ async editFromDetail() {
968
const taskId = this.selectedTaskForDetail?.uuid;
969
if (!taskId) return;
970
this.closeTaskDetail();
971
- this.startEditTask(taskId);
971
+ await this.startEditTask(taskId);
972
+ // Open main scheduler modal to show the editor
973
+ window.openModal("modals/scheduler/scheduler-modal.html");
974
},
975
976
async deleteFromDetail() {
webui/components/sidebar/top-section/quick-actions.html
+2
-7
@@ -3,11 +3,6 @@
3
<head>
4
<script type="module">
5
import { store } from "/components/sidebar/chats/chats-store.js";
6
- import { store as settingsStore } from "/components/settings/settings-store.js";
7
- import { store as schedulerModalStore } from "/components/modals/scheduler/scheduler-modal-store.js";
8
- // Expose for Alpine template access
9
- globalThis.openSettingsModal = () => settingsStore.open();
10
- globalThis.openSchedulerModal = () => schedulerModalStore.open();
6
</script>
7
</head>
8
@@ -18,7 +13,7 @@
13
<button class="config-button" id="loadChats" @click="$store.chats.loadChats()">Load Chat</button>
14
<button class="config-button" id="loadChat" @click="$store.chats.saveChat()">Save Chat</button>
15
<button class="config-button" id="restart" @click="$store.chats.restart()">Restart</button>
21
- <button class="config-button" id="settings" @click="openSettingsModal()"><svg
16
+ <button class="config-button" id="settings" @click="openModal('settings/settings.html')"><svg
17
xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="-5.0 -17.0 110.0 135.0" fill="currentColor" width="24"
18
height="24">
19
<path
@@ -28,7 +23,7 @@
23
d="m50.301 66.5c-9 0-16.398-7.3008-16.398-16.398 0-9.1016 7.3008-16.398 16.398-16.398 9.1016 0 16.398 7.3008 16.398 16.398 0 9.0977-7.3984 16.398-16.398 16.398zm0-25.5c-5 0-9.1016 4.1016-9.1016 9.1016s4.1016 9.1016 9.1016 9.1016 9.1016-4.1016 9.1016-9.1016c-0.003906-5-4.1016-9.1016-9.1016-9.1016z">
24
</path>
25
</svg>Settings</button>
31
- <button class="config-button" id="scheduler" @click="openSchedulerModal()">
26
+ <button class="config-button" id="scheduler" @click="openModal('modals/scheduler/scheduler-modal.html')">
27
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
28
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67V7z"/>
29
</svg>Scheduler</button>