diff --git a/package.json b/package.json index beac0f9..f8b971b 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,10 @@ "name": "docker-registry-ui", "version": "2.1.0", "scripts": { + "format": "npm run format-html && npm run format-js && npm run format-riot", + "format-html": "find src rollup rollup.config.js -name '*.html' -exec prettier --config .prettierrc -w --parser html {} \\;", + "format-js": "find src rollup rollup.config.js -name '*.js' -exec prettier --config .prettierrc -w {} \\;", + "format-riot": "find src rollup rollup.config.js -name '*.riot' -exec prettier --config .prettierrc -w --parser html {} \\;", "start": "rollup -c -w --environment ROLLUP_SERVE:true", "build": "rollup -c", "build:electron": "npm run build && cd examples/electron && npm install && npm run dist" @@ -25,8 +29,8 @@ "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.1.3", "core-js": "^3.19.1", - "js-beautify": "^1.14.0", "node-sass": "^7.0.1", + "prettier": "^2.6.2", "riot": "^6.1.2", "riot-mui": "github:joxit/riot-5-mui#4d68d7f", "rollup": "^2.59.0", diff --git a/rollup/license.js b/rollup/license.js index f8f9728..54b7102 100644 --- a/rollup/license.js +++ b/rollup/license.js @@ -15,4 +15,4 @@ export default `/* * along with this program. If not, see . * * @license AGPL - */` \ No newline at end of file + */`; diff --git a/src/components/catalog/catalog-element.riot b/src/components/catalog/catalog-element.riot index f8fd495..01a1c0b 100644 --- a/src/components/catalog/catalog-element.riot +++ b/src/components/catalog/catalog-element.riot @@ -96,10 +96,10 @@ along with this program. If not, see . onAuthentication: props.onAuthentication, }); oReq.addEventListener('load', function () { - if (this.status == 200) { + if (this.status === 200) { const nbTags = (JSON.parse(this.responseText).tags || []).length; self.update({ nbTags }); - } else if (this.status == 404) { + } else if (this.status === 404) { props.onNotify('Server not found', true); } else { props.onNotify(this.responseText, true); diff --git a/src/components/catalog/catalog.riot b/src/components/catalog/catalog.riot index 370d78a..4d05184 100644 --- a/src/components/catalog/catalog.riot +++ b/src/components/catalog/catalog.riot @@ -73,14 +73,14 @@ along with this program. If not, see . onAuthentication: this.props.onAuthentication, }); oReq.addEventListener('load', function () { - if (this.status == 200) { + if (this.status === 200) { repositories = JSON.parse(this.responseText).repositories || []; repositories.sort(); repositories = repositories.reduce(function (acc, e) { const slash = e.indexOf('/'); if (slash > 0) { const repoName = e.substring(0, slash) + '/'; - if (acc.length == 0 || acc[acc.length - 1].repo != repoName) { + if (acc.length === 0 || acc[acc.length - 1].repo != repoName) { acc.push({ repo: repoName, images: [], @@ -92,7 +92,7 @@ along with this program. If not, see . acc.push(e); return acc; }, []); - } else if (this.status == 404) { + } else if (this.status === 404) { self.props.onNotify('Server not found', true); } else { self.props.onNotify(this.responseText); diff --git a/src/components/dialogs/add-registry-url.riot b/src/components/dialogs/add-registry-url.riot index 10b1804..41df728 100644 --- a/src/components/dialogs/add-registry-url.riot +++ b/src/components/dialogs/add-registry-url.riot @@ -31,9 +31,7 @@ - \ No newline at end of file + diff --git a/src/components/dialogs/change-registry-url.riot b/src/components/dialogs/change-registry-url.riot index 9aac35b..bae4937 100644 --- a/src/components/dialogs/change-registry-url.riot +++ b/src/components/dialogs/change-registry-url.riot @@ -32,10 +32,7 @@ - \ No newline at end of file + diff --git a/src/components/dialogs/confirm-delete-image.riot b/src/components/dialogs/confirm-delete-image.riot index 85006a2..efc82bf 100644 --- a/src/components/dialogs/confirm-delete-image.riot +++ b/src/components/dialogs/confirm-delete-image.riot @@ -52,7 +52,7 @@ const oReq = new Http({ onAuthentication }); const self = this; oReq.addEventListener('loadend', function () { - if (this.status == 200 || this.status == 202) { + if (this.status === 200 || this.status === 202) { oReq.getContentDigest(function (digest) { if (!digest) { onNotify(ERROR_CAN_NOT_READ_CONTENT_DIGEST); @@ -60,7 +60,7 @@ self.deleteImage({ name, tag, digest }, opts); } }); - } else if (this.status == 404) { + } else if (this.status === 404) { onNotify(`Manifest for ${name}:${tag} not found`, true); } else { onNotify(this.responseText); @@ -77,10 +77,10 @@ const { registryUrl, ignoreError, onNotify, onAuthentication, onClick } = opts; const oReq = new Http({ onAuthentication }); oReq.addEventListener('loadend', function () { - if (this.status == 200 || this.status == 202) { + if (this.status === 200 || this.status === 202) { router.taglist(name); onNotify(`Deleting ${name}:${tag} image. Run \`registry garbage-collect config.yml\` on your registry`); - } else if (this.status == 404) { + } else if (this.status === 404) { ignoreError || onNotify({ message: 'Digest not found for this image in your registry.', diff --git a/src/components/dialogs/dialogs-menu.riot b/src/components/dialogs/dialogs-menu.riot index c560f54..c0ad257 100644 --- a/src/components/dialogs/dialogs-menu.riot +++ b/src/components/dialogs/dialogs-menu.riot @@ -15,18 +15,35 @@ along with this program. If not, see . --> - - - + + +
more_vert - +
-
\ No newline at end of file + diff --git a/src/components/dialogs/remove-registry-url.riot b/src/components/dialogs/remove-registry-url.riot index 8bfbad1..2a00241 100644 --- a/src/components/dialogs/remove-registry-url.riot +++ b/src/components/dialogs/remove-registry-url.riot @@ -21,8 +21,13 @@ along with this program. If not, see .
  • - + delete { url } @@ -37,18 +42,15 @@ along with this program. If not, see . - \ No newline at end of file + diff --git a/src/components/docker-registry-ui.riot b/src/components/docker-registry-ui.riot index dc2e3f4..2878922 100644 --- a/src/components/docker-registry-ui.riot +++ b/src/components/docker-registry-ui.riot @@ -19,35 +19,63 @@ along with this program. If not, see . - +
    - + - + - + - +
    @@ -64,25 +92,14 @@ along with this program. If not, see .
    - \ No newline at end of file + diff --git a/src/components/search-bar.riot b/src/components/search-bar.riot index 5a5efe2..77fffd1 100644 --- a/src/components/search-bar.riot +++ b/src/components/search-bar.riot @@ -1,9 +1,7 @@ - \ No newline at end of file + diff --git a/src/components/tag-list/image-content-digest.riot b/src/components/tag-list/image-content-digest.riot index 9fef135..96f26a4 100644 --- a/src/components/tag-list/image-content-digest.riot +++ b/src/components/tag-list/image-content-digest.riot @@ -39,12 +39,12 @@ Copyright (C) 2016-2021 Jones Magloire @Joxit onResize(chars) { if (chars !== this.state.chars) { this.update({ - chars + chars, }); } }, getTitle(image, chars) { - return chars >= 70 ? '' : (image.digest || ''); + return chars >= 70 ? '' : image.digest || ''; }, getDigest(image, chars) { if (chars >= 70) { @@ -54,7 +54,7 @@ Copyright (C) 2016-2021 Jones Magloire @Joxit } else { return image.digest && image.digest.slice(0, chars) + '...'; } - } - } + }, + }; - \ No newline at end of file + diff --git a/src/components/tag-list/image-size.riot b/src/components/tag-list/image-size.riot index ed8fe2f..3cbff04 100644 --- a/src/components/tag-list/image-size.riot +++ b/src/components/tag-list/image-size.riot @@ -17,9 +17,7 @@
    { getImageSize(props.image) }
    -
    \ No newline at end of file + diff --git a/src/components/tag-list/pagination.riot b/src/components/tag-list/pagination.riot index 99ce37a..17187d0 100644 --- a/src/components/tag-list/pagination.riot +++ b/src/components/tag-list/pagination.riot @@ -17,14 +17,16 @@ along with this program. If not, see .
    - + onClick="{() => props.onPageUpdate(p.page)}" + > { p.icon }
    { p.page }
    - -
    \ No newline at end of file + + diff --git a/src/components/tag-list/remove-image.riot b/src/components/tag-list/remove-image.riot index 1e086d8..f9796c5 100644 --- a/src/components/tag-list/remove-image.riot +++ b/src/components/tag-list/remove-image.riot @@ -15,29 +15,35 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> - + delete - + - \ No newline at end of file + diff --git a/src/components/tag-list/tag-list.riot b/src/components/tag-list/tag-list.riot index a8cd1b3..437a90b 100644 --- a/src/components/tag-list/tag-list.riot +++ b/src/components/tag-list/tag-list.riot @@ -16,15 +16,13 @@ along with this program. If not, see . --> -
    +
    arrow_back

    Tags of { props.image } -
    - Sourced from { state.registryName + '/' + props.image } -
    +
    Sourced from { state.registryName + '/' + props.image }
    { state.tags.length } tags

    @@ -36,30 +34,31 @@ along with this program. If not, see . - + - \ No newline at end of file + diff --git a/src/components/tag-list/tag-table.riot b/src/components/tag-list/tag-table.riot index 1083e00..795d3b9 100644 --- a/src/components/tag-list/tag-table.riot +++ b/src/components/tag-list/tag-table.riot @@ -15,39 +15,61 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> - + - +
    - - @@ -63,30 +85,42 @@ along with this program. If not, see .
    + onclick="{() => onPageReorder('date') }" + > Creation date + onclick="{() => onPageReorder('size') }" + > Size Content DigestTag + onclick="{ onReverseOrder }" + > + Tag History - + + title="Toggle multi-delete. Alt+Click to select all tags." + onChange="{ onRemoveImageHeaderChange }" + > - + delete - + - + - +
    -
    \ No newline at end of file +
    diff --git a/src/scripts/docker-image.js b/src/scripts/docker-image.js index 9e701fc..79cec8a 100644 --- a/src/scripts/docker-image.js +++ b/src/scripts/docker-image.js @@ -97,7 +97,7 @@ export class DockerImage { const oReq = new Http({ onAuthentication: this.opts.onAuthentication }); const self = this; oReq.addEventListener('loadend', function () { - if (this.status == 200 || this.status == 202) { + if (this.status === 200 || this.status === 202) { const response = JSON.parse(this.responseText); if (response.mediaType === 'application/vnd.docker.distribution.manifest.list.v2+json' && self.opts.list) { self.trigger('list', response); @@ -131,7 +131,7 @@ export class DockerImage { self.trigger('blobs'); self.trigger('oci-image'); } - } else if (this.status == 404) { + } else if (this.status === 404) { self.opts.onNotify(`Manifest for ${self.name}:${self.tag} not found`, true); } else { self.opts.onNotify(this.responseText); @@ -149,7 +149,7 @@ export class DockerImage { const oReq = new Http({ onAuthentication: this.opts.onAuthentication }); const self = this; oReq.addEventListener('loadend', function () { - if (this.status == 200 || this.status == 202) { + if (this.status === 200 || this.status === 202) { const response = JSON.parse(this.responseText); self.creationDate = new Date(response.created); self.blobs = response; @@ -164,7 +164,7 @@ export class DockerImage { self.blobs.id = blob.replace('sha256:', ''); self.trigger('creation-date', self.creationDate); self.trigger('blobs', self.blobs); - } else if (this.status == 404) { + } else if (this.status === 404) { self.opts.onNotify(`Blobs for ${self.name}:${self.tag} not found`, true); } else { self.opts.onNotify(this.responseText); diff --git a/src/scripts/http.js b/src/scripts/http.js index 043e949..432fb73 100644 --- a/src/scripts/http.js +++ b/src/scripts/http.js @@ -52,7 +52,7 @@ export class Http { switch (e) { case 'loadend': { self.oReq.addEventListener('loadend', function () { - if (this.status == 401 && !this.withCredentials) { + if (this.status === 401 && !this.withCredentials) { const tokenAuth = this.hasHeader('www-authenticate') && parseAuthenticateHeader(this.getResponseHeader('www-authenticate')); self.onAuthentication(tokenAuth, (bearer) => { diff --git a/src/scripts/utils.js b/src/scripts/utils.js index cd61701..55cca50 100644 --- a/src/scripts/utils.js +++ b/src/scripts/utils.js @@ -4,7 +4,7 @@ export function bytesToSize(bytes) { const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (bytes == undefined || isNaN(bytes)) { return '?'; - } else if (bytes == 0) { + } else if (bytes === 0) { return '0 Byte'; } const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));