From b2c8458e5db131b4405ae2a18c32bd9642646bd5 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 15 Dec 2022 18:28:12 -0800 Subject: [PATCH] add action icons, set action icons depending on instance status --- images/actions/config-active.svg | 16 ++++++++++++++++ images/actions/config-inactive.svg | 16 ++++++++++++++++ images/actions/start.svg | 1 + images/actions/stop.svg | 7 +++++++ index.html | 4 ++-- scripts/elements.js | 5 ++++- 6 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 images/actions/config-active.svg create mode 100644 images/actions/config-inactive.svg create mode 100644 images/actions/start.svg create mode 100644 images/actions/stop.svg diff --git a/images/actions/config-active.svg b/images/actions/config-active.svg new file mode 100644 index 0000000..6627ac4 --- /dev/null +++ b/images/actions/config-active.svg @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/images/actions/config-inactive.svg b/images/actions/config-inactive.svg new file mode 100644 index 0000000..5e595cf --- /dev/null +++ b/images/actions/config-inactive.svg @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/images/actions/start.svg b/images/actions/start.svg new file mode 100644 index 0000000..6f1003a --- /dev/null +++ b/images/actions/start.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/actions/stop.svg b/images/actions/stop.svg new file mode 100644 index 0000000..75ffb4d --- /dev/null +++ b/images/actions/stop.svg @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 2f58f07..5466384 100644 --- a/index.html +++ b/index.html @@ -46,8 +46,8 @@
- - + +
diff --git a/scripts/elements.js b/scripts/elements.js index 71fce14..3ce233e 100644 --- a/scripts/elements.js +++ b/scripts/elements.js @@ -51,7 +51,10 @@ class Instance extends HTMLElement { resourceDISK.innerText = (data.maxdisk / 1073741824).toFixed(3); let powerButton = this.shadowElement.querySelector("#power-btn"); - powerButton.innerText = data.status === "running" ? "Shutdown" : "Start" + powerButton.src = data.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg"; + + let configButton = this.shadowElement.querySelector("#configure-btn"); + configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg"; } }