Commit 9e22b2af authored by François Agneray's avatar François Agneray
Browse files

Add retrieveDatasetDirectoryInfo

parent 01b12a7e
......@@ -197,7 +197,7 @@
<h4 class="modal-title pull-left">ANIS file explorer</h4>
</div>
<div>
<div *ngIf="directoryInfoIsLoading" class="row justify-content-center mt-5">
<div *ngIf="rootDirectoryInfoIsLoading" class="row justify-content-center mt-5">
<span class="fas fa-circle-notch fa-spin fa-3x"></span>
<span class="sr-only">Loading...</span>
</div>
......@@ -206,7 +206,7 @@
<i class="far fa-folder"></i>
{{ fileExplorerPath }}
</p>
<div *ngIf="directoryInfoIsLoaded" class="table-responsive">
<div *ngIf="rootDirectoryInfoIsLoaded" class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
......@@ -217,7 +217,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let fileInfo of directoryInfo" (click)="dataPathAction(fileInfo)" [class.cursor-pointer]="fileInfo.type === 'dir' && fileInfo.name !== '.'">
<tr *ngFor="let fileInfo of rootDirectoryInfo" (click)="dataPathAction(fileInfo)" [class.cursor-pointer]="fileInfo.type === 'dir' && fileInfo.name !== '.'">
<td>
<span *ngIf="fileInfo.type === 'dir'"><i class="far fa-folder"></i></span>
<span *ngIf="fileInfo.type === 'file'"><i class="far fa-file"></i></span>
......@@ -244,7 +244,7 @@
<h4 class="modal-title pull-left">Add an image</h4>
</div>
<div>
<div *ngIf="directoryInfoIsLoading" class="row justify-content-center mt-5">
<div *ngIf="datasetDirectoryInfoIsLoading" class="row justify-content-center mt-5">
<span class="fas fa-circle-notch fa-spin fa-3x"></span>
<span class="sr-only">Loading...</span>
</div>
......@@ -253,7 +253,7 @@
<i class="far fa-folder"></i>
{{ fileExplorerPath }}
</p>
<div *ngIf="directoryInfoIsLoaded" class="table-responsive">
<div *ngIf="datasetDirectoryInfoIsLoaded" class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
......@@ -264,7 +264,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let fileInfo of directoryInfo"
<tr *ngFor="let fileInfo of datasetDirectoryInfo"
(click)="newImageAction(fileInfo)"
[class.table-active]="fileInfo === imageSelected && imageLimitIsLoaded"
[class.cursor-pointer]="fileInfo.name !== '.'">
......@@ -283,7 +283,6 @@
</div>
</div>
<div class="modal-footer">
{{ imageLimitIsLoading }}
<button (click)="modalRef.hide()" class="btn btn-danger">Cancel</button>
&nbsp;
<button [disabled]="!imageSelected || !imageLimitIsLoaded" (click)="selectImage()" class="btn btn-primary">
......
......@@ -19,20 +19,26 @@ export class FormDatasetComponent implements OnChanges {
@Input() tableList: string[];
@Input() datasetFamilyList: DatasetFamily[];
@Input() idDatasetFamilyQueryParam: number = 0;
@Input() directoryInfo: FileInfo[];
@Input() directoryInfoIsLoading: boolean;
@Input() directoryInfoIsLoaded: boolean;
@Input() rootDirectoryInfo: FileInfo[];
@Input() rootDirectoryInfoIsLoading: boolean;
@Input() rootDirectoryInfoIsLoaded: boolean;
@Input() datasetDirectoryInfo: FileInfo[];
@Input() datasetDirectoryInfoIsLoading: boolean;
@Input() datasetDirectoryInfoIsLoaded: boolean;
@Input() imageLimitIsLoading: boolean;
@Input() imageLimitIsLoaded: boolean;
@Input() imageLimit: ImageLimit;
@Output() changeSurvey: EventEmitter<number> = new EventEmitter();
@Output() loadDirectoryInfo: EventEmitter<string> = new EventEmitter();
@Output() loadRootDirectoryInfo: EventEmitter<string> = new EventEmitter();
@Output() loadDatasetDirectoryInfo: EventEmitter<string> = new EventEmitter();
@Output() loadFitsImageLimits: EventEmitter<string> = new EventEmitter();
@Output() submitted: EventEmitter<Dataset> = new EventEmitter();
modalRef: BsModalRef;
dataPathFileExplorerPristine = true;
fileExplorerPath = '';
datasetFileExplorerPath = '';
imageSelected = null;
datasetImages = [];
......@@ -49,7 +55,7 @@ export class FormDatasetComponent implements OnChanges {
this.fileExplorerPath = '';
}
this.modalRef = this.modalService.show(template);
this.loadDirectoryInfo.emit(this.fileExplorerPath);
this.loadRootDirectoryInfo.emit(this.fileExplorerPath);
}
dataPathAction(fileInfo: FileInfo): void {
......@@ -63,13 +69,19 @@ export class FormDatasetComponent implements OnChanges {
this.fileExplorerPath += '/' + fileInfo.name;
}
this.dataPathFileExplorerPristine = false;
this.loadDirectoryInfo.emit(this.fileExplorerPath);
this.loadRootDirectoryInfo.emit(this.fileExplorerPath);
}
selectDirectory() {
this.ngForm.controls['data_path'].setValue(this.fileExplorerPath);
this.ngForm.controls['data_path'].markAsDirty();
this.modalRef.hide();
}
newImageOpenModal(template: TemplateRef<any>): void {
this.fileExplorerPath = this.ngForm.controls['data_path'].value;
this.imageSelected = null;
this.modalRef = this.modalService.show(template);
this.loadDirectoryInfo.emit(this.fileExplorerPath);
this.loadDatasetDirectoryInfo.emit(this.datasetFileExplorerPath);
}
newImageAction(fileInfo: FileInfo): void {
......@@ -78,36 +90,32 @@ export class FormDatasetComponent implements OnChanges {
}
if (fileInfo.type === 'file' && fileInfo.mimetype === 'image/fits') {
this.loadFitsImageLimits.emit(fileInfo.name);
this.loadFitsImageLimits.emit(this.datasetFileExplorerPath + '/' + fileInfo.name);
this.imageSelected = fileInfo;
} else {
if (fileInfo.name === '..') {
this.fileExplorerPath = this.fileExplorerPath.substr(0, this.fileExplorerPath.lastIndexOf("/"));
this.datasetFileExplorerPath = this.datasetFileExplorerPath.substr(0, this.datasetFileExplorerPath.lastIndexOf("/"));
} else {
this.fileExplorerPath += '/' + fileInfo.name;
this.datasetFileExplorerPath += '/' + fileInfo.name;
}
this.imageSelected = null;
this.loadDirectoryInfo.emit(this.fileExplorerPath);
this.loadDatasetDirectoryInfo.emit(this.datasetFileExplorerPath);
}
}
selectImage(): void {
this.datasetImages.push({ ...this.imageSelected, ...this.imageLimit });
const name = this.datasetFileExplorerPath + '/' + this.imageSelected.name;
this.datasetImages.push({ name, size: this.imageSelected.size, ...this.imageLimit });
this.modalRef.hide();
this.ngForm.controls['data_path'].markAsDirty();
}
deleteImage(image): void {
this.datasetImages = this.datasetImages.filter(i => i.name !== image.name);
}
selectDirectory() {
this.ngForm.controls['data_path'].setValue(this.fileExplorerPath);
this.ngForm.controls['data_path'].markAsDirty();
this.modalRef.hide();
}
isConeSearchDisabled() {
isConeSearchDisabled(): boolean {
return (!this.model.name) ? true : false;
}
......
......@@ -23,12 +23,23 @@
<div *ngIf="(datasetFamilyListIsLoaded | async) && (datasetListIsLoaded | async) && (attributeListIsLoaded | async)">
<div class="row">
<div class="col">
<app-form-dataset [model]="dataset | async" [datasetFamilyList]="datasetFamilyList | async"
[directoryInfo]="directoryInfo | async" [directoryInfoIsLoading]="directoryInfoIsLoading | async"
[directoryInfoIsLoaded]="directoryInfoIsLoaded | async" [attributeList]="attributeList | async"
[imageLimit]="imageLimit | async" [imageLimitIsLoading]="imageLimitIsLoading | async"
[imageLimitIsLoaded]="imageLimitIsLoaded | async" (loadDirectoryInfo)="loadDirectoryInfo($event)"
(loadFitsImageLimits)="loadFitsImageLimits($event)" (submitted)="editDataset($event)" #formDataset>
<app-form-dataset [model]="dataset | async"
[datasetFamilyList]="datasetFamilyList | async"
[rootDirectoryInfo]="rootDirectoryInfo | async"
[rootDirectoryInfoIsLoading]="rootDirectoryInfoIsLoading | async"
[rootDirectoryInfoIsLoaded]="rootDirectoryInfoIsLoaded | async"
[datasetDirectoryInfo]="datasetDirectoryInfo | async"
[datasetDirectoryInfoIsLoading]="datasetDirectoryInfoIsLoading | async"
[datasetDirectoryInfoIsLoaded]="datasetDirectoryInfoIsLoaded | async"
[attributeList]="attributeList | async"
[imageLimit]="imageLimit | async"
[imageLimitIsLoading]="imageLimitIsLoading | async"
[imageLimitIsLoaded]="imageLimitIsLoaded | async"
(loadRootDirectoryInfo)="loadRootDirectoryInfo($event)"
(loadDatasetDirectoryInfo)="loadDatasetDirectoryInfo($event)"
(loadFitsImageLimits)="loadFitsImageLimits($event)"
(submitted)="editDataset($event)"
#formDataset>
<button [disabled]="!formDataset.ngForm.form.valid || formDataset.ngForm.form.pristine"
type="submit" class="btn btn-primary">
<i class="fa fa-database"></i> Update dataset information
......
......@@ -27,9 +27,12 @@ export class EditDatasetComponent implements OnInit {
public datasetListIsLoading: Observable<boolean>;
public datasetListIsLoaded: Observable<boolean>;
public dataset: Observable<Dataset>;
public directoryInfo: Observable<FileInfo[]>;
public directoryInfoIsLoading: Observable<boolean>;
public directoryInfoIsLoaded: Observable<boolean>;
public rootDirectoryInfo: Observable<FileInfo[]>;
public rootDirectoryInfoIsLoading: Observable<boolean>;
public rootDirectoryInfoIsLoaded: Observable<boolean>;
public datasetDirectoryInfo: Observable<FileInfo[]>;
public datasetDirectoryInfoIsLoading: Observable<boolean>;
public datasetDirectoryInfoIsLoaded: Observable<boolean>;
public attributeList: Observable<Attribute[]>;
public attributeListIsLoading: Observable<boolean>;
public attributeListIsLoaded: Observable<boolean>;
......@@ -46,9 +49,12 @@ export class EditDatasetComponent implements OnInit {
this.datasetListIsLoading = store.select(datasetSelector.getDatasetListIsLoading);
this.datasetListIsLoaded = store.select(datasetSelector.getDatasetListIsLoaded);
this.dataset = store.select(datasetSelector.getDatasetByRouteName);
this.directoryInfo = store.select(fileExplorerSelector.getDirectoryInfo);
this.directoryInfoIsLoading = store.select(fileExplorerSelector.getDirectoryInfoIsLoading);
this.directoryInfoIsLoaded = store.select(fileExplorerSelector.getDirectoryInfoIsLoaded);
this.rootDirectoryInfo = store.select(fileExplorerSelector.getRootDirectoryInfo);
this.rootDirectoryInfoIsLoading = store.select(fileExplorerSelector.getRootDirectoryInfoIsLoading);
this.rootDirectoryInfoIsLoaded = store.select(fileExplorerSelector.getRootDirectoryInfoIsLoaded);
this.datasetDirectoryInfo = store.select(fileExplorerSelector.getDatasetDirectoryInfo);
this.datasetDirectoryInfoIsLoading = store.select(fileExplorerSelector.getDatasetDirectoryInfoIsLoading);
this.datasetDirectoryInfoIsLoaded = store.select(fileExplorerSelector.getDatasetDirectoryInfoIsLoaded);
this.attributeList = store.select(attributeSelector.getAttributeList);
this.attributeListIsLoading = store.select(attributeSelector.getAttributeListIsLoading);
this.attributeListIsLoaded = store.select(attributeSelector.getAttributeListIsLoaded);
......@@ -63,8 +69,12 @@ export class EditDatasetComponent implements OnInit {
this.store.dispatch(new attributeActions.LoadAttributeListAction());
}
loadDirectoryInfo(path: string) {
this.store.dispatch(new fileExplorerAction.LoadDirectoryInfoAction(path));
loadRootDirectoryInfo(path: string) {
this.store.dispatch(new fileExplorerAction.LoadRootDirectoryInfoAction(path));
}
loadDatasetDirectoryInfo(path: string) {
this.store.dispatch(new fileExplorerAction.LoadDatasetDirectoryInfoAction(path));
}
loadFitsImageLimits(filename: string) {
......
......@@ -25,10 +25,10 @@
[tableList]="tableList | async"
[datasetFamilyList]="datasetFamilyList | async"
[idDatasetFamilyQueryParam]="idDatasetFamilyQueryParam | async"
[directoryInfo]="directoryInfo | async"
[directoryInfoIsLoading]="directoryInfoIsLoading | async"
[directoryInfoIsLoaded]="directoryInfoIsLoaded | async"
(loadDirectoryInfo)="loadDirectoryInfo($event)"
[rootDirectoryInfo]="rootDirectoryInfo | async"
[rootDirectoryInfoIsLoading]="rootDirectoryInfoIsLoading | async"
[rootDirectoryInfoIsLoaded]="rootDirectoryInfoIsLoaded | async"
(loadRootDirectoryInfo)="loadRootDirectoryInfo($event)"
(changeSurvey)="loadTableList($event)"
(submitted)="addNewDataset($event)"
#formDataset>
......
......@@ -31,9 +31,9 @@ export class NewDatasetComponent implements OnInit {
public datasetFamilyListIsLoaded: Observable<boolean>;
public datasetFamilyList: Observable<DatasetFamily[]>;
public idDatasetFamilyQueryParam: Observable<number>;
public directoryInfo: Observable<FileInfo[]>;
public directoryInfoIsLoading: Observable<boolean>;
public directoryInfoIsLoaded: Observable<boolean>;
public rootDirectoryInfo: Observable<FileInfo[]>;
public rootDirectoryInfoIsLoading: Observable<boolean>;
public rootDirectoryInfoIsLoaded: Observable<boolean>;
constructor(private store: Store<metamodelReducer.State>) {
this.instanceSelected = store.select(instanceSelector.getInstanceSelected);
......@@ -47,9 +47,9 @@ export class NewDatasetComponent implements OnInit {
this.datasetFamilyListIsLoaded = store.select(datasetFamilySelector.getDatasetFamilyListIsLoaded);
this.datasetFamilyList = store.select(datasetFamilySelector.getDatasetFamilyList);
this.idDatasetFamilyQueryParam = store.select(datasetFamilySelector.getIdDatasetFamilyQueryParam);
this.directoryInfo = store.select(fileExplorerSelector.getDirectoryInfo);
this.directoryInfoIsLoading = store.select(fileExplorerSelector.getDirectoryInfoIsLoading);
this.directoryInfoIsLoaded = store.select(fileExplorerSelector.getDirectoryInfoIsLoaded);
this.rootDirectoryInfo = store.select(fileExplorerSelector.getRootDirectoryInfo);
this.rootDirectoryInfoIsLoading = store.select(fileExplorerSelector.getRootDirectoryInfoIsLoading);
this.rootDirectoryInfoIsLoaded = store.select(fileExplorerSelector.getRootDirectoryInfoIsLoaded);
}
ngOnInit() {
......@@ -61,8 +61,8 @@ export class NewDatasetComponent implements OnInit {
this.store.dispatch(new databaseActions.LoadTableListAction(idDatabase));
}
loadDirectoryInfo(path: string) {
this.store.dispatch(new fileExplorerAction.LoadDirectoryInfoAction(path));
loadRootDirectoryInfo(path: string) {
this.store.dispatch(new fileExplorerAction.LoadRootDirectoryInfoAction(path));
}
addNewDataset(dataset: Dataset) {
......
......@@ -2,27 +2,48 @@ import { Action } from '@ngrx/store';
import { FileInfo, ImageLimit } from '../model';
export const LOAD_DIRECTORY_INFO = '[FileExplorer] Load Directory Info';
export const LOAD_DIRECTORY_INFO_SUCCESS = '[FileExplorer] Load Directory Info Success';
export const LOAD_DIRECTORY_INFO_FAIL = '[FileExplorer] Load Directory Info Fail';
export const LOAD_ROOT_DIRECTORY_INFO = '[FileExplorer] Load Root Directory Info';
export const LOAD_ROOT_DIRECTORY_INFO_SUCCESS = '[FileExplorer] Load Root Directory Info Success';
export const LOAD_ROOT_DIRECTORY_INFO_FAIL = '[FileExplorer] Load Root Directory Info Fail';
export const LOAD_DATASET_DIRECTORY_INFO = '[FileExplorer] Load Dataset Directory Info';
export const LOAD_DATASET_DIRECTORY_INFO_SUCCESS = '[FileExplorer] Load Dataset Directory Info Success';
export const LOAD_DATASET_DIRECTORY_INFO_FAIL = '[FileExplorer] Load Dataset Directory Info Fail';
export const LOAD_IMAGE_LIMIT = '[FileExplorer] Load Image Limit';
export const LOAD_IMAGE_LIMIT_SUCCESS = '[FileExplorer] Load Image Limit Success';
export const LOAD_IMAGE_LIMIT_FAIL = '[FileExplorer] Load Image Limit Fail';
export class LoadDirectoryInfoAction implements Action {
readonly type = LOAD_DIRECTORY_INFO;
export class LoadRootDirectoryInfoAction implements Action {
readonly type = LOAD_ROOT_DIRECTORY_INFO;
constructor(public payload: string) { }
}
export class LoadDirectoryInfoSuccessAction implements Action {
readonly type = LOAD_DIRECTORY_INFO_SUCCESS;
export class LoadRootDirectoryInfoSuccessAction implements Action {
readonly type = LOAD_ROOT_DIRECTORY_INFO_SUCCESS;
constructor(public payload: FileInfo[]) { }
}
export class LoadDirectoryInfoFailAction implements Action {
readonly type = LOAD_DIRECTORY_INFO_FAIL;
export class LoadRootDirectoryInfoFailAction implements Action {
readonly type = LOAD_ROOT_DIRECTORY_INFO_FAIL;
constructor(public payload: {} = null) { }
}
export class LoadDatasetDirectoryInfoAction implements Action {
readonly type = LOAD_DATASET_DIRECTORY_INFO;
constructor(public payload: string) { }
}
export class LoadDatasetDirectoryInfoSuccessAction implements Action {
readonly type = LOAD_DATASET_DIRECTORY_INFO_SUCCESS;
constructor(public payload: FileInfo[]) { }
}
export class LoadDatasetDirectoryInfoFailAction implements Action {
readonly type = LOAD_DATASET_DIRECTORY_INFO_FAIL;
constructor(public payload: {} = null) { }
}
......@@ -46,9 +67,12 @@ export class LoadImageLimitFail implements Action {
}
export type Actions
= LoadDirectoryInfoAction
| LoadDirectoryInfoSuccessAction
| LoadDirectoryInfoFailAction
= LoadRootDirectoryInfoAction
| LoadRootDirectoryInfoSuccessAction
| LoadRootDirectoryInfoFailAction
| LoadDatasetDirectoryInfoAction
| LoadDatasetDirectoryInfoSuccessAction
| LoadDatasetDirectoryInfoFailAction
| LoadImageLimit
| LoadImageLimitSuccess
| LoadImageLimitFail;
......@@ -21,20 +21,41 @@ export class FileExplorerEffects {
) { }
@Effect()
loadDirectoryInfoAction$ = this.actions$.pipe(
ofType(fileExplorerActions.LOAD_DIRECTORY_INFO),
switchMap((action: fileExplorerActions.LoadDirectoryInfoAction) => {
return this.fileExplorerService.retrieveDirectoryInfo(action.payload).pipe(
loadRootDirectoryInfoAction$ = this.actions$.pipe(
ofType(fileExplorerActions.LOAD_ROOT_DIRECTORY_INFO),
switchMap((action: fileExplorerActions.LoadRootDirectoryInfoAction) => {
return this.fileExplorerService.retrieveRootDirectoryInfo(action.payload).pipe(
map((directoryInfo: FileInfo[]) =>
new fileExplorerActions.LoadDirectoryInfoSuccessAction(directoryInfo)),
catchError(() => of(new fileExplorerActions.LoadDirectoryInfoFailAction()))
new fileExplorerActions.LoadRootDirectoryInfoSuccessAction(directoryInfo)),
catchError(() => of(new fileExplorerActions.LoadRootDirectoryInfoFailAction()))
)
})
);
@Effect({ dispatch: false })
loadDirectoryInfoFailedAction$ = this.actions$.pipe(
ofType(fileExplorerActions.LOAD_DIRECTORY_INFO_FAIL),
loadRootDirectoryInfoFailedAction$ = this.actions$.pipe(
ofType(fileExplorerActions.LOAD_ROOT_DIRECTORY_INFO_FAIL),
tap(_ => this.toastr.error('Loading Failed!', 'Directory info failed'))
);
@Effect()
loadDatasetDirectoryInfoAction$ = this.actions$.pipe(
ofType(fileExplorerActions.LOAD_DATASET_DIRECTORY_INFO),
withLatestFrom(this.store$),
switchMap(([action, state]) => {
const loadDatasetDirectoryInfoAction = action as fileExplorerActions.LoadDatasetDirectoryInfoAction;
const dname = state.router.state.params.dname;
return this.fileExplorerService.retrieveDatasetDirectoryInfo(dname, loadDatasetDirectoryInfoAction.payload).pipe(
map((directoryInfo: FileInfo[]) =>
new fileExplorerActions.LoadDatasetDirectoryInfoSuccessAction(directoryInfo)),
catchError(() => of(new fileExplorerActions.LoadDatasetDirectoryInfoFailAction()))
)
})
);
@Effect({ dispatch: false })
loadDatasetDirectoryInfoFailedAction$ = this.actions$.pipe(
ofType(fileExplorerActions.LOAD_DATASET_DIRECTORY_INFO_FAIL),
tap(_ => this.toastr.error('Loading Failed!', 'Directory info failed'))
);
......
import { FileInfo } from "./file-info.model";
export interface Image extends FileInfo {
export interface Image {
name: string;
size: number;
ra_min: number;
ra_max: number;
dec_min: number;
......
......@@ -3,18 +3,24 @@ import * as actions from '../action/file-explorer.action';
import { FileInfo, ImageLimit } from '../model';
export interface State {
directoryInfoIsLoading: boolean;
directoryInfoIsLoaded: boolean;
directoryInfo: FileInfo[];
rootDirectoryInfoIsLoading: boolean;
rootDirectoryInfoIsLoaded: boolean;
rootDirectoryInfo: FileInfo[];
datasetDirectoryInfoIsLoading: boolean;
datasetDirectoryInfoIsLoaded: boolean;
datasetDirectoryInfo: FileInfo[];
imageLimitIsLoading: boolean;
imageLimitIsLoaded: boolean;
imageLimit: ImageLimit;
}
const initialState: State = {
directoryInfoIsLoading: false,
directoryInfoIsLoaded: false,
directoryInfo: [],
rootDirectoryInfoIsLoading: false,
rootDirectoryInfoIsLoaded: false,
rootDirectoryInfo: [],
datasetDirectoryInfoIsLoading: false,
datasetDirectoryInfoIsLoaded: false,
datasetDirectoryInfo: [],
imageLimitIsLoading: false,
imageLimitIsLoaded: false,
imageLimit: null
......@@ -22,26 +28,48 @@ const initialState: State = {
export function reducer(state: State = initialState, action: actions.Actions): State {
switch (action.type) {
case actions.LOAD_DIRECTORY_INFO:
case actions.LOAD_ROOT_DIRECTORY_INFO:
return {
...state,
directoryInfoIsLoading: true,
directoryInfoIsLoaded: false,
directoryInfo: []
rootDirectoryInfoIsLoading: true,
rootDirectoryInfoIsLoaded: false,
rootDirectoryInfo: []
};
case actions.LOAD_DIRECTORY_INFO_SUCCESS:
case actions.LOAD_ROOT_DIRECTORY_INFO_SUCCESS:
return {
...state,
directoryInfo: action.payload,
directoryInfoIsLoading: false,
directoryInfoIsLoaded: true
rootDirectoryInfoIsLoading: false,
rootDirectoryInfoIsLoaded: true,
rootDirectoryInfo: action.payload
};
case actions.LOAD_DIRECTORY_INFO_FAIL:
case actions.LOAD_ROOT_DIRECTORY_INFO_FAIL:
return {
...state,
directoryInfoIsLoading: false
rootDirectoryInfoIsLoading: false
};
case actions.LOAD_DATASET_DIRECTORY_INFO:
return {
...state,
datasetDirectoryInfoIsLoading: true,
datasetDirectoryInfoIsLoaded: false,
datasetDirectoryInfo: []
};
case actions.LOAD_DATASET_DIRECTORY_INFO_SUCCESS:
return {
...state,
datasetDirectoryInfoIsLoading: false,
datasetDirectoryInfoIsLoaded: true,
datasetDirectoryInfo: action.payload
};
case actions.LOAD_DATASET_DIRECTORY_INFO_FAIL:
return {
...state,
datasetDirectoryInfoIsLoading: false
};
case actions.LOAD_IMAGE_LIMIT:
......@@ -71,9 +99,12 @@ export function reducer(state: State = initialState, action: actions.Actions): S
}
}
export const getDirectoryInfoIsLoading = (state: State) => state.directoryInfoIsLoading;
export const getDirectoryInfoIsLoaded = (state: State) => state.directoryInfoIsLoaded;
export const getDirectoryInfo = (state: State) => state.directoryInfo;
export const getRootDirectoryInfoIsLoading = (state: State) => state.rootDirectoryInfoIsLoading;
export const getRootDirectoryInfoIsLoaded = (state: State) => state.rootDirectoryInfoIsLoaded;
export const getRootDirectoryInfo = (state: State) => state.rootDirectoryInfo;
export const getDatasetDirectoryInfoIsLoading = (state: State) => state.datasetDirectoryInfoIsLoading;
export const getDatasetDirectoryInfoIsLoaded = (state: State) => state.datasetDirectoryInfoIsLoaded;
export const getDatasetDirectoryInfo = (state: State) => state.datasetDirectoryInfo;
export const getImageLimitIsLoading = (state: State) => state.imageLimitIsLoading;
export const getImageLimitIsLoaded = (state: State) => state.imageLimitIsLoaded;
export const getImageLimit = (state: State) => state.imageLimit;
......@@ -8,19 +8,34 @@ export const getFileExplorerState = createSelector(
(state: reducer.State) => state.fileExplorer
);
export const getDirectoryInfoIsLoading = createSelector(
export const getRootDirectoryInfoIsLoading = createSelector(
getFileExplorerState,
fileExplorer.getDirectoryInfoIsLoading
fileExplorer.getRootDirectoryInfoIsLoading
);
export const getDirectoryInfoIsLoaded = createSelector(
export const getRootDirectoryInfoIsLoaded = createSelector(
getFileExplorerState,
fileExplorer.getDirectoryInfoIsLoaded
fileExplorer.getRootDirectoryInfoIsLoaded
);
export const getDirectoryInfo = createSelector(
export const getRootDirectoryInfo = createSelector(
getFileExplorerState,
fileExplorer.getDirectoryInfo
fileExplorer.getRootDirectoryInfo
);
export const getDatasetDirectoryInfoIsLoading = createSelector(
getFileExplorerState,
fileExplorer.getDatasetDirectoryInfoIsLoading
);
export const getDatasetDirectoryInfoIsLoaded = createSelector(
getFileExplorerState,
fileExplorer.getDatasetDirectoryInfoIsLoaded
);
export const getDatasetDirectoryInfo = createSelector(
getFileExplorerState,
fileExplorer.getDatasetDirectoryInfo
);