6
</script>
7
</head>
8
<body>
9
- <div x-data>
10
- <template x-if="$store.pluginSettings">
11
- <div x-create="$store.pluginSettings.onModalOpen()"
12
- x-destroy="$store.pluginSettings.cleanup(); $store.pluginListStore?.refresh()">
9
+ <div x-data="(() => {
10
+ const context = $instantiate($store.pluginSettingsPrototype);
11
+ return {
12
+ context,
13
+ get config() {
14
+ return this.context.settings;
15
+ },
16
+ };
17
+ })()">
18
+ <template x-if="context">
19
+ <div>
20
+ <div x-create="context.onModalOpen(); (() => { const modal = $el.closest('.modal'); if (modal) modal.__pluginSettingsContext = context; })()"
21
+ x-destroy="context.cleanup(); $store.pluginListStore?.refresh()">
22
23
<!-- Context toolbar: Project + Agent profile (only when at least one scope is configurable) -->
24
<div class="plugin-settings-scope-section"
16
- x-show="$store.pluginSettings.perProjectConfig || $store.pluginSettings.perAgentConfig">
25
+ x-show="context.perProjectConfig || context.perAgentConfig">
26
<div class="plugin-settings-scope-header">
27
<div class="plugin-settings-scope-title">Settings scope</div>
28
<div class="plugin-settings-scope-desc">This plugin supports settings per project or agent profile.</div>
32
33
<label class="plugin-settings-toolbar-item">
34
<span class="plugin-settings-toolbar-label">Project</span>
26
- <select x-model="$store.pluginSettings.projectName"
27
- x-init="$nextTick(() => $el.value = $store.pluginSettings.projectName)"
28
- @change="$store.pluginSettings.onScopeChanged()"
29
- :disabled="!$store.pluginSettings.perProjectConfig">
35
+ <select x-model="context.projectName"
36
+ x-init="$nextTick(() => $el.value = context.projectName)"
37
+ @change="context.onScopeChanged()"
38
+ :disabled="!context.perProjectConfig">
39
<option value="">Global</option>
31
- <template x-for="project in $store.pluginSettings.projects" :key="project.key">
40
+ <template x-for="project in context.projects" :key="project.key">
41
<option :value="project.key" x-text="project.label"></option>
42
</template>
43
</select>
45
46
<label class="plugin-settings-toolbar-item">
47
<span class="plugin-settings-toolbar-label">Agent profile</span>
39
- <select x-model="$store.pluginSettings.agentProfileKey"
40
- x-init="$nextTick(() => $el.value = $store.pluginSettings.agentProfileKey)"
41
- @change="$store.pluginSettings.onScopeChanged()"
42
- :disabled="!$store.pluginSettings.perAgentConfig">
48
+ <select x-model="context.agentProfileKey"
49
+ x-init="$nextTick(() => $el.value = context.agentProfileKey)"
50
+ @change="context.onScopeChanged()"
51
+ :disabled="!context.perAgentConfig">
52
<option value="">All profiles</option>
44
- <template x-for="profile in $store.pluginSettings.agentProfiles" :key="profile.key">
53
+ <template x-for="profile in context.agentProfiles" :key="profile.key">
54
<option :value="profile.key" x-text="profile.label"></option>
55
</template>
56
</select>
57
</label>
58
50
- <button type="button" class="button plugin-settings-toolbar-button" title="Show existing configurations" @click="$store.pluginSettings.openConfigListModal()">
59
+ <button type="button" class="button plugin-settings-toolbar-button" title="Show existing configurations" @click="context.openConfigListModal()">
60
<span class="icon material-symbols-outlined">list</span>
61
</button>
62
79
</div>
80
</div>
81
73
- <div x-show="$store.pluginSettings.scopeMismatchMessage" class="plugin-settings-scope-info">
82
+ <div x-show="context.scopeMismatchMessage" class="plugin-settings-scope-info">
83
<span class="material-symbols-outlined">info</span>
75
- <span x-text="$store.pluginSettings.scopeMismatchMessage"></span>
84
+ <span x-text="context.scopeMismatchMessage"></span>
85
</div>
86
</div>
87
88
<!-- Error -->
80
- <div x-show="$store.pluginSettings.error" class="plugin-settings-error">
89
+ <div x-show="context.error" class="plugin-settings-error">
90
<span class="material-symbols-outlined">error</span>
82
- <span x-text="$store.pluginSettings.error"></span>
91
+ <span x-text="context.error"></span>
92
</div>
93
94
<!-- Loading -->
86
- <div x-show="$store.pluginSettings.isLoading" class="plugin-settings-loading">
95
+ <div x-show="context.isLoading" class="plugin-settings-loading">
96
<span class="material-symbols-outlined spinning">progress_activity</span>
97
<span>Loading settings...</span>
98
</div>
99
100
<!-- Plugin settings body: plugin provides /plugins/<name>/webui/config.html -->
92
- <div x-show="!$store.pluginSettings.isLoading"
101
+ <div x-show="!context.isLoading"
102
class="plugin-settings-body"
94
- x-html="$store.pluginSettings.settingsComponentHtml">
103
+ x-html="context.settingsComponentHtml">
104
</div>
105
106
</div>
98
- </template>
99
- </div>
107
101
- <!-- Footer (pinned outside scroll area) -->
102
- <div class="modal-footer" data-modal-footer>
103
- <button class="btn btn-ok"
104
- @click="$store.pluginSettings.save()"
105
- :disabled="$store.pluginSettings?.isSaving || $store.pluginSettings?.isLoading">
106
- Save
107
- </button>
108
- <button class="btn"
109
- @click="$store.pluginSettings.resetToDefault()"
110
- :disabled="$store.pluginSettings?.isSaving || $store.pluginSettings?.isLoading">
111
- Default
112
- </button>
113
- <button class="btn btn-cancel"
114
- @click="window.closeModal?.()">
115
- Cancel
116
- </button>
108
+ <!-- Footer (pinned outside scroll area) -->
109
+ <div class="modal-footer" data-modal-footer>
110
+ <button class="btn btn-ok"
111
+ @click="context.save()"
112
+ :disabled="context?.isSaving || context?.isLoading">
113
+ Save
114
+ </button>
115
+ <button class="btn"
116
+ @click="context.resetToDefault()"
117
+ :disabled="context?.isSaving || context?.isLoading">
118
+ Default
119
+ </button>
120
+ <button class="btn btn-cancel"
121
+ @click="window.closeModal?.()">
122
+ Cancel
123
+ </button>
124
+ </div>
125
+ </div>
126
+ </template>
127
</div>
128
129
<style>