Browse Source

chore(nocodb): primary value -> display value

pull/5117/head
Wing-Kam Wong 2 years ago
parent
commit
7463594019
  1. 8
      packages/nocodb/src/lib/meta/api/sync/helpers/job.ts
  2. 6
      packages/nocodb/src/lib/models/View.ts
  3. 2
      packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts
  4. 4
      packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts

8
packages/nocodb/src/lib/meta/api/sync/helpers/job.ts

@ -1292,7 +1292,7 @@ export default async (
async function nocoSetPrimary(aTblSchema) {
for (let idx = 0; idx < aTblSchema.length; idx++) {
logDetailed(
`[${idx + 1}/${aTblSchema.length}] Configuring Primary value : ${
`[${idx + 1}/${aTblSchema.length}] Configuring Display value : ${
aTblSchema[idx].name
}`
);
@ -2225,10 +2225,10 @@ export default async (
logDetailed('Migrating Lookup form Rollup columns completed');
}
}
logDetailed('Configuring Primary value column');
// configure primary values
logDetailed('Configuring Display Value column');
// configure Display Value
await nocoSetPrimary(aTblSchema);
logDetailed('Configuring primary value column completed');
logDetailed('Configuring Display Value column completed');
logBasic('Configuring User(s)');
// add users

6
packages/nocodb/src/lib/models/View.ts

@ -375,10 +375,10 @@ export default class View implements ViewType {
let kanbanShowLimit = 0;
if (view.type === ViewTypes.KANBAN && !copyFromView) {
// sort by primary value & attachment first, then by singleLineText & Number
// sort by display value & attachment first, then by singleLineText & Number
// so that later we can handle control `show` easily
columns.sort((a, b) => {
const primaryValueOrder = b.pv - a.pv;
const displayValueOrder = b.pv - a.pv;
const attachmentOrder =
+(b.uidt === UITypes.Attachment) - +(a.uidt === UITypes.Attachment);
const singleLineTextOrder =
@ -388,7 +388,7 @@ export default class View implements ViewType {
+(b.uidt === UITypes.Number) - +(a.uidt === UITypes.Number);
const defaultOrder = b.order - a.order;
return (
primaryValueOrder ||
displayValueOrder ||
attachmentOrder ||
singleLineTextOrder ||
numberOrder ||

2
packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts

@ -2511,7 +2511,7 @@ export default abstract class BaseApiBuilder<T extends Noco>
ctx,
filename: '',
}).getVitualColumns();
// set default primary values
// set default display values
ModelXcMetaFactory.create(
this.connectionConfig,
{}

4
packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts

@ -1,9 +1,9 @@
import { NcUpgraderCtx } from './NcUpgrader';
import { MetaTable } from '../utils/globals';
// before 0.104.3, primary value column can be in any position in table
// before 0.104.3, display value column can be in any position in table
// with this upgrade we introduced sticky primary column feature
// this upgrader will make primary value column first column in grid views
// this upgrader will make display value column first column in grid views
export default async function ({ ncMeta }: NcUpgraderCtx) {
const grid_columns = await ncMeta.metaList2(

Loading…
Cancel
Save