Browse Source

refactor: replace `rollup` with `rl`

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/510/head
Pranav C 3 years ago
parent
commit
c4fd87d4d6
  1. 22
      .github/workflows/ci-cd.yml
  2. 1
      cypress.json
  3. 2
      packages/nc-gui/components/project/spreadsheet/components/editColumn/rollupOptions.vue
  4. 2
      packages/nc-gui/components/project/spreadsheet/components/virtualCell.vue
  5. 16
      packages/nc-gui/components/project/spreadsheet/components/virtualHeaderCell.vue
  6. 2
      packages/nc-gui/plugins/ncApis/gqlApi.js
  7. 4
      packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts
  8. 2
      packages/nocodb/src/lib/sqlMgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts

22
.github/workflows/ci-cd.yml

@ -9,17 +9,17 @@ on:
branches: [ master ] branches: [ master ]
jobs: jobs:
cypress-run: # cypress-run:
runs-on: ubuntu-20.04 # runs-on: ubuntu-20.04
steps: # steps:
- name: Checkout # - name: Checkout
uses: actions/checkout@v2 # uses: actions/checkout@v2
- name: Cypress run # - name: Cypress run
uses: cypress-io/github-action@v2 # uses: cypress-io/github-action@v2
with: # with:
start: docker-compose -f ./docker-compose-cypress.yml up -d # start: docker-compose -f ./docker-compose-cypress.yml up -d
wait-on: 'http://localhost:3000' # wait-on: 'http://localhost:3000'
wait-on-timeout: 900 # wait-on-timeout: 900
docker: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest

1
cypress.json

@ -5,5 +5,6 @@
"viewportWidth": 1980, "viewportWidth": 1980,
"viewportHeight": 1000, "viewportHeight": 1000,
"video": false, "video": false,
"retries": 2,
"screenshotOnRunFailure": false "screenshotOnRunFailure": false
} }

2
packages/nc-gui/components/project/spreadsheet/components/editColumn/rollupOptions.vue

@ -176,7 +176,7 @@ export default {
meta.v.push({ meta.v.push({
_cn: this.alias, _cn: this.alias,
rollup: { rl: {
...this.rollup.table, ...this.rollup.table,
...this.rollup.column, ...this.rollup.column,
fn: this.rollup.fn fn: this.rollup.fn

2
packages/nc-gui/components/project/spreadsheet/components/virtualCell.vue

@ -138,7 +138,7 @@ export default {
return this.column && this.column.formula return this.column && this.column.formula
}, },
rollup() { rollup() {
return this.column && this.column.rollup return this.column && this.column.rl
} }
}, },
methods: { methods: {

16
packages/nc-gui/components/project/spreadsheet/components/virtualHeaderCell.vue

@ -25,14 +25,14 @@
mdi-table-column-plus-before mdi-table-column-plus-before
</v-icon> </v-icon>
</template> </template>
<template v-else-if="column.rollup"> <template v-else-if="column.rl">
<v-icon v-if="column.rollup.type === 'hm'" color="warning" x-small class="mr-1" v-on="on"> <v-icon v-if="column.rl.type === 'hm'" color="warning" x-small class="mr-1" v-on="on">
{{ rollupIcon }} {{ rollupIcon }}
</v-icon> </v-icon>
<v-icon v-else-if="column.rollup.type === 'bt'" color="info" x-small class="mr-1" v-on="on"> <v-icon v-else-if="column.rl.type === 'bt'" color="info" x-small class="mr-1" v-on="on">
{{ rollupIcon }} {{ rollupIcon }}
</v-icon> </v-icon>
<v-icon v-else-if="column.rollup.type === 'mm'" color="pink" x-small class="mr-1" v-on="on"> <v-icon v-else-if="column.rl.type === 'mm'" color="pink" x-small class="mr-1" v-on="on">
{{ rollupIcon }} {{ rollupIcon }}
</v-icon> </v-icon>
</template> </template>
@ -217,8 +217,8 @@ export default {
return `'${this.column.lk._lcn}' from '${this.column.lk._ltn}' (${this.column.lk.type})` return `'${this.column.lk._lcn}' from '${this.column.lk._ltn}' (${this.column.lk.type})`
} else if (this.column.formula) { } else if (this.column.formula) {
return `Formula - ${this.column.formula.value}` return `Formula - ${this.column.formula.value}`
} else if (this.column.rollup) { } else if (this.column.rl) {
return `${this.column.rollup.fn} of ${this.column.rollup._rlcn} (${this.column.rollup._rltn})` return `${this.column.rl.fn} of ${this.column.rl._rlcn} (${this.column.rl._rltn})`
} }
return '' return ''
} }
@ -308,7 +308,7 @@ export default {
const meta = JSON.parse(JSON.stringify(this.$store.state.meta.metas[this.meta.tn])) const meta = JSON.parse(JSON.stringify(this.$store.state.meta.metas[this.meta.tn]))
// remove rollup from virtual columns // remove rollup from virtual columns
meta.v = meta.v.filter(cl => !cl.rollup || cl._cn !== this.column._cn) meta.v = meta.v.filter(cl => !cl.rl || cl._cn !== this.column._cn)
await this.$store.dispatch('sqlMgr/ActSqlOp', [{ await this.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.nodes.env, env: this.nodes.env,
@ -328,7 +328,7 @@ export default {
await this.deleteLookupColumn() await this.deleteLookupColumn()
} else if (this.column.formula) { } else if (this.column.formula) {
await this.deleteFormulaColumn() await this.deleteFormulaColumn()
} else if (this.column.rollup) { } else if (this.column.rl) {
await this.deleteRollupColumn() await this.deleteRollupColumn()
} else { } else {
await this.deleteRelation() await this.deleteRelation()

2
packages/nc-gui/plugins/ncApis/gqlApi.js

@ -135,7 +135,7 @@ export default class GqlApi {
} }
// add formula columns to query // add formula columns to query
str += this.meta.v.reduce((arr, v) => { str += this.meta.v.reduce((arr, v) => {
if (v.formula || v.rollup) { if (v.formula || v.rl) {
arr.push(v._cn) arr.push(v._cn)
} }
return arr return arr

4
packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts

@ -1903,9 +1903,9 @@ class BaseModelSql extends BaseModel {
// todo: optimize // todo: optimize
protected get selectRollups() { protected get selectRollups() {
return (this.virtualColumns || [])?.reduce((arr, v) => { return (this.virtualColumns || [])?.reduce((arr, v) => {
if (v.rollup) { if (v.rl) {
arr.push( arr.push(
genRollupSelect({knex: this.dbDriver, rollup: v.rollup}).as(v._cn) genRollupSelect({knex: this.dbDriver, rollup: v.rl}).as(v._cn)
); );
} }
return arr; return arr;

2
packages/nocodb/src/lib/sqlMgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts

@ -82,7 +82,7 @@ abstract class BaseGqlXcTsSchema extends BaseRender {
} }
const props = []; const props = [];
for (const v of args.v) { for (const v of args.v) {
if (!v.formula && !v.rollup) continue if (!v.formula && !v.rl) continue
props.push(`\t\t${v._cn}: JSON`) props.push(`\t\t${v._cn}: JSON`)
} }
return props.length ? `\r\n${props.join('\r\n')}\r\n` : ''; return props.length ? `\r\n${props.join('\r\n')}\r\n` : '';

Loading…
Cancel
Save