diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html
index dbb7ba9ef..569ed52c2 100644
--- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html
+++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html
@@ -18,13 +18,9 @@
{{'GENERAL.VALIDATION.REQUIRED' | translate}}
-
-
-
-
+
@@ -45,8 +41,11 @@
View All
+
+
-
{{chip.name.substring(0, 1).toUpperCase()}}
@@ -58,11 +57,12 @@
-
+ -->
-
-
+
+
{{chip.name.substring(0, 1).toUpperCase()}}
{{chip.name}}
@@ -75,7 +75,7 @@
-
diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts
index 4cd93e46b..3cb61f321 100644
--- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts
+++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts
@@ -25,6 +25,7 @@ import { ViewContainerRef } from '@angular/core';
import { TdDialogService } from '@covalent/core';
import { AvailableProfilesComponent } from "@app/available-profiles/available-profiles.component";
import { AutoCompleteChipConfiguration } from "@app/shared/components/autocompleteChips/AutoCompleteChipConfiguration";
+import { BaseCriteria } from "@app/models/criteria/BaseCriteria";
@Component({
selector: 'app-dmp-editor-component',
@@ -48,7 +49,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
filteredProfiles: DatasetProfileModel[];
projectAutoCompleteConfiguration: AutoCompleteConfiguration;
- projectAutoCompleteConfigurationTest: AutoCompleteChipConfiguration;
+ organisationsAutoCompleteConfiguration: AutoCompleteChipConfiguration;
createNewVersion;
associatedUsers: Array
@@ -74,8 +75,10 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
let projectRequestItem: RequestItem = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
+ let organisationRequestItem: RequestItem = new RequestItem();
+ organisationRequestItem.criteria = new BaseCriteria();
this.projectAutoCompleteConfiguration = new AutoCompleteConfiguration(this.projectService.getWithExternal.bind(this.projectService), projectRequestItem);
- this.projectAutoCompleteConfigurationTest = new AutoCompleteChipConfiguration(this.projectService.getWithExternal.bind(this.projectService), projectRequestItem);
+ this.organisationsAutoCompleteConfiguration = new AutoCompleteChipConfiguration(this.externalSourcesService.searchDMPOrganizations.bind(this.externalSourcesService), organisationRequestItem);
if (itemId != null) {
this.isNew = false;
@@ -145,24 +148,24 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
this.router.navigate(['/invite/' + this.dataManagementPlan.id]);
}
- filterOrganisations(value: string): void {
+ // filterOrganisations(value: string): void {
- this.filteredOrganisations = undefined;
- if (value) {
- this.filteringOrganisationsAsync = true;
+ // this.filteredOrganisations = undefined;
+ // if (value) {
+ // this.filteringOrganisationsAsync = true;
- this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
- this.filteredOrganisations = items;
- this.filteringOrganisationsAsync = false;
+ // this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
+ // this.filteredOrganisations = items;
+ // this.filteringOrganisationsAsync = false;
- // this.filteredOrganisations = items.filter((filteredObj: any) => {
- // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
- // });
+ // // this.filteredOrganisations = items.filter((filteredObj: any) => {
+ // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
+ // // });
- });
+ // });
- }
- }
+ // }
+ // }
filterResearchers(value: string): void {
diff --git a/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.html b/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.html
index 53742965e..4dc57c4fc 100644
--- a/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.html
+++ b/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.html
@@ -34,8 +34,11 @@
{{'GENERAL.VALIDATION.REQUIRED' | translate}}
+
+
-
{{chip.name.substring(0, 1).toUpperCase()}}
@@ -47,7 +50,7 @@
-
+ -->
diff --git a/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts b/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts
index 00135a0ee..3211bf4b4 100644
--- a/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts
+++ b/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts
@@ -19,6 +19,8 @@ import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Observable } from "rxjs/Observable";
import { FormGroup } from '@angular/forms';
+import { AutoCompleteChipConfiguration } from "@app/shared/components/autocompleteChips/AutoCompleteChipConfiguration";
+import { BaseCriteria } from '@app/models/criteria/BaseCriteria';
@Component({
@@ -42,6 +44,7 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
filteredProfiles: DatasetProfileModel[];
projectAutoCompleteConfiguration: AutoCompleteConfiguration;
+ organisationsAutoCompleteConfiguration: AutoCompleteChipConfiguration;
createNewVersion;
associatedUsers: Array
@@ -63,6 +66,11 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
let projectRequestItem: RequestItem = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
this.projectAutoCompleteConfiguration = new AutoCompleteConfiguration(this.projectService.getWithExternal.bind(this.projectService), projectRequestItem);
+
+ let organisationRequestItem: RequestItem = new RequestItem();
+ organisationRequestItem.criteria = new BaseCriteria();
+ this.organisationsAutoCompleteConfiguration = new AutoCompleteChipConfiguration(this.externalSourcesService.searchDMPOrganizations.bind(this.externalSourcesService), organisationRequestItem);
+
}
formSubmit(): void {
@@ -109,20 +117,20 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
filterOrganisations(value: string): void {
this.filteredOrganisations = undefined;
- if (value) {
- this.filteringOrganisationsAsync = true;
+ // if (value) {
+ // this.filteringOrganisationsAsync = true;
- this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
- this.filteredOrganisations = items;
- this.filteringOrganisationsAsync = false;
+ // this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
+ // this.filteredOrganisations = items;
+ // this.filteringOrganisationsAsync = false;
- // this.filteredOrganisations = items.filter((filteredObj: any) => {
- // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
- // });
+ // // this.filteredOrganisations = items.filter((filteredObj: any) => {
+ // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
+ // // });
- });
+ // });
- }
+ // }
}
filterResearchers(value: string): void {
diff --git a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts
index 1297752f1..b7f8c75f6 100644
--- a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts
+++ b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts
@@ -56,7 +56,7 @@ export class DataManagementPlanModel implements Serializable(this.actionUrl + "researchers" + "?query=" + like, { headers: this.headers });
}
- public searchDMPOrganizations(like: string): Observable {
- return this.http.get(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers });
+ public searchDMPOrganizations(organizationscriteria: RequestItem): Observable {
+ return this.http.get(this.actionUrl + "organisations" + "?query=" + organizationscriteria.criteria.like, { headers: this.headers });
}
public searchDMPProfiles(like: string): Observable {
diff --git a/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.html b/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.html
index 17ce761bf..8803aa35e 100644
--- a/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.html
+++ b/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.html
@@ -1,12 +1,12 @@
-
-
- {{item.label}}
- cancel
-
-
-
-
+
+
+ {{item.name}}
+ cancel
+
+
+
{{'GENERAL.VALIDATION.REQUIRED' | translate}}
{{errorString}}
@@ -18,5 +18,5 @@
-
+
\ No newline at end of file
diff --git a/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.scss b/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.scss
index 6e7ec5cf9..c54755d5e 100644
--- a/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.scss
+++ b/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.scss
@@ -27,4 +27,4 @@
.full-width {
width: 100%;
-}
+}
\ No newline at end of file
diff --git a/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.ts b/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.ts
index 69605addd..35f6acc0f 100644
--- a/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.ts
+++ b/dmp-frontend/src/app/shared/components/autocompleteChips/autocompleteChips.component.ts
@@ -52,7 +52,7 @@ export class AutocompleteChipComponent implements OnInit {
term = new FormControl();
// @Input()
// ClickFunctionCall: Function;
-
+ @ViewChild('chipInput') chipInput: MatInput;
loading = false;
hasSelectedItem = false;
@@ -61,12 +61,14 @@ export class AutocompleteChipComponent implements OnInit {
constructor() {
}
-
+
ngOnInit() {
const valueChanges = this.term.valueChanges.share();
valueChanges.subscribe(searchTerm => {
- if (!this.hasSelectedItem) { //proswrina epeidh ta projects den eixan ids...gia test!!!
+ if (this.hasSelectedItem) {
+ this.resetFormControlValue();
+ } else {
this.loading = true;
}
});
@@ -74,11 +76,10 @@ export class AutocompleteChipComponent implements OnInit {
.debounceTime(this.delay)
.distinctUntilChanged()
.switchMap(val => {
- if (this.hasSelectedItem) {
+ if (this.hasSelectedItem || typeof(val) !== "string") {
this.loading = false;
- this.resetFormControlValue();
- return [];
- } else {
+ return this.filteredItems = [];
+ } else if (typeof(val)== "string") {
this.configuration.requestItem.criteria.like = val;
return this.configuration.callback(this.configuration.requestItem).map(result => {
this.filteredItems = (result)
@@ -86,7 +87,8 @@ export class AutocompleteChipComponent implements OnInit {
})
}
- }).subscribe()
+ }).subscribe()
+
}
resetFormControlValue() {
@@ -97,15 +99,12 @@ export class AutocompleteChipComponent implements OnInit {
// // listingItemToDropDown(item: DropdownListingItem): AutoCompleteItem {
// // return (item as DropdownListingItem).toDropdownList();
// // }
-
optionSelected(event: any) {
this.hasSelectedItem = true;
this.selectedItems.push(event.option.value)
- let value = this.control.value;
- if (this.multiChips) value.push(event.option.value)
- else value = event.option.value
- this.control.setValue(value, { emitEvent: false });
- this.filteredItems = this.selectedItems;
+ this.chipInput['nativeElement'].value = '';
+ this.control.setValue(this.selectedItems, { emitEvent: false });
+ //this.filteredItems = this.selectedItems;
//this.selectedDropdownItemChange.emit(event.option.value);
//this.form.updateValueAndValidity();