-
Notifications
You must be signed in to change notification settings - Fork 331
/
ChartUsageGuideDialog.tsx
185 lines (179 loc) · 6.16 KB
/
ChartUsageGuideDialog.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import * as React from 'react';
import { connect, Provider } from 'react-redux';
import { bindActionCreators } from '@tencent/ff-redux';
import { RootState } from '../models';
import { allActions } from '../actions';
import { router } from '../router';
import { t, Trans } from '@tencent/tea-app/lib/i18n';
import { Clip, GridTable, TipDialog, WorkflowDialog } from '../../common/components';
const mapDispatchToProps = dispatch =>
Object.assign({}, bindActionCreators({ actions: allActions }, dispatch), {
dispatch
});
export interface RootProps extends RootState {
actions?: typeof allActions;
}
interface ChartUsageGuideDialogProps extends RootProps {
showDialog: boolean;
chartGroupName: string;
registryUrl: string;
username: string;
onClose: Function;
}
interface ChartUsageGuideDialogState extends RootProps {
showDialog?: boolean;
}
@connect(state => state, mapDispatchToProps)
export class ChartUsageGuideDialog extends React.Component<ChartUsageGuideDialogProps, ChartUsageGuideDialogState> {
constructor(props, context) {
super(props, context);
this.state = {
showDialog: this.props.showDialog
};
}
componentWillReceiveProps(nextProps: ChartUsageGuideDialogProps) {
let { showDialog } = nextProps;
if (showDialog !== this.props.showDialog) {
this.setState({
showDialog: showDialog
});
}
}
render() {
return (
<TipDialog
isShow={this.state.showDialog}
width={680}
caption={t('Chart 上传指引')}
cancelAction={() => {
this.setState({ showDialog: false });
this.props.onClose && this.props.onClose();
}}
performAction={() => {
this.setState({ showDialog: false });
this.props.onClose && this.props.onClose();
}}
>
<div className="mirroring-box" style={{ marginTop: '0px' }}>
<ul className="mirroring-upload-list">
<li>
<p>
<strong>
<Trans>前置条件</Trans>
</strong>
</p>
</li>
<li>
<p>
<Trans>
本地安装 Helm 客户端, 更多可查看{' '}
<a href="https://helm.sh/docs/intro/quickstart/" target="_blank">
安装 Helm
</a>
.{' '}
</Trans>
</p>
<code>
<Clip target="#installHelm" className="copy-btn">
<Trans>复制</Trans>
</Clip>
<p id="installHelm">{`curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | sh`}</p>
</code>
</li>
<li>
<p>
<Trans>本地 Helm 客户端添加 TKEStack 的 repo.</Trans>
</p>
<code>
<Clip target="#addTkeRepo" className="copy-btn">
<Trans>复制</Trans>
</Clip>
<p id="addTkeRepo">{`helm repo add ${this.props.chartGroupName} https://${this.props.registryUrl}/chart/${this.props.chartGroupName} --username ${this.props.username} --password [访问凭证] `}</p>
</code>
<p className="text-weak">
<Trans>
获取有效访问凭证信息,请前往
<a
href="javascript:;"
onClick={() => {
let urlParams = router.resolve(this.props.route);
router.navigate(Object.assign({}, urlParams, { sub: 'apikey', mode: '', tab: '' }), {});
}}
>
[访问凭证]
</a>
管理。
</Trans>
</p>
</li>
<li>
<p>
<Trans>安装 helm-push 插件</Trans>
</p>
<code>
<Clip target="#installHelmPush" className="copy-btn">
<Trans>复制</Trans>
</Clip>
<p id="installHelmPush">{`helm plugin install https://github.com/chartmuseum/helm-push`}</p>
</code>
<p className="text-weak">
<Trans>如安装失败,可以手动下载后解压到$HOME/.local/share/helm/plugins,解压路径可以通过helm --help 查看</Trans>
</p>
</li>
<li>
<p>
<strong>
<Trans>上传Helm Chart</Trans>
</strong>
</p>
</li>
<li>
<p>
<Trans>上传文件夹</Trans>
</p>
<code>
<Clip target="#pushHelmDir" className="copy-btn">
<Trans>复制</Trans>
</Clip>
<p id="pushHelmDir">{`helm push ./myapp ${this.props.chartGroupName}`}</p>
</code>
</li>
<li>
<p>
<Trans>上传压缩包</Trans>
</p>
<code>
<Clip target="#pushHelmTar" className="copy-btn">
<Trans>复制</Trans>
</Clip>
<p id="pushHelmTar">{`helm push myapp-1.0.1.tgz ${this.props.chartGroupName}`}</p>
</code>
</li>
<li>
<p>
<Trans>下载最新版本</Trans>
</p>
<code>
<Clip target="#downloadChart" className="copy-btn">
<Trans>复制</Trans>
</Clip>
<p id="downloadChart">{`helm fetch ${this.props.chartGroupName}/myapp`}</p>
</code>
</li>
<li>
<p>
<Trans>下载指定版本</Trans>
</p>
<code>
<Clip target="#downloadSChart" className="copy-btn">
<Trans>复制</Trans>
</Clip>
<p id="downloadSChart">{`helm fetch ${this.props.chartGroupName}/myapp --version 1.0.1`}</p>
</code>
</li>
</ul>
</div>
</TipDialog>
);
}
}