/
PodContainerArtifactsConfigSection.jsx
119 lines (109 loc) · 2.89 KB
/
PodContainerArtifactsConfigSection.jsx
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
116
117
118
119
import PropTypes from "prop-types";
import * as React from "react";
import { MountService } from "foundation-ui";
import { Trans } from "@lingui/macro";
import { i18nMark } from "@lingui/react";
import ConfigurationMapHeading from "#SRC/js/components/ConfigurationMapHeading";
import ConfigurationMapBooleanValue from "../components/ConfigurationMapBooleanValue";
import ConfigurationMapTable from "../components/ConfigurationMapTable";
const BOOLEAN_OPTIONS = {
truthy: i18nMark("TRUE"),
falsy: i18nMark("FALSE")
};
class PodContainerArtifactsConfigSection extends React.Component {
getColumns() {
return [
{
heading() {
return <Trans render="span">Artifact URI</Trans>;
},
prop: "uri"
},
{
heading() {
return <Trans render="span">Executable</Trans>;
},
prop: "executable",
render(prop, row) {
return (
<ConfigurationMapBooleanValue
options={BOOLEAN_OPTIONS}
value={row[prop]}
/>
);
}
},
{
heading() {
return <Trans render="span">Extract</Trans>;
},
prop: "extract",
render(prop, row) {
return (
<ConfigurationMapBooleanValue
options={BOOLEAN_OPTIONS}
value={row[prop]}
/>
);
}
},
{
heading() {
return <Trans render="span">Cache</Trans>;
},
prop: "cache",
render(prop, row) {
return (
<ConfigurationMapBooleanValue
options={BOOLEAN_OPTIONS}
value={row[prop]}
/>
);
}
},
{
heading() {
return <Trans render="span">Destination Path</Trans>;
},
prop: "destPath"
}
];
}
render() {
const { artifacts, index, onEditClick } = this.props;
let tabViewID = "services";
if (index != null) {
tabViewID = `container${index}`;
}
if (!artifacts || !artifacts.length) {
return <noscript />;
}
return (
<MountService.Mount
type="CreateService:ServiceConfigDisplay:Pod:Container:General:Artifacts"
artifacts={artifacts}
onEditClick={onEditClick}
>
<Trans render={<ConfigurationMapHeading level={3} />}>
Container Artifacts
</Trans>
<ConfigurationMapTable
columnDefaults={{ hideIfEmpty: true }}
columns={this.getColumns()}
data={artifacts}
onEditClick={onEditClick}
tabViewID={tabViewID}
/>
</MountService.Mount>
);
}
}
PodContainerArtifactsConfigSection.defaultProps = {
artifacts: []
};
PodContainerArtifactsConfigSection.propTypes = {
artifacts: PropTypes.array,
index: PropTypes.number,
onEditClick: PropTypes.func
};
export default PodContainerArtifactsConfigSection;