这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3d2ddd2
server: Rename tables and columns. WIP
rakeshkky Jul 1, 2018
560db07
server: working rename tables. rename columns is in WIP
rakeshkky Jul 3, 2018
7180875
server: Renaming columns. Testing needed
rakeshkky Jul 3, 2018
f5593b9
Merge branch 'master' into rename-tab-col
rakeshkky Jul 4, 2018
2cf262b
server: refactoring code
rakeshkky Jul 5, 2018
6504dbf
server: refactoring code
rakeshkky Jul 5, 2018
e91fd84
server: processSchemaChanges -> processCatalogChanges (only DB tx)
rakeshkky Jul 10, 2018
885fcad
Merge branch 'rename-tab-col' of github.com:hasura/graphql-engine int…
rakeshkky Jul 10, 2018
6f30c15
Merge branch 'master' into rename-tab-col
rakeshkky Jul 10, 2018
1ee1cc3
update metadata when constraints on a table are altered, fix #240
rakeshkky Aug 1, 2018
a0c86b6
fetch table constraints from hdb_catalog.hdb_table_constraint
rakeshkky Aug 2, 2018
19b1828
wip, moving all views from hdb_catalog to hdb_views
rakeshkky Aug 6, 2018
8653850
Merge branch 'master' into issue-79
rakeshkky Aug 6, 2018
52e621f
Merge branch 'issue-79' into issue-240
rakeshkky Aug 6, 2018
0a16970
move all migrate functions to new Migrate.hs
rakeshkky Aug 6, 2018
107f49c
add test cases for rename table and column
rakeshkky Aug 6, 2018
605df1b
Merge branch 'master' into issue-240
rakeshkky Aug 6, 2018
252bf48
improve function naming in Migrate.hs
rakeshkky Aug 6, 2018
b6d740e
fix for migrating from '1' if insert permissions are defined already
rakeshkky Aug 6, 2018
d1e7e5e
Merge branch 'master' into issue-240
rakeshkky Aug 20, 2018
329024d
Merge branch 'master' into issue-240
rakeshkky Jan 28, 2019
0c7b589
add catalog update to have fkey on update cascade of relationships an…
rakeshkky Jan 29, 2019
8855635
Merge branch 'master' into issue-79-renaming
rakeshkky Jan 29, 2019
716c1e9
update columns in permission preset (insert)
rakeshkky Jan 29, 2019
ad16bc0
graphql schema conflict check on new table name
rakeshkky Jan 29, 2019
f34b912
implement rename_relationship query type
rakeshkky Jan 30, 2019
6ff7c09
move modify-table col editor to a new file
wawhal Jan 31, 2019
2f5441c
update renamed fields based on schema dependency objects
rakeshkky Jan 31, 2019
7737841
Merge branch 'master' into issue-79-renaming
rakeshkky Jan 31, 2019
39f084a
saperate migrate related codebase into new module
rakeshkky Jan 31, 2019
7cb6f1f
renaming tables and columns WIP
wawhal Jan 31, 2019
b2444c2
rename tables and columns complete
wawhal Jan 31, 2019
b8bd420
rename columns first
rakeshkky Jan 31, 2019
1a1421b
support renaming relationships
wawhal Jan 31, 2019
4857289
Merge branch 'issue-79-renaming' of github.com:rakeshkky/graphql-engi…
wawhal Feb 1, 2019
cda1a5b
allow renaming relationships for views
wawhal Feb 1, 2019
ec208ef
write tests
wawhal Feb 1, 2019
6468364
update test for views
wawhal Feb 1, 2019
ede67cc
re build schema cache from catalog after relationship rename
rakeshkky Feb 1, 2019
0078307
move tabname map to utils
wawhal Feb 4, 2019
85d050d
build schema cache only if required while migrating metadata
rakeshkky Feb 4, 2019
16b60ba
Merge branch 'master' into issue-79-renaming
rakeshkky Feb 4, 2019
7de6809
Merge branch 'master' into issue-79-renaming
rakeshkky Feb 5, 2019
f2d8dd0
refactor Rename.hs module for better readability
rakeshkky Feb 28, 2019
1c74de2
Merge branch 'master' of github.com:hasura/graphql-engine into issue-…
wawhal Feb 28, 2019
c49dbe3
improve column renaming logic in relationship
rakeshkky Feb 28, 2019
74645c0
fix merge conflicts for console
wawhal Feb 28, 2019
3da43c0
Merge branch 'issue-79-renaming' of github.com:rakeshkky/graphql-engi…
wawhal Feb 28, 2019
0413380
Merge branch 'master' of github.com:hasura/graphql-engine into issue-…
wawhal Feb 28, 2019
b6440a4
Merge branch 'master' into issue-79-renaming
0x777 Mar 1, 2019
8986e18
remove unused function 'getAllRelations'
rakeshkky Mar 1, 2019
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
34 changes: 34 additions & 0 deletions console/cypress/integration/data/modify/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,40 @@ export const passMTCheckRoute = () => {
);
};

