chore: code formatting
This commit is contained in:
@@ -38,7 +38,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
||||
}
|
||||
: null),
|
||||
}
|
||||
const extras = {css: imports.metadata.plugins.core.extras("extras_css", {...conf.settings, error:false}) ? q["extras.css"] ?? "" : "", js: imports.metadata.plugins.core.extras("extras_js", {...conf.settings, error:false}) ? q["extras.js"] ?? "" : ""}
|
||||
const extras = {css: imports.metadata.plugins.core.extras("extras_css", {...conf.settings, error: false}) ? q["extras.css"] ?? "" : "", js: imports.metadata.plugins.core.extras("extras_js", {...conf.settings, error: false}) ? q["extras.js"] ?? "" : ""}
|
||||
const data = {q, animated: true, large: false, base: {}, config: {}, errors: [], plugins: {}, computed: {}, extras, postscripts: []}
|
||||
const experimental = new Set(decodeURIComponent(q["experimental.features"] ?? "").split(" ").map(x => x.trim().toLocaleLowerCase()).filter(x => x))
|
||||
if (conf.settings["debug.headless"])
|
||||
@@ -184,7 +184,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
||||
if ((conf.settings?.optimize === true) || (conf.settings?.optimize?.includes?.("svg")))
|
||||
rendered = await imports.svg.optimize.svg(rendered, q, experimental)
|
||||
//Verify svg
|
||||
if ((verify)&&(imports.metadata.plugins.core.extras("verify", {...conf.settings, error:false}))) {
|
||||
if ((verify) && (imports.metadata.plugins.core.extras("verify", {...conf.settings, error: false}))) {
|
||||
console.debug(`metrics/compute/${login} > verify SVG`)
|
||||
let libxmljs = null
|
||||
try {
|
||||
|
||||
@@ -265,7 +265,7 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
|
||||
console.debug(`metrics/extras > ${name} > ${key} > skipping (no error mode)`)
|
||||
return false
|
||||
}
|
||||
throw Object.assign(new Error(`Unsupported option "${key}"`), {extras:true})
|
||||
throw Object.assign(new Error(`Unsupported option "${key}"`), {extras: true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ export default async function({log = true, sandbox = false, community = {}} = {}
|
||||
logger("metrics/setup > load package.json > success")
|
||||
|
||||
//Load community templates
|
||||
if ((conf.settings.extras?.features?.includes("metrics.setup.community.templates"))||(conf.settings.extras?.features === true)||(conf.settings.extras?.default)) {
|
||||
if ((conf.settings.extras?.features?.includes("metrics.setup.community.templates")) || (conf.settings.extras?.features === true) || (conf.settings.extras?.default)) {
|
||||
if ((typeof conf.settings.community.templates === "string") && (conf.settings.community.templates.length)) {
|
||||
logger("metrics/setup > parsing community templates list")
|
||||
conf.settings.community.templates = [...new Set([...decodeURIComponent(conf.settings.community.templates).split(",").map(v => v.trim().toLocaleLowerCase()).filter(v => v)])]
|
||||
@@ -194,12 +194,12 @@ export default async function({log = true, sandbox = false, community = {}} = {}
|
||||
conf.metadata = await metadata({log})
|
||||
|
||||
//Modes
|
||||
if ((!conf.settings.modes)||(!conf.settings.modes.length))
|
||||
if ((!conf.settings.modes) || (!conf.settings.modes.length))
|
||||
conf.settings.modes = ["embed", "insights"]
|
||||
logger(`metrics/setup > setup > enabled modes ${JSON.stringify(conf.settings.modes)}`)
|
||||
|
||||
//Allowed outputs formats
|
||||
if ((!conf.settings.outputs)||(!conf.settings.outputs.length))
|
||||
if ((!conf.settings.outputs) || (!conf.settings.outputs.length))
|
||||
conf.settings.outputs = metadata.inputs.config_output.values
|
||||
else
|
||||
conf.settings.outputs = conf.settings.outputs.filter(format => metadata.inputs.config_output.values.includes(format))
|
||||
|
||||
@@ -148,7 +148,7 @@ export function formatters({timeZone} = {}) {
|
||||
message = `API error: ${status}`
|
||||
|
||||
//Error description (optional)
|
||||
if ((descriptions)&&(descriptions[status]))
|
||||
if ((descriptions) && (descriptions[status]))
|
||||
message += ` (${descriptions[status]})`
|
||||
else {
|
||||
const description = error.response?.data?.errors?.[0]?.message ?? error.response.data?.error_description ?? error.response?.data?.message ?? null
|
||||
|
||||
@@ -338,7 +338,7 @@ export default async function({sandbox = false} = {}) {
|
||||
//Render
|
||||
const q = req.query
|
||||
console.debug(`metrics/app/${login} > ${util.inspect(q, {depth: Infinity, maxStringLength: 256})}`)
|
||||
if ((q["config.presets"]) && ((conf.settings.extras?.features?.includes("metrics.setup.community.presets"))||(conf.settings.extras?.features === true)||(conf.settings.extras?.default))) {
|
||||
if ((q["config.presets"]) && ((conf.settings.extras?.features?.includes("metrics.setup.community.presets")) || (conf.settings.extras?.features === true) || (conf.settings.extras?.default))) {
|
||||
console.debug(`metrics/app/${login} > presets have been specified, loading them`)
|
||||
Object.assign(q, await presets(q["config.presets"]))
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
},
|
||||
},
|
||||
//Methods
|
||||
methods:{
|
||||
methods: {
|
||||
//Metrics insights
|
||||
async insights() {
|
||||
window.location.href = `/insights?user=${this.user1}`
|
||||
@@ -74,7 +74,7 @@
|
||||
//Metrics embed
|
||||
async embed() {
|
||||
window.location.href = `/embed?user=${this.user2}`
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user