forked from ansible/ansible-hub-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecution-environment-header.tsx
115 lines (109 loc) · 3.28 KB
/
execution-environment-header.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import { Trans, t } from '@lingui/macro';
import React from 'react';
import { ContainerRepositoryType } from 'src/api';
import {
BaseHeader,
Breadcrumbs,
SignatureBadge,
Tabs,
Tooltip,
} from 'src/components';
import { Paths, formatEEPath, formatPath } from 'src/paths';
import { lastSyncStatus, lastSynced } from 'src/utilities';
interface IProps {
id: string;
tab: string;
updateState: (any) => void;
container: ContainerRepositoryType;
pageControls?: React.ReactElement;
groupId?: number;
displaySignatures: boolean;
}
export class ExecutionEnvironmentHeader extends React.Component<IProps> {
render() {
const { container, groupId, tab, displaySignatures } = this.props;
const tabs = [
{ id: 'detail', name: t`Detail` },
{ id: 'activity', name: t`Activity` },
{ id: 'images', name: t`Images` },
{ id: 'access', name: t`Access` },
];
const last_sync_task = container.pulp.repository.remote?.last_sync_task;
return (
<BaseHeader
title={container.name}
breadcrumbs={
<Breadcrumbs
links={[
{
url: formatPath(Paths.executionEnvironments),
name: t`Execution Environments`,
},
{
name: container.name,
url:
tab === 'access'
? formatEEPath(Paths.executionEnvironmentDetail, {
container: container.name,
})
: null,
},
tab === 'access'
? {
name: t`Access`,
url: groupId
? formatEEPath(Paths.executionEnvironmentDetailAccess, {
container: container.name,
})
: null,
}
: null,
tab === 'access' && groupId
? { name: t`Group ${groupId}` }
: null,
].filter(Boolean)}
/>
}
pageControls={this.props.pageControls}
>
{displaySignatures &&
this.props.container.pulp.repository.sign_state && (
<SignatureBadge
isCompact
signState={
this.props.container.pulp.repository.sign_state == 'signed'
? 'signed'
: 'unsigned'
}
/>
)}
{last_sync_task && (
<p className='hub-m-truncated'>
<Trans>
Last updated from registry {lastSynced({ last_sync_task })}
</Trans>{' '}
{lastSyncStatus({ last_sync_task })}
</p>
)}
<div style={{ height: '10px' }}> </div>
<Tooltip content={container.description}>
<p data-cy='description' className={'hub-m-truncated'}>
{container.description}
</p>
</Tooltip>
<span />
<div className='hub-tab-link-container'>
<div className='tabs'>
<Tabs
tabs={tabs}
params={{ tab }}
updateParams={({ tab }) =>
this.props.updateState({ redirect: tab })
}
/>
</div>
</div>
</BaseHeader>
);
}
}