2022-05-13 10:00:45 +02:00
|
|
|
import { Accessory } from 'ng-swagger-gen/models/accessory';
|
|
|
|
import { Artifact } from '../../../../../../ng-swagger-gen/models/artifact';
|
|
|
|
import { Platform } from '../../../../../../ng-swagger-gen/models/platform';
|
2020-02-20 09:12:46 +01:00
|
|
|
|
2020-02-25 03:36:24 +01:00
|
|
|
export interface ArtifactFront extends Artifact {
|
2022-05-13 10:00:45 +02:00
|
|
|
platform?: Platform;
|
|
|
|
showImage?: string;
|
|
|
|
pullCommand?: string;
|
|
|
|
annotationsArray?: Array<{ [key: string]: any }>;
|
|
|
|
tagNumber?: number;
|
|
|
|
coSigned?: string;
|
|
|
|
accessoryNumber?: number;
|
2022-01-05 06:41:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface AccessoryFront extends Accessory {
|
2022-05-13 10:00:45 +02:00
|
|
|
pullCommand?: string;
|
|
|
|
tagNumber?: number;
|
|
|
|
scan_overview?: any;
|
2020-02-13 08:39:29 +01:00
|
|
|
}
|
2020-02-25 03:36:24 +01:00
|
|
|
|
2020-02-25 09:07:21 +01:00
|
|
|
export const mutipleFilter = [
|
2022-05-13 10:00:45 +02:00
|
|
|
{
|
|
|
|
filterBy: 'type',
|
|
|
|
filterByShowText: 'Type',
|
|
|
|
listItem: [
|
|
|
|
{
|
|
|
|
filterText: 'IMAGE',
|
|
|
|
showItem: 'ARTIFACT.IMAGE',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filterText: 'CHART',
|
|
|
|
showItem: 'ARTIFACT.CHART',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filterText: 'CNAB',
|
|
|
|
showItem: 'ARTIFACT.CNAB',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filterBy: 'tags',
|
|
|
|
filterByShowText: 'Tags',
|
|
|
|
listItem: [
|
|
|
|
{
|
|
|
|
filterText: '*',
|
|
|
|
showItem: 'ARTIFACT.TAGGED',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filterText: 'nil',
|
|
|
|
showItem: 'ARTIFACT.UNTAGGED',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filterText: '',
|
|
|
|
showItem: 'ARTIFACT.ALL',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filterBy: 'labels',
|
|
|
|
filterByShowText: 'Label',
|
|
|
|
listItem: [],
|
|
|
|
},
|
2022-01-05 06:41:51 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
export enum AccessoryType {
|
2022-05-13 10:00:45 +02:00
|
|
|
COSIGN = 'signature.cosign',
|
2022-07-08 11:03:02 +02:00
|
|
|
NYDUS = 'accelerator.nydus',
|
2022-01-05 06:41:51 +01:00
|
|
|
}
|
|
|
|
|
2022-03-18 12:41:59 +01:00
|
|
|
export enum ArtifactType {
|
2022-05-13 10:00:45 +02:00
|
|
|
IMAGE = 'IMAGE',
|
|
|
|
CHART = 'CHART',
|
|
|
|
CNAB = 'CNAB',
|
|
|
|
OPENPOLICYAGENT = 'OPENPOLICYAGENT',
|
2022-03-18 12:41:59 +01:00
|
|
|
}
|
|
|
|
|
2022-05-13 10:00:45 +02:00
|
|
|
export const artifactDefault = 'images/artifact-default.svg';
|
2022-01-05 06:41:51 +01:00
|
|
|
|
2022-03-03 03:06:28 +01:00
|
|
|
export enum AccessoryQueryParams {
|
2022-05-13 10:00:45 +02:00
|
|
|
ACCESSORY_TYPE = 'accessoryType',
|
2022-03-03 03:06:28 +01:00
|
|
|
}
|
2022-01-05 06:41:51 +01:00
|
|
|
|
2022-05-13 10:00:45 +02:00
|
|
|
export function getPullCommandByDigest(
|
|
|
|
artifactType: string,
|
|
|
|
url: string,
|
|
|
|
digest: string
|
|
|
|
): string {
|
|
|
|
let pullCommand: string = '';
|
|
|
|
if (artifactType && url && digest) {
|
|
|
|
if (artifactType === ArtifactType.IMAGE) {
|
|
|
|
pullCommand = `docker pull ${url}@${digest}`;
|
|
|
|
}
|
|
|
|
if (artifactType === ArtifactType.CNAB) {
|
|
|
|
pullCommand = `cnab-to-oci pull ${url}@${digest}`;
|
|
|
|
}
|
2022-03-18 12:41:59 +01:00
|
|
|
}
|
2022-05-13 10:00:45 +02:00
|
|
|
return pullCommand;
|
2022-03-18 12:41:59 +01:00
|
|
|
}
|
|
|
|
|
2022-05-13 10:00:45 +02:00
|
|
|
export function getPullCommandByTag(
|
|
|
|
artifactType: string,
|
|
|
|
url: string,
|
|
|
|
tag: string
|
|
|
|
): string {
|
|
|
|
let pullCommand: string = '';
|
|
|
|
if (artifactType && url && tag) {
|
|
|
|
if (artifactType === ArtifactType.IMAGE) {
|
|
|
|
pullCommand = `docker pull ${url}:${tag}`;
|
|
|
|
}
|
|
|
|
if (artifactType === ArtifactType.CNAB) {
|
|
|
|
pullCommand = `cnab-to-oci pull ${url}:${tag}`;
|
|
|
|
}
|
|
|
|
if (artifactType === ArtifactType.CHART) {
|
|
|
|
pullCommand = `helm pull oci://${url} --version ${tag}`;
|
|
|
|
}
|
2022-03-18 12:41:59 +01:00
|
|
|
}
|
2022-05-13 10:00:45 +02:00
|
|
|
return pullCommand;
|
2022-03-18 12:41:59 +01:00
|
|
|
}
|