Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit abbba1f

Browse files
author
Noah Hanjun Lee
authored
feat: responsive deployment view (#94)
* Display the deployed time * Support responsible view
1 parent df11732 commit abbba1f

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

ui/src/components/DeployConfirm.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Form, Typography, Avatar, Button, Collapse, Timeline } from "antd"
2+
import moment from "moment"
23

34
import { Deployment, Commit } from "../models"
45
import DeploymentRefCode from "./DeploymentRefCode"
@@ -60,6 +61,12 @@ export default function DeployConfirm(props: DeployConfirmProps): JSX.Element {
6061
U
6162
</Avatar>}
6263
</Form.Item>
64+
<Form.Item
65+
{...layout}
66+
label="Deployed At"
67+
>
68+
<Text>{moment(props.deployment.createdAt).format()}</Text>
69+
</Form.Item>
6370
{(props.deployment.isApprovalEanbled) ?
6471
<Form.Item
6572
{...layout}

ui/src/components/DeploymentStatusSteps.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Steps, Popover } from "antd"
2+
import moment from "moment"
23

34
import { Deployment } from "../models"
45
import DeploymentStatusBadge from "./DeploymentStatusBadge"
@@ -23,17 +24,20 @@ export default function DeploymentStatusSteps(props: DeploymentStatusStepsProps)
2324
size="small"
2425
responsive>
2526
{props.deployment.statuses.map((status, idx) => {
26-
const title = (status.logUrl) ?
27+
const title = (status.logUrl)?
2728
<a href={status.logUrl}>{status.status}</a> :
2829
<span>{status.status}</span>
30+
31+
const description = (status.description)?
32+
`${status.description.replace(/\.$/,' ')} at ${moment(status.createdAt).format('HH:mm:ss')}` :
33+
moment(status.createdAt).format('HH:mm:ss')
34+
2935
return (<Step
30-
key={idx}
31-
style={{width: "100px"}}
32-
status="finish"
33-
icon={<span></span>}
34-
title={<Popover content={status.description}>
35-
{title}
36-
</Popover>}
36+
key={idx}
37+
style={{width: "100px"}}
38+
status="finish"
39+
icon={<span></span>}
40+
title={<Popover content={description}>{title}</Popover>}
3741
/>)
3842
})}
3943
</Steps>

ui/src/views/Deployment.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect } from "react"
2-
import { Breadcrumb, PageHeader, Row, Col } from "antd"
2+
import { Breadcrumb, PageHeader, Row, Col, Divider } from "antd"
33
import { shallowEqual } from 'react-redux'
44
import { useParams } from "react-router-dom"
55

@@ -154,10 +154,22 @@ export default function DeploymentView(): JSX.Element {
154154
onBack={onBack}
155155
/>
156156
</div>
157-
{/* TODO: support mobile view */}
158157
<div style={{marginTop: "20px", marginBottom: "30px"}}>
159158
<Row>
160-
<Col span="18">
159+
<Col xs={{span: 24}} md={{span: 0}}>
160+
{/* Mobile view */}
161+
{(deployment.isApprovalEanbled) ?
162+
<ApproversSelector
163+
approvers={approvers}
164+
candidates={candidates}
165+
approvals={approvals}
166+
onSearchCandidates={onSearchCandidates}
167+
onSelectCandidate={onSelectCandidate}
168+
/> :
169+
null}
170+
<Divider />
171+
</Col>
172+
<Col xs={{span: 24}} md={{span: 18}}>
161173
<DeployConfirm
162174
isDeployable={(repo?.locked)? false : isDeployable(deployment, approvals)}
163175
deploying={RequestStatus.Pending === deploying}
@@ -166,7 +178,8 @@ export default function DeploymentView(): JSX.Element {
166178
onClickDeploy={onClickDeploy}
167179
/>
168180
</Col>
169-
<Col span="6">
181+
<Col xs={{span: 0}} md={{span: 6}}>
182+
{/* Desktop view */}
170183
{(deployment.isApprovalEanbled) ?
171184
<ApproversSelector
172185
approvers={approvers}

0 commit comments

Comments
 (0)