Fix progress-bar for dmp editor. Fix table of contents in creation of DMP. On save of new dmp, change location instead of route.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-31 16:38:20 +03:00
parent 634d49ea35
commit a4555f7303
3 changed files with 15 additions and 6 deletions

View File

@ -1355,7 +1355,8 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
reloadDateset(datasetId: string) { reloadDateset(datasetId: string) {
this.router.navigate(['/datasets', 'edit', datasetId]); let url = this.router.createUrlTree(['/datasets', 'edit', datasetId]).toString();
this.location.go(url);
} }
backToDmp(id: string) { backToDmp(id: string) {

View File

@ -48,7 +48,7 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
this.total = this.countFormControlsRequiredFieldsForTotal(this.formGroup); this.total = this.countFormControlsRequiredFieldsForTotal(this.formGroup);
} else if (this.isDatasetEditor) { } else if (this.isDatasetEditor) {
this.progressSoFar = this.countFormControlsValidForProgress(this.formGroup) + this.countFormControlsWithValueForProgress(this.formGroup); this.progressSoFar = this.countFormControlsValidForProgress(this.formGroup) + this.countFormControlsWithValueForProgress(this.formGroup);
this.total = this.countFormControlsRequiredFieldsForTotal(this.formGroup) + this.CountFormControlDepthLengthFotTotal(this.formGroup); this.total = this.countFormControlsRequiredFieldsForTotal(this.formGroup, true) + this.CountFormControlDepthLengthFotTotal(this.formGroup);
} else { } else {
this.progressSoFar = this.countFormControlsWithValueForProgress(this.formGroup); this.progressSoFar = this.countFormControlsWithValueForProgress(this.formGroup);
this.total = this.CountFormControlDepthLengthFotTotal(this.formGroup); this.total = this.CountFormControlDepthLengthFotTotal(this.formGroup);
@ -169,14 +169,14 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
return valueCurrent; return valueCurrent;
} }
countFormControlsRequiredFieldsForTotal(formControl: AbstractControl): number { countFormControlsRequiredFieldsForTotal(formControl: AbstractControl, checkVisibility = false): number {
let valueCurrent = 0; let valueCurrent = 0;
if (formControl instanceof FormControl) { if (formControl instanceof FormControl) {
if (this.controlRequired(formControl) && this.controlEnabled(formControl)) { if (this.controlRequired(formControl) && this.controlEnabled(formControl)) {
valueCurrent++; valueCurrent++;
} }
} else if (formControl instanceof FormGroup) { } else if (formControl instanceof FormGroup) {
if(!formControl.get('id')?.value || this.visibilityRulesService.checkElementVisibility(formControl.get('id').value)) { if(!checkVisibility || (!formControl.get('id')?.value || this.visibilityRulesService.checkElementVisibility(formControl.get('id').value))) {
Object.keys(formControl.controls).forEach(item => { Object.keys(formControl.controls).forEach(item => {
const control = formControl.get(item); const control = formControl.get(item);
valueCurrent = valueCurrent + this.countFormControlsRequiredFieldsForTotal(control); valueCurrent = valueCurrent + this.countFormControlsRequiredFieldsForTotal(control);

View File

@ -57,6 +57,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
@Input() selectedFieldsetId:string; @Input() selectedFieldsetId:string;
private _tocentrySelected:ToCEntry = null; private _tocentrySelected:ToCEntry = null;
private isSelecting: boolean = false;
private _intersectionObserver: IntersectionObserver; private _intersectionObserver: IntersectionObserver;
private _actOnObservation: boolean = true; private _actOnObservation: boolean = true;
public hiddenEntries:string[] = []; public hiddenEntries:string[] = [];
@ -442,8 +443,14 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
} }
onToCentrySelected(entry: ToCEntry = null, execute: boolean = true){ onToCentrySelected(entry: ToCEntry = null, execute: boolean = true){
if(!this.isSelecting) {
this.isSelecting = true;
this.tocentrySelected = entry; this.tocentrySelected = entry;
this.entrySelected.emit({entry: entry, execute: execute}); this.entrySelected.emit({entry: entry, execute: execute});
setTimeout(() => {
this.isSelecting = false;
}, 200);
}
} }
private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry{ private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry{
@ -496,6 +503,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
return this.tocentries.some(e => this.internalTable.invalidChildsVisible(e)); return this.tocentries.some(e => this.internalTable.invalidChildsVisible(e));
} }
protected readonly console = console;
} }
export interface LinkToScroll { export interface LinkToScroll {