mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 22:05:23 +02:00
fix(registry-manager): add repositories pagination support (#2641)
* fix(registry-management): add support for repositories list with multiple requests * refactor(registry-management): change regex usage to a reusable interceptor function * refactor(registry-management): change interceptor to transformResponse function
This commit is contained in:
parent
90a0998502
commit
801336336f
3 changed files with 40 additions and 8 deletions
|
@ -1,11 +1,13 @@
|
|||
angular.module('portainer.extensions.registrymanagement')
|
||||
.factory('RegistryCatalog', ['$resource', 'API_ENDPOINT_REGISTRIES', function RegistryCatalogFactory($resource, API_ENDPOINT_REGISTRIES) {
|
||||
.factory('RegistryCatalog', ['$resource', 'API_ENDPOINT_REGISTRIES',
|
||||
function RegistryCatalogFactory($resource, API_ENDPOINT_REGISTRIES) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_REGISTRIES + '/:id/v2/:action', {},
|
||||
{
|
||||
get: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', action: '_catalog' }
|
||||
params: { id: '@id', action: '_catalog' },
|
||||
transformResponse: linkGetResponse
|
||||
},
|
||||
ping: {
|
||||
method: 'GET',
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
function linkGetResponse(data, headers) {
|
||||
var response = angular.fromJson(data);
|
||||
var link = headers('link');
|
||||
if (link) {
|
||||
var queryString = link.substring(link.indexOf('?') + 1).split('>;')[0];
|
||||
var queries = queryString.split('&');
|
||||
for (var i = 0; i < queries.length; i++) {
|
||||
var kv = queries[i].split('=');
|
||||
response[kv[0]] = kv[1];
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue