Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix/Handle null pointer when the as hegemony graph clicked in the network report #642

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/ReactiveChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ export default {

graphDiv.on('plotly_click', (eventData) => {
if (eventData && eventData.points ) {
const point = eventData.points[0]
this.$emit('plotly-click', point)
this.$emit('plotly-click', eventData)
}
})

Expand Down
4 changes: 2 additions & 2 deletions src/views/Countries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ export default {
//this.$router.replace({ query: Object.assign({}, this.$route.query, { hege_dt: clickData.points[0].x, hege_tb: table }) });
query: Object.assign({}, this.$route.query, {
af: this.family,
last: this.intervalCurrent.dayDiff(),
date: this.$options.filters.ihrUtcString(this.intervalCurrent.end, false),
last: this.interval.dayDiff(),
date: this.$options.filters.ihrUtcString(this.interval.end, false),
}),
})
this.loadingStatus = LOADING_STATUS.LOADED
Expand Down
6 changes: 3 additions & 3 deletions src/views/GlobalReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="text-center">
<div class="text-h1">{{ title }}</div>
<div class="text-h3">
{{ intervalCurrent.dayDiff() }}-day report ending on {{ reportDateFmt }}
{{ interval.dayDiff() }}-day report ending on {{ reportDateFmt }}
<date-time-picker :min="minDate" :max="maxDate" :value="maxDate" @input="setReportDate" hideTime
class="IHR_subtitle_calendar" />
</div>
Expand Down Expand Up @@ -74,8 +74,8 @@ export default {
pushRoute() {
const currentQuery = {
filter_level: String(this.filterLevel),
last: String(this.intervalCurrent.dayDiff()),
date: this.$options.filters.ihrUtcString(this.intervalCurrent.end, false),
last: String(this.interval.dayDiff()),
date: this.$options.filters.ihrUtcString(this.interval.end, false),
};
if (JSON.stringify(currentQuery) !== JSON.stringify(this.$route.query)) {
const newRoute = { query: currentQuery, hash: this.$route.hash }
Expand Down
6 changes: 3 additions & 3 deletions src/views/Networks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ export default {
//this.$router.replace({ query: Object.assign({}, this.$route.query, { hege_dt: clickData.points[0].x, hege_tb: table }) });
query: Object.assign({}, this.$route.query, {
af: this.family,
last: this.intervalCurrent.dayDiff(),
date: this.$options.filters.ihrUtcString(this.intervalCurrent.end, false),
last: this.interval.dayDiff(),
date: this.$options.filters.ihrUtcString(this.interval.end, false),
}),
})
},
Expand All @@ -310,7 +310,7 @@ export default {
this.show.hegemony = results.results[0].hegemony
})

this.asName = results.results[0].name
if (results.results[0].name && results.results[0].name.length !== 0) this.asName = results.results[0].name;
this.loadingStatus = LOADING_STATUS.LOADED
this.fetch = true
})
Expand Down
4 changes: 2 additions & 2 deletions src/views/ROV.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export default {
//this.$router.replace({ query: Object.assign({}, this.$route.query, { hege_dt: clickData.points[0].x, hege_tb: table }) });
query: Object.assign({}, this.$route.query, {
af: this.family,
last: this.intervalCurrent.dayDiff(),
date: this.$options.filters.ihrUtcString(this.intervalCurrent.end, false),
last: this.interval.dayDiff(),
date: this.$options.filters.ihrUtcString(this.interval.end, false),
}),
})
this.loadingStatus = LOADING_STATUS.LOADED
Expand Down
2 changes: 1 addition & 1 deletion src/views/charts/PrefixHegemonyChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export default {
const toObserve = new IntersectionObserver(entries =>{
const [entry] = entries
const isVisible = entry.intersectionRatio === 1
if(!isVisible){
if(!isVisible && this.$refs.selectValidity){
this.$refs.selectValidity.hidePopup()
}
})
Expand Down
3 changes: 2 additions & 1 deletion src/views/charts/global/TreeMapAggregatedAlarmsReactive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export default {
}
},
methods: {
onTreemapNodeClicked(treemapPointClicked) {
onTreemapNodeClicked(clickedData) {
if (this.clickProcessing) return;
const treemapPointClicked = clickedData.points[0];
if (treemapPointClicked.pointNumber !== undefined && treemapPointClicked.parent == '') {
this.clickProcessing = true;
this.$emit('treemap-node-clicked', treemapPointClicked.label)
Expand Down
4 changes: 2 additions & 2 deletions src/views/charts/global/WorldMapAggregatedAlarmsReactive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default {
}
},
methods: {
onCountryClicked(newPlotlyClickedData) {
const country = newPlotlyClickedData.text
onCountryClicked(clickedData) {
const country = clickedData.points[0].text
this.$emit('worldmap-country-clicked', country)
}
}
Expand Down
35 changes: 16 additions & 19 deletions src/views/mixin/reportMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ export default {
default: false,
},
},
created() {
let interval = null;
try {
interval = this.getDateInterval(this.$route.query.date + 'T00:00+00:00', this.$route.query.last)
} catch (e) {
interval = this.getDateInterval(new Date(), this.defaultTimeRangeVal)
}
this.$set(this, 'interval', interval);
},
data() {
return {
intervalUpdated: null,
interval: null,
fetch: false,
}
},
Expand All @@ -40,7 +49,7 @@ export default {
},
methods: {
setReportDate(event) {
this.intervalUpdated = this.getDateInterval(event, this.defaultTimeRangeVal);
this.interval = this.getDateInterval(event, this.defaultTimeRangeVal);
},
resizeCharts() {
setTimeout(() => {
Expand Down Expand Up @@ -77,32 +86,20 @@ export default {
day: '2-digit',
timeZone: 'UTC',
}
return this.intervalCurrent.end.toLocaleDateString(undefined, options)
return this.interval.end.toLocaleDateString(undefined, options)
},
startTime() {
return this.intervalCurrent.begin
return this.interval.begin
},
endTime() {
return this.intervalCurrent.end
return this.interval.end
},
intervalCurrent() {
return this.intervalUpdated ? this.intervalUpdated : this.interval
},
interval() {
let intervalVal = null;
try {
intervalVal = this.getDateInterval(this.$route.query.date + 'T00:00+00:00', this.$route.query.last)
} catch (e) {
intervalVal = this.getDateInterval(new Date(), this.defaultTimeRangeVal)
}
return intervalVal
},
defaultTimeRangeVal(){
defaultTimeRangeVal() {
return this.defaultTimeRange ? this.defaultTimeRange : 3
}
},
watch: {
intervalUpdated(){
interval() {
this.pushRoute()
},
},
Expand Down
Loading