diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss
index fbebe8c46..bd0fdb41b 100644
--- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss
+++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss
@@ -227,6 +227,11 @@
padding-bottom: 0 !important;
}
+::ng-deep .sort-form .mat-form-field-wrapper {
+ background-color: white !important;
+ padding-bottom: 0 !important;
+}
+
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: 0.3rem 0rem 0.6rem 0rem !important;
}
diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts
index dab5e41c7..02e4aa33c 100644
--- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts
+++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts
@@ -25,6 +25,7 @@ import { isNullOrUndefined } from 'util';
import { AuthService } from '@app/core/services/auth/auth.service';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { DmpCriteriaDialogComponent } from './criteria/dmp-criteria-dialog.component';
+import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
@Component({
@@ -56,10 +57,12 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
criteria: DmpCriteria;
criteriaFormGroup: FormGroup;
public formGroup = new FormBuilder().group({
- like: new FormControl()
+ like: new FormControl(),
+ order: new FormControl()
});
scrollbar: boolean;
+ order = RecentActivityOrder;
constructor(
private dmpService: DmpService,
@@ -77,6 +80,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
ngOnInit() {
this.isPublic = this.router.url.startsWith('/explore-plans');
+ this.formGroup.get('order').setValue(this.order.MODIFIED);
if (!this.isPublic && isNullOrUndefined(this.authService.current())) {
this.router.navigateByUrl("/explore-plans");
}
@@ -164,6 +168,9 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
+ this.formGroup.get('order').valueChanges
+ .pipe(takeUntil(this._destroyed))
+ .subscribe(x => this.refresh());
}
ngAfterContentChecked(): void {
@@ -175,9 +182,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
// if (resetPages) this._paginator.pageIndex = 0;
// const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
- let fields: Array
= new Array();
+ // let fields: Array = new Array();
// if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
- fields.push('-modified');
+ // fields.push('-modified');
+ const fields: Array = ["-" + this.formGroup.get('order').value];
const request = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields });
this.setPublicCriteria();
@@ -200,7 +208,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
public loadMore() {
this.startIndex = this.startIndex + this.pageSize;
- const fields: Array = ["-modified"];
+ // const fields: Array = ["-modified"];
+ const fields: Array = ["-" + this.formGroup.get('order').value];
const request = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields });
this.setPublicCriteria();
request.criteria = this.criteria;
diff --git a/dmp-frontend/src/app/ui/language-editor/language-editor.component.html b/dmp-frontend/src/app/ui/language-editor/language-editor.component.html
index b0eaa1c83..655293b39 100644
--- a/dmp-frontend/src/app/ui/language-editor/language-editor.component.html
+++ b/dmp-frontend/src/app/ui/language-editor/language-editor.component.html
@@ -14,12 +14,8 @@
{{key}} :
-
+
diff --git a/dmp-frontend/src/app/ui/language-editor/language-editor.component.scss b/dmp-frontend/src/app/ui/language-editor/language-editor.component.scss
index a02699a28..811aa4ee3 100644
--- a/dmp-frontend/src/app/ui/language-editor/language-editor.component.scss
+++ b/dmp-frontend/src/app/ui/language-editor/language-editor.component.scss
@@ -1,5 +1,5 @@
.language-editor {
- padding-top: 5em;
+ padding-top: 6em;
padding-bottom: 2em;
.language-area {
@@ -12,13 +12,13 @@
width: 56px !important;
bottom: 10px;
position: fixed;
- right: 10px;
+ right: 24px;
}
.sticky {
position: fixed;
- left: 200px;
- right: 200px;
+ left: 214px;
+ right: 214px;
width: 50%;
}
@@ -28,7 +28,7 @@
width: 258px !important;
top: 100px;
position: fixed;
- right: 10px;
+ right: 24px;
background-color: white;
border: 1px solid rgb(218, 218, 218);
border-radius: 6px;
diff --git a/dmp-frontend/src/app/ui/language-editor/language-editor.component.ts b/dmp-frontend/src/app/ui/language-editor/language-editor.component.ts
index 21dbbe559..551df1671 100644
--- a/dmp-frontend/src/app/ui/language-editor/language-editor.component.ts
+++ b/dmp-frontend/src/app/ui/language-editor/language-editor.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit, OnDestroy } from '@angular/core';
+import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { LanguageService } from '@app/core/services/language/language.service';
import { BaseComponent } from '@common/base/base.component';
import { takeUntil } from 'rxjs/operators';
@@ -6,13 +6,18 @@ import { FormGroup, FormBuilder } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
import { Router } from '@angular/router';
+import { CdkTextareaAutosize } from '@angular/cdk/text-field';
@Component({
- selector: 'app-language-editor',
- templateUrl: './language-editor.component.html',
- styleUrls: ['./language-editor.component.scss']
+ selector: 'app-language-editor',
+ templateUrl: './language-editor.component.html',
+ styleUrls: ['./language-editor.component.scss']
})
export class LanguageEditorComponent extends BaseComponent implements OnInit, OnDestroy {
+
+ @ViewChild('autosize', {static: false}) autosize: CdkTextareaAutosize;
+
+
readonly rowHeight = 100;
readonly maxElements = 12;
@@ -26,113 +31,119 @@ export class LanguageEditorComponent extends BaseComponent implements OnInit, On
formGroup: FormGroup;
formBuilder: FormBuilder;
- constructor(
- private language: LanguageService,
- private uiNotificationService: UiNotificationService,
- private translate: TranslateService,
- private router: Router,
- ) { super(); }
+ constructor(
+ private language: LanguageService,
+ private uiNotificationService: UiNotificationService,
+ private translate: TranslateService,
+ private router: Router,
+ ) { super(); }
- ngOnInit() {
- this.formBuilder = new FormBuilder();
- this.formGroup = this.formBuilder.group({});
- this.endIndex = this.maxElements;
- window.addEventListener('scroll', this.refreshFn, true);
- this.language.getCurrentLanguageJSON()
- .pipe(takeUntil(this._destroyed))
- .subscribe(response => {
- const blob = new Blob([response.body], { type: 'application/json' });
- this.convertBlobToJSON(blob);
+ ngOnInit() {
+ this.formBuilder = new FormBuilder();
+ this.formGroup = this.formBuilder.group({});
+ this.endIndex = this.maxElements;
+ window.addEventListener('scroll', this.refreshFn, true);
+ this.language.getCurrentLanguageJSON()
+ .pipe(takeUntil(this._destroyed))
+ .subscribe(response => {
+ const blob = new Blob([response.body], { type: 'application/json' });
+ this.convertBlobToJSON(blob);
- });
- }
+ });
+ }
- ngOnDestroy() {
- window.removeEventListener('scroll', this.refreshFn, true);
- }
+ ngOnDestroy() {
+ window.removeEventListener('scroll', this.refreshFn, true);
+ }
- convertBlobToJSON(blob: Blob) {
- const fr = new FileReader();
- fr.onload = ev => {
- const langObj = JSON.parse(fr.result as string);
- this.convertObjectToForm(langObj, '', this.formGroup);
- this.currentLang = this.language.getCurrentLanguageName();
+ convertBlobToJSON(blob: Blob) {
+ const fr = new FileReader();
+ fr.onload = ev => {
+ const langObj = JSON.parse(fr.result as string);
+ this.convertObjectToForm(langObj, '', this.formGroup);
+ this.currentLang = this.language.getCurrentLanguageName();
+ this.keys.length = 0;
+ for (const key of this.allkeys) {
+ this.keys.push(key);
+ }
+ this.visibleKeys = this.keys.slice(this.startIndex, this.endIndex);
+ this.parseFinished = true;
+ this.setupAutosize();
+ };
+ fr.readAsText(blob);
+ }
+
+ convertObjectToForm(obj: any, parentKey: string, form: FormGroup) {
+ for (let prop in obj) {
+ const key = parentKey !== '' ? `${parentKey}.${prop}` : prop;
+ if (typeof obj[prop] === 'object') {
+ form.addControl(prop, this.formBuilder.group({}));
+ this.convertObjectToForm(obj[prop], key, form.get(prop) as FormGroup);
+ continue;
+ } else {
+ form.addControl(prop, this.formBuilder.control(obj[prop]));
+ this.allkeys.push(key);
+ }
+ }
+ return;
+ }
+
+ updateLang() {
+ const json = JSON.stringify(this.formGroup.value, null, " ");
+ this.language.updateLanguage(json).pipe(takeUntil(this._destroyed))
+ .subscribe(
+ complete => {
+ this.onCallbackSuccess(complete);
+ },
+ error => {
+ this.onCallbackError(error);
+ }
+ );
+
+ }
+
+ onCallbackSuccess(id?: String): void {
+ this.uiNotificationService.snackBarNotification(this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
+ this.router.navigate(['/reload']).then(() => this.router.navigate(['/language-editor']));
+ }
+
+ onCallbackError(error: any) {
+ this.uiNotificationService.snackBarNotification(error, SnackBarNotificationLevel.Error);
+ //this.validateAllFormFields(this.formGroup);
+ }
+
+ refreshFn = (ev: Event) => {
+ const evDoc = (
ev.target);
+ if (document.scrollingElement !== undefined) {
+ this.startIndex = Math.floor(evDoc.scrollTop / this.rowHeight);
+ this.endIndex = this.startIndex + this.maxElements;
+ const tempKeys = this.keys.slice(this.startIndex, this.endIndex);
+ this.visibleKeys.length = 0;
+ for (const key of tempKeys) {
+ this.visibleKeys.push(key);
+ }
+ }
+ }
+
+ findKeys(ev: any) {
+ let tempKeys = [];
+ if (ev.value === "") {
+ tempKeys = this.allkeys;
+ } else {
+ tempKeys = this.allkeys.filter((key) => (this.formGroup.get(key).value as string).toLowerCase().includes(ev.value.toLowerCase()));
+ window.scrollTo({ top: 0 });
+ }
this.keys.length = 0;
- for (const key of this.allkeys) {
+ for (const key of tempKeys) {
this.keys.push(key);
}
this.visibleKeys = this.keys.slice(this.startIndex, this.endIndex);
- this.parseFinished = true;
-
- };
- fr.readAsText(blob);
- }
-
- convertObjectToForm(obj: any, parentKey: string, form: FormGroup) {
- for (let prop in obj) {
- const key = parentKey !== '' ? `${parentKey}.${prop}` : prop;
- if (typeof obj[prop] === 'object') {
- form.addControl(prop, this.formBuilder.group({}));
- this.convertObjectToForm(obj[prop], key, form.get(prop) as FormGroup);
- continue;
- } else {
- form.addControl(prop, this.formBuilder.control(obj[prop]));
- this.allkeys.push(key);
- }
- }
- return;
- }
-
- updateLang() {
- const json = JSON.stringify(this.formGroup.value, null, " ");
- this.language.updateLanguage(json).pipe(takeUntil(this._destroyed))
- .subscribe(
- complete => {
- this.onCallbackSuccess(complete);
- },
- error => {
- this.onCallbackError(error);
- }
- );
-
- }
-
- onCallbackSuccess(id?: String): void {
- this.uiNotificationService.snackBarNotification( this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
- this.router.navigate(['/reload']).then(() => this.router.navigate(['/language-editor']));
-}
-
-onCallbackError(error: any) {
- this.uiNotificationService.snackBarNotification( error, SnackBarNotificationLevel.Error);
- //this.validateAllFormFields(this.formGroup);
-}
-
-refreshFn = (ev: Event) => {
-
- if ((ev.srcElement as HTMLDocument).scrollingElement !== undefined) {
- this.startIndex = Math.floor((ev.srcElement as HTMLDocument).scrollingElement.scrollTop / this.rowHeight);
- this.endIndex = this.startIndex + this.maxElements;
- const tempKeys = this.keys.slice(this.startIndex, this.endIndex);
- this.visibleKeys.length = 0;
- for (const key of tempKeys) {
- this.visibleKeys.push(key);
- }
}
-}
-findKeys(ev: any) {
- let tempKeys = [];
- if (ev.value === "") {
- tempKeys = this.allkeys;
- } else {
- tempKeys = this.allkeys.filter((key) => (this.formGroup.get(key).value as string).toLowerCase().includes(ev.value.toLowerCase()));
- window.scrollTo({top: 0});
+ private setupAutosize() {
+ this.autosize.minRows = 1;
+ this.autosize.maxRows = 5;
+ this.autosize.enabled = true;
}
- this.keys.length = 0;
- for (const key of tempKeys) {
- this.keys.push(key);
- }
- this.visibleKeys = this.keys.slice(this.startIndex, this.endIndex);
-}
}
diff --git a/dmp-frontend/src/app/ui/language-editor/language-editor.module.ts b/dmp-frontend/src/app/ui/language-editor/language-editor.module.ts
index ff38b4929..9d8b40f16 100644
--- a/dmp-frontend/src/app/ui/language-editor/language-editor.module.ts
+++ b/dmp-frontend/src/app/ui/language-editor/language-editor.module.ts
@@ -4,6 +4,7 @@ import { LanguageEditorRoutingModule } from './language-editor.routing';
import { CommonUiModule } from '@common/ui/common-ui.module';
import { CommonFormsModule } from '@common/forms/common-forms.module';
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
+import {TextFieldModule} from '@angular/cdk/text-field';
@@ -13,7 +14,8 @@ import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/co
CommonUiModule,
CommonFormsModule,
ConfirmationDialogModule,
- LanguageEditorRoutingModule
+ LanguageEditorRoutingModule,
+ TextFieldModule
]
})
export class LanguageEditorModule { }
diff --git a/dmp-frontend/src/assets/css/demo.css b/dmp-frontend/src/assets/css/demo.css
index 158a19232..ffc0cdfef 100644
--- a/dmp-frontend/src/assets/css/demo.css
+++ b/dmp-frontend/src/assets/css/demo.css
@@ -396,7 +396,7 @@ input[type=email], select {
opacity: 1;
}
-textarea {
+/* textarea {
width: 100%;
height: 142px;
padding: 16px;
@@ -404,7 +404,7 @@ textarea {
border: 1px solid #D1D1D1;
border-radius: 4px;
opacity: 1;
-}
+} */
p {
text-align: left;
diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json
index cd9179861..e962f693f 100644
--- a/dmp-frontend/src/assets/i18n/en.json
+++ b/dmp-frontend/src/assets/i18n/en.json
@@ -405,6 +405,7 @@
"TEXT-INFO-QUESTION": "Not sure how a DMP looks in practice? Browse Public DMPs and",
"LINK-ZENODO": "LIBER community in Zenodo",
"GET-IDEA": "to get an idea!",
+ "SORT-BY": "Sort by",
"COLUMNS": {
"NAME": "Name",
"GRANT": "Grant",
@@ -1029,6 +1030,12 @@
"DMPS": "DMPs",
"DATASETS": "Dataset Descriptions",
"EXTERNAL-SOURCE-HINT": "List of values provided by external source(s)"
+ },
+ "RECENT-ACTIVITY-ORDER": {
+ "CREATED": "Created",
+ "LABEL": "Label",
+ "MODIFIED": "Modified",
+ "STATUS": "Status"
}
},
"ADDRESEARCHERS-EDITOR": {
diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json
index 278a83fa2..7d5a06b08 100644
--- a/dmp-frontend/src/assets/i18n/es.json
+++ b/dmp-frontend/src/assets/i18n/es.json
@@ -404,6 +404,7 @@
"TEXT-INFO-QUESTION": "Not sure how a DMP looks in practice? Browse Public DMPs and",
"LINK-ZENODO": "LIBER community in Zenodo",
"GET-IDEA": "to get an idea!",
+ "SORT-BY": "Sort by",
"COLUMNS": {
"NAME": "Nombre",
"GRANT": "Subvención",
@@ -1024,6 +1025,12 @@
"DMPS": "PGDs",
"DATASETS": "Descripciones del Dataset",
"EXTERNAL-SOURCE-HINT": "Lista de valores para seleccionar la(s) fuente(s) externa(s)"
+ },
+ "RECENT-ACTIVITY-ORDER": {
+ "CREATED": "Created",
+ "LABEL": "Label",
+ "MODIFIED": "Modified",
+ "STATUS": "Status"
}
},
"ADDRESEARCHERS-EDITOR": {
diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json
index 0bdaa15a7..91b1e8487 100644
--- a/dmp-frontend/src/assets/i18n/gr.json
+++ b/dmp-frontend/src/assets/i18n/gr.json
@@ -404,6 +404,7 @@
"TEXT-INFO-QUESTION": "Not sure how a DMP looks in practice? Browse Public DMPs and",
"LINK-ZENODO": "LIBER community in Zenodo",
"GET-IDEA": "to get an idea!",
+ "SORT-BY": "Sort by",
"COLUMNS": {
"NAME": "Τίτλος",
"GRANT": "Επιχορήγηση",
@@ -1025,6 +1026,12 @@
"DMPS": "Σχέδια Διαχείρισης Δεδομένων",
"DATASETS": "Περιγραφές Συνόλων Δεδομένων",
"EXTERNAL-SOURCE-HINT": "Κατάλογος τιμών που παρέχονται από εξωτερικές πηγές"
+ },
+ "RECENT-ACTIVITY-ORDER": {
+ "CREATED": "Created",
+ "LABEL": "Label",
+ "MODIFIED": "Modified",
+ "STATUS": "Status"
}
},
"ADDRESEARCHERS-EDITOR": {