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

Added tooltips for context help in ping and metric fields. Fixes #293 #300

Merged
merged 2 commits into from
Jan 11, 2021
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
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"postcss-load-config": "^3.0.0",
"sirv-cli": "1.0.10",
"svelte-preprocess": "^4.6.1",
"sveltejs-tippy": "^3.0.0",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.1"
}
}
8 changes: 8 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import replace from "@rollup/plugin-replace";
import svelte from "rollup-plugin-svelte";
import postcss from "rollup-plugin-postcss";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import livereload from "rollup-plugin-livereload";
Expand Down Expand Up @@ -39,6 +40,9 @@ export default {
file: "public/build/bundle.js",
},
plugins: [
postcss({
plugins: [],
}),
svelte({
// enable run-time checks when not in production
dev: !production,
Expand All @@ -56,6 +60,10 @@ export default {
__VERSION__: execSync("git rev-list HEAD --max-count=1")
.toString()
.trim(),
// workaround the way sveltejs-tippy imports tippy: https://github.com/mdauner/sveltejs-tippy/issues/117
"process.env.NODE_ENV": JSON.stringify(
nfebe marked this conversation as resolved.
Show resolved Hide resolved
production ? "production" : "development"
),
}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
Expand Down
25 changes: 25 additions & 0 deletions src/components/HelpHoverable.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script>
import tippy from "sveltejs-tippy";
import InfoIcon from "./icons/InfoIcon.svelte";

export let content;
export let link;
let props = {
content,
allowHTML: true,
placement: "top",
};
</script>

<style>
.main {
nfebe marked this conversation as resolved.
Show resolved Hide resolved
@apply inline-block;
@apply text-gray-500;
}
</style>

<div class="main">
nfebe marked this conversation as resolved.
Show resolved Hide resolved
<a href={link} use:tippy={props}>
<InfoIcon />
</a>
</div>
10 changes: 10 additions & 0 deletions src/components/icons/InfoIcon.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="w-5 inline-block">
<path
fill-rule="evenodd"
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
clip-rule="evenodd" />
</svg>
17 changes: 17 additions & 0 deletions src/data/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
bugs: {
text:
"Required. A list of bugs (e.g. Bugzilla or GitHub) that are relevant to this metric. For example, bugs that track its original implementation or later changes to it.",
link: "https://mozilla.github.io/glean/book/user/metric-parameters.html",
},
lifetime: {
text:
"Defines the lifetime of the metric. Different lifetimes affect when the metrics value is reset.",
link: "https://mozilla.github.io/glean/book/user/metric-parameters.html",
},
send_in_pings: {
text:
"Defines which pings the metric should be sent on. If not specified, the metric is sent on the 'default ping', which is the events ping for events and the metrics ping for everything else. Most metrics don't need to specify this unless they are sent on custom pings.",
link: "https://mozilla.github.io/glean/book/user/metric-parameters.html",
},
};
18 changes: 15 additions & 3 deletions src/pages/MetricDetail.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script>
import { getMetricData } from "../state/api";
import { getMetricBigQueryURL } from "../state/urls";

import Markdown from "../components/Markdown.svelte";
import NotFound from "../components/NotFound.svelte";
import HelpHoverable from "../components/HelpHoverable.svelte";
import helpText from "../data/help";

export let params;
let metricName = params.metric.replaceAll("-", ".");
Expand Down Expand Up @@ -76,7 +77,10 @@
</p>
<table class="metrics-table">
<tr>
<td>Relevant Bugs</td>
<td>
Relevant Bugs
<HelpHoverable content={helpText.bugs.text} link={helpText.bugs.link} />
</td>
<td>
{#each metric.bugs as bug}
<a
Expand All @@ -89,7 +93,12 @@
</td>
</tr>
<tr>
<td>Send In Pings</td>
<td>
Send In Pings
<HelpHoverable
content={helpText.send_in_pings.text}
link={helpText.send_in_pings.link} />
</td>
<td>
{#each metric.send_in_pings as name}
<a href={`/apps/${params.app}/pings/${name}`}> {name} </a>
Expand All @@ -104,6 +113,9 @@
target="_blank">
Lifetime
</a>
<HelpHoverable
content={helpText.lifetime.text}
link={helpText.lifetime.link} />
</td>
<td>{metric.lifetime}</td>
</tr>
Expand Down