Converted to API v2 format
This commit is contained in:
parent
a33329b77d
commit
fe20392a97
2 changed files with 41 additions and 5 deletions
|
|
@ -45,7 +45,7 @@
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<tabIcon
|
<tabIcon
|
||||||
v-for="plugin in $store.state.apiPlugins"
|
v-for="plugin in pluginsGuiList"
|
||||||
:id="plugin.id"
|
:id="plugin.id"
|
||||||
:key="plugin.id"
|
:key="plugin.id"
|
||||||
:require-connection="plugin.requiresConnection"
|
:require-connection="plugin.requiresConnection"
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
</tabContent>
|
</tabContent>
|
||||||
|
|
||||||
<tabContent
|
<tabContent
|
||||||
v-for="plugin in $store.state.apiPlugins"
|
v-for="plugin in pluginsGuiList"
|
||||||
:id="plugin.id"
|
:id="plugin.id"
|
||||||
:key="plugin.id"
|
:key="plugin.id"
|
||||||
:require-connection="plugin.requiresConnection"
|
:require-connection="plugin.requiresConnection"
|
||||||
|
|
@ -126,6 +126,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
// Import generic components
|
// Import generic components
|
||||||
import tabIcon from "./genericComponents/tabIcon";
|
import tabIcon from "./genericComponents/tabIcon";
|
||||||
import tabContent from "./genericComponents/tabContent";
|
import tabContent from "./genericComponents/tabContent";
|
||||||
|
|
@ -155,18 +157,52 @@ export default {
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
|
plugins: {},
|
||||||
currentTab: "status",
|
currentTab: "status",
|
||||||
showControlBar: true
|
showControlBar: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
pluginApiUri: function() {
|
pluginsUri: function() {
|
||||||
return this.$store.getters.uri + "/plugin";
|
return `${this.$store.getters.baseUri}/api/v2/plugins`;
|
||||||
|
},
|
||||||
|
pluginsGuiList: function() {
|
||||||
|
// List of plugin GUIs, obtained from this.plugins values
|
||||||
|
console.log("Recalculating plugins");
|
||||||
|
var pluginGuis = [];
|
||||||
|
for (let plugin of Object.values(this.plugins)) {
|
||||||
|
if (plugin.gui) {
|
||||||
|
pluginGuis.push(plugin.gui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pluginGuis;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created: function() {
|
||||||
|
// Watch for host 'ready', then update status
|
||||||
|
this.$store.watch(
|
||||||
|
(state, getters) => {
|
||||||
|
return getters.ready;
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.updatePlugins();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
updatePlugins: function() {
|
||||||
|
axios
|
||||||
|
.get(this.pluginsUri)
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
this.plugins = response.data;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.modalError(error); // Let mixin handle error
|
||||||
|
});
|
||||||
|
},
|
||||||
setTab: function(event, tab) {
|
setTab: function(event, tab) {
|
||||||
if (this.currentTab == tab) {
|
if (this.currentTab == tab) {
|
||||||
this.showControlBar = !this.showControlBar;
|
this.showControlBar = !this.showControlBar;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
pluginApiUri: function() {
|
pluginApiUri: function() {
|
||||||
return this.$store.getters.uri + "/plugin";
|
return `${this.$store.getters.baseUri}/api/v2/plugins`;
|
||||||
},
|
},
|
||||||
|
|
||||||
submitApiUri: function() {
|
submitApiUri: function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue