forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[explorev2] Bug fixes in Save Modal (apache#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
- Loading branch information
Showing
7 changed files
with
53 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint camelcase: 0 */ | ||
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, saveNewSlice) { | ||
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' | ||
&& !(saveNewSlice && field === 'slice_name')) { | ||
data[field] = form_data[field]; | ||
} | ||
}); | ||
const filterParams = formatFilters(form_data.filters); | ||
Object.assign(data, filterParams); | ||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters