WIP: Plugin List

This commit is contained in:
Louis Lam 2022-09-17 01:17:04 +08:00
parent 53c06c2b06
commit 4265c6f66a
3 changed files with 44 additions and 9 deletions

View File

@ -43,6 +43,32 @@ class PluginsManager {
} }
} }
} }
/**
* Install a Plugin
* @param {string} tarGzFileURL The url of tar.gz file
* @param {number} userID User ID - Used for streaming installing progress
*/
installPlugin(tarGzFileURL, userID = undefined) {
}
/**
* Remove a plugin
* @param pluginID
*/
removePlugin(pluginID) {
}
/**
* Update a plugin
* Only available for plugins which were downloaded from the official list
* @param pluginID
*/
updatePlugin(pluginID) {
}
} }
class Plugin { class Plugin {

View File

@ -2,7 +2,10 @@
<div class="plugin-item pt-4 pb-2"> <div class="plugin-item pt-4 pb-2">
<div> <div>
<h6>{{ plugin.name }}</h6> <h6>{{ plugin.name }}</h6>
<p class="description">{{ plugin.description }}</p> <p class="description">
{{ plugin.description }}
</p>
<span class="version">{{ $t("Version") }}: {{ plugin.version }}</span>
</div> </div>
<div class="buttons"> <div class="buttons">
<button class="btn btn-primary">Install</button> <button class="btn btn-primary">Install</button>
@ -35,5 +38,8 @@ export default {
margin-bottom: 0; margin-bottom: 0;
} }
.version {
font-size: 13px;
}
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div class="mt-3">{{ pluginListMsg }}</div> <div class="mt-3">{{ remotePluginListMsg }}</div>
<PluginItem v-for="plugin in pluginList" :key="plugin.id" :plugin="plugin" /> <PluginItem v-for="plugin in remotePluginList" :key="plugin.id" :plugin="plugin" />
</div> </div>
</template> </template>
@ -15,12 +15,15 @@ export default {
data() { data() {
return { return {
pluginList: [], remotePluginList: [],
pluginListMsg: "", remotePluginListMsg: "",
}; };
}, },
computed: { computed: {
pluginList() {
return this.$parent.$parent.$parent.pluginList;
},
settings() { settings() {
return this.$parent.$parent.$parent.settings; return this.$parent.$parent.$parent.settings;
}, },
@ -33,14 +36,14 @@ export default {
}, },
async mounted() { async mounted() {
this.pluginListMsg = this.$t("Loading") + "..."; this.remotePluginListMsg = this.$t("Loading") + "...";
this.$root.getSocket().emit("getPluginList", (res) => { this.$root.getSocket().emit("getPluginList", (res) => {
if (res.ok) { if (res.ok) {
this.pluginList = res.pluginList; this.remotePluginList = res.pluginList;
this.pluginListMsg = ""; this.remotePluginListMsg = "";
} else { } else {
this.pluginListMsg = this.$t("loadingError") + " " + res.message; this.remotePluginListMsg = this.$t("loadingError") + " " + res.message;
} }
}); });
}, },