@smartnet360/svelte-components 0.0.124 → 0.0.126
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/apps/antenna-tools/components/AntennaSettingsModal.svelte +4 -174
- package/dist/apps/antenna-tools/components/DatabaseViewer.svelte +2 -2
- package/dist/apps/antenna-tools/components/MSIConverter.svelte +302 -43
- package/dist/apps/antenna-tools/db.js +4 -0
- package/dist/apps/antenna-tools/utils/db-utils.d.ts +19 -0
- package/dist/apps/antenna-tools/utils/db-utils.js +108 -0
- package/dist/core/Auth/LoginForm.svelte +397 -0
- package/dist/core/Auth/LoginForm.svelte.d.ts +16 -0
- package/dist/core/Auth/auth.svelte.d.ts +22 -0
- package/dist/core/Auth/auth.svelte.js +229 -0
- package/dist/core/Auth/config.d.ts +25 -0
- package/dist/core/Auth/config.js +256 -0
- package/dist/core/Auth/index.d.ts +4 -0
- package/dist/core/Auth/index.js +5 -0
- package/dist/core/Auth/types.d.ts +140 -0
- package/dist/core/Auth/types.js +2 -0
- package/dist/core/LandingPage/App.svelte +102 -0
- package/dist/core/LandingPage/App.svelte.d.ts +20 -0
- package/dist/core/LandingPage/LandingPage.svelte +480 -0
- package/dist/core/LandingPage/LandingPage.svelte.d.ts +21 -0
- package/dist/core/LandingPage/index.d.ts +2 -0
- package/dist/core/LandingPage/index.js +3 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +4 -0
- package/dist/map-v3/demo/DemoMap.svelte +18 -0
- package/dist/map-v3/demo/demo-custom-cells.d.ts +21 -0
- package/dist/map-v3/demo/demo-custom-cells.js +48 -0
- package/dist/map-v3/features/cells/custom/components/CustomCellFilterControl.svelte +220 -0
- package/dist/map-v3/features/cells/custom/components/CustomCellFilterControl.svelte.d.ts +15 -0
- package/dist/map-v3/features/cells/custom/components/CustomCellSetManager.svelte +306 -0
- package/dist/map-v3/features/cells/custom/components/CustomCellSetManager.svelte.d.ts +10 -0
- package/dist/map-v3/features/cells/custom/components/index.d.ts +5 -0
- package/dist/map-v3/features/cells/custom/components/index.js +5 -0
- package/dist/map-v3/features/cells/custom/index.d.ts +32 -0
- package/dist/map-v3/features/cells/custom/index.js +35 -0
- package/dist/map-v3/features/cells/custom/layers/CustomCellsLayer.svelte +262 -0
- package/dist/map-v3/features/cells/custom/layers/CustomCellsLayer.svelte.d.ts +10 -0
- package/dist/map-v3/features/cells/custom/layers/index.d.ts +4 -0
- package/dist/map-v3/features/cells/custom/layers/index.js +4 -0
- package/dist/map-v3/features/cells/custom/logic/csv-parser.d.ts +20 -0
- package/dist/map-v3/features/cells/custom/logic/csv-parser.js +164 -0
- package/dist/map-v3/features/cells/custom/logic/index.d.ts +5 -0
- package/dist/map-v3/features/cells/custom/logic/index.js +5 -0
- package/dist/map-v3/features/cells/custom/logic/tree-adapter.d.ts +24 -0
- package/dist/map-v3/features/cells/custom/logic/tree-adapter.js +67 -0
- package/dist/map-v3/features/cells/custom/stores/custom-cell-sets.svelte.d.ts +78 -0
- package/dist/map-v3/features/cells/custom/stores/custom-cell-sets.svelte.js +242 -0
- package/dist/map-v3/features/cells/custom/stores/index.d.ts +4 -0
- package/dist/map-v3/features/cells/custom/stores/index.js +4 -0
- package/dist/map-v3/features/cells/custom/types.d.ts +83 -0
- package/dist/map-v3/features/cells/custom/types.js +23 -0
- package/dist/map-v3/shared/controls/MapControl.svelte +27 -3
- package/package.json +1 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// Auth state management using Svelte 5 runes
|
|
2
|
+
import { browser } from '$app/environment';
|
|
3
|
+
// Demo mode - enabled via PUBLIC_DEMO_MODE env var (GitHub Pages)
|
|
4
|
+
const DEMO_MODE = import.meta.env.PUBLIC_DEMO_MODE === 'true';
|
|
5
|
+
const DEMO_USERNAME = 'demo';
|
|
6
|
+
const DEMO_PASSWORD = 'demo123';
|
|
7
|
+
// Demo user session (client-side only, no server needed)
|
|
8
|
+
const DEMO_SESSION = {
|
|
9
|
+
user: {
|
|
10
|
+
id: 'demo-user',
|
|
11
|
+
username: 'demo',
|
|
12
|
+
displayName: 'Demo User',
|
|
13
|
+
email: 'demo@example.com',
|
|
14
|
+
groups: ['demo'],
|
|
15
|
+
loginTime: Date.now()
|
|
16
|
+
},
|
|
17
|
+
permissions: [
|
|
18
|
+
{ featureId: 'map-view', canView: true, canEdit: false, canAdmin: false },
|
|
19
|
+
{ featureId: 'coverage-view', canView: true, canEdit: false, canAdmin: false },
|
|
20
|
+
{ featureId: 'charts-view', canView: true, canEdit: false, canAdmin: false },
|
|
21
|
+
{ featureId: 'desktop-view', canView: true, canEdit: false, canAdmin: false },
|
|
22
|
+
{ featureId: 'table-view', canView: true, canEdit: false, canAdmin: false },
|
|
23
|
+
{ featureId: 'antenna-view', canView: true, canEdit: false, canAdmin: false },
|
|
24
|
+
{ featureId: 'site-check', canView: true, canEdit: false, canAdmin: false },
|
|
25
|
+
{ featureId: 'settings-view', canView: true, canEdit: false, canAdmin: false }
|
|
26
|
+
],
|
|
27
|
+
token: 'demo-token',
|
|
28
|
+
expiresAt: Date.now() + (24 * 60 * 60 * 1000) // 24 hours for demo
|
|
29
|
+
};
|
|
30
|
+
// Default configuration
|
|
31
|
+
const defaultConfig = {
|
|
32
|
+
apiEndpoint: '/api/auth',
|
|
33
|
+
devMode: false,
|
|
34
|
+
storagePrefix: 'rf-tools-auth',
|
|
35
|
+
sessionTimeout: 8 * 60 * 60 * 1000 // 8 hours
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Create auth state store with Svelte 5 runes
|
|
39
|
+
* This must be called within a component context or .svelte.ts file
|
|
40
|
+
*/
|
|
41
|
+
export function createAuthState(config = {}) {
|
|
42
|
+
const cfg = { ...defaultConfig, ...config };
|
|
43
|
+
// Core state
|
|
44
|
+
let session = $state(null);
|
|
45
|
+
let isLoading = $state(false);
|
|
46
|
+
let error = $state(null);
|
|
47
|
+
let initialized = $state(false);
|
|
48
|
+
// Derived state
|
|
49
|
+
const isAuthenticated = $derived(session !== null && session.expiresAt > Date.now());
|
|
50
|
+
const user = $derived(session?.user ?? null);
|
|
51
|
+
const permissions = $derived(session?.permissions ?? []);
|
|
52
|
+
const token = $derived(session?.token ?? null);
|
|
53
|
+
// Storage keys
|
|
54
|
+
const sessionKey = `${cfg.storagePrefix}-session`;
|
|
55
|
+
/**
|
|
56
|
+
* Initialize auth state from storage
|
|
57
|
+
*/
|
|
58
|
+
function initialize() {
|
|
59
|
+
if (!browser) {
|
|
60
|
+
initialized = true;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const stored = localStorage.getItem(sessionKey);
|
|
65
|
+
if (stored) {
|
|
66
|
+
const parsed = JSON.parse(stored);
|
|
67
|
+
if (parsed.expiresAt > Date.now()) {
|
|
68
|
+
session = parsed;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
localStorage.removeItem(sessionKey);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
console.error('Failed to restore auth session:', e);
|
|
77
|
+
localStorage.removeItem(sessionKey);
|
|
78
|
+
}
|
|
79
|
+
initialized = true;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Save session to storage
|
|
83
|
+
*/
|
|
84
|
+
function saveSession(newSession) {
|
|
85
|
+
session = newSession;
|
|
86
|
+
if (browser) {
|
|
87
|
+
localStorage.setItem(sessionKey, JSON.stringify(newSession));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Clear session
|
|
92
|
+
*/
|
|
93
|
+
function clearSession() {
|
|
94
|
+
session = null;
|
|
95
|
+
if (browser) {
|
|
96
|
+
localStorage.removeItem(sessionKey);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Login with credentials
|
|
101
|
+
*/
|
|
102
|
+
async function login(username, password, agreedToMonitoring) {
|
|
103
|
+
if (!agreedToMonitoring) {
|
|
104
|
+
error = 'You must agree to activity monitoring to proceed.';
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
isLoading = true;
|
|
108
|
+
error = null;
|
|
109
|
+
try {
|
|
110
|
+
// Demo mode: handle authentication client-side (no server needed)
|
|
111
|
+
if (DEMO_MODE) {
|
|
112
|
+
if (username === DEMO_USERNAME && password === DEMO_PASSWORD) {
|
|
113
|
+
// Create fresh demo session with updated timestamp
|
|
114
|
+
const demoSession = {
|
|
115
|
+
...DEMO_SESSION,
|
|
116
|
+
user: { ...DEMO_SESSION.user, loginTime: Date.now() },
|
|
117
|
+
expiresAt: Date.now() + (24 * 60 * 60 * 1000)
|
|
118
|
+
};
|
|
119
|
+
saveSession(demoSession);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
error = 'Demo mode: Use username "demo" and password "demo123"';
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Normal mode: call server API
|
|
128
|
+
const response = await fetch(`${cfg.apiEndpoint}/login`, {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
headers: { 'Content-Type': 'application/json' },
|
|
131
|
+
body: JSON.stringify({ username, password, agreedToMonitoring })
|
|
132
|
+
});
|
|
133
|
+
const data = await response.json();
|
|
134
|
+
if (data.success && data.session) {
|
|
135
|
+
saveSession(data.session);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
error = data.error || 'Authentication failed';
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
error = e instanceof Error ? e.message : 'Network error';
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
isLoading = false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Login with dev mode credentials (auto-login)
|
|
153
|
+
*/
|
|
154
|
+
function loginDev(devUser, devPermissions) {
|
|
155
|
+
const devSession = {
|
|
156
|
+
user: devUser,
|
|
157
|
+
permissions: devPermissions,
|
|
158
|
+
token: 'dev-token-' + Date.now(),
|
|
159
|
+
expiresAt: Date.now() + cfg.sessionTimeout
|
|
160
|
+
};
|
|
161
|
+
saveSession(devSession);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Logout
|
|
165
|
+
*/
|
|
166
|
+
async function logout() {
|
|
167
|
+
isLoading = true;
|
|
168
|
+
try {
|
|
169
|
+
// Skip server call in demo mode (no server available)
|
|
170
|
+
if (!DEMO_MODE && session?.token) {
|
|
171
|
+
await fetch(`${cfg.apiEndpoint}/logout`, {
|
|
172
|
+
method: 'POST',
|
|
173
|
+
headers: {
|
|
174
|
+
'Content-Type': 'application/json',
|
|
175
|
+
'Authorization': `Bearer ${session.token}`
|
|
176
|
+
}
|
|
177
|
+
}).catch(() => { }); // Ignore errors
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
clearSession();
|
|
182
|
+
isLoading = false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Check if user has permission for a feature
|
|
187
|
+
*/
|
|
188
|
+
function hasPermission(featureId, level = 'view') {
|
|
189
|
+
const permission = permissions.find(p => p.featureId === featureId);
|
|
190
|
+
if (!permission)
|
|
191
|
+
return false;
|
|
192
|
+
switch (level) {
|
|
193
|
+
case 'view': return permission.canView;
|
|
194
|
+
case 'edit': return permission.canEdit ?? false;
|
|
195
|
+
case 'admin': return permission.canAdmin ?? false;
|
|
196
|
+
default: return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Check if user can access a route
|
|
201
|
+
*/
|
|
202
|
+
function canAccessRoute(route, requiredPermission) {
|
|
203
|
+
if (!isAuthenticated)
|
|
204
|
+
return false;
|
|
205
|
+
if (!requiredPermission)
|
|
206
|
+
return true;
|
|
207
|
+
return hasPermission(requiredPermission, 'view');
|
|
208
|
+
}
|
|
209
|
+
// Initialize on creation
|
|
210
|
+
initialize();
|
|
211
|
+
return {
|
|
212
|
+
// State (getters)
|
|
213
|
+
get session() { return session; },
|
|
214
|
+
get isLoading() { return isLoading; },
|
|
215
|
+
get error() { return error; },
|
|
216
|
+
get initialized() { return initialized; },
|
|
217
|
+
get isAuthenticated() { return isAuthenticated; },
|
|
218
|
+
get user() { return user; },
|
|
219
|
+
get permissions() { return permissions; },
|
|
220
|
+
get token() { return token; },
|
|
221
|
+
// Actions
|
|
222
|
+
login,
|
|
223
|
+
loginDev,
|
|
224
|
+
logout,
|
|
225
|
+
hasPermission,
|
|
226
|
+
canAccessRoute,
|
|
227
|
+
clearError: () => { error = null; }
|
|
228
|
+
};
|
|
229
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DevConfig, CategoryInfo, AppDefinition, User, FeatureAccess } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default category definitions
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_CATEGORIES: CategoryInfo[];
|
|
6
|
+
/**
|
|
7
|
+
* Default app definitions - all available apps/tools
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_APPS: AppDefinition[];
|
|
10
|
+
/**
|
|
11
|
+
* Default dev user for development mode
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_DEV_USER: User;
|
|
14
|
+
/**
|
|
15
|
+
* Default permissions for dev mode (full access)
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_DEV_PERMISSIONS: FeatureAccess[];
|
|
18
|
+
/**
|
|
19
|
+
* Get full dev configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare function getDevConfig(): DevConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Check if we're in development mode
|
|
24
|
+
*/
|
|
25
|
+
export declare function isDevMode(): boolean;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default category definitions
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_CATEGORIES = [
|
|
5
|
+
{
|
|
6
|
+
id: 'map-tools',
|
|
7
|
+
title: 'Map Tools',
|
|
8
|
+
description: 'Geographic visualization and network mapping tools',
|
|
9
|
+
icon: 'bi-map',
|
|
10
|
+
color: 'primary'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 'visualization',
|
|
14
|
+
title: 'Visualization',
|
|
15
|
+
description: 'Charts, graphs, and data visualization tools',
|
|
16
|
+
icon: 'bi-bar-chart-line',
|
|
17
|
+
color: 'success'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'optimization',
|
|
21
|
+
title: 'Optimization',
|
|
22
|
+
description: 'Network optimization and planning tools',
|
|
23
|
+
icon: 'bi-sliders',
|
|
24
|
+
color: 'warning'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'analysis',
|
|
28
|
+
title: 'Analysis',
|
|
29
|
+
description: 'Data analysis and reporting tools',
|
|
30
|
+
icon: 'bi-graph-up',
|
|
31
|
+
color: 'info'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'configuration',
|
|
35
|
+
title: 'Configuration',
|
|
36
|
+
description: 'System configuration and settings',
|
|
37
|
+
icon: 'bi-gear',
|
|
38
|
+
color: 'secondary'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'demo',
|
|
42
|
+
title: 'Demos & Examples',
|
|
43
|
+
description: 'Demo applications and component showcases',
|
|
44
|
+
icon: 'bi-play-circle',
|
|
45
|
+
color: 'dark'
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Default app definitions - all available apps/tools
|
|
50
|
+
*/
|
|
51
|
+
export const DEFAULT_APPS = [
|
|
52
|
+
// Map Tools
|
|
53
|
+
{
|
|
54
|
+
id: 'map-v3-demo',
|
|
55
|
+
title: 'Network Map',
|
|
56
|
+
description: 'Interactive cellular network visualization with coverage layers',
|
|
57
|
+
route: '/apps/map-v3-demo',
|
|
58
|
+
icon: 'bi-map',
|
|
59
|
+
category: 'map-tools',
|
|
60
|
+
requiredPermission: 'map-view',
|
|
61
|
+
enabled: true,
|
|
62
|
+
badge: 'New',
|
|
63
|
+
badgeColor: 'success'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'coverage-test',
|
|
67
|
+
title: 'Coverage Analysis',
|
|
68
|
+
description: 'Analyze network coverage and signal propagation',
|
|
69
|
+
route: '/apps/coverage-test',
|
|
70
|
+
icon: 'bi-broadcast',
|
|
71
|
+
category: 'map-tools',
|
|
72
|
+
requiredPermission: 'coverage-view',
|
|
73
|
+
enabled: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'map-demo',
|
|
77
|
+
title: 'Map Demo (Legacy)',
|
|
78
|
+
description: 'Legacy map component demonstration',
|
|
79
|
+
route: '/apps/map-demo',
|
|
80
|
+
icon: 'bi-map-fill',
|
|
81
|
+
category: 'map-tools',
|
|
82
|
+
requiredPermission: 'map-view',
|
|
83
|
+
enabled: true
|
|
84
|
+
},
|
|
85
|
+
// Visualization
|
|
86
|
+
{
|
|
87
|
+
id: 'charts-demo',
|
|
88
|
+
title: 'Charts',
|
|
89
|
+
description: 'Interactive Plotly-based chart visualization system',
|
|
90
|
+
route: '/apps/demo/charts',
|
|
91
|
+
icon: 'bi-bar-chart-line',
|
|
92
|
+
category: 'visualization',
|
|
93
|
+
requiredPermission: 'charts-view',
|
|
94
|
+
enabled: true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'charts-editor',
|
|
98
|
+
title: 'Chart Editor',
|
|
99
|
+
description: 'Create and customize chart configurations',
|
|
100
|
+
route: '/apps/demo/charts/editor',
|
|
101
|
+
icon: 'bi-pencil-square',
|
|
102
|
+
category: 'visualization',
|
|
103
|
+
requiredPermission: 'charts-edit',
|
|
104
|
+
enabled: true
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: 'desktop-grid',
|
|
108
|
+
title: 'Desktop Grid',
|
|
109
|
+
description: 'Multi-panel layout orchestrator for complex dashboards',
|
|
110
|
+
route: '/apps/demo/desktop',
|
|
111
|
+
icon: 'bi-grid-3x3-gap',
|
|
112
|
+
category: 'visualization',
|
|
113
|
+
requiredPermission: 'desktop-view',
|
|
114
|
+
enabled: true
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'cell-table',
|
|
118
|
+
title: 'Cell Table',
|
|
119
|
+
description: 'Tabulator-based data table with grouping and filtering',
|
|
120
|
+
route: '/apps/demo/cell-table',
|
|
121
|
+
icon: 'bi-table',
|
|
122
|
+
category: 'visualization',
|
|
123
|
+
requiredPermission: 'table-view',
|
|
124
|
+
enabled: true
|
|
125
|
+
},
|
|
126
|
+
// Analysis
|
|
127
|
+
{
|
|
128
|
+
id: 'antenna-patterns',
|
|
129
|
+
title: 'Antenna Patterns',
|
|
130
|
+
description: 'Visualize and analyze antenna radiation patterns',
|
|
131
|
+
route: '/apps/antenna-patterns',
|
|
132
|
+
icon: 'bi-broadcast-pin',
|
|
133
|
+
category: 'analysis',
|
|
134
|
+
requiredPermission: 'antenna-view',
|
|
135
|
+
enabled: true
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'site-check',
|
|
139
|
+
title: 'Site Check',
|
|
140
|
+
description: 'Site validation and configuration checker',
|
|
141
|
+
route: '/apps/site-check',
|
|
142
|
+
icon: 'bi-building-check',
|
|
143
|
+
category: 'analysis',
|
|
144
|
+
requiredPermission: 'site-check',
|
|
145
|
+
enabled: true
|
|
146
|
+
},
|
|
147
|
+
// Configuration
|
|
148
|
+
{
|
|
149
|
+
id: 'settings-test',
|
|
150
|
+
title: 'Settings Panel',
|
|
151
|
+
description: 'Configuration management interface',
|
|
152
|
+
route: '/apps/settings-test',
|
|
153
|
+
icon: 'bi-gear-wide-connected',
|
|
154
|
+
category: 'configuration',
|
|
155
|
+
requiredPermission: 'settings-view',
|
|
156
|
+
enabled: true
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'settings-demo',
|
|
160
|
+
title: 'Settings Demo',
|
|
161
|
+
description: 'Settings component showcase',
|
|
162
|
+
route: '/apps/demo/settings-demo',
|
|
163
|
+
icon: 'bi-sliders2',
|
|
164
|
+
category: 'configuration',
|
|
165
|
+
enabled: true
|
|
166
|
+
},
|
|
167
|
+
// Demos
|
|
168
|
+
{
|
|
169
|
+
id: 'tree-test',
|
|
170
|
+
title: 'Tree View',
|
|
171
|
+
description: 'Hierarchical tree navigation component',
|
|
172
|
+
route: '/apps/demo/tree-test',
|
|
173
|
+
icon: 'bi-diagram-3',
|
|
174
|
+
category: 'demo',
|
|
175
|
+
enabled: true
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 'dummy-components',
|
|
179
|
+
title: 'Component Showcase',
|
|
180
|
+
description: 'Demo of all available UI components',
|
|
181
|
+
route: '/apps/demo/dummy-components',
|
|
182
|
+
icon: 'bi-boxes',
|
|
183
|
+
category: 'demo',
|
|
184
|
+
enabled: true
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 'charts-tabs',
|
|
188
|
+
title: 'Charts Tabs Mode',
|
|
189
|
+
description: 'Charts with tabbed navigation',
|
|
190
|
+
route: '/apps/demo/charts/tabs',
|
|
191
|
+
icon: 'bi-window-tab',
|
|
192
|
+
category: 'demo',
|
|
193
|
+
enabled: true
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: 'charts-scrollspy',
|
|
197
|
+
title: 'Charts Scrollspy',
|
|
198
|
+
description: 'Charts with scroll-based navigation',
|
|
199
|
+
route: '/apps/demo/charts/scrollspy',
|
|
200
|
+
icon: 'bi-arrows-vertical',
|
|
201
|
+
category: 'demo',
|
|
202
|
+
enabled: true
|
|
203
|
+
}
|
|
204
|
+
];
|
|
205
|
+
/**
|
|
206
|
+
* Default dev user for development mode
|
|
207
|
+
*/
|
|
208
|
+
export const DEFAULT_DEV_USER = {
|
|
209
|
+
id: 'dev-user',
|
|
210
|
+
username: 'developer',
|
|
211
|
+
displayName: 'Developer',
|
|
212
|
+
email: 'dev@localhost',
|
|
213
|
+
groups: ['developers', 'admins'],
|
|
214
|
+
loginTime: Date.now()
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Default permissions for dev mode (full access)
|
|
218
|
+
*/
|
|
219
|
+
export const DEFAULT_DEV_PERMISSIONS = [
|
|
220
|
+
{ featureId: 'map-view', canView: true, canEdit: true, canAdmin: true },
|
|
221
|
+
{ featureId: 'coverage-view', canView: true, canEdit: true, canAdmin: true },
|
|
222
|
+
{ featureId: 'charts-view', canView: true, canEdit: true, canAdmin: true },
|
|
223
|
+
{ featureId: 'charts-edit', canView: true, canEdit: true, canAdmin: true },
|
|
224
|
+
{ featureId: 'desktop-view', canView: true, canEdit: true, canAdmin: true },
|
|
225
|
+
{ featureId: 'table-view', canView: true, canEdit: true, canAdmin: true },
|
|
226
|
+
{ featureId: 'antenna-view', canView: true, canEdit: true, canAdmin: true },
|
|
227
|
+
{ featureId: 'site-check', canView: true, canEdit: true, canAdmin: true },
|
|
228
|
+
{ featureId: 'settings-view', canView: true, canEdit: true, canAdmin: true },
|
|
229
|
+
{ featureId: 'admin', canView: true, canEdit: true, canAdmin: true }
|
|
230
|
+
];
|
|
231
|
+
/**
|
|
232
|
+
* Get full dev configuration
|
|
233
|
+
*/
|
|
234
|
+
export function getDevConfig() {
|
|
235
|
+
return {
|
|
236
|
+
devMode: true,
|
|
237
|
+
devUser: DEFAULT_DEV_USER,
|
|
238
|
+
devPermissions: DEFAULT_DEV_PERMISSIONS,
|
|
239
|
+
landingPage: {
|
|
240
|
+
title: 'RF Tool Components',
|
|
241
|
+
subtitle: 'Network Planning and Visualization Suite',
|
|
242
|
+
categories: DEFAULT_CATEGORIES,
|
|
243
|
+
apps: DEFAULT_APPS
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Check if we're in development mode
|
|
249
|
+
*/
|
|
250
|
+
export function isDevMode() {
|
|
251
|
+
// Check environment - in dev server or explicit flag
|
|
252
|
+
if (typeof import.meta !== 'undefined' && import.meta.env?.DEV) {
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User information returned after successful authentication
|
|
3
|
+
*/
|
|
4
|
+
export interface User {
|
|
5
|
+
/** Unique user identifier */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Username used for login */
|
|
8
|
+
username: string;
|
|
9
|
+
/** Display name */
|
|
10
|
+
displayName: string;
|
|
11
|
+
/** User email (from LDAP) */
|
|
12
|
+
email?: string;
|
|
13
|
+
/** Groups/roles from LDAP */
|
|
14
|
+
groups?: string[];
|
|
15
|
+
/** Timestamp of login */
|
|
16
|
+
loginTime: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Access permission for a specific feature/app
|
|
20
|
+
*/
|
|
21
|
+
export interface FeatureAccess {
|
|
22
|
+
/** Feature/app identifier */
|
|
23
|
+
featureId: string;
|
|
24
|
+
/** Whether user can view this feature */
|
|
25
|
+
canView: boolean;
|
|
26
|
+
/** Whether user can edit/modify */
|
|
27
|
+
canEdit?: boolean;
|
|
28
|
+
/** Whether user can administrate */
|
|
29
|
+
canAdmin?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* User session with permissions
|
|
33
|
+
*/
|
|
34
|
+
export interface UserSession {
|
|
35
|
+
/** Authenticated user info */
|
|
36
|
+
user: User;
|
|
37
|
+
/** Access permissions for features */
|
|
38
|
+
permissions: FeatureAccess[];
|
|
39
|
+
/** Session token (for API calls) */
|
|
40
|
+
token: string;
|
|
41
|
+
/** Token expiration timestamp */
|
|
42
|
+
expiresAt: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Login credentials
|
|
46
|
+
*/
|
|
47
|
+
export interface LoginCredentials {
|
|
48
|
+
username: string;
|
|
49
|
+
password: string;
|
|
50
|
+
/** User agreed to activity monitoring */
|
|
51
|
+
agreedToMonitoring: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Login response from API
|
|
55
|
+
*/
|
|
56
|
+
export interface LoginResponse {
|
|
57
|
+
success: boolean;
|
|
58
|
+
session?: UserSession;
|
|
59
|
+
error?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Auth configuration
|
|
63
|
+
*/
|
|
64
|
+
export interface AuthConfig {
|
|
65
|
+
/** API endpoint for authentication */
|
|
66
|
+
apiEndpoint: string;
|
|
67
|
+
/** Enable development mode (auto-login) */
|
|
68
|
+
devMode: boolean;
|
|
69
|
+
/** Session storage key prefix */
|
|
70
|
+
storagePrefix: string;
|
|
71
|
+
/** Session timeout in milliseconds */
|
|
72
|
+
sessionTimeout: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* App/Feature definition for landing page
|
|
76
|
+
*/
|
|
77
|
+
export interface AppDefinition {
|
|
78
|
+
/** Unique identifier */
|
|
79
|
+
id: string;
|
|
80
|
+
/** Display title */
|
|
81
|
+
title: string;
|
|
82
|
+
/** Short description */
|
|
83
|
+
description: string;
|
|
84
|
+
/** Route path */
|
|
85
|
+
route: string;
|
|
86
|
+
/** Bootstrap icon class (e.g., 'bi-map') */
|
|
87
|
+
icon: string;
|
|
88
|
+
/** Category for grouping */
|
|
89
|
+
category: AppCategory;
|
|
90
|
+
/** Required permission to access */
|
|
91
|
+
requiredPermission?: string;
|
|
92
|
+
/** Whether app is enabled */
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
/** Badge text (e.g., 'New', 'Beta') */
|
|
95
|
+
badge?: string;
|
|
96
|
+
/** Badge color class */
|
|
97
|
+
badgeColor?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* App category for grouping in landing page
|
|
101
|
+
*/
|
|
102
|
+
export type AppCategory = 'map-tools' | 'visualization' | 'optimization' | 'analysis' | 'configuration' | 'demo';
|
|
103
|
+
/**
|
|
104
|
+
* Category metadata for display
|
|
105
|
+
*/
|
|
106
|
+
export interface CategoryInfo {
|
|
107
|
+
id: AppCategory;
|
|
108
|
+
title: string;
|
|
109
|
+
description: string;
|
|
110
|
+
icon: string;
|
|
111
|
+
color: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Landing page configuration
|
|
115
|
+
*/
|
|
116
|
+
export interface LandingPageConfig {
|
|
117
|
+
/** Application title */
|
|
118
|
+
title: string;
|
|
119
|
+
/** Subtitle/description */
|
|
120
|
+
subtitle: string;
|
|
121
|
+
/** Logo URL (optional) */
|
|
122
|
+
logo?: string;
|
|
123
|
+
/** Categories to display */
|
|
124
|
+
categories: CategoryInfo[];
|
|
125
|
+
/** Apps to display */
|
|
126
|
+
apps: AppDefinition[];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Development mode configuration (from config.json)
|
|
130
|
+
*/
|
|
131
|
+
export interface DevConfig {
|
|
132
|
+
/** Enable dev mode */
|
|
133
|
+
devMode: boolean;
|
|
134
|
+
/** Auto-login user for dev mode */
|
|
135
|
+
devUser: User;
|
|
136
|
+
/** Dev mode permissions */
|
|
137
|
+
devPermissions: FeatureAccess[];
|
|
138
|
+
/** Landing page config */
|
|
139
|
+
landingPage: LandingPageConfig;
|
|
140
|
+
}
|