[machines] Replace bespoke clipboard behavior with clipboard-sk.
Bug: skia:13929
Change-Id: I2ccc35d3560e23aa3c198f9af0fdfb3f7e8fc5e0
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/608116
Commit-Queue: Ravi Mistry <rmistry@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
Auto-Submit: Joe Gregorio <jcgregorio@google.com>
diff --git a/machine/modules/machines-table-sk/BUILD.bazel b/machine/modules/machines-table-sk/BUILD.bazel
index ec0714d..c5b13a8 100644
--- a/machine/modules/machines-table-sk/BUILD.bazel
+++ b/machine/modules/machines-table-sk/BUILD.bazel
@@ -12,6 +12,7 @@
"//machine/modules/auto-refresh-sk",
"//machine/modules/device-editor-sk",
"//machine/modules/machine-table-columns-dialog-sk",
+ "//infra-sk/modules/clipboard-sk",
],
ts_deps = [
"//machine/modules/json:index_ts_lib",
diff --git a/machine/modules/machines-table-sk/machines-table-sk-demo.html b/machine/modules/machines-table-sk/machines-table-sk-demo.html
index b0bcb33..b7fe262 100644
--- a/machine/modules/machines-table-sk/machines-table-sk-demo.html
+++ b/machine/modules/machines-table-sk/machines-table-sk-demo.html
@@ -1,15 +1,13 @@
<!DOCTYPE html>
<html>
+ <head>
+ <title>machines-table-sk</title>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ </head>
-<head>
- <title>machines-table-sk</title>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-</head>
-
-<body class="body-sk">
- <!-- A machines-table-sk instance will be inserted here dynamically. -->
-</body>
-
-</html>
\ No newline at end of file
+ <body class="body-sk">
+ <!-- A machines-table-sk instance will be inserted here dynamically. -->
+ </body>
+</html>
diff --git a/machine/modules/machines-table-sk/machines-table-sk.ts b/machine/modules/machines-table-sk/machines-table-sk.ts
index 97c89c2..a2249b9 100644
--- a/machine/modules/machines-table-sk/machines-table-sk.ts
+++ b/machine/modules/machines-table-sk/machines-table-sk.ts
@@ -20,6 +20,7 @@
} from '../json';
import '../../../infra-sk/modules/theme-chooser-sk/theme-chooser-sk';
+import '../../../infra-sk/modules/clipboard-sk';
import 'elements-sk/error-toast-sk/index';
import 'elements-sk/icon/block-icon-sk';
import 'elements-sk/icon/cached-icon-sk';
@@ -647,13 +648,14 @@
}
private machineLink(machine: FrontendDescription): TemplateResult {
- return html`
+ return html`
<a
href="https://chromium-swarm.appspot.com/bot?id=${machine.Dimensions!.id}"
+
>
${machine.Dimensions!.id}
</a>
- <content-copy-icon-sk @click=${() => this.copyToClipboard(machine.Dimensions!.id)}></content-copy-icon-sk>
+ <clipboard-sk value="${machine.Dimensions!.id![0]}"></clipboard-sk>
`;
}
@@ -665,13 +667,6 @@
</select>`;
}
- async copyToClipboard(s: string[] | null) {
- if (!s) {
- return;
- }
- await navigator.clipboard.writeText(s[0]);
- }
-
sortArrow(fn: compareFunc<FrontendDescription>): TemplateResult {
const column = sortFunctionsByColumn.indexOf(fn);
if (column === -1) {