Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(provider/kubernetes): events in manifest details #5092

Merged
merged 1 commit into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ <h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
</ul>
</collapsible-section>

<collapsible-section heading="Events" expanded="true">
<kubernetes-manifest-events manifest="ctrl.manifest"></kubernetes-manifest-events>
</collapsible-section>

<collapsible-section heading="Labels" expanded="true">
<kubernetes-manifest-labels manifest="ctrl.instance.manifest"></kubernetes-manifest-labels>
</collapsible-section>
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/modules/kubernetes/src/v2/kubernetes.v2.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { KUBERNETES_MANIFEST_ARTIFACT } from './manifest/artifact/artifact.compo
import { KUBERNETES_MANIFEST_SELECTOR } from './manifest/selector/selector.component';
import { KUBERNETES_MANIFEST_LABELS } from './manifest/manifestLabels.component';
import { KUBERNETES_MANIFEST_ANNOTATIONS } from './manifest/manifestAnnotations.component';
import { KUBERNETES_MANIFEST_EVENTS } from './manifest/manifestEvents.component';
import { KUBERNETES_MULTI_MANIFEST_SELECTOR } from './manifest/selector/multiSelector.component';
import { KUBERNETES_SHOW_MANIFEST_YAML } from './manifest/showManifestYaml.component';
import { KUBERNETES_SHOW_MANIFEST_DETAILS } from './manifest/showManifestDetails.component';
Expand Down Expand Up @@ -84,6 +85,7 @@ module(KUBERNETES_V2_MODULE, [
KUBERNETES_MULTI_MANIFEST_SELECTOR,
KUBERNETES_MANIFEST_LABELS,
KUBERNETES_MANIFEST_ANNOTATIONS,
KUBERNETES_MANIFEST_EVENTS,
KUBERNETES_SHOW_MANIFEST_YAML,
KUBERNETES_SHOW_MANIFEST_DETAILS,
]).config((cloudProviderRegistryProvider: CloudProviderRegistry) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ <h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
<health-counts class="pull-left" container="ctrl.loadBalancer.instanceCounts"></health-counts>
</collapsible-section>

<collapsible-section heading="Events" expanded="true">
<kubernetes-manifest-events manifest="ctrl.manifest"></kubernetes-manifest-events>
</collapsible-section>

<collapsible-section heading="Labels" expanded="true">
<kubernetes-manifest-labels manifest="ctrl.loadBalancer.manifest"></kubernetes-manifest-labels>
</collapsible-section>
Expand Down
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());
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ <h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
</dd>
</dl>
</collapsible-section>
<collapsible-section heading="Events" expanded="true">
<kubernetes-manifest-events manifest="ctrl.manifest"></kubernetes-manifest-events>
</collapsible-section>
<collapsible-section heading="Labels" expanded="true">
<kubernetes-manifest-labels manifest="ctrl.serverGroup.manifest"></kubernetes-manifest-labels>
</collapsible-section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ <h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
</ul>
</collapsible-section>

<collapsible-section heading="Events" expanded="true">
<kubernetes-manifest-events manifest="ctrl.manifest"></kubernetes-manifest-events>
</collapsible-section>

<collapsible-section heading="Labels" expanded="true">
<kubernetes-manifest-labels manifest="ctrl.serverGroupManager.manifest"></kubernetes-manifest-labels>
</collapsible-section>
Expand Down