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.
393 lines
9.8 KiB
393 lines
9.8 KiB
3 years ago
|
<template>
|
||
|
<v-container
|
||
2 years ago
|
class="h-100 j-excel-container"
|
||
3 years ago
|
:class="{
|
||
2 years ago
|
'pa-0 ma-0': !notFound,
|
||
3 years ago
|
}"
|
||
|
fluid
|
||
|
>
|
||
2 years ago
|
<v-alert v-if="notFound" type="warning" class="mx-auto mt-10" outlined max-width="300"> Not found </v-alert>
|
||
3 years ago
|
<template v-else>
|
||
|
<div v-if="viewName" class="model-name">
|
||
|
<span class="font-weight-bold"> {{ viewName }}</span> <span class="font-weight-regular ml-1" />
|
||
|
</div>
|
||
2 years ago
|
<v-toolbar
|
||
|
v-if="meta"
|
||
|
height="40"
|
||
|
dense
|
||
|
class="elevation-0 xc-toolbar xc-border-bottom"
|
||
|
style="z-index: 7; border-radius: 4px"
|
||
|
>
|
||
3 years ago
|
<v-spacer />
|
||
|
<v-btn outlined small text @click="reload">
|
||
2 years ago
|
<v-icon small class="mr-1" color="grey darken-3"> mdi-reload </v-icon>
|
||
3 years ago
|
<!-- Reload -->
|
||
|
{{ $t('general.reload') }}
|
||
3 years ago
|
</v-btn>
|
||
|
<fields-menu v-model="showFields" :field-list="fieldList" is-public />
|
||
|
<sort-list-menu v-model="sortList" :field-list="realFieldList" />
|
||
|
<column-filter-menu v-model="filters" :field-list="realFieldList" />
|
||
2 years ago
|
<csv-export-import
|
||
|
:query-params="{ ...queryParams, showFields }"
|
||
|
:public-view-id="$route.params.id"
|
||
|
:meta="meta"
|
||
|
/>
|
||
3 years ago
|
</v-toolbar>
|
||
|
<div
|
||
|
v-if="meta"
|
||
|
class="nc-grid-wrapper d-flex"
|
||
|
:class="`cell-height-${cellHeight}`"
|
||
2 years ago
|
style="overflow: auto; transition: width 500ms"
|
||
3 years ago
|
>
|
||
3 years ago
|
<v-container v-if="loadingData" fluid>
|
||
3 years ago
|
<v-row>
|
||
|
<v-col v-for="idx in 5" :key="idx">
|
||
3 years ago
|
<v-skeleton-loader type="image@3" />
|
||
3 years ago
|
</v-col>
|
||
|
</v-row>
|
||
|
</v-container>
|
||
|
<kanban-view
|
||
3 years ago
|
v-if="!loadingData && kanban.data.length"
|
||
3 years ago
|
:nodes="nodes"
|
||
|
:table="table"
|
||
|
:show-fields="showFields"
|
||
|
:available-columns="availableColumns"
|
||
|
:meta="meta"
|
||
|
:kanban="kanban"
|
||
|
:sql-ui="sqlUi"
|
||
|
:primary-value-column="primaryValueColumn"
|
||
|
:grouping-field.sync="groupingField"
|
||
|
:api="api"
|
||
2 years ago
|
@loadMoreKanbanData="groupingFieldVal => loadMoreKanbanData(groupingFieldVal)"
|
||
3 years ago
|
/>
|
||
|
</div>
|
||
|
</template>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
/* eslint-disable camelcase */
|
||
2 years ago
|
import spreadsheet from '../mixins/spreadsheet';
|
||
|
import FieldsMenu from '../components/FieldsMenu';
|
||
|
import SortListMenu from '../components/SortListMenu';
|
||
|
import ColumnFilterMenu from '../components/ColumnFilterMenu';
|
||
|
import CsvExportImport from '~/components/project/spreadsheet/components/MoreActions';
|
||
|
import KanbanView from '~/components/project/spreadsheet/views/KanbanView';
|
||
3 years ago
|
export default {
|
||
|
name: 'XcKanban',
|
||
|
components: { CsvExportImport, ColumnFilterMenu, SortListMenu, FieldsMenu, KanbanView },
|
||
|
mixins: [spreadsheet],
|
||
|
props: {
|
||
|
env: String,
|
||
|
nodes: Object,
|
||
|
relationType: String,
|
||
|
relation: Object,
|
||
|
relationIdValue: [String, Number],
|
||
|
refTable: String,
|
||
2 years ago
|
relationPrimaryValue: [String, Number],
|
||
3 years ago
|
},
|
||
|
data: () => ({
|
||
|
notFound: false,
|
||
|
viewName: null,
|
||
|
viewType: null,
|
||
|
columnsWidth: {},
|
||
|
metas: {},
|
||
|
fieldsOrder: [],
|
||
|
password: null,
|
||
|
showPasswordModal: false,
|
||
|
client: 'mysql',
|
||
|
shareLink: null,
|
||
|
showShareModel: false,
|
||
|
loadingMeta: true,
|
||
|
loadingData: true,
|
||
|
toggleDrawer: false,
|
||
|
selectedItem: 0,
|
||
|
searchField: null,
|
||
|
searchQuery: '',
|
||
|
showExpandModal: false,
|
||
|
selectedExpandRowIndex: null,
|
||
|
selectedExpandRowMeta: null,
|
||
|
meta: null,
|
||
3 years ago
|
|
||
3 years ago
|
navDrawer: true,
|
||
|
selected: {
|
||
|
row: null,
|
||
2 years ago
|
col: null,
|
||
3 years ago
|
},
|
||
|
editEnabled: {
|
||
|
row: null,
|
||
2 years ago
|
col: null,
|
||
3 years ago
|
},
|
||
|
page: 1,
|
||
|
count: 0,
|
||
|
size: 25,
|
||
|
xWhere: '',
|
||
|
sort: '',
|
||
|
cellHeight: 'small',
|
||
|
isAnyFieldHidden: false,
|
||
2 years ago
|
opList: [
|
||
|
'is equal',
|
||
|
'is not equal',
|
||
|
'is like',
|
||
|
'is not like',
|
||
|
'is empty',
|
||
|
'is not empty',
|
||
|
'is null',
|
||
|
'is not null',
|
||
|
],
|
||
3 years ago
|
fieldFilter: '',
|
||
|
filters: [],
|
||
|
sortList: [],
|
||
|
data: [],
|
||
|
spreadsheet: null,
|
||
|
options: {
|
||
|
allowToolbar: true,
|
||
2 years ago
|
columnSorting: false,
|
||
3 years ago
|
},
|
||
|
filteredData: [],
|
||
|
showFields: {},
|
||
|
// fieldList: [],
|
||
2 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',
|
||
|
},
|
||
|
],
|
||
3 years ago
|
rowContextMenu: null,
|
||
|
modelName: null,
|
||
|
kanban: {
|
||
|
data: [],
|
||
|
stages: [],
|
||
|
blocks: [],
|
||
|
recordCnt: {},
|
||
|
recordTotalCnt: {},
|
||
|
groupingColumnItems: [],
|
||
3 years ago
|
loadingData: true,
|
||
3 years ago
|
selectedExpandRow: null,
|
||
|
selectedExpandOldRow: null,
|
||
2 years ago
|
selectedExpandRowMeta: null,
|
||
|
},
|
||
3 years ago
|
}),
|
||
2 years ago
|
computed: {},
|
||
3 years ago
|
async mounted() {
|
||
|
try {
|
||
2 years ago
|
await this.loadMetaData();
|
||
3 years ago
|
if (!this.showPasswordModal && !this.notFound) {
|
||
2 years ago
|
await this.loadKanbanData();
|
||
3 years ago
|
}
|
||
|
} catch (e) {
|
||
2 years ago
|
console.log(e);
|
||
3 years ago
|
}
|
||
2 years ago
|
this.searchField = this.primaryValueColumn;
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
|
async loadMetaData() {
|
||
2 years ago
|
this.loading = true;
|
||
3 years ago
|
try {
|
||
|
// eslint-disable-next-line camelcase
|
||
|
const {
|
||
|
meta,
|
||
|
// model_name,
|
||
|
view_name,
|
||
|
view_type,
|
||
|
client,
|
||
|
query_params: qp = {},
|
||
|
db_alias: dbAlias = '_noco',
|
||
2 years ago
|
relatedTableMetas = {},
|
||
|
} = await this.$store.dispatch('sqlMgr/ActSqlOp', [
|
||
|
null,
|
||
|
'sharedViewGet',
|
||
|
{
|
||
|
view_id: this.$route.params.id,
|
||
|
password: this.password,
|
||
|
},
|
||
|
]);
|
||
3 years ago
|
|
||
2 years ago
|
this.fieldsOrder = qp.fieldsOrder || [];
|
||
|
this.viewName = view_name;
|
||
|
this.viewType = view_type;
|
||
3 years ago
|
|
||
2 years ago
|
this.columnsWidth = qp.columnsWidth || {};
|
||
3 years ago
|
|
||
2 years ago
|
this.client = client;
|
||
|
this.meta = meta;
|
||
|
this.query_params = qp;
|
||
|
this.dbAlias = dbAlias;
|
||
|
this.metas = relatedTableMetas;
|
||
|
this.sortList = qp.sortList || [];
|
||
3 years ago
|
|
||
2 years ago
|
this.showFields = this.query_params.showFields || {};
|
||
3 years ago
|
|
||
|
// this.fieldList = Object.keys(this.showFields)
|
||
|
|
||
2 years ago
|
let fields = this.query_params.fieldsOrder || [];
|
||
|
if (!fields.length) {
|
||
|
fields = Object.keys(this.showFields);
|
||
|
}
|
||
3 years ago
|
// eslint-disable-next-line camelcase
|
||
|
|
||
2 years ago
|
let columns = this.meta.columns;
|
||
3 years ago
|
if (this.meta && this.meta.v) {
|
||
2 years ago
|
columns = [...columns, ...this.meta.v.map(v => ({ ...v, virtual: 1 }))];
|
||
3 years ago
|
}
|
||
|
|
||
|
{
|
||
2 years ago
|
const _ref = {};
|
||
|
columns.forEach(c => {
|
||
3 years ago
|
if (c.virtual && c.bt) {
|
||
2 years ago
|
c.prop = `${c.bt.rtn}Read`;
|
||
3 years ago
|
}
|
||
|
if (c.virtual && c.mm) {
|
||
2 years ago
|
c.prop = `${c.mm.rtn}MMList`;
|
||
3 years ago
|
}
|
||
|
if (c.virtual && c.hm) {
|
||
2 years ago
|
c.prop = `${c.hm.table_name}List`;
|
||
3 years ago
|
}
|
||
|
|
||
2 years ago
|
c.alias = c.title;
|
||
3 years ago
|
if (c.alias in _ref) {
|
||
2 years ago
|
c.alias += _ref[c.alias]++;
|
||
3 years ago
|
} else {
|
||
2 years ago
|
_ref[c.alias] = 1;
|
||
3 years ago
|
}
|
||
2 years ago
|
});
|
||
3 years ago
|
}
|
||
|
} catch (e) {
|
||
|
if (e.message === 'Not found' || e.message === 'Meta not found') {
|
||
2 years ago
|
this.notFound = true;
|
||
3 years ago
|
} else if (e.message === 'Invalid password') {
|
||
2 years ago
|
this.showPasswordModal = true;
|
||
3 years ago
|
} else {
|
||
2 years ago
|
console.log(e);
|
||
3 years ago
|
}
|
||
|
}
|
||
|
|
||
2 years ago
|
this.loadingData = false;
|
||
3 years ago
|
},
|
||
|
async loadKanbanData() {
|
||
2 years ago
|
this.loadingData = true;
|
||
3 years ago
|
try {
|
||
|
// TODO
|
||
|
} catch (e) {
|
||
2 years ago
|
this.showPasswordModal = true;
|
||
3 years ago
|
}
|
||
|
|
||
2 years ago
|
this.loadingData = false;
|
||
3 years ago
|
},
|
||
|
async unlock() {
|
||
2 years ago
|
this.showPasswordModal = false;
|
||
|
await this.reload();
|
||
3 years ago
|
},
|
||
|
async reload() {
|
||
2 years ago
|
await this.loadMetaData();
|
||
|
await this.loadKanbanData();
|
||
|
},
|
||
|
},
|
||
|
};
|
||
3 years ago
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
/deep/ .v-input__control .v-input__slot .v-input--selection-controls__input {
|
||
2 years ago
|
transform: scale(0.85);
|
||
3 years ago
|
margin-right: 0;
|
||
|
}
|
||
|
|
||
2 years ago
|
/deep/ .xc-toolbar .v-input__slot,
|
||
|
.navigation .v-input__slot {
|
||
3 years ago
|
box-shadow: none !important;
|
||
|
}
|
||
|
|
||
|
/deep/ .navigation .v-input__slot input::placeholder {
|
||
2 years ago
|
font-size: 0.8rem;
|
||
3 years ago
|
}
|
||
|
|
||
|
/deep/ .v-btn {
|
||
|
text-transform: capitalize;
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-bt-chip {
|
||
|
margin-right: 12px;
|
||
2 years ago
|
transition: 0.4s margin-right, 0.4s padding-right;
|
||
3 years ago
|
}
|
||
|
|
||
|
/deep/ .xc-border.search-box {
|
||
|
overflow: visible;
|
||
|
border-radius: 4px;
|
||
|
}
|
||
|
|
||
|
/deep/ .xc-border.search-box .v-input {
|
||
2 years ago
|
transition: 0.4s border-color;
|
||
3 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;
|
||
|
}
|
||
|
|
||
2 years ago
|
.nc-grid-wrapper {
|
||
|
height: calc(100vh - 120px);
|
||
3 years ago
|
}
|
||
|
|
||
2 years ago
|
.nc-grid {
|
||
|
height: calc(100% - 34px);
|
||
3 years ago
|
}
|
||
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
* @author Wing-Kam Wong <wingkwong.code@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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|