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

#55 => done

parent d72360fb
Pipeline #4910 passed with stages
in 10 minutes and 48 seconds
......@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Added
- #53: Authentication is optional (environment: authenticationEnabled)
- #54: Administrator can select dataset data_path via a file explorer
- #55: Add image renderer configuration
### Changed
- #52: Update dependencies (Angular v11, ngrx v11, ...)
......
......@@ -11,6 +11,7 @@ import { TrResultComponent } from './result/tr-result.component';
import { DetailRendererComponent } from './result/renderer/detail-renderer.component';
import { LinkRendererComponent } from './result/renderer/link-renderer.component';
import { DownloadRendererComponent } from './result/renderer/download-renderer.component';
import { ImageRendererComponent } from './result/renderer/image-renderer.component';
import { TableDetailComponent } from './detail/table-detail.component';
import { TrDetailComponent } from './detail/tr-detail.component';
import { TableVoComponent } from './vo/table-vo.component';
......@@ -36,6 +37,7 @@ export const attributeDummiesComponents = [
DetailRendererComponent,
LinkRendererComponent,
DownloadRendererComponent,
ImageRendererComponent,
TableDetailComponent,
TrDetailComponent,
TableVoComponent,
......
<div class="form-group row align-items-center">
<label for="{{id}}_type" class="col-md-5 col-sm-12 col-form-label">Type:</label>
<div class="col-md-7 col-sm-12">
<select class="form-control" name="{{id}}_type" id="{{id}}_type" [formControl]="rendererConfig.controls.type">
<option></option>
<option value="fits">Fits</option>
<option value="link">Link</option>
</select>
</div>
</div>
<div class="form-group row align-items-center">
<label for="{{id}}_display" class="col-md-5 col-sm-12 col-form-label">Display:</label>
<div class="col-md-7 col-sm-12">
<select class="form-control" name="{{id}}_display" id="{{id}}_display" [formControl]="rendererConfig.controls.display">
<option></option>
<option value="modal">Modal</option>
<option value="mini">Mini</option>
<option value="full">Full</option>
</select>
</div>
</div>
<div *ngIf="rendererConfig.controls.display.value === 'mini'" class="form-group row align-items-center">
<label for="{{id}}_width" class="col-md-5 col-sm-12 col-form-label">Width:</label>
<div class="col-md-7 col-sm-12">
<input type="string" class="form-control" id="{{id}}_width" name="{{id}}_width" [formControl]="rendererConfig.controls.width">
</div>
</div>
<div *ngIf="rendererConfig.controls.display.value === 'mini'" class="form-group row align-items-center">
<label for="{{id}}_height" class="col-md-5 col-sm-12 col-form-label">Height:</label>
<div class="col-md-7 col-sm-12">
<input type="string" class="form-control" id="{{id}}_height" name="{{id}}_height" [formControl]="rendererConfig.controls.height">
</div>
</div>
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { FormGroup } from '@angular/forms';
@Component({
selector: 'app-image-renderer',
templateUrl: 'image-renderer.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ImageRendererComponent {
@Input() id: number;
@Input() rendererConfig: FormGroup;
}
\ No newline at end of file
......@@ -14,6 +14,7 @@
<app-detail-renderer *ngSwitchCase="'detail'" [id]="_attribute.id" [rendererConfig]="getRendererConfigFormGroup()"></app-detail-renderer>
<app-link-renderer *ngSwitchCase="'link'" [id]="_attribute.id" [rendererConfig]="getRendererConfigFormGroup()"></app-link-renderer>
<app-download-renderer *ngSwitchCase="'download'" [id]="_attribute.id" [rendererConfig]="getRendererConfigFormGroup()"></app-download-renderer>
<app-image-renderer *ngSwitchCase="'image'" [id]="_attribute.id" [rendererConfig]="getRendererConfigFormGroup()"></app-image-renderer>
</ng-container>
</td>
<td>
......
......@@ -33,6 +33,9 @@ export class FormDatasetComponent {
openModal(template: TemplateRef<any>) {
this.fileExplorerPristine = true;
this.fileExplorerPath = this.ngForm.controls['data_path'].value;
if (!this.fileExplorerPath) {
this.fileExplorerPath = '';
}
this.modalRef = this.modalService.show(template);
this.loadDirectoryInfo.emit(this.fileExplorerPath);
}
......
......@@ -25,6 +25,10 @@
[tableList]="tableList | async"
[datasetFamilyList]="datasetFamilyList | async"
[idDatasetFamilyQueryParam]="idDatasetFamilyQueryParam | async"
[directoryInfo]="directoryInfo | async"
[directoryInfoIsLoading]="directoryInfoIsLoading | async"
[directoryInfoIsLoaded]="directoryInfoIsLoaded | async"
(loadDirectoryInfo)="loadDirectoryInfo($event)"
(changeProject)="loadTableList($event)"
(submitted)="addNewDataset($event)"
#formDataset>
......
......@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
import { Project, DatasetFamily, Dataset } from '../../store/model';
import { Project, DatasetFamily, Dataset, FileInfo } from '../../store/model';
import * as projectActions from '../../store/action/project.action';
import * as projectSelector from '../../store/selector/project.selector';
import * as databaseActions from '../../store/action/database.action';
......@@ -10,6 +10,8 @@ import * as databaseSelector from '../../store/selector/database.selector';
import * as datasetFamilyActions from '../../store/action/dataset-family.action';
import * as datasetFamilySelector from '../../store/selector/dataset-family.selector';
import * as datasetActions from '../../store/action/dataset.action';
import * as fileExplorerAction from '../../store/action/file-explorer.action';
import * as fileExplorerSelector from '../../store/selector/file-explorer.selector';
import * as instanceSelector from '../../store/selector/instance.selector';
import * as metamodelReducer from '../../store/reducer';
......@@ -29,6 +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>;
constructor(private store: Store<metamodelReducer.State>) {
this.instanceSelected = store.select(instanceSelector.getInstanceSelected);
......@@ -42,6 +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);
}
ngOnInit() {
......@@ -52,6 +60,10 @@ export class NewDatasetComponent implements OnInit {
loadTableList(idDatabase: number) {
this.store.dispatch(new databaseActions.LoadTableListAction(idDatabase));
}
loadDirectoryInfo(path: string) {
this.store.dispatch(new fileExplorerAction.LoadDirectoryInfoAction(path));
}
addNewDataset(dataset: Dataset) {
this.store.dispatch(new datasetActions.AddNewDatasetAction(dataset));
......
import { RendererConfig } from './renderer-config.model';
export interface ImageRendererConfig extends RendererConfig {
type: string;
display: string;
width: string;
height: string;
}
\ No newline at end of file
export * from './renderer-config.model';
export * from './detail-renderer-config.model';
export * from './link-renderer-config.model';
export * from './download-renderer-config.model';
\ No newline at end of file
export * from './download-renderer-config.model';
export * from './image-renderer-config.model';
\ No newline at end of file
import { RendererConfig, DetailRendererConfig, LinkRendererConfig, DownloadRendererConfig } from './index';
import { RendererConfig, DetailRendererConfig, LinkRendererConfig, DownloadRendererConfig, ImageRendererConfig } from './index';
export abstract class RendererConfigFactory {
static create(renderer: string): RendererConfig {
......@@ -22,6 +22,13 @@ export abstract class RendererConfigFactory {
text: 'DOWNLOAD',
icon: 'fas fa-download'
} as DownloadRendererConfig;
case 'image':
return {
type: 'fits',
display: 'modal',
width: '',
height: ''
} as ImageRendererConfig
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment