mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
add base code for console read only mode (#3466)
This commit is contained in:
parent
c86a8242f2
commit
69179adb6d
@ -33,6 +33,12 @@ const setFeaturesCompatibility = data => ({
|
|||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const SET_READ_ONLY_MODE = 'Main/SET_READ_ONLY_MODE';
|
||||||
|
const setReadOnlyMode = data => ({
|
||||||
|
type: SET_READ_ONLY_MODE,
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
|
||||||
const featureCompatibilityInit = () => {
|
const featureCompatibilityInit = () => {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const { serverVersion } = getState().main;
|
const { serverVersion } = getState().main;
|
||||||
@ -245,6 +251,12 @@ const mainReducer = (state = defaultState, action) => {
|
|||||||
};
|
};
|
||||||
case UPDATE_MIGRATION_STATUS_ERROR:
|
case UPDATE_MIGRATION_STATUS_ERROR:
|
||||||
return { ...state, migrationError: action.data };
|
return { ...state, migrationError: action.data };
|
||||||
|
case SET_READ_ONLY_MODE:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
readOnlyMode: action.data,
|
||||||
|
migrationMode: !action.data, // HACK
|
||||||
|
};
|
||||||
case HASURACTL_URL_ENV:
|
case HASURACTL_URL_ENV:
|
||||||
return { ...state, hasuractlEnv: action.data };
|
return { ...state, hasuractlEnv: action.data };
|
||||||
case UPDATE_MIGRATION_MODE:
|
case UPDATE_MIGRATION_MODE:
|
||||||
@ -301,6 +313,7 @@ export {
|
|||||||
UPDATE_MIGRATION_STATUS_ERROR,
|
UPDATE_MIGRATION_STATUS_ERROR,
|
||||||
UPDATE_ADMIN_SECRET_INPUT,
|
UPDATE_ADMIN_SECRET_INPUT,
|
||||||
loadMigrationStatus,
|
loadMigrationStatus,
|
||||||
|
setReadOnlyMode,
|
||||||
updateMigrationModeStatus,
|
updateMigrationModeStatus,
|
||||||
LOGIN_IN_PROGRESS,
|
LOGIN_IN_PROGRESS,
|
||||||
LOGIN_ERROR,
|
LOGIN_ERROR,
|
||||||
|
@ -2,6 +2,7 @@ const defaultState = {
|
|||||||
migrationError: null,
|
migrationError: null,
|
||||||
hasuractlEnv: null,
|
hasuractlEnv: null,
|
||||||
migrationMode: true,
|
migrationMode: true,
|
||||||
|
readOnlyMode: false,
|
||||||
migrationModeProgress: false,
|
migrationModeProgress: false,
|
||||||
metadataExport: { error: false, info: null },
|
metadataExport: { error: false, info: null },
|
||||||
adminSecretInput: null,
|
adminSecretInput: null,
|
||||||
|
@ -37,6 +37,7 @@ const executeSQL = (isMigration, migrationName) => (dispatch, getState) => {
|
|||||||
|
|
||||||
const sql = getState().rawSQL.sql;
|
const sql = getState().rawSQL.sql;
|
||||||
const currMigrationMode = getState().main.migrationMode;
|
const currMigrationMode = getState().main.migrationMode;
|
||||||
|
const readOnlyMode = getState().main.readOnlyMode;
|
||||||
|
|
||||||
const migrateUrl = returnMigrateUrl(currMigrationMode);
|
const migrateUrl = returnMigrateUrl(currMigrationMode);
|
||||||
const isCascadeChecked = getState().rawSQL.isCascadeChecked;
|
const isCascadeChecked = getState().rawSQL.isCascadeChecked;
|
||||||
@ -45,7 +46,11 @@ const executeSQL = (isMigration, migrationName) => (dispatch, getState) => {
|
|||||||
const schemaChangesUp = [
|
const schemaChangesUp = [
|
||||||
{
|
{
|
||||||
type: 'run_sql',
|
type: 'run_sql',
|
||||||
args: { sql: sql, cascade: isCascadeChecked },
|
args: {
|
||||||
|
sql: sql,
|
||||||
|
cascade: isCascadeChecked,
|
||||||
|
read_only: readOnlyMode,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
// check if track view enabled
|
// check if track view enabled
|
||||||
|
@ -69,6 +69,7 @@ class Schema extends Component {
|
|||||||
schema,
|
schema,
|
||||||
schemaList,
|
schemaList,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
untrackedRelations,
|
untrackedRelations,
|
||||||
currentSchema,
|
currentSchema,
|
||||||
dispatch,
|
dispatch,
|
||||||
@ -326,6 +327,10 @@ class Schema extends Component {
|
|||||||
|
|
||||||
const getUntrackedTablesSection = () => {
|
const getUntrackedTablesSection = () => {
|
||||||
const getTrackAllBtn = () => {
|
const getTrackAllBtn = () => {
|
||||||
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let trackAllBtn = null;
|
let trackAllBtn = null;
|
||||||
|
|
||||||
const trackAllTables = e => {
|
const trackAllTables = e => {
|
||||||
@ -362,22 +367,19 @@ class Schema extends Component {
|
|||||||
const untrackedTablesList = [];
|
const untrackedTablesList = [];
|
||||||
|
|
||||||
allUntrackedTables.forEach((table, i) => {
|
allUntrackedTables.forEach((table, i) => {
|
||||||
const handleTrackTable = e => {
|
const getTrackBtn = () => {
|
||||||
e.preventDefault();
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch(setTableName(table.table_name));
|
const handleTrackTable = e => {
|
||||||
dispatch(addExistingTableSql());
|
e.preventDefault();
|
||||||
};
|
|
||||||
|
|
||||||
const isGQLCompatible = gqlPattern.test(table.table_name);
|
dispatch(setTableName(table.table_name));
|
||||||
const gqlCompatibilityWarning = !isGQLCompatible ? (
|
dispatch(addExistingTableSql());
|
||||||
<span className={styles.add_mar_left_mid}>
|
};
|
||||||
<GqlCompatibilityWarning />
|
|
||||||
</span>
|
|
||||||
) : null;
|
|
||||||
|
|
||||||
untrackedTablesList.push(
|
return (
|
||||||
<div className={styles.padd_bottom} key={`untracked-${i}`}>
|
|
||||||
<div
|
<div
|
||||||
className={`${styles.display_inline} ${styles.add_mar_right}`}
|
className={`${styles.display_inline} ${styles.add_mar_right}`}
|
||||||
>
|
>
|
||||||
@ -391,6 +393,19 @@ class Schema extends Component {
|
|||||||
Track
|
Track
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isGQLCompatible = gqlPattern.test(table.table_name);
|
||||||
|
const gqlCompatibilityWarning = !isGQLCompatible ? (
|
||||||
|
<span className={styles.add_mar_left_mid}>
|
||||||
|
<GqlCompatibilityWarning />
|
||||||
|
</span>
|
||||||
|
) : null;
|
||||||
|
|
||||||
|
untrackedTablesList.push(
|
||||||
|
<div className={styles.padd_bottom} key={`untracked-${i}`}>
|
||||||
|
{getTrackBtn()}
|
||||||
<div className={styles.display_inline}>
|
<div className={styles.display_inline}>
|
||||||
{displayTableName(table)}
|
{displayTableName(table)}
|
||||||
</div>
|
</div>
|
||||||
@ -428,6 +443,10 @@ class Schema extends Component {
|
|||||||
|
|
||||||
const getUntrackedRelationsSection = () => {
|
const getUntrackedRelationsSection = () => {
|
||||||
const getTrackAllBtn = () => {
|
const getTrackAllBtn = () => {
|
||||||
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let trackAllBtn = null;
|
let trackAllBtn = null;
|
||||||
|
|
||||||
const trackAllRelations = e => {
|
const trackAllRelations = e => {
|
||||||
@ -467,10 +486,31 @@ class Schema extends Component {
|
|||||||
untrackedRelations.forEach((rel, i) => {
|
untrackedRelations.forEach((rel, i) => {
|
||||||
const relData = rel.data;
|
const relData = rel.data;
|
||||||
|
|
||||||
const handleAddRel = e => {
|
const getTrackBtn = () => {
|
||||||
e.preventDefault();
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch(autoAddRelName(rel));
|
const handleTrackRel = e => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
dispatch(autoAddRelName(rel));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`${styles.display_inline} ${styles.add_mar_right}`}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
className={styles.display_inline}
|
||||||
|
color="white"
|
||||||
|
size="xs"
|
||||||
|
onClick={handleTrackRel}
|
||||||
|
>
|
||||||
|
Track
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const relFrom = <b>{relData.lTable}</b>;
|
const relFrom = <b>{relData.lTable}</b>;
|
||||||
@ -483,18 +523,7 @@ class Schema extends Component {
|
|||||||
|
|
||||||
untrackedRelList.push(
|
untrackedRelList.push(
|
||||||
<div className={styles.padd_bottom} key={`untracked-rel-${i}`}>
|
<div className={styles.padd_bottom} key={`untracked-rel-${i}`}>
|
||||||
<div
|
{getTrackBtn()}
|
||||||
className={`${styles.display_inline} ${styles.add_mar_right}`}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
className={styles.display_inline}
|
|
||||||
color="white"
|
|
||||||
size="xs"
|
|
||||||
onClick={handleAddRel}
|
|
||||||
>
|
|
||||||
Track
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div className={styles.display_inline}>
|
<div className={styles.display_inline}>
|
||||||
<span>
|
<span>
|
||||||
{relFrom} → {relTo}
|
{relFrom} → {relTo}
|
||||||
@ -540,23 +569,35 @@ class Schema extends Component {
|
|||||||
const trackableFunctionList = [];
|
const trackableFunctionList = [];
|
||||||
|
|
||||||
trackableFuncs.forEach((p, i) => {
|
trackableFuncs.forEach((p, i) => {
|
||||||
trackableFunctionList.push(
|
const getTrackBtn = () => {
|
||||||
<div className={styles.padd_bottom} key={`untracked-function-${i}`}>
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleTrackFn = e => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
dispatch(addExistingFunction(p.function_name));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
<div
|
<div
|
||||||
className={`${styles.display_inline} ${styles.add_mar_right}`}
|
className={`${styles.display_inline} ${styles.add_mar_right}`}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
data-test={`add-track-function-${p.function_name}`}
|
data-test={`add-track-function-${p.function_name}`}
|
||||||
className={`${styles.display_inline} btn btn-xs btn-default`}
|
className={`${styles.display_inline} btn btn-xs btn-default`}
|
||||||
onClick={e => {
|
onClick={handleTrackFn}
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
dispatch(addExistingFunction(p.function_name));
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Track
|
Track
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
trackableFunctionList.push(
|
||||||
|
<div className={styles.padd_bottom} key={`untracked-function-${i}`}>
|
||||||
|
{getTrackBtn()}
|
||||||
<div className={styles.display_inline}>
|
<div className={styles.display_inline}>
|
||||||
<span>{p.function_name}</span>
|
<span>{p.function_name}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -711,6 +752,7 @@ const mapStateToProps = state => ({
|
|||||||
schema: state.tables.allSchemas,
|
schema: state.tables.allSchemas,
|
||||||
schemaList: state.tables.schemaList,
|
schemaList: state.tables.schemaList,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
untrackedRelations: state.tables.untrackedRelations,
|
untrackedRelations: state.tables.untrackedRelations,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
functionsList: [...state.tables.postgresFunctions],
|
functionsList: [...state.tables.postgresFunctions],
|
||||||
|
@ -28,6 +28,7 @@ class EditItem extends Component {
|
|||||||
schemas,
|
schemas,
|
||||||
oldItem,
|
oldItem,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
ongoingRequest,
|
ongoingRequest,
|
||||||
lastError,
|
lastError,
|
||||||
lastSuccess,
|
lastSuccess,
|
||||||
@ -253,6 +254,7 @@ class EditItem extends Component {
|
|||||||
table={currentTable}
|
table={currentTable}
|
||||||
tabName="edit"
|
tabName="edit"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={styles.insertContainer + ' container-fluid'}>
|
<div className={styles.insertContainer + ' container-fluid'}>
|
||||||
@ -292,6 +294,7 @@ EditItem.propTypes = {
|
|||||||
lastSuccess: PropTypes.object,
|
lastSuccess: PropTypes.object,
|
||||||
lastError: PropTypes.object,
|
lastError: PropTypes.object,
|
||||||
migrationMode: PropTypes.bool.isRequired,
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
count: PropTypes.number,
|
count: PropTypes.number,
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
@ -302,6 +305,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
...state.tables.update,
|
...state.tables.update,
|
||||||
schemas: state.tables.allSchemas,
|
schemas: state.tables.allSchemas,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -63,6 +63,7 @@ const ViewRows = ({
|
|||||||
updateInvocationFunction,
|
updateInvocationFunction,
|
||||||
triggeredRow,
|
triggeredRow,
|
||||||
triggeredFunction,
|
triggeredFunction,
|
||||||
|
readOnlyMode,
|
||||||
}) => {
|
}) => {
|
||||||
const styles = require('../../../Common/TableCommon/Table.scss');
|
const styles = require('../../../Common/TableCommon/Table.scss');
|
||||||
|
|
||||||
@ -429,7 +430,7 @@ const ViewRows = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showActionBtns = !_isSingleRow && !isView;
|
const showActionBtns = !readOnlyMode && !_isSingleRow && !isView;
|
||||||
|
|
||||||
if (showActionBtns) {
|
if (showActionBtns) {
|
||||||
const pkClause = getPKClause();
|
const pkClause = getPKClause();
|
||||||
@ -686,6 +687,7 @@ const ViewRows = ({
|
|||||||
curDepth={curDepth + 1}
|
curDepth={curDepth + 1}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
expandedRow={expandedRow}
|
expandedRow={expandedRow}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -148,6 +148,7 @@ class ViewTable extends Component {
|
|||||||
count,
|
count,
|
||||||
activePath,
|
activePath,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
ongoingRequest,
|
ongoingRequest,
|
||||||
isProgressing,
|
isProgressing,
|
||||||
lastError,
|
lastError,
|
||||||
@ -201,6 +202,7 @@ class ViewTable extends Component {
|
|||||||
updateInvocationFunction={this.updateInvocationFunction.bind(this)}
|
updateInvocationFunction={this.updateInvocationFunction.bind(this)}
|
||||||
triggeredRow={triggeredRow}
|
triggeredRow={triggeredRow}
|
||||||
triggeredFunction={triggeredFunction}
|
triggeredFunction={triggeredFunction}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -212,6 +214,7 @@ class ViewTable extends Component {
|
|||||||
table={tableSchema}
|
table={tableSchema}
|
||||||
tabName="browse"
|
tabName="browse"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -245,6 +248,7 @@ ViewTable.propTypes = {
|
|||||||
query: PropTypes.object.isRequired,
|
query: PropTypes.object.isRequired,
|
||||||
curFilter: PropTypes.object.isRequired,
|
curFilter: PropTypes.object.isRequired,
|
||||||
migrationMode: PropTypes.bool.isRequired,
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
ongoingRequest: PropTypes.bool.isRequired,
|
ongoingRequest: PropTypes.bool.isRequired,
|
||||||
isProgressing: PropTypes.bool.isRequired,
|
isProgressing: PropTypes.bool.isRequired,
|
||||||
rows: PropTypes.array.isRequired,
|
rows: PropTypes.array.isRequired,
|
||||||
@ -262,6 +266,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
schemas: state.tables.allSchemas,
|
schemas: state.tables.allSchemas,
|
||||||
tableComment: state.tables.tableComment,
|
tableComment: state.tables.tableComment,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
serverVersion: state.main.serverVersion,
|
serverVersion: state.main.serverVersion,
|
||||||
...state.tables.view,
|
...state.tables.view,
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,14 @@ import {
|
|||||||
getTableRelationshipsRoute,
|
getTableRelationshipsRoute,
|
||||||
} from '../../../Common/utils/routesUtils';
|
} from '../../../Common/utils/routesUtils';
|
||||||
|
|
||||||
const TableHeader = ({ tabName, count, table, migrationMode, dispatch }) => {
|
const TableHeader = ({
|
||||||
|
tabName,
|
||||||
|
count,
|
||||||
|
table,
|
||||||
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
|
dispatch,
|
||||||
|
}) => {
|
||||||
const styles = require('../../../Common/TableCommon/Table.scss');
|
const styles = require('../../../Common/TableCommon/Table.scss');
|
||||||
|
|
||||||
const capitalisedTabName = tabName[0].toUpperCase() + tabName.slice(1);
|
const capitalisedTabName = tabName[0].toUpperCase() + tabName.slice(1);
|
||||||
@ -97,7 +104,8 @@ const TableHeader = ({ tabName, count, table, migrationMode, dispatch }) => {
|
|||||||
`Browse Rows ${countDisplay}`,
|
`Browse Rows ${countDisplay}`,
|
||||||
'table-browse-rows'
|
'table-browse-rows'
|
||||||
)}
|
)}
|
||||||
{isTable &&
|
{!readOnlyMode &&
|
||||||
|
isTable &&
|
||||||
getTab(
|
getTab(
|
||||||
'insert',
|
'insert',
|
||||||
getTableInsertRowRoute(tableSchema, tableName, isTable),
|
getTableInsertRowRoute(tableSchema, tableName, isTable),
|
||||||
|
@ -47,6 +47,7 @@ class InsertItem extends Component {
|
|||||||
clone,
|
clone,
|
||||||
schemas,
|
schemas,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
ongoingRequest,
|
ongoingRequest,
|
||||||
lastError,
|
lastError,
|
||||||
lastSuccess,
|
lastSuccess,
|
||||||
@ -260,6 +261,7 @@ class InsertItem extends Component {
|
|||||||
table={currentTable}
|
table={currentTable}
|
||||||
tabName="insert"
|
tabName="insert"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={styles.insertContainer + ' container-fluid'}>
|
<div className={styles.insertContainer + ' container-fluid'}>
|
||||||
@ -345,6 +347,7 @@ InsertItem.propTypes = {
|
|||||||
lastSuccess: PropTypes.object,
|
lastSuccess: PropTypes.object,
|
||||||
lastError: PropTypes.object,
|
lastError: PropTypes.object,
|
||||||
migrationMode: PropTypes.bool.isRequired,
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
count: PropTypes.number,
|
count: PropTypes.number,
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
@ -356,6 +359,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
schemas: state.tables.allSchemas,
|
schemas: state.tables.allSchemas,
|
||||||
...state.tables.view,
|
...state.tables.view,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -62,6 +62,7 @@ class ModifyTable extends React.Component {
|
|||||||
allTables,
|
allTables,
|
||||||
dispatch,
|
dispatch,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
currentSchema,
|
currentSchema,
|
||||||
tableCommentEdit,
|
tableCommentEdit,
|
||||||
columnEdit,
|
columnEdit,
|
||||||
@ -176,6 +177,7 @@ class ModifyTable extends React.Component {
|
|||||||
table={table}
|
table={table}
|
||||||
tabName="modify"
|
tabName="modify"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={`container-fluid ${styles.padd_left_remove}`}>
|
<div className={`container-fluid ${styles.padd_left_remove}`}>
|
||||||
@ -270,6 +272,7 @@ ModifyTable.propTypes = {
|
|||||||
currentSchema: PropTypes.string.isRequired,
|
currentSchema: PropTypes.string.isRequired,
|
||||||
allTables: PropTypes.array.isRequired,
|
allTables: PropTypes.array.isRequired,
|
||||||
migrationMode: PropTypes.bool.isRequired,
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
activeEdit: PropTypes.object.isRequired,
|
activeEdit: PropTypes.object.isRequired,
|
||||||
fkAdd: PropTypes.object.isRequired,
|
fkAdd: PropTypes.object.isRequired,
|
||||||
relAdd: PropTypes.object.isRequired,
|
relAdd: PropTypes.object.isRequired,
|
||||||
@ -288,6 +291,7 @@ const mapStateToProps = (state, ownProps) => ({
|
|||||||
tableName: ownProps.params.table,
|
tableName: ownProps.params.table,
|
||||||
allTables: state.tables.allSchemas,
|
allTables: state.tables.allSchemas,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
serverVersion: state.main.serverVersion,
|
serverVersion: state.main.serverVersion,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
columnEdit: state.tables.modify.columnEdit,
|
columnEdit: state.tables.modify.columnEdit,
|
||||||
|
@ -49,8 +49,9 @@ class ModifyView extends Component {
|
|||||||
dispatch,
|
dispatch,
|
||||||
currentSchema,
|
currentSchema,
|
||||||
tableCommentEdit,
|
tableCommentEdit,
|
||||||
migrationMode,
|
|
||||||
rootFieldsEdit,
|
rootFieldsEdit,
|
||||||
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const styles = require('./ModifyTable.scss');
|
const styles = require('./ModifyTable.scss');
|
||||||
@ -192,6 +193,7 @@ class ModifyView extends Component {
|
|||||||
table={tableSchema}
|
table={tableSchema}
|
||||||
tabName="modify"
|
tabName="modify"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={'container-fluid ' + styles.padd_left_remove}>
|
<div className={'container-fluid ' + styles.padd_left_remove}>
|
||||||
@ -241,6 +243,8 @@ ModifyView.propTypes = {
|
|||||||
currentSchema: PropTypes.string.isRequired,
|
currentSchema: PropTypes.string.isRequired,
|
||||||
activeEdit: PropTypes.object.isRequired,
|
activeEdit: PropTypes.object.isRequired,
|
||||||
ongoingRequest: PropTypes.bool.isRequired,
|
ongoingRequest: PropTypes.bool.isRequired,
|
||||||
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
lastError: PropTypes.object,
|
lastError: PropTypes.object,
|
||||||
lastSuccess: PropTypes.bool,
|
lastSuccess: PropTypes.bool,
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
@ -254,6 +258,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
sql: state.rawSQL.sql,
|
sql: state.rawSQL.sql,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
serverVersion: state.main.serverVersion,
|
serverVersion: state.main.serverVersion,
|
||||||
...state.tables.modify,
|
...state.tables.modify,
|
||||||
};
|
};
|
||||||
|
@ -118,6 +118,7 @@ class Permissions extends Component {
|
|||||||
lastSuccess,
|
lastSuccess,
|
||||||
permissionsState,
|
permissionsState,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
currentSchema,
|
currentSchema,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
@ -183,6 +184,7 @@ class Permissions extends Component {
|
|||||||
table={tableSchema}
|
table={tableSchema}
|
||||||
tabName="permissions"
|
tabName="permissions"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1461,6 +1463,10 @@ class Permissions extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getClonePermsSection = () => {
|
const getClonePermsSection = () => {
|
||||||
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// const applySameSelected = e => {
|
// const applySameSelected = e => {
|
||||||
// const isChecked = e.target.checked;
|
// const isChecked = e.target.checked;
|
||||||
// const selectedRole = e.target.getAttribute('data-role');
|
// const selectedRole = e.target.getAttribute('data-role');
|
||||||
@ -1620,6 +1626,10 @@ class Permissions extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getButtonsSection = () => {
|
const getButtonsSection = () => {
|
||||||
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const dispatchSavePermissions = () => {
|
const dispatchSavePermissions = () => {
|
||||||
dispatch(permChangePermissions(permChangeTypes.save));
|
dispatch(permChangePermissions(permChangeTypes.save));
|
||||||
};
|
};
|
||||||
@ -1800,6 +1810,7 @@ Permissions.propTypes = {
|
|||||||
tableType: PropTypes.string.isRequired,
|
tableType: PropTypes.string.isRequired,
|
||||||
allSchemas: PropTypes.array.isRequired,
|
allSchemas: PropTypes.array.isRequired,
|
||||||
migrationMode: PropTypes.bool.isRequired,
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
currentSchema: PropTypes.string.isRequired,
|
currentSchema: PropTypes.string.isRequired,
|
||||||
activeEdit: PropTypes.object.isRequired,
|
activeEdit: PropTypes.object.isRequired,
|
||||||
permissionsState: PropTypes.object.isRequired,
|
permissionsState: PropTypes.object.isRequired,
|
||||||
@ -1815,6 +1826,7 @@ const mapStateToProps = (state, ownProps) => ({
|
|||||||
allSchemas: state.tables.allSchemas,
|
allSchemas: state.tables.allSchemas,
|
||||||
schemaList: state.tables.schemaList,
|
schemaList: state.tables.schemaList,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
serverVersion: state.main.serverVersion ? state.main.serverVersion : '',
|
serverVersion: state.main.serverVersion ? state.main.serverVersion : '',
|
||||||
...state.tables.modify,
|
...state.tables.modify,
|
||||||
|
@ -72,7 +72,7 @@ class RelationshipEditor extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { dispatch, relConfig } = this.props;
|
const { dispatch, relConfig, readOnlyMode } = this.props;
|
||||||
const { text, isEditting } = this.state;
|
const { text, isEditting } = this.state;
|
||||||
|
|
||||||
const { relName } = relConfig;
|
const { relName } = relConfig;
|
||||||
@ -92,23 +92,37 @@ class RelationshipEditor extends React.Component {
|
|||||||
dispatch(deleteRelMigrate(relConfig));
|
dispatch(deleteRelMigrate(relConfig));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const collapsed = () => (
|
const collapsed = () => {
|
||||||
<div>
|
const getEditBtn = () => {
|
||||||
<Button
|
if (readOnlyMode) {
|
||||||
color={'white'}
|
return null;
|
||||||
size={'xs'}
|
}
|
||||||
onClick={this.toggleEditor}
|
|
||||||
data-test={`relationship-toggle-editor-${relName}`}
|
return (
|
||||||
>
|
<React.Fragment>
|
||||||
Edit
|
<Button
|
||||||
</Button>
|
color={'white'}
|
||||||
|
size={'xs'}
|
||||||
<b>{relName}</b> {gqlCompatibilityWarning}
|
onClick={this.toggleEditor}
|
||||||
<div className={tableStyles.relationshipTopPadding}>
|
data-test={`relationship-toggle-editor-${relName}`}
|
||||||
{getRelDef(relConfig)}
|
>
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{getEditBtn()}
|
||||||
|
<b>{relName}</b> {gqlCompatibilityWarning}
|
||||||
|
<div className={tableStyles.relationshipTopPadding}>
|
||||||
|
{getRelDef(relConfig)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
};
|
||||||
|
|
||||||
const expanded = () => (
|
const expanded = () => (
|
||||||
<div className={styles.activeEdit}>
|
<div className={styles.activeEdit}>
|
||||||
|
@ -318,6 +318,7 @@ class Relationships extends Component {
|
|||||||
manualRelAdd,
|
manualRelAdd,
|
||||||
currentSchema,
|
currentSchema,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
schemaList,
|
schemaList,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const styles = require('../TableModify/ModifyTable.scss');
|
const styles = require('../TableModify/ModifyTable.scss');
|
||||||
@ -383,6 +384,7 @@ class Relationships extends Component {
|
|||||||
<RelationshipEditor
|
<RelationshipEditor
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
key={rel.objRel.rel_name}
|
key={rel.objRel.rel_name}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
relConfig={findAllFromRel(
|
relConfig={findAllFromRel(
|
||||||
allSchemas,
|
allSchemas,
|
||||||
tableSchema,
|
tableSchema,
|
||||||
@ -396,6 +398,7 @@ class Relationships extends Component {
|
|||||||
<RelationshipEditor
|
<RelationshipEditor
|
||||||
key={rel.arrRel.rel_name}
|
key={rel.arrRel.rel_name}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
relConfig={findAllFromRel(
|
relConfig={findAllFromRel(
|
||||||
allSchemas,
|
allSchemas,
|
||||||
tableSchema,
|
tableSchema,
|
||||||
@ -418,6 +421,51 @@ class Relationships extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getAddRelSection = () => {
|
||||||
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
let addRelSection = null;
|
||||||
|
|
||||||
|
if (relAdd.isActive) {
|
||||||
|
addRelSection = (
|
||||||
|
<div className={styles.activeEdit}>
|
||||||
|
<AddRelationship
|
||||||
|
tableName={tableName}
|
||||||
|
currentSchema={currentSchema}
|
||||||
|
allSchemas={allSchemas}
|
||||||
|
cachedRelationshipData={relAdd}
|
||||||
|
dispatch={dispatch}
|
||||||
|
/>
|
||||||
|
<hr />
|
||||||
|
<AddManualRelationship
|
||||||
|
tableSchema={tableSchema}
|
||||||
|
allSchemas={allSchemas}
|
||||||
|
schemaList={schemaList}
|
||||||
|
relAdd={manualRelAdd}
|
||||||
|
dispatch={dispatch}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
addRelSection = (
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
color="white"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
dispatch(addNewRelClicked());
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
+ Add relationship
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return addRelSection;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.container} container-fluid`}>
|
<div className={`${styles.container} container-fluid`}>
|
||||||
<TableHeader
|
<TableHeader
|
||||||
@ -425,6 +473,7 @@ class Relationships extends Component {
|
|||||||
table={tableSchema}
|
table={tableSchema}
|
||||||
tabName="relationships"
|
tabName="relationships"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={`${styles.padd_left_remove} container-fluid`}>
|
<div className={`${styles.padd_left_remove} container-fluid`}>
|
||||||
@ -432,36 +481,7 @@ class Relationships extends Component {
|
|||||||
<h4 className={styles.subheading_text}>Relationships</h4>
|
<h4 className={styles.subheading_text}>Relationships</h4>
|
||||||
{addedRelationshipsView}
|
{addedRelationshipsView}
|
||||||
<br />
|
<br />
|
||||||
{relAdd.isActive ? (
|
{getAddRelSection()}
|
||||||
<div className={styles.activeEdit}>
|
|
||||||
<AddRelationship
|
|
||||||
tableName={tableName}
|
|
||||||
currentSchema={currentSchema}
|
|
||||||
allSchemas={allSchemas}
|
|
||||||
cachedRelationshipData={relAdd}
|
|
||||||
dispatch={dispatch}
|
|
||||||
/>
|
|
||||||
<hr />
|
|
||||||
<AddManualRelationship
|
|
||||||
tableSchema={tableSchema}
|
|
||||||
allSchemas={allSchemas}
|
|
||||||
schemaList={schemaList}
|
|
||||||
relAdd={manualRelAdd}
|
|
||||||
dispatch={dispatch}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<Button
|
|
||||||
type="submit"
|
|
||||||
color="white"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => {
|
|
||||||
dispatch(addNewRelClicked());
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
+ Add relationship
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={`${styles.fixed} hidden`}>{alert}</div>
|
<div className={`${styles.fixed} hidden`}>{alert}</div>
|
||||||
@ -479,6 +499,7 @@ Relationships.propTypes = {
|
|||||||
relAdd: PropTypes.object.isRequired,
|
relAdd: PropTypes.object.isRequired,
|
||||||
manualRelAdd: PropTypes.object.isRequired,
|
manualRelAdd: PropTypes.object.isRequired,
|
||||||
migrationMode: PropTypes.bool.isRequired,
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
ongoingRequest: PropTypes.bool.isRequired,
|
ongoingRequest: PropTypes.bool.isRequired,
|
||||||
lastError: PropTypes.object,
|
lastError: PropTypes.object,
|
||||||
lastFormError: PropTypes.object,
|
lastFormError: PropTypes.object,
|
||||||
@ -492,6 +513,7 @@ const mapStateToProps = (state, ownProps) => ({
|
|||||||
allSchemas: state.tables.allSchemas,
|
allSchemas: state.tables.allSchemas,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
serverVersion: state.main.serverVersion,
|
serverVersion: state.main.serverVersion,
|
||||||
schemaList: state.tables.schemaList,
|
schemaList: state.tables.schemaList,
|
||||||
...state.tables.modify,
|
...state.tables.modify,
|
||||||
|
@ -33,6 +33,7 @@ class RelationshipsView extends Component {
|
|||||||
manualRelAdd,
|
manualRelAdd,
|
||||||
currentSchema,
|
currentSchema,
|
||||||
migrationMode,
|
migrationMode,
|
||||||
|
readOnlyMode,
|
||||||
schemaList,
|
schemaList,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const styles = require('../TableModify/ModifyTable.scss');
|
const styles = require('../TableModify/ModifyTable.scss');
|
||||||
@ -140,6 +141,7 @@ class RelationshipsView extends Component {
|
|||||||
table={tableSchema}
|
table={tableSchema}
|
||||||
tabName="relationships"
|
tabName="relationships"
|
||||||
migrationMode={migrationMode}
|
migrationMode={migrationMode}
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={`${styles.padd_left_remove} container-fluid`}>
|
<div className={`${styles.padd_left_remove} container-fluid`}>
|
||||||
@ -170,6 +172,8 @@ RelationshipsView.propTypes = {
|
|||||||
activeEdit: PropTypes.object.isRequired,
|
activeEdit: PropTypes.object.isRequired,
|
||||||
manualRelAdd: PropTypes.object.isRequired,
|
manualRelAdd: PropTypes.object.isRequired,
|
||||||
ongoingRequest: PropTypes.bool.isRequired,
|
ongoingRequest: PropTypes.bool.isRequired,
|
||||||
|
migrationMode: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
lastError: PropTypes.object,
|
lastError: PropTypes.object,
|
||||||
lastFormError: PropTypes.object,
|
lastFormError: PropTypes.object,
|
||||||
lastSuccess: PropTypes.bool,
|
lastSuccess: PropTypes.bool,
|
||||||
@ -182,6 +186,7 @@ const mapStateToProps = (state, ownProps) => ({
|
|||||||
allSchemas: state.tables.allSchemas,
|
allSchemas: state.tables.allSchemas,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
migrationMode: state.main.migrationMode,
|
migrationMode: state.main.migrationMode,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
serverVersion: state.main.serverVersion,
|
serverVersion: state.main.serverVersion,
|
||||||
schemaList: state.tables.schemaList,
|
schemaList: state.tables.schemaList,
|
||||||
...state.tables.modify,
|
...state.tables.modify,
|
||||||
|
@ -16,6 +16,7 @@ const EventSubSidebar = ({
|
|||||||
// children,
|
// children,
|
||||||
dispatch,
|
dispatch,
|
||||||
location,
|
location,
|
||||||
|
readOnlyMode,
|
||||||
}) => {
|
}) => {
|
||||||
const styles = require('../../Common/Layout/LeftSubSidebar/LeftSubSidebar.scss');
|
const styles = require('../../Common/Layout/LeftSubSidebar/LeftSubSidebar.scss');
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ const EventSubSidebar = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<LeftSubSidebar
|
<LeftSubSidebar
|
||||||
showAddBtn
|
showAddBtn={!readOnlyMode}
|
||||||
searchInput={getSearchInput()}
|
searchInput={getSearchInput()}
|
||||||
heading={`Event Triggers (${triggerList.length})`}
|
heading={`Event Triggers (${triggerList.length})`}
|
||||||
addLink={'/events/manage/triggers/add'}
|
addLink={'/events/manage/triggers/add'}
|
||||||
@ -110,6 +111,7 @@ const mapStateToProps = state => {
|
|||||||
currentTrigger: state.triggers.currentTrigger,
|
currentTrigger: state.triggers.currentTrigger,
|
||||||
triggerList: state.triggers.triggerList,
|
triggerList: state.triggers.triggerList,
|
||||||
listingTrigger: state.triggers.listingTrigger,
|
listingTrigger: state.triggers.listingTrigger,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class EventTrigger extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { dispatch, listingTrigger } = this.props;
|
const { dispatch, listingTrigger, readOnlyMode } = this.props;
|
||||||
|
|
||||||
const styles = require('../../../Common/Layout/LeftSubSidebar/LeftSubSidebar.scss');
|
const styles = require('../../../Common/Layout/LeftSubSidebar/LeftSubSidebar.scss');
|
||||||
|
|
||||||
@ -52,6 +52,10 @@ class EventTrigger extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getAddBtn = () => {
|
const getAddBtn = () => {
|
||||||
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const handleClick = e => {
|
const handleClick = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@ -127,6 +131,7 @@ const mapStateToProps = state => ({
|
|||||||
untrackedRelations: state.tables.untrackedRelations,
|
untrackedRelations: state.tables.untrackedRelations,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
listingTrigger: state.triggers.listingTrigger,
|
listingTrigger: state.triggers.listingTrigger,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
});
|
});
|
||||||
|
|
||||||
const eventTriggerConnector = connect => connect(mapStateToProps)(EventTrigger);
|
const eventTriggerConnector = connect => connect(mapStateToProps)(EventTrigger);
|
||||||
|
@ -9,6 +9,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
allSchemas: state.tables.allSchemas,
|
allSchemas: state.tables.allSchemas,
|
||||||
serverVersion: state.main.serverVersion,
|
serverVersion: state.main.serverVersion,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ class Modify extends React.Component {
|
|||||||
modifyTriggerName,
|
modifyTriggerName,
|
||||||
modifyTrigger,
|
modifyTrigger,
|
||||||
triggerList,
|
triggerList,
|
||||||
|
readOnlyMode,
|
||||||
dispatch,
|
dispatch,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ class Modify extends React.Component {
|
|||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
triggerName={modifyTriggerName}
|
triggerName={modifyTriggerName}
|
||||||
tabName="modify"
|
tabName="modify"
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
|
@ -127,6 +127,7 @@ class ViewTable extends Component {
|
|||||||
lastSuccess,
|
lastSuccess,
|
||||||
dispatch,
|
dispatch,
|
||||||
expandedRow,
|
expandedRow,
|
||||||
|
readOnlyMode,
|
||||||
} = this.props; // eslint-disable-line no-unused-vars
|
} = this.props; // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// check if trigger exists
|
// check if trigger exists
|
||||||
@ -168,6 +169,7 @@ class ViewTable extends Component {
|
|||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
triggerName={triggerName}
|
triggerName={triggerName}
|
||||||
tabName="pending"
|
tabName="pending"
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -188,6 +190,7 @@ ViewTable.propTypes = {
|
|||||||
query: PropTypes.object.isRequired,
|
query: PropTypes.object.isRequired,
|
||||||
curFilter: PropTypes.object.isRequired,
|
curFilter: PropTypes.object.isRequired,
|
||||||
ongoingRequest: PropTypes.bool.isRequired,
|
ongoingRequest: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
rows: PropTypes.array.isRequired,
|
rows: PropTypes.array.isRequired,
|
||||||
expandedRow: PropTypes.string.isRequired,
|
expandedRow: PropTypes.string.isRequired,
|
||||||
count: PropTypes.number,
|
count: PropTypes.number,
|
||||||
@ -200,6 +203,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
return {
|
return {
|
||||||
triggerName: ownProps.params.trigger,
|
triggerName: ownProps.params.trigger,
|
||||||
triggerList: state.triggers.pendingEvents,
|
triggerList: state.triggers.pendingEvents,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
...state.triggers.view,
|
...state.triggers.view,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -138,6 +138,7 @@ class ViewTable extends Component {
|
|||||||
lastSuccess,
|
lastSuccess,
|
||||||
dispatch,
|
dispatch,
|
||||||
expandedRow,
|
expandedRow,
|
||||||
|
readOnlyMode,
|
||||||
} = this.props; // eslint-disable-line no-unused-vars
|
} = this.props; // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// check if table exists
|
// check if table exists
|
||||||
@ -178,6 +179,7 @@ class ViewTable extends Component {
|
|||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
triggerName={triggerName}
|
triggerName={triggerName}
|
||||||
tabName="processed"
|
tabName="processed"
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -198,6 +200,7 @@ ViewTable.propTypes = {
|
|||||||
query: PropTypes.object.isRequired,
|
query: PropTypes.object.isRequired,
|
||||||
curFilter: PropTypes.object.isRequired,
|
curFilter: PropTypes.object.isRequired,
|
||||||
ongoingRequest: PropTypes.bool.isRequired,
|
ongoingRequest: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
rows: PropTypes.array.isRequired,
|
rows: PropTypes.array.isRequired,
|
||||||
expandedRow: PropTypes.string.isRequired,
|
expandedRow: PropTypes.string.isRequired,
|
||||||
count: PropTypes.number,
|
count: PropTypes.number,
|
||||||
@ -210,6 +213,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
return {
|
return {
|
||||||
triggerName: ownProps.params.trigger,
|
triggerName: ownProps.params.trigger,
|
||||||
triggerList: state.triggers.triggerList,
|
triggerList: state.triggers.triggerList,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
...state.triggers.view,
|
...state.triggers.view,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -128,6 +128,7 @@ class ViewTable extends Component {
|
|||||||
lastSuccess,
|
lastSuccess,
|
||||||
dispatch,
|
dispatch,
|
||||||
expandedRow,
|
expandedRow,
|
||||||
|
readOnlyMode,
|
||||||
} = this.props; // eslint-disable-line no-unused-vars
|
} = this.props; // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// check if table exists
|
// check if table exists
|
||||||
@ -169,6 +170,7 @@ class ViewTable extends Component {
|
|||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
triggerName={triggerName}
|
triggerName={triggerName}
|
||||||
tabName="running"
|
tabName="running"
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -189,6 +191,7 @@ ViewTable.propTypes = {
|
|||||||
query: PropTypes.object.isRequired,
|
query: PropTypes.object.isRequired,
|
||||||
curFilter: PropTypes.object.isRequired,
|
curFilter: PropTypes.object.isRequired,
|
||||||
ongoingRequest: PropTypes.bool.isRequired,
|
ongoingRequest: PropTypes.bool.isRequired,
|
||||||
|
readOnlyMode: PropTypes.bool.isRequired,
|
||||||
isProgressing: PropTypes.bool.isRequired,
|
isProgressing: PropTypes.bool.isRequired,
|
||||||
rows: PropTypes.array.isRequired,
|
rows: PropTypes.array.isRequired,
|
||||||
expandedRow: PropTypes.string.isRequired,
|
expandedRow: PropTypes.string.isRequired,
|
||||||
@ -202,6 +205,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
return {
|
return {
|
||||||
triggerName: ownProps.params.trigger,
|
triggerName: ownProps.params.trigger,
|
||||||
triggerList: state.triggers.runningEvents,
|
triggerList: state.triggers.runningEvents,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
...state.triggers.view,
|
...state.triggers.view,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -107,7 +107,14 @@ class StreamingLogs extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { triggerName, log, count, dispatch, triggerList } = this.props;
|
const {
|
||||||
|
triggerName,
|
||||||
|
log,
|
||||||
|
count,
|
||||||
|
dispatch,
|
||||||
|
triggerList,
|
||||||
|
readOnlyMode,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
const styles = require('../TableCommon/EventTable.scss');
|
const styles = require('../TableCommon/EventTable.scss');
|
||||||
|
|
||||||
@ -345,6 +352,7 @@ class StreamingLogs extends Component {
|
|||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
triggerName={triggerName}
|
triggerName={triggerName}
|
||||||
tabName="logs"
|
tabName="logs"
|
||||||
|
readOnlyMode={readOnlyMode}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div className={'hide'}>
|
<div className={'hide'}>
|
||||||
@ -453,6 +461,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
return {
|
return {
|
||||||
...state.triggers,
|
...state.triggers,
|
||||||
serverVersion: state.main.serverVersion,
|
serverVersion: state.main.serverVersion,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
triggerName: ownProps.params.trigger,
|
triggerName: ownProps.params.trigger,
|
||||||
currentSchema: state.tables.currentSchema,
|
currentSchema: state.tables.currentSchema,
|
||||||
triggerList: state.triggers.triggerList,
|
triggerList: state.triggers.triggerList,
|
||||||
|
@ -3,7 +3,7 @@ import { Link } from 'react-router';
|
|||||||
import Helmet from 'react-helmet';
|
import Helmet from 'react-helmet';
|
||||||
import BreadCrumb from '../../../Common/Layout/BreadCrumb/BreadCrumb';
|
import BreadCrumb from '../../../Common/Layout/BreadCrumb/BreadCrumb';
|
||||||
|
|
||||||
const TableHeader = ({ triggerName, tabName, count }) => {
|
const TableHeader = ({ triggerName, tabName, count, readOnlyMode }) => {
|
||||||
const styles = require('./EventTable.scss');
|
const styles = require('./EventTable.scss');
|
||||||
let capitalised = tabName;
|
let capitalised = tabName;
|
||||||
capitalised = capitalised[0].toUpperCase() + capitalised.slice(1);
|
capitalised = capitalised[0].toUpperCase() + capitalised.slice(1);
|
||||||
@ -99,15 +99,17 @@ const TableHeader = ({ triggerName, tabName, count }) => {
|
|||||||
Invocation Logs
|
Invocation Logs
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li
|
{!readOnlyMode && (
|
||||||
role="presentation"
|
<li
|
||||||
className={tabName === 'modify' ? styles.active : ''}
|
role="presentation"
|
||||||
data-test="trigger-modify"
|
className={tabName === 'modify' ? styles.active : ''}
|
||||||
>
|
data-test="trigger-modify"
|
||||||
<Link to={'/events/manage/triggers/' + triggerName + '/modify'}>
|
>
|
||||||
Modify
|
<Link to={'/events/manage/triggers/' + triggerName + '/modify'}>
|
||||||
</Link>
|
Modify
|
||||||
</li>
|
</Link>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div className="clearfix" />
|
<div className="clearfix" />
|
||||||
|
@ -81,7 +81,7 @@ class ViewStitchedSchema extends React.Component {
|
|||||||
const styles = require('../RemoteSchema.scss');
|
const styles = require('../RemoteSchema.scss');
|
||||||
|
|
||||||
const { remoteSchemaName } = this.props.params;
|
const { remoteSchemaName } = this.props.params;
|
||||||
const { manualUrl, envName, headers } = this.props;
|
const { manualUrl, envName, headers, readOnlyMode } = this.props;
|
||||||
|
|
||||||
const filterHeaders = headers.filter(h => !!h.name);
|
const filterHeaders = headers.filter(h => !!h.name);
|
||||||
|
|
||||||
@ -121,8 +121,12 @@ class ViewStitchedSchema extends React.Component {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (readOnlyMode) {
|
||||||
|
delete tabInfo.modify;
|
||||||
|
}
|
||||||
|
|
||||||
const showReloadRemoteSchema =
|
const showReloadRemoteSchema =
|
||||||
remoteSchemaName && remoteSchemaName.length > 0 ? (
|
!readOnlyMode && remoteSchemaName && remoteSchemaName.length > 0 ? (
|
||||||
<div className={styles.commonBtn + ' ' + styles.detailsRefreshButton}>
|
<div className={styles.commonBtn + ' ' + styles.detailsRefreshButton}>
|
||||||
<span>
|
<span>
|
||||||
<ReloadRemoteSchema
|
<ReloadRemoteSchema
|
||||||
@ -205,6 +209,7 @@ const mapStateToProps = state => {
|
|||||||
...state.remoteSchemas.headerData,
|
...state.remoteSchemas.headerData,
|
||||||
allRemoteSchemas: state.remoteSchemas.listData.remoteSchemas,
|
allRemoteSchemas: state.remoteSchemas.listData.remoteSchemas,
|
||||||
dataHeaders: { ...state.tables.dataHeaders },
|
dataHeaders: { ...state.tables.dataHeaders },
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class RemoteSchema extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const styles = require('../RemoteSchema.scss');
|
const styles = require('../RemoteSchema.scss');
|
||||||
|
|
||||||
const { dispatch, remoteSchemaList } = this.props;
|
const { dispatch, readOnlyMode, remoteSchemaList } = this.props;
|
||||||
const showIntroSection = !remoteSchemaList.remoteSchemas.length;
|
const showIntroSection = !remoteSchemaList.remoteSchemas.length;
|
||||||
const getIntroSection = () => {
|
const getIntroSection = () => {
|
||||||
if (!showIntroSection) {
|
if (!showIntroSection) {
|
||||||
@ -33,14 +33,16 @@ class RemoteSchema extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getAddBtn = () => {
|
const getAddBtn = () => {
|
||||||
let addBtn = null;
|
if (readOnlyMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const handleClick = e => {
|
const handleClick = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch(push(`${globals.urlPrefix}${appPrefix}/manage/add`));
|
dispatch(push(`${globals.urlPrefix}${appPrefix}/manage/add`));
|
||||||
};
|
};
|
||||||
|
|
||||||
addBtn = (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-test="data-create-remote-schemas"
|
data-test="data-create-remote-schemas"
|
||||||
color="yellow"
|
color="yellow"
|
||||||
@ -51,8 +53,6 @@ class RemoteSchema extends React.Component {
|
|||||||
Add
|
Add
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|
||||||
return addBtn;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -96,6 +96,7 @@ class RemoteSchema extends React.Component {
|
|||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
remoteSchemaList: state.remoteSchemas.listData,
|
remoteSchemaList: state.remoteSchemas.listData,
|
||||||
|
readOnlyMode: state.main.readOnlyMode,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ const RemoteSchemaSubSidebar = ({
|
|||||||
location,
|
location,
|
||||||
filterItem,
|
filterItem,
|
||||||
viewRemoteSchema,
|
viewRemoteSchema,
|
||||||
|
main,
|
||||||
}) => {
|
}) => {
|
||||||
const styles = require('../../Common/Layout/LeftSubSidebar/LeftSubSidebar.scss');
|
const styles = require('../../Common/Layout/LeftSubSidebar/LeftSubSidebar.scss');
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ const RemoteSchemaSubSidebar = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<LeftSubSidebar
|
<LeftSubSidebar
|
||||||
showAddBtn
|
showAddBtn={!main.readOnlyMode}
|
||||||
searchInput={getSearchInput()}
|
searchInput={getSearchInput()}
|
||||||
heading={`Remote Schemas (${dataList.length})`}
|
heading={`Remote Schemas (${dataList.length})`}
|
||||||
addLink={`${appPrefix}/manage/add`}
|
addLink={`${appPrefix}/manage/add`}
|
||||||
|
Loading…
Reference in New Issue
Block a user