export const passMTRenameTable = () => {
cy.get(getElementFromAlias('heading-edit-table')).click();
cy.get(getElementFromAlias('heading-edit-table-input'))
.clear()
.type(getTableName(3, testName));
cy.get(getElementFromAlias('heading-edit-table-save')).click();
cy.wait(10000);
validateCT(getTableName(3, testName), 'success');
cy.get(getElementFromAlias('heading-edit-table')).click();
cy.get(getElementFromAlias('heading-edit-table-input'))
.clear()
.type(getTableName(0, testName));
cy.get(getElementFromAlias('heading-edit-table-save')).click();
cy.wait(10000);
validateCT(getTableName(0, testName), 'success');
};

export const passMTRenameColumn = () => {
cy.get(getElementFromAlias('edit-id')).click();
cy.get(getElementFromAlias('edit-col-name'))
.clear()
.type(getColName(3));
cy.get(getElementFromAlias('save-button')).click();
cy.wait(2500);
validateColumn(getTableName(0, testName), [getColName(3)], 'success');
cy.get(getElementFromAlias(`edit-${getColName(3)}`)).click();
cy.get(getElementFromAlias('edit-col-name'))
.clear()
.type('id');
cy.get(getElementFromAlias('save-button')).click();
cy.wait(2500);
validateColumn(getTableName(0, testName), ['id'], 'success');
};

