diff --git a/dashboard/src/components/info-card.tsx b/dashboard/src/components/info-card.tsx index c625958894..7820255b4b 100644 --- a/dashboard/src/components/info-card.tsx +++ b/dashboard/src/components/info-card.tsx @@ -13,7 +13,7 @@ import { colors } from "../styles/variables" import { Facebook } from "react-content-loader" interface InfoCardProps { - type: InfoCardType + type: EntityType } const InfoCard = styled.div` max-height: 13rem; @@ -91,9 +91,9 @@ const Row = styled.div` display: flex; align-items: center; ` -type InfoCardType = "service" | "test" | "task" +type EntityType = "service" | "test" | "task" interface Props { - type: InfoCardType + type: EntityType children: ReactNode entity: Entity } @@ -110,9 +110,11 @@ export default ({ {type.toUpperCase()} {name} - - {state} - + {state && ( + + {state} + + )} diff --git a/dashboard/src/components/module.tsx b/dashboard/src/components/module.tsx index 142cdf00d7..e13f81124d 100644 --- a/dashboard/src/components/module.tsx +++ b/dashboard/src/components/module.tsx @@ -21,8 +21,8 @@ const Module = styled.div` border-radius: 4px; margin: 0 1.3rem 1.3rem 0; min-width: 17rem; - flex: 1 1; - max-width: 20rem; + flex: 1 1; + max-width: 20rem; ` type InfoCardsProps = { @@ -57,11 +57,11 @@ type FieldsProps = { } const Fields = styled.div` display: ${props => (props.visible ? `block` : "none")}; + animation: fadein .5s ; - animation: fadein .5s ; -&:first-of-type{ - padding-top:0; -} + &:first-of-type{ + padding-top:0; + } @keyframes fadein { from { opacity: 0; @@ -72,7 +72,11 @@ const Fields = styled.div` } ` -const Field = styled.div` +type FieldProps = { + inline?: boolean, +} +const Field = styled.div` + display: ${props => (props.inline ? "inline" : "block")}; padding-bottom: .5rem; &:last-of-type{ @@ -96,15 +100,15 @@ const Name = styled.div` color: #323C47; ` -const Key = styled.div` - padding-right: .5rem; +const Key = styled.span` + padding-right: .25rem; font-size: 13px; line-height: 19px; letter-spacing: 0.01em; color: #4C5862; opacity: 0.5; ` -const Value = styled.div` +const Value = styled.span` padding-right: .5rem; font-size: 13px; line-height: 19px; @@ -179,6 +183,12 @@ export default ({ type={"service"} > + {service.dependencies.length > 0 && ( + + Depends on: + {service.dependencies.join(", ")} + + )} @@ -193,20 +203,26 @@ export default ({ entity={test} type={"test"} > - {filters.testsInfo && -
-
- Last run + + {test.dependencies.length > 0 && ( + + Depends on: + {test.dependencies.join(", ")} + + )} +
+ + Ran: {moment(test.startedAt).fromNow()} -
+ {test.state === "succeeded" && -
- Duration + + Took: {test.duration} -
+ }
- } + ))} @@ -217,22 +233,26 @@ export default ({ entity={task} type={"task"} > - {filters.tasksInfo && -
- {task.startedAt && ( -
- Last run - {moment(task.startedAt).fromNow()} -
- )} + + {task.dependencies.length && ( + + Depends on: + {task.dependencies.join(", ")} + + )} +
+ + Ran: + {moment(task.startedAt).fromNow()} + {task.state === "succeeded" && -
- Duration + + Took: {task.duration} -
+ }
- } +
))} diff --git a/dashboard/src/containers/overview.tsx b/dashboard/src/containers/overview.tsx index 83d867d3ac..2c721accb6 100644 --- a/dashboard/src/containers/overview.tsx +++ b/dashboard/src/containers/overview.tsx @@ -49,24 +49,25 @@ export type ModuleModel = { } export type Entity = { name: string; + state?: ServiceState | RunState; isLoading: boolean; - state: ServiceState | RunState; + dependencies: string[]; } export interface Service extends Entity { - state: ServiceState + state?: ServiceState ingresses?: ServiceIngress[] } export interface Test extends Entity { startedAt?: Date completedAt?: Date duration?: string - state: RunState + state?: RunState } export interface Task extends Entity { startedAt?: Date completedAt?: Date duration?: string - state: RunState + state?: RunState } // Note: We render the overview page components individually so we that we don't @@ -103,15 +104,18 @@ export default () => { services: moduleConfig.serviceConfigs.map(service => ({ name: service.name, isLoading: true, - })) as Service[], + dependencies: service.dependencies, + })), tests: moduleConfig.testConfigs.map(test => ({ name: test.name, isLoading: true, - })) as Test[], + dependencies: test.dependencies, + })), tasks: moduleConfig.taskConfigs.map(task => ({ name: task.name, isLoading: true, - })) as Task[], + dependencies: task.dependencies, + })), })) // fill missing data from status @@ -126,7 +130,7 @@ export default () => { if (index !== -1) { currModule.services[index] = { ...currModule.services[index], - state: servicesStatus[serviceName].state || "unknown", + state: servicesStatus[serviceName].state, ingresses: servicesStatus[serviceName].ingresses, isLoading: false, } @@ -140,7 +144,7 @@ export default () => { const testStatus = testsStatus[testName] currModule.tests[index] = { ...currModule.tests[index], - state: testStatus.state || "outdated", + state: testStatus.state, isLoading: false, startedAt: testStatus.startedAt, completedAt: testStatus.completedAt, @@ -158,7 +162,7 @@ export default () => { const taskStatus = tasksStatus[taskName] currModule.tasks[index] = { ...currModule.tasks[index], - state: taskStatus.state || "outdated", + state: taskStatus.state, isLoading: false, startedAt: taskStatus.startedAt, completedAt: taskStatus.completedAt, @@ -188,7 +192,6 @@ export default () => { }
} -
)