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