CreateImageWizard: Get all matching packages from package search
When searching for a package, all matching packages are now returned. First an attempt is made using the api's default limit and if there are more matching packages than the default limit a second request is made with an increased limit. To facilitate this, api.getPackages() now accepts an optional limit parameter. Retrieving all matching packages is necessary because of the sorting logic.
This commit is contained in:
parent
7ec9047140
commit
e8e7329bf6
3 changed files with 57 additions and 8 deletions
|
|
@ -28,12 +28,13 @@ async function getComposeStatus(id) {
|
|||
return request.data;
|
||||
}
|
||||
|
||||
async function getPackages(distribution, architecture, search) {
|
||||
async function getPackages(distribution, architecture, search, limit) {
|
||||
const params = new URLSearchParams({
|
||||
distribution,
|
||||
architecture,
|
||||
search,
|
||||
});
|
||||
limit && params.append('limit', limit);
|
||||
let path = '/packages?' + params.toString();
|
||||
const request = await axios.get(IMAGE_BUILDER_API.concat(path));
|
||||
return request.data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue