Skip to content

Commit

Permalink
feat(artifacts): List artifacts consumed / produced by executions (#5322
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Scott Bloch-Wehba-Seaward committed May 16, 2018
1 parent 99d0c22 commit 897818f
Show file tree
Hide file tree
Showing 14 changed files with 369 additions and 1 deletion.
29 changes: 29 additions & 0 deletions app/scripts/modules/core/src/artifact/ArtifactIconService.ts
@@ -0,0 +1,29 @@
const unknownArtifactPath = require('./icons/unknown-type-artifact.svg');

interface IArtifactIcon {
type: RegExp;
path: string;
}

export class ArtifactIconService {
private static icons: IArtifactIcon[] = [];

public static registerType(type: RegExp, path: string) {
ArtifactIconService.icons.push({ type, path });
}

public static getPath(type: string) {
const icon = ArtifactIconService.icons.find(entry => entry.type.test(type));
if (icon === undefined) {
return unknownArtifactPath;
}
return icon.path;
}
}

ArtifactIconService.registerType(/docker\/image/, require('./icons/docker-image-artifact.svg'));
ArtifactIconService.registerType(/kubernetes\/.*/, require('./icons/kubernetes-artifact.svg'));
ArtifactIconService.registerType(/embedded\/base64/, require('./icons/embedded-base64-artifact.svg'));
ArtifactIconService.registerType(/gcs\/object/, require('./icons/gcs-file-artifact.svg'));
ArtifactIconService.registerType(/github\/file/, require('./icons/github-file-artifact.svg'));
ArtifactIconService.registerType(/s3\/object/, require('./icons/s3-object-artifact.svg'));
30 changes: 30 additions & 0 deletions app/scripts/modules/core/src/artifact/artifactIconList.ts
@@ -0,0 +1,30 @@
import { IComponentOptions, IController, module } from 'angular';
import { ArtifactIconService } from '@spinnaker/core';

class ArtifactIconListController implements IController {
public artifacts: any[];

public iconPath(type: string): string {
return ArtifactIconService.getPath(type);
}
}

class ArtifactIconListComponent implements IComponentOptions {
public bindings: any = { artifacts: '<' };
public controller: any = ArtifactIconListController;
public controllerAs = 'ctrl';
public template = `
<div class="artifact-list-item" ng-repeat="artifact in ctrl.artifacts" title="{{ artifact.type }}">
<img
class="artifact-list-item-icon"
ng-if="ctrl.iconPath(artifact.type)"
ng-src="{{ ctrl.iconPath(artifact.type) }}"
width="20"
height="20"
/><span class="artifact-list-item-name">{{ artifact.name }}<span ng-if="artifact.version"> - {{ artifact.version }}</span></span>
</div>
`;
}

export const ARTIFACT_ICON_LIST = 'spinnaker.kubernetes.v2.kubernetes.artifact.iconList';
module(ARTIFACT_ICON_LIST, []).component('artifactIconList', new ArtifactIconListComponent());
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions app/scripts/modules/core/src/artifact/icons/gcs-file-artifact.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 897818f

Please sign in to comment.