mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
chore(project): add prettier for code format (#3645)
* chore(project): install prettier and lint-staged * chore(project): apply prettier to html too * chore(project): git ignore eslintcache * chore(project): add a comment about format script * chore(prettier): update printWidth * chore(prettier): remove useTabs option * chore(prettier): add HTML validation * refactor(prettier): fix closing tags * feat(prettier): define angular parser for html templates * style(prettier): run prettier on codebase Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
parent
6663073be1
commit
cf5056d9c0
714 changed files with 31228 additions and 28305 deletions
|
@ -1,27 +1,34 @@
|
|||
import linkGetResponse from './transform/linkGetResponse'
|
||||
import linkGetResponse from './transform/linkGetResponse';
|
||||
|
||||
angular.module('portainer.extensions.registrymanagement')
|
||||
.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' },
|
||||
transformResponse: linkGetResponse
|
||||
},
|
||||
ping: {
|
||||
method: 'GET',
|
||||
params: { id: '@id' }, timeout: 3500
|
||||
},
|
||||
pingWithForceNew: {
|
||||
method: 'GET',
|
||||
params: { id: '@id' }, timeout: 3500,
|
||||
headers: { 'X-RegistryManagement-ForceNew': '1' }
|
||||
}
|
||||
angular.module('portainer.extensions.registrymanagement').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' },
|
||||
transformResponse: linkGetResponse,
|
||||
},
|
||||
ping: {
|
||||
method: 'GET',
|
||||
params: { id: '@id' },
|
||||
timeout: 3500,
|
||||
},
|
||||
pingWithForceNew: {
|
||||
method: 'GET',
|
||||
params: { id: '@id' },
|
||||
timeout: 3500,
|
||||
headers: { 'X-RegistryManagement-ForceNew': '1' },
|
||||
},
|
||||
},
|
||||
{
|
||||
stripTrailingSlashes: false,
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
stripTrailingSlashes: false
|
||||
});
|
||||
}]);
|
||||
]);
|
||||
|
|
|
@ -1,33 +1,38 @@
|
|||
import gitlabResponseGetLink from './transform/gitlabResponseGetLink'
|
||||
import gitlabResponseGetLink from './transform/gitlabResponseGetLink';
|
||||
|
||||
angular.module('portainer.extensions.registrymanagement')
|
||||
.factory('Gitlab', ['$resource', 'API_ENDPOINT_REGISTRIES',
|
||||
function GitlabFactory($resource, API_ENDPOINT_REGISTRIES) {
|
||||
'use strict';
|
||||
return function(env) {
|
||||
const headers = {};
|
||||
if (env) {
|
||||
headers['Private-Token'] = env.token;
|
||||
headers['X-Gitlab-Domain'] = env.url
|
||||
}
|
||||
|
||||
const baseUrl = API_ENDPOINT_REGISTRIES + '/:id/proxies/gitlab/api/v4/projects';
|
||||
|
||||
return $resource(baseUrl, {id:'@id'},
|
||||
{
|
||||
projects: {
|
||||
method: 'GET',
|
||||
params: { membership: 'true' },
|
||||
transformResponse: gitlabResponseGetLink,
|
||||
headers: headers
|
||||
},
|
||||
repositories :{
|
||||
method: 'GET',
|
||||
url: baseUrl + '/:projectId/registry/repositories',
|
||||
params: { tags: true },
|
||||
headers: headers,
|
||||
transformResponse: gitlabResponseGetLink
|
||||
angular.module('portainer.extensions.registrymanagement').factory('Gitlab', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_REGISTRIES',
|
||||
function GitlabFactory($resource, API_ENDPOINT_REGISTRIES) {
|
||||
'use strict';
|
||||
return function (env) {
|
||||
const headers = {};
|
||||
if (env) {
|
||||
headers['Private-Token'] = env.token;
|
||||
headers['X-Gitlab-Domain'] = env.url;
|
||||
}
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
const baseUrl = API_ENDPOINT_REGISTRIES + '/:id/proxies/gitlab/api/v4/projects';
|
||||
|
||||
return $resource(
|
||||
baseUrl,
|
||||
{ id: '@id' },
|
||||
{
|
||||
projects: {
|
||||
method: 'GET',
|
||||
params: { membership: 'true' },
|
||||
transformResponse: gitlabResponseGetLink,
|
||||
headers: headers,
|
||||
},
|
||||
repositories: {
|
||||
method: 'GET',
|
||||
url: baseUrl + '/:projectId/registry/repositories',
|
||||
params: { tags: true },
|
||||
headers: headers,
|
||||
transformResponse: gitlabResponseGetLink,
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -6,84 +6,85 @@
|
|||
|
||||
import $ from 'jquery';
|
||||
|
||||
angular.module('portainer.extensions.registrymanagement')
|
||||
.factory('RegistryManifestsJquery', ['API_ENDPOINT_REGISTRIES',
|
||||
function RegistryManifestsJqueryFactory(API_ENDPOINT_REGISTRIES) {
|
||||
'use strict';
|
||||
angular.module('portainer.extensions.registrymanagement').factory('RegistryManifestsJquery', [
|
||||
'API_ENDPOINT_REGISTRIES',
|
||||
function RegistryManifestsJqueryFactory(API_ENDPOINT_REGISTRIES) {
|
||||
'use strict';
|
||||
|
||||
function buildUrl(params) {
|
||||
return API_ENDPOINT_REGISTRIES + '/' + params.id + '/v2/' + params.repository + '/manifests/'+ params.tag;
|
||||
}
|
||||
|
||||
function _get(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
url: buildUrl(params),
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache',
|
||||
'If-Modified-Since':'Mon, 26 Jul 1997 05:00:00 GMT'
|
||||
},
|
||||
success: (result) => resolve(result),
|
||||
error: (error) => reject(error)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function _getV2(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
url: buildUrl(params),
|
||||
headers: {
|
||||
'Accept': 'application/vnd.docker.distribution.manifest.v2+json',
|
||||
'Cache-Control': 'no-cache',
|
||||
'If-Modified-Since':'Mon, 26 Jul 1997 05:00:00 GMT'
|
||||
},
|
||||
success: (result, status, request) => {
|
||||
result.digest = request.getResponseHeader('Docker-Content-Digest');
|
||||
resolve(result);
|
||||
},
|
||||
error: (error) => reject(error)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function _put(params, data) {
|
||||
const transformRequest = (d) => {
|
||||
return angular.toJson(d, 3);
|
||||
function buildUrl(params) {
|
||||
return API_ENDPOINT_REGISTRIES + '/' + params.id + '/v2/' + params.repository + '/manifests/' + params.tag;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: buildUrl(params),
|
||||
headers: {
|
||||
'Content-Type': 'application/vnd.docker.distribution.manifest.v2+json'
|
||||
},
|
||||
data: transformRequest(data),
|
||||
success: (result) => resolve(result),
|
||||
error: (error) => reject(error)
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function _delete(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: buildUrl(params),
|
||||
success: (result) => resolve(result),
|
||||
error: (error) => reject(error)
|
||||
function _get(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
url: buildUrl(params),
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache',
|
||||
'If-Modified-Since': 'Mon, 26 Jul 1997 05:00:00 GMT',
|
||||
},
|
||||
success: (result) => resolve(result),
|
||||
error: (error) => reject(error),
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
get: _get,
|
||||
getV2: _getV2,
|
||||
put: _put,
|
||||
delete: _delete
|
||||
}
|
||||
}]);
|
||||
function _getV2(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
url: buildUrl(params),
|
||||
headers: {
|
||||
Accept: 'application/vnd.docker.distribution.manifest.v2+json',
|
||||
'Cache-Control': 'no-cache',
|
||||
'If-Modified-Since': 'Mon, 26 Jul 1997 05:00:00 GMT',
|
||||
},
|
||||
success: (result, status, request) => {
|
||||
result.digest = request.getResponseHeader('Docker-Content-Digest');
|
||||
resolve(result);
|
||||
},
|
||||
error: (error) => reject(error),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function _put(params, data) {
|
||||
const transformRequest = (d) => {
|
||||
return angular.toJson(d, 3);
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: buildUrl(params),
|
||||
headers: {
|
||||
'Content-Type': 'application/vnd.docker.distribution.manifest.v2+json',
|
||||
},
|
||||
data: transformRequest(data),
|
||||
success: (result) => resolve(result),
|
||||
error: (error) => reject(error),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function _delete(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: buildUrl(params),
|
||||
success: (result) => resolve(result),
|
||||
error: (error) => reject(error),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
get: _get,
|
||||
getV2: _getV2,
|
||||
put: _put,
|
||||
delete: _delete,
|
||||
};
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
import linkGetResponse from './transform/linkGetResponse';
|
||||
|
||||
angular.module('portainer.extensions.registrymanagement')
|
||||
.factory('RegistryTags', ['$resource', 'API_ENDPOINT_REGISTRIES', function RegistryTagsFactory($resource, API_ENDPOINT_REGISTRIES) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_REGISTRIES + '/:id/v2/:repository/tags/list', {}, {
|
||||
get: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', repository: '@repository' },
|
||||
transformResponse: linkGetResponse
|
||||
}
|
||||
});
|
||||
}]);
|
||||
angular.module('portainer.extensions.registrymanagement').factory('RegistryTags', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_REGISTRIES',
|
||||
function RegistryTagsFactory($resource, API_ENDPOINT_REGISTRIES) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_REGISTRIES + '/:id/v2/:repository/tags/list',
|
||||
{},
|
||||
{
|
||||
get: {
|
||||
method: 'GET',
|
||||
params: { id: '@id', repository: '@repository' },
|
||||
transformResponse: linkGetResponse,
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -7,4 +7,4 @@ export default function gitlabResponseGetLink(data, headers) {
|
|||
response = data;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,4 +10,4 @@ export default function linkGetResponse(data, headers) {
|
|||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue