|
4 | 4 | import { _ } from 'svelte-i18n'; |
5 | 5 | import InPlaceEdit from '$lib/common/InPlaceEdit.svelte'; |
6 | 6 | import { utcToLocal } from '$lib/helpers/datetime'; |
7 | | - import { AgentMode, AgentType } from '$lib/helpers/enums'; |
| 7 | + import { RoutingMode, AgentType } from '$lib/helpers/enums'; |
8 | 8 | import { AgentExtensions } from '$lib/helpers/utils/agent'; |
9 | 9 |
|
10 | 10 | const limit = 10; |
|
21 | 21 | |
22 | 22 | /** @type {() => void} */ |
23 | 23 | export let handleAgentChange = () => {}; |
24 | | - |
25 | | - onMount(() => {}); |
26 | 24 |
|
27 | 25 | /** @type {import('$commonTypes').IdName[]} */ |
28 | | - const agentModeOptions = Object.entries(AgentMode).map(([k, v]) => ( |
| 26 | + let routingModeOptions = Object.entries(RoutingMode).map(([k, v]) => ( |
29 | 27 | { id: v, name: v } |
30 | 28 | )); |
31 | 29 |
|
| 30 | + |
| 31 | + onMount(() => { |
| 32 | + init(); |
| 33 | + }); |
| 34 | +
|
| 35 | + function init() { |
| 36 | + routingModeOptions = [{ id: null, name: '' }, ...routingModeOptions]; |
| 37 | + } |
| 38 | + |
32 | 39 | function addProfile() { |
33 | 40 | if (!!!agent) return; |
34 | 41 |
|
|
67 | 74 | * @param {any} e |
68 | 75 | */ |
69 | 76 | function changeMode(e) { |
70 | | - const value = e.target.value; |
| 77 | + const value = e.target.value || null; |
71 | 78 | agent.mode = value; |
72 | 79 | handleAgentChange(); |
73 | 80 | } |
|
127 | 134 | {/if} |
128 | 135 | </td> |
129 | 136 | </tr> |
| 137 | + {#if 1} |
| 138 | + <tr> |
| 139 | + <th class="agent-prop-key" style="vertical-align: middle"> |
| 140 | + <div class="mt-1"> |
| 141 | + Routing Mode |
| 142 | + </div> |
| 143 | + </th> |
| 144 | + <td> |
| 145 | + <div class="mt-2 mb-2" style="width: fit-content;"> |
| 146 | + <Input |
| 147 | + type="select" |
| 148 | + on:change={e => changeMode(e)} |
| 149 | + > |
| 150 | + {#each [...routingModeOptions] as option} |
| 151 | + <option value={option.id} selected={option.id === agent.mode}> |
| 152 | + {option.name} |
| 153 | + </option> |
| 154 | + {/each} |
| 155 | + </Input> |
| 156 | + </div> |
| 157 | + </td> |
| 158 | + </tr> |
| 159 | + {/if} |
130 | 160 | <tr> |
131 | 161 | <th class="agent-prop-key"> |
132 | 162 | <div class="mt-2 mb-2"> |
|
272 | 302 | </div> |
273 | 303 | </td> |
274 | 304 | </tr> |
275 | | - <tr> |
276 | | - <th class="agent-prop-key" style="vertical-align: middle"> |
277 | | - <div class="mt-1"> |
278 | | - Mode |
279 | | - </div> |
280 | | - </th> |
281 | | - <td> |
282 | | - <div class="mt-2 mb-2" style="width: fit-content;"> |
283 | | - <Input |
284 | | - type="select" |
285 | | - on:change={e => changeMode(e)} |
286 | | - > |
287 | | - {#each [...agentModeOptions] as option} |
288 | | - <option value={option.id} selected={option.id === agent.mode}> |
289 | | - {option.name} |
290 | | - </option> |
291 | | - {/each} |
292 | | - </Input> |
293 | | - </div> |
294 | | - </td> |
295 | | - </tr> |
296 | 305 | <tr> |
297 | 306 | <th class="agent-prop-key" style="vertical-align: middle"> |
298 | 307 | <div class="mt-1"> |
|
0 commit comments