mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
316 lines
10 KiB
316 lines
10 KiB
4 years ago
|
<template>
|
||
3 years ago
|
<div>
|
||
2 years ago
|
<h3 class="mb-5 title grey--text">Configure apps</h3>
|
||
3 years ago
|
<v-divider />
|
||
|
<div class="d-flex h-100 nc-app-store-tab mt-5">
|
||
2 years ago
|
<v-dialog v-model="pluginInstallOverlay" min-width="400px" max-width="700px" min-height="300">
|
||
3 years ago
|
<v-card
|
||
|
v-if="installPlugin && pluginInstallOverlay"
|
||
3 years ago
|
:dark="$store.state.settings.darkTheme"
|
||
|
:light="!$store.state.settings.darkTheme"
|
||
3 years ago
|
>
|
||
3 years ago
|
<app-install
|
||
|
:id="installPlugin.id"
|
||
|
:default-config="defaultConfig"
|
||
|
@close="pluginInstallOverlay = false"
|
||
|
@saved="saved()"
|
||
|
/>
|
||
3 years ago
|
</v-card>
|
||
|
</v-dialog>
|
||
4 years ago
|
|
||
3 years ago
|
<dlg-ok-new
|
||
|
v-model="pluginUninstallModal"
|
||
2 years ago
|
:heading="`Please click on submit to reset ${resetPluginRef && resetPluginRef.title}`"
|
||
3 years ago
|
ok-label="Submit"
|
||
|
type="primary"
|
||
|
@ok="confirmResetPlugin"
|
||
|
/>
|
||
4 years ago
|
|
||
3 years ago
|
<v-dialog min-width="400px" max-width="700px" min-height="300">
|
||
2 years ago
|
<v-card v-if="resetPluginRef" :dark="$store.state.settings.darkTheme" :light="!$store.state.settings.darkTheme">
|
||
|
<v-card-text> Please confirm to reset {{ resetPluginRef.title }} </v-card-text>
|
||
3 years ago
|
<v-card-actions>
|
||
2 years ago
|
<v-btn color="primary" @click="confirmResetPlugin"> Yes </v-btn>
|
||
|
<v-btn @click="pluginUninstallModal = false"> No </v-btn>
|
||
3 years ago
|
</v-card-actions>
|
||
|
</v-card>
|
||
|
</v-dialog>
|
||
4 years ago
|
|
||
3 years ago
|
<v-container class="h-100 app-container">
|
||
|
<v-row class="d-flex align-stretch">
|
||
3 years ago
|
<v-col v-for="(app, i) in filteredApps" :key="i" class="" cols="6">
|
||
3 years ago
|
<!-- @click="installApp(app)"-->
|
||
4 years ago
|
|
||
3 years ago
|
<v-card height="100%" class="elevatio app-item-card">
|
||
|
<div class="install-btn">
|
||
2 years ago
|
<v-btn v-if="app.parsedInput" x-small outlined class="caption text-capitalize" @click="installApp(app)">
|
||
|
<v-icon x-small class="mr-1"> mdi-pencil </v-icon>
|
||
|
{{ $t('general.edit') }}
|
||
3 years ago
|
</v-btn>
|
||
2 years ago
|
<v-btn v-if="app.parsedInput" x-small outlined class="caption text-capitalize" @click="resetApp(app)">
|
||
|
<v-icon x-small class="mr-1"> mdi-close-circle-outline </v-icon>
|
||
3 years ago
|
Reset
|
||
|
</v-btn>
|
||
2 years ago
|
<v-btn v-else x-small outlined class="caption text-capitalize" @click="installApp(app)">
|
||
|
<v-icon x-small class="mr-1"> mdi-plus </v-icon>
|
||
3 years ago
|
Install
|
||
|
</v-btn>
|
||
|
</div>
|
||
4 years ago
|
|
||
3 years ago
|
<div class="d-flex flex-no-wrap">
|
||
2 years ago
|
<v-avatar class="ma-3 align-self-center" size="50" tile :color="app.title === 'SES' ? '#242f3e' : ''">
|
||
3 years ago
|
<v-img v-if="app.logo" :src="app.logo" contain />
|
||
|
<v-icon v-else-if="app.icon" color="#242f3e" size="50">
|
||
|
{{ app.icon }}
|
||
|
</v-icon>
|
||
|
</v-avatar>
|
||
|
<div class="flex-grow-1">
|
||
3 years ago
|
<v-card-title class="title" v-text="app.title" />
|
||
4 years ago
|
|
||
3 years ago
|
<v-card-subtitle class="pb-1" v-text="app.description" />
|
||
|
<v-card-actions>
|
||
2 years ago
|
<div class="d-flex justify-space-between d-100 align-center">
|
||
3 years ago
|
<!-- <v-rating-->
|
||
|
<!-- full-icon="mdi-star"-->
|
||
|
<!-- readonly-->
|
||
|
<!-- length="5"-->
|
||
|
<!-- size="15"-->
|
||
|
<!-- :value="5"-->
|
||
|
<!-- />-->
|
||
4 years ago
|
|
||
3 years ago
|
<!-- <span class="subtitles" v-if="app.price && app.price !== 'Free'">${{ app.price }} / mo</span>-->
|
||
|
<!-- <span class="subtitles" v-else>Free</span>-->
|
||
3 years ago
|
</div>
|
||
|
</v-card-actions>
|
||
4 years ago
|
|
||
3 years ago
|
<!-- <v-card-actions>-->
|
||
|
<!-- <v-btn-->
|
||
|
<!-- outlined-->
|
||
|
<!-- rounded-->
|
||
|
<!-- small-->
|
||
|
<!-- >-->
|
||
|
<!-- Download-->
|
||
|
<!-- </v-btn>-->
|
||
|
<!-- </v-card-actions>-->
|
||
3 years ago
|
</div>
|
||
4 years ago
|
</div>
|
||
3 years ago
|
</v-card>
|
||
|
</v-col>
|
||
|
</v-row>
|
||
|
</v-container>
|
||
4 years ago
|
|
||
3 years ago
|
<!-- <v-navigation-drawer width="300" class="pa-1">
|
||
|
<v-text-field
|
||
|
v-model="query"
|
||
|
dense
|
||
|
hide-details
|
||
|
:placeholder="$t('placeholder.searchApps')"
|
||
|
color="primary"
|
||
|
class="search-field caption"
|
||
|
>
|
||
|
<template #prepend-inner>
|
||
|
<v-icon small class="mt-1">
|
||
|
mdi-magnify
|
||
|
</v-icon>
|
||
|
</template>
|
||
|
</v-text-field>
|
||
4 years ago
|
|
||
3 years ago
|
<v-list dense>
|
||
|
<v-list-item v-for="filter of filters" :key="filter" dense>
|
||
|
<v-checkbox
|
||
|
v-model="selectedTags"
|
||
|
class="pt-0 mt-0"
|
||
|
:value="filter"
|
||
|
hide-details
|
||
|
dense
|
||
|
:label="filter"
|
||
|
>
|
||
|
<template #label>
|
||
|
<v-icon small class="mr-1">
|
||
|
{{ icons[filter] }}
|
||
|
</v-icon>
|
||
4 years ago
|
|
||
3 years ago
|
{{ filter }}
|
||
|
</template>
|
||
|
</v-checkbox>
|
||
|
</v-list-item>
|
||
|
</v-list>
|
||
|
</v-navigation-drawer>-->
|
||
|
</div>
|
||
4 years ago
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
2 years ago
|
import AppInstall from '~/components/project/appStore/AppInstall';
|
||
|
import DlgOkNew from '~/components/utils/DlgOkNew';
|
||
4 years ago
|
|
||
|
export default {
|
||
3 years ago
|
name: 'AppStore',
|
||
|
components: { DlgOkNew, AppInstall },
|
||
4 years ago
|
data: () => ({
|
||
|
query: '',
|
||
|
selectedTags: [],
|
||
|
apps: [],
|
||
|
pluginInstallOverlay: false,
|
||
|
installPlugin: null,
|
||
|
resetPluginRef: null,
|
||
|
pluginUninstallModal: false,
|
||
3 years ago
|
defaultConfig: {},
|
||
4 years ago
|
icons: {
|
||
|
Email: 'mdi-email-outline',
|
||
|
Storage: 'mdi-usb-flash-drive-outline',
|
||
|
Notification: 'mdi-bell-outline',
|
||
|
Authentication: 'mdi-shield-account-outline',
|
||
|
Brand: 'mdi-sparkles',
|
||
|
Cache: 'mdi-cached',
|
||
|
Enterprise: 'mdi-bank',
|
||
2 years ago
|
Chat: 'mdi-chat-outline',
|
||
|
},
|
||
4 years ago
|
}),
|
||
3 years ago
|
computed: {
|
||
3 years ago
|
filters() {
|
||
3 years ago
|
return this.apps
|
||
|
.reduce((arr, app) => arr.concat(app.tags || []), [])
|
||
|
.filter((f, i, arr) => i === arr.indexOf(f))
|
||
2 years ago
|
.sort();
|
||
3 years ago
|
},
|
||
3 years ago
|
filteredApps() {
|
||
3 years ago
|
return this.apps.filter(
|
||
|
app =>
|
||
2 years ago
|
(!this.query.trim() || app.title.toLowerCase().includes(this.query.trim().toLowerCase())) &&
|
||
|
(!this.selectedTags.length || this.selectedTags.some(t => app.tags && app.tags.includes(t)))
|
||
|
);
|
||
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
async created() {
|
||
2 years ago
|
await this.loadPluginList();
|
||
4 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
async confirmResetPlugin() {
|
||
4 years ago
|
try {
|
||
3 years ago
|
await this.$api.plugin.update(this.resetPluginRef.id, {
|
||
4 years ago
|
input: null,
|
||
2 years ago
|
active: 0,
|
||
|
});
|
||
|
this.$toast.success('Plugin uninstalled successfully').goAway(5000);
|
||
|
await this.loadPluginList();
|
||
4 years ago
|
} catch (e) {
|
||
2 years ago
|
this.$toast.error(e.message).goAway(3000);
|
||
4 years ago
|
}
|
||
3 years ago
|
|
||
2 years ago
|
this.$e('a:appstore:reset', { app: this.resetPluginRef.title });
|
||
4 years ago
|
},
|
||
3 years ago
|
async saved() {
|
||
2 years ago
|
this.pluginInstallOverlay = false;
|
||
|
await this.loadPluginList();
|
||
|
this.$e('a:appstore:install', { app: this.installPlugin.title });
|
||
4 years ago
|
},
|
||
3 years ago
|
async installApp(app) {
|
||
2 years ago
|
this.pluginInstallOverlay = true;
|
||
|
this.installPlugin = app;
|
||
3 years ago
|
|
||
2 years ago
|
this.$e('c:appstore:install', { app: app.title });
|
||
4 years ago
|
},
|
||
3 years ago
|
async resetApp(app) {
|
||
2 years ago
|
this.pluginUninstallModal = true;
|
||
|
this.resetPluginRef = app;
|
||
4 years ago
|
},
|
||
3 years ago
|
async loadPluginList() {
|
||
4 years ago
|
try {
|
||
3 years ago
|
// const plugins = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginList'])
|
||
2 years ago
|
const plugins = (await this.$api.plugin.list()).list;
|
||
3 years ago
|
// plugins.push(...plugins.splice(0, 3))
|
||
2 years ago
|
this.apps = plugins.map(p => {
|
||
|
p.tags = p.tags ? p.tags.split(',') : [];
|
||
|
p.parsedInput = p.input && JSON.parse(p.input);
|
||
|
return p;
|
||
|
});
|
||
3 years ago
|
} catch (e) {}
|
||
2 years ago
|
},
|
||
|
},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
.app-item-card {
|
||
3 years ago
|
transition: 0.4s background-color;
|
||
4 years ago
|
position: relative;
|
||
|
overflow-x: hidden;
|
||
|
|
||
|
.install-btn {
|
||
|
position: absolute;
|
||
|
opacity: 0;
|
||
|
right: -100%;
|
||
|
top: 10px;
|
||
3 years ago
|
transition: 0.4s opacity, 0.4s right;
|
||
4 years ago
|
}
|
||
|
|
||
|
&:hover .install-btn {
|
||
|
right: 10px;
|
||
|
opacity: 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.app-item-card {
|
||
3 years ago
|
transition: 0.4s background-color, 0.4s transform;
|
||
4 years ago
|
|
||
|
&:hover {
|
||
|
background: rgba(123, 126, 136, 0.1) !important;
|
||
|
transform: scale(1.01);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
::v-deep {
|
||
|
.v-rating {
|
||
|
margin-left: 6px;
|
||
|
|
||
|
.v-icon {
|
||
|
padding-right: 2px;
|
||
|
padding-left: 2px;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.v-input__control .v-input__slot .v-input--selection-controls__input {
|
||
3 years ago
|
transform: scale(0.75);
|
||
4 years ago
|
}
|
||
|
|
||
|
.v-input--selection-controls .v-input__slot > .v-label {
|
||
3 years ago
|
font-size: 0.8rem;
|
||
4 years ago
|
}
|
||
|
|
||
3 years ago
|
.search-field.v-text-field > .v-input__control,
|
||
|
.search-field.v-text-field > .v-input__control > .v-input__slot {
|
||
4 years ago
|
min-height: auto;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.app-container {
|
||
|
height: 100%;
|
||
|
overflow-y: auto;
|
||
|
}
|
||
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|