[Library | Trunk]: Stakeholder-service: Reorder change method

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60103 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-12-09 13:22:52 +00:00
parent ccb6315f9c
commit 440e23e56f
1 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,12 @@ import {CustomOptions} from "../../services/servicesUtils/customOptions.class";
let maps: string[] = ['parameters', 'filters']; let maps: string[] = ['parameters', 'filters'];
export interface Reorder {
action: 'moved' | 'added' | 'removed',
target: string,
ids: string[];
}
@Injectable({ @Injectable({
providedIn: "root" providedIn: "root"
}) })
@ -112,9 +118,9 @@ export class StakeholderService {
return this.http.delete<any>(url + '/' + path.join('/') + '/delete'+params, CustomOptions.registryOptions()); return this.http.delete<any>(url + '/' + path.join('/') + '/delete'+params, CustomOptions.registryOptions());
} }
reorderIndicators(url: string, path: string[], indicatorIds: string[], type: string = 'chart'): Observable<Indicator[]> { reorderIndicators(url: string, path: string[], reorder: Reorder, type: string = 'chart'): Observable<Indicator[]> {
path = HelperFunctions.encodeArray(path); path = HelperFunctions.encodeArray(path);
return this.http.post<Indicator[]>(url + '/' + path.join('/') + '/' + type + '/reorder', indicatorIds, CustomOptions.registryOptions()).pipe(map(indicators => { return this.http.post<Indicator[]>(url + '/' + path.join('/') + '/' + type + '/reorder', reorder, CustomOptions.registryOptions()).pipe(map(indicators => {
return this.formalize(indicators); return this.formalize(indicators);
})); }));
} }