User guide patch. Sorting available profiles in dmp editor. Portuguese on guide tour.

This commit is contained in:
Kristian Ntavidi 2021-04-07 19:19:22 +03:00
parent 037e246262
commit 14c7770ae9
16 changed files with 110 additions and 24 deletions

View File

@ -25,4 +25,7 @@
<app-notification *ngIf="!onlySplash"></app-notification> <app-notification *ngIf="!onlySplash"></app-notification>
<router-outlet *ngIf="onlySplash"></router-outlet> <router-outlet *ngIf="onlySplash"></router-outlet>
<ngx-guided-tour></ngx-guided-tour> <ngx-guided-tour
[skipText]="'DASHBOARD.TOUR-GUIDE.LEAVE-TOUR'| translate"
[nextText]="'DASHBOARD.TOUR-GUIDE.GOT-IT'| translate"
></ngx-guided-tour>

View File

@ -35,7 +35,10 @@ export class AvailableProfilesComponent extends BaseComponent implements OnInit
this.datasetService.getDatasetProfiles(profileRequestItem) this.datasetService.getDatasetProfiles(profileRequestItem)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.profiles = data;
const dataArray = data;
dataArray.sort((a,b)=> (a.label as string).localeCompare(b.label));
this.profiles = dataArray;
}); });
} }

View File

@ -14,7 +14,7 @@
<div class="profile-form"> <div class="profile-form">
<mat-form-field> <mat-form-field>
<mat-label>{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}</mat-label> <mat-label>{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}</mat-label>
<app-multiple-auto-complete placeholder="{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}" [hidePlaceholder]="true" required='true' [formControl]="formGroup.get('profiles')" [configuration]="profilesAutoCompleteConfiguration" (optionRemoved)="onRemoveTemplate($event)" (optionActionClicked)="onPreviewTemplate($event)"> <app-multiple-auto-complete placeholder="{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}" [hidePlaceholder]="true" required='true' [formControl]="formGroup.get('profiles')" [configuration]="profilesAutoCompleteConfiguration" (optionRemoved)="onRemoveTemplate($event)" (optionActionClicked)="onPreviewTemplate($event)" (optionSelected)="onOptionSelected()">
</app-multiple-auto-complete> </app-multiple-auto-complete>
<mat-error *ngIf="formGroup.get('profiles').hasError('backendError')"> <mat-error *ngIf="formGroup.get('profiles').hasError('backendError')">
{{formGroup.get('profiles').getError('backendError').message}}</mat-error> {{formGroup.get('profiles').getError('backendError').message}}</mat-error>

View File

@ -68,6 +68,17 @@ export class DatasetInfoComponent extends BaseComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
try{
const profiles = this.formGroup.get('profiles').value as {id:string, label:string}[];
profiles.sort((a,b)=>a.label.localeCompare(b.label));
}catch{
console.info('Could not sort profiles');
}
this.profilesAutoCompleteConfiguration = { this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this), filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
@ -237,4 +248,13 @@ export class DatasetInfoComponent extends BaseComponent implements OnInit {
} }
}); });
} }
onOptionSelected(){
console.log('this option selected emited');
try{
const profiles = this.formGroup.get('profiles').value as {id:string, label:string}[];
profiles.sort((a,b)=> a.label.localeCompare(b.label));
}catch{
console.info('Could not sort Dataset Templates')
}
}
} }

View File

@ -411,11 +411,22 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// } // }
// else { // else {
// console.log("update ", this.formGroup); // console.log("update ", this.formGroup);
/*
if (!this.isFormValid()) { if (!this.isFormValid()) {
this.showValidationErrorsDialog(); this.showValidationErrorsDialog();
this.hintErrors = true; this.hintErrors = true;
return; return;
} }
*/
// if(!this.formval)
if(!this._isDMPDescriptionValid()){
const errmess = this._buildDMPDescriptionErrorMessages();
this.showValidationErrorsDialog(undefined, errmess);
this.hintErrors = true;
return;
}
this.onSubmit(addNew, showAddDatasetDialog); this.onSubmit(addNew, showAddDatasetDialog);
// } // }
} }

View File

