Revision 57451
Added by Konstantinos Triantafyllou over 4 years ago
monitor.component.ts | ||
---|---|---|
12 | 12 |
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; |
13 | 13 |
import {StakeholderService} from "../services/stakeholder.service"; |
14 | 14 |
import {Category, IndicatorPath, Stakeholder, SubCategory, Topic} from "../utils/entities/stakeholder"; |
15 |
import {MenuItem, RootMenuItem, SideMenuItem} from "../openaireLibrary/sharedComponents/menu"; |
|
16 | 15 |
import {StatisticsService} from "../utils/services/statistics.service"; |
16 |
import {Item, Sidebar} from "../utils/entities/sidebar"; |
|
17 | 17 |
|
18 | 18 |
@Component({ |
19 | 19 |
selector: 'monitor', |
... | ... | |
28 | 28 |
public activeTopic: Topic = null; |
29 | 29 |
public activeCategory: Category = null; |
30 | 30 |
public activeSubCategory: SubCategory = null; |
31 |
public sideMenuItems: SideMenuItem[] = null;
|
|
31 |
public sideBar: Sidebar = null;
|
|
32 | 32 |
public errorCodes: ErrorCodes; |
33 | 33 |
public stakeholder: Stakeholder; |
34 | 34 |
public numberResults: Map<number, number> = new Map<number, number>(); |
... | ... | |
142 | 142 |
} |
143 | 143 |
|
144 | 144 |
private setSideBar() { |
145 |
this.sideMenuItems = [];
|
|
145 |
let items: Item[] = [];
|
|
146 | 146 |
this.activeTopic.categories.forEach(category => { |
147 | 147 |
if (category.isPublic && category.isActive) { |
148 |
let rootItem: MenuItem = new MenuItem(category.alias, category.name, null, ( |
|
149 |
'/monitor/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias), |
|
150 |
false, null, null, null); |
|
151 |
let items: RootMenuItem[] = []; |
|
148 |
let subItems: Item[] = []; |
|
152 | 149 |
category.subCategories.forEach(subCategory => { |
153 | 150 |
if (subCategory.alias != null && subCategory.isPublic && subCategory.isActive) { |
154 |
items.push({ |
|
155 |
items: [], |
|
156 |
rootItem: new MenuItem(subCategory.alias, subCategory.name, null, ( |
|
157 |
'/monitor/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias + '/' + subCategory.alias), |
|
158 |
false, null, null, null) |
|
159 |
}); |
|
151 |
subItems.push(new Item(subCategory.name, ( |
|
152 |
'/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias + '/' + subCategory.alias), |
|
153 |
null, null, false)); |
|
160 | 154 |
} |
161 | 155 |
}); |
162 |
this.sideMenuItems.push({ |
|
163 |
rootItem: rootItem, |
|
164 |
items: items, |
|
165 |
ukIcon: null |
|
166 |
}); |
|
156 |
const open = this.activeCategory.alias === category.alias; |
|
157 |
items.push(new Item(category.name, ( |
|
158 |
'/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias), |
|
159 |
subItems, null, open)); |
|
167 | 160 |
} |
168 | 161 |
}); |
162 |
this.sideBar = new Sidebar(items); |
|
169 | 163 |
} |
170 | 164 |
|
171 | 165 |
private setIndicators() { |
... | ... | |
211 | 205 |
} |
212 | 206 |
|
213 | 207 |
public navigateTo(stakeholder: string, topic: string, category: string = null, subcategory: string = null) { |
214 |
let url = 'monitor/' + stakeholder + '/' + topic + ((category) ? ('/'
|
|
208 |
let url = '/' + stakeholder + '/' + topic + ((category) ? ('/' |
|
215 | 209 |
+ category) : '') + ((subcategory) ? ('/' + subcategory) : ''); |
216 | 210 |
return this._router.navigate([url]); |
217 | 211 |
} |
Also available in: Unified diff
[Monitor-Dashboard]: Add new dashboard theme and make monitor page base on it.