export const passMTMoveToTable = () => {
cy.get(getElementFromAlias(getTableName(0, testName))).click();
cy.url().should(
Expand Down
4 changes: 4 additions & 0 deletions console/cypress/integration/data/modify/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
failMCWithWrongDefaultValue,
passCreateForeignKey,
passRemoveForeignKey,
passMTRenameTable,
passMTRenameColumn,
} from './spec';

import { testMode } from '../../../helpers/common';
Expand All @@ -36,6 +38,8 @@ export const runModifyTableTests = () => {
it('Creating a table', passMTCreateTable);
it('Moving to the table', passMTMoveToTable);
it('Modify table button opens the correct route', passMTCheckRoute);
it('Pass renaming table', passMTRenameTable);
it('Pass renaming column', passMTRenameColumn);
it('Fails to add column without column name', failMTWithoutColName);
it('Fails without type selected', failMTWithoutColType);
it('Add a column', passMTAddColumn);
Expand Down
36 changes: 31 additions & 5 deletions console/cypress/integration/data/relationships/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
const delRel = (table, relname) => {
cy.get(getElementFromAlias(table)).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias(`remove-button-${relname}`))
.first()
.click();
cy.get(getElementFromAlias(`relationship-toggle-editor-${relname}`)).click();
cy.get(getElementFromAlias(`relationship-remove-${relname}`)).click();
cy.on('window:alert', str => {
expect(str === 'Are you sure?').to.be.true;
});
Expand Down Expand Up @@ -176,7 +175,7 @@ export const passRTAddSuggestedRel = () => {
.clear()
.type('author');
cy.get(getElementFromAlias('obj-rel-save-0')).click();
cy.wait(15000);
cy.wait(5000);
validateColumn(
'article_table_rt',
['title', { name: 'author', columns: ['name'] }],
Expand All @@ -189,7 +188,34 @@ export const passRTAddSuggestedRel = () => {
.clear()
.type('comments');
cy.get(getElementFromAlias('arr-rel-save-0')).click();
cy.wait(15000);
cy.wait(5000);
validateColumn(
'article_table_rt',
['title', { name: 'comments', columns: ['comment'] }],
'success'
);
};

export const passRTRenameRelationship = () => {
cy.get(getElementFromAlias('relationship-toggle-editor-comments')).click();
cy.get(getElementFromAlias('relationship-name-input-comments'))
.clear()
.type('comments_renamed');
cy.get(getElementFromAlias('relationship-save-comments')).click();
cy.wait(5000);
validateColumn(
'article_table_rt',
['title', { name: 'comments_renamed', columns: ['comment'] }],
'success'
);
cy.get(
getElementFromAlias('relationship-toggle-editor-comments_renamed')
).click();
cy.get(getElementFromAlias('relationship-name-input-comments_renamed'))
.clear()
.type('comments');
cy.get(getElementFromAlias('relationship-save-comments_renamed')).click();
cy.wait(5000);
validateColumn(
'article_table_rt',
['title', { name: 'comments', columns: ['comment'] }],
Expand Down
2 changes: 2 additions & 0 deletions console/cypress/integration/data/relationships/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
passRTAddSuggestedRel,
failRTAddSuggestedRel,
checkAddManualRelationshipsButton,
passRTRenameRelationship,
} from './spec';
import { testMode } from '../../../helpers/common';
import { setMetaData } from '../../validators/validators';
Expand Down Expand Up @@ -42,6 +43,7 @@ export const runRelationshipsTests = () => {
it('Deleting the relationships', passRTDeleteRelationships);
it('Adding Suggested Relationships Error', failRTAddSuggestedRel);
it('Adding Suggested Relationships', passRTAddSuggestedRel);
it('Rename relationships', passRTRenameRelationship);
it('Deleting the relationships', passRTDeleteRelationships);
it('Deleting testing tables', passRTDeleteTables);
});
Expand Down
6 changes: 2 additions & 4 deletions console/cypress/integration/data/views/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,8 @@ export const passVAddManualObjRel = () => {
export const passVDeleteRelationships = () => {
cy.get(getElementFromAlias('author_average_rating_vt')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get('button')
.contains('Remove')
.first()
.click();
cy.get(getElementFromAlias('relationship-toggle-editor-author')).click();
cy.get(getElementFromAlias('relationship-remove-author')).click();
cy.on('window:alert', str => {
expect(str === 'Are you sure?').to.be.true;
});
Expand Down
46 changes: 45 additions & 1 deletion console/src/components/Common/Common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ code
.yellow_button
{
background-color: #FEC53D;
border-radius: 5px;
border-radius: 3px;
color: #606060;
border: 1px solid #FEC53D;
padding: 5px 10px;
Expand Down Expand Up @@ -861,7 +861,51 @@ code
{
font-size: 18px;
font-weight: bold;
padding-bottom: 20px
}

.editable_heading_text
{
font-size: 18px;
font-weight: bold;
display: flex;
align-items: center;
padding-bottom: 20px;
h2 {
font-size: 18px;
font-weight: bold;
margin-right: 10px;
}
i {
cursor: pointer;
}
}
.editable_heading_textbox
{
display: flex;
align-items: center;
padding-bottom: 12px;
input {
width: 30%;
font-weight: normal;
}
}
.editable_heading_action
{
margin-left: 10px;
display: flex;
align-items: center;
i {
margin-top: 2px;
}
}
.editable_heading_action_item
{
margin-right: 10px;
font-size: 14px;
text-decoration: underline;
font-weight: normal;
cursor: pointer;
}
.header_project_name
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import React from 'react';
import styles from '../Common.scss';

class Heading extends React.Component {
state = {
text: this.props.currentValue,
isEditting: false,
};

handleTextChange = e => {
this.setState({ text: e.target.value });
};

toggleEditting = () => {
this.setState({ isEditting: !this.state.isEditting });
};

handleKeyPress = e => {
if (this.state.isEditting) {
if (e.charCode === 13) {
this.save();
}
}
};

save = () => {
if (this.props.loading) {
return;
}
this.props.save(this.state.text);
};

render = () => {
const { editable, currentValue, save, loading, property } = this.props;

const { text, isEditting } = this.state;

if (!editable) {
return <h2 className={styles.heading_text}>{currentValue}</h2>;
}

if (!save) {
console.warn('In EditableHeading, please provide a prop save');
}

if (!isEditting) {
return (
<div className={styles.editable_heading_text}>
<h2>{currentValue}</h2>
<div
onClick={this.toggleEditting}
className={styles.editable_heading_action}
data-test={`heading-edit-${property}`}
>
<i className="fa fa-edit" />
</div>
</div>
);
}

return (
<div className={styles.editable_heading_textbox}>
<input
onChange={this.handleTextChange}
className={`${styles.add_pad_left} form-control`}
type="text"
onKeyPress={this.handleKeyPress}
value={text}
data-test={`heading-edit-${property}-input`}
/>
<div className={styles.editable_heading_action}>
<div
className={styles.editable_heading_action_item}
onClick={this.save}
data-test={`heading-edit-${property}-save`}
>
{loading ? 'Saving...' : 'Save'}
</div>
<div
className={styles.editable_heading_action_item}
onClick={this.toggleEditting}
data-test={`heading-edit-${property}-cancel`}
>
Cancel
</div>
</div>
</div>
);
};
}

export default Heading;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const gqlTableErrorNotif = [
custom:
'Table name cannot contain special characters. It can have alphabets, numbers (cannot start with numbers) and _ (can start with _)',
},
'Error renaming table!',
];

const gqlColumnErrorNotif = [
Expand All @@ -18,6 +19,18 @@ const gqlColumnErrorNotif = [
custom:
'Column name cannot contain special characters. It can have alphabets, numbers (cannot start with numbers) and _ (can start with _)',
},
'Error renaming column!',
];

const gqlViewErrorNotif = [
'Error creating view!',
'View name cannot contain special characters',
'',
{
custom:
'View name cannot contain special characters. It can have alphabets, numbers (cannot start with numbers) and _ (can start with _)',
},
'Error renaming view!',
];

const gqlRelErrorNotif = [
Expand All @@ -28,7 +41,13 @@ const gqlRelErrorNotif = [
custom:
'Relationship name cannot contain special characters. It can have alphabets, numbers (cannot start with numbers) and _ (can start with _)',
},
'Error renaming relationship!',
];

export default gqlPattern;
export { gqlTableErrorNotif, gqlColumnErrorNotif, gqlRelErrorNotif };
export {
gqlTableErrorNotif,
gqlViewErrorNotif,
gqlColumnErrorNotif,
gqlRelErrorNotif,
};
13 changes: 8 additions & 5 deletions console/src/components/Services/Data/DataActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ const makeMigrationCall = (
customOnError,
requestMsg,
successMsg,
errorMsg
errorMsg,
shouldSkipSchemaReload
) => {
const upQuery = {
type: 'bulk',
Expand Down Expand Up @@ -519,14 +520,16 @@ const makeMigrationCall = (
};

const onSuccess = () => {
if (globals.consoleMode === 'cli') {
dispatch(loadMigrationStatus()); // don't call for server mode
if (!shouldSkipSchemaReload) {
if (globals.consoleMode === 'cli') {
dispatch(loadMigrationStatus()); // don't call for server mode
}
dispatch(loadSchema());
}
dispatch(loadSchema());
customOnSuccess();
if (successMsg) {
dispatch(showSuccessNotification(successMsg));
}
customOnSuccess();
};

const onError = err => {
Expand Down
Loading