Skip to content

Commit

Permalink
improvement(TestRunInfo.svelte): Add popup hints for copy buttons
Browse files Browse the repository at this point in the history
This commit adds success indicators when user does copy-to-clipboard
actions, making it less confusing.

Fixes scylladb#431
  • Loading branch information
k0machi committed Dec 19, 2024
1 parent 00074a8 commit b4c3578
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontend/TestRun/IssueTemplate.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
getOperatorPackage, getOperatorHelmPackage, getOperatorHelmRepoPackage,
} from "../Common/RunUtils";
import { markdownRendererOptions } from "../markdownOptions";
import { sendMessage } from "../Stores/AlertStore";
let renderedElement;
let templateElement;
let issueTemplateText = "";
Expand All @@ -21,6 +22,7 @@
const copyTemplateToClipboard = function () {
navigator.clipboard.writeText(templateElement.innerText);
sendMessage("success", "Issue template has been copied to your clipboard");
};
let scyllaServerPackage = getScyllaPackage(test_run.packages);
Expand Down
2 changes: 2 additions & 0 deletions frontend/TestRun/ResourcesInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
faCopy,
faPlay,
} from "@fortawesome/free-solid-svg-icons";
import { sendMessage } from "../Stores/AlertStore";
let sortHeaders = {
creationTime: ["instance_info", "creation_time"],
terminationTime: ["instance_info", "termination_time"],
Expand Down Expand Up @@ -88,6 +89,7 @@
navigator.clipboard.writeText(
`${regions} hydra clean-resources --backend ${backend} --test-id ${run_id}`
);
sendMessage("success", `\`${regions} hydra clean-resources --backend ${backend} --test-id ${run_id}\` has been copied to your clipboard`);
}}>
<Fa icon={faCopy} /> Hydra Clean Resources
</button>
Expand Down
2 changes: 2 additions & 0 deletions frontend/TestRun/StructuredEvent.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import { faCopy, faDotCircle } from "@fortawesome/free-solid-svg-icons";
import Fa from "svelte-fa";
import { sendMessage } from "../Stores/AlertStore";
export let event;
Expand Down Expand Up @@ -38,6 +39,7 @@
class="btn btn-light"
on:click={() => {
navigator.clipboard.writeText(event.eventText);
sendMessage("success", "Event text has been copied to your clipboard");
}}
>
<Fa icon={faCopy} />
Expand Down
3 changes: 3 additions & 0 deletions frontend/TestRun/TestRunInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import JenkinsBuildModal from "./Jenkins/JenkinsBuildModal.svelte";
import JenkinsCloneModal from "./Jenkins/JenkinsCloneModal.svelte";
import { createEventDispatcher } from "svelte";
import { sendMessage } from "../Stores/AlertStore";
export let test_run = {};
export let release;
export let group;
Expand Down Expand Up @@ -286,6 +287,7 @@
navigator.clipboard.writeText(
cmd_hydraInvestigateShowMonitor
);
sendMessage("success", `\`${cmd_hydraInvestigateShowMonitor}\` has been copied to your clipboard`);
}}><Fa icon={faCopy} /> Hydra Show Monitor</button
>
<button
Expand All @@ -295,6 +297,7 @@
navigator.clipboard.writeText(
cmd_hydraInvestigateShowLogs
);
sendMessage("success", `\`${cmd_hydraInvestigateShowLogs}\` has been copied to your clipboard`);
}}><Fa icon={faCopy} /> Hydra Show Logs</button
>
{/if}
Expand Down

0 comments on commit b4c3578

Please sign in to comment.