@gen3/core 0.10.49 → 0.10.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +299 -29
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/constants.d.ts +2 -1
- package/dist/dts/features/cohort/cohortSlice.d.ts +16 -1
- package/dist/dts/features/cohort/index.d.ts +2 -2
- package/dist/dts/features/download/downloadStatusApi.d.ts +303 -1
- package/dist/dts/features/download/index.d.ts +2 -2
- package/dist/dts/features/guppy/tests/conversion.unit.test.d.ts +1 -0
- package/dist/dts/features/sower/index.d.ts +2 -0
- package/dist/dts/features/sower/sowerApi.d.ts +845 -0
- package/dist/dts/features/sower/types.d.ts +8 -0
- package/dist/dts/features/user/index.d.ts +1 -1
- package/dist/dts/features/user/types.d.ts +1 -1
- package/dist/dts/features/user/userSliceRTK.d.ts +3 -0
- package/dist/dts/features/workspace/index.d.ts +5 -2
- package/dist/dts/features/workspace/types.d.ts +89 -0
- package/dist/dts/features/workspace/utils.d.ts +3 -0
- package/dist/dts/features/workspace/workspaceApi.d.ts +1523 -0
- package/dist/dts/features/workspace/workspaceSlice.d.ts +14 -0
- package/dist/dts/hooks.d.ts +2 -0
- package/dist/dts/index.d.ts +3 -2
- package/dist/dts/reducers.d.ts +2 -0
- package/dist/dts/store.d.ts +2 -0
- package/dist/dts/types/index.d.ts +5 -0
- package/dist/esm/index.js +273 -29
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +2350 -331
- package/package.json +2 -2
- package/dist/dts/features/workspace/workspacesSlice.d.ts +0 -402
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoreState } from '../../reducers';
|
|
2
|
+
import { type WorkspaceId, WorkspaceStatus } from './types';
|
|
3
|
+
export declare const NO_WORKSPACE_ID = "none";
|
|
4
|
+
export type RequestedWorkspaceStatus = 'Launching' | 'Terminating' | 'NotSet';
|
|
5
|
+
export interface WorkspaceState {
|
|
6
|
+
id: string;
|
|
7
|
+
status: WorkspaceStatus;
|
|
8
|
+
requestedStatus: RequestedWorkspaceStatus;
|
|
9
|
+
}
|
|
10
|
+
export declare const activeWorkspaceReducer: import("redux").Reducer<WorkspaceState>;
|
|
11
|
+
export declare const setActiveWorkspaceId: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceId, "ActiveWorkspace/setActiveWorkspaceId">, clearActiveWorkspaceId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"ActiveWorkspace/clearActiveWorkspaceId">, setActiveWorkspaceStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceStatus, "ActiveWorkspace/setActiveWorkspaceStatus">, setRequestedWorkspaceStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<RequestedWorkspaceStatus, "ActiveWorkspace/setRequestedWorkspaceStatus">, setActiveWorkspace: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceState, "ActiveWorkspace/setActiveWorkspace">;
|
|
12
|
+
export declare const selectActiveWorkspaceId: (state: CoreState) => string;
|
|
13
|
+
export declare const selectActiveWorkspaceStatus: (state: CoreState) => WorkspaceStatus;
|
|
14
|
+
export declare const selectRequestedWorkspaceStatus: (state: CoreState) => RequestedWorkspaceStatus;
|
package/dist/dts/hooks.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const useCoreSelector: import("react-redux").UseSelector<{
|
|
|
13
13
|
drsHostnames: Record<string, string>;
|
|
14
14
|
modals: import("./features/modals/modalsSlice").ModalState;
|
|
15
15
|
cohorts: import("./features/cohort/cohortSlice").CohortState;
|
|
16
|
+
activeWorkspace: import("./features/workspace/workspaceSlice").WorkspaceState;
|
|
16
17
|
userAuthApi: import("@reduxjs/toolkit/query").CombinedState<{
|
|
17
18
|
fetchUserDetails: import("@reduxjs/toolkit/query").QueryDefinition<void, ({ endpoint }: any, { getState }: import("@reduxjs/toolkit/query").BaseQueryApi) => Promise<{
|
|
18
19
|
data: {};
|
|
@@ -34,6 +35,7 @@ export declare const useCoreDispatch: import("react-redux").UseDispatch<import("
|
|
|
34
35
|
drsHostnames: Record<string, string>;
|
|
35
36
|
modals: import("./features/modals/modalsSlice").ModalState;
|
|
36
37
|
cohorts: import("./features/cohort/cohortSlice").CohortState;
|
|
38
|
+
activeWorkspace: import("./features/workspace/workspaceSlice").WorkspaceState;
|
|
37
39
|
userAuthApi: import("@reduxjs/toolkit/query").CombinedState<{
|
|
38
40
|
fetchUserDetails: import("@reduxjs/toolkit/query").QueryDefinition<void, ({ endpoint }: any, { getState }: import("@reduxjs/toolkit/query").BaseQueryApi) => Promise<{
|
|
39
41
|
data: {};
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GEN3_API, GEN3_DOMAIN, GEN3_COMMONS_NAME, GEN3_DOWNLOADS_ENDPOINT, GEN3_GUPPY_API, GEN3_FENCE_API, GEN3_AUTHZ_API, GEN3_MDS_API, GEN3_REDIRECT_URL,
|
|
1
|
+
import { GEN3_API, GEN3_DOMAIN, GEN3_COMMONS_NAME, GEN3_DOWNLOADS_ENDPOINT, GEN3_GUPPY_API, GEN3_FENCE_API, GEN3_AUTHZ_API, GEN3_MDS_API, GEN3_REDIRECT_URL, GEN3_WORKSPACE_API, GEN3_SUBMISSION_API, GEN3_CROSSWALK_API, GEN3_SOWER_API, Accessibility } from './constants';
|
|
2
2
|
import { type CoreState } from './reducers';
|
|
3
3
|
export * from './features/user';
|
|
4
4
|
export * from './types';
|
|
@@ -20,4 +20,5 @@ export * from './features/guppy';
|
|
|
20
20
|
export * from './features/aiSearch';
|
|
21
21
|
export * from './features/workspace';
|
|
22
22
|
export * from './features/submission';
|
|
23
|
-
export
|
|
23
|
+
export * from './features/sower';
|
|
24
|
+
export { type CoreState, GEN3_COMMONS_NAME, GEN3_DOMAIN, GEN3_API, GEN3_DOWNLOADS_ENDPOINT, GEN3_GUPPY_API, GEN3_FENCE_API, GEN3_AUTHZ_API, GEN3_MDS_API, GEN3_REDIRECT_URL, GEN3_WORKSPACE_API, GEN3_SUBMISSION_API, GEN3_CROSSWALK_API, GEN3_SOWER_API, Accessibility, };
|
package/dist/dts/reducers.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const rootReducer: import("redux").Reducer<{
|
|
|
6
6
|
drsHostnames: Record<string, string>;
|
|
7
7
|
modals: import("./features/modals/modalsSlice").ModalState;
|
|
8
8
|
cohorts: import("./features/cohort/cohortSlice").CohortState;
|
|
9
|
+
activeWorkspace: import("./features/workspace/workspaceSlice").WorkspaceState;
|
|
9
10
|
userAuthApi: import("@reduxjs/toolkit/query").CombinedState<{
|
|
10
11
|
fetchUserDetails: import("@reduxjs/toolkit/query").QueryDefinition<void, ({ endpoint }: any, { getState }: import("@reduxjs/toolkit/query").BaseQueryApi) => Promise<{
|
|
11
12
|
data: {};
|
|
@@ -26,6 +27,7 @@ export declare const rootReducer: import("redux").Reducer<{
|
|
|
26
27
|
drsHostnames: Record<string, string> | undefined;
|
|
27
28
|
modals: import("./features/modals/modalsSlice").ModalState | undefined;
|
|
28
29
|
cohorts: import("./features/cohort/cohortSlice").CohortState | undefined;
|
|
30
|
+
activeWorkspace: import("./features/workspace/workspaceSlice").WorkspaceState | undefined;
|
|
29
31
|
userAuthApi: import("@reduxjs/toolkit/query").CombinedState<{
|
|
30
32
|
fetchUserDetails: import("@reduxjs/toolkit/query").QueryDefinition<void, ({ endpoint }: any, { getState }: import("@reduxjs/toolkit/query").BaseQueryApi) => Promise<{
|
|
31
33
|
data: {};
|
package/dist/dts/store.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const coreStore: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
6
6
|
drsHostnames: Record<string, string>;
|
|
7
7
|
modals: import("./features/modals/modalsSlice").ModalState;
|
|
8
8
|
cohorts: import("./features/cohort/cohortSlice").CohortState;
|
|
9
|
+
activeWorkspace: import("./features/workspace/workspaceSlice").WorkspaceState;
|
|
9
10
|
userAuthApi: import("@reduxjs/toolkit/query").CombinedState<{
|
|
10
11
|
fetchUserDetails: import("@reduxjs/toolkit/query").QueryDefinition<void, ({ endpoint }: any, { getState }: import("@reduxjs/toolkit/query").BaseQueryApi) => Promise<{
|
|
11
12
|
data: {};
|
|
@@ -27,6 +28,7 @@ export declare const coreStore: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
27
28
|
drsHostnames: Record<string, string>;
|
|
28
29
|
modals: import("./features/modals/modalsSlice").ModalState;
|
|
29
30
|
cohorts: import("./features/cohort/cohortSlice").CohortState;
|
|
31
|
+
activeWorkspace: import("./features/workspace/workspaceSlice").WorkspaceState;
|
|
30
32
|
userAuthApi: import("@reduxjs/toolkit/query").CombinedState<{
|
|
31
33
|
fetchUserDetails: import("@reduxjs/toolkit/query").QueryDefinition<void, ({ endpoint }: any, { getState }: import("@reduxjs/toolkit/query").BaseQueryApi) => Promise<{
|
|
32
34
|
data: {};
|
|
@@ -43,6 +43,11 @@ interface ParsingError {
|
|
|
43
43
|
data: string;
|
|
44
44
|
error: string;
|
|
45
45
|
}
|
|
46
|
+
interface HttpError {
|
|
47
|
+
status: number;
|
|
48
|
+
data: unknown;
|
|
49
|
+
}
|
|
50
|
+
export declare function isHttpStatusError(error: unknown): error is HttpError;
|
|
46
51
|
/**
|
|
47
52
|
* Type predicate to narrow an unknown error to an object with a string 'message' property
|
|
48
53
|
*/
|
package/dist/esm/index.js
CHANGED
|
@@ -27,10 +27,11 @@ const GEN3_FENCE_API = process.env.NEXT_PUBLIC_GEN3_FENCE_API || GEN3_API;
|
|
|
27
27
|
const GEN3_AI_SEARCH_API = process.env.NEXT_PUBLIC_GEN3_AI_SEARCH_API || `${GEN3_API}/ai-search`;
|
|
28
28
|
const GEN3_AUTHZ_API = process.env.NEXT_PUBLIC_GEN3_AUTHZ_API || `${GEN3_API}/authz`;
|
|
29
29
|
const GEN3_REDIRECT_URL = process.env.NEXT_PUBLIC_GEN3_REDIRECT_URL || GEN3_API;
|
|
30
|
-
const
|
|
30
|
+
const GEN3_WORKSPACE_API = process.env.NEXT_PUBLIC_GEN3_WORKSPACE_STATUS_API || `${GEN3_API}/lw-workspace`;
|
|
31
31
|
const GEN3_SUBMISSION_API = process.env.NEXT_PUBLIC_GEN3_SUBMISSION_API || `${GEN3_API}/api/v0/submission`;
|
|
32
32
|
const GEN3_WTS_API = process.env.NEXT_PUBLIC_GEN3_WTS_API || `${GEN3_API}/wts`;
|
|
33
33
|
const GEN3_CROSSWALK_API = process.env.NEXT_PUBLIC_GEN3_CROSSWALK_API || `${GEN3_API}/mds`;
|
|
34
|
+
const GEN3_SOWER_API = process.env.NEXT_PUBLIC_GEN3_SOWER_API || `${GEN3_API}/jobs`;
|
|
34
35
|
var Accessibility;
|
|
35
36
|
(function(Accessibility) {
|
|
36
37
|
Accessibility["ACCESSIBLE"] = "accessible";
|
|
@@ -390,7 +391,7 @@ const createUseCoreDataHook = (fetchDataActionCreator, dataSelector)=>{
|
|
|
390
391
|
});
|
|
391
392
|
const isAuthenticated = (loginStatus)=>loginStatus === 'authenticated';
|
|
392
393
|
const isPending = (loginStatus)=>loginStatus === 'pending';
|
|
393
|
-
const initialState$
|
|
394
|
+
const initialState$4 = {
|
|
394
395
|
status: 'uninitialized',
|
|
395
396
|
loginStatus: 'unauthenticated',
|
|
396
397
|
error: undefined
|
|
@@ -399,11 +400,11 @@ const initialState$3 = {
|
|
|
399
400
|
* Wraps a slice on top of fetchUserState async thunk to keep track of
|
|
400
401
|
* query state. authenticated/not-authenticated vs. ejected/fulfilled/pending
|
|
401
402
|
* @returns: status messages wrapped around fetchUserState response dict
|
|
402
|
-
*/ const slice$
|
|
403
|
+
*/ const slice$4 = createSlice({
|
|
403
404
|
name: 'fence/user',
|
|
404
|
-
initialState: initialState$
|
|
405
|
+
initialState: initialState$4,
|
|
405
406
|
reducers: {
|
|
406
|
-
resetUserState: ()=>initialState$
|
|
407
|
+
resetUserState: ()=>initialState$4
|
|
407
408
|
},
|
|
408
409
|
extraReducers: (builder)=>{
|
|
409
410
|
builder.addCase(fetchUserState.fulfilled, (_, action)=>{
|
|
@@ -434,8 +435,8 @@ const initialState$3 = {
|
|
|
434
435
|
});
|
|
435
436
|
}
|
|
436
437
|
});
|
|
437
|
-
const userReducer = slice$
|
|
438
|
-
const { resetUserState } = slice$
|
|
438
|
+
const userReducer = slice$4.reducer;
|
|
439
|
+
const { resetUserState } = slice$4.actions;
|
|
439
440
|
const selectUserData = (state)=>{
|
|
440
441
|
return state.user;
|
|
441
442
|
};
|
|
@@ -554,6 +555,9 @@ const isHistogramDataArrayARange = (data)=>{
|
|
|
554
555
|
*/ function isErrorWithMessage(error) {
|
|
555
556
|
return typeof error === 'object' && error != null && 'message' in error && typeof error.message === 'string';
|
|
556
557
|
}
|
|
558
|
+
function isHttpStatusError(error) {
|
|
559
|
+
return typeof error === 'object' && error != null && 'status' in error && typeof error.status === 'number';
|
|
560
|
+
}
|
|
557
561
|
/**
|
|
558
562
|
* Type predicate to narrow an unknown error to an object with a string 'message' property
|
|
559
563
|
*/ function isFetchParseError(error) {
|
|
@@ -570,12 +574,12 @@ const lookupGen3App = (id)=>{
|
|
|
570
574
|
return REGISTRY[id];
|
|
571
575
|
};
|
|
572
576
|
|
|
573
|
-
const initialState$
|
|
577
|
+
const initialState$3 = {
|
|
574
578
|
gen3Apps: {}
|
|
575
579
|
};
|
|
576
|
-
const slice$
|
|
580
|
+
const slice$3 = createSlice({
|
|
577
581
|
name: 'gen3Apps',
|
|
578
|
-
initialState: initialState$
|
|
582
|
+
initialState: initialState$3,
|
|
579
583
|
reducers: {
|
|
580
584
|
addGen3AppMetadata: (state, action)=>{
|
|
581
585
|
const { name, requiredEntityTypes } = action.payload;
|
|
@@ -589,24 +593,24 @@ const slice$2 = createSlice({
|
|
|
589
593
|
}
|
|
590
594
|
}
|
|
591
595
|
});
|
|
592
|
-
const gen3AppReducer = slice$
|
|
593
|
-
const { addGen3AppMetadata } = slice$
|
|
596
|
+
const gen3AppReducer = slice$3.reducer;
|
|
597
|
+
const { addGen3AppMetadata } = slice$3.actions;
|
|
594
598
|
const selectGen3AppMetadataByName = (state, appName)=>state.gen3Apps.gen3Apps[appName];
|
|
595
599
|
const selectGen3AppByName = (appName)=>lookupGen3App(appName); // TODO: memoize this selector
|
|
596
600
|
|
|
597
|
-
const initialState$
|
|
601
|
+
const initialState$2 = {};
|
|
598
602
|
// TODO: document what this does
|
|
599
|
-
const slice$
|
|
603
|
+
const slice$2 = createSlice({
|
|
600
604
|
name: 'drsResolver',
|
|
601
|
-
initialState: initialState$
|
|
605
|
+
initialState: initialState$2,
|
|
602
606
|
reducers: {
|
|
603
607
|
setDRSHostnames: (_state, action)=>{
|
|
604
608
|
return action.payload;
|
|
605
609
|
}
|
|
606
610
|
}
|
|
607
611
|
});
|
|
608
|
-
const drsHostnamesReducer = slice$
|
|
609
|
-
const { setDRSHostnames } = slice$
|
|
612
|
+
const drsHostnamesReducer = slice$2.reducer;
|
|
613
|
+
const { setDRSHostnames } = slice$2.actions;
|
|
610
614
|
|
|
611
615
|
var Modals;
|
|
612
616
|
(function(Modals) {
|
|
@@ -616,13 +620,13 @@ var Modals;
|
|
|
616
620
|
Modals["CreateCredentialsAPIKeyModal"] = "CreateCredentialsAPIKeyModal";
|
|
617
621
|
Modals["GeneralErrorModal"] = "GeneralErrorModal";
|
|
618
622
|
})(Modals || (Modals = {}));
|
|
619
|
-
const initialState = {
|
|
623
|
+
const initialState$1 = {
|
|
620
624
|
currentModal: null
|
|
621
625
|
};
|
|
622
626
|
//Creates a modal slice for tracking showModal and hideModal state.
|
|
623
|
-
const slice = createSlice({
|
|
627
|
+
const slice$1 = createSlice({
|
|
624
628
|
name: 'modals',
|
|
625
|
-
initialState,
|
|
629
|
+
initialState: initialState$1,
|
|
626
630
|
reducers: {
|
|
627
631
|
showModal: (state, action)=>{
|
|
628
632
|
state.currentModal = action.payload.modal;
|
|
@@ -635,8 +639,8 @@ const slice = createSlice({
|
|
|
635
639
|
}
|
|
636
640
|
}
|
|
637
641
|
});
|
|
638
|
-
const modalReducer = slice.reducer;
|
|
639
|
-
const { showModal, hideModal } = slice.actions;
|
|
642
|
+
const modalReducer = slice$1.reducer;
|
|
643
|
+
const { showModal, hideModal } = slice$1.actions;
|
|
640
644
|
const selectCurrentModal = (state)=>state.modals.currentModal;
|
|
641
645
|
const selectCurrentMessage = (state)=>state.modals.message;
|
|
642
646
|
|
|
@@ -681,6 +685,18 @@ const cohortsAdapter = createEntityAdapter<Cohort>({
|
|
|
681
685
|
}
|
|
682
686
|
};
|
|
683
687
|
},
|
|
688
|
+
setCohortFilter: (state, action)=>{
|
|
689
|
+
const { index, filters } = action.payload;
|
|
690
|
+
return {
|
|
691
|
+
cohort: {
|
|
692
|
+
...state.cohort,
|
|
693
|
+
filters: {
|
|
694
|
+
...state.cohort.filters,
|
|
695
|
+
[index]: filters
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
},
|
|
684
700
|
// removes a filter to the cohort filter set at the given index
|
|
685
701
|
removeCohortFilter: (state, action)=>{
|
|
686
702
|
const { index, field } = action.payload;
|
|
@@ -722,7 +738,7 @@ const cohortsAdapter = createEntityAdapter<Cohort>({
|
|
|
722
738
|
}
|
|
723
739
|
});
|
|
724
740
|
// Filter actions: addFilter, removeFilter, updateFilter
|
|
725
|
-
const { updateCohortFilter, removeCohortFilter, clearCohortFilters } = cohortSlice.actions;
|
|
741
|
+
const { updateCohortFilter, setCohortFilter, removeCohortFilter, clearCohortFilters } = cohortSlice.actions;
|
|
726
742
|
const selectCohortFilters = (state)=>state.cohorts.cohort.filters;
|
|
727
743
|
const selectCurrentCohortId = (state)=>state.cohorts.cohort.id;
|
|
728
744
|
const selectCurrentCohort = (state)=>state.cohorts.cohort;
|
|
@@ -750,6 +766,80 @@ const EmptyFilterSet = {
|
|
|
750
766
|
};
|
|
751
767
|
const cohortReducer = cohortSlice.reducer;
|
|
752
768
|
|
|
769
|
+
var WorkspaceStatus;
|
|
770
|
+
(function(WorkspaceStatus) {
|
|
771
|
+
WorkspaceStatus["Launching"] = "Launching";
|
|
772
|
+
WorkspaceStatus["Running"] = "Running";
|
|
773
|
+
WorkspaceStatus["Terminating"] = "Terminating";
|
|
774
|
+
WorkspaceStatus["Stopped"] = "Stopped";
|
|
775
|
+
WorkspaceStatus["NotFound"] = "Not Found";
|
|
776
|
+
WorkspaceStatus["Errored"] = "Errored";
|
|
777
|
+
WorkspaceStatus["StatusError"] = "Status Error";
|
|
778
|
+
})(WorkspaceStatus || (WorkspaceStatus = {}));
|
|
779
|
+
var PodConditionType;
|
|
780
|
+
(function(PodConditionType) {
|
|
781
|
+
PodConditionType["PodScheduled"] = "PodScheduled";
|
|
782
|
+
PodConditionType["Initialized"] = "Initialized";
|
|
783
|
+
PodConditionType["ContainersReady"] = "ContainersReady";
|
|
784
|
+
PodConditionType["PodReadyToStartContainers"] = "PodReadyToStartContainers";
|
|
785
|
+
PodConditionType["ProxyConnected"] = "ProxyConnected";
|
|
786
|
+
PodConditionType["Ready"] = "Ready";
|
|
787
|
+
})(PodConditionType || (PodConditionType = {}));
|
|
788
|
+
var PodStatus;
|
|
789
|
+
(function(PodStatus) {
|
|
790
|
+
PodStatus["True"] = "True";
|
|
791
|
+
PodStatus["False"] = "False";
|
|
792
|
+
PodStatus["Unknown"] = "Unknown";
|
|
793
|
+
})(PodStatus || (PodStatus = {}));
|
|
794
|
+
|
|
795
|
+
const NO_WORKSPACE_ID = 'none';
|
|
796
|
+
const initialState = {
|
|
797
|
+
id: NO_WORKSPACE_ID,
|
|
798
|
+
status: WorkspaceStatus.NotFound,
|
|
799
|
+
requestedStatus: 'NotSet'
|
|
800
|
+
};
|
|
801
|
+
const slice = createSlice({
|
|
802
|
+
name: 'ActiveWorkspace',
|
|
803
|
+
initialState,
|
|
804
|
+
reducers: {
|
|
805
|
+
setActiveWorkspaceId: (state, action)=>{
|
|
806
|
+
state = {
|
|
807
|
+
...state,
|
|
808
|
+
id: action.payload.id
|
|
809
|
+
};
|
|
810
|
+
return state;
|
|
811
|
+
},
|
|
812
|
+
clearActiveWorkspaceId: (state)=>{
|
|
813
|
+
return {
|
|
814
|
+
...state,
|
|
815
|
+
id: NO_WORKSPACE_ID
|
|
816
|
+
};
|
|
817
|
+
},
|
|
818
|
+
setActiveWorkspaceStatus: (state, action)=>{
|
|
819
|
+
return {
|
|
820
|
+
...state,
|
|
821
|
+
status: action.payload
|
|
822
|
+
};
|
|
823
|
+
},
|
|
824
|
+
setRequestedWorkspaceStatus: (state, action)=>{
|
|
825
|
+
return {
|
|
826
|
+
...state,
|
|
827
|
+
requestedStatus: action.payload
|
|
828
|
+
};
|
|
829
|
+
},
|
|
830
|
+
setActiveWorkspace: (_state, action)=>{
|
|
831
|
+
return {
|
|
832
|
+
...action.payload
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
const activeWorkspaceReducer = slice.reducer;
|
|
838
|
+
const { setActiveWorkspaceId, clearActiveWorkspaceId, setActiveWorkspaceStatus, setRequestedWorkspaceStatus, setActiveWorkspace } = slice.actions;
|
|
839
|
+
const selectActiveWorkspaceId = (state)=>state.activeWorkspace.id;
|
|
840
|
+
const selectActiveWorkspaceStatus = (state)=>state.activeWorkspace.status;
|
|
841
|
+
const selectRequestedWorkspaceStatus = (state)=>state.activeWorkspace.requestedStatus;
|
|
842
|
+
|
|
753
843
|
/**
|
|
754
844
|
* Creates a base class core API for guppy API calls.
|
|
755
845
|
* @returns: guppy core API with guppyAPIFetch base query
|
|
@@ -806,6 +896,7 @@ const rootReducer = combineReducers({
|
|
|
806
896
|
drsHostnames: drsHostnamesReducer,
|
|
807
897
|
modals: modalReducer,
|
|
808
898
|
cohorts: cohortReducer,
|
|
899
|
+
activeWorkspace: activeWorkspaceReducer,
|
|
809
900
|
[guppyApiSliceReducerPath]: guppyApiReducer,
|
|
810
901
|
[userAuthApiReducerPath]: userAuthApiReducer
|
|
811
902
|
});
|
|
@@ -1972,20 +2063,142 @@ const { useDownloadFromGuppyMutation } = downloadRequestApi;
|
|
|
1972
2063
|
// Add more endpoints here
|
|
1973
2064
|
const { useAskQuestionMutation, useGetAISearchStatusQuery, useGetAISearchVersionQuery } = aiSearchApi;
|
|
1974
2065
|
|
|
1975
|
-
const
|
|
2066
|
+
const WorkspaceWithTags = gen3Api.enhanceEndpoints({
|
|
2067
|
+
addTagTypes: [
|
|
2068
|
+
'Workspace',
|
|
2069
|
+
'PayModel'
|
|
2070
|
+
]
|
|
2071
|
+
});
|
|
2072
|
+
const EmptyWorkspaceStatusResponse = {
|
|
2073
|
+
status: WorkspaceStatus.NotFound,
|
|
2074
|
+
conditions: [],
|
|
2075
|
+
containerStates: [],
|
|
2076
|
+
idleTimeLimit: 0,
|
|
2077
|
+
lastActivityTime: 0,
|
|
2078
|
+
workspaceType: ''
|
|
2079
|
+
};
|
|
2080
|
+
const workspacesApi = WorkspaceWithTags.injectEndpoints({
|
|
1976
2081
|
endpoints: (builder)=>({
|
|
1977
2082
|
getWorkspaceOptions: builder.query({
|
|
1978
|
-
query: ()=>`${
|
|
2083
|
+
query: ()=>`${GEN3_WORKSPACE_API}/options`,
|
|
2084
|
+
transformResponse: (response)=>{
|
|
2085
|
+
return response.map((workspace)=>{
|
|
2086
|
+
return {
|
|
2087
|
+
id: workspace.id,
|
|
2088
|
+
name: workspace.name,
|
|
2089
|
+
idleTimeLimit: workspace['idle-time-limit'],
|
|
2090
|
+
memoryLimit: workspace['memory-limit'],
|
|
2091
|
+
cpuLimit: workspace['cpu-limit']
|
|
2092
|
+
};
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
1979
2095
|
}),
|
|
1980
2096
|
getWorkspacePayModels: builder.query({
|
|
1981
|
-
query: ()=>`${
|
|
2097
|
+
query: ()=>`${GEN3_WORKSPACE_API}/allpaymodels`,
|
|
2098
|
+
providesTags: [
|
|
2099
|
+
'PayModel'
|
|
2100
|
+
],
|
|
2101
|
+
transformResponse: (response)=>{
|
|
2102
|
+
return {
|
|
2103
|
+
currentPayModel: response.current_pay_model,
|
|
2104
|
+
allPayModels: response.all_pay_models,
|
|
2105
|
+
noPayModel: false
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2108
|
+
}),
|
|
2109
|
+
getActivePayModel: builder.query({
|
|
2110
|
+
query: ()=>`${GEN3_WORKSPACE_API}/paymodels`,
|
|
2111
|
+
providesTags: [
|
|
2112
|
+
'PayModel'
|
|
2113
|
+
]
|
|
2114
|
+
}),
|
|
2115
|
+
setCurrentPayModel: builder.mutation({
|
|
2116
|
+
query: (id)=>({
|
|
2117
|
+
url: `${GEN3_WORKSPACE_API}/setpaymodel`,
|
|
2118
|
+
method: 'POST',
|
|
2119
|
+
body: id,
|
|
2120
|
+
invalidatesTags: [
|
|
2121
|
+
'PayModel'
|
|
2122
|
+
]
|
|
2123
|
+
})
|
|
1982
2124
|
}),
|
|
1983
2125
|
getWorkspaceStatus: builder.query({
|
|
1984
|
-
|
|
2126
|
+
queryFn: async (_arg0, queryApi, _extraOptions, fetchWithBQ)=>{
|
|
2127
|
+
const currentWorkspaceStatus = selectActiveWorkspaceStatus(queryApi.getState());
|
|
2128
|
+
const workspaceStatus = await fetchWithBQ(`${GEN3_WORKSPACE_API}/status`);
|
|
2129
|
+
if (workspaceStatus.error) {
|
|
2130
|
+
return workspaceStatus;
|
|
2131
|
+
}
|
|
2132
|
+
// TODO: try to find out IF this is code is required
|
|
2133
|
+
const workspaceStatusData = workspaceStatus.data;
|
|
2134
|
+
if (workspaceStatusData.status === WorkspaceStatus.Running && (currentWorkspaceStatus === 'Not Found' || currentWorkspaceStatus === 'Launching')) {
|
|
2135
|
+
const proxyStatus = await fetchWithBQ(`${GEN3_WORKSPACE_API}/proxy/`);
|
|
2136
|
+
let statusError = undefined;
|
|
2137
|
+
if (isFetchParseError(proxyStatus.error)) {
|
|
2138
|
+
statusError = proxyStatus.error.originalStatus;
|
|
2139
|
+
}
|
|
2140
|
+
if (isHttpStatusError(proxyStatus.error)) {
|
|
2141
|
+
statusError = proxyStatus.error.status;
|
|
2142
|
+
}
|
|
2143
|
+
if (statusError && statusError !== 200) {
|
|
2144
|
+
return {
|
|
2145
|
+
data: {
|
|
2146
|
+
...workspaceStatusData,
|
|
2147
|
+
status: WorkspaceStatus.Launching,
|
|
2148
|
+
conditions: [
|
|
2149
|
+
{
|
|
2150
|
+
type: 'ProxyConnected',
|
|
2151
|
+
status: PodStatus.False
|
|
2152
|
+
}
|
|
2153
|
+
]
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
return {
|
|
2159
|
+
data: workspaceStatus.data
|
|
2160
|
+
};
|
|
2161
|
+
},
|
|
2162
|
+
providesTags: [
|
|
2163
|
+
'Workspace'
|
|
2164
|
+
]
|
|
2165
|
+
}),
|
|
2166
|
+
launchWorkspace: builder.mutation({
|
|
2167
|
+
query: (id)=>{
|
|
2168
|
+
return {
|
|
2169
|
+
url: `${GEN3_WORKSPACE_API}/launch?id=${id}`,
|
|
2170
|
+
method: 'POST',
|
|
2171
|
+
invalidatesTags: [
|
|
2172
|
+
'Workspace'
|
|
2173
|
+
],
|
|
2174
|
+
responseHandler: (response)=>response.text()
|
|
2175
|
+
};
|
|
2176
|
+
},
|
|
2177
|
+
transformResponse: async (response)=>{
|
|
2178
|
+
return !!(response && response === 'Success');
|
|
2179
|
+
}
|
|
2180
|
+
}),
|
|
2181
|
+
terminateWorkspace: builder.mutation({
|
|
2182
|
+
query: ()=>({
|
|
2183
|
+
url: `${GEN3_WORKSPACE_API}/terminate`,
|
|
2184
|
+
method: 'POST',
|
|
2185
|
+
invalidatesTags: [
|
|
2186
|
+
'Workspace'
|
|
2187
|
+
],
|
|
2188
|
+
responseHandler: (response)=>response.text()
|
|
2189
|
+
})
|
|
1985
2190
|
})
|
|
1986
2191
|
})
|
|
1987
2192
|
});
|
|
1988
|
-
const { useGetWorkspaceOptionsQuery, useGetWorkspacePayModelsQuery, useGetWorkspaceStatusQuery } = workspacesApi;
|
|
2193
|
+
const { useGetWorkspaceOptionsQuery, useGetWorkspacePayModelsQuery, useGetWorkspaceStatusQuery, useGetActivePayModelQuery, useSetCurrentPayModelMutation, useLaunchWorkspaceMutation, useTerminateWorkspaceMutation } = workspacesApi;
|
|
2194
|
+
const workspaceStatusSelector = workspacesApi.endpoints.getWorkspaceStatus.select();
|
|
2195
|
+
const selectWorkspaceStatusFromService = createSelector(workspaceStatusSelector, (status)=>status.data ?? {
|
|
2196
|
+
...EmptyWorkspaceStatusResponse
|
|
2197
|
+
});
|
|
2198
|
+
const selectWorkspaceStatus = createSelector(workspaceStatusSelector, (status)=>status?.data?.status ?? WorkspaceStatus.NotFound);
|
|
2199
|
+
|
|
2200
|
+
const isWorkspaceActive = (status)=>status === WorkspaceStatus.Running || status === WorkspaceStatus.Launching || status === WorkspaceStatus.Terminating;
|
|
2201
|
+
const isWorkspaceRunningOrStopping = (status)=>status === WorkspaceStatus.Running || status === WorkspaceStatus.Terminating;
|
|
1989
2202
|
|
|
1990
2203
|
const resourcePathFromProjectID = (projectID)=>{
|
|
1991
2204
|
const split = projectID.split('-');
|
|
@@ -2195,5 +2408,36 @@ const SubmissionGraphqlQuery = `query transactionList {
|
|
|
2195
2408
|
});
|
|
2196
2409
|
const { useGetProjectsQuery, useGetSubmissionGraphQLQuery, useGetProjectsDetailsQuery, useLazyGetProjectsQuery, useLazyGetSubmissionGraphQLQuery, useGetSubmissionsQuery, useGetDictionaryQuery } = submissionApi;
|
|
2197
2410
|
|
|
2198
|
-
|
|
2411
|
+
/**
|
|
2412
|
+
* Creates a loadingStatusApi for checking the status of a sower data download job
|
|
2413
|
+
* @param getJobList Shows the list of jobs currently running
|
|
2414
|
+
* @see https://petstore.swagger.io/?url=https://raw.githubusercontent.com/uc-cdis/sower/master/openapis/openapi.yaml#/sower/list
|
|
2415
|
+
* @param getDownloadStatus Shows the status of a selected job
|
|
2416
|
+
* @returns: A sower job response dict which returns job information of file downloads
|
|
2417
|
+
*/ const loadingStatusApi = gen3Api.injectEndpoints({
|
|
2418
|
+
endpoints: (builder)=>({
|
|
2419
|
+
getSowerJobList: builder.query({
|
|
2420
|
+
query: ()=>`${GEN3_SOWER_API}/list`
|
|
2421
|
+
}),
|
|
2422
|
+
submitSowerJob: builder.mutation({
|
|
2423
|
+
query: (params)=>({
|
|
2424
|
+
url: `${GEN3_SOWER_API}/dispatch`,
|
|
2425
|
+
method: 'POST',
|
|
2426
|
+
body: params
|
|
2427
|
+
})
|
|
2428
|
+
}),
|
|
2429
|
+
getSowerJobStatus: builder.query({
|
|
2430
|
+
query: (uid)=>`${GEN3_SOWER_API}/status?UID=${uid}`
|
|
2431
|
+
}),
|
|
2432
|
+
getSowerOutput: builder.query({
|
|
2433
|
+
query: (uid)=>`${GEN3_SOWER_API}/output?UID=${uid}`
|
|
2434
|
+
}),
|
|
2435
|
+
getSowerServiceStatus: builder.query({
|
|
2436
|
+
query: ()=>`${GEN3_SOWER_API}/_status`
|
|
2437
|
+
})
|
|
2438
|
+
})
|
|
2439
|
+
});
|
|
2440
|
+
const { useGetSowerJobListQuery, useLazyGetSowerJobListQuery, useSubmitSowerJobMutation, useGetSowerJobStatusQuery, useGetSowerOutputQuery, useGetSowerServiceStatusQuery } = loadingStatusApi;
|
|
2441
|
+
|
|
2442
|
+
export { Accessibility, CoreProvider, EmptyWorkspaceStatusResponse, GEN3_API, GEN3_AUTHZ_API, GEN3_COMMONS_NAME, GEN3_CROSSWALK_API, GEN3_DOMAIN, GEN3_DOWNLOADS_ENDPOINT, GEN3_FENCE_API, GEN3_GUPPY_API, GEN3_MDS_API, GEN3_REDIRECT_URL, GEN3_SOWER_API, GEN3_SUBMISSION_API, GEN3_WORKSPACE_API, Modals, PodConditionType, PodStatus, WorkspaceStatus, clearActiveWorkspaceId, clearCohortFilters, cohortReducer, convertFilterSetToGqlFilter, coreStore, createAppApiForRTKQ, createAppStore, createGen3App, createGen3AppWithOwnStore, createUseCoreDataHook, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, drsHostnamesReducer, extractEnumFilterValue, extractFieldNameFromFullFieldName, extractFilterValue, extractIndexAndFieldNameFromFullFieldName, extractIndexFromFullFieldName, fetchFence, fetchJson, fetchUserState, fieldNameToTitle, gen3Api, getGen3AppId, graphQLAPI, graphQLWithTags, guppyAPISliceMiddleware, guppyApi, guppyApiReducer, guppyApiSliceReducerPath, handleOperation, hideModal, isAuthenticated, isErrorWithMessage, isFetchBaseQueryError, isFetchParseError, isFilterEmpty, isGuppyAggregationData, isHistogramData, isHistogramDataAArray, isHistogramDataAnEnum, isHistogramDataArray, isHistogramDataArrayARange, isHistogramDataArrayAnEnum, isHistogramDataCollection, isHistogramRangeData, isHttpStatusError, isJSONObject, isJSONValue, isJSONValueArray, isOperationWithField, isPending, isProgramUrl, isRootUrl, isWorkspaceActive, isWorkspaceRunningOrStopping, listifyMethodsFromMapping, logoutFence, prependIndexToFieldName, projectCodeFromResourcePath, rawDataQueryStrForEachField, removeCohortFilter, resetUserState, resourcePathFromProjectID, selectActiveWorkspaceId, selectActiveWorkspaceStatus, selectAuthzMappingData, selectCSRFToken, selectCSRFTokenData, selectCohortFilters, selectCurrentCohort, selectCurrentCohortId, selectCurrentCohortName, selectCurrentMessage, selectCurrentModal, selectGen3AppByName, selectGen3AppMetadataByName, selectHeadersWithCSRFToken, selectIndexFilters, selectIndexedFilterByName, selectRequestedWorkspaceStatus, selectUser, selectUserAuthStatus, selectUserData, selectUserDetails, selectUserLoginStatus, selectWorkspaceStatus, selectWorkspaceStatusFromService, setActiveWorkspace, setActiveWorkspaceId, setActiveWorkspaceStatus, setCohortFilter, setDRSHostnames, setRequestedWorkspaceStatus, showModal, submissionApi, trimFirstFieldNameToTitle, updateCohortFilter, useAddNewCredentialMutation, useAskQuestionMutation, useAuthorizeFromCredentialsMutation, useCoreDispatch, useCoreSelector, useDownloadFromGuppyMutation, useFetchUserDetailsQuery, useGeneralGQLQuery, useGetAISearchStatusQuery, useGetAISearchVersionQuery, useGetAccessibleDataQuery, useGetActivePayModelQuery, useGetAggMDSQuery, useGetAggsQuery, useGetAllFieldsForTypeQuery, useGetArrayTypes, useGetAuthzMappingsQuery, useGetCSRFQuery, useGetCountsQuery, useGetCredentialsQuery, useGetCrosswalkDataQuery, useGetDataQuery, useGetDictionaryQuery, useGetExternalLoginsQuery, useGetFieldCountSummaryQuery, useGetFieldsForIndexQuery, useGetIndexAggMDSQuery, useGetIndexFields, useGetJWKKeysQuery, useGetLoginProvidersQuery, useGetMDSQuery, useGetProjectsDetailsQuery, useGetProjectsQuery, useGetRawDataAndTotalCountsQuery, useGetSowerJobListQuery, useGetSowerJobStatusQuery, useGetSowerOutputQuery, useGetSowerServiceStatusQuery, useGetStatus, useGetSubAggsQuery, useGetSubmissionGraphQLQuery, useGetSubmissionsQuery, useGetTagsQuery, useGetWorkspaceOptionsQuery, useGetWorkspacePayModelsQuery, useGetWorkspaceStatusQuery, useGraphQLQuery, useIsExternalConnectedQuery, useIsUserLoggedIn, useLaunchWorkspaceMutation, useLazyFetchUserDetailsQuery, useLazyGeneralGQLQuery, useLazyGetAggsQuery, useLazyGetCrosswalkDataQuery, useLazyGetExternalLoginsQuery, useLazyGetProjectsQuery, useLazyGetSowerJobListQuery, useLazyGetSubmissionGraphQLQuery, useLazyIsExternalConnectedQuery, usePrevious, useRemoveCredentialMutation, useSetCurrentPayModelMutation, useSubmitSowerJobMutation, useTerminateWorkspaceMutation, useUser, useUserAuth, userHasCreateOrUpdateOnAnyProject, userHasDataUpload, userHasMethodForServiceOnProject, userHasMethodForServiceOnResource, userHasMethodOnAnyProject, userHasSheepdogProgramAdmin, userHasSheepdogProjectAdmin };
|
|
2199
2443
|
//# sourceMappingURL=index.js.map
|