Skip to content

Commit

Permalink
Merge pull request #790 from InternetHealthReport/dev
Browse files Browse the repository at this point in the history
v1.3.3
  • Loading branch information
dpgiakatos authored Apr 30, 2024
2 parents cd0e2d6 + 7f9d89e commit 3d0906d
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ihr-website",
"version": "1.3.2",
"version": "1.3.3",
"private": true,
"type": "module",
"scripts": {
Expand Down
88 changes: 81 additions & 7 deletions src/components/charts/AsInterdependenciesChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ const details = ref({
const loadingHegemony = ref(true)
const loadingHegemonyCone = ref(true)
const hegemonyFilter = ref(null)
const hegemonyTier1Filter = ref(null)
const hegemonyConeFilter = ref(null)
const traces = ref(DEFAULT_TRACE)
const layout = ref(AS_INTERDEPENDENCIES_LAYOUT)
const loadingNeighbours = ref(true)
const neighbours = ref([])
const loading = ref(true)
const noData = ref('')
const noDataError = ref(true)
const route = useRoute()
const router = useRouter()
Expand All @@ -101,6 +103,15 @@ const makeHegemonyFilter = () => {
.orderedByTime()
}
const makeHegemonyTier1Filter = () => {
return new HegemonyQuery()
.originAs(0)
.asNumber([174,1299])
.addressFamily(props.addressFamily)
.timeInterval(props.startTime, props.endTime)
.orderedByTime()
}
const makeHegemonyConeFilter = () => {
return new HegemonyConeQuery()
.asNumber(props.asNumber)
Expand All @@ -109,17 +120,19 @@ const makeHegemonyConeFilter = () => {
.orderedByTime()
}
const apiCall = () => {
const apiCall = async() => {
if (props.asNumber == 0) {
return
}
updateAxesLabel()
hegemonyFilter.value = makeHegemonyFilter()
hegemonyTier1Filter.value = makeHegemonyTier1Filter()
hegemonyConeFilter.value = makeHegemonyConeFilter()
traces.value = extend(true, [], DEFAULT_TRACE)
loading.value = true
loadingHegemony.value = true
loadingHegemonyCone.value = true
await queryHegemonyTier1API()
queryHegemonyAPI()
queryHegemonyConeAPI()
Expand Down Expand Up @@ -262,6 +275,26 @@ const queryHegemonyAPI = () => {
)
}
const queryHegemonyTier1API = async() => {
try {
const result = await new Promise((resolve, reject) => {
ihr_api.hegemony(
hegemonyTier1Filter.value,
result => {
resolve(result);
},
error => {
reject(error);
}
);
});
if(result.results.length > 0) noDataError.value = false
} catch (error) {
console.error(error); //FIXME do a correct alert
}
}
const queryHegemonyConeAPI = () => {
loadingHegemonyCone.value = true
ihr_api.hegemony_cone(
Expand All @@ -283,23 +316,62 @@ const fetchHegemony = (data) => {
let anotherAsn
let minX, maxX
if (data.length == 0) {
if (noDataError.value){
traces.value = extend(true, [], DEFAULT_TRACE)
layout.value.annotations = [
{
x: 0.45,
y: 0.23,
x: 0.5,
y: 0.25,
xref: 'paper',
yref: 'paper',
text: 'Network is unreachable',
text: 'No Data Available',
showarrow: false,
font: {
size: 22,
},
},
{
x: 0.5,
y: 0.75,
xref: 'paper',
yref: 'paper',
text: 'No Data Available',
showarrow: false,
font: {
size: 22,
},
},
]
return
} else {
}
else if (data.length == 0) {
traces.value = extend(true, [], DEFAULT_TRACE)
layout.value.annotations = [
{
x: 0.5,
y: 0.25,
xref: 'paper',
yref: 'paper',
text: 'Network is Unreachable',
showarrow: false,
font: {
size: 22,
},
},
{
x: 0.5,
y: 0.75,
xref: 'paper',
yref: 'paper',
text: 'Network is Unreachable',
showarrow: false,
font: {
size: 22,
},
},
]
return
} else if (data.length > 0) {
let noDependency = false
data.forEach(elem => {
if (elem.originasn == 0) {
Expand Down Expand Up @@ -350,7 +422,9 @@ const fetchHegemony = (data) => {
'<extra></extra>',
connectgaps: false,
}
if (elem.hege === 1) {
trace.name = trace.name + ' (direct)'
}
tracesLocal[elem.asn] = trace
traces.value.push(trace)
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/layouts/layoutsChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ var IODA_ALARMS_SPECIFIC_ENTRY_TIMESERIES_LAYOUT = {
...COMMON_WITH_LEGEND,
title: '',
xaxis: { title: '', autorange: true },
yaxis: { ticksuffix: '%', autoragne: true },
yaxis: { ticksuffix: '%', range: [0, 100] },
margin: { t: 10, b: 40, l: 80, r: 80 },

}
Expand Down

0 comments on commit 3d0906d

Please sign in to comment.