github.com/grafana/pyroscope@v1.18.0/public/app/redux/reducers/continuous/state.ts (about)

     1  import type { Profile } from '@pyroscope/legacy/models';
     2  import type { Timeline } from '@pyroscope/models/timeline';
     3  import type { App } from '@pyroscope/models/app';
     4  
     5  type SingleView =
     6    | { type: 'pristine'; profile?: Profile }
     7    | { type: 'loading'; profile?: Profile }
     8    | {
     9        type: 'loaded';
    10        timeline: Timeline;
    11        profile: Profile;
    12      }
    13    | {
    14        type: 'reloading';
    15        timeline: Timeline;
    16        profile: Profile;
    17      };
    18  
    19  type TimelineState =
    20    | { type: 'pristine'; timeline: Timeline }
    21    | { type: 'loading'; timeline: Timeline }
    22    | { type: 'reloading'; timeline: Timeline }
    23    | { type: 'loaded'; timeline: Timeline };
    24  
    25  type TagsData =
    26    | { type: 'pristine' }
    27    | { type: 'loading' }
    28    | { type: 'failed' }
    29    | { type: 'loaded'; values: string[] };
    30  
    31  // Tags really refer to each application
    32  // Should we nest them to an application?
    33  export type TagsState =
    34    | { type: 'pristine'; tags: Record<string, TagsData> }
    35    | { type: 'loading'; tags: Record<string, TagsData> }
    36    | {
    37        type: 'loaded';
    38        tags: Record<string, TagsData>;
    39        from: number;
    40        until: number;
    41      }
    42    | { type: 'failed'; tags: Record<string, TagsData> };
    43  
    44  // TODO
    45  type appName = string;
    46  type Tags = Record<appName, TagsState>;
    47  
    48  export interface ContinuousState {
    49    from: string;
    50    until: string;
    51    leftFrom: string;
    52    leftUntil: string;
    53    rightFrom: string;
    54    rightUntil: string;
    55    query: string;
    56    leftQuery?: string;
    57    rightQuery?: string;
    58    maxNodes: string;
    59    aggregation: string;
    60    refreshToken?: string;
    61  
    62    singleView: SingleView;
    63    tags: Tags;
    64  
    65    apps:
    66      | { type: 'loaded'; data: App[] }
    67      | { type: 'reloading'; data: App[] }
    68      | { type: 'failed'; data: App[] };
    69  
    70    // Since both comparison and diff use the same timeline
    71    // Makes sense storing them separately
    72    leftTimeline: TimelineState;
    73    rightTimeline: TimelineState;
    74  }