这是indexloc提供的服务,不要输入任何密码
Skip to content

add limit in select permission and override query limit (close #178) #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion console/cypress/integration/data/permissions/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const runPermissionsTests = () => {
describe('Permissions', () => {
it('Create a table', passPTCreateTable);
it('Create a view', passPVCreateView);
it('Check permissiosn route', passPTCheckRoute);
it('Check permission route', passPTCheckRoute);
it('Table No-check permissions work as expected', passPTNoChecks);
it('Table Custom-check permissions work as expected', passPTCustomChecks);
it('Table Permissions removal works as expected', passPTRemovePerms);
Expand Down
41 changes: 30 additions & 11 deletions console/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"clean-webpack-plugin": "^0.1.17",
"concurrently": "^3.5.0",
"css-loader": "^0.28.11",
"cypress": "^3.0.1",
"cypress": "3.0.2",
"dotenv": "^5.0.1",
"eslint": "^4.19.1",
"eslint-config-airbnb": "16.1.0",
Expand Down
8 changes: 8 additions & 0 deletions console/src/components/Common/Common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,14 @@ input {
{
margin-left: 15px;
}
.mar_small_left
{
margin-left: 5px;
}
.mar_small_neg_left
{
margin-left: -5px;
}
.padd_remove
{
padding-left: 0 !important;
Expand Down
5 changes: 2 additions & 3 deletions console/src/components/Services/Data/DataHeader.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { Link } from 'react-router';
import Helmet from 'react-helmet';

import PageContainer from './PageContainer/PageContainer';

import { appPrefix } from './push';
import globals from '../../../Globals';

const appPrefix = '/data';

const DataHeader = ({
schema,
currentSchema,
Expand Down
2 changes: 2 additions & 0 deletions console/src/components/Services/Data/DataState.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const defaultPermissionsState = {
query: '',
custom_checked: false,
newRole: '',
limitEnabled: true,
};

const defaultQueryPermissions = {
Expand All @@ -37,6 +38,7 @@ const defaultQueryPermissions = {
select: {
columns: [],
filter: {},
limit: null,
},
update: {
columns: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React from 'react';
import { Link } from 'react-router';
import Helmet from 'react-helmet';

import { appPrefix } from '../push';

const ViewHeader = ({ tableName, tabName, currentSchema, migrationMode }) => {
const styles = require('../TableCommon/Table.scss');
let capitalised = tabName;
Expand Down Expand Up @@ -51,8 +49,7 @@ const ViewHeader = ({ tableName, tabName, currentSchema, migrationMode }) => {
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/views/' +
tableName +
Expand All @@ -70,8 +67,7 @@ const ViewHeader = ({ tableName, tabName, currentSchema, migrationMode }) => {
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/views/' +
tableName +
Expand All @@ -89,8 +85,7 @@ const ViewHeader = ({ tableName, tabName, currentSchema, migrationMode }) => {
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/views/' +
tableName +
Expand All @@ -107,8 +102,7 @@ const ViewHeader = ({ tableName, tabName, currentSchema, migrationMode }) => {
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/views/' +
tableName +
Expand Down
19 changes: 6 additions & 13 deletions console/src/components/Services/Data/TableCommon/TableHeader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { Link } from 'react-router';
import Helmet from 'react-helmet';
import { appPrefix } from '../push';

const TableHeader = ({
tableName,
Expand Down Expand Up @@ -62,8 +61,7 @@ const TableHeader = ({
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/tables/' +
tableName +
Expand All @@ -80,8 +78,7 @@ const TableHeader = ({
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/tables/' +
tableName +
Expand All @@ -99,8 +96,7 @@ const TableHeader = ({
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/tables/' +
tableName +
Expand All @@ -118,8 +114,7 @@ const TableHeader = ({
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/tables/' +
tableName +
Expand All @@ -136,8 +131,7 @@ const TableHeader = ({
>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/tables/' +
tableName +
Expand All @@ -151,8 +145,7 @@ const TableHeader = ({
<li role="presentation" className={'hide'}>
<Link
to={
appPrefix +
'/schema/' +
'/data/schema/' +
currentSchema +
'/tables/' +
tableName +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ import {
PERM_TOGGLE_COLUMN,
PERM_TOGGLE_ALL_COLUMNS,
PERM_ALLOW_ALL,
PERM_TOGGLE_ENABLE_LIMIT,
PERM_TOGGLE_MODIFY_LIMIT,
PERM_TOGGLE_ALLOW_UPSERT,
PERM_CUSTOM_CHECKED,
PERM_REMOVE_ACCESS,
Expand Down Expand Up @@ -304,6 +306,27 @@ const modifyReducer = (tableName, schemas, modifyStateOrig, action) => {
},
};

case PERM_TOGGLE_ENABLE_LIMIT:
return {
...modifyState,
permissionsState: {
...modifyState.permissionsState,
limitEnabled: action.data,
},
};

case PERM_TOGGLE_MODIFY_LIMIT:
return {
...modifyState,
permissionsState: {
...updatePermissionsState(
modifyState.permissionsState,
'limit',
action.data
),
},
};

case PERM_SET_FILTER_SAME_AS:
case PERM_SET_FILTER:
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
text-align: center;
}

.limitInput {
display: inline-block;
width: 100px;
margin-left: 15px;
height: 25px;
}

.colEditor {
:global(.form-control):focus {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 rgba(102, 175, 233, 0.6);
Expand Down
Loading