Skip to content

Commit 94a12f1

Browse files
committed
Corrected navigation on the analyze page.
1 parent ed8aa19 commit 94a12f1

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed
Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
import { MyIncidents, IMyIncident } from "../myincidents";
1+
import { MyIncidents, IMyIncident, IIncidentListChangedContext } from "../myincidents";
22
import Vue from "vue";
33
import { Component } from "vue-property-decorator";
44

5+
56
@Component
67
export default class AnalyzeHomeComponent extends Vue {
78
showWelcome: boolean = false;
89

910
created() {
10-
MyIncidents.Instance.subscribeOnSelectedIncident(x => {
11-
this.showWelcome = x == null;
12-
});
13-
MyIncidents.Instance.subscribeOnListChanges(x => {
14-
this.showWelcome = MyIncidents.Instance.myIncidents.length === 0;
15-
});
11+
MyIncidents.Instance.subscribeOnSelectedIncident(x => this.onIncidentSelected(x));
12+
MyIncidents.Instance.subscribeOnListChanges(x => this.onIncidentListChanged(x));
1613
MyIncidents.Instance.ready()
17-
.then(x => {
18-
this.showWelcome = MyIncidents.Instance.myIncidents.length === 0;
19-
});
14+
.then(() => this.onReady());
15+
}
16+
17+
destroyed() {
18+
MyIncidents.Instance.unsubscribe(this.onIncidentSelected);
19+
MyIncidents.Instance.unsubscribe(this.onIncidentListChanged);
20+
}
21+
22+
private onIncidentSelected(incident?: IMyIncident) {
23+
this.showWelcome = incident == null;
24+
}
25+
26+
private onIncidentListChanged(incident?: IIncidentListChangedContext) {
27+
this.showWelcome = MyIncidents.Instance.myIncidents.length === 0;
28+
}
29+
30+
private onReady() {
31+
this.showWelcome = MyIncidents.Instance.myIncidents.length === 0;
2032
}
2133
}

src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class MyIncidents {
8282
this.triggerIncidentListCallbacks();
8383

8484
if (this.selectedIncident) {
85-
if (this.selectedIncident.applicationId === applicationId || this.selectedApplicationId == null) {
85+
if (this.selectedIncident.applicationId === applicationId) {
8686
return;
8787
}
8888
}

src/Server/Coderr.Server.Web/ClientApp/components/home/navmenu/navmenu.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export default class NavMenuComponent extends Vue {
7979
}
8080
});
8181
PubSubService.Instance.subscribe(MenuApi.MessagingTopics.SetApplication, ctx => {
82-
console.log('SET', ctx.message)
8382
var msg = <MenuApi.SetApplication>ctx.message.body;
8483
this.changeApplication(msg.applicationId);
8584
});
@@ -111,9 +110,10 @@ export default class NavMenuComponent extends Vue {
111110
}
112111
}
113112

113+
const appIdStr = applicationId == null ? null : applicationId.toString();
114114
if (currentRoute.path.indexOf('/manage/') !== -1) {
115115
if (applicationId) {
116-
const route = { name: 'manageAppSettings', params: { applicationId: applicationId.toString() } };
116+
const route = { name: 'manageAppSettings', params: { applicationId: appIdStr } };
117117
this.$router.push(route);
118118
} else {
119119
const route = { name: 'manageHome' };
@@ -129,11 +129,15 @@ export default class NavMenuComponent extends Vue {
129129
}
130130
return;
131131
} else if (currentRoute.path.indexOf('/discover') === 0) {
132-
this.$router.push({ name: 'discover', params: { applicationId: applicationId.toString() } });
132+
this.$router.push({ name: 'discover', params: { applicationId: appIdStr } });
133133
} else if (currentRoute.path.indexOf('/analyze') === 0) {
134-
this.$router.push({ name: 'analyzeHome', params: { applicationId: applicationId.toString() } });
134+
if (applicationId == null) {
135+
this.$router.push({ name: 'analyzeHome' });
136+
} else {
137+
this.$router.push({ name: 'analyzeHome', params: { applicationId: appIdStr } });
138+
}
135139
} else {
136-
const route = { name: currentRoute.name, params: { applicationId: applicationId.toString() } };
140+
const route = { name: currentRoute.name, params: { applicationId: appIdStr } };
137141
this.$router.push(route);
138142
}
139143

src/Server/Coderr.Server.Web/ClientApp/services/AppRoot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class AppRoot {
124124
localForage.getItem(options.name);
125125
})
126126
.catch(reason => {
127-
console.log('ERRROR', reason);
127+
console.log('ERROR', reason);
128128
});
129129
}
130130

0 commit comments

Comments
 (0)