-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/kubernetes): events in manifest details (#5092)
- Loading branch information
Showing
6 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
52 changes: 52 additions & 0 deletions
52
app/scripts/modules/kubernetes/src/v2/manifest/manifestEvents.component.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,52 @@ | ||
import { IComponentOptions, IController, module } from 'angular'; | ||
|
||
class KubernetesManifestEvents implements IController { | ||
public manifest: any; | ||
|
||
public pillStyle(e: any): string { | ||
if (e.type === 'Warning') { | ||
return 'alert' | ||
} else if (e.type === 'Normal') { | ||
return 'success' | ||
} else { | ||
return '' | ||
} | ||
} | ||
|
||
constructor() { | ||
'ngInject'; | ||
} | ||
} | ||
|
||
class KubernetesManifestEventsComponent implements IComponentOptions { | ||
public bindings: any = { manifest: '<' }; | ||
public controller: any = KubernetesManifestEvents; | ||
public controllerAs = 'ctrl'; | ||
public template = ` | ||
<div ng-if="ctrl.manifest && !ctrl.manifest.events">No events found - Kubernetes does not store events for long.</div> | ||
<div class="info" ng-repeat="e in ctrl.manifest.events"> | ||
<div class="horizontal"> | ||
<div ng-if="e.count" class="pill {{ctrl.pillStyle(e)}}">{{e.count}} × <b>{{e.reason}}</b></div> | ||
</div> | ||
<div ng-if="e.firstTimestamp || e.lastTimestamp"> | ||
<div ng-if="e.firstTimestamp === e.lastTimestamp"> | ||
<i>{{e.firstTimestamp}}</i> | ||
</div> | ||
<div ng-if="e.firstTimestamp !== e.lastTimestamp"> | ||
<div> | ||
First Occurrence: <i>{{e.firstTimestamp}}</i> | ||
</div> | ||
<div> | ||
Last Occurrence: <i>{{e.lastTimestamp}}</i> | ||
</div> | ||
</div> | ||
</div> | ||
<div>{{e.message}}<div> | ||
<br ng-if="!$last"> | ||
</div> | ||
`; | ||
} | ||
|
||
export const KUBERNETES_MANIFEST_EVENTS = 'spinnaker.kubernetes.v2.manifest.events'; | ||
module(KUBERNETES_MANIFEST_EVENTS, []) | ||
.component('kubernetesManifestEvents', new KubernetesManifestEventsComponent()); |
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
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