Display local plugins in tab

This commit is contained in:
Jiiks 2018-01-20 20:30:05 +02:00
parent 1a9fbef1f5
commit 9f0eb844c2
1 changed files with 15 additions and 8 deletions

View File

@ -1,17 +1,21 @@
<template src="./templates/PluginsView.html"></template> <template src="./templates/PluginsView.html"></template>
<script> <script>
const { PluginManager } = require('../../../../'); //#1 require of 2018~ :3
/*Imports*/ /*Imports*/
import { SettingsWrapper } from './'; import { SettingsWrapper } from './';
import PluginCard from './PluginCard.vue'; import PluginCard from './PluginCard.vue';
const components = { SettingsWrapper, PluginCard }; const components = { SettingsWrapper, PluginCard };
/*Variables*/ /*Variables*/
let dummyPlugins = [
{ "id": 0, "name": "Dummy Plugin 1", "authors": ["Jiiks"], "version": "1.0", "description": "Dummy Plugin 1 Description" },
{ "id": 1, "name": "Dummy Plugin 2", "authors": ["Jiiks", "SomeoneElse"], "version": "1.0", "description": "Dummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 DescriptionDummy Plugin 2 Description" }
];
/*Methods*/ /*Methods*/
async function refreshLocalPlugins() {
if (PluginManager.plugins.length <= 0) {
await PluginManager.loadAllPlugins();
}
this.localPlugins = PluginManager.plugins;
}
function showLocal() { function showLocal() {
this.local = true; this.local = true;
@ -21,16 +25,19 @@
this.local = false; this.local = false;
} }
const methods = { showLocal, showOnline }; const methods = { showLocal, showOnline, refreshLocalPlugins };
export default { export default {
components, components,
data() { data() {
return { return {
localPlugins: dummyPlugins, localPlugins: [],
local: true local: true
} }
}, },
methods methods,
created: function () {
this.refreshLocalPlugins();
}
} }
</script> </script>