Hide inactive tabs’ refresh button
This commit is contained in:
parent
5931bffca3
commit
fca89aaaa6
|
@ -10,20 +10,12 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Card :item="plugin">
|
<Card :item="plugin">
|
||||||
<SettingSwitch v-if="plugin.type === 'plugin'" slot="toggle" :checked="plugin.enabled" :change="() => plugin.enabled ? plugin.stop() : plugin.start()" />
|
<SettingSwitch v-if="plugin.type === 'plugin'" slot="toggle" :checked="plugin.enabled" :change="togglePlugin" />
|
||||||
<ButtonGroup slot="controls">
|
<ButtonGroup slot="controls">
|
||||||
<Button v-tooltip="'Settings'" v-if="plugin.hasSettings" :onClick="() => showSettings(plugin)">
|
<Button v-tooltip="'Settings'" v-if="plugin.hasSettings" :onClick="() => showSettings(plugin)"><MiSettings size="18" /></Button>
|
||||||
<MiSettings size="18" />
|
<Button v-tooltip="'Reload'" :onClick="reloadPlugin"><MiRefresh size="18" /></Button>
|
||||||
</Button>
|
<Button v-tooltip="'Edit'" :onClick="editPlugin"><MiPencil size="18" /></Button>
|
||||||
<Button v-tooltip="'Reload'" :onClick="() => reloadPlugin(plugin)">
|
<Button v-tooltip="'Uninstall'" type="err"><MiDelete size="18" /></Button>
|
||||||
<MiRefresh size="18" />
|
|
||||||
</Button>
|
|
||||||
<Button v-tooltip="'Edit'" :onClick="editPlugin">
|
|
||||||
<MiPencil size="18" />
|
|
||||||
</Button>
|
|
||||||
<Button v-tooltip="'Uninstall'" type="err">
|
|
||||||
<MiDelete size="18" />
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Card>
|
</Card>
|
||||||
</template>
|
</template>
|
||||||
|
@ -52,6 +44,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
<div class="bd-tabbar" slot="header">
|
<div class="bd-tabbar" slot="header">
|
||||||
<div class="bd-button" :class="{'bd-active': local}" @click="showLocal">
|
<div class="bd-button" :class="{'bd-active': local}" @click="showLocal">
|
||||||
<h3>Local</h3>
|
<h3>Local</h3>
|
||||||
<div class="bd-material-button" @click="refreshLocal"><MiRefresh /></div>
|
<div class="bd-material-button" v-if="local" @click="refreshLocal"><MiRefresh /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bd-button" :class="{'bd-active': !local}" @click="showOnline">
|
<div class="bd-button" :class="{'bd-active': !local}" @click="showOnline">
|
||||||
<h3>Online</h3>
|
<h3>Online</h3>
|
||||||
<div class="bd-material-button"><MiRefresh /></div>
|
<div class="bd-material-button" v-if="!local" @click="refreshOnline"><MiRefresh /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bd-flex bd-flex-col bd-pluginsView">
|
<div class="bd-flex bd-flex-col bd-pluginsView">
|
||||||
<div v-if="local" class="bd-flex bd-flex-grow bd-flex-col bd-plugins-container bd-local-plugins">
|
<div v-if="local" class="bd-flex bd-flex-grow bd-flex-col bd-plugins-container bd-local-plugins">
|
||||||
<PluginCard v-for="plugin in localPlugins" :plugin="plugin" :key="plugin.id" :togglePlugin="togglePlugin" :reloadPlugin="reloadPlugin" :showSettings="showSettings" />
|
<PluginCard v-for="plugin in localPlugins" :plugin="plugin" :key="plugin.id" :togglePlugin="() => togglePlugin(plugin)" :reloadPlugin="() => reloadPlugin(plugin)" :showSettings="() => showSettings(plugin)" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!local" class="bd-spinner-container">
|
<div v-if="!local" class="bd-spinner-container">
|
||||||
<div class="bd-spinner-2"></div>
|
<div class="bd-spinner-2"></div>
|
||||||
|
@ -58,32 +58,31 @@
|
||||||
showOnline() {
|
showOnline() {
|
||||||
this.local = false;
|
this.local = false;
|
||||||
},
|
},
|
||||||
refreshLocal() {
|
async refreshLocal() {
|
||||||
(async () => {
|
await PluginManager.refreshPlugins();
|
||||||
await PluginManager.refreshPlugins();
|
|
||||||
})();
|
|
||||||
},
|
},
|
||||||
togglePlugin(plugin) {
|
async refreshOnline() {
|
||||||
|
|
||||||
|
},
|
||||||
|
async togglePlugin(plugin) {
|
||||||
// TODO Display error if plugin fails to start/stop
|
// TODO Display error if plugin fails to start/stop
|
||||||
try {
|
try {
|
||||||
if (plugin.enabled) {
|
if (plugin.enabled) {
|
||||||
PluginManager.stopPlugin(plugin);
|
await PluginManager.stopPlugin(plugin);
|
||||||
} else {
|
} else {
|
||||||
PluginManager.startPlugin(plugin);
|
await PluginManager.startPlugin(plugin);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reloadPlugin(plugin) {
|
async reloadPlugin(plugin) {
|
||||||
(async () => {
|
try {
|
||||||
try {
|
await PluginManager.reloadPlugin(plugin);
|
||||||
await PluginManager.reloadPlugin(plugin);
|
this.$forceUpdate();
|
||||||
this.$forceUpdate();
|
} catch (err) {
|
||||||
} catch (err) {
|
console.log(err);
|
||||||
console.log(err);
|
}
|
||||||
}
|
|
||||||
})();
|
|
||||||
},
|
},
|
||||||
showSettings(plugin) {
|
showSettings(plugin) {
|
||||||
return Modals.contentSettings(plugin);
|
return Modals.contentSettings(plugin);
|
||||||
|
|
|
@ -10,20 +10,12 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Card :item="theme">
|
<Card :item="theme">
|
||||||
<SettingSwitch slot="toggle" :checked="theme.enabled" :change="() => theme.enabled ? theme.disable() : theme.enable()" />
|
<SettingSwitch slot="toggle" :checked="theme.enabled" :change="toggleTheme" />
|
||||||
<ButtonGroup slot="controls">
|
<ButtonGroup slot="controls">
|
||||||
<Button v-tooltip="'Settings'" v-if="theme.hasSettings" :onClick="() => showSettings(theme)">
|
<Button v-tooltip="'Settings'" v-if="theme.hasSettings" :onClick="showSettings"><MiSettings size="18" /></Button>
|
||||||
<MiSettings size="18" />
|
<Button v-tooltip="'Reload'" :onClick="reloadTheme"><MiRefresh size="18" /></Button>
|
||||||
</Button>
|
<Button v-tooltip="'Edit'" :onClick="editTheme"><MiPencil size="18" /></Button>
|
||||||
<Button v-tooltip="'Reload'" :onClick="() => reloadTheme(theme)">
|
<Button v-tooltip="'Uninstall'" type="err"><MiDelete size="18" /></Button>
|
||||||
<MiRefresh size="18" />
|
|
||||||
</Button>
|
|
||||||
<Button v-tooltip="'Edit'" :onClick="editTheme">
|
|
||||||
<MiPencil size="18" />
|
|
||||||
</Button>
|
|
||||||
<Button v-tooltip="'Uninstall'" type="err">
|
|
||||||
<MiDelete size="18" />
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Card>
|
</Card>
|
||||||
</template>
|
</template>
|
||||||
|
@ -52,6 +44,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
<div class="bd-tabbar" slot="header">
|
<div class="bd-tabbar" slot="header">
|
||||||
<div class="bd-button" :class="{'bd-active': local}" @click="showLocal">
|
<div class="bd-button" :class="{'bd-active': local}" @click="showLocal">
|
||||||
<h3>Local</h3>
|
<h3>Local</h3>
|
||||||
<div class="bd-material-button" @click="refreshLocal"><MiRefresh /></div>
|
<div class="bd-material-button" v-if="local" @click="refreshLocal"><MiRefresh /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bd-button" :class="{'bd-active': !local}" @click="showOnline">
|
<div class="bd-button" :class="{'bd-active': !local}" @click="showOnline">
|
||||||
<h3>Online</h3>
|
<h3>Online</h3>
|
||||||
<div class="bd-material-button"><MiRefresh /></div>
|
<div class="bd-material-button" v-if="!local" @click="refreshOnline"><MiRefresh /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bd-flex bd-flex-col bd-themesView">
|
<div class="bd-flex bd-flex-col bd-themesView">
|
||||||
<div v-if="local" class="bd-flex bd-flex-grow bd-flex-col bd-themes-container bd-local-themes">
|
<div v-if="local" class="bd-flex bd-flex-grow bd-flex-col bd-themes-container bd-local-themes">
|
||||||
<ThemeCard v-for="theme in localThemes" :theme="theme" :key="theme.id" :toggleTheme="toggleTheme" :reloadTheme="reloadTheme" :showSettings="showSettings" />
|
<ThemeCard v-for="theme in localThemes" :theme="theme" :key="theme.id" :toggleTheme="() => toggleTheme(theme)" :reloadTheme="() => reloadTheme(theme)" :showSettings="() => showSettings(theme)" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!local" class="bd-spinner-container">
|
<div v-if="!local" class="bd-spinner-container">
|
||||||
<div class="bd-spinner-2"></div>
|
<div class="bd-spinner-2"></div>
|
||||||
|
@ -58,10 +58,11 @@
|
||||||
showOnline() {
|
showOnline() {
|
||||||
this.local = false;
|
this.local = false;
|
||||||
},
|
},
|
||||||
refreshLocal() {
|
async refreshLocal() {
|
||||||
(async () => {
|
await ThemeManager.refreshTheme();
|
||||||
await ThemeManager.refreshTheme();
|
},
|
||||||
})();
|
async refreshOnline() {
|
||||||
|
|
||||||
},
|
},
|
||||||
toggleTheme(theme) {
|
toggleTheme(theme) {
|
||||||
// TODO Display error if theme fails to enable/disable
|
// TODO Display error if theme fails to enable/disable
|
||||||
|
@ -75,15 +76,13 @@
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reloadTheme(theme) {
|
async reloadTheme(theme) {
|
||||||
(async () => {
|
try {
|
||||||
try {
|
await ThemeManager.reloadTheme(theme);
|
||||||
await ThemeManager.reloadTheme(theme);
|
this.$forceUpdate();
|
||||||
this.$forceUpdate();
|
} catch (err) {
|
||||||
} catch (err) {
|
console.log(err);
|
||||||
console.log(err);
|
}
|
||||||
}
|
|
||||||
})();
|
|
||||||
},
|
},
|
||||||
showSettings(theme) {
|
showSettings(theme) {
|
||||||
return Modals.contentSettings(theme);
|
return Modals.contentSettings(theme);
|
||||||
|
|
Loading…
Reference in New Issue