easy-devops 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -6
- package/dist/ui/assets/index-B6zdwEnG.css +1 -0
- package/dist/ui/assets/index-Cy0oNmul.js +442 -0
- package/dist/ui/assets/socket-DwLPrgsr.js +1 -0
- package/dist/ui/assets/socket-K5ttLD2q.js +65 -0
- package/dist/ui/brand/apple-touch-icon.png +0 -0
- package/dist/ui/brand/favicon-16.png +0 -0
- package/dist/ui/brand/favicon-32.png +0 -0
- package/dist/ui/brand/favicon-light-16.png +0 -0
- package/dist/ui/brand/favicon-light-32.png +0 -0
- package/dist/ui/brand/favicon.ico +0 -0
- package/dist/ui/brand/icon-192.png +0 -0
- package/dist/ui/brand/icon-48.png +0 -0
- package/dist/ui/brand/icon-512.png +0 -0
- package/dist/ui/brand/icon-64-light.png +0 -0
- package/dist/ui/brand/icon-64.png +0 -0
- package/dist/ui/brand/logo-dark.png +0 -0
- package/dist/ui/brand/logo-light.png +0 -0
- package/dist/ui/brand/mark-dark.png +0 -0
- package/dist/ui/brand/mark-light.png +0 -0
- package/dist/ui/index.html +71 -0
- package/install.ps1 +188 -1
- package/install.sh +254 -29
- package/package.json +17 -5
- package/src/cli/dash.js +110 -0
- package/src/cli/index.js +237 -106
- package/src/cli/managers/domain-manager.js +60 -40
- package/src/cli/managers/ssl-manager.js +47 -330
- package/src/cli/menu.js +156 -0
- package/src/cli/menus/cleanup.js +205 -0
- package/src/cli/menus/dashboard.js +93 -2
- package/src/cli/menus/runtime.js +236 -0
- package/src/cli/menus/service.js +764 -0
- package/src/cli/menus/settings.js +176 -8
- package/src/cli/menus/uninstall.js +167 -0
- package/src/cli/menus/update.js +221 -65
- package/src/core/acme-challenge.js +273 -0
- package/src/core/cert-operations.js +189 -0
- package/src/{dashboard/lib → core}/cert-reader.js +2 -2
- package/src/core/cert-renewal.js +494 -0
- package/src/core/channels/discord.js +77 -0
- package/src/core/channels/telegram.js +120 -0
- package/src/core/cleanup.js +600 -0
- package/src/core/config.js +169 -2
- package/src/core/daemon/ipc.js +292 -0
- package/src/core/daemon/lock.js +294 -0
- package/src/core/daemon/run.js +241 -0
- package/src/core/daemon/stopRequest.js +162 -0
- package/src/core/db.js +44 -8
- package/src/core/deploy/apps.js +491 -0
- package/src/core/deploy/domainLink.js +200 -0
- package/src/core/deploy/engine.js +973 -0
- package/src/core/deploy/ezfile.js +361 -0
- package/src/core/deploy/github.js +239 -0
- package/src/core/deploy/githubApi.js +261 -0
- package/src/core/deploy/hookServer.js +325 -0
- package/src/core/deploy/hubCommands.js +267 -0
- package/src/core/deploy/launcher.js +57 -0
- package/src/core/deploy/status.js +91 -0
- package/src/core/deploy/store.js +398 -0
- package/src/core/domainNotifier.js +364 -0
- package/src/core/domains-db.js +234 -0
- package/src/core/events.js +222 -0
- package/src/core/hub/agent.js +842 -0
- package/src/core/hubLink.js +306 -0
- package/src/core/hubPermissions.js +430 -0
- package/src/core/installSource.js +162 -0
- package/src/core/jobs/bus.js +120 -0
- package/src/core/jobs/index.js +371 -0
- package/src/core/jobs/monitors.js +368 -0
- package/src/core/jobs/owner.js +217 -0
- package/src/core/jobs/revisionWatcher.js +106 -0
- package/src/core/nginx-apply.js +213 -0
- package/src/core/nginx-conf-generator.js +253 -17
- package/src/{dashboard/lib → core}/nginx-service.js +18 -9
- package/src/core/notifications/claim.js +214 -0
- package/src/core/notifications/dispatch.js +154 -0
- package/src/core/notifier.js +103 -0
- package/src/core/passwords.js +172 -0
- package/src/core/permissions.js +8 -4
- package/src/core/platform.js +709 -2
- package/src/core/probeCache.js +258 -0
- package/src/core/purge.js +372 -0
- package/src/core/runner.js +488 -0
- package/src/core/service/acl.js +226 -0
- package/src/core/service/dataDir.js +345 -0
- package/src/core/service/index.js +1128 -0
- package/src/core/service/legacy.js +218 -0
- package/src/core/service/runtime.js +446 -0
- package/src/core/service/runtimeUpdate.js +800 -0
- package/src/core/service/systemd.js +458 -0
- package/src/core/service/windowsPersonal.js +530 -0
- package/src/core/service/windowsService.js +576 -0
- package/src/core/service/winsw.js +260 -0
- package/src/core/setupCode.js +331 -0
- package/src/core/shell.js +128 -13
- package/src/core/ssl-issuer.js +627 -0
- package/src/core/updater.js +295 -0
- package/src/core/validators.js +99 -0
- package/src/dashboard/controllers/authController.js +316 -0
- package/src/dashboard/controllers/deploymentsController.js +479 -0
- package/src/dashboard/controllers/domainsController.js +403 -0
- package/src/dashboard/controllers/hubController.js +135 -0
- package/src/dashboard/controllers/nginxController.js +146 -0
- package/src/dashboard/controllers/processesController.js +368 -0
- package/src/dashboard/controllers/settingsController.js +503 -0
- package/src/dashboard/controllers/sslController.js +452 -0
- package/src/dashboard/lib/daemonBridge.js +163 -0
- package/src/dashboard/lib/localRequest.js +235 -0
- package/src/dashboard/lib/loginRateLimit.js +119 -0
- package/src/dashboard/lib/requireAuth.js +80 -0
- package/src/dashboard/public/img/icon.png +0 -0
- package/src/dashboard/public/img/icon_b.png +0 -0
- package/src/dashboard/public/js/app.js +595 -19
- package/src/dashboard/routes/auth.js +14 -33
- package/src/dashboard/routes/deployments.js +46 -0
- package/src/dashboard/routes/domains.js +20 -363
- package/src/dashboard/routes/hub.js +22 -0
- package/src/dashboard/routes/nginx.js +22 -146
- package/src/dashboard/routes/processes.js +29 -0
- package/src/dashboard/routes/settings.js +25 -232
- package/src/dashboard/routes/ssl.js +18 -276
- package/src/dashboard/server.js +279 -165
- package/src/dashboard/socketManager.js +246 -0
- package/src/dashboard/views/index.ejs +1 -0
- package/src/dashboard/views/partials/domain-form.ejs +64 -1
- package/src/dashboard/views/partials/login.ejs +69 -8
- package/src/dashboard/views/partials/processes-panel.ejs +261 -0
- package/src/dashboard/views/partials/settings-panel.ejs +549 -118
- package/src/dashboard/views/partials/sidebar.ejs +3 -1
- package/src/dashboard/lib/domains-db.js +0 -51
- /package/src/{dashboard/routes → core/channels}/.gitkeep +0 -0
|
@@ -1,133 +1,564 @@
|
|
|
1
1
|
<!-- Settings Page -->
|
|
2
2
|
<div v-show="page === 'settings'" class="w-full max-w-4xl pb-12">
|
|
3
|
-
<div class="flex items-center justify-between mb-8">
|
|
4
|
-
<div>
|
|
5
|
-
<h2 class="text-2xl font-bold tracking-tight text-foreground">Settings</h2>
|
|
6
|
-
<p class="text-muted font-medium text-sm mt-1">Dashboard configuration and service paths</p>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
3
|
+
<div class="flex items-center justify-between mb-8">
|
|
4
|
+
<div>
|
|
5
|
+
<h2 class="text-2xl font-bold tracking-tight text-foreground">Settings</h2>
|
|
6
|
+
<p class="text-muted font-medium text-sm mt-1">Dashboard configuration and service paths</p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
<div class="
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
<!-- Tab Navigation -->
|
|
11
|
+
<div class="flex gap-1 mb-6 p-1 bg-black/5 dark:bg-white/5 rounded-[10px] border border-border/50">
|
|
12
|
+
<button
|
|
13
|
+
@click="settingsTab = 'general'"
|
|
14
|
+
class="flex-1 px-4 py-2.5 text-sm font-semibold rounded-[8px] transition-all"
|
|
15
|
+
:class="settingsTab === 'general'
|
|
16
|
+
? 'bg-primary text-white shadow-sm'
|
|
17
|
+
: 'text-muted hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5'">
|
|
18
|
+
⚙️ General Settings
|
|
19
|
+
</button>
|
|
20
|
+
<button
|
|
21
|
+
@click="settingsTab = 'notifications'"
|
|
22
|
+
class="flex-1 px-4 py-2.5 text-sm font-semibold rounded-[8px] transition-all"
|
|
23
|
+
:class="settingsTab === 'notifications'
|
|
24
|
+
? 'bg-primary text-white shadow-sm'
|
|
25
|
+
: 'text-muted hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5'">
|
|
26
|
+
🔔 Notifications
|
|
27
|
+
</button>
|
|
28
|
+
<button
|
|
29
|
+
@click="settingsTab = 'hub'"
|
|
30
|
+
class="flex-1 px-4 py-2.5 text-sm font-semibold rounded-[8px] transition-all"
|
|
31
|
+
:class="settingsTab === 'hub'
|
|
32
|
+
? 'bg-primary text-white shadow-sm'
|
|
33
|
+
: 'text-muted hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5'">
|
|
34
|
+
🌐 Hub
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
15
37
|
|
|
16
|
-
|
|
17
|
-
<div
|
|
38
|
+
<!-- Tab Content: General Settings -->
|
|
39
|
+
<div v-show="settingsTab === 'general'" class="space-y-6">
|
|
18
40
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
<!--
|
|
42
|
+
Background service summary. Installing is done from the CLI (on
|
|
43
|
+
Windows the at-boot task needs an elevated, interactive terminal so
|
|
44
|
+
Windows can prompt for the account password), so this is a read-only
|
|
45
|
+
summary that points at the Processes page for the details.
|
|
46
|
+
-->
|
|
47
|
+
<div class="stat-card overflow-hidden relative">
|
|
48
|
+
<div class="absolute top-0 left-0 w-full h-1"
|
|
49
|
+
:class="svc.status && svc.status.running ? 'bg-green-500/40' : 'bg-yellow-500/40'"></div>
|
|
50
|
+
<div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
|
|
51
|
+
<h3 class="form-label !mb-0 font-bold">Background service</h3>
|
|
52
|
+
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
|
|
53
|
+
Whether Easy DevOps keeps running after you close the terminal
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="p-6 bg-background">
|
|
57
|
+
<div v-if="svc.loading && !svc.status" class="text-sm text-muted">Checking…</div>
|
|
24
58
|
|
|
25
|
-
<div class="
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
</
|
|
59
|
+
<div v-else-if="svc.status && !svc.status.pm2.installed" class="space-y-2">
|
|
60
|
+
<p class="text-sm text-muted">Not set up — PM2 is not installed.</p>
|
|
61
|
+
<p class="text-[13px] text-foreground">
|
|
62
|
+
Run <code class="font-mono">{{ svc.status.cliHint }}</code>
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
30
65
|
|
|
31
|
-
<div class="
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<p class="text-[
|
|
35
|
-
|
|
66
|
+
<div v-else-if="svc.status" class="space-y-4">
|
|
67
|
+
<div class="grid grid-cols-3 gap-4">
|
|
68
|
+
<div>
|
|
69
|
+
<p class="text-[10px] uppercase tracking-widest text-muted font-bold">Installed</p>
|
|
70
|
+
<p class="text-sm font-semibold mt-1"
|
|
71
|
+
:class="svc.status.installed ? 'text-green-500' : 'text-yellow-500'">
|
|
72
|
+
{{ svc.status.installed ? 'Yes' : 'No' }}
|
|
73
|
+
</p>
|
|
74
|
+
</div>
|
|
75
|
+
<div>
|
|
76
|
+
<p class="text-[10px] uppercase tracking-widest text-muted font-bold">Running</p>
|
|
77
|
+
<p class="text-sm font-semibold mt-1"
|
|
78
|
+
:class="svc.status.running ? 'text-green-500' : 'text-yellow-500'">
|
|
79
|
+
{{ svc.status.running ? 'Yes' : (svc.status.status || 'No') }}
|
|
80
|
+
</p>
|
|
81
|
+
</div>
|
|
82
|
+
<div>
|
|
83
|
+
<p class="text-[10px] uppercase tracking-widest text-muted font-bold">On boot</p>
|
|
84
|
+
<p class="text-sm font-semibold mt-1"
|
|
85
|
+
:class="svc.status.enabledOnBoot ? 'text-green-500' : 'text-yellow-500'">
|
|
86
|
+
{{ describeBoot(svc.status) }}
|
|
87
|
+
</p>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
36
90
|
|
|
37
|
-
<div
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
</
|
|
91
|
+
<div v-if="!svc.status.installed || !svc.status.enabledOnBoot"
|
|
92
|
+
class="px-4 py-3 rounded-[10px] text-[13px] border bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-500">
|
|
93
|
+
<span v-if="!svc.status.installed">
|
|
94
|
+
Easy DevOps stops when this terminal closes and will not return after a reboot.
|
|
95
|
+
</span>
|
|
96
|
+
<span v-else>
|
|
97
|
+
The service will not start on boot, so it will not return after a reboot.
|
|
98
|
+
</span>
|
|
99
|
+
Run <code class="font-mono">{{ svc.status.cliHint }}</code>
|
|
100
|
+
</div>
|
|
42
101
|
|
|
43
|
-
|
|
102
|
+
<button @click="loadPage('processes')" class="btn btn-secondary text-xs">
|
|
103
|
+
Open Processes
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
44
108
|
|
|
45
|
-
|
|
46
|
-
<div class="
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
</
|
|
50
|
-
</div>
|
|
109
|
+
<!-- Application Configuration Card -->
|
|
110
|
+
<div class="stat-card overflow-hidden relative">
|
|
111
|
+
<div class="absolute top-0 left-0 w-full h-1 bg-primary/40"></div>
|
|
112
|
+
<div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
|
|
113
|
+
<h3 class="form-label !mb-0 font-bold">Application configuration</h3>
|
|
114
|
+
</div>
|
|
51
115
|
|
|
52
|
-
|
|
116
|
+
<div class="p-8 space-y-10 bg-background">
|
|
117
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-10">
|
|
53
118
|
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
{{ settings.loading ? 'Saving...' : 'Save Settings' }}
|
|
60
|
-
</button>
|
|
61
|
-
</div>
|
|
62
|
-
<div>
|
|
63
|
-
<span v-if="settings.msg" class="text-green-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-green-500/10 border border-green-500/20">{{ settings.msg }}</span>
|
|
64
|
-
<span v-if="settings.error" class="text-red-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-red-500/10 border border-red-500/20">{{ settings.error }}</span>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
119
|
+
<div class="w-full">
|
|
120
|
+
<label class="form-label">Dashboard Port</label>
|
|
121
|
+
<input v-model.number="settings.dashboardPort" type="number" class="form-input" placeholder="6443" />
|
|
122
|
+
<p class="text-[11px] text-muted mt-2 font-bold tracking-wide uppercase opacity-70">Restart dashboard after changing</p>
|
|
123
|
+
</div>
|
|
68
124
|
|
|
69
|
-
<!--
|
|
70
|
-
|
|
71
|
-
<div class="absolute top-0 left-0 w-full h-1 bg-primary/40"></div>
|
|
72
|
-
<div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
|
|
73
|
-
<h3 class="form-label !mb-0 font-bold">Backup & Restore</h3>
|
|
74
|
-
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">Export or restore configuration and domains</p>
|
|
75
|
-
</div>
|
|
76
|
-
<div class="p-8 bg-background flex flex-col sm:flex-row gap-6">
|
|
77
|
-
<div class="flex-1">
|
|
78
|
-
<p class="text-sm text-muted mb-4">Export all settings and domains as a JSON file. Passwords are excluded from the export.</p>
|
|
79
|
-
<button @click="exportBackup" class="btn btn-secondary">
|
|
80
|
-
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
|
|
81
|
-
Export Backup
|
|
82
|
-
</button>
|
|
83
|
-
</div>
|
|
84
|
-
<div class="w-px bg-border hidden sm:block"></div>
|
|
85
|
-
<div class="flex-1">
|
|
86
|
-
<p class="text-sm text-muted mb-4">Restore configuration from a previously exported backup file.</p>
|
|
87
|
-
<label class="btn btn-secondary cursor-pointer" :class="backup.restoring ? 'opacity-50 pointer-events-none' : ''">
|
|
88
|
-
<svg v-if="backup.restoring" class="w-4 h-4 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
|
|
89
|
-
<svg v-else class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l4-4m0 0l4 4m-4-4v12"></path></svg>
|
|
90
|
-
{{ backup.restoring ? 'Restoring...' : 'Import Backup' }}
|
|
91
|
-
<input type="file" accept=".json" class="hidden" @change="importBackup" :disabled="backup.restoring" />
|
|
92
|
-
</label>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
<div v-if="backup.msg || backup.error" class="px-8 pb-6">
|
|
96
|
-
<span v-if="backup.msg" class="text-green-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-green-500/10 border border-green-500/20">{{ backup.msg }}</span>
|
|
97
|
-
<span v-if="backup.error" class="text-red-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-red-500/10 border border-red-500/20">{{ backup.error }}</span>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
125
|
+
<!--
|
|
126
|
+
How the dashboard authenticates.
|
|
100
127
|
|
|
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
|
-
</div>
|
|
128
|
+
"No password" is a real option for a single-user machine, not a
|
|
129
|
+
loophole: the server refuses it unless the listener is bound to
|
|
130
|
+
this machine only, and refuses to open the listener up again
|
|
131
|
+
while it is in force. Both halves are re-checked server-side —
|
|
132
|
+
this control only reflects what is permitted.
|
|
133
|
+
-->
|
|
134
|
+
<div class="w-full">
|
|
135
|
+
<label class="form-label">Authentication</label>
|
|
136
|
+
<select v-model="settings.dashboardAuth" class="form-input">
|
|
137
|
+
<option value="password">Password required</option>
|
|
138
|
+
<option value="none" :disabled="!settings.canUseNoPassword && settings.dashboardAuth !== 'none'">
|
|
139
|
+
No password (this machine only)
|
|
140
|
+
</option>
|
|
141
|
+
</select>
|
|
142
|
+
|
|
143
|
+
<p v-if="settings.dashboardAuth === 'none'"
|
|
144
|
+
class="text-[11px] mt-2 font-bold tracking-wide uppercase opacity-70 text-yellow-600 dark:text-yellow-500">
|
|
145
|
+
No login — reachable from this machine only
|
|
146
|
+
</p>
|
|
147
|
+
<p v-else-if="!settings.hasPassword"
|
|
148
|
+
class="text-[11px] mt-2 font-bold tracking-wide uppercase opacity-70 text-yellow-600 dark:text-yellow-500">
|
|
149
|
+
No password set yet — set one below
|
|
150
|
+
</p>
|
|
151
|
+
<p v-else class="text-[11px] text-muted mt-2 font-bold tracking-wide uppercase opacity-70">
|
|
152
|
+
A password is required to sign in
|
|
153
|
+
</p>
|
|
154
|
+
|
|
155
|
+
<p v-if="!settings.canUseNoPassword && settings.dashboardAuth !== 'none'"
|
|
156
|
+
class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
|
|
157
|
+
To remove the password, set Listen On to this machine only
|
|
158
|
+
</p>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<!--
|
|
162
|
+
Who can reach the dashboard. Loopback-only is the safer default
|
|
163
|
+
and the one new Linux installs get; an existing install keeps
|
|
164
|
+
listening everywhere until it is changed here.
|
|
165
|
+
-->
|
|
166
|
+
<div class="w-full">
|
|
167
|
+
<label class="form-label">Listen On</label>
|
|
168
|
+
<select v-model="settings.dashboardBindAddress" class="form-input">
|
|
169
|
+
<option value="127.0.0.1">This machine only (127.0.0.1)</option>
|
|
170
|
+
<option value="0.0.0.0">All interfaces (0.0.0.0)</option>
|
|
171
|
+
</select>
|
|
172
|
+
<p class="text-[11px] mt-2 font-bold tracking-wide uppercase opacity-70"
|
|
173
|
+
:class="settings.bindsToLoopbackOnly ? 'text-muted' : 'text-yellow-600 dark:text-yellow-500'">
|
|
174
|
+
<span v-if="settings.bindsToLoopbackOnly">
|
|
175
|
+
Currently {{ settings.dashboardBindAddress }} — reachable only from this machine
|
|
176
|
+
</span>
|
|
177
|
+
<span v-else>
|
|
178
|
+
Currently {{ settings.dashboardBindAddress }} — reachable from the network
|
|
179
|
+
</span>
|
|
180
|
+
</p>
|
|
181
|
+
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
|
|
182
|
+
Restart dashboard after changing
|
|
183
|
+
</p>
|
|
184
|
+
<p v-if="settings.dashboardAuth === 'none'"
|
|
185
|
+
class="text-[11px] mt-1 font-bold tracking-wide uppercase opacity-70 text-yellow-600 dark:text-yellow-500">
|
|
186
|
+
Locked to this machine while there is no password
|
|
187
|
+
</p>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div class="w-full">
|
|
191
|
+
<label class="form-label">ACME Email (Let's Encrypt)</label>
|
|
192
|
+
<input v-model="settings.acmeEmail" type="email" class="form-input" placeholder="admin@example.com" />
|
|
193
|
+
<p class="text-[11px] text-muted mt-2 font-bold tracking-wide uppercase opacity-70">Required for certificate issuance</p>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div class="w-full">
|
|
197
|
+
<label class="form-label">Nginx Directory</label>
|
|
198
|
+
<input v-model="settings.nginxDir" class="form-input font-mono text-[13px]" placeholder="/etc/nginx" />
|
|
199
|
+
<p class="text-[11px] text-muted mt-2 font-bold tracking-wide uppercase opacity-70">Where nginx.conf is located</p>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<div class="w-full">
|
|
203
|
+
<label class="form-label">SSL Settings Directory</label>
|
|
204
|
+
<input v-model="settings.sslDir" class="form-input font-mono text-[13px]" placeholder="/etc/nginx/ssl" />
|
|
205
|
+
<p class="text-[11px] text-muted mt-2 font-bold tracking-wide uppercase opacity-70">Directory for default SSL certs</p>
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div class="border-t border-border/50 pt-10">
|
|
211
|
+
<div class="w-full max-w-md">
|
|
212
|
+
<label class="form-label">New Password</label>
|
|
213
|
+
<input v-model="settings.password" type="password" class="form-input" placeholder="Leave blank to keep current" />
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
<!-- Actions area -->
|
|
220
|
+
<div class="p-5 border-t border-border bg-black/5 dark:bg-white/5 flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
|
221
|
+
<div class="flex items-center gap-3">
|
|
222
|
+
<button @click="saveSettings" :disabled="settings.loading" class="btn btn-primary min-w-[140px] shadow-sm">
|
|
223
|
+
<svg v-if="settings.loading" class="w-4 h-4 animate-spin -ml-1 mr-2 inline-block" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
|
|
224
|
+
{{ settings.loading ? 'Saving...' : 'Save Settings' }}
|
|
225
|
+
</button>
|
|
226
|
+
</div>
|
|
227
|
+
<div>
|
|
228
|
+
<span v-if="settings.msg" class="text-green-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-green-500/10 border border-green-500/20">{{ settings.msg }}</span>
|
|
229
|
+
<span v-if="settings.error" class="text-red-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-red-500/10 border border-red-500/20">{{ settings.error }}</span>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<!-- Backup & Restore card -->
|
|
235
|
+
<div class="stat-card overflow-hidden relative">
|
|
236
|
+
<div class="absolute top-0 left-0 w-full h-1 bg-primary/40"></div>
|
|
237
|
+
<div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
|
|
238
|
+
<h3 class="form-label !mb-0 font-bold">Backup & Restore</h3>
|
|
239
|
+
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">Export or restore configuration and domains</p>
|
|
240
|
+
</div>
|
|
241
|
+
<div class="p-8 bg-background flex flex-col sm:flex-row gap-6">
|
|
242
|
+
<div class="flex-1">
|
|
243
|
+
<p class="text-sm text-muted mb-4">Export all settings and domains as a JSON file. Passwords are excluded from the export.</p>
|
|
244
|
+
<button @click="exportBackup" class="btn btn-secondary">
|
|
245
|
+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
|
|
246
|
+
Export Backup
|
|
247
|
+
</button>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="w-px bg-border hidden sm:block"></div>
|
|
250
|
+
<div class="flex-1">
|
|
251
|
+
<p class="text-sm text-muted mb-4">Restore configuration from a previously exported backup file.</p>
|
|
252
|
+
<label class="btn btn-secondary cursor-pointer" :class="backup.restoring ? 'opacity-50 pointer-events-none' : ''">
|
|
253
|
+
<svg v-if="backup.restoring" class="w-4 h-4 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
|
|
254
|
+
<svg v-else class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l4-4m0 0l4 4m-4-4v12"></path></svg>
|
|
255
|
+
{{ backup.restoring ? 'Restoring...' : 'Import Backup' }}
|
|
256
|
+
<input type="file" accept=".json" class="hidden" @change="importBackup" :disabled="backup.restoring" />
|
|
257
|
+
</label>
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
<div v-if="backup.msg || backup.error" class="px-8 pb-6">
|
|
261
|
+
<span v-if="backup.msg" class="text-green-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-green-500/10 border border-green-500/20">{{ backup.msg }}</span>
|
|
262
|
+
<span v-if="backup.error" class="text-red-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-red-500/10 border border-red-500/20">{{ backup.error }}</span>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
<!-- Linux Permissions card (hidden on Windows) -->
|
|
267
|
+
<div v-if="settings.platform !== 'win32'" class="stat-card overflow-hidden relative">
|
|
268
|
+
<div class="absolute top-0 left-0 w-full h-1" :class="permissions.configured ? 'bg-green-500/40' : 'bg-yellow-500/40'"></div>
|
|
269
|
+
<div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5 flex items-center justify-between">
|
|
270
|
+
<div>
|
|
271
|
+
<h3 class="form-label !mb-0 font-bold">Linux Permissions</h3>
|
|
272
|
+
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">Passwordless sudo for nginx and systemctl</p>
|
|
273
|
+
</div>
|
|
274
|
+
<span v-if="permissions.configured" class="text-green-500 text-xs font-bold px-2.5 py-1 rounded-lg bg-green-500/10 border border-green-500/20">✓ Configured</span>
|
|
275
|
+
<span v-else class="text-yellow-500 text-xs font-bold px-2.5 py-1 rounded-lg bg-yellow-500/10 border border-yellow-500/20">⚠ Required</span>
|
|
276
|
+
</div>
|
|
277
|
+
<div class="p-8 bg-background">
|
|
278
|
+
<p v-if="permissions.configured" class="text-sm text-muted">Passwordless sudo is configured. The dashboard can manage nginx and systemctl without prompting for a password.</p>
|
|
279
|
+
<div v-else>
|
|
280
|
+
<p class="text-sm text-muted mb-6">The dashboard needs passwordless sudo to control nginx and systemctl. Enter your sudo password once to configure it.</p>
|
|
281
|
+
<div class="w-full max-w-md">
|
|
282
|
+
<label class="form-label">Sudo Password</label>
|
|
283
|
+
<input v-model="permissions.password" type="password" class="form-input" placeholder="Enter your sudo password" @keyup.enter="setupPermissions" />
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
<div v-if="!permissions.configured" class="p-5 border-t border-border bg-black/5 dark:bg-white/5 flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
|
288
|
+
<button @click="setupPermissions" :disabled="permissions.loading || !permissions.password" class="btn btn-primary min-w-[180px] shadow-sm">
|
|
289
|
+
<svg v-if="permissions.loading" class="w-4 h-4 animate-spin -ml-1 mr-2 inline-block" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
|
|
290
|
+
{{ permissions.loading ? 'Setting up...' : 'Setup Permissions' }}
|
|
291
|
+
</button>
|
|
292
|
+
<div>
|
|
293
|
+
<span v-if="permissions.msg" class="text-green-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-green-500/10 border border-green-500/20">{{ permissions.msg }}</span>
|
|
294
|
+
<span v-if="permissions.error" class="text-red-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-red-500/10 border border-red-500/20">{{ permissions.error }}</span>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<!-- Tab Content: Notifications -->
|
|
301
|
+
<div v-show="settingsTab === 'notifications'" class="space-y-6">
|
|
302
|
+
|
|
303
|
+
<!-- Notification Channels card -->
|
|
304
|
+
<div class="stat-card overflow-hidden relative">
|
|
305
|
+
<div class="absolute top-0 left-0 w-full h-1 bg-primary/40"></div>
|
|
306
|
+
<div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5 flex items-center justify-between">
|
|
307
|
+
<div>
|
|
308
|
+
<h3 class="form-label !mb-0 font-bold">Notification Channels</h3>
|
|
309
|
+
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">Named Discord and Telegram channels — assign to domains per event</p>
|
|
310
|
+
</div>
|
|
311
|
+
<button @click="openAddChannel()" class="btn btn-primary btn-sm shrink-0">+ Add Channel</button>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<div class="p-6 bg-background">
|
|
315
|
+
<div v-if="channels.loading" class="text-muted text-sm py-4 text-center">Loading...</div>
|
|
316
|
+
|
|
317
|
+
<div v-else-if="channels.list.length === 0" class="text-center py-10">
|
|
318
|
+
<p class="text-muted text-sm">No channels configured yet.</p>
|
|
319
|
+
<p class="text-muted text-xs mt-1 opacity-70">Add a Discord webhook or Telegram bot to start receiving notifications.</p>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<div v-else class="space-y-3">
|
|
323
|
+
<div v-for="ch in channels.list" :key="ch.id"
|
|
324
|
+
class="flex items-center justify-between p-4 border border-border/60 rounded-[12px] bg-black/5 dark:bg-white/5">
|
|
325
|
+
<div class="flex items-center gap-3 min-w-0">
|
|
326
|
+
<span class="text-[11px] font-bold px-2 py-0.5 rounded-md shrink-0"
|
|
327
|
+
:class="ch.type === 'discord' ? 'bg-indigo-500/20 text-indigo-400' : 'bg-sky-500/20 text-sky-400'">
|
|
328
|
+
{{ ch.type === 'discord' ? 'Discord' : 'Telegram' }}
|
|
329
|
+
</span>
|
|
330
|
+
<span class="text-sm font-semibold text-foreground truncate">{{ ch.name }}</span>
|
|
331
|
+
<span v-if="ch.message" class="text-[10px] text-muted opacity-60 truncate">{{ ch.message.substring(0, 30) }}{{ ch.message.length > 30 ? '...' : '' }}</span>
|
|
332
|
+
</div>
|
|
333
|
+
<div class="flex items-center gap-2 shrink-0 ml-3">
|
|
334
|
+
<span v-if="channels.testResults[ch.id]?.msg" class="text-green-500 text-xs font-medium">{{ channels.testResults[ch.id].msg }}</span>
|
|
335
|
+
<span v-if="channels.testResults[ch.id]?.error" class="text-red-500 text-xs font-medium">{{ channels.testResults[ch.id].error }}</span>
|
|
336
|
+
<button @click="testChannelById(ch.id)" :disabled="channels.testingId === ch.id" class="btn btn-secondary btn-sm">
|
|
337
|
+
<svg v-if="channels.testingId === ch.id" class="w-3 h-3 animate-spin inline-block mr-1" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
|
|
338
|
+
Test
|
|
339
|
+
</button>
|
|
340
|
+
<button @click="openEditChannel(ch)" class="btn btn-secondary btn-sm">Edit</button>
|
|
341
|
+
<button @click="deleteChannel(ch.id)" class="btn btn-danger btn-sm">Delete</button>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
<!-- Tab Content: Hub -->
|
|
350
|
+
<div v-show="settingsTab === 'hub'" class="space-y-6">
|
|
351
|
+
|
|
352
|
+
<!-- Hub Connection card -->
|
|
353
|
+
<div class="stat-card overflow-hidden relative">
|
|
354
|
+
<div class="absolute top-0 left-0 w-full h-1" :class="hub.status.status === 'connected' ? 'bg-green-500/40' : (hub.status.status === 'rejected' ? 'bg-red-500/40' : 'bg-yellow-500/40')"></div>
|
|
355
|
+
<div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
|
|
356
|
+
<h3 class="form-label !mb-0 font-bold">Easy DevOps Hub</h3>
|
|
357
|
+
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">Monitor and control this server from a central dashboard</p>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
<!--
|
|
361
|
+
Which database this dashboard is using. `--dev` and
|
|
362
|
+
EASY_DEVOPS_DATA_DIR point at a different file, so a CLI started
|
|
363
|
+
without the same flag edits a different domain list entirely.
|
|
364
|
+
That looks exactly like a broken sync, so show it here.
|
|
365
|
+
-->
|
|
366
|
+
<div v-if="hub.status.dataDir" class="px-6 py-3 border-b border-border/50 flex items-start gap-2 flex-wrap text-[11px]">
|
|
367
|
+
<span class="font-bold uppercase tracking-wide text-muted opacity-70">Data directory</span>
|
|
368
|
+
<code class="font-mono text-[11px] text-foreground break-all">{{ hub.status.dataDir }}</code>
|
|
369
|
+
<span v-if="hub.status.devDataDir"
|
|
370
|
+
class="px-1.5 py-0.5 rounded bg-yellow-500/15 text-yellow-600 dark:text-yellow-500 font-bold uppercase tracking-wide">
|
|
371
|
+
dev override
|
|
372
|
+
</span>
|
|
373
|
+
<span v-if="hub.status.devDataDir" class="w-full text-muted">
|
|
374
|
+
This is not the normal data directory. The CLI must run with the same override, or it will
|
|
375
|
+
read and write a different domain list.
|
|
376
|
+
</span>
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<!-- Not linked state — paste the string the hub issued -->
|
|
380
|
+
<div v-if="!hub.status.linked" class="p-8 space-y-6 bg-background">
|
|
381
|
+
<div class="space-y-2">
|
|
382
|
+
<p class="text-sm text-muted">Add this server in the Hub first, then paste the connection string it gives you.</p>
|
|
383
|
+
<ol class="text-[13px] text-muted list-decimal list-inside space-y-1">
|
|
384
|
+
<li>Open your Hub dashboard → <span class="font-semibold text-foreground">Add Server</span></li>
|
|
385
|
+
<li>Enter a display name and submit</li>
|
|
386
|
+
<li>Copy the connection string the Hub shows you</li>
|
|
387
|
+
<li>Paste it below and click Connect</li>
|
|
388
|
+
</ol>
|
|
389
|
+
</div>
|
|
390
|
+
<div class="w-full max-w-md space-y-4">
|
|
391
|
+
<div>
|
|
392
|
+
<label class="form-label">Connection String</label>
|
|
393
|
+
<textarea v-model.trim="hub.form.connectionString" class="form-input font-mono text-xs h-20 resize-none"
|
|
394
|
+
placeholder="ezops://https://hub.example.com|server-id|secret"></textarea>
|
|
395
|
+
<p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
|
|
396
|
+
Shown only once by the Hub. Treat it like a password.
|
|
397
|
+
</p>
|
|
398
|
+
</div>
|
|
399
|
+
<button @click="connectHubAgent" :disabled="hub.loading || !hub.form.connectionString" class="btn btn-primary min-w-[140px]">
|
|
400
|
+
<svg v-if="hub.loading" class="w-4 h-4 animate-spin -ml-1 mr-2 inline-block" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
|
|
401
|
+
{{ hub.loading ? 'Connecting...' : 'Connect' }}
|
|
402
|
+
</button>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
<!-- Linked state -->
|
|
407
|
+
<div v-else class="p-8 space-y-6 bg-background">
|
|
408
|
+
<div class="flex items-center gap-3 flex-wrap">
|
|
409
|
+
<span :class="hubStatusDotClass()" class="w-2.5 h-2.5 rounded-full"></span>
|
|
410
|
+
<span class="text-sm font-semibold">{{ hubStatusLabel() }}</span>
|
|
411
|
+
<span class="text-xs text-muted">{{ hub.status.hubUrl }}</span>
|
|
412
|
+
</div>
|
|
413
|
+
|
|
414
|
+
<!-- Why we are not connected -->
|
|
415
|
+
<div v-if="hub.status.lastError" class="px-4 py-3 rounded-[10px] text-[13px] border"
|
|
416
|
+
:class="hub.status.status === 'rejected'
|
|
417
|
+
? 'bg-red-500/10 border-red-500/20 text-red-500'
|
|
418
|
+
: 'bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-500'">
|
|
419
|
+
{{ hub.status.lastError }}
|
|
420
|
+
</div>
|
|
421
|
+
|
|
422
|
+
<!-- Rejected: only a new string can fix this, so offer the input here -->
|
|
423
|
+
<div v-if="hub.status.status === 'rejected'" class="w-full max-w-md space-y-3 pt-2 border-t border-border/50">
|
|
424
|
+
<label class="form-label">Paste a new connection string</label>
|
|
425
|
+
<textarea v-model.trim="hub.form.connectionString" class="form-input font-mono text-xs h-20 resize-none"
|
|
426
|
+
placeholder="ezops://https://hub.example.com|server-id|secret"></textarea>
|
|
427
|
+
<button @click="connectHubAgent" :disabled="hub.loading || !hub.form.connectionString" class="btn btn-primary">
|
|
428
|
+
{{ hub.loading ? 'Connecting...' : 'Reconnect' }}
|
|
429
|
+
</button>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<div class="space-y-3">
|
|
433
|
+
<div>
|
|
434
|
+
<p class="text-xs font-bold uppercase tracking-wide text-muted">Allow Hub To</p>
|
|
435
|
+
<p class="text-[11px] text-muted mt-1 opacity-70">
|
|
436
|
+
Monitoring (metrics, nginx status, domains, certificate expiry) is always on and is not listed here.
|
|
437
|
+
These toggles are enforced on this server — the Hub cannot grant itself anything.
|
|
438
|
+
</p>
|
|
439
|
+
</div>
|
|
440
|
+
|
|
441
|
+
<div v-for="group in hub.status.tree" :key="group.id" class="border border-border/50 rounded-[10px] overflow-hidden">
|
|
442
|
+
<!-- Group header: checked / unchecked / indeterminate -->
|
|
443
|
+
<label class="flex items-start gap-3 p-3 cursor-pointer bg-black/5 dark:bg-white/5 hover:bg-black/10 dark:hover:bg-white/10 transition-colors">
|
|
444
|
+
<input type="checkbox" class="w-4 h-4 mt-0.5 shrink-0"
|
|
445
|
+
:checked="hubGroupChecked(group)"
|
|
446
|
+
:indeterminate.prop="hubGroupIndeterminate(group)"
|
|
447
|
+
@change="toggleHubGroup(group)" />
|
|
448
|
+
<span class="min-w-0">
|
|
449
|
+
<span class="text-sm font-semibold block">{{ group.label }}</span>
|
|
450
|
+
<span class="text-[11px] text-muted block mt-0.5">{{ group.description }}</span>
|
|
451
|
+
</span>
|
|
452
|
+
</label>
|
|
453
|
+
|
|
454
|
+
<!-- Children -->
|
|
455
|
+
<div class="divide-y divide-border/30">
|
|
456
|
+
<label v-for="child in group.children" :key="child.id"
|
|
457
|
+
class="flex items-start gap-3 py-2.5 pl-10 pr-3"
|
|
458
|
+
:class="child.comingSoon ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-black/5 dark:hover:bg-white/5'">
|
|
459
|
+
<input type="checkbox" class="w-3.5 h-3.5 mt-0.5 shrink-0"
|
|
460
|
+
:checked="hub.status.permissions[child.id] === true"
|
|
461
|
+
:disabled="child.comingSoon"
|
|
462
|
+
@change="toggleHubPermission(child)" />
|
|
463
|
+
<span class="min-w-0">
|
|
464
|
+
<span class="text-[13px] font-medium">
|
|
465
|
+
{{ child.label }}
|
|
466
|
+
<span v-if="child.comingSoon"
|
|
467
|
+
class="ml-2 text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-yellow-500/15 text-yellow-600 dark:text-yellow-500 border border-yellow-500/25">
|
|
468
|
+
Coming soon
|
|
469
|
+
</span>
|
|
470
|
+
</span>
|
|
471
|
+
<span class="text-[11px] text-muted block mt-0.5">{{ child.description }}</span>
|
|
472
|
+
</span>
|
|
473
|
+
</label>
|
|
474
|
+
</div>
|
|
475
|
+
</div>
|
|
476
|
+
|
|
477
|
+
<p class="text-[11px] text-muted opacity-70">{{ hubGrantedCount() }} permission(s) granted.</p>
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
<button @click="unlinkHub" :disabled="hub.loading" class="btn btn-secondary text-red-500 border-red-500/30 hover:bg-red-500/10">
|
|
481
|
+
Unlink from Hub
|
|
482
|
+
</button>
|
|
483
|
+
</div>
|
|
484
|
+
|
|
485
|
+
<!-- Messages -->
|
|
486
|
+
<div v-if="hub.msg" class="px-8 pb-6">
|
|
487
|
+
<span class="text-green-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-green-500/10 border border-green-500/20">{{ hub.msg }}</span>
|
|
488
|
+
</div>
|
|
489
|
+
<div v-if="hub.error" class="px-8 pb-6">
|
|
490
|
+
<span class="text-red-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-red-500/10 border border-red-500/20">{{ hub.error }}</span>
|
|
491
|
+
</div>
|
|
492
|
+
</div>
|
|
493
|
+
</div>
|
|
494
|
+
|
|
495
|
+
<!-- Channel Add/Edit Modal -->
|
|
496
|
+
<div v-if="channelModal.open" class="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 modal-overlay">
|
|
497
|
+
<div class="relative w-full max-w-lg flex flex-col modal-card">
|
|
498
|
+
<div class="flex items-center justify-between p-5 border-b border-border shrink-0" style="background: rgba(0,0,0,0.1)">
|
|
499
|
+
<h3 class="font-bold text-[15px] text-foreground tracking-tight">
|
|
500
|
+
{{ channelModal.editing ? 'Edit Channel' : 'Add Channel' }}
|
|
501
|
+
</h3>
|
|
502
|
+
<button @click="channelModal.open = false" class="btn btn-secondary btn-sm">Cancel</button>
|
|
503
|
+
</div>
|
|
504
|
+
<div class="p-6 space-y-5 bg-background">
|
|
505
|
+
|
|
506
|
+
<div>
|
|
507
|
+
<label class="form-label">Name</label>
|
|
508
|
+
<input v-model="channelModal.form.name" type="text" class="form-input" placeholder="e.g. Production Discord" />
|
|
509
|
+
</div>
|
|
510
|
+
|
|
511
|
+
<div v-if="!channelModal.editing">
|
|
512
|
+
<label class="form-label">Type</label>
|
|
513
|
+
<div class="flex gap-6">
|
|
514
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
515
|
+
<input type="radio" v-model="channelModal.form.type" value="discord" class="text-primary" />
|
|
516
|
+
<span class="text-sm font-bold">Discord</span>
|
|
517
|
+
</label>
|
|
518
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
519
|
+
<input type="radio" v-model="channelModal.form.type" value="telegram" class="text-primary" />
|
|
520
|
+
<span class="text-sm font-bold">Telegram</span>
|
|
521
|
+
</label>
|
|
522
|
+
</div>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
<div v-if="channelModal.form.type === 'discord'">
|
|
526
|
+
<label class="form-label">Webhook URL</label>
|
|
527
|
+
<input v-model="channelModal.form.webhookUrl" type="text" class="form-input font-mono text-sm" placeholder="https://discord.com/api/webhooks/..." />
|
|
528
|
+
</div>
|
|
529
|
+
|
|
530
|
+
<template v-if="channelModal.form.type === 'telegram'">
|
|
531
|
+
<div>
|
|
532
|
+
<label class="form-label">Bot Token</label>
|
|
533
|
+
<input v-model="channelModal.form.botToken" type="text" class="form-input font-mono text-sm" placeholder="123456:ABCdef..." />
|
|
534
|
+
</div>
|
|
535
|
+
<div>
|
|
536
|
+
<label class="form-label">Chat ID</label>
|
|
537
|
+
<input v-model="channelModal.form.chatId" type="text" class="form-input font-mono text-sm" placeholder="100123456789" />
|
|
538
|
+
</div>
|
|
539
|
+
</template>
|
|
540
|
+
|
|
541
|
+
<!-- Message Prefix Field (Discord only) -->
|
|
542
|
+
<div v-if="channelModal.form.type === 'discord'">
|
|
543
|
+
<label class="form-label">Message Prefix <span class="text-muted font-normal">(optional)</span></label>
|
|
544
|
+
<input v-model="channelModal.form.message" type="text" class="form-input" placeholder="e.g. <@&1280907071813976196> or @team" />
|
|
545
|
+
<div class="mt-2 p-3 bg-primary/5 border border-primary/20 rounded-[8px]">
|
|
546
|
+
<p class="text-[11px] text-muted">
|
|
547
|
+
💡 <span class="font-semibold text-foreground">Tip:</span> To mention a Discord role, use <code class="px-1 py-0.5 bg-black/10 dark:bg-white/10 rounded text-[10px]"><@&RoleId></code>
|
|
548
|
+
<span class="opacity-70">— Example: <code class="px-1 py-0.5 bg-black/10 dark:bg-white/10 rounded text-[10px]"><@&1280907071813976196></code> will ping that role on every alert.</span>
|
|
549
|
+
</p>
|
|
550
|
+
</div>
|
|
551
|
+
</div>
|
|
552
|
+
|
|
553
|
+
<p v-if="channelModal.error" class="text-red-500 text-[13px] font-semibold">{{ channelModal.error }}</p>
|
|
554
|
+
</div>
|
|
555
|
+
<div class="p-5 border-t border-border bg-black/5 dark:bg-white/5 flex justify-end gap-3">
|
|
556
|
+
<button @click="channelModal.open = false" class="btn btn-secondary">Cancel</button>
|
|
557
|
+
<button @click="saveChannel()" :disabled="channelModal.saving" class="btn btn-primary min-w-[100px]">
|
|
558
|
+
<svg v-if="channelModal.saving" class="w-4 h-4 animate-spin -ml-1 mr-2 inline-block" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
|
|
559
|
+
{{ channelModal.saving ? 'Saving...' : 'Save' }}
|
|
560
|
+
</button>
|
|
561
|
+
</div>
|
|
562
|
+
</div>
|
|
563
|
+
</div>
|
|
133
564
|
</div>
|