main
html 154 lines 5.59 KB
Raw
1 <html>
2 <head>
3 <title>Existing plugin configurations</title>
4 <script type="module">
5 import { store } from "/components/plugins/plugin-settings-store.js";
6 </script>
7 </head>
8 <body>
9 <div x-data="(() => {
10 const modals = Array.from(document.querySelectorAll('.modal.show'));
11 const parentModal = /** @type {HTMLElement & { __pluginSettingsContext?: object }} */ (modals[modals.length - 2] || null);
12 return {
13 context: parentModal?.__pluginSettingsContext || null,
14 };
15 })()">
16 <template x-if="context">
17 <div x-create="context.loadConfigList()" class="plugin-configs-container">
18
19 <div x-show="context.configsError" class="plugin-configs-error">
20 <x-icon name="error"></x-icon>
21 <span x-text="context.configsError"></span>
22 </div>
23
24 <div x-show="context.isListingConfigs" class="plugin-configs-loading">
25 <x-icon class="spinning" name="progress_activity"></x-icon>
26 <span>Loading configurations...</span>
27 </div>
28
29 <div x-show="!context.isListingConfigs" class="plugin-configs-list">
30 <template x-if="(context.configs || []).length === 0">
31 <div class="plugin-configs-empty">No configurations found.</div>
32 </template>
33
34 <template x-for="cfg in (context.configs || [])" :key="(cfg.project_name || '') + '|' + (cfg.agent_profile || '')">
35 <div class="plugin-configs-row">
36 <div class="plugin-configs-scope">
37 <div class="plugin-configs-scope-top">
38 <div class="plugin-configs-scope-line">
39 <span class="plugin-configs-scope-key">Project:</span>
40 <span x-text="context.projectLabel(cfg.project_name || '')"></span>
41 </div>
42 <div class="plugin-configs-scope-line">
43 <span class="plugin-configs-scope-key">Agent profile:</span>
44 <span x-text="context.agentProfileLabel(cfg.agent_profile || '')"></span>
45 </div>
46 </div>
47 <div class="plugin-configs-scope-sub" x-text="cfg.path || ''"></div>
48 </div>
49
50 <div class="plugin-configs-actions">
51 <button type="button" class="button" @click="context.switchToConfig(cfg.project_name || '', cfg.agent_profile || '')">
52 <x-icon class="icon" name="list"></x-icon>
53 Show
54 </button>
55 <button type="button" class="button cancel icon-button" title="Delete" @click="$confirmClick($event, () => context.deleteConfig(cfg.project_name || '', cfg.agent_profile || ''))">
56 <x-icon class="icon" name="delete"></x-icon>
57 </button>
58 </div>
59 </div>
60 </template>
61 </div>
62
63 </div>
64 </template>
65 </div>
66
67 <style>
68 .plugin-configs-loading,
69 .plugin-configs-error {
70 display: flex;
71 align-items: center;
72 gap: 0.5rem;
73 padding: 0.5rem 0.75rem;
74 margin-bottom: 0.75rem;
75 font-size: var(--font-size-small);
76 }
77
78 .plugin-configs-container {
79 padding: 0.75rem;
80 }
81
82 .plugin-configs-error {
83 color: var(--color-error);
84 background: rgba(255, 0, 0, 0.07);
85 border: 1px solid rgba(255, 0, 0, 0.2);
86 border-radius: 4px;
87 }
88
89 .plugin-configs-list {
90 display: flex;
91 flex-direction: column;
92 gap: 0.5rem;
93 }
94
95 .plugin-configs-row {
96 display: flex;
97 align-items: center;
98 justify-content: space-between;
99 gap: 0.75rem;
100 padding: 0.75rem;
101 border: 1px solid var(--color-border);
102 border-radius: 6px;
103 background: var(--color-surface);
104 }
105
106 .plugin-configs-scope {
107 flex: 1 1 auto;
108 min-width: 0;
109 }
110
111 .plugin-configs-scope-top {
112 display: flex;
113 gap: 1rem;
114 flex-wrap: wrap;
115 align-items: baseline;
116 }
117
118 .plugin-configs-scope-line {
119 display: flex;
120 gap: 0.35rem;
121 align-items: baseline;
122 }
123
124 .plugin-configs-scope-key {
125 font-weight: 600;
126 color: var(--color-text-secondary);
127 white-space: nowrap;
128 }
129
130 .plugin-configs-scope-sub {
131 font-size: var(--font-size-small);
132 color: var(--color-text-secondary);
133 margin-top: 0.2rem;
134 white-space: normal;
135 overflow-wrap: break-word;
136 word-break: normal;
137 }
138
139 .plugin-configs-actions {
140 display: flex;
141 gap: 0.5rem;
142 flex-wrap: nowrap;
143 justify-content: flex-end;
144 flex: 0 0 auto;
145 }
146
147 .plugin-configs-empty {
148 padding: 0.75rem;
149 color: var(--color-text-secondary);
150 font-size: var(--font-size-small);
151 }
152 </style>
153 </body>
154 </html>