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.
122 lines
3.1 KiB
122 lines
3.1 KiB
3 years ago
|
<template>
|
||
3 years ago
|
<div class="">
|
||
3 years ago
|
<div v-if="loading" class="pr-4">
|
||
3 years ago
|
<v-skeleton-loader type="text" class="mx-2 mt-4 mr-14" />
|
||
|
<v-skeleton-loader type="text@10" class="mx-2 mt-4" />
|
||
|
<v-skeleton-loader type="text@2" class="mx-2 mt-4 mr-14" />
|
||
|
</div>
|
||
|
<template v-else>
|
||
|
<v-list dense>
|
||
|
<v-list-item dense>
|
||
|
<v-list-item-subtitle>
|
||
|
<span class="caption" @dblclick="counterLoc++">Categories</span>
|
||
|
</v-list-item-subtitle>
|
||
|
</v-list-item>
|
||
|
<v-list-item-group v-model="category">
|
||
|
<v-list-item v-for="c in categories" :key="c.category" :value="c.category" dense>
|
||
|
<v-list-item-title>
|
||
3 years ago
|
<span :class="{ 'font-weight-black': category === c.category }" class="body-1">
|
||
|
{{ c.category }}
|
||
|
</span>
|
||
|
<span class="grey--text">({{ c.count }})</span>
|
||
3 years ago
|
</v-list-item-title>
|
||
|
</v-list-item>
|
||
|
</v-list-item-group>
|
||
|
</v-list>
|
||
|
<!-- v-if="counter > 4"-->
|
||
3 years ago
|
<v-btn class="ml-4" color="grey" small outlined @click="showTemplateEditor">
|
||
|
<v-icon class="mr-1" small> mdi-plus </v-icon> New template
|
||
3 years ago
|
</v-btn>
|
||
3 years ago
|
|
||
3 years ago
|
<v-tooltip bottom>
|
||
3 years ago
|
<template #activator="{ on }">
|
||
3 years ago
|
<v-btn
|
||
3 years ago
|
class="ml-4 mt-4"
|
||
3 years ago
|
color="grey"
|
||
|
small
|
||
|
outlined
|
||
|
v-on="on"
|
||
|
@click="$toast.info('Happy hacking!').goAway(3000)"
|
||
|
>
|
||
3 years ago
|
<v-icon small class="mr-1"> mdi-file-excel-outline </v-icon>
|
||
3 years ago
|
Import
|
||
|
</v-btn>
|
||
|
</template>
|
||
|
<span class="caption">Create templates from multiple Excel files</span>
|
||
|
</v-tooltip>
|
||
3 years ago
|
|
||
3 years ago
|
<v-text-field
|
||
|
v-if="$store.state.templateE > 3"
|
||
|
v-model="t"
|
||
|
autocomplete="new-password"
|
||
|
name="nc"
|
||
|
outlined
|
||
|
dense
|
||
|
:full-width="false"
|
||
|
style="width: 135px"
|
||
|
type="password"
|
||
3 years ago
|
class="caption mt-4 ml-1 mr-3 ml-4"
|
||
3 years ago
|
hide-details
|
||
|
/>
|
||
|
</template>
|
||
3 years ago
|
</div>
|
||
3 years ago
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
// import categories from './templates.categories'
|
||
3 years ago
|
export default {
|
||
3 years ago
|
name: 'Categories',
|
||
|
props: { value: String, counter: Number },
|
||
|
data: () => ({
|
||
3 years ago
|
categories: [],
|
||
3 years ago
|
loading: false,
|
||
3 years ago
|
}),
|
||
3 years ago
|
computed: {
|
||
3 years ago
|
counterLoc: {
|
||
|
get() {
|
||
3 years ago
|
return this.$store.state.templateE;
|
||
3 years ago
|
},
|
||
|
set(c) {
|
||
3 years ago
|
this.$store.commit('mutTemplateE', c);
|
||
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
category: {
|
||
|
get() {
|
||
3 years ago
|
return this.value;
|
||
3 years ago
|
},
|
||
3 years ago
|
set(v) {
|
||
3 years ago
|
this.$emit('input', v);
|
||
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
t: {
|
||
3 years ago
|
get() {
|
||
3 years ago
|
return this.$store.state.template;
|
||
3 years ago
|
},
|
||
3 years ago
|
set(t) {
|
||
3 years ago
|
this.$store.commit('mutTemplate', t);
|
||
|
},
|
||
|
},
|
||
3 years ago
|
},
|
||
|
created() {
|
||
3 years ago
|
this.loadCategories();
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
|
async loadCategories() {
|
||
3 years ago
|
this.loading = true;
|
||
3 years ago
|
try {
|
||
3 years ago
|
const res = await this.$axios.get(`${process.env.NC_API_URL}/api/v1/nc/templates/categories`);
|
||
|
this.categories = res.data;
|
||
3 years ago
|
} catch (e) {
|
||
3 years ago
|
console.log(e);
|
||
3 years ago
|
}
|
||
3 years ago
|
this.loading = false;
|
||
3 years ago
|
},
|
||
|
showTemplateEditor() {
|
||
3 years ago
|
this.$emit('showTemplateEditor');
|
||
|
},
|
||
|
},
|
||
|
};
|
||
3 years ago
|
</script>
|
||
|
|
||
3 years ago
|
<style scoped></style>
|