-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
342 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<script setup lang="ts"> | ||
import * as mutations from '~/mutations' | ||
import * as queries from '~/queries' | ||
const apiStore = useAPIStore() | ||
const defaults = await apiStore.getDefaults() | ||
const { data: dnss, execute: reloadDNSs } = useAsyncData( | ||
'routings', | ||
async () => { | ||
const data = await apiStore.apiClient?.query(queries.dnss, {}) | ||
return data?.data?.dnss | ||
} | ||
) | ||
const isRemovingDNS = ref(false) | ||
const removeDNS = async (id: string | number) => { | ||
isRemovingDNS.value = true | ||
try { | ||
await apiStore.apiClient?.mutation(mutations.removeDNS, { id }) | ||
await reloadDNSs() | ||
} finally { | ||
isRemovingDNS.value = false | ||
} | ||
} | ||
const isSelectingDNS = ref(false) | ||
const selectDNS = async (id: string | number) => { | ||
isSelectingDNS.value = true | ||
try { | ||
await apiStore.apiClient?.mutation(mutations.selectDNS, { id }) | ||
await reloadDNSs() | ||
} finally { | ||
isSelectingDNS.value = false | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="space-y-2"> | ||
<UButton block icon="i-heroicons-plus" /> | ||
|
||
<UCard v-for="dns in dnss" :key="dns.id"> | ||
<template #header> | ||
{{ dns.name }} | ||
</template> | ||
|
||
<template #footer> | ||
<div class="flex justify-end gap-2"> | ||
<UButton | ||
:loading="isRemovingDNS" | ||
:disabled="dns.id === defaults?.defaultDNSID || dns.selected" | ||
size="xs" | ||
icon="i-heroicons-minus" | ||
@click="removeDNS(dns.id)" | ||
/> | ||
|
||
<UButton | ||
:loading="isSelectingDNS" | ||
:disabled="dns.selected" | ||
size="xs" | ||
icon="i-heroicons-map-pin" | ||
@click="selectDNS(dns.id)" | ||
/> | ||
</div> | ||
</template> | ||
</UCard> | ||
</div> | ||
</template> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<script setup lang="ts"> | ||
import * as mutations from '~/mutations' | ||
import * as queries from '~/queries' | ||
const apiStore = useAPIStore() | ||
const defaults = await apiStore.getDefaults() | ||
const { data: routings, execute: reloadRoutings } = useAsyncData( | ||
'routings', | ||
async () => { | ||
const data = await apiStore.apiClient?.query(queries.routings, {}) | ||
return data?.data?.routings | ||
} | ||
) | ||
const isRemovingRouting = ref(false) | ||
const removeRouting = async (id: string | number) => { | ||
isRemovingRouting.value = true | ||
try { | ||
await apiStore.apiClient?.mutation(mutations.removeRouting, { id }) | ||
await reloadRoutings() | ||
} finally { | ||
isRemovingRouting.value = false | ||
} | ||
} | ||
const isSelectingRouting = ref(false) | ||
const selectRouting = async (id: string | number) => { | ||
isSelectingRouting.value = true | ||
try { | ||
await apiStore.apiClient?.mutation(mutations.selectRouting, { id }) | ||
await reloadRoutings() | ||
} finally { | ||
isSelectingRouting.value = false | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="space-y-2"> | ||
<UButton block icon="i-heroicons-plus" /> | ||
|
||
<UCard v-for="routing in routings" :key="routing.id"> | ||
<template #header> | ||
{{ routing.name }} | ||
</template> | ||
|
||
<template #footer> | ||
<div class="flex justify-end gap-2"> | ||
<UButton | ||
:loading="isRemovingRouting" | ||
:disabled=" | ||
routing.id === defaults?.defaultRoutingID || routing.selected | ||
" | ||
size="xs" | ||
icon="i-heroicons-minus" | ||
@click="removeRouting(routing.id)" | ||
/> | ||
|
||
<UButton | ||
:loading="isSelectingRouting" | ||
:disabled="routing.selected" | ||
size="xs" | ||
icon="i-heroicons-map-pin" | ||
@click="selectRouting(routing.id)" | ||
/> | ||
</div> | ||
</template> | ||
</UCard> | ||
</div> | ||
</template> |
Oops, something went wrong.