Skip to content

Commit

Permalink
feat: remove backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephyruso committed Dec 2, 2024
1 parent 35cbea0 commit f26ba61
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/store/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ export const addBackend = (backend: Omit<Backend, 'uuid'>) => {
})
activeUuid.value = id
}

export const removeBackend = (uuid: string) => {
backendList.value = backendList.value.filter((end) => end.uuid !== uuid)
}
31 changes: 22 additions & 9 deletions src/views/SetupPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,34 @@
>
{{ $t('submit') }}
</button>
<button
class="btn btn-xs mt-2 w-full"
v-for="backend in backendList"
:key="backend.uuid"
@click="activeUuid = backend.uuid"
>
{{ backend.protocol }}://{{ backend.host }}:{{ backend.port }}
</button>
<div class="flex flex-col gap-2 pt-4">
<div
v-for="backend in backendList"
:key="backend.uuid"
class="flex items-center gap-2"
>
<button
class="btn btn-xs flex-1"
@click="activeUuid = backend.uuid"
>
{{ backend.protocol }}://{{ backend.host }}:{{ backend.port }}
</button>
<button
class="btn btn-circle btn-xs"
@click="() => removeBackend(backend.uuid)"
>
<MinusCircleIcon class="h-4 w-4" />
</button>
</div>
</div>
</div>
</div>
</template>

<script setup lang="ts">
import router from '@/router'
import { activeUuid, addBackend, backendList } from '@/store/setup'
import { activeUuid, addBackend, backendList, removeBackend } from '@/store/setup'
import { MinusCircleIcon } from '@heroicons/vue/24/outline'
import { reactive } from 'vue'
const form = reactive({
Expand Down

0 comments on commit f26ba61

Please sign in to comment.