Skip to content

Commit

Permalink
#1348 Fixing UI for legacy data
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoraboeuf committed Sep 13, 2024
1 parent 5857d6a commit 0ab833a
Showing 1 changed file with 36 additions and 29 deletions.
65 changes: 36 additions & 29 deletions ontrack-web-core/components/core/model/EventEntity.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
import {extractProjectEntityInfo} from "@components/entities/ProjectEntityPageInfo";
import {Space} from "antd";
import {useEffect, useState} from "react";

export default function EventEntity({event}) {

let entityType = null
let entity = null

if (event.entities.VALIDATION_RUN) {
entityType = 'VALIDATION_RUN'
entity = event.entities.VALIDATION_RUN
} else if (event.entities.PROMOTION_RUN) {
entityType = 'PROMOTION_RUN'
entity = event.entities.PROMOTION_RUN
} else if (event.entities.PROMOTION_LEVEL) {
entityType = 'PROMOTION_LEVEL'
entity = event.entities.PROMOTION_LEVEL
} else if (event.entities.VALIDATION_STAMP) {
entityType = 'VALIDATION_STAMP'
entity = event.entities.VALIDATION_STAMP
} else if (event.entities.BUILD) {
entityType = 'BUILD'
entity = event.entities.BUILD
} else if (event.entities.BRANCH) {
entityType = 'BRANCH'
entity = event.entities.BRANCH
} else if (event.entities.PROJECT) {
entityType = 'PROJECT'
entity = event.entities.PROJECT
}

const info = extractProjectEntityInfo(entityType, entity)
const [info, setInfo] = useState(null)

useEffect(() => {

let entityType = null
let entity = null

if (event.entities.VALIDATION_RUN) {
entityType = 'VALIDATION_RUN'
entity = event.entities.VALIDATION_RUN
} else if (event.entities.PROMOTION_RUN) {
entityType = 'PROMOTION_RUN'
entity = event.entities.PROMOTION_RUN
} else if (event.entities.PROMOTION_LEVEL) {
entityType = 'PROMOTION_LEVEL'
entity = event.entities.PROMOTION_LEVEL
} else if (event.entities.VALIDATION_STAMP) {
entityType = 'VALIDATION_STAMP'
entity = event.entities.VALIDATION_STAMP
} else if (event.entities.BUILD) {
entityType = 'BUILD'
entity = event.entities.BUILD
} else if (event.entities.BRANCH) {
entityType = 'BRANCH'
entity = event.entities.BRANCH
} else if (event.entities.PROJECT) {
entityType = 'PROJECT'
entity = event.entities.PROJECT
}

setInfo(extractProjectEntityInfo(entityType, entity))
}, [event])


return (
<>
<Space>
{info.type}
{info.component}
{info?.type}
{info?.component}
</Space>
</>
)
Expand Down

0 comments on commit 0ab833a

Please sign in to comment.