2022-04-09 02:28:08 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2022-06-22 05:24:06 +00:00
|
|
|
<div style="margin: 1em">
|
2022-07-12 20:05:54 +00:00
|
|
|
<v-btn style="width: 100%" class="primary text-none" @click="pickFile()">
|
|
|
|
<v-icon style="margin-right: 0.5em">mdi-sd</v-icon>
|
|
|
|
Install from storage
|
|
|
|
</v-btn>
|
2022-07-07 04:25:53 +00:00
|
|
|
<input type="file" id="filePicker" accept="js,.js" />
|
2022-05-30 20:42:55 +00:00
|
|
|
</div>
|
|
|
|
|
2022-06-22 05:24:06 +00:00
|
|
|
<center v-if="plugins.length == 0" style="margin-top: 2em">
|
2022-05-30 17:54:29 +00:00
|
|
|
<v-icon size="50px">mdi-connection</v-icon>
|
|
|
|
<h2>No plugins installed</h2>
|
|
|
|
</center>
|
|
|
|
|
2022-07-12 20:05:54 +00:00
|
|
|
<!-- Plugin List Renderer -->
|
|
|
|
<v-card v-for="(plugin, index) in plugins" :key="index">
|
|
|
|
<v-card-title>{{ plugin }}</v-card-title>
|
|
|
|
|
|
|
|
<v-card-actions>
|
|
|
|
<v-btn style="width: 100%" class="error text-none" @click="remove(plugin)">
|
|
|
|
<v-icon style="margin-right: 0.5em">mdi-delete</v-icon>
|
|
|
|
Uninstall
|
|
|
|
</v-btn>
|
|
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
|
|
<!-- End Plugin List Renderer -->
|
|
|
|
|
|
|
|
|
2022-04-09 02:28:08 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-05-30 20:42:55 +00:00
|
|
|
<style scoped>
|
|
|
|
#filePicker {
|
|
|
|
visibility: hidden;
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2022-04-09 02:28:08 +00:00
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2022-05-30 17:54:29 +00:00
|
|
|
plugins: [],
|
2022-08-22 17:35:31 +00:00
|
|
|
installedVersion: process.env.version,
|
2022-04-09 02:28:08 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
async mounted() {
|
2022-05-30 20:42:55 +00:00
|
|
|
//this.plugins = await this.$tppl.list;
|
|
|
|
|
2022-05-30 22:24:37 +00:00
|
|
|
const vm = this;
|
2022-06-22 05:24:06 +00:00
|
|
|
document.getElementById("filePicker").onchange = async function () {
|
2022-05-30 20:42:55 +00:00
|
|
|
const file = document.getElementById("filePicker").files[0];
|
2022-05-30 22:24:37 +00:00
|
|
|
const contents = await vm.readFileContent(file);
|
|
|
|
await vm.$tppl.addPlugin(contents);
|
2022-07-12 20:05:54 +00:00
|
|
|
this.rebuildList();
|
2022-05-30 20:42:55 +00:00
|
|
|
};
|
2022-07-07 04:25:53 +00:00
|
|
|
|
2022-07-12 20:05:54 +00:00
|
|
|
this.rebuildList();
|
|
|
|
|
2022-04-09 02:28:08 +00:00
|
|
|
},
|
2022-05-30 20:42:55 +00:00
|
|
|
methods: {
|
2022-07-12 20:05:54 +00:00
|
|
|
async rebuildList() {
|
|
|
|
const pluginsData = await this.$tppl.list;
|
|
|
|
this.plugins = pluginsData.files;
|
|
|
|
},
|
|
|
|
|
|
|
|
async remove(plugin) {
|
|
|
|
await this.$tppl.removePlugin(plugin);
|
|
|
|
this.rebuildList();
|
2022-05-30 22:24:37 +00:00
|
|
|
},
|
|
|
|
|
2022-05-30 20:42:55 +00:00
|
|
|
pickFile() {
|
|
|
|
document.getElementById("filePicker").click();
|
2022-06-22 05:24:06 +00:00
|
|
|
},
|
|
|
|
},
|
2022-04-09 02:28:08 +00:00
|
|
|
};
|
|
|
|
</script>
|