Skip to content

Commit fb0694d

Browse files
committed
more fixes
1 parent b792529 commit fb0694d

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

src/components/newEnvironment/NewEnvironment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const NewEnvironment: FC<Props> = ({ projectName, renderType = 'card', re
5353
<Input placeholder="Enter a branch name" />
5454
</FormItem>
5555
</StepWrapper>
56-
<Tip content="Add the branch you wish to build this environment from. This branch must already exist in your git repository. Please note, that only lowercase alpha characters and “-” are available for group names." />
56+
<Tip content="Add the branch you wish to build this environment from. This branch must already exist in your git repository." />
5757
</>
5858
);
5959

src/components/pages/environment/EnvironmentPage.tsx

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ import deleteEnvironment from '@/lib/mutation/deleteEnvironment';
88
import switchActiveStandby from '@/lib/mutation/switchActiveStandby';
99
import { QueryRef, useMutation, useQueryRefHandlers, useReadQuery } from '@apollo/client';
1010
import { DetailedStats, Head3, Head4, Text } from '@uselagoon/ui-library';
11+
import dayjs from 'dayjs';
12+
import utc from 'dayjs/plugin/utc';
13+
import gitUrlParse from 'git-url-parse';
1114

1215
import ActiveStandbyConfirm from '../../activestandbyconfirm/ActiveStandbyConfirm';
1316
import DeleteConfirm from '../../deleteConfirm/DeleteConfirm';
17+
import { StyledGitLink } from '../projectDetails/styles';
1418
import LimitedRoutes from './_components/LimitedRoutes';
15-
import { EnvironmentActions, RoutesSection, RoutesWrapper } from './styles';
19+
import { EnvironmentActions, RoutesSection } from './styles';
20+
21+
dayjs.extend(utc);
1622

1723
// active/standby routes
1824
export const createLinks = (routes: string | null) =>
@@ -45,6 +51,22 @@ export default function EnvironmentPage({
4551
return <EnvironmentNotFound openshiftProjectName={environmentSlug} />;
4652
}
4753

54+
let gitUrlParsed;
55+
56+
try {
57+
gitUrlParsed = gitUrlParse(environment.project.gitUrl);
58+
} catch {
59+
gitUrlParsed = null;
60+
}
61+
62+
const gitBranchLink = gitUrlParsed
63+
? `${gitUrlParsed.resource}/${gitUrlParsed.full_name}/${
64+
environment.deployType === 'branch'
65+
? `tree/${environment.name}`
66+
: `pull/${environment.name.replace(/pr-/i, '')}`
67+
}`
68+
: '';
69+
4870
const environmentDetailItems = [
4971
{
5072
children: environment.environmentType,
@@ -57,15 +79,28 @@ export default function EnvironmentPage({
5779
label: 'Deployment Type',
5880
},
5981
{
60-
children: environment.created,
82+
children: dayjs.utc(environment.created).local().format('YYYY-MM-DD HH:mm:ss Z'),
6183
key: 'created',
6284
label: 'Created',
6385
},
6486
{
65-
children: environment.updated,
87+
children: dayjs.utc(environment.updated).local().format('YYYY-MM-DD HH:mm:ss Z'),
6688
key: 'updated',
6789
label: 'Updated',
6890
},
91+
...(gitBranchLink
92+
? [
93+
{
94+
children: (
95+
<StyledGitLink className="hover-state" data-cy="source" target="_blank" href={`https://${gitBranchLink}`}>
96+
{gitBranchLink}
97+
</StyledGitLink>
98+
),
99+
key: 'source',
100+
label: 'Source',
101+
},
102+
]
103+
: []),
69104
];
70105

71106
const routes = createLinks(environment.routes);

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3413,7 +3413,7 @@
34133413

34143414
"@uselagoon/ui-library@github:uselagoon/ui-library":
34153415
version "1.1.2"
3416-
resolved "https://codeload.github.com/uselagoon/ui-library/tar.gz/3863033db65385fddde41340289eb3745f1fe0d8"
3416+
resolved "https://codeload.github.com/uselagoon/ui-library/tar.gz/72583bb218482840428e9b17d23690c0b8861e8a"
34173417
dependencies:
34183418
dayjs "^1.11.13"
34193419
react-highlight-words "^0.20.0"

0 commit comments

Comments
 (0)