[Monitor Dashboard | Trunk]: Fix a bug on number indicators reordering. Add reordering status during the request

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@58918 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2020-06-15 16:58:06 +00:00
parent 06ec6b383f
commit 89ab45bc63
2 changed files with 8 additions and 5 deletions

View File

@ -65,7 +65,7 @@
<h4 class="uk-text-bold">Number Indicators</h4>
<div *ngIf="numberSections">
<ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index">
<div [class.list-view]="!grid" [id]="number._id"
<div [class.list-view]="!grid" [id]="'number-' + number._id"
class="uk-grid-match section uk-grid-small uk-grid uk-margin-top"
uk-sortable="group: number" uk-grid>
<div *ngIf="grid" class="tools disable-sortable uk-sortable-nodrag">

View File

@ -73,6 +73,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
* Toggles
*/
public grid: boolean = true;
private reordering: boolean = false;
/** Safe Urls*/
public safeUrls: Map<string, SafeResourceUrl> = new Map<string, SafeResourceUrl>([]);
@ -149,16 +150,17 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
reordered.push(items.item(i).id);
}
}
this.reordering = true;
this.reorderIndicators(list.current.id.toString().split('-')[1], type, reordered);
};
this.numbers.forEach((section) => {
this.subscriptions.push(UIkit.util.on(document, 'moved', '#chart' + section._id, (list): void => {
this.subscriptions.push(UIkit.util.on(document, 'moved', '#number-' + section._id, (list): void => {
callback(list, "number");
}));
this.subscriptions.push(UIkit.util.on(document, 'added', '#chart' + section._id, (list): void => {
this.subscriptions.push(UIkit.util.on(document, 'added', '#number-' + section._id, (list): void => {
callback(list, "number");
}));
this.subscriptions.push(UIkit.util.on(document, 'removed', '#chart' + section._id, (list): void => {
this.subscriptions.push(UIkit.util.on(document, 'removed', '#number-' + section._id, (list): void => {
callback(list, "number");
}));
});
@ -349,7 +351,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
get canReorder(): boolean {
return this.filters.value.chartType === 'all' && this.filters.value.privacy === 'all' &&
this.filters.value.status === 'all' && this.filters.value.keyword === '' && this.grid;
this.filters.value.status === 'all' && this.filters.value.keyword === '' && this.grid && !this.reordering;
}
get canEdit() {
@ -639,6 +641,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.numbers.find(section => section._id === sectionId).indicators = indicators;
this.filterNumbers();
}
this.reordering = false;
});
}