Spaces:
Sleeping
Sleeping
File size: 6,574 Bytes
4343907 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
<template>
<div class="settings">
<!-- Settings Header -->
<div class="settings-header">
<h1 class="saap-heading-2">Platform Settings</h1>
<p class="saap-body text-saap-gray-600">
Configure your SAAP platform preferences
</p>
</div>
<!-- Settings Sections -->
<div class="settings-sections space-y-6">
<!-- System Configuration -->
<div class="settings-section saap-card p-6">
<h2 class="saap-heading-3 mb-4">System Configuration</h2>
<div class="setting-item">
<label class="setting-label">Backend URL</label>
<input
v-model="backendUrl"
type="url"
class="setting-input"
placeholder="http://localhost:8000"
/>
<p class="setting-description">
SAAP Backend API base URL
</p>
</div>
<div class="setting-item">
<label class="setting-label">WebSocket URL</label>
<input
v-model="websocketUrl"
type="url"
class="setting-input"
placeholder="ws://localhost:8000/ws"
/>
<p class="setting-description">
Real-time updates connection URL
</p>
</div>
</div>
<!-- Agent Configuration -->
<div class="settings-section saap-card p-6">
<h2 class="saap-heading-3 mb-4">Agent Configuration</h2>
<div class="setting-item">
<label class="setting-label">Default Agent Timeout</label>
<input
v-model="agentTimeout"
type="number"
class="setting-input"
placeholder="30"
/>
<p class="setting-description">
Default timeout for agent responses (seconds)
</p>
</div>
<div class="setting-item">
<label class="setting-label">Auto-refresh Interval</label>
<input
v-model="refreshInterval"
type="number"
class="setting-input"
placeholder="30"
/>
<p class="setting-description">
Auto-refresh dashboard every N seconds
</p>
</div>
</div>
<!-- UI Preferences -->
<div class="settings-section saap-card p-6">
<h2 class="saap-heading-3 mb-4">Interface Preferences</h2>
<div class="setting-item">
<label class="setting-label">Theme</label>
<select v-model="theme" class="setting-select">
<option value="light">Light</option>
<option value="dark">Dark</option>
<option value="auto">Auto</option>
</select>
<p class="setting-description">
Dashboard color theme
</p>
</div>
<div class="setting-item">
<div class="checkbox-item">
<input
v-model="enableNotifications"
type="checkbox"
id="notifications"
class="setting-checkbox"
/>
<label for="notifications" class="checkbox-label">
Enable Notifications
</label>
</div>
<p class="setting-description">
Show browser notifications for agent events
</p>
</div>
</div>
<!-- Actions -->
<div class="settings-actions">
<button @click="saveSettings" class="saap-button-primary">
Save Settings
</button>
<button @click="resetSettings" class="saap-button-secondary">
Reset to Defaults
</button>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
// Settings state
const backendUrl = ref('http://localhost:8000')
const websocketUrl = ref('ws://localhost:8000/ws')
const agentTimeout = ref(30)
const refreshInterval = ref(30)
const theme = ref('light')
const enableNotifications = ref(true)
// Load settings from localStorage
const loadSettings = () => {
const saved = localStorage.getItem('saap-settings')
if (saved) {
try {
const settings = JSON.parse(saved)
backendUrl.value = settings.backendUrl || backendUrl.value
websocketUrl.value = settings.websocketUrl || websocketUrl.value
agentTimeout.value = settings.agentTimeout || agentTimeout.value
refreshInterval.value = settings.refreshInterval || refreshInterval.value
theme.value = settings.theme || theme.value
enableNotifications.value = settings.enableNotifications ?? enableNotifications.value
} catch (error) {
console.error('Failed to load settings:', error)
}
}
}
// Save settings to localStorage
const saveSettings = () => {
const settings = {
backendUrl: backendUrl.value,
websocketUrl: websocketUrl.value,
agentTimeout: agentTimeout.value,
refreshInterval: refreshInterval.value,
theme: theme.value,
enableNotifications: enableNotifications.value
}
localStorage.setItem('saap-settings', JSON.stringify(settings))
// Show success notification (simple alert for now)
alert('Settings saved successfully!')
}
// Reset settings to defaults
const resetSettings = () => {
if (confirm('Reset all settings to defaults?')) {
backendUrl.value = 'http://localhost:8000'
websocketUrl.value = 'ws://localhost:8000/ws'
agentTimeout.value = 30
refreshInterval.value = 30
theme.value = 'light'
enableNotifications.value = true
localStorage.removeItem('saap-settings')
alert('Settings reset to defaults!')
}
}
onMounted(() => {
loadSettings()
})
</script>
<style scoped>
.settings {
@apply space-y-8;
}
.settings-header {
@apply space-y-2;
}
.settings-sections {
@apply space-y-6;
}
.settings-section {
@apply space-y-4;
}
.setting-item {
@apply space-y-2;
}
.setting-label {
@apply block text-sm font-medium text-saap-gray-700;
}
.setting-input,
.setting-select {
@apply w-full px-3 py-2 border border-saap-gray-300 rounded-md;
@apply focus:outline-none focus:ring-2 focus:ring-saap-primary-500 focus:border-transparent;
@apply text-saap-gray-900 bg-white;
}
.setting-description {
@apply text-sm text-saap-gray-500;
}
.checkbox-item {
@apply flex items-center space-x-2;
}
.setting-checkbox {
@apply h-4 w-4 text-saap-primary-600 border-saap-gray-300 rounded;
@apply focus:ring-saap-primary-500 focus:ring-2;
}
.checkbox-label {
@apply text-sm font-medium text-saap-gray-700 cursor-pointer;
}
.settings-actions {
@apply flex space-x-4;
}
</style> |