@ -18,6 +18,6 @@
} }
h6 { h6 {
text-transform: capitalize; // text-transform: capitalize;
font-weight: 400; font-weight: 400;
} }

View File

@ -1,6 +1,6 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<iframe *ngIf="!useInnerHTML && guideHTMLUrl" class="iframe" id='userguide' [src]="guideHTMLUrl"></iframe> <iframe *ngIf="!useInnerHTML && guideHTMLUrl" class="iframe" id='userguide' [src]="guideHTMLUrl" (load)="onIFrameLoad(iframe)" #iframe></iframe>
<span #guide *ngIf="useInnerHTML" id='userguide' [innerHTML]="guideHTML"></span> <span #guide *ngIf="useInnerHTML" id='userguide' [innerHTML]="guideHTML"></span>
</div> </div>
</div> </div>

View File

@ -53,10 +53,10 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
} else { } else {
this.guideHTMLUrl = this.sanitizer.bypassSecurityTrustResourceUrl((window.URL ? URL : webkitURL).createObjectURL(blob)); this.guideHTMLUrl = this.sanitizer.bypassSecurityTrustResourceUrl((window.URL ? URL : webkitURL).createObjectURL(blob));
//GK: In case the app is in localhost (dev/debug build) apply the following transformation //GK: In case the app is in localhost (dev/debug build) apply the following transformation
//in order to show the user guide's images // in order to show the user guide's images
if (this.guideHTMLUrl && this.configurationService.app.includes('localhost')) { // if (this.guideHTMLUrl && this.configurationService.app.includes('localhost')) {
interval(1000).pipe(takeUntil(this._transformed)).subscribe(() => this.transform()); // interval(1000).pipe(takeUntil(this._transformed)).subscribe(() => this.transform());
} // }
} }
// this.guideHTML = this.sanitizer.sanitize(SecurityContext.HTML, blob); // this.guideHTML = this.sanitizer.sanitize(SecurityContext.HTML, blob);
@ -149,4 +149,37 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
element.setAttribute('path', href.slice(hashtagIndex + 1)); element.setAttribute('path', href.slice(hashtagIndex + 1));
} }
onIFrameLoad(iframe:HTMLIFrameElement){
try{
// const contentDocument = iframe.contentDocument;
// const URI = contentDocument.URL;
// const refs = contentDocument.getElementsByTagName('a');
// const navLinks:HTMLAnchorElement[] = [];//only navigation links
// for(let i =0; i<refs.length;i++){
// const ref = refs[i];
// if(ref.classList.contains('nav-link')){
// navLinks.push(ref);
// }
// }
// navLinks.forEach(a=>a.href = URI+a.hash);
const images =iframe.contentWindow.document.getElementsByTagName('img');
for(let i=0; i< images.length; i++){
const tempDiv = document.createElement('div');
const currentImage = images.item(i);
tempDiv.innerHTML = currentImage.outerHTML.trim();
currentImage.src = (tempDiv.firstChild as HTMLImageElement).src;
}
// const elem = tempDiv.firstChild as HTMLImageElement;
// console.log('eleme', elem);
// firstimage.src = elem.src;
}catch{
console.warn('Could not find contentDocument');
}
}
} }

View File

