-
Notifications
You must be signed in to change notification settings - Fork 154
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
Pagination refactor + Space awareness for Kibana #721
Pagination refactor + Space awareness for Kibana #721
Conversation
src/main/java/co/elastic/support/diagnostics/commands/KibanaUrl.java
Outdated
Show resolved
Hide resolved
Thank you @pickypg for the review - I'll work on #721 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to merge this and make a few tweaks to push.
if(current.isSpaceAware()) { | ||
for(String spaceId : spacesIds) { | ||
RestEntry tmp = new RestEntry(current); | ||
// The calls made for the default Space will be written without a subpath | ||
if(!spaceId.equals("default")) { | ||
tmp.url = String.format("/s/%s%s", spaceId, tmp.getUrl()); | ||
// Sanitizing the spaceId to make it "safe" for a filepath | ||
tmp.subdir = Paths.get(tmp.subdir, "space_" + spaceId.replaceAll("[^a-zA-Z0-9-_]", "_")).normalize().toString(); | ||
} | ||
if(current.isPageable()) { | ||
getAllPages(client, queries, context.perPage, tmp, current.getPageableFieldName()); | ||
} else { | ||
queries.add(tmp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tmp
is a bit of an ambiguous name for this usage. We should name it so a future reader can understand it.
if(current.isSpaceAware()) { | |
for(String spaceId : spacesIds) { | |
RestEntry tmp = new RestEntry(current); | |
// The calls made for the default Space will be written without a subpath | |
if(!spaceId.equals("default")) { | |
tmp.url = String.format("/s/%s%s", spaceId, tmp.getUrl()); | |
// Sanitizing the spaceId to make it "safe" for a filepath | |
tmp.subdir = Paths.get(tmp.subdir, "space_" + spaceId.replaceAll("[^a-zA-Z0-9-_]", "_")).normalize().toString(); | |
} | |
if(current.isPageable()) { | |
getAllPages(client, queries, context.perPage, tmp, current.getPageableFieldName()); | |
} else { | |
queries.add(tmp); | |
if (current.isSpaceAware()) { | |
for (String spaceId : spacesIds) { | |
RestEntry spaceEntry = new RestEntry(current); | |
// The calls made for the default Space will be written without a subpath | |
if (!spaceId.equals("default")) { | |
spaceEntry.url = String.format("/s/%s%s", spaceId, spaceEntry.getUrl()); | |
// Sanitizing the spaceId to make it "safe" for a filepath | |
spaceEntry.subdir = Paths.get(spaceEntry.subdir, "space_" + spaceId.replaceAll("[^a-zA-Z0-9-_]", "_")).normalize().toString(); | |
} | |
if(current.isPageable()) { | |
getAllPages(client, queries, context.perPage, spaceEntry, current.getPageableFieldName()); | |
} else { | |
queries.add(spaceEntry); |
if(pageableFieldName != null) { | ||
this.pageableFieldName = pageableFieldName; | ||
this.isPageable = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the [unlikely] event where we're unsetting it, we need to properly reflect that state.
if(pageableFieldName != null) { | |
this.pageableFieldName = pageableFieldName; | |
this.isPageable = true; | |
} | |
this.pageableFieldName = pageableFieldName; | |
this.isPageable = pageableFieldName != null; |
">= 7.0.0": | ||
url: "/api/actions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no harm in it, but we don't need to specify the "verbose" format when we don't need it.
We could just do
">= 7.0.0": | |
url: "/api/actions" | |
">= 7.0.0": "/api/actions" |
Attempt to solve #578
Checklist
Notes/Obs
The KibanaUrl code could be integrated in the RestEntry - if we agree on that we can change it.
Hold prior merging.