refactor console code, update react to 16.8.2 (close #1467) (#1608)

This commit is contained in:
Rishichandra Wawhal 2019-02-28 17:13:06 +05:30 committed by Shahidh K Muhammed
parent 9cfdef3645
commit a002d3ad2a
77 changed files with 523 additions and 643 deletions

View File

@ -13514,14 +13514,14 @@
}
},
"react": {
"version": "16.4.2",
"resolved": "https://registry.npmjs.org/react/-/react-16.4.2.tgz",
"integrity": "sha512-dMv7YrbxO4y2aqnvA7f/ik9ibeLSHQJTI6TrYAenPSaQ6OXfb+Oti+oJiy8WBxgRzlKatYqtCjphTgDSCEiWFg==",
"version": "16.8.2",
"resolved": "https://registry.npmjs.org/react/-/react-16.8.2.tgz",
"integrity": "sha512-aB2ctx9uQ9vo09HVknqv3DGRpI7OIGJhCx3Bt0QqoRluEjHSaObJl+nG12GDdYH6sTgE7YiPJ6ZUyMx9kICdXw==",
"requires": {
"fbjs": "^0.8.16",
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
"prop-types": "^15.6.0"
"prop-types": "^15.6.2",
"scheduler": "^0.13.2"
}
},
"react-a11y": {
@ -13599,14 +13599,14 @@
}
},
"react-dom": {
"version": "16.4.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.4.2.tgz",
"integrity": "sha512-Usl73nQqzvmJN+89r97zmeUpQDKDlh58eX6Hbs/ERdDHzeBzWy+ENk7fsGQ+5KxArV1iOFPT46/VneklK9zoWw==",
"version": "16.8.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.8.2.tgz",
"integrity": "sha512-cPGfgFfwi+VCZjk73buu14pYkYBR1b/SRMSYqkLDdhSEHnSwcuYTPu6/Bh6ZphJFIk80XLvbSe2azfcRzNF+Xg==",
"requires": {
"fbjs": "^0.8.16",
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
"prop-types": "^15.6.0"
"prop-types": "^15.6.2",
"scheduler": "^0.13.2"
}
},
"react-helmet": {
@ -14994,6 +14994,15 @@
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true
},
"scheduler": {
"version": "0.13.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.13.2.tgz",
"integrity": "sha512-qK5P8tHS7vdEMCW5IPyt8v9MJOHqTrOUgPXib7tqm9vh834ibBX5BNhwkplX/0iOzHW5sXyluehYfS9yrkz9+w==",
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}
},
"schema-utils": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.3.0.tgz",

View File

@ -73,11 +73,11 @@
"pretty-error": "^1.2.0",
"prop-types": "^15.6.0",
"query-string": "^6.1.0",
"react": "16.4.2",
"react": "16.8.2",
"react-ace": "^6.1.1",
"react-bootstrap": "^0.32.1",
"react-copy-to-clipboard": "^5.0.0",
"react-dom": "16.4.2",
"react-dom": "16.8.2",
"react-helmet": "^5.2.0",
"react-modal": "^3.1.2",
"react-notification-system": "^0.2.17",

View File

@ -75,8 +75,9 @@ class App extends Component {
className={styles.alertDanger + ' alert alert-danger'}
>
<strong>
Hasura console is not able to reach your Hasura GraphQL engine instance.
Please ensure that your instance is running and the endpoint is configured correctly.
Hasura console is not able to reach your Hasura GraphQL engine
instance. Please ensure that your instance is running and the
endpoint is configured correctly.
</strong>
</div>
);

View File

@ -1,5 +1,5 @@
import React from 'react';
import styles from '../../../Common/Common.scss';
import styles from '../Common.scss';
/*
This is a Button HOC that takes al the props supported by <button> and also

View File

@ -39,7 +39,7 @@ class DropButton extends React.Component {
onClick={onButtonChange}
eventKey={i + 1}
key={i}
data-test={testId + '-' + 'dropdown-item'}
data-test={testId + '-' + 'dropdown-item' + '-' + (i + 1)}
>
{d.display_text}
</MenuItem>

View File

@ -5,7 +5,7 @@ import { Link } from 'react-router';
class BreadCrumb extends React.Component {
render() {
const { breadCrumbs } = this.props;
const styles = require('../../EventTrigger/TableCommon/Table.scss');
const styles = require('../../../Services/EventTrigger/TableCommon/Table.scss');
const bC =
breadCrumbs && breadCrumbs.length > 0
? breadCrumbs.map((b, i) => {

View File

@ -1,7 +1,7 @@
import React from 'react';
import BreadCrumb from '../../Layout/BreadCrumb/BreadCrumb';
import Tabs from '../../Layout/ReusableTabs/ReusableTabs';
import BreadCrumb from '../BreadCrumb/BreadCrumb';
import Tabs from '../ReusableTabs/ReusableTabs';
class CommonTabLayout extends React.Component {
render() {

View File

@ -0,0 +1 @@
@import '../../Common.scss';

View File

@ -9,8 +9,7 @@ import PropTypes from 'prop-types';
class LayoutWrapper extends React.Component {
render() {
const styles = require('../../Data/TableCommon/Table.scss');
const styles = require('../../../Services/Data/TableCommon/Table.scss');
const { appPrefix, children } = this.props;
const currentLocation = location.pathname;
@ -27,7 +26,9 @@ class LayoutWrapper extends React.Component {
<li
role="presentation"
className={
currentLocation.includes('remote-schemas/manage') ? styles.active : ''
currentLocation.includes('remote-schemas/manage')
? styles.active
: ''
}
>
<Link

View File

@ -2,9 +2,7 @@
import React from 'react';
import { Link } from 'react-router';
import { LISTING_SCHEMA } from '../../Data/DataActions';
import Button from '../Button/Button';
import Button from '../../Button/Button';
const LeftNavBar = ({
appPrefix,

View File

@ -1,5 +1,5 @@
@import "~bootstrap-sass/assets/stylesheets/bootstrap/variables";
@import "../../../Common/Common.scss";
@import "../../Common.scss";
.container {
}
.displayFlexContainer

View File

@ -1,7 +1,7 @@
import React from 'react';
import { generateHeaderSyms } from './HeaderReducer';
import DropdownButton from '../../CustomResolver/Common/DropdownButton';
import DropdownButton from '../../DropdownButton/DropdownButton';
class Header extends React.Component {
constructor(props) {

View File

@ -1,4 +1,4 @@
@import "../../../Common/Common.scss";
@import "../../Common.scss";
.common_header_wrapper {
.defaultWidth

View File

@ -0,0 +1,5 @@
@import "../../Common.scss";
.loader_ml {
margin-left: 3px;
}

View File

@ -1,5 +1,5 @@
@import "~bootstrap-sass/assets/stylesheets/bootstrap/variables";
@import "../../../Common/Common.scss";
@import "../../Common.scss";
.flexRow {
display: flex;

View File

@ -1,6 +1,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Helmet from 'react-helmet';
import Button from '../Common/Button/Button';
import globals from '../../Globals';
import { loginClicked, UPDATE_ADMIN_SECRET_INPUT } from '../Main/Actions';
@ -62,9 +63,9 @@ class Login extends Component {
</div>
</div>
<div className={styles.signin_btn}>
<button type="submit" className="form-control">
<Button type="submit" color="green" className="form-control">
{loginText}
</button>
</Button>
</div>
</form>
</div>

View File

@ -26,9 +26,7 @@ class QueryBuilderJson extends React.Component {
const wrapSquareBrackets = value => {
return (
<span>
[
<div className={styles.qb_nested}>{value}</div>
]
[<div className={styles.qb_nested}>{value}</div>]
</span>
);
};

View File

@ -3,7 +3,7 @@ import Common from '../Common/Common';
import { addResolver, RESET } from './addResolverReducer';
import Helmet from 'react-helmet';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import { pageTitle } from '../constants';

View File

@ -8,7 +8,7 @@ import dataHeaders from '../../Data/Common/Headers';
import { push } from 'react-router-redux';
import { fetchResolvers } from '../customActions';
import { generateHeaderSyms } from '../../Layout/ReusableHeader/HeaderReducer';
import { generateHeaderSyms } from '../../../Common/Layout/ReusableHeader/HeaderReducer';
import { makeRequest } from '../customActions';
// import { UPDATE_MIGRATION_STATUS_ERROR } from '../../../Main/Actions';
import { appPrefix } from '../constants';

View File

@ -2,14 +2,14 @@ import React from 'react';
import PropTypes from 'prop-types';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Tooltip from 'react-bootstrap/lib/Tooltip';
import DropdownButton from './DropdownButton';
import DropdownButton from '../../../Common/DropdownButton/DropdownButton';
import {
inputChange,
UPDATE_FORWARD_CLIENT_HEADERS,
} from '../Add/addResolverReducer';
import CommonHeader from '../../Layout/ReusableHeader/Header';
import CommonHeader from '../../../Common/Layout/ReusableHeader/Header';
const graphqlurl = (
<Tooltip id="tooltip-cascade">

View File

@ -1,83 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import InputGroup from 'react-bootstrap/lib/InputGroup';
import DropdownButton from 'react-bootstrap/lib/DropdownButton';
import MenuItem from 'react-bootstrap/lib/MenuItem';
class DropButton extends React.Component {
render() {
const {
title,
dropdownOptions,
value,
required,
onInputChange,
onButtonChange,
dataKey,
dataIndex,
bsClass,
disabled,
inputVal,
inputPlaceHolder,
id,
testId,
} = this.props;
return (
<InputGroup className={bsClass}>
<DropdownButton
title={value || title}
componentClass={InputGroup.Button}
disabled={disabled}
id={id}
data-test={testId + '-' + 'dropdown-button'}
>
{dropdownOptions.map((d, i) => (
<MenuItem
data-index-id={dataIndex}
value={d.value}
onClick={onButtonChange}
eventKey={i + 1}
key={i}
data-test={testId + '-' + 'dropdown-item' + '-' + (i + 1)}
>
{d.display_text}
</MenuItem>
))}
</DropdownButton>
<input
type="text"
data-key={dataKey}
data-index-id={dataIndex}
className={'form-control'}
required={required}
onChange={onInputChange}
disabled={disabled}
value={inputVal || ''}
placeholder={inputPlaceHolder}
data-test={testId + '-' + 'input'}
/>
</InputGroup>
);
}
}
DropButton.propTypes = {
dispatch: PropTypes.func.isRequired,
dropdownOptions: PropTypes.array.isRequired,
title: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
dataKey: PropTypes.string.isRequired,
dataIndex: PropTypes.string.isRequired,
inputVal: PropTypes.string.isRequired,
inputPlaceHolder: PropTypes.string,
required: PropTypes.bool.isRequired,
onButtonChange: PropTypes.func.isRequired,
onInputChange: PropTypes.func.isRequired,
bsClass: PropTypes.string,
id: PropTypes.string,
testId: PropTypes.string,
disabled: PropTypes.bool.isRequired,
};
export default DropButton;

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Route, IndexRedirect, Link } from 'react-router';
import { layoutConnector, rightBar } from '../Layout';
import { layoutConnector, rightBar } from '../../Common/Layout';
import globals from '../../../Globals';
import {
landingCustomResolverGen,

View File

@ -12,8 +12,8 @@ import { VIEW_RESOLVER } from '../customActions';
import { push } from 'react-router-redux';
import Helmet from 'react-helmet';
import tabInfo from './tabInfo';
import CommonTabLayout from '../../Layout/CommonTabLayout/CommonTabLayout';
import Button from '../../Layout/Button/Button';
import CommonTabLayout from '../../../Common/Layout/CommonTabLayout/CommonTabLayout';
import Button from '../../../Common/Button/Button';
import { appPrefix, pageTitle } from '../constants';

View File

@ -1,6 +1,6 @@
import React from 'react';
import CommonTabLayout from '../../Layout/CommonTabLayout/CommonTabLayout';
import CommonTabLayout from '../../../Common/Layout/CommonTabLayout/CommonTabLayout';
import tabInfo from './tabInfo';
import Tooltip from 'react-bootstrap/lib/Tooltip';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';

View File

@ -4,7 +4,7 @@ import { push } from 'react-router-redux';
import { appPrefix, pageTitle } from '../constants';
import globals from '../../../../Globals';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class CustomResolver extends React.Component {
render() {

View File

@ -2,7 +2,7 @@ import { combineReducers } from 'redux';
import listReducer from './customActions';
import addReducer from './Add/addResolverReducer';
import headerReducer from '../Layout/ReusableHeader/HeaderReducer';
import headerReducer from '../../Common/Layout/ReusableHeader/HeaderReducer';
const customResolverReducer = combineReducers({
addData: addReducer,

View File

@ -4,7 +4,7 @@ import Helmet from 'react-helmet';
import * as tooltip from './Tooltips';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import dataTypes from '../Common/DataTypes';
import { showErrorNotification } from '../Notification';

View File

@ -36,10 +36,7 @@ const DataHeader = ({
currentLocation.includes('data/migrations') ? styles.active : ''
}
>
<Link
className={styles.linkBorder}
to={sectionPrefix + '/migrations'}
>
<Link className={styles.linkBorder} to={sectionPrefix + '/migrations'}>
Migrations
</Link>
</li>

View File

@ -3,17 +3,18 @@ import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import { push } from 'react-router-redux';
import CommonTabLayout from '../../../Layout/CommonTabLayout/CommonTabLayout';
import CommonTabLayout from '../../../../Common/Layout/CommonTabLayout/CommonTabLayout';
import _push from '../../push';
import { pageTitle, appPrefix } from './constants';
import tabInfo from './tabInfo';
import globals from '../../../../../Globals';
import Button from '../../../../Common/Button/Button';
const prefixUrl = globals.urlPrefix + appPrefix;
import ReusableTextAreaWithCopy from '../../../Layout/ReusableTextAreaWithCopy/ReusableTextAreaWithCopy';
import ReusableTextAreaWithCopy from '../../../../Common/Layout/ReusableTextAreaWithCopy/ReusableTextAreaWithCopy';
import {
fetchCustomFunction,
@ -105,21 +106,17 @@ class ModifyCustomFunction extends React.Component {
const generateMigrateBtns = () => {
return (
<div className={styles.commonBtn}>
<button
className={styles.yellow_button}
<Button
color="yellow"
className={styles.add_mar_right}
data-test={'custom-function-edit-modify-btn'}
onClick={this.loadRunSQLAndLoadPage.bind(this)}
>
Modify
</button>
<button
className={
styles.danger_button +
' ' +
styles.white_button +
' ' +
'btn-default'
}
</Button>
<Button
color="white"
className={styles.add_mar_right}
onClick={e => {
e.preventDefault();
this.handleUntrackCustomFunction(e);
@ -128,17 +125,9 @@ class ModifyCustomFunction extends React.Component {
data-test={'custom-function-edit-untrack-btn'}
>
{isUntracking ? 'Untracking Function...' : 'Untrack Function'}
</button>
<button
className={
styles.danger_button +
' ' +
styles.red_button +
' ' +
styles.no_mr_right +
' ' +
'btn-danger'
}
</Button>
<Button
color="red"
onClick={e => {
e.preventDefault();
this.handleDeleteCustomFunction(e);
@ -147,7 +136,7 @@ class ModifyCustomFunction extends React.Component {
disabled={isRequesting || isDeleting || isUntracking}
>
{isDeleting ? 'Deleting Function...' : 'Delete Function'}
</button>
</Button>
{this.state.deleteConfirmationError ? (
<span
className={styles.delete_confirmation_error}

View File

@ -1,7 +1,7 @@
import React from 'react';
import Helmet from 'react-helmet';
import CommonTabLayout from '../../../Layout/CommonTabLayout/CommonTabLayout';
import CommonTabLayout from '../../../../Common/Layout/CommonTabLayout/CommonTabLayout';
import { Link } from 'react-router';
import { push } from 'react-router-redux';
@ -9,6 +9,7 @@ import { pageTitle, appPrefix } from '../Modify/constants';
import tabInfo from '../Modify/tabInfo';
import globals from '../../../../../Globals';
import Button from '../../../../Common/Button/Button';
const prefixUrl = globals.urlPrefix + appPrefix;
@ -83,12 +84,9 @@ class Permission extends React.Component {
</p>
<div className={styles.commonBtn}>
<Link to={permissionTableUrl}>
<button
className={styles.yellow_button}
data-test={'custom-function-permission-btn'}
>
<Button color="yellow" data-test={'custom-function-permission-btn'}>
{`${setOffTable} Permissions`}
</button>
</Button>
</Link>
</div>
</div>

View File

@ -7,7 +7,7 @@ import {
showSuccessNotification,
showErrorNotification,
} from '../Notification';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class ClearAdminSecret extends Component {
constructor() {

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Endpoints, { globalCookiePolicy } from '../../../../Endpoints';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
showSuccessNotification,

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Endpoints, { globalCookiePolicy } from '../../../../Endpoints';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
showSuccessNotification,

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Endpoints, { globalCookiePolicy } from '../../../../Endpoints';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
showSuccessNotification,

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Endpoints, { globalCookiePolicy } from '../../../../Endpoints';
import { showNotification } from '../../../App/Actions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
showSuccessNotification,

View File

@ -2,7 +2,7 @@ import React from 'react';
import AceEditor from 'react-ace';
import { showNotification, showTempNotification } from '../../App/Actions';
import { notifExpand, notifMsg } from '../../App/Actions';
import Button from '../Layout/Button/Button';
import Button from '../../Common/Button/Button';
const styles = require('./TableCommon/Table.scss');

View File

@ -4,7 +4,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import globals from '../../../../Globals';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import { LISTING_SCHEMA, UPDATE_TRACKED_FUNCTIONS } from '../DataActions';
import semverCheck from '../../../../helpers/semver';

View File

@ -5,7 +5,7 @@ import AceEditor from 'react-ace';
import 'brace/mode/sql';
import Modal from 'react-bootstrap/lib/Modal';
import ModalButton from 'react-bootstrap/lib/Button';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Tooltip from 'react-bootstrap/lib/Tooltip';

View File

@ -9,7 +9,7 @@ import {
autoAddRelName,
} from '../TableRelationships/Actions';
import { getRelationshipLine } from '../TableRelationships/Relationships';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class AutoAddRelations extends Component {
trackAllRelations = untrackedData => {

View File

@ -14,7 +14,7 @@ import {
trackableFunctions,
// nonTrackableFunctions,
} from './Tooltips';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
setTableName,
addExistingTableSql,
@ -293,7 +293,7 @@ class Schema extends Component {
styles.padd_right
}`}
>
<button
<Button
data-test={`add-track-function-${p.function_name}`}
className={`${
styles.display_inline
@ -304,7 +304,7 @@ class Schema extends Component {
}}
>
Add
</button>
</Button>
</div>
<div
className={`${styles.padd_right} ${

View File

@ -4,7 +4,7 @@ import TableHeader from '../TableCommon/TableHeader';
import { editItem, E_ONGOING_REQ } from './EditActions';
import globals from '../../../../Globals';
import { modalClose } from './EditActions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
getPlaceholder,

View File

@ -22,7 +22,7 @@ import {
removeOrder,
} from './FilterActions.js';
import { setDefaultQuery, runQuery } from './FilterActions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
const renderCols = (colName, tableSchema, onChange, usage, key) => {
const columns = tableSchema.columns.map(c => c.column_name);

View File

@ -25,7 +25,7 @@ import { I_SET_CLONE } from '../TableInsertItem/InsertActions';
import _push from '../push';
import { ordinalColSort, findTableFromRel } from '../utils';
import Spinner from '../../../Common/Spinner/Spinner';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import './ReactTableFix.css';
const ViewRows = ({

View File

@ -4,7 +4,7 @@ import TableHeader from '../TableCommon/TableHeader';
import { insertItem, I_RESET } from './InsertActions';
import { ordinalColSort } from '../utils';
import { setTable } from '../DataActions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
getPlaceholder,
BOOLEAN,

View File

@ -47,7 +47,7 @@ import {
TIMESTAMP,
TIME,
} from '../../../../constants';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
const appPrefix = '/data';

View File

@ -15,7 +15,7 @@ import {
} from './ModifyActions';
import { ordinalColSort } from '../utils';
import { setTable, fetchTableComment } from '../DataActions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class ModifyView extends Component {
componentDidMount() {

View File

@ -455,7 +455,9 @@ const applySamePermissionsBulk = tableSchema => {
const table = tableSchema.table_name;
const currentQueryType = permissionsState.query;
const toBeAppliedPermission = permissionsState[currentQueryType];
const selectedRoles = permissionsState.applySamePermissions.concat([permissionsState.role]);
const selectedRoles = permissionsState.applySamePermissions.concat([
permissionsState.role,
]);
const permissionsUpQueries = [];
const permissionsDownQueries = [];
@ -469,7 +471,10 @@ const applySamePermissionsBulk = tableSchema => {
return el.role_name === role;
});
if (currentRolePermission && currentRolePermission.permissions[currentQueryType]) {
if (
currentRolePermission &&
currentRolePermission.permissions[currentQueryType]
) {
// existing permission is there. so drop and recreate.
const deleteQuery = {
type: 'drop_' + currentQueryType + '_permission',

View File

@ -25,7 +25,7 @@ import {
textColumnOperators,
jsonColumnOperators,
topologyColumnOperators,
PGTypes
PGTypes,
} from './utils';
import QueryBuilderJson from '../../../../QueryBuilderJson/QueryBuilderJson';
@ -313,11 +313,17 @@ class PermissionBuilder extends React.Component {
prefix = '',
disabledValues = []
) => {
const _value = (typeof value === 'boolean') ? value.toString() : '';
const _value = typeof value === 'boolean' ? value.toString() : '';
const values = ['true', 'false'];
return renderSelect(selectDispatchFunc, _value, values, prefix, disabledValues);
return renderSelect(
selectDispatchFunc,
_value,
values,
prefix,
disabledValues
);
};
const renderSelect = (
@ -382,7 +388,11 @@ class PermissionBuilder extends React.Component {
);
};
const renderSuggestion = (suggestionDispatchFunc, inputValue, displayValue = null) => {
const renderSuggestion = (
suggestionDispatchFunc,
inputValue,
displayValue = null
) => {
const dispatchSuggestion = () => {
suggestionDispatchFunc(inputValue);
};
@ -392,7 +402,7 @@ class PermissionBuilder extends React.Component {
onClick={dispatchSuggestion}
className={styles.qb_input_suggestion}
>
[{ displayValue || inputValue }]
[{displayValue || inputValue}]
</span>
);
};
@ -405,10 +415,18 @@ class PermissionBuilder extends React.Component {
if (val !== '') {
if (PGTypes.boolean.includes(valueType)) {
_val = (val === 'true');
} else if (PGTypes.numeric.includes(valueType) && !isNaN(val) && val.substr(-1) !== '.') {
_val = val === 'true';
} else if (
PGTypes.numeric.includes(valueType) &&
!isNaN(val) &&
val.substr(-1) !== '.'
) {
_val = Number(val);
} else if ((PGTypes.json.includes(valueType) || PGTypes.postgis.includes(valueType)) && isJsonString(val)) {
} else if (
(PGTypes.json.includes(valueType) ||
PGTypes.postgis.includes(valueType)) &&
isJsonString(val)
) {
_val = JSON.parse(val);
}
}
@ -433,7 +451,10 @@ class PermissionBuilder extends React.Component {
if (PGTypes.boolean.includes(valueType)) {
input = renderBoolSelect(dispatchInput, value);
} else if (PGTypes.json.includes(valueType) || PGTypes.postgis.includes(valueType)) {
} else if (
PGTypes.json.includes(valueType) ||
PGTypes.postgis.includes(valueType)
) {
input = inputBox();
suggestion = jsonSuggestion();
} else {
@ -451,7 +472,12 @@ class PermissionBuilder extends React.Component {
const renderValueArray = (dispatchFunc, values, prefix, valueType) => {
const _inputArray = [];
(values || []).concat(['']).map((val, i) => {
const input = renderValue(dispatchFunc, val, addToPrefix(prefix, i), valueType);
const input = renderValue(
dispatchFunc,
val,
addToPrefix(prefix, i),
valueType
);
_inputArray.push(input);
});
@ -575,7 +601,12 @@ class PermissionBuilder extends React.Component {
} else {
const columnType = getColumnType(column, tableSchema);
_columnExp = renderOperatorExp(dispatchFunc, expression, prefix, columnType);
_columnExp = renderOperatorExp(
dispatchFunc,
expression,
prefix,
columnType
);
}
return _columnExp;

View File

@ -1,12 +1,8 @@
/* Constants */
export const PGTypes = {
boolean: [
'boolean'
],
uuid: [
'uuid'
],
boolean: ['boolean'],
uuid: ['uuid'],
numeric: [
'smallint',
'integer',
@ -16,36 +12,22 @@ export const PGTypes = {
'real',
'double precision',
],
character: [
'character',
'character varying',
'text'
],
character: ['character', 'character varying', 'text'],
dateTime: [
'timestamp',
'timestamp with time zone',
'date',
'time',
'time with time zone',
'interval'
'interval',
],
json: [
'json',
'jsonb'
],
postgis: [
'geometry',
]
json: ['json', 'jsonb'],
postgis: ['geometry'],
};
export const notBoolOperators = [
'_not'
];
export const notBoolOperators = ['_not'];
export const andOrBoolOperators = [
'_and',
'_or'
];
export const andOrBoolOperators = ['_and', '_or'];
export const genericSimpleColumnOperators = [
'_eq',
@ -55,17 +37,12 @@ export const genericSimpleColumnOperators = [
'_gt',
'_lt',
'_gte',
'_lte'
'_lte',
];
export const genericArrayColumnOperators = [
'_in',
'_nin'
];
export const genericArrayColumnOperators = ['_in', '_nin'];
export const genericBoolColumnOperators = [
'_is_null'
];
export const genericBoolColumnOperators = ['_is_null'];
export const textOnlyColumnOperators = [
'_like',
@ -76,10 +53,7 @@ export const textOnlyColumnOperators = [
'_nsimilar',
];
export const jsonColumnOperators = [
'_contains',
'_contained_in'
];
export const jsonColumnOperators = ['_contains', '_contained_in'];
export const topologyColumnOperators = [
'_st_contains',
@ -89,11 +63,10 @@ export const topologyColumnOperators = [
'_st_overlaps',
'_st_touches',
'_st_within',
'_st_d_within'
'_st_d_within',
];
export const boolOperators = notBoolOperators
.concat(andOrBoolOperators);
export const boolOperators = notBoolOperators.concat(andOrBoolOperators);
export const columnOperators = genericSimpleColumnOperators
.concat(genericArrayColumnOperators)
@ -106,11 +79,11 @@ export const genericOperators = genericSimpleColumnOperators
.concat(genericArrayColumnOperators)
.concat(genericBoolColumnOperators);
export const textColumnOperators = genericOperators
.concat(textOnlyColumnOperators);
export const textColumnOperators = genericOperators.concat(
textOnlyColumnOperators
);
export const allOperators = boolOperators
.concat(columnOperators);
export const allOperators = boolOperators.concat(columnOperators);
/* Util functions */
@ -131,9 +104,7 @@ export function isBoolTypeColumnOperator(value) {
}
export function isJsonTypeColumnOperator(value) {
return jsonColumnOperators
.concat(topologyColumnOperators)
.includes(value);
return jsonColumnOperators.concat(topologyColumnOperators).includes(value);
}
export function isColumnOperator(value) {
@ -247,7 +218,9 @@ export function getColumnType(columnName, tableSchema) {
return _columnType;
}
const columnSchema = tableSchema.columns.find(_columnSchema => (_columnSchema.column_name === columnName));
const columnSchema = tableSchema.columns.find(
_columnSchema => _columnSchema.column_name === columnName
);
if (columnSchema) {
_columnType = columnSchema.data_type;

View File

@ -44,7 +44,7 @@ import { setTable, fetchViewInfoFromInformationSchema } from '../DataActions';
import { getIngForm, escapeRegExp } from '../utils';
import { allOperators, getLegacyOperator } from './PermissionBuilder/utils';
import semverCheck from '../../../../helpers/semver';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
/* */
import EnhancedInput from '../../../Common/InputChecker/InputChecker';
@ -156,7 +156,6 @@ class Permissions extends Component {
this.addNewPresetColumn(queryType);
}
this.setState({
...this.state,
setOperations: {
...this.state.setOperations,
[queryType]: {
@ -243,7 +242,7 @@ class Permissions extends Component {
const { showAggregation, showInsertPrefix, showUpdatePresets } = this.state;
const styles = require('../TableModify/Modify.scss');
const getAllRoles = (allTableSchemas) => {
const getAllRoles = allTableSchemas => {
const _allRoles = [];
allTableSchemas.forEach(tableSchema => {
@ -367,9 +366,14 @@ class Permissions extends Component {
if (isNewPerm && permsState.newRole !== '') {
dispatch(permOpenEdit(tableSchema, permsState.newRole, queryType));
} else if (role !== '') {
const allowInsertPermColumns = semverCheck('insertPermRestrictColumns', this.props.serverVersion);
const allowInsertPermColumns = semverCheck(
'insertPermRestrictColumns',
this.props.serverVersion
);
dispatch(permOpenEdit(tableSchema, role, queryType, allowInsertPermColumns));
dispatch(
permOpenEdit(tableSchema, role, queryType, allowInsertPermColumns)
);
} else {
document.getElementById('newRoleInput').focus();
}
@ -391,7 +395,9 @@ class Permissions extends Component {
const dispatchDeletePermission = () => {
const isConfirm = window.confirm(
'Are you sure you want to delete the permission for role ' + role + '?'
'Are you sure you want to delete the permission for role ' +
role +
'?'
);
if (isConfirm) {
dispatch(permRemoveRole(tableSchema, role));
@ -593,7 +599,12 @@ class Permissions extends Component {
);
};
const getPermissionsTable = (tableSchema, queryTypes, permsState, roleList) => {
const getPermissionsTable = (
tableSchema,
queryTypes,
permsState,
roleList
) => {
const permissionsSymbols = {
fullAccess: <i className="fa fa-check" aria-hidden="true" />,
noAccess: <i className="fa fa-times" aria-hidden="true" />,
@ -689,160 +700,160 @@ class Permissions extends Component {
const setOptions =
insertState && insertState.localSet && insertState.localSet.length > 0
? insertState.localSet.map((s, i) => {
return (
<div className={styles.insertSetConfigRow} key={i}>
<div
className={
styles.display_inline +
return (
<div className={styles.insertSetConfigRow} key={i}>
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<select
className="input-sm form-control"
value={s.key}
onChange={e => this.onSetKeyChange(e, 'insert')}
data-index-id={i}
data-test={'column-presets-column-' + i}
}
>
<option value="" disabled>
<select
className="input-sm form-control"
value={s.key}
onChange={e => this.onSetKeyChange(e, 'insert')}
data-index-id={i}
data-test={'column-presets-column-' + i}
>
<option value="" disabled>
Column Name
</option>
{columns && columns.length > 0
? columns.map((c, key) => (
<option
value={c.column_name}
data-column-type={c.data_type}
key={key}
>
{c.column_name}
</option>
))
: null}
</select>
</div>
<div
className={
styles.display_inline +
</option>
{columns && columns.length > 0
? columns.map((c, key) => (
<option
value={c.column_name}
data-column-type={c.data_type}
key={key}
>
{c.column_name}
</option>
))
: null}
</select>
</div>
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<select
className="input-sm form-control"
onChange={e => this.onSetTypeChange(e, 'insert')}
data-index-id={i}
data-test={'column-presets-type-' + i}
value={setConfigValueType(s.value) || ''}
}
>
<option value="" disabled>
<select
className="input-sm form-control"
onChange={e => this.onSetTypeChange(e, 'insert')}
data-index-id={i}
data-test={'column-presets-type-' + i}
value={setConfigValueType(s.value) || ''}
>
<option value="" disabled>
Select Preset Type
</option>
<option value="static">static</option>
<option value="session">from session variable</option>
</select>
</div>
<div
className={
styles.display_inline +
</option>
<option value="static">static</option>
<option value="session">from session variable</option>
</select>
</div>
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
{setConfigValueType(s.value) === 'session' ? (
<InputGroup>
<InputGroup.Addon>X-Hasura-</InputGroup.Addon>
<input
className={'input-sm form-control '}
}
>
{setConfigValueType(s.value) === 'session' ? (
<InputGroup>
<InputGroup.Addon>X-Hasura-</InputGroup.Addon>
<input
className={'input-sm form-control '}
placeholder="column_value"
value={s.value.slice(X_HASURA_CONST.length)}
onChange={e => this.onSetValueChange(e, 'insert')}
data-test={'column-presets-value-' + i}
data-index-id={i}
data-prefix-val={X_HASURA_CONST}
/>
</InputGroup>
) : (
<EnhancedInput
placeholder="column_value"
value={s.value.slice(X_HASURA_CONST.length)}
type={
i in this.state.setOperations.insert.columnTypeMap
? this.state.setOperations.insert.columnTypeMap[i]
: ''
}
value={s.value}
onChange={e => this.onSetValueChange(e, 'insert')}
data-test={'column-presets-value-' + i}
data-index-id={i}
indexId={i}
data-prefix-val={X_HASURA_CONST}
/>
</InputGroup>
) : (
<EnhancedInput
placeholder="column_value"
type={
i in this.state.setOperations.insert.columnTypeMap
? this.state.setOperations.insert.columnTypeMap[i]
: ''
)}
</div>
{setConfigValueType(s.value) === 'session' ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. X-Hasura-User-Id
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. false, 1, some-text
</div>
)}
{i !== insertState.localSet.length - 1 ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<i
className="fa-lg fa fa-times"
onClick={e => this.deleteSetKeyVal(e, 'insert')}
data-index-id={i}
/>
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
value={s.value}
onChange={e => this.onSetValueChange(e, 'insert')}
data-test={'column-presets-value-' + i}
indexId={i}
data-prefix-val={X_HASURA_CONST}
/>
)}
</div>
{setConfigValueType(s.value) === 'session' ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. X-Hasura-User-Id
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. false, 1, some-text
</div>
)}
{i !== insertState.localSet.length - 1 ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<i
className="fa-lg fa fa-times"
onClick={e => this.deleteSetKeyVal(e, 'insert')}
data-index-id={i}
/>
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
/>
)}
</div>
);
})
);
})
: null;
return (
@ -914,160 +925,160 @@ class Permissions extends Component {
const setOptions =
updateState && updateState.localSet && updateState.localSet.length > 0
? updateState.localSet.map((s, i) => {
return (
<div className={styles.insertSetConfigRow} key={i}>
<div
className={
styles.display_inline +
return (
<div className={styles.insertSetConfigRow} key={i}>
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<select
className="input-sm form-control"
value={s.key}
data-test={'column-presets-column-' + i}
onChange={e => this.onSetKeyChange(e, 'update')}
data-index-id={i}
}
>
<option value="" disabled>
<select
className="input-sm form-control"
value={s.key}
data-test={'column-presets-column-' + i}
onChange={e => this.onSetKeyChange(e, 'update')}
data-index-id={i}
>
<option value="" disabled>
Column Name
</option>
{columns && columns.length > 0
? columns.map((c, key) => (
<option
value={c.column_name}
data-column-type={c.data_type}
key={key}
>
{c.column_name}
</option>
))
: null}
</select>
</div>
<div
className={
styles.display_inline +
</option>
{columns && columns.length > 0
? columns.map((c, key) => (
<option
value={c.column_name}
data-column-type={c.data_type}
key={key}
>
{c.column_name}
</option>
))
: null}
</select>
</div>
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<select
className="input-sm form-control"
onChange={e => this.onSetTypeChange(e, 'update')}
data-index-id={i}
data-test={'column-presets-type-' + i}
value={setConfigValueType(s.value) || ''}
}
>
<option value="" disabled>
<select
className="input-sm form-control"
onChange={e => this.onSetTypeChange(e, 'update')}
data-index-id={i}
data-test={'column-presets-type-' + i}
value={setConfigValueType(s.value) || ''}
>
<option value="" disabled>
Select Preset Type
</option>
<option value="static">static</option>
<option value="session">from session variable</option>
</select>
</div>
<div
className={
styles.display_inline +
</option>
<option value="static">static</option>
<option value="session">from session variable</option>
</select>
</div>
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
{setConfigValueType(s.value) === 'session' ? (
<InputGroup>
<InputGroup.Addon>X-Hasura-</InputGroup.Addon>
<input
className={'input-sm form-control '}
}
>
{setConfigValueType(s.value) === 'session' ? (
<InputGroup>
<InputGroup.Addon>X-Hasura-</InputGroup.Addon>
<input
className={'input-sm form-control '}
placeholder="column_value"
value={s.value.slice(X_HASURA_CONST.length)}
onChange={e => this.onSetValueChange(e, 'update')}
data-index-id={i}
data-prefix-val={X_HASURA_CONST}
data-test={'column-presets-value-' + i}
/>
</InputGroup>
) : (
<EnhancedInput
placeholder="column_value"
value={s.value.slice(X_HASURA_CONST.length)}
type={
i in this.state.setOperations.update.columnTypeMap
? this.state.setOperations.update.columnTypeMap[i]
: ''
}
value={s.value}
onChange={e => this.onSetValueChange(e, 'update')}
data-index-id={i}
indexId={i}
data-prefix-val={X_HASURA_CONST}
data-test={'column-presets-value-' + i}
/>
</InputGroup>
) : (
<EnhancedInput
placeholder="column_value"
type={
i in this.state.setOperations.update.columnTypeMap
? this.state.setOperations.update.columnTypeMap[i]
: ''
)}
</div>
{setConfigValueType(s.value) === 'session' ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. X-Hasura-User-Id
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. false, 1, some-text
</div>
)}
{i !== updateState.localSet.length - 1 ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<i
className="fa-lg fa fa-times"
onClick={e => this.deleteSetKeyVal(e, 'update')}
data-index-id={i}
/>
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
value={s.value}
onChange={e => this.onSetValueChange(e, 'update')}
indexId={i}
data-prefix-val={X_HASURA_CONST}
data-test={'column-presets-value-' + i}
/>
)}
</div>
{setConfigValueType(s.value) === 'session' ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. X-Hasura-User-Id
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper +
' ' +
styles.e_g_text
}
>
e.g. false, 1, some-text
</div>
)}
{i !== updateState.localSet.length - 1 ? (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
>
<i
className="fa-lg fa fa-times"
onClick={e => this.deleteSetKeyVal(e, 'update')}
data-index-id={i}
/>
</div>
) : (
<div
className={
styles.display_inline +
' ' +
styles.add_mar_right +
' ' +
styles.input_element_wrapper
}
/>
)}
</div>
);
})
);
})
: null;
return (
<div
@ -1182,7 +1193,9 @@ class Permissions extends Component {
tableSchema.columns.forEach((colObj, i) => {
const column = colObj.column_name;
const checked = permsState[query] ? permsState[query].columns.includes(column) : false;
const checked = permsState[query]
? permsState[query].columns.includes(column)
: false;
_columnList.push(
<div key={i} className={styles.columnListElement}>
@ -1201,23 +1214,30 @@ class Permissions extends Component {
);
});
_columnList.push(
<div key={-1} className={styles.clear_fix} />
);
_columnList.push(<div key={-1} className={styles.clear_fix} />);
return _columnList;
};
const getRelationshipsMsg = (tableSchema) => {
const getRelationshipsMsg = tableSchema => {
let _relationshipsMsg = '';
const relationships = tableSchema.relationships.map(relObj => relObj.rel_name);
const relationships = tableSchema.relationships.map(
relObj => relObj.rel_name
);
if (relationships.length) {
_relationshipsMsg = (
<div className={styles.add_mar_top_small}>
For <b>relationship{relationships.length !== 1 ? 's' : ''}</b>: <i>{relationships.join(', ')}</i>.
<span className={styles.mar_left}>Set permissions on the corresponding table/view.</span>
For{' '}
<b>
relationship
{relationships.length !== 1 ? 's' : ''}
</b>
: <i>{relationships.join(', ')}</i>.
<span className={styles.mar_left}>
Set permissions on the corresponding table/view.
</span>
</div>
);
}
@ -1232,8 +1252,13 @@ class Permissions extends Component {
const query = permsState.query;
const allowInsertPermColumns = semverCheck('insertPermRestrictColumns', serverVersion);
const queriesWithPermColumns = getQueriesWithPermColumns(allowInsertPermColumns);
const allowInsertPermColumns = semverCheck(
'insertPermRestrictColumns',
serverVersion
);
const queriesWithPermColumns = getQueriesWithPermColumns(
allowInsertPermColumns
);
if (queriesWithPermColumns.includes(query)) {
const dispatchToggleAllColumns = () => {
@ -1262,10 +1287,9 @@ class Permissions extends Component {
</span>
</div>
{ getColumnList(tableSchema, permsState) }
{ getRelationshipsMsg(tableSchema) }
{getColumnList(tableSchema, permsState)}
{getRelationshipsMsg(tableSchema)}
</div>
);
}
@ -1543,7 +1567,9 @@ class Permissions extends Component {
const rolePermissions = tableSchema.permissions.find(
p => p.role_name === permsState.role
);
const currQueryPermissions = rolePermissions ? rolePermissions.permissions[permsState.query] : null;
const currQueryPermissions = rolePermissions
? rolePermissions.permissions[permsState.query]
: null;
const roleListHtml = [];
if (currQueryPermissions) {
@ -1552,7 +1578,9 @@ class Permissions extends Component {
roleListHtml.push(
<div
key={role}
className={styles.display_inline + ' checkbox ' + styles.add_mar_right}
className={
styles.display_inline + ' checkbox ' + styles.add_mar_right
}
>
<label>
<input
@ -1577,7 +1605,11 @@ class Permissions extends Component {
let applyBulkPermissions = null;
if (roleListHtml.length) {
applyBulkPermissions = (
<div className={styles.editPermissionsSection + ' ' + styles.removePadding}>
<div
className={
styles.editPermissionsSection + ' ' + styles.removePadding
}
>
<hr />
<div>Apply same {permsState.query} permissions to other roles:</div>
<div className={styles.add_mar_top_small}>{roleListHtml}</div>
@ -1634,8 +1666,10 @@ class Permissions extends Component {
: undefined;
const newQueryPermissions = permsState[permsState.query];
const disableSave = permsState.applySamePermissions.length ||
(JSON.stringify(newQueryPermissions) === JSON.stringify(currQueryPermissions));
const disableSave =
permsState.applySamePermissions.length ||
JSON.stringify(newQueryPermissions) ===
JSON.stringify(currQueryPermissions);
const disableRemoveAccess = !currQueryPermissions;
const saveButton = getButton(
@ -1663,7 +1697,12 @@ class Permissions extends Component {
);
};
const getEditPermissions = (tableSchema, queryTypes, permsState, roleList) => (
const getEditPermissions = (
tableSchema,
queryTypes,
permsState,
roleList
) => (
<div className={styles.activeEdit}>
<div className={styles.editPermissionsHeading}>
Role: {permsState.role}
@ -1688,7 +1727,12 @@ class Permissions extends Component {
let _editSection = '';
if (permsState.role && permsState.query) {
_editSection = getEditPermissions(tableSchema, queryTypes, permsState, roleList);
_editSection = getEditPermissions(
tableSchema,
queryTypes,
permsState,
roleList
);
}
return _editSection;
@ -1813,7 +1857,12 @@ class Permissions extends Component {
<div className={styles.padd_left_remove}>
<div className={`${styles.padd_remove} col-xs-12`}>
<h4 className={styles.subheading_text}>Permissions</h4>
{getPermissionsTable(tSchema, qTypes, permissionsState, allRolesList)}
{getPermissionsTable(
tSchema,
qTypes,
permissionsState,
allRolesList
)}
{getBulkSection(tSchema, qTypes, permissionsState)}
{getEditSection(tSchema, qTypes, permissionsState, allRolesList)}
</div>

View File

@ -16,7 +16,7 @@ import {
UPDATE_REMOTE_SCHEMA_MANUAL_REL,
RESET_MANUAL_REL_TABLE_LIST,
} from '../DataActions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class AddManualRelationship extends Component {
constructor() {

View File

@ -19,7 +19,7 @@ import gqlPattern, { gqlRelErrorNotif } from '../Common/GraphQLValidation';
import AddManualRelationship from './AddManualRelationship';
import suggestedRelationshipsRaw from './autoRelations';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
/* Gets the complete list of relationships and converts it to a list of object, which looks like so :
{

View File

@ -7,7 +7,7 @@ import { findAllFromRel } from '../utils';
import { setTable, UPDATE_REMOTE_SCHEMA_MANUAL_REL } from '../DataActions';
import AddRelationship from './AddManualRelationship';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
/* Gets the complete list of relationships and converts it to a list of object, which looks like so :
{

View File

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import Helmet from 'react-helmet';
import * as tooltip from './Tooltips';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import {
removeHeader,

View File

@ -1,5 +1,5 @@
import React from 'react';
import {Link} from 'react-router';
import { Link } from 'react-router';
import Helmet from 'react-helmet';
import PageContainer from './PageContainer/PageContainer';
@ -31,16 +31,12 @@ const EventHeader = ({
currentLocation.includes('events/manage') ? styles.active : ''
}
>
<Link
className={styles.linkBorder}
to={appPrefix + '/manage'}
>
<Link className={styles.linkBorder} to={appPrefix + '/manage'}>
<div className={styles.schemaWrapper}>
<div
className={styles.schemaSidebarSection}
data-test="schema"
>
Manage
</div>
</div>

View File

@ -1,6 +1,6 @@
import React from 'react';
import { deleteTrigger } from '../EventActions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
const verifyDeleteTrigger = (triggerName, dispatch) => {
if (confirm('Are you sure?')) {

View File

@ -1,5 +1,5 @@
import React from 'react';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class Editor extends React.Component {
state = {

View File

@ -2,7 +2,7 @@ import React from 'react';
import AceEditor from 'react-ace';
import { showNotification, showTempNotification } from '../../App/Actions';
import { notifExpand, notifMsg } from '../../App/Actions';
import Button from '../Layout/Button/Button';
import Button from '../../Common/Button/Button';
const styles = require('./TableCommon/Table.scss');

View File

@ -4,7 +4,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import globals from '../../../../Globals';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import { LISTING_TRIGGER } from '../EventActions';

View File

@ -21,7 +21,7 @@ import {
addOrder,
removeOrder,
} from './FilterActions.js';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import { setDefaultQuery, runQuery } from './FilterActions';
import { vMakeRequest } from './ViewActions';

View File

@ -21,7 +21,7 @@ import {
addOrder,
removeOrder,
} from './FilterActions.js';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
import { setDefaultQuery, runQuery } from './FilterActions';
import { vMakeRequest } from './ViewActions';

View File

@ -23,7 +23,7 @@ import {
} from './FilterActions.js';
import { setDefaultQuery, runQuery } from './FilterActions';
import { vMakeRequest } from './ViewActions';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
const renderCols = (colName, triggerSchema, onChange, usage, key) => {
const columns = ['id', 'delivered', 'created_at'];

View File

@ -8,7 +8,7 @@ import Helmet from 'react-helmet';
import { push } from 'react-router-redux';
import { loadTriggers } from '../EventActions';
import globals from '../../../../Globals';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
const appPrefix = globals.urlPrefix + '/events';

View File

@ -28,7 +28,7 @@ import {
import * as tooltip from '../Common/Tooltips';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import { convertDateTimeToLocale } from '../utils';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class StreamingLogs extends Component {
constructor(props) {

View File

@ -12,7 +12,7 @@ import {
} from '../EventActions';
import AceEditor from 'react-ace';
import 'brace/mode/json';
import Button from '../../Layout/Button/Button';
import Button from '../../../Common/Button/Button';
class RedeliverEvent extends Component {
constructor(props) {
@ -230,10 +230,10 @@ class RedeliverEvent extends Component {
value={
log.eventInvocations[0]
? JSON.stringify(
log.eventInvocations[0].request,
null,
4
)
log.eventInvocations[0].request,
null,
4
)
: ''
}
minLines={8}

View File

@ -1 +0,0 @@
@import '../../../Common/Common.scss';

View File

@ -1,5 +0,0 @@
@import "../../../Common/Common.scss";
.loader_ml {
margin-left: 3px;
}

View File

@ -1,83 +0,0 @@
/* eslint-disable space-infix-ops */
/* eslint-disable no-loop-func */
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Helmet from 'react-helmet';
import Button from '../Button/Button';
import { push } from 'react-router-redux';
import { loadTriggers } from '../EventActions';
import globals from '../../../../Globals';
const appPrefix = globals.urlPrefix + '/events';
class Schema extends Component {
constructor(props) {
super(props);
// Initialize this table
const dispatch = this.props.dispatch;
dispatch(loadTriggers());
}
render() {
const { migrationMode, dispatch } = this.props;
const styles = require('../PageContainer/PageContainer.scss');
return (
<div
className={`${styles.padd_left_remove} container-fluid ${
styles.padd_top
}`}
>
<div className={styles.padd_left}>
<Helmet title="Event Triggers | Hasura" />
<div>
<h2 className={`${styles.heading_text} ${styles.inline_block}`}>
{' '}
Event Triggers{' '}
</h2>
{migrationMode ? (
<Button
data-test="data-create-trigger"
className={styles.button_mar_right}
color="yellow"
size="sm"
onClick={e => {
e.preventDefault();
dispatch(push(`${appPrefix}/manage/triggers/add`));
}}
>
Create Trigger
</Button>
) : null}
</div>
<hr />
</div>
</div>
);
}
}
Schema.propTypes = {
schema: PropTypes.array.isRequired,
untracked: PropTypes.array.isRequired,
untrackedRelations: PropTypes.array.isRequired,
migrationMode: PropTypes.bool.isRequired,
currentSchema: PropTypes.string.isRequired,
dispatch: PropTypes.func.isRequired,
};
const mapStateToProps = state => ({
schema: state.tables.allSchemas,
schemaList: state.tables.schemaList,
untracked: state.tables.untrackedSchemas,
migrationMode: state.main.migrationMode,
untrackedRelations: state.tables.untrackedRelations,
currentSchema: state.tables.currentSchema,
});
const schemaConnector = connect => connect(mapStateToProps)(Schema);
export default schemaConnector;

View File

@ -47,7 +47,7 @@ const routes = store => {
} else {
alert(
'Hasura console is not able to reach your Hasura GraphQL engine instance. Please ensure that your ' +
'instance is running and the endpoint is configured correctly.'
'instance is running and the endpoint is configured correctly.'
);
}
}