@ -1492,7 +1492,9 @@
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "You can import a DMP",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "or create new in Argos.",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Got it!",
"LEAVE-TOUR":"Leave Tour"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {

View File

@ -1492,7 +1492,9 @@
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "You can import a DMP",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "or create new in Argos.",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Got it!",
"LEAVE-TOUR":"Leave Tour"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {

View File

@ -1492,7 +1492,9 @@
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "You can import a DMP",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "or create new in Argos.",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Got it!",
"LEAVE-TOUR":"Leave Tour"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {

View File

@ -1492,7 +1492,9 @@
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "You can import a DMP",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "or create new in Argos.",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Got it!",
"LEAVE-TOUR":"Leave Tour"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {

View File

@ -86,7 +86,7 @@
"RDA-SPECIFICATIONS": "de acordo com as especificações da RDA", "RDA-SPECIFICATIONS": "de acordo com as especificações da RDA",
"MACHINE-ACTIONABLE": "para PGDs acionáveis por máquina", "MACHINE-ACTIONABLE": "para PGDs acionáveis por máquina",
"UPLOAD-FILE": "Carregar Ficheiro", "UPLOAD-FILE": "Carregar Ficheiro",
"REPLACE-FILE": "Replace File" "REPLACE-FILE": "Substituir Ficheiro"
}, },
"INVITATION-DIALOG": { "INVITATION-DIALOG": {
"HINT": "Prima vírgula ou \"Enter\" entre os autores", "HINT": "Prima vírgula ou \"Enter\" entre os autores",
@ -1114,7 +1114,7 @@
"NEW": "Novo Plano de Gestão de Dados", "NEW": "Novo Plano de Gestão de Dados",
"EDIT": "Editar", "EDIT": "Editar",
"INTRO": "Um Plano de Gestão de Dados (PGD) permite uma maior proximidade com o local onde os seus dados são gerados, analisados e armazenados. O Argos é uma ferramenta aberta, extensível e colaborativa que disponibiliza Planos de Gestão de Dados FAIR e Abertos.", "INTRO": "Um Plano de Gestão de Dados (PGD) permite uma maior proximidade com o local onde os seus dados são gerados, analisados e armazenados. O Argos é uma ferramenta aberta, extensível e colaborativa que disponibiliza Planos de Gestão de Dados FAIR e Abertos.",
"INTRO-TIP": "Tip: Add new datasets to describe different types of data or disciplinary data to avoid mixing information." "INTRO-TIP": "Dica: Adicione tantos conjuntos de dados quantos os que tiver para descrever, para não gerar confusão na descrição da informação."
}, },
"FIELDS": { "FIELDS": {
"NAME": "Designação do Dataset", "NAME": "Designação do Dataset",
@ -1155,7 +1155,7 @@
"EXTERNAL-LINK": "Forneça uma ligação URL externa" "EXTERNAL-LINK": "Forneça uma ligação URL externa"
}, },
"HINT": { "HINT": {
"DESCRIPTION": "Briefly describe the context and purpose of the Dataset", "DESCRIPTION": "Descrever brevemente o contexto e o objetivo do conjunto de dados",
"TITLE": "Uma breve descrição do que o/a ", "TITLE": "Uma breve descrição do que o/a ",
"TITLE-REST": "é sobre o seu âmbito e objetivos." "TITLE-REST": "é sobre o seu âmbito e objetivos."
}, },
@ -1487,12 +1487,14 @@
"ADD-DMP-DESCRIPTION": "Adicione uma descrição ao PGD" "ADD-DMP-DESCRIPTION": "Adicione uma descrição ao PGD"
}, },
"TOUR-GUIDE": { "TOUR-GUIDE": {
"DMP": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", "DMP": "Aqui pode visualizar e editar todos os PGDs para os quais tenha contribuído ou criado.",
"START-NEW": "Create your DMP with Start new DMP.", "START-NEW": "Crie o seu PGD através do botão “Iniciar novo PGD”.",
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "Aqui pode importar um PGD pré-existente...",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "... ou criar um novo no Argos!",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Ok, entendi!",
"LEAVE-TOUR":"Saltar a Apresentação"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {

View File

@ -1492,7 +1492,9 @@
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "You can import a DMP",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "or create new in Argos.",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Got it!",
"LEAVE-TOUR":"Leave Tour"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {

View File

@ -1492,7 +1492,9 @@
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "You can import a DMP",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "or create new in Argos.",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Got it!",
"LEAVE-TOUR":"Leave Tour"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {

View File

@ -1492,7 +1492,9 @@
"IMPORT-DMP": "You can import a DMP", "IMPORT-DMP": "You can import a DMP",
"START-WIZARD": "or create new in Argos.", "START-WIZARD": "or create new in Argos.",
"DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.", "DATASET": "This is your dashboard. You can view and edit all Datasets that you have either contributed to or created yourself.",
"NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process." "NEW-DATASET": "With Add Dataset you can describe new datasets anytime in the research process.",
"GOT-IT":"Got it!",
"LEAVE-TOUR":"Leave Tour"
} }
}, },
"USER-DIALOG": { "USER-DIALOG": {