fix console link on schema change (#1389)

This commit is contained in:
Rishichandra Wawhal 2019-01-17 22:38:37 +05:30 committed by Shahidh K Muhammed
parent aa36fc68d7
commit 26a997208a
4 changed files with 8 additions and 34 deletions

View File

@ -127,31 +127,6 @@ export const passCT = () => {
validateCT(getTableName(0, testName), 'success');
};
export const failAddExistingTable = () => {
cy.visit(`${baseUrl}/data/schema/public/existing-table-view/add`);
cy.get(getElementFromAlias('existing-table')).type(getTableName(0, testName));
cy.get(getElementFromAlias('add-existing-table-button')).click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/existing-table-view/add`
);
cy.get(getElementFromAlias(getTableName(0, testName))).click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get(getElementFromAlias('untrack-table')).click();
cy.on('window:confirm', () => true);
cy.wait(5000);
};
export const passAddExistingTable = () => {
cy.visit(`${baseUrl}/data/schema/public/existing-table-view/add`);
cy.get(getElementFromAlias('existing-table')).type(getTableName(0, testName));
cy.get(getElementFromAlias('add-existing-table-button')).click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0, testName)}/modify`
);
};
export const failCTDuplicateTable = () => {
// Visit data page
cy.get(getElementFromAlias('sidebar-add-table')).click();

View File

@ -38,8 +38,6 @@ export const runCreateTableTests = () => {
it('Fails to create with duplicate primary key', failCTDuplicatePrimaryKey);
it('Fails to create with wrong default value', failCTWrongDefaultValue);
it('Successfuly creates table', passCT);
it('Fails to add existing table', failAddExistingTable);
it('Passes add existing table', passAddExistingTable);
it('Fails to create duplicate table', failCTDuplicateTable);
it('Delete off the test table', deleteCTTestTable);
});

View File

@ -198,7 +198,7 @@ const loadUntrackedSchema = () => (dispatch, getState) => {
const url = Endpoints.getSchema;
const currentSchema = getState().tables.currentSchema;
const body = initQueries.loadUntrackedSchema;
body.args.where.table_name = currentSchema;
body.args.where.table_schema = currentSchema;
const options = {
credentials: globalCookiePolicy,
method: 'POST',

View File

@ -1,9 +1,10 @@
import React from 'react';
import { Link } from 'react-router';
import { push } from 'react-router-redux';
import _push from './push';
import Helmet from 'react-helmet';
import PageContainer from './PageContainer/PageContainer';
import globals from '../../../Globals';
import {
loadSchema,
loadUntrackedSchema,
@ -11,7 +12,7 @@ import {
UPDATE_CURRENT_SCHEMA,
} from './DataActions';
const appPrefix = '/data';
const sectionPrefix = '/data';
const DataHeader = ({
schema,
@ -34,7 +35,7 @@ const DataHeader = ({
>
<Link
className={styles.sidebarMigration}
to={appPrefix + '/migrations'}
to={sectionPrefix + '/migrations'}
>
Migrations
</Link>
@ -44,7 +45,7 @@ const DataHeader = ({
const handleSchemaChange = e => {
const updatedSchema = e.target.value;
dispatch(push(`${appPrefix}/schema/${updatedSchema}`));
dispatch(_push(`/schema/${updatedSchema}`));
Promise.all([
dispatch({ type: UPDATE_CURRENT_SCHEMA, currentSchema: updatedSchema }),
dispatch(loadSchema()),
@ -74,7 +75,7 @@ const DataHeader = ({
>
<Link
className={styles.schemaBorder}
to={appPrefix + '/schema'}
to={sectionPrefix + '/schema'}
>
Schema:
</Link>
@ -108,7 +109,7 @@ const DataHeader = ({
>
<Link
className={styles.wd100}
to={appPrefix + '/sql'}
to={sectionPrefix + '/sql'}
data-test="sql-link"
>
SQL