diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-03-11 22:47:26 +0100 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-03-11 22:47:26 +0100 |
commit | f3980069351ec91bea1999e5efff5c343a808706 (patch) | |
tree | e86760449a59c12d157f5cb5af55523ceff25d86 /src/components | |
parent | db2a2af3a4664366257957400b9eaadf795808c2 (diff) | |
download | homer-f3980069351ec91bea1999e5efff5c343a808706.tar.gz homer-f3980069351ec91bea1999e5efff5c343a808706.tar.zst homer-f3980069351ec91bea1999e5efff5c343a808706.zip |
Add a get started link when no configuration is found
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/GetStarted.vue | 35 | ||||
-rw-r--r-- | src/components/services/Portainer.vue | 25 |
2 files changed, 52 insertions, 8 deletions
diff --git a/src/components/GetStarted.vue b/src/components/GetStarted.vue new file mode 100644 index 0000000..dcabc02 --- /dev/null +++ b/src/components/GetStarted.vue | |||
@@ -0,0 +1,35 @@ | |||
1 | <template> | ||
2 | <article> | ||
3 | <div class="m-6 has-text-centered py-6"> | ||
4 | <p class="is-size-5 mb-0">No configured service found!</p> | ||
5 | <p>Check out the documentation to start building your Homer dashboard.</p> | ||
6 | <p> | ||
7 | <a | ||
8 | class="button is-primary mt-5 has-text-weight-bold" | ||
9 | href="https://github.com/bastienwirtz/homer/blob/main/README.md#getting-started" | ||
10 | target="_blank" | ||
11 | > | ||
12 | Get started | ||
13 | </a> | ||
14 | </p> | ||
15 | </div> | ||
16 | </article> | ||
17 | </template> | ||
18 | |||
19 | <script> | ||
20 | export default { | ||
21 | name: "GetStarted", | ||
22 | }; | ||
23 | </script> | ||
24 | |||
25 | <style lang="scss" scoped> | ||
26 | p { | ||
27 | color: #4a4a4a; | ||
28 | } | ||
29 | |||
30 | body #app a { | ||
31 | font-weight: 900; | ||
32 | color: #ffffff; | ||
33 | font-family: "Lato", sans-serif; | ||
34 | } | ||
35 | </style> | ||
diff --git a/src/components/services/Portainer.vue b/src/components/services/Portainer.vue index 176d92e..c7e9962 100644 --- a/src/components/services/Portainer.vue +++ b/src/components/services/Portainer.vue | |||
@@ -8,7 +8,11 @@ | |||
8 | <strong v-if="dead > 0" class="notif dead" title="Dead"> | 8 | <strong v-if="dead > 0" class="notif dead" title="Dead"> |
9 | {{ dead }} | 9 | {{ dead }} |
10 | </strong> | 10 | </strong> |
11 | <strong v-if="misc > 0" class="notif misc" title="Other (creating, paused, exited, etc.)"> | 11 | <strong |
12 | v-if="misc > 0" | ||
13 | class="notif misc" | ||
14 | title="Other (creating, paused, exited, etc.)" | ||
15 | > | ||
12 | {{ misc }} | 16 | {{ misc }} |
13 | </strong> | 17 | </strong> |
14 | </div> | 18 | </div> |
@@ -55,7 +59,10 @@ export default { | |||
55 | return ""; | 59 | return ""; |
56 | } | 60 | } |
57 | return this.containers.filter((container) => { | 61 | return this.containers.filter((container) => { |
58 | return container.State.toLowerCase() !== "running" && container.State.toLowerCase() !== "dead"; | 62 | return ( |
63 | container.State.toLowerCase() !== "running" && | ||
64 | container.State.toLowerCase() !== "dead" | ||
65 | ); | ||
59 | }).length; | 66 | }).length; |
60 | }, | 67 | }, |
61 | }, | 68 | }, |
@@ -68,18 +75,20 @@ export default { | |||
68 | "X-Api-Key": this.item.apikey, | 75 | "X-Api-Key": this.item.apikey, |
69 | }; | 76 | }; |
70 | 77 | ||
71 | this.endpoints = await this.fetch("/api/endpoints", { headers }) | 78 | this.endpoints = await this.fetch("/api/endpoints", { headers }).catch( |
72 | .catch((e) => { | 79 | (e) => { |
73 | console.error(e); | 80 | console.error(e); |
74 | }); | 81 | } |
82 | ); | ||
75 | 83 | ||
76 | let containers = []; | 84 | let containers = []; |
77 | for (let endpoint of this.endpoints) { | 85 | for (let endpoint of this.endpoints) { |
78 | const uri = `/api/endpoints/${endpoint.Id}/docker/containers/json?all=1`; | 86 | const uri = `/api/endpoints/${endpoint.Id}/docker/containers/json?all=1`; |
79 | const endpointContainers = await this.fetch(uri, { headers }) | 87 | const endpointContainers = await this.fetch(uri, { headers }).catch( |
80 | .catch((e) => { | 88 | (e) => { |
81 | console.error(e); | 89 | console.error(e); |
82 | }); | 90 | } |
91 | ); | ||
83 | 92 | ||
84 | containers = containers.concat(endpointContainers); | 93 | containers = containers.concat(endpointContainers); |
85 | } | 94 | } |