diff --git a/src/components/tag-list/architectures.riot b/src/components/tag-list/architectures.riot
new file mode 100644
index 0000000..2f40841
--- /dev/null
+++ b/src/components/tag-list/architectures.riot
@@ -0,0 +1,54 @@
+
+ { architecture }
+
+
+
diff --git a/src/components/tag-list/tag-table.riot b/src/components/tag-list/tag-table.riot
index c96a26b..f5ae108 100644
--- a/src/components/tag-list/tag-table.riot
+++ b/src/components/tag-list/tag-table.riot
@@ -49,6 +49,7 @@ along with this program. If not, see .
>
Tag
+
Arch |
History |
| .
on-notify="{ props.onNotify }"
>
+
+
+ |
|
@@ -130,6 +134,7 @@ along with this program. If not, see .
import CopyToClipboard from './copy-to-clipboard.riot';
import TagHistoryButton from './tag-history-button.riot';
import RemoveImage from './remove-image.riot';
+ import Architectures from './architectures.riot';
import { matchSearch } from '../search-bar.riot';
import ConfirmDeleteImage from '../dialogs/confirm-delete-image.riot';
const ACTION_CHECK_TO_DELETE = 'CHECK';
@@ -146,6 +151,7 @@ along with this program. If not, see .
RemoveImage,
TagHistoryButton,
ConfirmDeleteImage,
+ Architectures,
},
onBeforeMount(props) {
this.state = {
@@ -277,4 +283,9 @@ along with this program. If not, see .
};
export { ACTION_CHECK_TO_DELETE, ACTION_UNCHECK_TO_DELETE, ACTION_DELETE_IMAGE };
+
diff --git a/src/scripts/docker-image.js b/src/scripts/docker-image.js
index a7bc7fc..a25de18 100644
--- a/src/scripts/docker-image.js
+++ b/src/scripts/docker-image.js
@@ -34,6 +34,13 @@ export const filterWrongManifests = (response) => {
);
};
+export const platformToString = (platform) => {
+ if (!platform || !platform.architecture) {
+ return 'unknown';
+ }
+ return platform.architecture + (platform.variant ? platform.variant : '');
+};
+
export class DockerImage {
constructor(name, tag, { list, registryUrl, onNotify, onAuthentication, useControlCacheHeader }) {
this.name = name;
@@ -90,7 +97,9 @@ export class DockerImage {
if (this.status === 200 || this.status === 202) {
const response = JSON.parse(this.responseText);
if (supportListManifest(response) && self.opts.list) {
- self.trigger('list', filterWrongManifests(response));
+ const manifests = filterWrongManifests(response);
+ self.trigger('list', manifests);
+ self.manifests = manifests;
const manifest = response.manifests[0];
const image = new DockerImage(self.name, manifest.digest, { ...self.opts, list: false });
eventTransfer(image, self);
diff --git a/test/docker-image.test.js b/test/docker-image.test.js
index cbf176a..7e8be61 100644
--- a/test/docker-image.test.js
+++ b/test/docker-image.test.js
@@ -1,4 +1,4 @@
-import { supportListManifest, filterWrongManifests } from '../src/scripts/docker-image.js';
+import { supportListManifest, filterWrongManifests, platformToString } from '../src/scripts/docker-image.js';
import { dockerManifestList } from './fixtures/docker-manifest-list.js';
import { ociImageIndexLayer } from './fixtures/oci-image-index-layer.js';
import { ociImageIndexManifest } from './fixtures/oci-image-index-manifest.js';
@@ -36,10 +36,18 @@ describe('docker-image', () => {
);
});
it('should return all manifests for `application/vnd.oci.image.index.v1+json`', () => {
- assert.equal(
- filterWrongManifests(ociImageIndexManifest['application/vnd.oci.image.index.v1+json']).length,
- 2
- );
+ assert.equal(filterWrongManifests(ociImageIndexManifest['application/vnd.oci.image.index.v1+json']).length, 2);
+ });
+ });
+ describe('platformToString', () => {
+ it('should return unknown when the platform is not found', () => {
+ assert.equal(platformToString(), 'unknown');
+ assert.equal(platformToString({}), 'unknown');
+ });
+ it('should format the platform', () => {
+ assert.equal(platformToString({ os: 'linux', architecture: 'amd64' }), 'amd64');
+ assert.equal(platformToString({ os: 'linux', architecture: 'arm', variant: 'v7' }), 'armv7');
+ assert.equal(platformToString({ architecture: 'arm', variant: 'v7' }), 'armv7');
});
});
});