Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support direct table filter link #146

Merged
merged 3 commits into from
Sep 1, 2020
Merged

Conversation

kaplanelad
Copy link
Contributor

What type of PR is this?
/UI Feature

What this PR does / why we need it:
support direct table filter link
for example, when the user goes to: /?filters=resource:aws_apigateway&executionId=general_1598464963&sortColumn=Name&direction=asc&search=test&rows=100&page=1

the resource table component will set the get parameters:
sortColumn
direction
search
rows

with the URL values

@kaplanelad kaplanelad added kind/new-feature New feature area/ui Improvements or additions to UI labels Aug 26, 2020
@kaplanelad kaplanelad requested a review from rs324 August 26, 2020 18:28
@kaplanelad kaplanelad self-assigned this Aug 26, 2020
* @returns {string} Param value from url
*/
export const getHistory = (query) => {
export const getHistory = (query, defaultReturn = null) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please chagne to defaultValue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

ui/src/utils/History.js Show resolved Hide resolved
const classes = useStyles();
// eslint-disable-next-line
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need it ?

@@ -150,7 +150,7 @@ const FilterBar = ({
}
});

updateFilters(filters);
setFilters(filters);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update filters updates the history as well incase of bad filter passed at the url.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is a bad filter? this code removes the table filters.
If we have a "bad" filter the code will not use them

const classes = useStyles();
// eslint-disable-next-line
const [tableFilters, setTableFilters] = useTableFilters({});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you use tableFilters ? (I only see you use setTableFilters)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@rs324 rs324 added the lgtm label Sep 1, 2020
@kaplanelad kaplanelad merged commit cafb955 into master Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui Improvements or additions to UI kind/new-feature New feature lgtm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants