Fix a bug in topics while delete the active entity. Fix a bug with infinity loading when a topic or category is not found.
This commit is contained in:
parent
53446ed998
commit
8e978b0c9f
|
@ -141,18 +141,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.stakeholder = stakeholder;
|
||||
LinksResolver.setProperties(this.stakeholder.alias);
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type);
|
||||
if (params && params['topic'] && !this.activeTopic) {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
|
||||
} else {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
|
||||
}
|
||||
if (params && params['category']) {
|
||||
this.activeCategory = this.activeTopic.categories.find(category => category.alias === decodeURIComponent(params['category']) && this.isPublicOrIsMember(category.visibility));
|
||||
} else {
|
||||
this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.visibility));
|
||||
}
|
||||
this.setSideBar();
|
||||
this.buildMenu();
|
||||
this.setActives(params);
|
||||
this.setSideBar();
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
|
@ -164,16 +155,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}));
|
||||
} else {
|
||||
this.buildMenu();
|
||||
if (params && params['topic']) {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
|
||||
} else {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
|
||||
}
|
||||
if (params && params['category']) {
|
||||
this.activeCategory = this.activeTopic.categories.find(category => category.alias === decodeURIComponent(params['category']) && this.isPublicOrIsMember(category.visibility));
|
||||
} else {
|
||||
this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.visibility));
|
||||
}
|
||||
this.setActives(params);
|
||||
this.loading = false;
|
||||
}
|
||||
} else {
|
||||
|
@ -207,6 +189,26 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}));
|
||||
}
|
||||
|
||||
setActives(params: Params) {
|
||||
if (params && params['topic']) {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
|
||||
} else {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
|
||||
}
|
||||
if(this.activeTopic) {
|
||||
if (params && params['category']) {
|
||||
this.activeCategory = this.activeTopic.categories.find(category => category.alias === decodeURIComponent(params['category']) && this.isPublicOrIsMember(category.visibility));
|
||||
} else {
|
||||
this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.visibility));
|
||||
}
|
||||
if(!this.activeCategory) {
|
||||
this.navigateToError();
|
||||
}
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}
|
||||
|
||||
public setNotificationGroups() {
|
||||
this.entities = this.stakeholderUtils.types.map(option => option.value);
|
||||
this.notificationGroups = [];
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
</ng-template>
|
||||
<div page-content>
|
||||
<div header>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-medium-top info">
|
||||
<div *ngIf="stakeholder" class="uk-flex uk-flex-middle uk-margin-medium-top info">
|
||||
<img [src]="stakeholder | logoUrl" class="uk-margin-right uk-blend-multiply">
|
||||
<div>
|
||||
<div class="uk-text-background uk-text-bold uk-text-small">Dashboard</div>
|
||||
<div class="uk-text-background uk-text-bold uk-text-small">Monitor Dashboard</div>
|
||||
<h1 class="uk-h6 uk-margin-remove">{{stakeholder.name}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -199,17 +199,18 @@
|
|||
</div>
|
||||
</div>
|
||||
<div actions>
|
||||
<div class="uk-margin-medium-top uk-margin-bottom">
|
||||
<ul *ngIf="stakeholder.topics.length > 0 && stakeholder.topics[topicIndex].categories.length > 0 && stakeholder.topics[topicIndex].categories[categoryIndex]"
|
||||
transition-group class="uk-tab" [id]="'subCategories'">
|
||||
<ng-template ngFor [ngForOf]=" stakeholder.topics[topicIndex].categories[categoryIndex].subCategories" let-subCategory let-i="index">
|
||||
<li class="uk-visible-toggle uk-flex" [class.uk-active]="subCategoryIndex === i" transition-group-item>
|
||||
<a (click)="chooseSubcategory(i)">
|
||||
<span> {{subCategory.name}}</span>
|
||||
</a>
|
||||
<span class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left"
|
||||
[class.uk-invisible-hover]="subCategoryIndex !== i"
|
||||
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||
<div class="uk-margin-medium-top uk-grid" uk-grid>
|
||||
<div class="uk-width-expand">
|
||||
<ul *ngIf="stakeholder.topics.length > 0 && stakeholder.topics[topicIndex].categories.length > 0 && stakeholder.topics[topicIndex].categories[categoryIndex]"
|
||||
transition-group class="uk-tab" [id]="'subCategories'">
|
||||
<ng-template ngFor [ngForOf]=" stakeholder.topics[topicIndex].categories[categoryIndex].subCategories" let-subCategory let-i="index">
|
||||
<li class="uk-visible-toggle uk-flex" [class.uk-active]="subCategoryIndex === i" transition-group-item>
|
||||
<a (click)="chooseSubcategory(i)">
|
||||
<span> {{subCategory.name}}</span>
|
||||
</a>
|
||||
<span class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left"
|
||||
[class.uk-invisible-hover]="subCategoryIndex !== i"
|
||||
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||
<a class="uk-link-reset uk-flex uk-flex-middle">
|
||||
<icon [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(subCategory.visibility)"
|
||||
ratio="0.6"></icon>
|
||||
|
@ -272,15 +273,43 @@
|
|||
</ul>
|
||||
</div>
|
||||
</span>
|
||||
</li>
|
||||
</ng-template>
|
||||
<li *ngIf="isCurator">
|
||||
<a (click)="editSubCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
<span>Create new subcategory</span>
|
||||
</a>
|
||||
</li>
|
||||
</ng-template>
|
||||
<li *ngIf="isCurator">
|
||||
<a (click)="editSubCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
<span>Create new subcategory</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div *ngIf="stakeholder.topics.length > 0" class="uk-width-auto@l uk-width-1-1">
|
||||
<div class="uk-flex uk-flex-center">
|
||||
<button class="uk-button uk-button-primary uk-flex uk-flex-middle">
|
||||
<icon name="visibility" [flex]="true"></icon>
|
||||
<span class="uk-margin-small-left uk-margin-small-right">Preview</span>
|
||||
<icon name="expand_more" [flex]="true"></icon>
|
||||
</button>
|
||||
<div #element uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; flip: false">
|
||||
<ul class="uk-nav uk-dropdown-nav">
|
||||
<li><a target="_blank"
|
||||
[routerLink]="'/' + stakeholder.alias + '/' + stakeholder.topics[topicIndex].alias"
|
||||
[queryParams]="{view: 'public'}"
|
||||
(click)="hide(element)">Public view</a>
|
||||
</li>
|
||||
<li><a target="_blank" [routerLink]="'/' + stakeholder.alias + '/' +
|
||||
stakeholder.topics[topicIndex].alias"
|
||||
[queryParams]="{view: 'restricted'}"
|
||||
(click)="hide(element)">Restricted view</a>
|
||||
</li>
|
||||
<!--<li class="disabled"><a class="uk-disabled uk-text-muted"
|
||||
uk-tooltip="Note: available only in administration dashboard"
|
||||
(click)="hide(element)">Private view</a>
|
||||
</li>-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div inner>
|
||||
|
|
|
@ -351,7 +351,7 @@ export class TopicComponent implements OnInit, OnDestroy, AfterViewInit, IDeacti
|
|||
this.topicChanged(() => {
|
||||
this.stakeholder.topics.splice(this.index, 1);
|
||||
if(this.topicIndex === this.index) {
|
||||
this.chooseTopic(Math.max(0, this.index));
|
||||
this.chooseTopic(Math.max(0, this.index - 1));
|
||||
}
|
||||
}, true);
|
||||
};
|
||||
|
@ -492,7 +492,7 @@ export class TopicComponent implements OnInit, OnDestroy, AfterViewInit, IDeacti
|
|||
this.categoryChanged(() => {
|
||||
this.stakeholder.topics[this.topicIndex].categories.splice(this.index, 1);
|
||||
if(this.categoryIndex === this.index) {
|
||||
this.chooseCategory(Math.max(0, this.index));
|
||||
this.chooseCategory(Math.max(0, this.index - 1));
|
||||
}
|
||||
}, true);
|
||||
};
|
||||
|
@ -632,7 +632,7 @@ export class TopicComponent implements OnInit, OnDestroy, AfterViewInit, IDeacti
|
|||
this.subCategoryChanged(() => {
|
||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories.splice(this.index, 1);
|
||||
if(this.subCategoryIndex === this.index) {
|
||||
this.chooseSubcategory(Math.max(0, this.index));
|
||||
this.chooseSubcategory(Math.max(0, this.index - 1));
|
||||
}
|
||||
}, true);
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 06e1889730e456e86f728a31410bf550d16ac7d6
|
||||
Subproject commit 75433ae50ab42a5ad1aea2a26ec26c57e78e4a25
|
Loading…
Reference in New Issue