Spaces:
Paused
Paused
dushyantsingh0 commited on
Commit ·
d1e80eb
1
Parent(s): 4f6d973
backend stabilization
Browse filesFiles changed (4)
1234578 unmodified lines84858687888990919293949596979869 unmodified lines168169170171172173174175176177178179180181123 unmodified lines30530630730830931031131231331431531631731856 unmodified lines37537637737837938038138238338438538643 unmodified lines430431432433434435436437438439440441import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';export interface DashboardStats {total_tickets: number;78 unmodified lines}}, [workspaceId]);useEffect(() => {const token = localStorage.getItem('token');if (token) {// If we already have stats for this workspace, don't re-fetch unless requestedif (!globalStats || globalStats.workspace_id !== workspaceId) {fetchStats();}}}, [fetchStats, workspaceId]);return {stats: localStats,69 unmodified lines}}, [workspaceId]);useEffect(() => {const token = localStorage.getItem('token');if (token) {if (!globalReports.volume) {fetchReports();}}}, [fetchReports]);return { ...localReports, loading, error, refresh: () => fetchReports(true) };};123 unmodified lines}};useEffect(() => {const token = localStorage.getItem('token');if (token) {if (globalEscalations.rules.length === 0 && globalEscalations.breaches.length === 0) {fetchData();}}}, [fetchData]);return { ...localEsc, loading, error, refresh: () => fetchData(true), createRule, updateRule, deleteRule };};56 unmodified lines}}, [workspaceId]);useEffect(() => {const token = localStorage.getItem('token');if (token && !globalAIInsights) {fetchInsights();}}, [fetchInsights]);return { insights, loading, error, refresh: () => fetchInsights(true) };};43 unmodified lines}}, [workspaceId]);useEffect(() => {const token = localStorage.getItem('token');if (token && !globalNarrative) {fetchNarrative();}}, [fetchNarrative]);return { narrative, loading, error, refresh: () => fetchNarrative(true) };};12345678 unmodified lines85868788899091929394959697989910069 unmodified lines170171172173174175176177178179180181182183184123 unmodified lines30830931031131231331431531631731831932032132256 unmodified lines37938038138238338438538638738838939039143 unmodified lines435436437438439440441442443444445446447import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';import { useAuth } from './useAuth';export interface DashboardStats {total_tickets: number;78 unmodified lines}}, [workspaceId]);const { token } = useAuth();useEffect(() => {if (token) {// If we already have stats for this workspace, don't re-fetch unless requestedif (!globalStats || globalStats.workspace_id !== workspaceId) {fetchStats();}}}, [fetchStats, workspaceId, token]);return {stats: localStats,69 unmodified lines}}, [workspaceId]);const { token } = useAuth();useEffect(() => {if (token) {if (!globalReports.volume) {fetchReports();}}}, [fetchReports, token]);return { ...localReports, loading, error, refresh: () => fetchReports(true) };};123 unmodified lines}};const { token } = useAuth();useEffect(() => {if (token) {if (globalEscalations.rules.length === 0 && globalEscalations.breaches.length === 0) {fetchData();}}}, [fetchData, token]);return { ...localEsc, loading, error, refresh: () => fetchData(true), createRule, updateRule, deleteRule };};56 unmodified lines}}, [workspaceId]);const { token } = useAuth();useEffect(() => {if (token && !globalAIInsights) {fetchInsights();}}, [fetchInsights, token]);return { insights, loading, error, refresh: () => fetchInsights(true) };};43 unmodified lines}}, [workspaceId]);const { token } = useAuth();useEffect(() => {if (token && !globalNarrative) {fetchNarrative();}}, [fetchNarrative, token]);return { narrative, loading, error, refresh: () => fetchNarrative(true) };};
1234580 unmodified lines86878889909192939495969747 unmodified lines14514614714814915015115215315415515639 unmodified lines196197198199200201202203204205206207import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';export interface Ticket {id: string;80 unmodified lines}};useEffect(() => {const token = localStorage.getItem('token');if (token && globalTickets.length === 0) {fetchTickets();}}, [fetchTickets]);return { tickets: localTickets, loading, error, refresh: () => fetchTickets(true), createTicket };};47 unmodified lines}}, [workspaceId]);useEffect(() => {const token = localStorage.getItem('token');if (token && globalQueue.length === 0) {fetchQueue();}}, [fetchQueue]);return { tickets: localQueue, loading, error, refresh: () => fetchQueue(true) };};39 unmodified lines}}, []);useEffect(() => {const token = localStorage.getItem('token');if (token && globalStatuses.length === 0) {fetchStatuses();}}, [fetchStatuses]);return { statuses: localStatuses, loading, error, refresh: () => fetchStatuses(true) };};12345680 unmodified lines8788899091929394959697989947 unmodified lines14714814915015115215315415515615715815939 unmodified lines199200201202203204205206207208209210211import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';import { useAuth } from './useAuth';export interface Ticket {id: string;80 unmodified lines}};const { token } = useAuth();useEffect(() => {if (token && globalTickets.length === 0) {fetchTickets();}}, [fetchTickets, token]);return { tickets: localTickets, loading, error, refresh: () => fetchTickets(true), createTicket };};47 unmodified lines}}, [workspaceId]);const { token } = useAuth();useEffect(() => {if (token && globalQueue.length === 0) {fetchQueue();}}, [fetchQueue, token]);return { tickets: localQueue, loading, error, refresh: () => fetchQueue(true) };};39 unmodified lines}}, []);const { token } = useAuth();useEffect(() => {if (token && globalStatuses.length === 0) {fetchStatuses();}}, [fetchStatuses, token]);return { statuses: localStatuses, loading, error, refresh: () => fetchStatuses(true) };};
1234563 unmodified lines697071727374757677787980import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';export interface User {id: string;63 unmodified lines}};useEffect(() => {const token = localStorage.getItem('token');if (token && !globalUsersLoaded && !globalUsersLoading) {fetchUsers();}}, [fetchUsers]);return { users: localUsers, loading, error, loaded, refresh: () => fetchUsers(true), addUser };};12345663 unmodified lines70717273747576777879808182import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';import { useAuth } from './useAuth';export interface User {id: string;63 unmodified lines}};const { token } = useAuth();useEffect(() => {if (token && !globalUsersLoaded && !globalUsersLoading) {fetchUsers();}}, [fetchUsers, token]);return { users: localUsers, loading, error, loaded, refresh: () => fetchUsers(true), addUser };};
1234538 unmodified lines44454647484950515253545538 unmodified lines949596979899100101102103104105import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';export interface Workspace {id: string;38 unmodified lines}}, []);useEffect(() => {const token = localStorage.getItem('token');if (token && !globalActiveWorkspace && !globalActiveWorkspaceLoading) {fetchWorkspace();}}, [fetchWorkspace]);return { workspace, loading, refresh: () => fetchWorkspace(true) };};38 unmodified lines}}, []);useEffect(() => {const token = localStorage.getItem('token');if (token && globalWorkspaces.length === 0) {fetchWorkspaces();}}, [fetchWorkspaces]);return { workspaces: localWorkspaces, loading, error, refresh: () => fetchWorkspaces(true) };};12345638 unmodified lines4546474849505152535455565738 unmodified lines96979899100101102103104105106107108import { useState, useCallback, useEffect } from 'react';import api from '../utils/api';import { useAuth } from './useAuth';export interface Workspace {id: string;38 unmodified lines}}, []);const { token } = useAuth();useEffect(() => {if (token && !globalActiveWorkspace && !globalActiveWorkspaceLoading) {fetchWorkspace();}}, [fetchWorkspace, token]);return { workspace, loading, refresh: () => fetchWorkspace(true) };};38 unmodified lines}}, []);const { token } = useAuth();useEffect(() => {if (token && globalWorkspaces.length === 0) {fetchWorkspaces();}}, [fetchWorkspaces, token]);return { workspaces: localWorkspaces, loading, error, refresh: () => fetchWorkspaces(true) };};
frontend/packages/shared/src/hooks/useDashboard.ts+16-10
frontend/packages/shared/src/hooks/useTickets.ts+10-6
frontend/packages/shared/src/hooks/useUsers.ts+4-2
frontend/packages/shared/src/hooks/useWorkspaces.ts+7-4