Version 1.9 (#6)
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
return computed.plugins.habits = null
|
||||
if (!q.habits)
|
||||
return computed.plugins.habits = null
|
||||
console.debug(`metrics/plugins/habits/${login} > started`)
|
||||
console.debug(`metrics/compute/${login}/plugins > habits`)
|
||||
computed.svg.height += 70
|
||||
|
||||
//Plugin execution
|
||||
pending.push(new Promise(async solve => {
|
||||
@@ -44,12 +45,14 @@
|
||||
}
|
||||
//Save results
|
||||
computed.plugins.habits = habits
|
||||
console.debug(`metrics/plugins/habits/${login} > ${JSON.stringify(computed.plugins.habits)}`)
|
||||
console.debug(`metrics/compute/${login}/plugins > habits > success`)
|
||||
console.debug(JSON.stringify(computed.plugins.habits))
|
||||
solve()
|
||||
}
|
||||
catch (error) {
|
||||
//Generic error
|
||||
computed.plugins.habits = {error:`An error occured`}
|
||||
console.debug(`metrics/compute/${login}/plugins > habits > error`)
|
||||
console.debug(error)
|
||||
solve()
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
return computed.plugins.lines = null
|
||||
if (!q.lines)
|
||||
return computed.plugins.lines = null
|
||||
console.debug(`metrics/plugins/lines/${login} > started`)
|
||||
console.debug(`metrics/compute/${login}/plugins > lines`)
|
||||
computed.svg.height += 20
|
||||
|
||||
//Plugin execution
|
||||
pending.push(new Promise(async solve => {
|
||||
@@ -37,12 +38,14 @@
|
||||
lines.deleted = format(lines.deleted)
|
||||
//Save results
|
||||
computed.plugins.lines = {...lines}
|
||||
console.debug(`metrics/plugins/lines/${login} > ${JSON.stringify(computed.plugins.lines)}`)
|
||||
console.debug(`metrics/compute/${login}/plugins > lines > success`)
|
||||
console.debug(JSON.stringify(computed.plugins.lines))
|
||||
solve()
|
||||
}
|
||||
catch (error) {
|
||||
//Generic error
|
||||
computed.plugins.pagespeed = {error:`An error occured`}
|
||||
computed.plugins.lines = {error:`An error occured`}
|
||||
console.debug(`metrics/compute/${login}/plugins > lines > error`)
|
||||
console.debug(error)
|
||||
solve()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
return computed.plugins.pagespeed = null
|
||||
if (!q.pagespeed)
|
||||
return computed.plugins.pagespeed = null
|
||||
console.debug(`metrics/plugins/pagespeed/${login} > started`)
|
||||
console.debug(`metrics/compute/${login}/plugins > pagespeed`)
|
||||
computed.svg.height += 130
|
||||
|
||||
//Plugin execution
|
||||
pending.push(new Promise(async solve => {
|
||||
@@ -26,18 +27,20 @@
|
||||
}))
|
||||
//Save results
|
||||
computed.plugins.pagespeed = {url, scores:[scores.get("performance"), scores.get("accessibility"), scores.get("best-practices"), scores.get("seo")]}
|
||||
console.debug(`metrics/plugins/pagespeed/${login} > ${JSON.stringify(computed.plugins.pagespeed)}`)
|
||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > success`)
|
||||
console.debug(JSON.stringify(computed.plugins.pagespeed))
|
||||
solve()
|
||||
}
|
||||
catch (error) {
|
||||
//Thrown when token is incorrect
|
||||
if ((error.response)&&(error.response.status)) {
|
||||
computed.plugins.pagespeed = {url, error:`PageSpeed token error (code ${error.response.status})`}
|
||||
console.debug(`metrics/plugins/traffic/${login} > ${error.response.status}`)
|
||||
console.debug(`metrics/plugins/pagespeed/${login} > ${error.response.status}`)
|
||||
return solve()
|
||||
}
|
||||
//Generic error
|
||||
computed.plugins.pagespeed = {error:`An error occured`}
|
||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > error`)
|
||||
console.debug(error)
|
||||
solve()
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
return computed.plugins.selfskip = null
|
||||
if (!q.selfskip)
|
||||
return computed.plugins.selfskip = null
|
||||
console.debug(`metrics/plugins/selfskip/${login} > started`)
|
||||
console.debug(`metrics/compute/${login}/plugins > selfskip`)
|
||||
|
||||
//Plugin execution
|
||||
pending.push(new Promise(async solve => {
|
||||
@@ -20,12 +20,14 @@
|
||||
}
|
||||
//Save results
|
||||
computed.plugins.selfskip = {commits}
|
||||
console.debug(`metrics/plugins/selfskip/${login} > ${JSON.stringify(computed.plugins.selfskip)}`)
|
||||
console.debug(`metrics/compute/${login}/plugins > selfskip > success`)
|
||||
console.debug(JSON.stringify(computed.plugins.selfskip))
|
||||
solve()
|
||||
}
|
||||
catch (error) {
|
||||
//Generic error
|
||||
computed.plugins.selfskip = {error:`An error occured`}
|
||||
console.debug(`metrics/compute/${login}/plugins > selfskip > error`)
|
||||
console.debug(error)
|
||||
solve()
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
return computed.plugins.traffic = null
|
||||
if (!q.traffic)
|
||||
return computed.plugins.traffic = null
|
||||
console.debug(`metrics/plugins/traffic/${login} > started`)
|
||||
console.debug(`metrics/compute/${login}/plugins > traffic`)
|
||||
computed.svg.height += 20
|
||||
|
||||
//Plugin execution
|
||||
pending.push(new Promise(async solve => {
|
||||
@@ -28,18 +29,20 @@
|
||||
views.uniques = format(views.uniques)
|
||||
//Save results
|
||||
computed.plugins.traffic = {views}
|
||||
console.debug(`metrics/plugins/traffic/${login} > ${JSON.stringify(computed.plugins.traffic)}`)
|
||||
console.debug(`metrics/compute/${login}/plugins > traffic > success`)
|
||||
console.debug(JSON.stringify(computed.plugins.traffic))
|
||||
solve()
|
||||
}
|
||||
catch (error) {
|
||||
//Thrown when token has unsufficient permissions
|
||||
if (error.status === 403) {
|
||||
computed.plugins.traffic = {error:`Insufficient token rights`}
|
||||
console.debug(`metrics/plugins/traffic/${login} > ${error.status}`)
|
||||
console.debug(`metrics/compute/${login}/plugins > error > 403 (insufficient token rights)`)
|
||||
return solve()
|
||||
}
|
||||
//Generic error
|
||||
computed.plugins.traffic = {error:`An error occured`}
|
||||
console.debug(`metrics/compute/${login}/plugins > error`)
|
||||
console.debug(error)
|
||||
solve()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user