UI: shared toast notifications in the bottom-right corner
- useToast composable and ToastContainer (mounted once in App.vue): stacked toasts with icon, close button and progress bar, hover pause, slide-in animation, aria roles, full width on phones. - Light and dark theme colour tokens; old .toast-message styles removed. - PKIConfig, VPNConfig, ServerManagement and Certificates use the shared toast through thin showMessage/showToast wrappers. - Docs: plan and summary in DOCS/Changes, README, Index. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d251ec73d0
commit
dcc3d7f2d5
12 files changed
+316
-93
No files matched your search
@@ -147,11 +147,6 @@
|
||||
<NewClientModal ref="newClientModal" @create="createClient" />
|
||||
<ConfirmModal ref="confirmModal" @confirm="confirmRevoke" />
|
||||
<ProfileDetailsModal ref="detailsModal" @save="saveNote" />
|
||||
|
||||
<div v-if="toastMessage" class="toast-message show" :class="'toast-' + toastType" style="position: fixed; bottom: 20px; right: 20px; z-index: 9999;">
|
||||
<i class="fas" :class="toastType === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle'"></i>
|
||||
{{ toastMessage }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -161,8 +156,10 @@ import NewClientModal from '../components/NewClientModal.vue';
|
||||
import ConfirmModal from '../components/ConfirmModal.vue';
|
||||
import ProfileDetailsModal from '../components/ProfileDetailsModal.vue';
|
||||
import vNoteTooltip from '../directives/noteTooltip';
|
||||
import { useToast } from '../composables/useToast';
|
||||
|
||||
const { profilesApiClient } = useApi();
|
||||
const toast = useToast();
|
||||
|
||||
const loading = ref(true);
|
||||
const allProfiles = ref([]);
|
||||
@@ -172,14 +169,7 @@ const hideExpired = ref(false);
|
||||
const newClientModal = ref(null);
|
||||
const confirmModal = ref(null);
|
||||
const detailsModal = ref(null);
|
||||
const toastMessage = ref('');
|
||||
const toastType = ref('success');
|
||||
|
||||
const showToast = (msg, type = 'success') => {
|
||||
toastMessage.value = msg;
|
||||
toastType.value = type;
|
||||
setTimeout(() => toastMessage.value = '', 3000);
|
||||
};
|
||||
const showToast = (msg, type = 'success') => toast.show(msg, type);
|
||||
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr) return 'N/A';
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
<h1>PKI Infrastructure Configuration</h1>
|
||||
</div>
|
||||
|
||||
<div v-if="message.text" :class="['toast-message', 'toast-' + message.type, 'show']">
|
||||
<i :class="['fas', message.icon]"></i> {{ message.text }}
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="handleSave">
|
||||
<div class="config-row">
|
||||
<div class="config-col">
|
||||
@@ -176,8 +172,10 @@
|
||||
import { ref, computed, onMounted, onUnmounted, reactive } from 'vue';
|
||||
|
||||
import { useApi } from '../composables/useApi';
|
||||
import { useToast } from '../composables/useToast';
|
||||
|
||||
const { profilesApiClient } = useApi();
|
||||
const toast = useToast();
|
||||
|
||||
// State
|
||||
const form = reactive({
|
||||
@@ -198,12 +196,6 @@ const form = reactive({
|
||||
easyrsa_batch: true
|
||||
});
|
||||
|
||||
const message = reactive({
|
||||
text: '',
|
||||
type: 'success', // success, warning, error (mapped to css classes)
|
||||
icon: 'fa-check-circle'
|
||||
});
|
||||
|
||||
const isLoading = ref(false);
|
||||
const action = ref(''); // 'save', 'init', 'clear'
|
||||
|
||||
@@ -225,16 +217,7 @@ const stepText = computed(() => STEP_TEXTS[initStatus.step] || 'Initializing PKI
|
||||
let pollTimer = null;
|
||||
|
||||
// Methods
|
||||
const showMessage = (text, type = 'success') => {
|
||||
message.text = text;
|
||||
message.type = type;
|
||||
message.icon = type === 'success' ? 'fa-check-circle' : type === 'warning' ? 'fa-exclamation-triangle' : 'fa-exclamation-circle';
|
||||
|
||||
// Auto hide
|
||||
setTimeout(() => {
|
||||
message.text = '';
|
||||
}, 4000);
|
||||
};
|
||||
const showMessage = (text, type = 'success') => toast.show(text, type);
|
||||
|
||||
// API Fetch Wrapper
|
||||
// API Wrapper removed, using profilesApiClient directly
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
<h1>Server Process Management</h1>
|
||||
</div>
|
||||
|
||||
<div v-if="message.text" :class="['toast-message', 'toast-' + message.type, 'show']">
|
||||
<i :class="['fas', message.icon]"></i> {{ message.text }}
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Stats Grid -->
|
||||
<!-- User requested specific order: CPU (full), Status, PID, Memory, Uptime -->
|
||||
@@ -92,8 +88,10 @@
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue';
|
||||
import { useApi } from '../composables/useApi';
|
||||
import { useToast } from '../composables/useToast';
|
||||
|
||||
const { profilesApiClient } = useApi();
|
||||
const toast = useToast();
|
||||
|
||||
// State
|
||||
const stats = reactive({
|
||||
@@ -104,26 +102,12 @@ const stats = reactive({
|
||||
uptime: null
|
||||
});
|
||||
|
||||
const message = reactive({
|
||||
text: '',
|
||||
type: 'success',
|
||||
icon: 'fa-check-circle'
|
||||
});
|
||||
|
||||
const isLoading = ref(false);
|
||||
const action = ref(''); // 'start', 'stop', 'restart'
|
||||
let pollInterval = null;
|
||||
|
||||
// Methods
|
||||
const showMessage = (text, type = 'success') => {
|
||||
message.text = text;
|
||||
message.type = type;
|
||||
message.icon = type === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle';
|
||||
|
||||
setTimeout(() => {
|
||||
message.text = '';
|
||||
}, 4000);
|
||||
};
|
||||
const showMessage = (text, type = 'success') => toast.show(text, type);
|
||||
|
||||
const fetchStats = async () => {
|
||||
try {
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
<h1>Server Infrastructure Configuration</h1>
|
||||
</div>
|
||||
|
||||
<div v-if="message.text" :class="['toast-message', 'toast-' + message.type, 'show']">
|
||||
<i :class="['fas', message.icon]"></i> {{ message.text }}
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="handleSave">
|
||||
<!-- Basic Network -->
|
||||
<div class="config-row">
|
||||
@@ -257,8 +253,10 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, reactive, watch } from 'vue';
|
||||
import { useApi } from '../composables/useApi';
|
||||
import { useToast } from '../composables/useToast';
|
||||
|
||||
const { profilesApiClient } = useApi();
|
||||
const toast = useToast();
|
||||
|
||||
// State
|
||||
const form = reactive({
|
||||
@@ -285,11 +283,6 @@ const form = reactive({
|
||||
|
||||
const isSplitTunnel = ref(false);
|
||||
|
||||
const message = reactive({
|
||||
text: '',
|
||||
type: 'success',
|
||||
icon: 'fa-check-circle'
|
||||
});
|
||||
const isLoading = ref(false);
|
||||
const action = ref('');
|
||||
|
||||
@@ -309,12 +302,7 @@ function maskToCidr(mask) {
|
||||
}
|
||||
|
||||
// Methods
|
||||
const showMessage = (text, type = 'success') => {
|
||||
message.text = text;
|
||||
message.type = type;
|
||||
message.icon = type === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle';
|
||||
setTimeout(() => message.text = '', 5000);
|
||||
};
|
||||
const showMessage = (text, type = 'success') => toast.show(text, type);
|
||||
|
||||
const addRoute = () => form.split_routes.push('');
|
||||
const removeRoute = (idx) => form.split_routes.splice(idx, 1);
|
||||
|
||||
Reference in new issue
Block a user