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.
654 lines
19 KiB
654 lines
19 KiB
4 years ago
|
<template>
|
||
3 years ago
|
<v-container class="h-100 j-excel-container backgroundColor pa-0 ma-0" fluid>
|
||
4 years ago
|
<div v-if="modelName" class="model-name text-capitalize">
|
||
|
<span class="font-weight-bold"> {{ modelName }}</span> <span class="font-weight-regular ml-1">( Main View )</span>
|
||
|
</div>
|
||
3 years ago
|
<v-toolbar
|
||
3 years ago
|
height="32"
|
||
|
dense
|
||
|
class="nc-table-toolbar elevation-0 xc-toolbar xc-border-bottom mx-1"
|
||
|
style="z-index: 7"
|
||
3 years ago
|
>
|
||
3 years ago
|
<div class="d-flex xc-border align-center search-box" style="min-width: 156px">
|
||
4 years ago
|
<v-menu bottom offset-y>
|
||
3 years ago
|
<template #activator="{ on }">
|
||
3 years ago
|
<div style="min-width: 56px" v-on="on">
|
||
3 years ago
|
<v-icon class="ml-2" small color="grey"> mdi-magnify </v-icon>
|
||
|
|
||
|
<v-icon color="grey" class="pl-0 pa-1" small> mdi-menu-down </v-icon>
|
||
4 years ago
|
</div>
|
||
|
</template>
|
||
3 years ago
|
<v-list v-if="meta" dense>
|
||
3 years ago
|
<v-list-item v-for="col in meta.columns" :key="col.column_name" @click="searchField = col.column_name">
|
||
3 years ago
|
<span class="caption">{{ col.column_name }}</span>
|
||
4 years ago
|
</v-list-item>
|
||
|
</v-list>
|
||
|
</v-menu>
|
||
|
|
||
3 years ago
|
<v-divider vertical />
|
||
4 years ago
|
|
||
|
<v-text-field
|
||
|
v-model="searchQuery"
|
||
3 years ago
|
autocomplete="off"
|
||
3 years ago
|
style="min-width: 100px; width: 150px"
|
||
4 years ago
|
flat
|
||
|
dense
|
||
|
solo
|
||
|
hide-details
|
||
3 years ago
|
:placeholder="searchField ? `Search '${searchField}' column` : 'Search all columns'"
|
||
|
class="elevation-0 pa-0 flex-grow-1 caption search-field"
|
||
4 years ago
|
@keyup.enter="loadTableData"
|
||
|
@blur="loadTableData"
|
||
3 years ago
|
/>
|
||
4 years ago
|
</div>
|
||
|
|
||
3 years ago
|
<span v-if="relationType && false" class="caption grey--text"
|
||
|
>{{ refTable }}({{ relationPrimaryValue }}) -> {{ relationType === 'hm' ? ' Has Many ' : ' Belongs To ' }} ->
|
||
|
{{ table }}</span
|
||
|
>
|
||
4 years ago
|
|
||
3 years ago
|
<div class="d-inline-flex">
|
||
3 years ago
|
<fields-menu v-model="showFields" :field-list="fieldList" :is-locked="isLocked" />
|
||
3 years ago
|
|
||
3 years ago
|
<sort-list-menu v-model="sortList" :field-list="fieldList" :is-locked="isLocked" />
|
||
3 years ago
|
|
||
3 years ago
|
<column-filter-menu v-model="filters" :field-list="fieldList" :is-locked="isLocked" />
|
||
3 years ago
|
|
||
|
<share-view-menu @share="$refs.drawer && $refs.drawer.genShareLink()" />
|
||
|
|
||
|
<MoreActions
|
||
3 years ago
|
ref="csvExportImport"
|
||
|
:meta="meta"
|
||
|
:nodes="nodes"
|
||
|
:query-params="{
|
||
|
fieldsOrder,
|
||
|
fieldFilter,
|
||
|
sortList,
|
||
3 years ago
|
showFields,
|
||
3 years ago
|
}"
|
||
|
:selected-view="selectedView"
|
||
|
:is-view="true"
|
||
|
@showAdditionalFeatOverlay="showAdditionalFeatOverlay($event)"
|
||
|
@webhook="showAdditionalFeatOverlay('webhooks')"
|
||
|
/>
|
||
3 years ago
|
</div>
|
||
3 years ago
|
<v-spacer class="h-100" @dblclick="debug = true" />
|
||
3 years ago
|
|
||
3 years ago
|
<template>
|
||
|
<debug-metas v-if="debug" class="mr-3" />
|
||
3 years ago
|
<lock-menu v-if="_isUIAllowed('view-type')" v-model="viewStatus.type" />
|
||
3 years ago
|
<v-icon small class="mx-n1" color="grey lighten-1"> mdi-circle-small </v-icon>
|
||
|
<x-icon tooltip="Reload view data" icon.class="nc-table-reload-btn mx-1" small @click="loadTableData">
|
||
3 years ago
|
mdi-reload
|
||
|
</x-icon>
|
||
|
</template>
|
||
3 years ago
|
|
||
|
<x-btn
|
||
|
tooltip="Toggle navigation drawer"
|
||
|
outlined
|
||
|
small
|
||
|
text
|
||
3 years ago
|
:btn-class="{ 'primary lighten-5 nc-toggle-nav-drawer': !toggleDrawer }"
|
||
3 years ago
|
@click="toggleDrawer = !toggleDrawer"
|
||
|
>
|
||
3 years ago
|
<v-icon small class="mx-0" color="grey darken-3">
|
||
3 years ago
|
{{ toggleDrawer ? 'mdi-door-closed' : 'mdi-door-open' }}
|
||
|
</v-icon>
|
||
|
</x-btn>
|
||
4 years ago
|
</v-toolbar>
|
||
3 years ago
|
<div
|
||
|
:class="`cell-height-${cellHeight}`"
|
||
3 years ago
|
style="overflow: auto; transition: width 500ms; height: calc(100% - 36px)"
|
||
3 years ago
|
class="d-flex backgroundColor"
|
||
4 years ago
|
>
|
||
|
<div class="flex-grow-1 h-100" style="overflow-y: auto">
|
||
3 years ago
|
<div ref="table" style="overflow: auto; width: 100%; height: calc(100% - 36px)">
|
||
3 years ago
|
<v-skeleton-loader v-if="loadingData" type="table" />
|
||
4 years ago
|
|
||
3 years ago
|
<template v-else-if="selectedView && (selectedView.type === 'view' || selectedView.show_as === 'grid')">
|
||
4 years ago
|
<xc-grid-view
|
||
3 years ago
|
:columns-width.sync="columnsWidth"
|
||
4 years ago
|
:meta="meta"
|
||
|
:data="data"
|
||
|
:available-columns="availableColumns"
|
||
|
:show-fields="showFields"
|
||
|
:belongs-to="[]"
|
||
|
:has-many="[]"
|
||
3 years ago
|
:is-public-view="true"
|
||
3 years ago
|
:nodes="{ dbAlias: '' }"
|
||
4 years ago
|
:sql-ui="sqlUi"
|
||
3 years ago
|
/>
|
||
4 years ago
|
</template>
|
||
3 years ago
|
<template v-else-if="selectedView && selectedView.show_as === 'gallery'">
|
||
4 years ago
|
<gallery-view
|
||
|
:nodes="nodes"
|
||
|
:table="table"
|
||
|
:show-fields="showFields"
|
||
|
:available-columns="availableColumns"
|
||
|
:meta="meta"
|
||
|
:data="data"
|
||
3 years ago
|
:primary-value-column="primaryValueColumn"
|
||
|
/>
|
||
4 years ago
|
</template>
|
||
3 years ago
|
<template v-else-if="selectedView && selectedView.show_as === 'kanban'">
|
||
4 years ago
|
<kanban-view
|
||
|
:nodes="nodes"
|
||
|
:table="table"
|
||
|
:show-fields="showFields"
|
||
|
:available-columns="availableColumns"
|
||
|
:meta="meta"
|
||
|
:data="data"
|
||
3 years ago
|
:primary-value-column="primaryValueColumn"
|
||
|
/>
|
||
4 years ago
|
</template>
|
||
3 years ago
|
<template v-else-if="selectedView && selectedView.show_as === 'calendar'">
|
||
4 years ago
|
<calendar-view
|
||
|
:nodes="nodes"
|
||
|
:table="table"
|
||
|
:show-fields="showFields"
|
||
|
:available-columns="availableColumns"
|
||
|
:meta="meta"
|
||
|
:data="data"
|
||
3 years ago
|
:primary-value-column="primaryValueColumn"
|
||
|
/>
|
||
4 years ago
|
</template>
|
||
|
</div>
|
||
|
|
||
|
<v-pagination
|
||
|
v-if="data"
|
||
|
v-model="page"
|
||
3 years ago
|
style="max-width: 100%"
|
||
4 years ago
|
:length="Math.ceil(count / size)"
|
||
|
:total-visible="8"
|
||
|
color="primary lighten-2"
|
||
3 years ago
|
@input="loadTableData"
|
||
|
/>
|
||
4 years ago
|
<!-- <div v-else class="d-flex justify-center py-4">-->
|
||
|
<!-- <v-alert type="info" dense class="ma-1 flex-shrink-1">Table is empty</v-alert>-->
|
||
|
<!-- </div>-->
|
||
|
</div>
|
||
|
|
||
|
<spreadsheet-nav-drawer
|
||
3 years ago
|
ref="drawer"
|
||
4 years ago
|
:nodes="nodes"
|
||
|
:table="table"
|
||
|
:meta="meta"
|
||
3 years ago
|
:toggle-drawer="toggleDrawer"
|
||
3 years ago
|
:primary-value-column="primaryValueColumn"
|
||
|
:concatenated-x-where="concatenatedXWhere"
|
||
4 years ago
|
:sort="sort"
|
||
3 years ago
|
:columns-width.sync="columnsWidth"
|
||
3 years ago
|
:selected-view-id.sync="selectedViewId"
|
||
|
:selected-view.sync="selectedView"
|
||
4 years ago
|
:filters.sync="filters"
|
||
3 years ago
|
:sort-list.sync="sortList"
|
||
|
:show-fields.sync="showFields"
|
||
3 years ago
|
:view-status.sync="viewStatus"
|
||
4 years ago
|
>
|
||
3 years ago
|
<!-- <v-list-item
|
||
3 years ago
|
@click="showAdditionalFeatOverlay('view-columns')"
|
||
|
>
|
||
|
<v-icon x-small class="mr-2">
|
||
|
mdi-view-column
|
||
|
</v-icon>
|
||
4 years ago
|
<span class="caption">View Columns</span>
|
||
|
</v-list-item>
|
||
|
<v-list-item
|
||
3 years ago
|
@click="showAdditionalFeatOverlay('view-acl')"
|
||
|
>
|
||
|
<v-icon x-small class="mr-2">
|
||
|
mdi-shield-edit-outline
|
||
|
</v-icon>
|
||
4 years ago
|
<span class="caption"> ACL</span>
|
||
3 years ago
|
</v-list-item>-->
|
||
4 years ago
|
</spreadsheet-nav-drawer>
|
||
|
</div>
|
||
|
|
||
3 years ago
|
<additional-features v-model="showAddFeatOverlay" :nodes="nodes" :type="featureType" />
|
||
4 years ago
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import debounce from 'debounce';
|
||
|
import { SqlUI } from '@/helpers/sqlUi/SqlUiFactory';
|
||
|
import FieldsMenu from '~/components/project/spreadsheet/components/FieldsMenu';
|
||
|
import SortListMenu from '~/components/project/spreadsheet/components/SortListMenu';
|
||
|
import ColumnFilterMenu from '~/components/project/spreadsheet/components/ColumnFilterMenu';
|
||
|
import XcGridView from '~/components/project/spreadsheet/views/GridView';
|
||
|
import SpreadsheetNavDrawer from '~/components/project/spreadsheet/components/SpreadsheetNavDrawer';
|
||
|
import GalleryView from '~/components/project/spreadsheet/views/GalleryView';
|
||
|
import KanbanView from '~/components/project/spreadsheet/views/KanbanView';
|
||
|
import CalendarView from '~/components/project/spreadsheet/views/CalendarView';
|
||
|
import AdditionalFeatures from '~/components/project/spreadsheet/overlay/AdditinalFeatures';
|
||
|
import spreadsheet from '@/components/project/spreadsheet/mixins/spreadsheet';
|
||
|
import MoreActions from '~/components/project/spreadsheet/components/MoreActions';
|
||
|
import ShareViewMenu from '~/components/project/spreadsheet/components/ShareViewMenu';
|
||
|
import LockMenu from '~/components/project/spreadsheet/components/LockMenu';
|
||
3 years ago
|
|
||
4 years ago
|
export default {
|
||
3 years ago
|
name: 'Spreadsheet',
|
||
4 years ago
|
components: {
|
||
|
AdditionalFeatures,
|
||
|
CalendarView,
|
||
|
KanbanView,
|
||
3 years ago
|
GalleryView,
|
||
|
SpreadsheetNavDrawer,
|
||
|
XcGridView,
|
||
|
ColumnFilterMenu,
|
||
|
SortListMenu,
|
||
3 years ago
|
FieldsMenu,
|
||
|
ShareViewMenu,
|
||
|
MoreActions,
|
||
3 years ago
|
LockMenu,
|
||
4 years ago
|
},
|
||
3 years ago
|
mixins: [spreadsheet],
|
||
4 years ago
|
props: {
|
||
|
dbAlias: String,
|
||
|
env: String,
|
||
|
nodes: Object,
|
||
|
relationType: String,
|
||
|
relation: Object,
|
||
|
relationIdValue: [String, Number],
|
||
|
refTable: String,
|
||
3 years ago
|
relationPrimaryValue: [String, Number],
|
||
4 years ago
|
},
|
||
|
data: () => ({
|
||
3 years ago
|
columnsWidth: null,
|
||
3 years ago
|
syncDataDebounce: debounce(async function (self) {
|
||
|
await self.syncData();
|
||
3 years ago
|
}, 500),
|
||
|
fieldsOrder: [],
|
||
4 years ago
|
showAddFeatOverlay: false,
|
||
|
featureType: null,
|
||
|
selectedViewId: null,
|
||
|
selectedView: null,
|
||
|
shareLink: null,
|
||
|
showShareModel: false,
|
||
|
loadingMeta: true,
|
||
|
loadingData: true,
|
||
|
toggleDrawer: false,
|
||
|
selectedItem: 0,
|
||
|
searchField: null,
|
||
|
searchQuery: '',
|
||
|
showExpandModal: false,
|
||
|
selectedExpandRowIndex: null,
|
||
|
selectedExpandRowMeta: null,
|
||
3 years ago
|
// meta: null,
|
||
4 years ago
|
navDrawer: true,
|
||
|
selected: {
|
||
|
row: null,
|
||
3 years ago
|
col: null,
|
||
4 years ago
|
},
|
||
|
editEnabled: {
|
||
|
row: null,
|
||
3 years ago
|
col: null,
|
||
4 years ago
|
},
|
||
|
page: 1,
|
||
|
count: 0,
|
||
|
size: 25,
|
||
|
xWhere: '',
|
||
|
sort: '',
|
||
|
|
||
|
cellHeight: 'small',
|
||
|
|
||
|
isAnyFieldHidden: false,
|
||
3 years ago
|
opList: [
|
||
|
'is equal',
|
||
|
'is not equal',
|
||
|
'is like',
|
||
|
'is not like',
|
||
|
'is empty',
|
||
|
'is not empty',
|
||
|
'is null',
|
||
|
'is not null',
|
||
|
],
|
||
4 years ago
|
spreadsheet: null,
|
||
|
options: {
|
||
|
allowToolbar: true,
|
||
3 years ago
|
columnSorting: false,
|
||
4 years ago
|
},
|
||
|
filteredData: [],
|
||
|
showFields: {},
|
||
3 years ago
|
// fieldList: [],
|
||
4 years ago
|
|
||
3 years ago
|
cellHeights: [
|
||
|
{
|
||
|
size: 'small',
|
||
|
icon: 'mdi-view-headline',
|
||
|
},
|
||
|
{
|
||
|
size: 'medium',
|
||
|
icon: 'mdi-view-sequential',
|
||
|
},
|
||
|
{
|
||
|
size: 'large',
|
||
|
icon: 'mdi-view-stream',
|
||
|
},
|
||
|
{
|
||
|
size: 'xlarge',
|
||
|
icon: 'mdi-card',
|
||
|
},
|
||
|
],
|
||
4 years ago
|
rowContextMenu: null,
|
||
3 years ago
|
modelName: null,
|
||
|
viewStatus: {
|
||
3 years ago
|
type: null,
|
||
|
},
|
||
4 years ago
|
}),
|
||
3 years ago
|
computed: {
|
||
3 years ago
|
meta() {
|
||
3 years ago
|
return this.$store.state.meta.metas[this.table];
|
||
3 years ago
|
},
|
||
3 years ago
|
sqlUi() {
|
||
|
// todo: replace with correct client
|
||
3 years ago
|
return SqlUI.create(this.nodes.dbConnection);
|
||
3 years ago
|
},
|
||
|
api() {
|
||
3 years ago
|
return (
|
||
|
this.meta &&
|
||
|
this.$ncApis.get({
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias,
|
||
|
table: this.meta.table_name,
|
||
|
})
|
||
|
);
|
||
3 years ago
|
},
|
||
|
edited() {
|
||
3 years ago
|
return this.data && this.data.some(r => r.rowMeta && (r.rowMeta.new || r.rowMeta.changed));
|
||
3 years ago
|
},
|
||
|
table() {
|
||
3 years ago
|
return this.nodes.table_name || this.nodes.view_name;
|
||
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
async mounted() {
|
||
4 years ago
|
try {
|
||
3 years ago
|
await this.loadMeta();
|
||
|
await this.loadTableData();
|
||
4 years ago
|
} catch (e) {
|
||
3 years ago
|
console.log(e);
|
||
4 years ago
|
}
|
||
3 years ago
|
this.mapFieldsAndShowFields();
|
||
4 years ago
|
if (this.data.length) {
|
||
3 years ago
|
// eslint-disable-next-line no-unused-vars
|
||
4 years ago
|
const options = {
|
||
|
...this.options,
|
||
3 years ago
|
columns: [
|
||
|
...this.meta.columns.map(col => {
|
||
|
return {
|
||
|
readOnly: col.ai,
|
||
|
type: typeof this.data[0][col.column_name],
|
||
|
title: col.column_name,
|
||
|
width: '150px',
|
||
|
};
|
||
|
}),
|
||
|
{
|
||
|
type: 'hidden',
|
||
|
key: '',
|
||
|
},
|
||
|
],
|
||
|
};
|
||
4 years ago
|
}
|
||
3 years ago
|
this.searchField = this.primaryValueColumn;
|
||
4 years ago
|
},
|
||
3 years ago
|
created() {
|
||
|
if (this.relationType === 'hm') {
|
||
|
this.filters.push({
|
||
3 years ago
|
field: this.relation.column_name,
|
||
3 years ago
|
op: 'is equal',
|
||
|
value: this.relationIdValue,
|
||
3 years ago
|
readOnly: true,
|
||
|
});
|
||
3 years ago
|
} else if (this.relationType === 'bt') {
|
||
|
this.filters.push({
|
||
|
field: this.relation.rcn,
|
||
|
op: 'is equal',
|
||
|
value: this.relationIdValue,
|
||
3 years ago
|
readOnly: true,
|
||
|
});
|
||
3 years ago
|
}
|
||
3 years ago
|
document.addEventListener('keydown', this.onKeyDown);
|
||
3 years ago
|
},
|
||
|
beforeDestroy() {
|
||
3 years ago
|
document.removeEventListener('keydown', this.onKeyDown);
|
||
3 years ago
|
},
|
||
4 years ago
|
|
||
|
methods: {
|
||
3 years ago
|
// syncDataDebounce: debounce(async function(self) {
|
||
|
// await self.syncData()
|
||
|
// }, 500),
|
||
3 years ago
|
async syncData() {
|
||
3 years ago
|
if (this.relation) {
|
||
3 years ago
|
return;
|
||
3 years ago
|
}
|
||
4 years ago
|
try {
|
||
3 years ago
|
const queryParams = {
|
||
4 years ago
|
filters: this.filters,
|
||
|
sortList: this.sortList,
|
||
3 years ago
|
showFields: this.showFields,
|
||
|
fieldsOrder: this.fieldsOrder,
|
||
|
viewStatus: this.viewStatus,
|
||
|
columnsWidth: this.columnsWidth,
|
||
|
showSystemFields: this.showSystemFields,
|
||
3 years ago
|
extraViewParams: this.extraViewParams,
|
||
|
};
|
||
3 years ago
|
|
||
|
if (this.isGallery) {
|
||
3 years ago
|
queryParams.coverImageField = this.coverImageField;
|
||
3 years ago
|
}
|
||
4 years ago
|
|
||
3 years ago
|
this.$set(this.selectedView, 'query_params', JSON.stringify(queryParams));
|
||
4 years ago
|
|
||
3 years ago
|
if (!this._isUIAllowed('xcVirtualTableUpdate')) {
|
||
3 years ago
|
return;
|
||
3 years ago
|
}
|
||
3 years ago
|
await this.sqlOp({ dbAlias: this.nodes.dbAlias }, 'xcVirtualTableUpdate', {
|
||
4 years ago
|
id: this.selectedViewId,
|
||
3 years ago
|
query_params: queryParams,
|
||
3 years ago
|
table_name: this.meta.table_name,
|
||
3 years ago
|
view_name: this.$route.query.view,
|
||
|
});
|
||
4 years ago
|
} catch (e) {
|
||
|
// this.$toast.error(e.message).goAway(3000);
|
||
|
}
|
||
|
},
|
||
3 years ago
|
mapFieldsAndShowFields() {
|
||
3 years ago
|
this.fieldList = this.availableColumns.map(c => c.title);
|
||
4 years ago
|
this.showFields = this.fieldList.reduce((obj, k) => {
|
||
3 years ago
|
obj[k] = true;
|
||
|
return obj;
|
||
|
}, {});
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
comingSoon() {
|
||
3 years ago
|
this.$toast.info('Coming soon!').goAway(3000);
|
||
4 years ago
|
},
|
||
3 years ago
|
makeSelected(col, row) {
|
||
4 years ago
|
if (this.selected.col !== col || this.selected.row !== row) {
|
||
3 years ago
|
this.selected = { col, row };
|
||
|
this.editEnabled = {};
|
||
4 years ago
|
}
|
||
|
},
|
||
3 years ago
|
makeEditable(col, row) {
|
||
4 years ago
|
if (this.meta.columns[col].ai) {
|
||
3 years ago
|
return this.$toast.info('Auto Increment field is not editable').goAway(3000);
|
||
4 years ago
|
}
|
||
|
if (this.meta.columns[col].pk && !this.data[row].rowMeta.new) {
|
||
3 years ago
|
return this.$toast.info('Editing primary key not supported').goAway(3000);
|
||
4 years ago
|
}
|
||
|
if (this.editEnabled.col !== col || this.editEnabled.row !== row) {
|
||
3 years ago
|
this.editEnabled = { col, row };
|
||
4 years ago
|
}
|
||
|
},
|
||
|
|
||
3 years ago
|
async handleKeyDown({ metaKey, key, altKey, shiftKey, ctrlKey }) {
|
||
3 years ago
|
console.log(metaKey, key, altKey, shiftKey, ctrlKey);
|
||
4 years ago
|
// ctrl + s -> save
|
||
|
// ctrl + l -> reload
|
||
|
// ctrl + n -> new
|
||
3 years ago
|
switch ([this._isMac ? metaKey : ctrlKey, key].join('_')) {
|
||
|
case 'true_s':
|
||
|
this.edited && (await this.save());
|
||
|
break;
|
||
|
case 'true_l':
|
||
|
await this.loadTableData();
|
||
|
break;
|
||
|
case 'true_n':
|
||
|
this.insertNewRow(true);
|
||
|
break;
|
||
4 years ago
|
}
|
||
|
},
|
||
|
|
||
3 years ago
|
addFilter() {
|
||
4 years ago
|
this.filters.push({
|
||
|
field: '',
|
||
|
op: '',
|
||
|
value: '',
|
||
3 years ago
|
logicOp: 'and',
|
||
|
});
|
||
|
this.filters = this.filters.slice();
|
||
4 years ago
|
},
|
||
3 years ago
|
showAdditionalFeatOverlay(feat) {
|
||
3 years ago
|
this.showAddFeatOverlay = true;
|
||
|
this.featureType = feat;
|
||
4 years ago
|
},
|
||
3 years ago
|
addSort() {
|
||
4 years ago
|
this.sortList.push({
|
||
|
field: '',
|
||
3 years ago
|
order: '',
|
||
|
});
|
||
|
this.filters = this.filters.slice();
|
||
4 years ago
|
},
|
||
3 years ago
|
showRowContextMenu(e, row, rowMeta, index) {
|
||
3 years ago
|
e.preventDefault();
|
||
|
this.rowContextMenu = false;
|
||
4 years ago
|
this.$nextTick(() => {
|
||
|
this.rowContextMenu = {
|
||
|
x: e.clientX,
|
||
|
y: e.clientY,
|
||
3 years ago
|
row,
|
||
|
index,
|
||
3 years ago
|
rowMeta,
|
||
|
};
|
||
|
});
|
||
4 years ago
|
},
|
||
3 years ago
|
expandRow(row, rowMeta) {},
|
||
4 years ago
|
|
||
3 years ago
|
async loadMeta() {
|
||
3 years ago
|
this.loadingMeta = true;
|
||
3 years ago
|
|
||
|
await this.$store.dispatch('meta/ActLoadMeta', {
|
||
4 years ago
|
env: this.nodes.env,
|
||
3 years ago
|
dbAlias: this.nodes.dbAlias,
|
||
3 years ago
|
table_name: this.table,
|
||
3 years ago
|
force: true,
|
||
|
});
|
||
3 years ago
|
|
||
|
// const tableMeta = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
|
||
|
// env: this.nodes.env,
|
||
|
// dbAlias: this.nodes.dbAlias
|
||
|
// }, 'tableXcModelGet', {
|
||
3 years ago
|
// table_name: this.table
|
||
3 years ago
|
// }])
|
||
|
// this.meta = JSON.parse(tableMeta.meta)
|
||
3 years ago
|
this.loadingMeta = false;
|
||
4 years ago
|
},
|
||
3 years ago
|
async loadTableData() {
|
||
3 years ago
|
this.loadingData = true;
|
||
|
const { list, count } = await this.api.paginatedList(this.queryParams);
|
||
|
this.count = count;
|
||
4 years ago
|
this.data = list.map(row => ({
|
||
|
row,
|
||
3 years ago
|
oldRow: { ...row },
|
||
3 years ago
|
rowMeta: {},
|
||
|
}));
|
||
|
this.loadingData = false;
|
||
|
},
|
||
|
},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
<style scoped>
|
||
|
/deep/ .v-input__control .v-input__slot .v-input--selection-controls__input {
|
||
3 years ago
|
transform: scale(0.85);
|
||
4 years ago
|
margin-right: 0;
|
||
|
}
|
||
|
|
||
3 years ago
|
/deep/ .xc-toolbar .v-input__slot,
|
||
|
.navigation .v-input__slot {
|
||
4 years ago
|
box-shadow: none !important;
|
||
|
}
|
||
|
|
||
|
/deep/ .navigation .v-input__slot input::placeholder {
|
||
3 years ago
|
font-size: 0.8rem;
|
||
4 years ago
|
}
|
||
|
|
||
|
/deep/ .v-btn {
|
||
|
text-transform: capitalize;
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-bt-chip {
|
||
|
margin-right: 12px;
|
||
3 years ago
|
transition: 0.4s margin-right, 0.4s padding-right;
|
||
4 years ago
|
}
|
||
|
|
||
|
/deep/ .xc-border.search-box {
|
||
|
overflow: visible;
|
||
|
border-radius: 4px;
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-border.search-box .v-input {
|
||
3 years ago
|
transition: 0.4s border-color;
|
||
4 years ago
|
}
|
||
|
|
||
|
/deep/ .xc-border.search-box .v-input--is-focused {
|
||
|
border: 1px solid var(--v-primary-base) !important;
|
||
|
margin: -1px;
|
||
|
}
|
||
|
|
||
|
/deep/ .search-field.v-text-field.v-text-field--solo.v-input--dense > .v-input__control {
|
||
|
min-height: auto;
|
||
|
}
|
||
|
|
||
|
.model-name {
|
||
|
position: fixed;
|
||
|
top: 5px;
|
||
|
pointer-events: none;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
text-align: center;
|
||
|
z-index: 9999;
|
||
|
width: 100%;
|
||
|
font-size: 1.2rem;
|
||
|
color: white;
|
||
|
height: 40px;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
3 years ago
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
|
||
4 years ago
|
*
|
||
|
* @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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|