[Monitor Dashboard | Trunk]: Fix a bug when a new empty topic has been created
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@58689 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
98f8c36f06
commit
b2253b7d5a
|
@ -123,7 +123,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
if (this.adminMenuItems.length == 0) {
|
||||
//nstructor(id: string, name: string, route: string, items: Item[], icon, open: boolean) {
|
||||
this.adminMenuItems.push(new MenuItem("stakeholders", "Manage Stakeholders", "", "/admin", false, [], [], {}));
|
||||
let adminOptions = new MenuItem("adminOptions", "Admin Options", "", "", false, [], [], {})
|
||||
/*let adminOptions = new MenuItem("adminOptions", "Admin Options", "", "", false, [], [], {})
|
||||
adminOptions.items.push(new MenuItem("pages", "Pages", "", "/pages", false, [], [], {}));
|
||||
adminOptions.items.push(new MenuItem("portals", "Portals", "", "/portals", false, [], [], {}));
|
||||
adminOptions.items.push(new MenuItem("entities", "Entities", "", "/entities", false, [], [], {}));
|
||||
|
@ -134,11 +134,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
monitorOptions.items.push(new MenuItem("entities", "Entities", "", "/entities", false, [], [], {communityId: 'openaire'}));
|
||||
monitorOptions.items.push(new MenuItem("classes", "Class help texts", "", "/classContents", false, [], [], {communityId: 'openaire'}));
|
||||
monitorOptions.items.push(new MenuItem("helptexts", "Help texts", "", "/helptexts", false, [], [], {communityId: 'openaire'}));
|
||||
this.adminMenuItems.push(monitorOptions);
|
||||
// this.adminMenuItems.push(new Item("pages", "Pages", "/pages", [], null, false));
|
||||
// this.adminMenuItems.push(new Item("monitor", "Monitor", "/portals", [], null, false));
|
||||
// this.adminMenuItems.push(new Item("entities", "Entities", "/entities", [], null, false));
|
||||
// this.adminMenuItems.push(new Item("helptexts", "Help texts", "/helptexts?communityId=openaire", [], null, false));
|
||||
this.adminMenuItems.push(monitorOptions);*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,6 +184,7 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
|
|||
];
|
||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(() => {
|
||||
this.stakeholder.topics.splice(this.index, 1);
|
||||
this.index = -1;
|
||||
UIkit.notification('Topic has been successfully deleted', {
|
||||
status: 'success',
|
||||
timeout: 3000,
|
||||
|
|
|
@ -111,9 +111,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.filterCharts();
|
||||
this.filterNumbers();
|
||||
}
|
||||
this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias +
|
||||
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias +
|
||||
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
|
||||
if (this.topicIndex && this.categoryIndex && this.subcategoryIndex) {
|
||||
this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias +
|
||||
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias +
|
||||
'/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
|
||||
}
|
||||
}
|
||||
|
||||
initReorder() {
|
||||
|
@ -291,7 +293,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
}
|
||||
|
||||
get charts(): Section[] {
|
||||
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].charts;
|
||||
if (this.topicIndex && this.categoryIndex && this.subcategoryIndex) {
|
||||
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].charts;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
set charts(sections: Section[]) {
|
||||
|
@ -299,7 +305,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
}
|
||||
|
||||
get numbers(): Section[] {
|
||||
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].numbers;
|
||||
if (this.topicIndex && this.categoryIndex && this.subcategoryIndex) {
|
||||
return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].numbers;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
set numbers(sections: Section[]) {
|
||||
|
@ -506,7 +516,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
|
||||
deleteIndicatorOpen(section: Section, indicatorId: string, type: string = 'chart') {
|
||||
this.section = section;
|
||||
if(type === 'chart') {
|
||||
if (type === 'chart') {
|
||||
this.index = this.charts.find(value => value._id == section._id).indicators.findIndex(value => value._id == indicatorId);
|
||||
} else {
|
||||
this.index = this.numbers.find(value => value._id == section._id).indicators.findIndex(value => value._id == indicatorId);
|
||||
|
@ -566,7 +576,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
});
|
||||
}
|
||||
|
||||
saveSection(section : Section, index: number, type: IndicatorType = "chart") {
|
||||
saveSection(section: Section, index: number, type: IndicatorType = "chart") {
|
||||
let path = [
|
||||
this.stakeholder._id,
|
||||
this.stakeholder.topics[this.topicIndex]._id,
|
||||
|
@ -574,7 +584,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id
|
||||
];
|
||||
this.stakeholderService.saveSection(this.properties.monitorServiceAPIURL, section, path, index).subscribe(section => {
|
||||
if(type === 'chart') {
|
||||
if (type === 'chart') {
|
||||
this.charts[index] = section;
|
||||
this.filterCharts();
|
||||
} else {
|
||||
|
@ -605,15 +615,15 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id
|
||||
];
|
||||
this.stakeholderService.saveSection(this.properties.monitorServiceAPIURL, this.section, path, index).subscribe(section => {
|
||||
if(type === 'chart') {
|
||||
if(index !== -1) {
|
||||
if (type === 'chart') {
|
||||
if (index !== -1) {
|
||||
this.charts.splice(index, 0, section);
|
||||
} else {
|
||||
this.charts.push(section);
|
||||
}
|
||||
this.filterCharts();
|
||||
} else {
|
||||
if(index !== -1) {
|
||||
if (index !== -1) {
|
||||
this.numbers.splice(index, 0, section);
|
||||
} else {
|
||||
this.numbers.push(section);
|
||||
|
@ -644,7 +654,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.deleteChartSectionModal.open();
|
||||
}
|
||||
|
||||
deleteSection(type: IndicatorType = 'chart') {
|
||||
deleteSection(type: IndicatorType = 'chart') {
|
||||
let path = [
|
||||
this.stakeholder._id,
|
||||
this.stakeholder.topics[this.topicIndex]._id,
|
||||
|
@ -652,8 +662,8 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
||||
this.section._id
|
||||
];
|
||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(()=> {
|
||||
if(type === "chart") {
|
||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(() => {
|
||||
if (type === "chart") {
|
||||
this.charts.splice(this.index, 1);
|
||||
this.filterCharts();
|
||||
} else {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
alt="BETA">
|
||||
<img class="logo" *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl">
|
||||
</div>
|
||||
<div *ngIf="stakeholder" class="menu_section">
|
||||
<div *ngIf="stakeholder && stakeholder.topics[topicIndex]" class="menu_section">
|
||||
<ul>
|
||||
<li class="uk-margin-bottom md-bg-blue-900 uk-padding-small">
|
||||
<a [routerLink]="'../'" class="md-color-white">
|
||||
|
|
Loading…
Reference in New Issue