Skip to content

Commit

Permalink
Move EXTRACT_JOB_TYPE to typings/query.ts. Add docs for `QUERY_JO…
Browse files Browse the repository at this point in the history
…B_TYPE`.
  • Loading branch information
junhaoliao committed Jan 12, 2025
1 parent 0a3de9e commit a85679c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
16 changes: 16 additions & 0 deletions components/log-viewer-webui/client/src/typings/query.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

enum QUERY_LOADING_STATE {
SUBMITTING = 0,
WAITING,
Expand All @@ -11,12 +12,26 @@ const QUERY_LOADING_STATE_VALUES = Object.freeze(
Object.values(QUERY_LOADING_STATE).filter((value) => "number" === typeof value)
);

/**
* Enum of job type, matching the `QueryJobType` class in
* `job_orchestration.query_scheduler.constants`.
*
* @enum {number}
*/
enum QUERY_JOB_TYPE {
SEARCH_OR_AGGREGATION = 0,
EXTRACT_IR,
EXTRACT_JSON,
}

/**
* Mapping between job type enums and stream type
*/
const EXTRACT_JOB_TYPE = Object.freeze({
ir: QUERY_JOB_TYPE.EXTRACT_IR,
json: QUERY_JOB_TYPE.EXTRACT_JSON,
});

interface QueryLoadingStateDescription {
label: string;
description: string;
Expand All @@ -43,6 +58,7 @@ const QUERY_LOADING_STATE_DESCRIPTIONS
});

export {
EXTRACT_JOB_TYPE,
QUERY_JOB_TYPE,
QUERY_LOADING_STATE,
QUERY_LOADING_STATE_DESCRIPTIONS,
Expand Down
10 changes: 1 addition & 9 deletions components/log-viewer-webui/client/src/ui/QueryStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,12 @@ import {isAxiosError} from "axios";
import {submitExtractStreamJob} from "../api/query";
import {Nullable} from "../typings/common";
import {
QUERY_JOB_TYPE,
EXTRACT_JOB_TYPE,
QUERY_LOADING_STATE,
} from "../typings/query";
import Loading from "./Loading";


/**
* Mapping between job type enums and stream type
*/
const EXTRACT_JOB_TYPE = Object.freeze({
ir: QUERY_JOB_TYPE.EXTRACT_IR,
json: QUERY_JOB_TYPE.EXTRACT_JSON,
});

/**
* Submits queries and renders the query states.
*
Expand Down

0 comments on commit a85679c

Please sign in to comment.