Skip to content

Commit

Permalink
fix merge confilicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo committed Aug 8, 2017
1 parent cf66782 commit 08a0e07
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
38 changes: 0 additions & 38 deletions superset/assets/javascripts/explore/actions/exploreActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ export function setDatasource(datasource) {
return { type: SET_DATASOURCE, datasource };
}

export const SET_DATASOURCES = 'SET_DATASOURCES';
export function setDatasources(datasources) {
return { type: SET_DATASOURCES, datasources };
}

export const FETCH_DATASOURCE_STARTED = 'FETCH_DATASOURCE_STARTED';
export function fetchDatasourceStarted() {
return { type: FETCH_DATASOURCE_STARTED };
Expand All @@ -34,21 +29,6 @@ export function fetchDatasourceFailed(error) {
return { type: FETCH_DATASOURCE_FAILED, error };
}

export const FETCH_DATASOURCES_STARTED = 'FETCH_DATASOURCES_STARTED';
export function fetchDatasourcesStarted() {
return { type: FETCH_DATASOURCES_STARTED };
}

export const FETCH_DATASOURCES_SUCCEEDED = 'FETCH_DATASOURCES_SUCCEEDED';
export function fetchDatasourcesSucceeded() {
return { type: FETCH_DATASOURCES_SUCCEEDED };
}

export const FETCH_DATASOURCES_FAILED = 'FETCH_DATASOURCES_FAILED';
export function fetchDatasourcesFailed(error) {
return { type: FETCH_DATASOURCES_FAILED, error };
}

export const RESET_FIELDS = 'RESET_FIELDS';
export function resetControls() {
return { type: RESET_FIELDS };
Expand Down Expand Up @@ -81,24 +61,6 @@ export function fetchDatasourceMetadata(datasourceKey, alsoTriggerQuery = false)
};
}

export function fetchDatasources() {
return function (dispatch) {
dispatch(fetchDatasourcesStarted());
const url = '/superset/datasources/';
$.ajax({
type: 'GET',
url,
success: (data) => {
dispatch(setDatasources(data));
dispatch(fetchDatasourcesSucceeded());
},
error(error) {
dispatch(fetchDatasourcesFailed(error.responseJSON.error));
},
});
};
}

export const TOGGLE_FAVE_STAR = 'TOGGLE_FAVE_STAR';
export function toggleFaveStar(isStarred) {
return { type: TOGGLE_FAVE_STAR, isStarred };
Expand Down
38 changes: 0 additions & 38 deletions superset/assets/spec/javascripts/explore/exploreActions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,4 @@ describe('fetching actions', () => {
expect(dispatch.getCall(4).args[0].type).to.equal(actions.TRIGGER_QUERY);
});
});

describe('fetchDatasources', () => {
const makeRequest = () => {
request = actions.fetchDatasources();
request(dispatch);
};

it('calls fetchDatasourcesStarted', () => {
makeRequest();
expect(dispatch.args[0][0].type).to.equal(actions.FETCH_DATASOURCES_STARTED);
});

it('makes the ajax request', () => {
makeRequest();
expect(ajaxStub.calledOnce).to.be.true;
});

it('calls correct url', () => {
const url = '/superset/datasources/';
makeRequest();
expect(ajaxStub.getCall(0).args[0].url).to.equal(url);
});

it('calls correct actions on error', () => {
ajaxStub.yieldsTo('error', { responseJSON: { error: 'error text' } });
makeRequest();
expect(dispatch.callCount).to.equal(2);
expect(dispatch.getCall(1).args[0].type).to.equal(actions.FETCH_DATASOURCES_FAILED);
});

it('calls correct actions on success', () => {
ajaxStub.yieldsTo('success', { data: '' });
makeRequest();
expect(dispatch.callCount).to.equal(3);
expect(dispatch.getCall(1).args[0].type).to.equal(actions.SET_DATASOURCES);
expect(dispatch.getCall(2).args[0].type).to.equal(actions.FETCH_DATASOURCES_SUCCEEDED);
});
});
});

0 comments on commit 08a0e07

Please sign in to comment.