Browse Source

fix(gui): public shared view issues

- hide virtual columns from filters and sort
- password protected form
- hide filter
- should be available without auth

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/669/head
Pranav C 3 years ago
parent
commit
63a27f0ed5
  1. 3
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue
  2. 2
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItemsModal.vue
  3. 4
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue
  4. 1
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue
  5. 1
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue
  6. 1
      packages/nc-gui/components/project/spreadsheet/public/xcForm.vue
  7. 15
      packages/nc-gui/components/project/spreadsheet/public/xcTable.vue
  8. 4
      packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue
  9. 9
      packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

3
packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue

@ -147,7 +147,8 @@ export default {
isPublic: Boolean,
rowId: [String, Number],
column: Object,
type: String
type: String,
password: String
},
data: () => ({
data: null,

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

@ -12,6 +12,7 @@
:is-new="isNew"
:size="10"
:meta="meta"
:password="password"
:parent-meta="parentMeta"
:primary-col="primaryCol"
:primary-key="primaryKey"
@ -37,6 +38,7 @@ export default {
readOnly: Boolean,
localState: Array,
isNew: Boolean,
password: String,
value: Boolean,
title: {
type: String,

4
packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue

@ -72,7 +72,9 @@
:is-new="isNew"
:size="10"
:meta="childMeta"
:parent-meta="meta"
:parent-meta="meta
:password="
password"
:primary-col="childPrimaryCol"
:primary-key="childPrimaryKey"
:api="childApi"

1
packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue

@ -36,6 +36,7 @@
:parent-meta="meta"
:primary-col="lookUpColumnAlias"
:api="lookupApi"
:password="password"
:read-only="true"
:query-params="queryParams"
/>

1
packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue

@ -75,6 +75,7 @@
:row-id="row && row[parentPrimaryKey]"
:column="column"
type="mm"
:password="password"
@new-record="showNewRecordModal"
@edit="editChild"
@unlink="unlinkChild"

1
packages/nc-gui/components/project/spreadsheet/public/xcForm.vue

@ -243,6 +243,7 @@ export default {
active: null,
loading: false,
showPasswordModal: false,
password: '',
submitting: false,
submitted: false,
client: null,

15
packages/nc-gui/components/project/spreadsheet/public/xcTable.vue

@ -5,6 +5,7 @@
</div>
<v-toolbar v-if="meta" height="40" dense class="elevation-0 xc-toolbar xc-border-bottom" style="z-index: 7;border-radius: 4px">
<!--
<div class="d-flex xc-border align-center search-box">
<v-menu bottom offset-y>
<template #activator="{on}">
@ -58,10 +59,11 @@
<span
v-if="relationType && false"
class="caption grey--text"
class="caption grey&#45;&#45;text"
>{{ refTable }}({{
relationPrimaryValue
}}) -> {{ relationType === 'hm' ? ' Has Many ' : ' Belongs To ' }} -> {{ table }}</span>
-->
<v-spacer />
@ -74,11 +76,11 @@
<!-- <fields-menu v-model="showFields" :field-list="fieldList" />-->
<sort-list-menu v-model="sortList" :field-list="fieldList" />
<sort-list-menu v-model="sortList" :field-list="realFieldList" />
<column-filter-menu v-model="filters" :field-list="fieldList" />
<column-filter-menu v-model="filters" :field-list="realFieldList" />
<v-menu>
<!-- <v-menu>
<template #activator="{ on, attrs }">
<v-icon
v-bind="attrs"
@ -98,12 +100,12 @@
{{ h.icon }}
</v-icon>
</v-list-item-icon>
<v-list-item-title :class="{'primary--text' : cellHeight === h.size}" style="text-transform: capitalize">
<v-list-item-title :class="{'primary&#45;&#45;text' : cellHeight === h.size}" style="text-transform: capitalize">
{{ h.size }}
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-menu>-->
</v-toolbar>
<div
@ -129,6 +131,7 @@
:nodes="{dbAlias:''}"
:sql-ui="sqlUi"
:columns-width="columnsWidth"
:password="password"
/>
</div>

4
packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

@ -151,6 +151,7 @@
>
<virtual-cell
v-if="columnObj.virtual"
:password="password"
:is-public="isPublicView"
:metas="metas"
:is-locked="isLocked "
@ -273,7 +274,8 @@ export default {
isVirtual: Boolean,
isLocked: Boolean,
columnsWidth: { type: Object },
isPkAvail: Boolean
isPkAvail: Boolean,
password: String
},
data: () => ({
resizingCol: null,

9
packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

@ -3391,7 +3391,6 @@ export default class NcMetaMgr {
protected async getSharedViewData(req, args: any): Promise<any> {
try {
console.log(args);
const viewMeta = await this.xcMeta
.knex('nc_shared_views')
.where({
@ -3403,6 +3402,14 @@ export default class NcMetaMgr {
// throw new Error('Invalid password')
// }
if (
viewMeta &&
viewMeta.password &&
viewMeta.password !== args.args.password
) {
throw new Error(this.INVALID_PASSWORD_ERROR);
}
const apiBuilder = this.app?.projectBuilders
?.find(pb => pb.id === viewMeta.project_id)
?.apiBuilders?.find(ab => ab.dbAlias === viewMeta.db_alias);

Loading…
Cancel
Save