mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
[explorev2] Bug fixes in Save Modal (#1707)
* Bug fixes in Save Modal Issues solved: - Save button doesn't pass in gotodash - slice_name was passed in from store as original slice_name instead of new one in 'saveas' action - datasource_type wasn't passed in to defaultViz and defaultForm function * Change css filename to exploreV2 * Moved out utils
This commit is contained in:
@@ -154,38 +154,6 @@ export function slugify(string) {
|
||||
.replace(/-$/, ''); // remove last floating dash
|
||||
}
|
||||
|
||||
function formatFilters(filters) {
|
||||
// outputs an object of url params of filters
|
||||
// prefix can be 'flt' or 'having'
|
||||
const params = {};
|
||||
for (let i = 0; i < filters.length; i++) {
|
||||
const filter = filters[i];
|
||||
params[`${filter.prefix}_col_${i + 1}`] = filter.col;
|
||||
params[`${filter.prefix}_op_${i + 1}`] = filter.op;
|
||||
params[`${filter.prefix}_eq_${i + 1}`] = filter.value;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
export function getParamObject(form_data, datasource_type) {
|
||||
const data = {
|
||||
// V2 tag temporarily for updating url
|
||||
// Todo: remove after launch
|
||||
V2: true,
|
||||
datasource_id: form_data.datasource,
|
||||
datasource_type,
|
||||
};
|
||||
Object.keys(form_data).forEach((field) => {
|
||||
// filter out null fields
|
||||
if (form_data[field] !== null && field !== 'datasource') {
|
||||
data[field] = form_data[field];
|
||||
}
|
||||
});
|
||||
const filterParams = formatFilters(form_data.filters);
|
||||
Object.assign(data, filterParams);
|
||||
return data;
|
||||
}
|
||||
|
||||
export function getAjaxErrorMsg(error) {
|
||||
const respJSON = error.responseJSON;
|
||||
return (respJSON && respJSON.message) ? respJSON.message :
|
||||
|
||||
Reference in New Issue
Block a user