|
66 | 66 |
|
67 | 67 | // Disable all direct terminals when switching to a system terminal |
68 | 68 | if ($settings?.terminalServers?.some((s) => s.enabled)) { |
69 | | - const updatedServers = ($settings.terminalServers ?? []).map((s) => ({ ...s, enabled: false })); |
| 69 | + const updatedServers = ($settings.terminalServers ?? []).map((s) => ({ |
| 70 | + ...s, |
| 71 | + enabled: false |
| 72 | + })); |
70 | 73 | settings.set({ |
71 | 74 | ...$settings, |
72 | 75 | terminalServers: updatedServers |
|
111 | 114 | <!-- Direct terminals (gated by permission) --> |
112 | 115 | {#if $user?.role === 'admin' || ($user?.permissions?.features?.direct_tool_servers ?? true)} |
113 | 116 | <div class="flex items-center justify-between px-3 py-1"> |
114 | | - <span class="text-[10px] font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider"> |
| 117 | + <span |
| 118 | + class="text-[10px] font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider" |
| 119 | + > |
115 | 120 | {$i18n.t('Direct')} |
116 | 121 | </span> |
117 | 122 | <Tooltip content={$i18n.t('Add Terminal')} placement="top"> |
118 | 123 | <button |
119 | 124 | type="button" |
120 | 125 | class="p-0.5 rounded-md text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 transition" |
121 | | - on:click|stopPropagation={() => { show = false; showSettings.set(true); }} |
| 126 | + on:click|stopPropagation={() => { |
| 127 | + show = false; |
| 128 | + showSettings.set(true); |
| 129 | + }} |
122 | 130 | > |
123 | | - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-3.5"> |
124 | | - <path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" /> |
| 131 | + <svg |
| 132 | + xmlns="http://www.w3.org/2000/svg" |
| 133 | + viewBox="0 0 20 20" |
| 134 | + fill="currentColor" |
| 135 | + class="size-3.5" |
| 136 | + > |
| 137 | + <path |
| 138 | + d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" |
| 139 | + /> |
125 | 140 | </svg> |
126 | 141 | </button> |
127 | 142 | </Tooltip> |
|
130 | 145 | {#each directTerminals as terminal} |
131 | 146 | <button |
132 | 147 | type="button" |
133 | | - class="flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl {$selectedTerminalId === terminal.url |
| 148 | + class="flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl {$selectedTerminalId === |
| 149 | + terminal.url |
134 | 150 | ? 'bg-gray-50 dark:bg-gray-800/50' |
135 | 151 | : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'}" |
136 | 152 | on:click={() => selectDirect(terminal)} |
137 | 153 | > |
138 | 154 | <div class="flex flex-1 gap-2 items-center truncate"> |
139 | 155 | <Cloud className="size-4 shrink-0" strokeWidth="2" /> |
140 | | - <span class="truncate">{terminal.name || terminal.url.replace(/^https?:\/\//, '')}</span> |
| 156 | + <span class="truncate" |
| 157 | + >{terminal.name || terminal.url.replace(/^https?:\/\//, '')}</span |
| 158 | + > |
141 | 159 | </div> |
142 | 160 | {#if $selectedTerminalId === terminal.url} |
143 | 161 | <div class="shrink-0 text-emerald-600 dark:text-emerald-400"> |
144 | | - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4"> |
145 | | - <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" /> |
| 162 | + <svg |
| 163 | + xmlns="http://www.w3.org/2000/svg" |
| 164 | + viewBox="0 0 20 20" |
| 165 | + fill="currentColor" |
| 166 | + class="size-4" |
| 167 | + > |
| 168 | + <path |
| 169 | + fill-rule="evenodd" |
| 170 | + d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" |
| 171 | + clip-rule="evenodd" |
| 172 | + /> |
146 | 173 | </svg> |
147 | 174 | </div> |
148 | 175 | {/if} |
149 | 176 | </button> |
150 | 177 | {/each} |
151 | 178 |
|
152 | | - <hr class="border-gray-100 dark:border-gray-800 my-1" /> |
| 179 | + {#if directTerminals.length > 0 && systemTerminals.length > 0} |
| 180 | + <hr class="border-gray-100 dark:border-gray-800 my-1" /> |
| 181 | + {/if} |
153 | 182 | {/if} |
154 | 183 |
|
155 | 184 | <!-- System terminals --> |
156 | | - <div class="flex items-center justify-between px-3 py-1"> |
157 | | - <span class="text-[10px] font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider"> |
158 | | - {$i18n.t('System')} |
159 | | - </span> |
160 | | - {#if $user?.role === 'admin'} |
161 | | - <Tooltip content={$i18n.t('Add Terminal')} placement="top"> |
162 | | - <button |
163 | | - type="button" |
164 | | - class="p-0.5 rounded-md text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 transition" |
165 | | - on:click|stopPropagation={() => { show = false; goto('/admin/settings/integrations'); }} |
166 | | - > |
167 | | - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-3.5"> |
168 | | - <path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" /> |
169 | | - </svg> |
170 | | - </button> |
171 | | - </Tooltip> |
172 | | - {/if} |
173 | | - </div> |
174 | | - |
175 | | - {#each systemTerminals as terminal} |
176 | | - <button |
177 | | - type="button" |
178 | | - class="flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl {$selectedTerminalId === terminal.id |
179 | | - ? 'bg-gray-50 dark:bg-gray-800/50' |
180 | | - : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'}" |
181 | | - on:click={() => selectSystem(terminal)} |
182 | | - > |
183 | | - <div class="flex flex-1 gap-2 items-center truncate"> |
184 | | - <Cloud className="size-4 shrink-0" strokeWidth="2" /> |
185 | | - <span class="truncate">{terminal.name || $i18n.t('Terminal')}</span> |
186 | | - </div> |
187 | | - {#if $selectedTerminalId === terminal.id} |
188 | | - <div class="shrink-0 text-emerald-600 dark:text-emerald-400"> |
189 | | - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4"> |
190 | | - <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" /> |
191 | | - </svg> |
192 | | - </div> |
| 185 | + {#if systemTerminals.length > 0} |
| 186 | + <div class="flex items-center justify-between px-3 py-1"> |
| 187 | + <span |
| 188 | + class="text-[10px] font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider" |
| 189 | + > |
| 190 | + {$i18n.t('System')} |
| 191 | + </span> |
| 192 | + {#if $user?.role === 'admin'} |
| 193 | + <Tooltip content={$i18n.t('Add Terminal')} placement="top"> |
| 194 | + <button |
| 195 | + type="button" |
| 196 | + class="p-0.5 rounded-md text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 transition" |
| 197 | + on:click|stopPropagation={() => { |
| 198 | + show = false; |
| 199 | + goto('/admin/settings/integrations'); |
| 200 | + }} |
| 201 | + > |
| 202 | + <svg |
| 203 | + xmlns="http://www.w3.org/2000/svg" |
| 204 | + viewBox="0 0 20 20" |
| 205 | + fill="currentColor" |
| 206 | + class="size-3.5" |
| 207 | + > |
| 208 | + <path |
| 209 | + d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" |
| 210 | + /> |
| 211 | + </svg> |
| 212 | + </button> |
| 213 | + </Tooltip> |
193 | 214 | {/if} |
194 | | - </button> |
195 | | - {/each} |
| 215 | + </div> |
| 216 | + |
| 217 | + {#each systemTerminals as terminal} |
| 218 | + <button |
| 219 | + type="button" |
| 220 | + class="flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl {$selectedTerminalId === |
| 221 | + terminal.id |
| 222 | + ? 'bg-gray-50 dark:bg-gray-800/50' |
| 223 | + : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'}" |
| 224 | + on:click={() => selectSystem(terminal)} |
| 225 | + > |
| 226 | + <div class="flex flex-1 gap-2 items-center truncate"> |
| 227 | + <Cloud className="size-4 shrink-0" strokeWidth="2" /> |
| 228 | + <span class="truncate">{terminal.name || $i18n.t('Terminal')}</span> |
| 229 | + </div> |
| 230 | + {#if $selectedTerminalId === terminal.id} |
| 231 | + <div class="shrink-0 text-emerald-600 dark:text-emerald-400"> |
| 232 | + <svg |
| 233 | + xmlns="http://www.w3.org/2000/svg" |
| 234 | + viewBox="0 0 20 20" |
| 235 | + fill="currentColor" |
| 236 | + class="size-4" |
| 237 | + > |
| 238 | + <path |
| 239 | + fill-rule="evenodd" |
| 240 | + d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" |
| 241 | + clip-rule="evenodd" |
| 242 | + /> |
| 243 | + </svg> |
| 244 | + </div> |
| 245 | + {/if} |
| 246 | + </button> |
| 247 | + {/each} |
| 248 | + {/if} |
196 | 249 | </DropdownMenu.Content> |
197 | 250 | </div> |
198 | 251 | </Dropdown> |
0 commit comments