mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 15:25:59 +00:00
handle readonly connection in UI
This commit is contained in:
@@ -95,7 +95,8 @@ export class CollectionGridDisplay extends GridDisplay {
|
||||
cache: GridCache,
|
||||
setCache: ChangeCacheFunc,
|
||||
loadedRows,
|
||||
changeSet
|
||||
changeSet,
|
||||
readOnly = false
|
||||
) {
|
||||
super(config, setConfig, cache, setCache, driver);
|
||||
const changedDocs = _.compact(changeSet.updates.map(chs => chs.document));
|
||||
@@ -103,7 +104,7 @@ export class CollectionGridDisplay extends GridDisplay {
|
||||
this.columns = analyseCollectionDisplayColumns([...(loadedRows || []), ...changedDocs, ...insertedDocs], this);
|
||||
this.filterable = true;
|
||||
this.sortable = true;
|
||||
this.editable = true;
|
||||
this.editable = !readOnly;
|
||||
this.supportsReload = true;
|
||||
this.isDynamicStructure = true;
|
||||
this.changeSetKeyFields = ['_id'];
|
||||
|
||||
@@ -23,7 +23,8 @@ export class TableFormViewDisplay extends FormViewDisplay {
|
||||
dbinfo: DatabaseInfo,
|
||||
displayOptions,
|
||||
serverVersion,
|
||||
getDictionaryDescription: DictionaryDescriptionFunc = null
|
||||
getDictionaryDescription: DictionaryDescriptionFunc = null,
|
||||
isReadOnly = false
|
||||
) {
|
||||
super(config, setConfig, cache, setCache, driver, dbinfo, serverVersion);
|
||||
this.gridDisplay = new TableGridDisplay(
|
||||
@@ -36,7 +37,8 @@ export class TableFormViewDisplay extends FormViewDisplay {
|
||||
dbinfo,
|
||||
displayOptions,
|
||||
serverVersion,
|
||||
getDictionaryDescription
|
||||
getDictionaryDescription,
|
||||
isReadOnly
|
||||
);
|
||||
this.gridDisplay.addAllExpandedColumnsToSelected = true;
|
||||
|
||||
@@ -263,4 +265,8 @@ export class TableFormViewDisplay extends FormViewDisplay {
|
||||
isExpandedColumn(uniqueName: string) {
|
||||
return this.gridDisplay.isExpandedColumn(uniqueName);
|
||||
}
|
||||
|
||||
get editable() {
|
||||
return this.gridDisplay.editable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ export class TableGridDisplay extends GridDisplay {
|
||||
dbinfo: DatabaseInfo,
|
||||
public displayOptions: any,
|
||||
serverVersion,
|
||||
public getDictionaryDescription: DictionaryDescriptionFunc = null
|
||||
public getDictionaryDescription: DictionaryDescriptionFunc = null,
|
||||
isReadOnly = false
|
||||
) {
|
||||
super(config, setConfig, cache, setCache, driver, dbinfo, serverVersion);
|
||||
|
||||
@@ -53,7 +54,7 @@ export class TableGridDisplay extends GridDisplay {
|
||||
this.filterable = true;
|
||||
this.sortable = true;
|
||||
this.groupable = true;
|
||||
this.editable = true;
|
||||
this.editable = !isReadOnly;
|
||||
this.supportsReload = true;
|
||||
this.baseTable = this.table;
|
||||
if (this.table && this.table.columns) {
|
||||
|
||||
Reference in New Issue
Block a user