diff --git a/src/app/applications/components/application-details/application-details.tsx b/src/app/applications/components/application-details/application-details.tsx index a662c4e256851..e58b5db381f74 100644 --- a/src/app/applications/components/application-details/application-details.tsx +++ b/src/app/applications/components/application-details/application-details.tsx @@ -181,6 +181,8 @@ export class ApplicationDetails extends React.Component, + }, { + title: 'EVENTS', key: 'event', content: , }]}/> )} diff --git a/src/app/applications/components/application-resource-events/application-resource-events.tsx b/src/app/applications/components/application-resource-events/application-resource-events.tsx index 84829fa884edf..e4e70b4630669 100644 --- a/src/app/applications/components/application-resource-events/application-resource-events.tsx +++ b/src/app/applications/components/application-resource-events/application-resource-events.tsx @@ -6,16 +6,18 @@ import { services } from '../../../shared/services'; require('./application-resource-events.scss'); -export class ApplicationResourceEvents extends React.Component<{ applicationName: string, resource: models.ResourceNode }, { events: models.Event[] }> { +export class ApplicationResourceEvents extends React.Component<{ applicationName: string, resource?: models.ResourceNode }, { events: models.Event[] }> { - constructor(props: {applicationName: string, resource: models.ResourceNode }) { + constructor(props: {applicationName: string, resource?: models.ResourceNode }) { super(props); this.state = { events: null }; } public async componentDidMount() { - const events = await services.applications.resourceEvents(this.props.applicationName, this.props.resource.state.metadata.uid, this.props.resource.state.metadata.name); - this.setState({ events }); + const events = this.props.resource ? + services.applications.resourceEvents(this.props.applicationName, this.props.resource.state.metadata.uid, this.props.resource.state.metadata.name) : + services.applications.events(this.props.applicationName); + this.setState({ events: await events }); } public render() { @@ -28,7 +30,8 @@ export class ApplicationResourceEvents extends React.Component<{ applicationName
-
MESSAGE
+
REASON
+
MESSAGE
COUNT
EVENT TIMESTAMP
@@ -37,7 +40,8 @@ export class ApplicationResourceEvents extends React.Component<{ applicationName
-
{event.message}
+
{event.reason}
+
{event.message}
{event.count}
{event.firstTimestamp}
diff --git a/src/app/shared/services/applications-service.ts b/src/app/shared/services/applications-service.ts index e90130239a38a..10481c2d0ecf7 100644 --- a/src/app/shared/services/applications-service.ts +++ b/src/app/shared/services/applications-service.ts @@ -53,6 +53,10 @@ export class ApplicationsService { return requests.delete(`/applications/${applicationName}/pods/${podName}`).send().then(() => true); } + public events(applicationName: string): Promise { + return this.resourceEvents(applicationName, null, null); + } + public resourceEvents(applicationName: string, resourceUID: string, resourceName: string): Promise { return requests.get(`/applications/${applicationName}/events`).query({resourceName, resourceUID}).send().then((res) => (res.body as models.EventList).items || []); }