Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop loading all data in memory in the history page #18

Merged
merged 6 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 145 additions & 41 deletions src/graphql/codegen/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,17 @@ export type Scalars = {
DateTime: { input: any; output: any; }
};

export type History = {
__typename?: 'History';
prompts: PromptHistoryConnection;
runs: RunHistoryConnection;
stdouts: StdoutHistoryConnection;
traces: TraceHistoryConnection;
};


export type HistoryPromptsArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};


export type HistoryRunsArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};


export type HistoryStdoutsArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};


export type HistoryTracesArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
export type AlertRdb = {
__typename?: 'AlertRDB';
version: Scalars['String']['output'];
};

export type Mutation = {
__typename?: 'Mutation';
exec: Scalars['Boolean']['output'];
interrupt: Scalars['Boolean']['output'];
kill: Scalars['Boolean']['output'];
rdb: MutationRdb;
reset: Scalars['Boolean']['output'];
runAndContinue: Scalars['Boolean']['output'];
schedule: MutationSchedule;
Expand All @@ -88,6 +54,16 @@ export type MutationAutoMode = {
turnOn: Scalars['Boolean']['output'];
};

export type MutationRdb = {
__typename?: 'MutationRDB';
deleteRuns: Array<Scalars['Int']['output']>;
};


export type MutationRdbDeleteRunsArgs = {
ids: Array<Scalars['Int']['input']>;
};

export type MutationSchedule = {
__typename?: 'MutationSchedule';
autoMode: MutationAutoMode;
Expand Down Expand Up @@ -141,6 +117,7 @@ export type PromptHistoryConnection = {
__typename?: 'PromptHistoryConnection';
edges: Array<PromptHistoryEdge>;
pageInfo: PageInfo;
totalCount: Scalars['Int']['output'];
};

export type PromptHistoryEdge = {
Expand All @@ -159,10 +136,13 @@ export type PromptingData = {

export type Query = {
__typename?: 'Query';
alert: AlertRdb;
continuousEnabled: Scalars['Boolean']['output'];
dev: QueryDev;
exception?: Maybe<Scalars['String']['output']>;
hello: Scalars['String']['output'];
history: History;
history: QueryRdb;
rdb: QueryRdb;
runNo: Scalars['Int']['output'];
schedule: QuerySchedule;
settings: Scalars['String']['output'];
Expand All @@ -188,6 +168,60 @@ export type QueryAutoMode = {
state: Scalars['String']['output'];
};

export type QueryDev = {
__typename?: 'QueryDev';
headers: Scalars['String']['output'];
};

export type QueryRdb = {
__typename?: 'QueryRDB';
migrationVersion?: Maybe<Scalars['String']['output']>;
prompts: PromptHistoryConnection;
run?: Maybe<RunHistory>;
runs: RunHistoryConnection;
stdouts: StdoutHistoryConnection;
traces: TraceHistoryConnection;
version: Scalars['String']['output'];
};


export type QueryRdbPromptsArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};


export type QueryRdbRunArgs = {
id?: InputMaybe<Scalars['Int']['input']>;
runNo?: InputMaybe<Scalars['Int']['input']>;
};


export type QueryRdbRunsArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};


export type QueryRdbStdoutsArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};


export type QueryRdbTracesArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};

export type QuerySchedule = {
__typename?: 'QuerySchedule';
autoMode: QueryAutoMode;
Expand Down Expand Up @@ -219,6 +253,7 @@ export type RunHistoryConnection = {
__typename?: 'RunHistoryConnection';
edges: Array<RunHistoryEdge>;
pageInfo: PageInfo;
totalCount: Scalars['Int']['output'];
};

export type RunHistoryEdge = {
Expand All @@ -242,6 +277,7 @@ export type StdoutHistoryConnection = {
__typename?: 'StdoutHistoryConnection';
edges: Array<StdoutHistoryEdge>;
pageInfo: PageInfo;
totalCount: Scalars['Int']['output'];
};

export type StdoutHistoryEdge = {
Expand Down Expand Up @@ -286,6 +322,7 @@ export type TraceHistoryConnection = {
__typename?: 'TraceHistoryConnection';
edges: Array<TraceHistoryEdge>;
pageInfo: PageInfo;
totalCount: Scalars['Int']['output'];
};

export type TraceHistoryEdge = {
Expand Down Expand Up @@ -360,6 +397,23 @@ export type ExceptionQueryVariables = Exact<{ [key: string]: never; }>;

export type ExceptionQuery = { __typename?: 'Query', exception?: string | null };

export type RdbRunQueryVariables = Exact<{
runNo: Scalars['Int']['input'];
}>;


export type RdbRunQuery = { __typename?: 'Query', rdb: { __typename?: 'QueryRDB', run?: { __typename?: 'RunHistory', id: number, runNo: number, state?: string | null, startedAt?: any | null, endedAt?: any | null, script?: string | null, exception?: string | null } | null } };

export type RdbRunsQueryVariables = Exact<{
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
}>;


export type RdbRunsQuery = { __typename?: 'Query', rdb: { __typename?: 'QueryRDB', runs: { __typename?: 'RunHistoryConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', startCursor?: string | null, endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean }, edges: Array<{ __typename?: 'RunHistoryEdge', cursor: string, node: { __typename?: 'RunHistory', id: number, runNo: number, state?: string | null, startedAt?: any | null, endedAt?: any | null, script?: string | null, exception?: string | null } }> } } };

export type QRunNoQueryVariables = Exact<{ [key: string]: never; }>;


Expand All @@ -368,7 +422,7 @@ export type QRunNoQuery = { __typename?: 'Query', runNo: number };
export type RunsQueryVariables = Exact<{ [key: string]: never; }>;


export type RunsQuery = { __typename?: 'Query', history: { __typename?: 'History', runs: { __typename?: 'RunHistoryConnection', edges: Array<{ __typename?: 'RunHistoryEdge', node: { __typename?: 'RunHistory', runNo: number, state?: string | null, startedAt?: any | null, endedAt?: any | null, script?: string | null, exception?: string | null } }> } } };
export type RunsQuery = { __typename?: 'Query', rdb: { __typename?: 'QueryRDB', runs: { __typename?: 'RunHistoryConnection', edges: Array<{ __typename?: 'RunHistoryEdge', node: { __typename?: 'RunHistory', runNo: number, state?: string | null, startedAt?: any | null, endedAt?: any | null, script?: string | null, exception?: string | null } }> } } };

export type QScheduleAutoModeStateQueryVariables = Exact<{ [key: string]: never; }>;

Expand Down Expand Up @@ -553,6 +607,56 @@ export const ExceptionDocument = gql`
export function useExceptionQuery(options: Omit<Urql.UseQueryArgs<never, ExceptionQueryVariables>, 'query'> = {}) {
return Urql.useQuery<ExceptionQuery>({ query: ExceptionDocument, ...options });
};
export const RdbRunDocument = gql`
query RDBRun($runNo: Int!) {
rdb {
run(runNo: $runNo) {
id
runNo
state
startedAt
endedAt
script
exception
}
}
}
`;

export function useRdbRunQuery(options: Omit<Urql.UseQueryArgs<never, RdbRunQueryVariables>, 'query'> = {}) {
return Urql.useQuery<RdbRunQuery>({ query: RdbRunDocument, ...options });
};
export const RdbRunsDocument = gql`
query RDBRuns($before: String, $after: String, $first: Int, $last: Int) {
rdb {
runs(before: $before, after: $after, first: $first, last: $last) {
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
totalCount
edges {
cursor
node {
id
runNo
state
startedAt
endedAt
script
exception
}
}
}
}
}
`;

export function useRdbRunsQuery(options: Omit<Urql.UseQueryArgs<never, RdbRunsQueryVariables>, 'query'> = {}) {
return Urql.useQuery<RdbRunsQuery>({ query: RdbRunsDocument, ...options });
};
export const QRunNoDocument = gql`
query QRunNo {
runNo
Expand All @@ -564,7 +668,7 @@ export function useQRunNoQuery(options: Omit<Urql.UseQueryArgs<never, QRunNoQuer
};
export const RunsDocument = gql`
query Runs {
history {
rdb {
runs {
edges {
node {
Expand Down
13 changes: 13 additions & 0 deletions src/graphql/gql/queries/RDBRun.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
query RDBRun($runNo: Int!) {
rdb {
run(runNo: $runNo) {
id
runNo
state
startedAt
endedAt
script
exception
}
}
}
30 changes: 30 additions & 0 deletions src/graphql/gql/queries/RDBRuns.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
query RDBRuns(
$before: String
$after: String
$first: Int
$last: Int
) {
rdb {
runs(before: $before, after: $after, first: $first, last: $last) {
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
totalCount
edges {
cursor
node {
id
runNo
state
startedAt
endedAt
script
exception
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/graphql/gql/queries/Runs.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query Runs {
history {
rdb {
runs {
edges {
node {
Expand Down
9 changes: 8 additions & 1 deletion src/graphql/urql/query/type.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@

export interface Edge<Node> {
node?: Node | null | undefined;
}

export interface PageInfo {
hasNextPage?: boolean;
hasPreviousPage?: boolean;
startCursor?: string | null;
endCursor?: string | null;
}

export interface Connection<Node> {
pageInfo?: PageInfo;
totalCount?: number;
edges: (Edge<Node> | null)[];
}
Loading
Loading