Skip to content

Commit 48c7c43

Browse files
luannmoreiragustavosbarreto
authored andcommitted
fix(ui): disable the item when it's version is set to unreachable
This commit is aimed to add an validation that adds a disabled attribute to the v-list-item inside the v-combobox slot that will disable it if the url doesn't give an info.
1 parent dbeb1b2 commit 48c7c43

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/renderer/src/components/Auth/NewInstanceDialog.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ const request = async (hostUrl: string, config: RequestInit) => {
128128
129129
const addInstance = async () => {
130130
if (hasError.value) {
131-
await request(`${url.value}/info`, {
132-
method: 'GET'
133-
})
131+
return
134132
}
133+
await request(`${url.value}/info`, {
134+
method: 'GET'
135+
})
135136
}
136137
137138
const close = () => {

src/renderer/src/views/Login.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@
3434
:items="items"
3535
>
3636
<template #item="{ item, index, props }">
37-
<v-list-item :value="item.value" lines="two" v-bind="props">
37+
<v-list-item
38+
:value="item.value"
39+
lines="two"
40+
v-bind="props"
41+
:disabled="item.raw.version === 'UNREACHABLE'"
42+
>
3843
<v-list-item-subtitle>
3944
{{ item.raw.url }}
4045
</v-list-item-subtitle>
@@ -43,7 +48,7 @@
4348
<div class="mr-4">
4449
<v-chip
4550
size="x-small"
46-
:color="version === 'UNREACHABLE' ? 'warning' : 'success'"
51+
:color="item.raw.version === 'UNREACHABLE' ? 'error' : 'success'"
4752
>{{ item.raw.version }}</v-chip
4853
>
4954
</div>
@@ -110,7 +115,6 @@ const validForm = ref(false)
110115
const showError = ref(false)
111116
const connecting = ref(false)
112117
const show = ref(true)
113-
const version = ref('')
114118
const items = ref(store.instances)
115119
const newInstance = ref(false)
116120
const instance = computed({

0 commit comments

Comments
 (0)