@alliance-droid/status-feedback-system 0.1.0 → 0.1.1
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/dist/api.d.ts +57 -0
- package/dist/api.js +76 -0
- package/dist/components/FeedbackButton.svelte +3 -3
- package/dist/components/FeedbackButton.svelte.d.ts +1 -1
- package/dist/components/FeedbackForm.svelte +3 -3
- package/dist/components/FeedbackForm.svelte.d.ts +1 -1
- package/dist/components/StatusBanner.svelte +36 -3
- package/dist/components/StatusBanner.svelte.d.ts +7 -1
- package/dist/components/StatusPage.svelte +150 -83
- package/dist/components/StatusPage.svelte.d.ts +10 -3
- package/dist/index.d.ts +6 -9
- package/dist/index.js +5 -8
- package/dist/types.d.ts +0 -6
- package/package.json +2 -13
- package/dist/components/admin/AdminDashboard.svelte +0 -274
- package/dist/components/admin/AdminDashboard.svelte.d.ts +0 -9
- package/dist/components/admin/ApiKeyManager.svelte +0 -68
- package/dist/components/admin/ApiKeyManager.svelte.d.ts +0 -7
- package/dist/components/admin/FeedbackList.svelte +0 -160
- package/dist/components/admin/FeedbackList.svelte.d.ts +0 -17
- package/dist/components/admin/IncidentForm.svelte +0 -135
- package/dist/components/admin/IncidentForm.svelte.d.ts +0 -14
- package/dist/components/admin/IncidentManager.svelte +0 -153
- package/dist/components/admin/IncidentManager.svelte.d.ts +0 -13
- package/dist/components/admin/ProjectForm.svelte +0 -106
- package/dist/components/admin/ProjectForm.svelte.d.ts +0 -13
- package/dist/components/admin/ProjectList.svelte +0 -57
- package/dist/components/admin/ProjectList.svelte.d.ts +0 -10
- package/dist/components/admin/StatusControl.svelte +0 -62
- package/dist/components/admin/StatusControl.svelte.d.ts +0 -8
- package/dist/components/admin/SystemManager.svelte +0 -119
- package/dist/components/admin/SystemManager.svelte.d.ts +0 -13
- package/dist/components/admin/index.d.ts +0 -9
- package/dist/components/admin/index.js +0 -9
- package/dist/server/db.d.ts +0 -17
- package/dist/server/db.js +0 -68
- package/dist/server/feedback.d.ts +0 -27
- package/dist/server/feedback.js +0 -124
- package/dist/server/handlers.d.ts +0 -41
- package/dist/server/handlers.js +0 -251
- package/dist/server/incidents.d.ts +0 -27
- package/dist/server/incidents.js +0 -180
- package/dist/server/index.d.ts +0 -101
- package/dist/server/index.js +0 -71
- package/dist/server/projects.d.ts +0 -45
- package/dist/server/projects.js +0 -156
- package/dist/server/schema.d.ts +0 -9
- package/dist/server/schema.js +0 -94
- package/dist/server/systems.d.ts +0 -20
- package/dist/server/systems.js +0 -146
- package/dist/server/types.d.ts +0 -4
- package/dist/server/types.js +0 -4
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { System, IncidentSeverity } from '../../types.js';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
systems: System[];
|
|
6
|
-
onSave?: (data: {
|
|
7
|
-
title: string;
|
|
8
|
-
severity: IncidentSeverity;
|
|
9
|
-
affectedSystems: string[];
|
|
10
|
-
message: string;
|
|
11
|
-
}) => Promise<void>;
|
|
12
|
-
onCancel?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let { systems, onSave, onCancel }: Props = $props();
|
|
16
|
-
|
|
17
|
-
let title = $state('');
|
|
18
|
-
let severity = $state<IncidentSeverity>('minor');
|
|
19
|
-
let message = $state('');
|
|
20
|
-
let selectedSystems = $state<string[]>([]);
|
|
21
|
-
let saving = $state(false);
|
|
22
|
-
|
|
23
|
-
const severities: IncidentSeverity[] = ['minor', 'major', 'critical'];
|
|
24
|
-
|
|
25
|
-
function toggleSystem(id: string) {
|
|
26
|
-
if (selectedSystems.includes(id)) {
|
|
27
|
-
selectedSystems = selectedSystems.filter((s) => s !== id);
|
|
28
|
-
} else {
|
|
29
|
-
selectedSystems = [...selectedSystems, id];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function handleSubmit(e: Event) {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
if (!title.trim() || !message.trim()) return;
|
|
36
|
-
saving = true;
|
|
37
|
-
try {
|
|
38
|
-
await onSave?.({
|
|
39
|
-
title: title.trim(),
|
|
40
|
-
severity,
|
|
41
|
-
affectedSystems: selectedSystems,
|
|
42
|
-
message: message.trim(),
|
|
43
|
-
});
|
|
44
|
-
} finally {
|
|
45
|
-
saving = false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<form onsubmit={handleSubmit} class="space-y-4">
|
|
51
|
-
<h3 class="text-base font-semibold text-foreground">Report Incident</h3>
|
|
52
|
-
|
|
53
|
-
<div>
|
|
54
|
-
<label for="sf-inc-title" class="mb-1 block text-sm font-semibold text-foreground">
|
|
55
|
-
Title <span class="text-red-500">*</span>
|
|
56
|
-
</label>
|
|
57
|
-
<input
|
|
58
|
-
id="sf-inc-title"
|
|
59
|
-
type="text"
|
|
60
|
-
bind:value={title}
|
|
61
|
-
required
|
|
62
|
-
placeholder="Brief description of the issue"
|
|
63
|
-
class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-foreground"
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div>
|
|
68
|
-
<label class="mb-1 block text-sm font-semibold text-foreground">Severity</label>
|
|
69
|
-
<div class="flex gap-2">
|
|
70
|
-
{#each severities as s}
|
|
71
|
-
<button
|
|
72
|
-
type="button"
|
|
73
|
-
onclick={() => (severity = s)}
|
|
74
|
-
class="rounded-md px-3 py-1.5 text-xs font-semibold capitalize transition-colors {severity === s
|
|
75
|
-
? 'bg-primary text-primary-foreground'
|
|
76
|
-
: 'border border-border text-foreground-secondary hover:bg-surface-hover'}"
|
|
77
|
-
>
|
|
78
|
-
{s}
|
|
79
|
-
</button>
|
|
80
|
-
{/each}
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
{#if systems.length > 0}
|
|
85
|
-
<div>
|
|
86
|
-
<label class="mb-1 block text-sm font-semibold text-foreground">Affected Systems</label>
|
|
87
|
-
<div class="flex flex-wrap gap-2">
|
|
88
|
-
{#each systems as system}
|
|
89
|
-
<button
|
|
90
|
-
type="button"
|
|
91
|
-
onclick={() => toggleSystem(system.id)}
|
|
92
|
-
class="rounded-md px-2.5 py-1 text-xs transition-colors {selectedSystems.includes(system.id)
|
|
93
|
-
? 'bg-red-500/10 border border-red-500/30 text-red-500'
|
|
94
|
-
: 'border border-border text-foreground-secondary hover:bg-surface-hover'}"
|
|
95
|
-
>
|
|
96
|
-
{system.name}
|
|
97
|
-
</button>
|
|
98
|
-
{/each}
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
{/if}
|
|
102
|
-
|
|
103
|
-
<div>
|
|
104
|
-
<label for="sf-inc-msg" class="mb-1 block text-sm font-semibold text-foreground">
|
|
105
|
-
Initial Update <span class="text-red-500">*</span>
|
|
106
|
-
</label>
|
|
107
|
-
<textarea
|
|
108
|
-
id="sf-inc-msg"
|
|
109
|
-
bind:value={message}
|
|
110
|
-
rows="3"
|
|
111
|
-
required
|
|
112
|
-
placeholder="What's happening and what are we doing about it?"
|
|
113
|
-
class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-foreground"
|
|
114
|
-
></textarea>
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
<div class="flex gap-2">
|
|
118
|
-
<button
|
|
119
|
-
type="submit"
|
|
120
|
-
disabled={saving || !title.trim() || !message.trim()}
|
|
121
|
-
class="rounded-md bg-red-500 px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-red-600 disabled:opacity-50"
|
|
122
|
-
>
|
|
123
|
-
{saving ? 'Creating...' : 'Create Incident'}
|
|
124
|
-
</button>
|
|
125
|
-
{#if onCancel}
|
|
126
|
-
<button
|
|
127
|
-
type="button"
|
|
128
|
-
onclick={onCancel}
|
|
129
|
-
class="rounded-md border border-border px-4 py-2 text-sm text-foreground-secondary transition-colors hover:bg-surface-hover"
|
|
130
|
-
>
|
|
131
|
-
Cancel
|
|
132
|
-
</button>
|
|
133
|
-
{/if}
|
|
134
|
-
</div>
|
|
135
|
-
</form>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { System, IncidentSeverity } from '../../types.js';
|
|
2
|
-
interface Props {
|
|
3
|
-
systems: System[];
|
|
4
|
-
onSave?: (data: {
|
|
5
|
-
title: string;
|
|
6
|
-
severity: IncidentSeverity;
|
|
7
|
-
affectedSystems: string[];
|
|
8
|
-
message: string;
|
|
9
|
-
}) => Promise<void>;
|
|
10
|
-
onCancel?: () => void;
|
|
11
|
-
}
|
|
12
|
-
declare const IncidentForm: import("svelte").Component<Props, {}, "">;
|
|
13
|
-
type IncidentForm = ReturnType<typeof IncidentForm>;
|
|
14
|
-
export default IncidentForm;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Incident, IncidentStatus } from '../../types.js';
|
|
3
|
-
import IncidentTimeline from '../shared/IncidentTimeline.svelte';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
incidents: Incident[];
|
|
7
|
-
onAddUpdate?: (incidentId: string, data: { status: IncidentStatus; message: string }) => Promise<void>;
|
|
8
|
-
onDelete?: (incidentId: string) => Promise<void>;
|
|
9
|
-
onCreate?: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let { incidents, onAddUpdate, onDelete, onCreate }: Props = $props();
|
|
13
|
-
|
|
14
|
-
let expandedId = $state<string | null>(null);
|
|
15
|
-
let updateMessage = $state('');
|
|
16
|
-
let updateStatus = $state<IncidentStatus>('investigating');
|
|
17
|
-
let submitting = $state(false);
|
|
18
|
-
|
|
19
|
-
const statusOptions: { value: IncidentStatus; label: string }[] = [
|
|
20
|
-
{ value: 'investigating', label: 'Investigating' },
|
|
21
|
-
{ value: 'identified', label: 'Identified' },
|
|
22
|
-
{ value: 'monitoring', label: 'Monitoring' },
|
|
23
|
-
{ value: 'resolved', label: 'Resolved' },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
function toggleExpand(id: string) {
|
|
27
|
-
expandedId = expandedId === id ? null : id;
|
|
28
|
-
updateMessage = '';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async function handleAddUpdate(incidentId: string) {
|
|
32
|
-
if (!updateMessage.trim()) return;
|
|
33
|
-
submitting = true;
|
|
34
|
-
try {
|
|
35
|
-
await onAddUpdate?.(incidentId, { status: updateStatus, message: updateMessage.trim() });
|
|
36
|
-
updateMessage = '';
|
|
37
|
-
} finally {
|
|
38
|
-
submitting = false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function handleDelete(id: string, title: string) {
|
|
43
|
-
if (!confirm(`Delete incident "${title}"?`)) return;
|
|
44
|
-
await onDelete?.(id);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function formatDate(timestamp: number): string {
|
|
48
|
-
return new Date(timestamp).toLocaleString();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const severityColors: Record<string, string> = {
|
|
52
|
-
minor: 'text-yellow-500 bg-yellow-500/10',
|
|
53
|
-
major: 'text-orange-500 bg-orange-500/10',
|
|
54
|
-
critical: 'text-red-500 bg-red-500/10',
|
|
55
|
-
};
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<div class="space-y-4">
|
|
59
|
-
<div class="flex items-center justify-between">
|
|
60
|
-
<h3 class="text-base font-semibold text-foreground">
|
|
61
|
-
<i class="fa-solid fa-triangle-exclamation mr-1.5 text-foreground-tertiary"></i>
|
|
62
|
-
Incidents
|
|
63
|
-
</h3>
|
|
64
|
-
{#if onCreate}
|
|
65
|
-
<button
|
|
66
|
-
onclick={onCreate}
|
|
67
|
-
class="rounded-md bg-red-500 px-3 py-1.5 text-xs font-semibold text-white transition-colors hover:bg-red-600"
|
|
68
|
-
>
|
|
69
|
-
<i class="fa-solid fa-plus mr-1"></i>
|
|
70
|
-
Report Incident
|
|
71
|
-
</button>
|
|
72
|
-
{/if}
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
{#if incidents.length === 0}
|
|
76
|
-
<div class="rounded-lg border border-border bg-surface p-6 text-center">
|
|
77
|
-
<i class="fa-solid fa-circle-check mb-2 text-xl text-green-500"></i>
|
|
78
|
-
<p class="text-sm text-foreground-secondary">No incidents</p>
|
|
79
|
-
</div>
|
|
80
|
-
{:else}
|
|
81
|
-
{#each incidents as incident}
|
|
82
|
-
<div class="rounded-lg border border-border bg-surface">
|
|
83
|
-
<button
|
|
84
|
-
onclick={() => toggleExpand(incident.id)}
|
|
85
|
-
class="flex w-full items-center justify-between p-3 text-left"
|
|
86
|
-
>
|
|
87
|
-
<div>
|
|
88
|
-
<div class="flex items-center gap-2">
|
|
89
|
-
<span class="text-sm font-semibold text-foreground">{incident.title}</span>
|
|
90
|
-
<span class="rounded px-1.5 py-0.5 text-xs capitalize {severityColors[incident.severity] || ''}">
|
|
91
|
-
{incident.severity}
|
|
92
|
-
</span>
|
|
93
|
-
<span class="rounded px-1.5 py-0.5 text-xs capitalize bg-surface-hover text-foreground-secondary">
|
|
94
|
-
{incident.status}
|
|
95
|
-
</span>
|
|
96
|
-
</div>
|
|
97
|
-
<p class="mt-0.5 text-xs text-foreground-tertiary">{formatDate(incident.createdAt)}</p>
|
|
98
|
-
</div>
|
|
99
|
-
<i class="fa-solid {expandedId === incident.id ? 'fa-chevron-up' : 'fa-chevron-down'} text-xs text-foreground-tertiary"></i>
|
|
100
|
-
</button>
|
|
101
|
-
|
|
102
|
-
{#if expandedId === incident.id}
|
|
103
|
-
<div class="border-t border-border p-3 space-y-4">
|
|
104
|
-
{#if incident.updates && incident.updates.length > 0}
|
|
105
|
-
<IncidentTimeline updates={incident.updates} />
|
|
106
|
-
{/if}
|
|
107
|
-
|
|
108
|
-
{#if incident.status !== 'resolved'}
|
|
109
|
-
<div class="rounded-lg border border-border bg-background p-3 space-y-3">
|
|
110
|
-
<div class="flex gap-2">
|
|
111
|
-
{#each statusOptions as opt}
|
|
112
|
-
<button
|
|
113
|
-
type="button"
|
|
114
|
-
onclick={() => (updateStatus = opt.value)}
|
|
115
|
-
class="rounded px-2 py-1 text-xs transition-colors {updateStatus === opt.value
|
|
116
|
-
? 'bg-primary text-primary-foreground'
|
|
117
|
-
: 'border border-border text-foreground-secondary hover:bg-surface-hover'}"
|
|
118
|
-
>
|
|
119
|
-
{opt.label}
|
|
120
|
-
</button>
|
|
121
|
-
{/each}
|
|
122
|
-
</div>
|
|
123
|
-
<textarea
|
|
124
|
-
bind:value={updateMessage}
|
|
125
|
-
placeholder="Update message..."
|
|
126
|
-
rows="2"
|
|
127
|
-
class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-foreground"
|
|
128
|
-
></textarea>
|
|
129
|
-
<button
|
|
130
|
-
onclick={() => handleAddUpdate(incident.id)}
|
|
131
|
-
disabled={submitting || !updateMessage.trim()}
|
|
132
|
-
class="rounded-md bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground disabled:opacity-50"
|
|
133
|
-
>
|
|
134
|
-
{submitting ? 'Posting...' : 'Post Update'}
|
|
135
|
-
</button>
|
|
136
|
-
</div>
|
|
137
|
-
{/if}
|
|
138
|
-
|
|
139
|
-
<div class="flex justify-end">
|
|
140
|
-
<button
|
|
141
|
-
onclick={() => handleDelete(incident.id, incident.title)}
|
|
142
|
-
class="text-xs text-red-500 transition-colors hover:text-red-400"
|
|
143
|
-
>
|
|
144
|
-
<i class="fa-solid fa-trash mr-1"></i>
|
|
145
|
-
Delete Incident
|
|
146
|
-
</button>
|
|
147
|
-
</div>
|
|
148
|
-
</div>
|
|
149
|
-
{/if}
|
|
150
|
-
</div>
|
|
151
|
-
{/each}
|
|
152
|
-
{/if}
|
|
153
|
-
</div>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Incident, IncidentStatus } from '../../types.js';
|
|
2
|
-
interface Props {
|
|
3
|
-
incidents: Incident[];
|
|
4
|
-
onAddUpdate?: (incidentId: string, data: {
|
|
5
|
-
status: IncidentStatus;
|
|
6
|
-
message: string;
|
|
7
|
-
}) => Promise<void>;
|
|
8
|
-
onDelete?: (incidentId: string) => Promise<void>;
|
|
9
|
-
onCreate?: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare const IncidentManager: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type IncidentManager = ReturnType<typeof IncidentManager>;
|
|
13
|
-
export default IncidentManager;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Project } from '../../types.js';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
project?: Project;
|
|
6
|
-
onSave?: (data: { name: string; description: string; allowedOrigins: string[] }) => Promise<void>;
|
|
7
|
-
onCancel?: () => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let { project, onSave, onCancel }: Props = $props();
|
|
11
|
-
|
|
12
|
-
let name = $state(project?.name ?? '');
|
|
13
|
-
let description = $state(project?.description ?? '');
|
|
14
|
-
let originsText = $state(project?.allowedOrigins?.join('\n') ?? '');
|
|
15
|
-
let saving = $state(false);
|
|
16
|
-
let errorMsg = $state('');
|
|
17
|
-
|
|
18
|
-
async function handleSubmit(e: Event) {
|
|
19
|
-
e.preventDefault();
|
|
20
|
-
if (!name.trim()) return;
|
|
21
|
-
|
|
22
|
-
saving = true;
|
|
23
|
-
errorMsg = '';
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
const origins = originsText
|
|
27
|
-
.split('\n')
|
|
28
|
-
.map((o) => o.trim())
|
|
29
|
-
.filter(Boolean);
|
|
30
|
-
await onSave?.({ name: name.trim(), description: description.trim(), allowedOrigins: origins });
|
|
31
|
-
} catch (err) {
|
|
32
|
-
errorMsg = err instanceof Error ? err.message : 'Failed to save';
|
|
33
|
-
} finally {
|
|
34
|
-
saving = false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<form onsubmit={handleSubmit} class="space-y-4">
|
|
40
|
-
<h3 class="text-lg font-semibold text-foreground">
|
|
41
|
-
{project ? 'Edit Project' : 'New Project'}
|
|
42
|
-
</h3>
|
|
43
|
-
|
|
44
|
-
<div>
|
|
45
|
-
<label for="sf-proj-name" class="mb-1 block text-sm font-semibold text-foreground">
|
|
46
|
-
Name <span class="text-red-500">*</span>
|
|
47
|
-
</label>
|
|
48
|
-
<input
|
|
49
|
-
id="sf-proj-name"
|
|
50
|
-
type="text"
|
|
51
|
-
bind:value={name}
|
|
52
|
-
required
|
|
53
|
-
class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-foreground"
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div>
|
|
58
|
-
<label for="sf-proj-desc" class="mb-1 block text-sm font-semibold text-foreground">
|
|
59
|
-
Description
|
|
60
|
-
</label>
|
|
61
|
-
<textarea
|
|
62
|
-
id="sf-proj-desc"
|
|
63
|
-
bind:value={description}
|
|
64
|
-
rows="2"
|
|
65
|
-
class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-foreground"
|
|
66
|
-
></textarea>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<div>
|
|
70
|
-
<label for="sf-proj-origins" class="mb-1 block text-sm font-semibold text-foreground">
|
|
71
|
-
Allowed Origins <span class="text-foreground-tertiary text-xs">(one per line)</span>
|
|
72
|
-
</label>
|
|
73
|
-
<textarea
|
|
74
|
-
id="sf-proj-origins"
|
|
75
|
-
bind:value={originsText}
|
|
76
|
-
rows="3"
|
|
77
|
-
placeholder="https://example.com"
|
|
78
|
-
class="w-full rounded-md border border-border bg-surface px-3 py-2 text-xs font-mono text-foreground"
|
|
79
|
-
></textarea>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
{#if errorMsg}
|
|
83
|
-
<div class="rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-500">
|
|
84
|
-
{errorMsg}
|
|
85
|
-
</div>
|
|
86
|
-
{/if}
|
|
87
|
-
|
|
88
|
-
<div class="flex gap-2">
|
|
89
|
-
<button
|
|
90
|
-
type="submit"
|
|
91
|
-
disabled={saving || !name.trim()}
|
|
92
|
-
class="rounded-md bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary-hover disabled:opacity-50"
|
|
93
|
-
>
|
|
94
|
-
{saving ? 'Saving...' : project ? 'Update' : 'Create'}
|
|
95
|
-
</button>
|
|
96
|
-
{#if onCancel}
|
|
97
|
-
<button
|
|
98
|
-
type="button"
|
|
99
|
-
onclick={onCancel}
|
|
100
|
-
class="rounded-md border border-border px-4 py-2 text-sm text-foreground-secondary transition-colors hover:bg-surface-hover"
|
|
101
|
-
>
|
|
102
|
-
Cancel
|
|
103
|
-
</button>
|
|
104
|
-
{/if}
|
|
105
|
-
</div>
|
|
106
|
-
</form>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Project } from '../../types.js';
|
|
2
|
-
interface Props {
|
|
3
|
-
project?: Project;
|
|
4
|
-
onSave?: (data: {
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
allowedOrigins: string[];
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
onCancel?: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare const ProjectForm: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type ProjectForm = ReturnType<typeof ProjectForm>;
|
|
13
|
-
export default ProjectForm;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Project } from '../../types.js';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
projects: Project[];
|
|
6
|
-
selectedId?: string;
|
|
7
|
-
onSelect?: (project: Project) => void;
|
|
8
|
-
onCreate?: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let { projects, selectedId, onSelect, onCreate }: Props = $props();
|
|
12
|
-
|
|
13
|
-
function formatDate(timestamp: number): string {
|
|
14
|
-
return new Date(timestamp).toLocaleDateString();
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<div class="space-y-3">
|
|
19
|
-
<div class="flex items-center justify-between">
|
|
20
|
-
<h2 class="text-lg font-semibold text-foreground">Projects</h2>
|
|
21
|
-
{#if onCreate}
|
|
22
|
-
<button
|
|
23
|
-
onclick={onCreate}
|
|
24
|
-
class="rounded-md bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground transition-colors hover:bg-primary-hover"
|
|
25
|
-
>
|
|
26
|
-
<i class="fa-solid fa-plus mr-1"></i>
|
|
27
|
-
New Project
|
|
28
|
-
</button>
|
|
29
|
-
{/if}
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
{#if projects.length === 0}
|
|
33
|
-
<div class="rounded-lg border border-border bg-surface p-8 text-center">
|
|
34
|
-
<i class="fa-solid fa-folder-open mb-2 text-2xl text-foreground-tertiary"></i>
|
|
35
|
-
<p class="text-sm text-foreground-secondary">No projects yet</p>
|
|
36
|
-
</div>
|
|
37
|
-
{:else}
|
|
38
|
-
<div class="space-y-2">
|
|
39
|
-
{#each projects as project}
|
|
40
|
-
<button
|
|
41
|
-
onclick={() => onSelect?.(project)}
|
|
42
|
-
class="w-full rounded-lg border p-3 text-left transition-colors {selectedId === project.id
|
|
43
|
-
? 'border-primary bg-primary/5'
|
|
44
|
-
: 'border-border bg-surface hover:bg-surface-hover'}"
|
|
45
|
-
>
|
|
46
|
-
<div class="flex items-center justify-between">
|
|
47
|
-
<span class="text-sm font-semibold text-foreground">{project.name}</span>
|
|
48
|
-
<span class="text-xs text-foreground-tertiary">{formatDate(project.createdAt)}</span>
|
|
49
|
-
</div>
|
|
50
|
-
{#if project.description}
|
|
51
|
-
<p class="mt-1 text-xs text-foreground-tertiary">{project.description}</p>
|
|
52
|
-
{/if}
|
|
53
|
-
</button>
|
|
54
|
-
{/each}
|
|
55
|
-
</div>
|
|
56
|
-
{/if}
|
|
57
|
-
</div>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Project } from '../../types.js';
|
|
2
|
-
interface Props {
|
|
3
|
-
projects: Project[];
|
|
4
|
-
selectedId?: string;
|
|
5
|
-
onSelect?: (project: Project) => void;
|
|
6
|
-
onCreate?: () => void;
|
|
7
|
-
}
|
|
8
|
-
declare const ProjectList: import("svelte").Component<Props, {}, "">;
|
|
9
|
-
type ProjectList = ReturnType<typeof ProjectList>;
|
|
10
|
-
export default ProjectList;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { System, SystemStatus } from '../../types.js';
|
|
3
|
-
import StatusIndicator from '../shared/StatusIndicator.svelte';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
systems: System[];
|
|
7
|
-
onUpdateStatus?: (systemId: string, status: SystemStatus) => Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let { systems, onUpdateStatus }: Props = $props();
|
|
11
|
-
|
|
12
|
-
let updating = $state<string | null>(null);
|
|
13
|
-
|
|
14
|
-
const statuses: { value: SystemStatus; label: string; icon: string }[] = [
|
|
15
|
-
{ value: 'operational', label: 'Operational', icon: 'fa-circle-check' },
|
|
16
|
-
{ value: 'degraded', label: 'Degraded', icon: 'fa-exclamation-triangle' },
|
|
17
|
-
{ value: 'outage', label: 'Outage', icon: 'fa-circle-xmark' },
|
|
18
|
-
{ value: 'maintenance', label: 'Maintenance', icon: 'fa-wrench' },
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
async function setStatus(systemId: string, status: SystemStatus) {
|
|
22
|
-
updating = systemId;
|
|
23
|
-
try {
|
|
24
|
-
await onUpdateStatus?.(systemId, status);
|
|
25
|
-
} finally {
|
|
26
|
-
updating = null;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<div class="space-y-4">
|
|
32
|
-
<h3 class="text-base font-semibold text-foreground">
|
|
33
|
-
<i class="fa-solid fa-toggle-on mr-1.5 text-foreground-tertiary"></i>
|
|
34
|
-
Quick Status Update
|
|
35
|
-
</h3>
|
|
36
|
-
|
|
37
|
-
{#each systems as system}
|
|
38
|
-
<div class="rounded-lg border border-border bg-surface p-3">
|
|
39
|
-
<div class="flex items-center gap-2 mb-2">
|
|
40
|
-
<StatusIndicator status={system.status} size="sm" />
|
|
41
|
-
<span class="text-sm font-semibold text-foreground">{system.name}</span>
|
|
42
|
-
{#if updating === system.id}
|
|
43
|
-
<i class="fa-solid fa-spinner fa-spin text-xs text-foreground-tertiary"></i>
|
|
44
|
-
{/if}
|
|
45
|
-
</div>
|
|
46
|
-
<div class="grid grid-cols-2 gap-1 sm:grid-cols-4">
|
|
47
|
-
{#each statuses as s}
|
|
48
|
-
<button
|
|
49
|
-
onclick={() => setStatus(system.id, s.value)}
|
|
50
|
-
disabled={updating === system.id}
|
|
51
|
-
class="rounded px-2 py-1.5 text-xs transition-colors {system.status === s.value
|
|
52
|
-
? 'bg-primary text-primary-foreground'
|
|
53
|
-
: 'border border-border text-foreground-secondary hover:bg-surface-hover'}"
|
|
54
|
-
>
|
|
55
|
-
<i class="fa-solid {s.icon} mr-1"></i>
|
|
56
|
-
{s.label}
|
|
57
|
-
</button>
|
|
58
|
-
{/each}
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
{/each}
|
|
62
|
-
</div>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { System, SystemStatus } from '../../types.js';
|
|
2
|
-
interface Props {
|
|
3
|
-
systems: System[];
|
|
4
|
-
onUpdateStatus?: (systemId: string, status: SystemStatus) => Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
declare const StatusControl: import("svelte").Component<Props, {}, "">;
|
|
7
|
-
type StatusControl = ReturnType<typeof StatusControl>;
|
|
8
|
-
export default StatusControl;
|