aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2022-04-07 21:45:32 +0200
committerGitHub <noreply@github.com>2022-04-07 21:45:32 +0200
commit9e1e82b0f3ce57f95f21fc09c70e2711e5105997 (patch)
treebc53c1bc8e96353d66606439912352abe94df179
parent000a46ee88742081ce8683db50f8d277b1d4f3da (diff)
parente2ebf9973bec9884154093d6bd7a9688261e6fed (diff)
downloadhomer-9e1e82b0f3ce57f95f21fc09c70e2711e5105997.tar.gz
homer-9e1e82b0f3ce57f95f21fc09c70e2711e5105997.tar.zst
homer-9e1e82b0f3ce57f95f21fc09c70e2711e5105997.zip
Merge pull request #402 from Zareix/feature/portainer-environments
Portainer service - Select environments
-rw-r--r--docs/customservices.md4
-rw-r--r--src/components/services/Portainer.vue6
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/customservices.md b/docs/customservices.md
index 49798a8..d9aa43f 100644
--- a/docs/customservices.md
+++ b/docs/customservices.md
@@ -140,6 +140,7 @@ For Prometheus you need to set the type to Prometheus and provide a url.
140This service displays info about the total number of containers managed by your Portainer instance. 140This service displays info about the total number of containers managed by your Portainer instance.
141In order to use it, you must be using Portainer version 1.11 or later. Generate an access token from the UI and pass 141In order to use it, you must be using Portainer version 1.11 or later. Generate an access token from the UI and pass
142it to the apikey field. 142it to the apikey field.
143By default, every connected environments will be checked. To select specific ones,add an "environments" entry which can be a simple string or an array containing all the selected environments name.
143 144
144See https://docs.portainer.io/v/ce-2.11/user/account-settings#access-tokens 145See https://docs.portainer.io/v/ce-2.11/user/account-settings#access-tokens
145 146
@@ -149,6 +150,9 @@ See https://docs.portainer.io/v/ce-2.11/user/account-settings#access-tokens
149 url: "http://192.168.0.151/" 150 url: "http://192.168.0.151/"
150 type: "Portainer" 151 type: "Portainer"
151 apikey: "MY-SUPER-SECRET-API-KEY" 152 apikey: "MY-SUPER-SECRET-API-KEY"
153 # environments:
154 # - "raspberry"
155 # - "local"
152``` 156```
153 157
154## Emby 158## Emby
diff --git a/src/components/services/Portainer.vue b/src/components/services/Portainer.vue
index 5f3954f..d101ecc 100644
--- a/src/components/services/Portainer.vue
+++ b/src/components/services/Portainer.vue
@@ -83,6 +83,12 @@ export default {
83 83
84 let containers = []; 84 let containers = [];
85 for (let endpoint of this.endpoints) { 85 for (let endpoint of this.endpoints) {
86 if (
87 this.item.environments &&
88 !this.item.environments.includes(endpoint.Name)
89 ) {
90 continue;
91 }
86 const uri = `/api/endpoints/${endpoint.Id}/docker/containers/json?all=1`; 92 const uri = `/api/endpoints/${endpoint.Id}/docker/containers/json?all=1`;
87 const endpointContainers = await this.fetch(uri, { headers }).catch( 93 const endpointContainers = await this.fetch(uri, { headers }).catch(
88 (e) => { 94 (e) => {