Fix unable to delete servers that are unreachable, include delete icon btn on server item #1703

This commit is contained in:
advplyr
2025-11-21 17:24:16 -06:00
parent 1df07dc58d
commit 68d82f7a3a
2 changed files with 28 additions and 29 deletions
+14 -10
View File
@@ -4,13 +4,16 @@
<!-- list of server connection configs --> <!-- list of server connection configs -->
<template v-if="!showForm"> <template v-if="!showForm">
<div v-for="config in serverConnectionConfigs" :key="config.id" class="border-b border-fg/10 py-4"> <div v-for="config in serverConnectionConfigs" :key="config.id" class="border-b border-fg/10 py-4">
<div class="flex items-center my-1 relative" @click="connectToServer(config)"> <div class="flex items-center my-1 relative space-x-2" @click="connectToServer(config)">
<span class="material-symbols text-xl text-fg-muted">dns</span> <div class="grow inline-flex items-center overflow-hidden">
<p class="pl-3 pr-6 text-base text-fg">{{ config.name }}</p> <p class="text-base text-fg truncate">{{ config.name }}</p>
</div>
<div class="absolute top-0 right-0 h-full px-4 flex items-center" @click.stop="editServerConfig(config)"> <div class="h-full w-6 flex items-center" @click.stop="editServerConfig(config)">
<span class="material-symbols text-2xl text-fg-muted">more_vert</span> <span class="material-symbols text-2xl text-fg-muted">more_vert</span>
</div> </div>
<div class="h-full w-6 flex items-center" @click.stop="removeServerConfigClick(config)">
<span class="material-symbols fill text-1.5xl text-fg-muted">delete</span>
</div>
</div> </div>
<!-- warning message if server connection config is using an old user id --> <!-- warning message if server connection config is using an old user id -->
<div v-if="!checkIdUuid(config.userId)" class="flex flex-nowrap justify-between items-center space-x-4 pt-4"> <div v-if="!checkIdUuid(config.userId)" class="flex flex-nowrap justify-between items-center space-x-4 pt-4">
@@ -57,7 +60,7 @@
<ui-text-input v-model="password" type="password" :disabled="processing" :placeholder="$strings.LabelPassword" class="w-full mb-2 text-lg" /> <ui-text-input v-model="password" type="password" :disabled="processing" :placeholder="$strings.LabelPassword" class="w-full mb-2 text-lg" />
<div class="flex items-center pt-2"> <div class="flex items-center pt-2">
<ui-icon-btn v-if="serverConfig.id" small bg-color="error" icon="delete" type="button" @click="removeServerConfigClick" /> <ui-icon-btn v-if="serverConfig.id" bg-color="error" icon="delete" type="button" @click="removeServerConfigClick(serverConfig)" />
<div class="flex-grow" /> <div class="flex-grow" />
<ui-btn :disabled="processing || !networkConnected" type="submit" class="mt-1 h-10">{{ networkConnected ? $strings.ButtonSubmit : $strings.MessageNoNetworkConnection }}</ui-btn> <ui-btn :disabled="processing || !networkConnected" type="submit" class="mt-1 h-10">{{ networkConnected ? $strings.ButtonSubmit : $strings.MessageNoNetworkConnection }}</ui-btn>
</div> </div>
@@ -478,8 +481,8 @@ export default {
} }
} }
}, },
async removeServerConfigClick() { async removeServerConfigClick(serverConfig) {
if (!this.serverConfig.id) return if (!serverConfig.id) return
await this.$hapticsImpact() await this.$hapticsImpact()
const { value } = await Dialog.confirm({ const { value } = await Dialog.confirm({
@@ -488,9 +491,9 @@ export default {
}) })
if (value) { if (value) {
this.processing = true this.processing = true
await this.$db.removeServerConnectionConfig(this.serverConfig.id) await this.$db.removeServerConnectionConfig(serverConfig.id)
const updatedDeviceData = { ...this.deviceData } const updatedDeviceData = { ...this.deviceData }
updatedDeviceData.serverConnectionConfigs = this.deviceData.serverConnectionConfigs.filter((scc) => scc.id != this.serverConfig.id) updatedDeviceData.serverConnectionConfigs = this.deviceData.serverConnectionConfigs.filter((scc) => scc.id != serverConfig.id)
this.$store.commit('setDeviceData', updatedDeviceData) this.$store.commit('setDeviceData', updatedDeviceData)
this.serverConfig = { this.serverConfig = {
@@ -502,6 +505,7 @@ export default {
this.processing = false this.processing = false
this.showAuth = false this.showAuth = false
this.showForm = !this.serverConnectionConfigs.length this.showForm = !this.serverConnectionConfigs.length
this.error = null
} }
}, },
async editServerConfig(serverConfig) { async editServerConfig(serverConfig) {
+14 -19
View File
@@ -1,17 +1,11 @@
const defaultTheme = require('tailwindcss/defaultTheme') const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = { module.exports = {
content: [ content: ['components/**/*.vue', 'layouts/**/*.vue', 'pages/**/*.vue', 'mixins/**/*.js', 'plugins/**/*.js'],
'components/**/*.vue',
'layouts/**/*.vue',
'pages/**/*.vue',
'mixins/**/*.js',
'plugins/**/*.js'
],
theme: { theme: {
extend: { extend: {
screens: { screens: {
'short': { 'raw': '(max-height: 500px)' } short: { raw: '(max-height: 500px)' }
}, },
colors: { colors: {
bg: 'rgb(var(--color-bg) / <alpha-value>)', bg: 'rgb(var(--color-bg) / <alpha-value>)',
@@ -24,7 +18,7 @@ module.exports = {
'bg-toggle': 'rgb(var(--color-bg-toggle) / <alpha-value>)', 'bg-toggle': 'rgb(var(--color-bg-toggle) / <alpha-value>)',
'bg-toggle-selected': 'rgb(var(--color-bg-toggle-selected) / <alpha-value>)', 'bg-toggle-selected': 'rgb(var(--color-bg-toggle-selected) / <alpha-value>)',
'track-cursor': 'rgb(var(--color-track-cursor) / <alpha-value>)', 'track-cursor': 'rgb(var(--color-track-cursor) / <alpha-value>)',
'track': 'rgb(var(--color-track) / <alpha-value>)', track: 'rgb(var(--color-track) / <alpha-value>)',
'track-buffered': 'rgb(var(--color-track-buffered) / <alpha-value>)', 'track-buffered': 'rgb(var(--color-track-buffered) / <alpha-value>)',
accent: '#1ad691', accent: '#1ad691',
error: '#FF5252', error: '#FF5252',
@@ -41,28 +35,29 @@ module.exports = {
mono: ['Ubuntu Mono', ...defaultTheme.fontFamily.mono] mono: ['Ubuntu Mono', ...defaultTheme.fontFamily.mono]
}, },
fontSize: { fontSize: {
'1.5xl': '1.375rem',
xxs: '0.625rem' xxs: '0.625rem'
}, },
spacing: { spacing: {
'18': '4.5rem' 18: '4.5rem'
}, },
height: { height: {
'18': '4.5rem' 18: '4.5rem'
}, },
maxWidth: { maxWidth: {
'24': '6rem' 24: '6rem'
}, },
minWidth: { minWidth: {
'4': '1rem', 4: '1rem',
'8': '2rem', 8: '2rem',
'10': '2.5rem', 10: '2.5rem',
'12': '3rem', 12: '3rem',
'16': '4rem' 16: '4rem'
}, },
minHeight: { minHeight: {
'12': '3rem' 12: '3rem'
} }
} }
}, },
plugins: [], plugins: []
} }