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 ]
jobs:
cypress-run:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v2
with:
start: docker-compose -f ./docker-compose-cypress.yml up -d
wait-on: 'http://localhost:3000'
wait-on-timeout: 900
# cypress-run:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Cypress run
# uses: cypress-io/github-action@v2
# with:
# start: docker-compose -f ./docker-compose-cypress.yml up -d
# wait-on: 'http://localhost:3000'
# wait-on-timeout: 900
docker:
runs-on: ubuntu-latest

1
cypress.json

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

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

@ -176,7 +176,7 @@ export default {
meta.v.push({
_cn: this.alias,
rollup: {
rl: {
...this.rollup.table,
...this.rollup.column,
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
},
rollup() {
return this.column && this.column.rollup
return this.column && this.column.rl
}
},
methods: {

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

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

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

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

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

@ -1903,9 +1903,9 @@ class BaseModelSql extends BaseModel {
// todo: optimize
protected get selectRollups() {
return (this.virtualColumns || [])?.reduce((arr, v) => {
if (v.rollup) {
if (v.rl) {
arr.push(
genRollupSelect({knex: this.dbDriver, rollup: v.rollup}).as(v._cn)
genRollupSelect({knex: this.dbDriver, rollup: v.rl}).as(v._cn)
);
}
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 = [];
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`)
}
return props.length ? `\r\n${props.join('\r\n')}\r\n` : '';

Loading…
Cancel
Save