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.
675 lines
19 KiB
675 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
|
||
3 years ago
|
class="ml-2"
|
||
3 years ago
|
small
|
||
|
color="grey"
|
||
|
>
|
||
|
mdi-magnify
|
||
4 years ago
|
</v-icon>
|
||
|
|
||
3 years ago
|
<v-icon
|
||
|
color="grey"
|
||
|
class="pl-0 pa-1"
|
||
|
small
|
||
|
>
|
||
|
mdi-menu-down
|
||
4 years ago
|
</v-icon>
|
||
|
</div>
|
||
|
</template>
|
||
3 years ago
|
<v-list v-if="meta" dense>
|
||
3 years ago
|
<v-list-item
|
||
|
v-for="col in meta.columns"
|
||
3 years ago
|
:key="col.column_name"
|
||
|
@click="searchField = col.column_name"
|
||
3 years ago
|
>
|
||
3 years ago
|
<span class="caption">{{ col.column_name }}</span>
|
||
4 years ago
|
</v-list-item>
|
||
|
</v-list>
|
||
|
</v-menu>
|
||
|
|
||
|
<v-divider
|
||
3 years ago
|
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,
|
||
|
showFields
|
||
|
}"
|
||
|
:selected-view="selectedView"
|
||
|
:is-view="true"
|
||
|
@showAdditionalFeatOverlay="showAdditionalFeatOverlay($event)"
|
||
|
@webhook="showAdditionalFeatOverlay('webhooks')"
|
||
|
/>
|
||
3 years ago
|
</div>
|
||
|
<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
|
||
3 years ago
|
</v-icon>
|
||
3 years ago
|
<x-icon
|
||
|
tooltip="Reload view data"
|
||
|
icon.class="nc-table-reload-btn mx-1"
|
||
|
small
|
||
|
@click="loadTableData"
|
||
|
>
|
||
|
mdi-reload
|
||
|
</x-icon>
|
||
|
</template>
|
||
3 years ago
|
|
||
|
<x-btn
|
||
|
tooltip="Toggle navigation drawer"
|
||
|
outlined
|
||
|
small
|
||
|
text
|
||
|
:btn-class="{ 'primary lighten-5 nc-toggle-nav-drawer' : !toggleDrawer}"
|
||
|
@click="toggleDrawer = !toggleDrawer"
|
||
|
>
|
||
|
<v-icon
|
||
|
small
|
||
|
class="mx-0"
|
||
|
color="grey darken-3"
|
||
|
>
|
||
|
{{ toggleDrawer ? 'mdi-door-closed' : 'mdi-door-open' }}
|
||
|
</v-icon>
|
||
|
</x-btn>
|
||
4 years ago
|
</v-toolbar>
|
||
3 years ago
|
<div
|
||
|
:class="`cell-height-${cellHeight}`"
|
||
|
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
|
|
||
|
<template v-else-if="selectedView && (selectedView.type === 'view' || selectedView.show_as === 'grid' )">
|
||
|
<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"
|
||
4 years ago
|
:nodes="{dbAlias:''}"
|
||
|
:sql-ui="sqlUi"
|
||
3 years ago
|
/>
|
||
4 years ago
|
</template>
|
||
|
<template v-else-if="selectedView && selectedView.show_as === 'gallery' ">
|
||
|
<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>
|
||
|
<template v-else-if="selectedView && selectedView.show_as === 'kanban' ">
|
||
|
<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>
|
||
|
<template v-else-if="selectedView && selectedView.show_as === 'calendar' ">
|
||
|
<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>
|
||
|
|
||
|
<additional-features
|
||
|
v-model="showAddFeatOverlay"
|
||
3 years ago
|
:nodes="nodes"
|
||
4 years ago
|
:type="featureType"
|
||
3 years ago
|
/>
|
||
4 years ago
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
|
||
3 years ago
|
import debounce from 'debounce'
|
||
3 years ago
|
import { SqlUI } from '@/helpers/sqlUi/SqlUiFactory'
|
||
3 years ago
|
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'
|
||
3 years ago
|
import spreadsheet from '@/components/project/spreadsheet/mixins/spreadsheet'
|
||
3 years ago
|
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()
|
||
|
}, 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,
|
||
|
col: null
|
||
|
},
|
||
|
editEnabled: {
|
||
|
row: null,
|
||
|
col: null
|
||
|
},
|
||
|
page: 1,
|
||
|
count: 0,
|
||
|
size: 25,
|
||
|
xWhere: '',
|
||
|
sort: '',
|
||
|
|
||
|
cellHeight: 'small',
|
||
|
|
||
|
isAnyFieldHidden: false,
|
||
|
opList: ['is equal', 'is not equal', 'is like', 'is not like', 'is empty', 'is not empty', 'is null', 'is not null'],
|
||
|
spreadsheet: null,
|
||
|
options: {
|
||
|
allowToolbar: true,
|
||
3 years ago
|
columnSorting: false
|
||
4 years ago
|
},
|
||
|
filteredData: [],
|
||
|
showFields: {},
|
||
3 years ago
|
// fieldList: [],
|
||
4 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'
|
||
|
}],
|
||
|
rowContextMenu: null,
|
||
3 years ago
|
modelName: null,
|
||
|
viewStatus: {
|
||
|
type: null
|
||
3 years ago
|
}
|
||
4 years ago
|
}),
|
||
3 years ago
|
computed: {
|
||
3 years ago
|
meta() {
|
||
|
return this.$store.state.meta.metas[this.table]
|
||
|
},
|
||
3 years ago
|
sqlUi() {
|
||
|
// todo: replace with correct client
|
||
|
return SqlUI.create(this.nodes.dbConnection)
|
||
|
},
|
||
|
api() {
|
||
3 years ago
|
return this.meta && this.$ncApis.get({
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias,
|
||
3 years ago
|
table: this.meta.table_name
|
||
3 years ago
|
})
|
||
3 years ago
|
},
|
||
|
edited() {
|
||
|
return this.data && this.data.some(r => r.rowMeta && (r.rowMeta.new || r.rowMeta.changed))
|
||
|
},
|
||
|
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) {
|
||
|
console.log(e)
|
||
|
}
|
||
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) => {
|
||
4 years ago
|
return {
|
||
|
readOnly: col.ai,
|
||
3 years ago
|
type: typeof this.data[0][col.column_name],
|
||
|
title: col.column_name,
|
||
4 years ago
|
width: '150px'
|
||
|
}
|
||
|
}), {
|
||
|
type: 'hidden',
|
||
|
key: ''
|
||
|
}]
|
||
3 years ago
|
}
|
||
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,
|
||
|
readOnly: true
|
||
|
})
|
||
|
} else if (this.relationType === 'bt') {
|
||
|
this.filters.push({
|
||
|
field: this.relation.rcn,
|
||
|
op: 'is equal',
|
||
|
value: this.relationIdValue,
|
||
|
readOnly: true
|
||
|
})
|
||
|
}
|
||
|
document.addEventListener('keydown', this.onKeyDown)
|
||
|
},
|
||
|
beforeDestroy() {
|
||
|
document.removeEventListener('keydown', this.onKeyDown)
|
||
|
},
|
||
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) {
|
||
|
return
|
||
|
}
|
||
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,
|
||
|
extraViewParams: this.extraViewParams
|
||
|
}
|
||
|
|
||
|
if (this.isGallery) {
|
||
|
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')) {
|
||
|
return
|
||
|
}
|
||
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
|
||
3 years ago
|
})
|
||
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() {
|
||
4 years ago
|
this.$toast.info('Coming soon!').goAway(3000)
|
||
|
},
|
||
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) {
|
||
|
return this.$toast.info('Auto Increment field is not editable').goAway(3000)
|
||
|
}
|
||
|
if (this.meta.columns[col].pk && !this.data[row].rowMeta.new) {
|
||
|
return this.$toast.info('Editing primary key not supported').goAway(3000)
|
||
|
}
|
||
|
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 }) {
|
||
4 years ago
|
console.log(metaKey, key, altKey, shiftKey, ctrlKey)
|
||
|
// ctrl + s -> save
|
||
|
// ctrl + l -> reload
|
||
|
// ctrl + n -> new
|
||
|
switch ([
|
||
3 years ago
|
this._isMac ? metaKey : ctrlKey,
|
||
|
key].join('_')) {
|
||
4 years ago
|
case 'true_s' :
|
||
3 years ago
|
this.edited && await this.save()
|
||
|
break
|
||
4 years ago
|
case 'true_l' :
|
||
3 years ago
|
await this.loadTableData()
|
||
|
break
|
||
4 years ago
|
case 'true_n' :
|
||
3 years ago
|
this.insertNewRow(true)
|
||
|
break
|
||
4 years ago
|
}
|
||
|
},
|
||
|
|
||
3 years ago
|
addFilter() {
|
||
4 years ago
|
this.filters.push({
|
||
|
field: '',
|
||
|
op: '',
|
||
|
value: '',
|
||
|
logicOp: 'and'
|
||
3 years ago
|
})
|
||
|
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: '',
|
||
|
order: ''
|
||
3 years ago
|
})
|
||
|
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,
|
||
|
rowMeta
|
||
4 years ago
|
}
|
||
3 years ago
|
})
|
||
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
|
||
|
})
|
||
|
|
||
|
// 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 },
|
||
4 years ago
|
rowMeta: {}
|
||
3 years ago
|
}))
|
||
|
this.loadingData = false
|
||
|
}
|
||
|
}
|
||
4 years ago
|
}
|
||
|
</script>
|
||
|
<style scoped>
|
||
|
|
||
|
/deep/ .v-input__control .v-input__slot .v-input--selection-controls__input {
|
||
|
transform: scale(.85);
|
||
|
margin-right: 0;
|
||
|
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-toolbar .v-input__slot, .navigation .v-input__slot {
|
||
|
box-shadow: none !important;
|
||
|
}
|
||
|
|
||
|
/deep/ .navigation .v-input__slot input::placeholder {
|
||
|
font-size: .8rem;
|
||
|
}
|
||
|
|
||
|
/deep/ .v-btn {
|
||
|
text-transform: capitalize;
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-bt-chip {
|
||
|
margin-right: 12px;
|
||
|
transition: .4s margin-right, .4s padding-right;
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-border.search-box {
|
||
|
overflow: visible;
|
||
|
border-radius: 4px;
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-border.search-box .v-input {
|
||
|
transition: .4s border-color;
|
||
|
}
|
||
|
|
||
|
/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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|