feat(plugins/pagespeed): improved performance and PWA support, fix(plugins/posts): "dev.to" lowercase username, fix(plugins/base): repositories count, fix(plugins/followup): issues and pull requests count from archived repositories (#1101)
This commit is contained in:
@@ -32,7 +32,7 @@ export default async function({login, graphql, rest, data, q, queries, imports},
|
|||||||
Object.assign(data, {user: queried[account]})
|
Object.assign(data, {user: queried[account]})
|
||||||
postprocess?.[account]({login, data})
|
postprocess?.[account]({login, data})
|
||||||
try {
|
try {
|
||||||
Object.assign(data.user, (await graphql(queries.base[`${account}.x`]({login, account, "calendar.from": new Date(Date.now() - 14 * 24 * 60 * 60 * 1000).toISOString(), "calendar.to": (new Date()).toISOString()})))[account])
|
Object.assign(data.user, (await graphql(queries.base[`${account}.x`]({login, account, "calendar.from": new Date(Date.now() - 14 * 24 * 60 * 60 * 1000).toISOString(), "calendar.to": (new Date()).toISOString(), affiliations})))[account])
|
||||||
console.debug(`metrics/compute/${login}/base > successfully loaded bulk query`)
|
console.debug(`metrics/compute/${login}/base > successfully loaded bulk query`)
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
@@ -54,7 +54,7 @@ export default async function({login, graphql, rest, data, q, queries, imports},
|
|||||||
//Query repositories fields
|
//Query repositories fields
|
||||||
for (const field of ["totalCount", "totalDiskUsage"]) {
|
for (const field of ["totalCount", "totalDiskUsage"]) {
|
||||||
try {
|
try {
|
||||||
Object.assign(data.user.repositories, (await graphql(queries.base["field.repositories"]({login, account, field})))[account].repositories)
|
Object.assign(data.user.repositories, (await graphql(queries.base["field.repositories"]({login, account, field, affiliations})))[account].repositories)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.debug(`metrics/compute/${login}/base > failed to retrieve repositories.${field}`)
|
console.debug(`metrics/compute/${login}/base > failed to retrieve repositories.${field}`)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
query BaseFieldRepositories{
|
query BaseFieldRepositories{
|
||||||
$account(login: "$login") {
|
$account(login: "$login") {
|
||||||
repositories(last: 0) {
|
repositories(last: 0 $affiliations) {
|
||||||
$field
|
$field
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ query BaseOrganizationX {
|
|||||||
membersWithRole {
|
membersWithRole {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
repositories(last: 0) {
|
repositories(last: 0 $affiliations) {
|
||||||
totalCount
|
totalCount
|
||||||
totalDiskUsage
|
totalDiskUsage
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ query BaseUserX {
|
|||||||
repositoriesContributedTo(includeUserRepositories: true) {
|
repositoriesContributedTo(includeUserRepositories: true) {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
repositories(last: 0) {
|
repositories(last: 0 $affiliations) {
|
||||||
totalCount
|
totalCount
|
||||||
totalDiskUsage
|
totalDiskUsage
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,3 +23,12 @@
|
|||||||
base: ""
|
base: ""
|
||||||
plugin_followup: yes
|
plugin_followup: yes
|
||||||
plugin_followup_indepth: yes
|
plugin_followup_indepth: yes
|
||||||
|
|
||||||
|
- name: Exclude Archived
|
||||||
|
uses: lowlighter/metrics@latest
|
||||||
|
with:
|
||||||
|
filename: metrics.plugin.followup.archived.svg
|
||||||
|
token: ${{ secrets.METRICS_TOKEN }}
|
||||||
|
base: ""
|
||||||
|
plugin_followup: yes
|
||||||
|
plugin_followup_archived: no
|
||||||
@@ -7,7 +7,9 @@ export default async function({login, data, computed, imports, q, graphql, queri
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {sections, indepth} = imports.metadata.plugins.followup.inputs({data, account, q})
|
let {sections, indepth, archived} = imports.metadata.plugins.followup.inputs({data, account, q})
|
||||||
|
|
||||||
|
archived = archived === false ? "archived:false" : ""
|
||||||
|
|
||||||
//Define getters
|
//Define getters
|
||||||
const followup = {
|
const followup = {
|
||||||
@@ -90,7 +92,7 @@ export default async function({login, data, computed, imports, q, graphql, queri
|
|||||||
|
|
||||||
//Load user issues and pull requests
|
//Load user issues and pull requests
|
||||||
if ((account === "user") && (sections.includes("user"))) {
|
if ((account === "user") && (sections.includes("user"))) {
|
||||||
const search = await graphql(queries.followup.user({login}))
|
const search = await graphql(queries.followup.user({login, archived}))
|
||||||
followup.user = {
|
followup.user = {
|
||||||
issues: {
|
issues: {
|
||||||
get count() {
|
get count() {
|
||||||
|
|||||||
@@ -36,3 +36,8 @@ inputs:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: no
|
default: no
|
||||||
extras: yes
|
extras: yes
|
||||||
|
|
||||||
|
plugin_followup_archived:
|
||||||
|
description: Include Issues and Pull requests on the archived repositories.
|
||||||
|
type: boolean
|
||||||
|
default: yes
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
query FollowupUser {
|
query FollowupUser {
|
||||||
issues_open:search(query: "is:issue author:$login is:open", type: ISSUE, first: 0) {
|
issues_open:search(query: "is:issue author:$login is:open $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
issues_drafts:search(query: "is:issue author:$login draft:true", type: ISSUE, first: 0) {
|
issues_drafts:search(query: "is:issue author:$login draft:true $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
issues_skipped:search(query: "is:issue author:$login is:closed label:wontfix,duplicate", type: ISSUE, first: 0) {
|
issues_skipped:search(query: "is:issue author:$login is:closed label:wontfix,duplicate $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
issues_closed:search(query: "is:issue author:$login is:closed", type: ISSUE, first: 0) {
|
issues_closed:search(query: "is:issue author:$login is:closed $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
pr_open:search(query: "is:pr author:$login is:open draft:false", type: ISSUE, first: 0) {
|
pr_open:search(query: "is:pr author:$login is:open draft:false $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
pr_drafts:search(query: "is:pr author:$login draft:true", type: ISSUE, first: 0) {
|
pr_drafts:search(query: "is:pr author:$login draft:true $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
pr_closed:search(query: "is:pr author:$login is:unmerged is:closed draft:false", type: ISSUE, first: 0) {
|
pr_closed:search(query: "is:pr author:$login is:unmerged is:closed draft:false $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
pr_merged:search(query: "is:pr author:$login is:merged", type: ISSUE, first: 0) {
|
pr_merged:search(query: "is:pr author:$login is:merged $archived", type: ISSUE, first: 0) {
|
||||||
issueCount
|
issueCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,3 +30,13 @@
|
|||||||
plugin_pagespeed_token: ${{ secrets.PAGESPEED_TOKEN }}
|
plugin_pagespeed_token: ${{ secrets.PAGESPEED_TOKEN }}
|
||||||
plugin_pagespeed_url: https://lecoq.io
|
plugin_pagespeed_url: https://lecoq.io
|
||||||
|
|
||||||
|
- name: Succint report with PWA
|
||||||
|
uses: lowlighter/metrics@latest
|
||||||
|
with:
|
||||||
|
filename: metrics.plugin.pagespeed.svg
|
||||||
|
token: NOT_NEEDED
|
||||||
|
base: ""
|
||||||
|
plugin_pagespeed: yes
|
||||||
|
plugin_pagespeed_token: ${{ secrets.PAGESPEED_TOKEN }}
|
||||||
|
plugin_pagespeed_url: https://lecoq.io
|
||||||
|
plugin_pagespeed_pwa: yes
|
||||||
@@ -7,7 +7,7 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {detailed, screenshot, url} = imports.metadata.plugins.pagespeed.inputs({data, account, q})
|
let {detailed, screenshot, url, pwa} = imports.metadata.plugins.pagespeed.inputs({data, account, q})
|
||||||
//Format url if needed
|
//Format url if needed
|
||||||
if (!/^https?:[/][/]/.test(url))
|
if (!/^https?:[/][/]/.test(url))
|
||||||
url = `https://${url}`
|
url = `https://${url}`
|
||||||
@@ -15,22 +15,26 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
|||||||
const result = {url: `${protocol}//${host}`, detailed, scores: [], metrics: {}}
|
const result = {url: `${protocol}//${host}`, detailed, scores: [], metrics: {}}
|
||||||
//Load scores from API
|
//Load scores from API
|
||||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > querying api for ${result.url}`)
|
console.debug(`metrics/compute/${login}/plugins > pagespeed > querying api for ${result.url}`)
|
||||||
const scores = new Map()
|
const categories = ["performance", "accessibility", "best-practices", "seo"]
|
||||||
await Promise.all(["performance", "accessibility", "best-practices", "seo"].map(async category => {
|
if (pwa){
|
||||||
|
categories.push("pwa")
|
||||||
|
}
|
||||||
|
let categories_required = ""
|
||||||
|
for (const category of categories){
|
||||||
|
categories_required += `&category=${category}`
|
||||||
|
}
|
||||||
//Perform audit
|
//Perform audit
|
||||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > performing audit ${category}`)
|
console.debug(`metrics/compute/${login}/plugins > pagespeed > performing audit ${categories_required}`)
|
||||||
const request = await imports.axios.get(`https://www.googleapis.com/pagespeedonline/v5/runPagespeed?category=${category}&url=${url}${token ? `&key=${token}` : ""}`)
|
const request = await imports.axios.get(`https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}${categories_required}${token ? `&key=${token}` : ""}`)
|
||||||
|
for (const category of categories){
|
||||||
const {score, title} = request.data.lighthouseResult.categories[category]
|
const {score, title} = request.data.lighthouseResult.categories[category]
|
||||||
scores.set(category, {score, title})
|
result.scores.push({score, title})
|
||||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > performed audit ${category} (status code ${request.status})`)
|
|
||||||
//Store screenshot
|
|
||||||
if ((screenshot) && (category === "performance")) {
|
|
||||||
result.screenshot = request.data.lighthouseResult.audits["final-screenshot"].details.data
|
|
||||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > performed audit ${category} (status code ${request.status})`)
|
console.debug(`metrics/compute/${login}/plugins > pagespeed > performed audit ${category} (status code ${request.status})`)
|
||||||
}
|
}
|
||||||
}))
|
//Store screenshot
|
||||||
result.scores = [scores.get("performance"), scores.get("accessibility"), scores.get("best-practices"), scores.get("seo")]
|
if (screenshot) {
|
||||||
|
result.screenshot = request.data.lighthouseResult.audits["final-screenshot"].details.data
|
||||||
|
}
|
||||||
//Detailed metrics
|
//Detailed metrics
|
||||||
if (detailed) {
|
if (detailed) {
|
||||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > performing detailed audit`)
|
console.debug(`metrics/compute/${login}/plugins > pagespeed > performing detailed audit`)
|
||||||
|
|||||||
@@ -55,3 +55,8 @@ inputs:
|
|||||||
Although not mandatory, it strongly advised to create one to avoid triggering the rate limiter. See [PageSpeed documentation](https://developers.google.com/speed/docs/insights/v5/get-started) for more informations.
|
Although not mandatory, it strongly advised to create one to avoid triggering the rate limiter. See [PageSpeed documentation](https://developers.google.com/speed/docs/insights/v5/get-started) for more informations.
|
||||||
type: token
|
type: token
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
|
plugin_pagespeed_pwa:
|
||||||
|
description: Display PWA Status
|
||||||
|
type: boolean
|
||||||
|
default: no
|
||||||
@@ -8,7 +8,6 @@ export default async function({login, data, imports, q, queries, account}, {enab
|
|||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {source, descriptions, covers, limit, user} = imports.metadata.plugins.posts.inputs({data, account, q})
|
let {source, descriptions, covers, limit, user} = imports.metadata.plugins.posts.inputs({data, account, q})
|
||||||
|
|
||||||
//Retrieve posts
|
//Retrieve posts
|
||||||
console.debug(`metrics/compute/${login}/plugins > posts > processing with source ${source}`)
|
console.debug(`metrics/compute/${login}/plugins > posts > processing with source ${source}`)
|
||||||
let posts = null
|
let posts = null
|
||||||
@@ -16,6 +15,7 @@ export default async function({login, data, imports, q, queries, account}, {enab
|
|||||||
switch (source) {
|
switch (source) {
|
||||||
//Dev.to
|
//Dev.to
|
||||||
case "dev.to": {
|
case "dev.to": {
|
||||||
|
user = user.toLowerCase()
|
||||||
console.debug(`metrics/compute/${login}/plugins > posts > querying api`)
|
console.debug(`metrics/compute/${login}/plugins > posts > querying api`)
|
||||||
posts = (await imports.axios.get(`https://dev.to/api/articles?username=${user}&state=fresh`)).data.map(({title, description, published_at: date, cover_image: image, url: link}) => ({title, description, date, image, link}))
|
posts = (await imports.axios.get(`https://dev.to/api/articles?username=${user}&state=fresh`)).data.map(({title, description, published_at: date, cover_image: image, url: link}) => ({title, description, date, image, link}))
|
||||||
link = `https://dev.to/${user}`
|
link = `https://dev.to/${user}`
|
||||||
|
|||||||
@@ -26,6 +26,51 @@
|
|||||||
<section class="categories">
|
<section class="categories">
|
||||||
<% for (const {score, title} of plugins.pagespeed.scores) { %>
|
<% for (const {score, title} of plugins.pagespeed.scores) { %>
|
||||||
<div class="category column">
|
<div class="category column">
|
||||||
|
<% if(title === "PWA"){ %>
|
||||||
|
<style>.lh-gauge--pwa__wrapper:not(.lh-badged--all) .lh-gauge--pwa__logo>path{fill:#B0B0B0}.lh-gauge--pwa__logo--primary-color{fill:#304FFE}.lh-gauge--pwa__wrapper.lh-badged--all .lh-gauge--pwa__check-circle,.lh-gauge--pwa__wrapper.lh-badged--pwa-installable .lh-gauge--pwa__installable-badge,.lh-gauge--pwa__wrapper.lh-badged--pwa-optimized:not(.lh-badged--pwa-installable) .lh-gauge--pwa__na-line,.lh-gauge--pwa__wrapper:not([class*=lh-badged--]) .lh-gauge--pwa__na-line{display:inline} @media(prefers-color-scheme:dark){.lh-gauge--pwa__disc{fill:#424242}.lh-gauge--pwa__logo--secondary-color{fill:#D8B6B6}}@media(prefers-color-scheme:light){.lh-gauge--pwa__disc{fill:#e0e0e0}.lh-gauge--pwa__logo--secondary-color{fill:#3D3D3D}}</style>
|
||||||
|
<svg class="lh-gauge lh-gauge--pwa lh-gauge__wrapper lh-gauge--pwa__wrapper lh-badged--<%= score == 1 ? 'all' : 'pwa-installable' %>" viewBox="0 0 60 60" height="50" width="50">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="lh-gauge--pwa__check-circle__gradient-0" x1="50%" y1="0%" x2="50%" y2="100%">
|
||||||
|
<stop stop-color="#00C852" offset="0%"></stop>
|
||||||
|
<stop stop-color="#009688" offset="100%"></stop>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="lh-gauge--pwa__installable__shadow-gradient-0" x1="76.056%" x2="24.111%" y1="82.995%" y2="24.735%">
|
||||||
|
<stop stop-color="#A5D6A7" offset="0%"></stop>
|
||||||
|
<stop stop-color="#80CBC4" offset="100%"></stop>
|
||||||
|
</linearGradient>
|
||||||
|
<g id="lh-gauge--pwa__installable-badge-0">
|
||||||
|
<circle fill="#FFFFFF" cx="10" cy="10" r="10"></circle>
|
||||||
|
<path
|
||||||
|
fill="#009688"
|
||||||
|
d="M10 4.167A5.835 5.835 0 0 0 4.167 10 5.835 5.835 0 0 0 10 15.833 5.835 5.835 0 0 0 15.833 10 5.835 5.835 0 0 0 10 4.167zm2.917 6.416h-2.334v2.334H9.417v-2.334H7.083V9.417h2.334V7.083h1.166v2.334h2.334v1.166z"
|
||||||
|
></path>
|
||||||
|
</g>
|
||||||
|
</defs>
|
||||||
|
<g stroke="none" fill-rule="nonzero">
|
||||||
|
<circle class="lh-gauge--pwa__disc" cx="30" cy="30" r="30"></circle>
|
||||||
|
<g class="lh-gauge--pwa__logo">
|
||||||
|
<path class="lh-gauge--pwa__logo--secondary-color" d="M35.66 19.39l.7-1.75h2L37.4 15 38.6 12l3.4 9h-2.51l-.58-1.61z"></path>
|
||||||
|
<path class="lh-gauge--pwa__logo--primary-color" d="M33.52 21l3.65-9h-2.42l-2.5 5.82L30.5 12h-1.86l-1.9 5.82-1.35-2.65-1.21 3.72L25.4 21h2.38l1.72-5.2 1.64 5.2z"></path>
|
||||||
|
<path
|
||||||
|
class="lh-gauge--pwa__logo--secondary-color"
|
||||||
|
fill-rule="nonzero"
|
||||||
|
d="M20.3 17.91h1.48c.45 0 .85-.05 1.2-.15l.39-1.18 1.07-3.3a2.64 2.64 0 0 0-.28-.37c-.55-.6-1.36-.91-2.42-.91H18v9h2.3V17.9zm1.96-3.84c.22.22.33.5.33.87 0 .36-.1.65-.29.87-.2.23-.59.35-1.15.35h-.86v-2.41h.87c.52 0 .89.1 1.1.32z"
|
||||||
|
></path>
|
||||||
|
</g>
|
||||||
|
<% if(score == 1) {%>
|
||||||
|
<g class="lh-gauge--pwa__component lh-gauge--pwa__check-circle" transform="translate(18, 28)">
|
||||||
|
<circle fill="#FFFFFF" cx="12" cy="12" r="12"></circle>
|
||||||
|
<path fill="url(#lh-gauge--pwa__check-circle__gradient-0)" d="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path>
|
||||||
|
</g>
|
||||||
|
<% } else {%>
|
||||||
|
<g class="lh-gauge--pwa__component lh-gauge--pwa__installable-badge" transform="translate(20, 29)">
|
||||||
|
<path fill="url(#lh-gauge--pwa__installable__shadow-gradient-0)" d="M33.629 19.487c-4.272 5.453-10.391 9.39-17.415 10.869L3 17.142 17.142 3 33.63 19.487z"></path>
|
||||||
|
<use href="#lh-gauge--pwa__installable-badge-0"></use>
|
||||||
|
</g>
|
||||||
|
<% } %>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
<% } else { %>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" width="50" height="50" class="gauge <%= !Number.isNaN(score) ? (score >= 0.9 ? 'high' : score >= 0.5 ? 'average' : 'low') : '' %>">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" width="50" height="50" class="gauge <%= !Number.isNaN(score) ? (score >= 0.9 ? 'high' : score >= 0.5 ? 'average' : 'low') : '' %>">
|
||||||
<circle class="gauge-base" r="53" cx="60" cy="60"></circle>
|
<circle class="gauge-base" r="53" cx="60" cy="60"></circle>
|
||||||
<% if (!Number.isNaN(score)) { %>
|
<% if (!Number.isNaN(score)) { %>
|
||||||
@@ -35,6 +80,7 @@
|
|||||||
<text x="60" y="60" dominant-baseline="central" >-</text>
|
<text x="60" y="60" dominant-baseline="central" >-</text>
|
||||||
<% } %>
|
<% } %>
|
||||||
</svg>
|
</svg>
|
||||||
|
<% } %>
|
||||||
<span class="title"><%= title %></span>
|
<span class="title"><%= title %></span>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|||||||
@@ -26,6 +26,51 @@
|
|||||||
<section class="categories">
|
<section class="categories">
|
||||||
<% for (const {score, title} of plugins.pagespeed.scores) { %>
|
<% for (const {score, title} of plugins.pagespeed.scores) { %>
|
||||||
<div class="category column">
|
<div class="category column">
|
||||||
|
<% if(title === "PWA"){ %>
|
||||||
|
<style>.lh-gauge--pwa__wrapper:not(.lh-badged--all) .lh-gauge--pwa__logo>path{fill:#B0B0B0}.lh-gauge--pwa__logo--primary-color{fill:#304FFE}.lh-gauge--pwa__wrapper.lh-badged--all .lh-gauge--pwa__check-circle,.lh-gauge--pwa__wrapper.lh-badged--pwa-installable .lh-gauge--pwa__installable-badge,.lh-gauge--pwa__wrapper.lh-badged--pwa-optimized:not(.lh-badged--pwa-installable) .lh-gauge--pwa__na-line,.lh-gauge--pwa__wrapper:not([class*=lh-badged--]) .lh-gauge--pwa__na-line{display:inline} @media(prefers-color-scheme:dark){.lh-gauge--pwa__disc{fill:#424242}.lh-gauge--pwa__logo--secondary-color{fill:#D8B6B6}}@media(prefers-color-scheme:light){.lh-gauge--pwa__disc{fill:#e0e0e0}.lh-gauge--pwa__logo--secondary-color{fill:#3D3D3D}}</style>
|
||||||
|
<svg class="lh-gauge lh-gauge--pwa lh-gauge__wrapper lh-gauge--pwa__wrapper lh-badged--<%= score == 1 ? 'all' : 'pwa-installable' %>" viewBox="0 0 60 60" height="50" width="50">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="lh-gauge--pwa__check-circle__gradient-0" x1="50%" y1="0%" x2="50%" y2="100%">
|
||||||
|
<stop stop-color="#00C852" offset="0%"></stop>
|
||||||
|
<stop stop-color="#009688" offset="100%"></stop>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="lh-gauge--pwa__installable__shadow-gradient-0" x1="76.056%" x2="24.111%" y1="82.995%" y2="24.735%">
|
||||||
|
<stop stop-color="#A5D6A7" offset="0%"></stop>
|
||||||
|
<stop stop-color="#80CBC4" offset="100%"></stop>
|
||||||
|
</linearGradient>
|
||||||
|
<g id="lh-gauge--pwa__installable-badge-0">
|
||||||
|
<circle fill="#FFFFFF" cx="10" cy="10" r="10"></circle>
|
||||||
|
<path
|
||||||
|
fill="#009688"
|
||||||
|
d="M10 4.167A5.835 5.835 0 0 0 4.167 10 5.835 5.835 0 0 0 10 15.833 5.835 5.835 0 0 0 15.833 10 5.835 5.835 0 0 0 10 4.167zm2.917 6.416h-2.334v2.334H9.417v-2.334H7.083V9.417h2.334V7.083h1.166v2.334h2.334v1.166z"
|
||||||
|
></path>
|
||||||
|
</g>
|
||||||
|
</defs>
|
||||||
|
<g stroke="none" fill-rule="nonzero">
|
||||||
|
<circle class="lh-gauge--pwa__disc" cx="30" cy="30" r="30"></circle>
|
||||||
|
<g class="lh-gauge--pwa__logo">
|
||||||
|
<path class="lh-gauge--pwa__logo--secondary-color" d="M35.66 19.39l.7-1.75h2L37.4 15 38.6 12l3.4 9h-2.51l-.58-1.61z"></path>
|
||||||
|
<path class="lh-gauge--pwa__logo--primary-color" d="M33.52 21l3.65-9h-2.42l-2.5 5.82L30.5 12h-1.86l-1.9 5.82-1.35-2.65-1.21 3.72L25.4 21h2.38l1.72-5.2 1.64 5.2z"></path>
|
||||||
|
<path
|
||||||
|
class="lh-gauge--pwa__logo--secondary-color"
|
||||||
|
fill-rule="nonzero"
|
||||||
|
d="M20.3 17.91h1.48c.45 0 .85-.05 1.2-.15l.39-1.18 1.07-3.3a2.64 2.64 0 0 0-.28-.37c-.55-.6-1.36-.91-2.42-.91H18v9h2.3V17.9zm1.96-3.84c.22.22.33.5.33.87 0 .36-.1.65-.29.87-.2.23-.59.35-1.15.35h-.86v-2.41h.87c.52 0 .89.1 1.1.32z"
|
||||||
|
></path>
|
||||||
|
</g>
|
||||||
|
<% if(score == 1) {%>
|
||||||
|
<g class="lh-gauge--pwa__component lh-gauge--pwa__check-circle" transform="translate(18, 28)">
|
||||||
|
<circle fill="#FFFFFF" cx="12" cy="12" r="12"></circle>
|
||||||
|
<path fill="url(#lh-gauge--pwa__check-circle__gradient-0)" d="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path>
|
||||||
|
</g>
|
||||||
|
<% } else {%>
|
||||||
|
<g class="lh-gauge--pwa__component lh-gauge--pwa__installable-badge" transform="translate(20, 29)">
|
||||||
|
<path fill="url(#lh-gauge--pwa__installable__shadow-gradient-0)" d="M33.629 19.487c-4.272 5.453-10.391 9.39-17.415 10.869L3 17.142 17.142 3 33.63 19.487z"></path>
|
||||||
|
<use href="#lh-gauge--pwa__installable-badge-0"></use>
|
||||||
|
</g>
|
||||||
|
<% } %>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
<% } else { %>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" width="50" height="50" class="gauge <%= !Number.isNaN(score) ? (score >= 0.9 ? 'high' : score >= 0.5 ? 'average' : 'low') : '' %>">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" width="50" height="50" class="gauge <%= !Number.isNaN(score) ? (score >= 0.9 ? 'high' : score >= 0.5 ? 'average' : 'low') : '' %>">
|
||||||
<circle class="gauge-base" r="53" cx="60" cy="60"></circle>
|
<circle class="gauge-base" r="53" cx="60" cy="60"></circle>
|
||||||
<% if (!Number.isNaN(score)) { %>
|
<% if (!Number.isNaN(score)) { %>
|
||||||
@@ -35,6 +80,7 @@
|
|||||||
<text x="60" y="60" dominant-baseline="central" >-</text>
|
<text x="60" y="60" dominant-baseline="central" >-</text>
|
||||||
<% } %>
|
<% } %>
|
||||||
</svg>
|
</svg>
|
||||||
|
<% } %>
|
||||||
<span class="title"><%= title %></span>
|
<span class="title"><%= title %></span>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ export default function({faker, url, options, login = faker.internet.userName()}
|
|||||||
title: "Performance",
|
title: "Performance",
|
||||||
score: faker.datatype.float({max: 1}),
|
score: faker.datatype.float({max: 1}),
|
||||||
},
|
},
|
||||||
|
pwa: {
|
||||||
|
id: "pwa",
|
||||||
|
title: "PWA",
|
||||||
|
score: faker.datatype.number({max: 1}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
analysisUTCTimestamp: `${faker.date.recent()}`,
|
analysisUTCTimestamp: `${faker.date.recent()}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user