File tree Expand file tree Collapse file tree 1 file changed +25
-11
lines changed
src/pages/options_src/Services Expand file tree Collapse file tree 1 file changed +25
-11
lines changed Original file line number Diff line number Diff line change 207
207
<span style ="color: {pingCache [instance ].color }" >{pingCache [instance ].value }</span >
208
208
{/if }
209
209
</span >
210
- < button
211
- class = " add "
212
- aria-label = " Add instance "
213
- on:click ={() => {
214
- if ( _options [ selectedFrontend ]) {
215
- if (! _options [selectedFrontend ]. includes ( instance ) ) {
210
+ { #if ! _options [ selectedFrontend ]. includes ( instance )}
211
+ < button
212
+ class = " add "
213
+ aria-label = " Add instance "
214
+ on:click ={() => {
215
+ if (_options [selectedFrontend ]) {
216
216
_options [selectedFrontend ].push (instance )
217
217
options .set (_options )
218
218
}
219
- }
220
- }}
221
- >
222
- <AddIcon />
223
- </button >
219
+ }}
220
+ >
221
+ <AddIcon />
222
+ </button >
223
+ {:else }
224
+ <button
225
+ class =" add"
226
+ aria-label =" Remove Instance"
227
+ on:click ={() => {
228
+ const index = _options [selectedFrontend ].indexOf (instance )
229
+ if (index > - 1 ) {
230
+ _options [selectedFrontend ].splice (index , 1 )
231
+ options .set (_options )
232
+ }
233
+ }}
234
+ >
235
+ <CloseIcon />
236
+ </button >
237
+ {/if }
224
238
</Row >
225
239
<hr />
226
240
{/each }
You can’t perform that action at this time.
0 commit comments