feat(allocation): implement resource allocation feature
- Add AllocationController with CRUD + bulk endpoints - Add AllocationValidationService for capacity/estimate validation - Add AllocationMatrixService for optimized matrix queries - Add AllocationPolicy for authorization - Add AllocationResource for API responses - Add frontend allocationService and matrix UI - Add E2E tests for allocation matrix (20 tests) - Add unit tests for validation service and policies - Fix month format conversion (YYYY-MM to YYYY-MM-01)
This commit is contained in:
32
frontend/src/lib/stores/expertMode.ts
Normal file
32
frontend/src/lib/stores/expertMode.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
const EXPERT_MODE_KEY = 'headroom.capacity.expertMode';
|
||||
|
||||
function getInitialExpertMode(): boolean {
|
||||
if (typeof localStorage === 'undefined') return false;
|
||||
|
||||
const stored = localStorage.getItem(EXPERT_MODE_KEY);
|
||||
if (stored === 'true') return true;
|
||||
if (stored === 'false') return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
const expertModeWritable = writable<boolean>(getInitialExpertMode());
|
||||
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
expertModeWritable.subscribe((value) => {
|
||||
localStorage.setItem(EXPERT_MODE_KEY, String(value));
|
||||
});
|
||||
}
|
||||
|
||||
export const expertMode = {
|
||||
subscribe: expertModeWritable.subscribe,
|
||||
};
|
||||
|
||||
export function setExpertMode(value: boolean): void {
|
||||
expertModeWritable.set(value);
|
||||
}
|
||||
|
||||
export function toggleExpertMode(): void {
|
||||
expertModeWritable.update((current) => !current);
|
||||
}
|
||||
Reference in New Issue
Block a user