Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(artifacts): List artifacts consumed / produced by executions (#5322
- Loading branch information
Scott Bloch-Wehba-Seaward
committed
May 16, 2018
1 parent
99d0c22
commit 897818f
Showing
14 changed files
with
369 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
app/scripts/modules/core/src/artifact/ArtifactIconService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); |
36 changes: 36 additions & 0 deletions
36
app/scripts/modules/core/src/artifact/icons/docker-image-artifact.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions
20
app/scripts/modules/core/src/artifact/icons/embedded-base64-artifact.svg
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
11
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.
2 changes: 2 additions & 0 deletions
2
app/scripts/modules/core/src/artifact/icons/github-file-artifact.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.