Update Aliyun-Driver

This commit is contained in:
GGGitBoy 2020-03-27 17:19:14 +08:00
parent e2f0dc795b
commit b3f85cfafd
4 changed files with 84 additions and 27 deletions

View File

@ -18,6 +18,7 @@ const OPT_DISK = [
];
const DEFAULT_INSTANCE_TYPE = 'ecs.g5.large';
const DEFAULT_INTERNET_CHARGE_TYPE = 'PayByBandwidth';
export default Component.extend(NodeDriver, {
intl: service(),
@ -32,11 +33,22 @@ export default Component.extend(NodeDriver, {
images: null,
instanceTypes: null,
ecsClient: null,
step: 1,
showCustomApiEndpoint: false,
ecsClient: null,
step: 1,
config: alias('model.aliyunecsConfig'),
init() {
this._super(...arguments);
if (!get(this, 'config.internetChargeType')) {
set(this, 'config.internetChargeType', DEFAULT_INTERNET_CHARGE_TYPE);
}
if (get(this, 'config.apiEndpoint')) {
set(this, 'showCustomApiEndpoint', true);
}
},
actions: {
alyLogin(cb) {
setProperties(this, {
@ -299,6 +311,12 @@ export default Component.extend(NodeDriver, {
}
}),
showCustomApiEndpointDidChange: observer('showCustomApiEndpoint', function() {
if (!get(this, 'showCustomApiEndpoint')){
set(this, 'config.apiEndpoint', '');
}
}),
diskCategoryChoicesDidChange: observer('diskCategoryChoices.@each.value', function() {
const systemDiskCategory = get(this, 'config.systemDiskCategory');
let found = get(this, 'diskCategoryChoices').findBy('value', systemDiskCategory);
@ -333,10 +351,11 @@ export default Component.extend(NodeDriver, {
bootstrap() {
const config = get(this, 'globalStore').createRecord({
type: 'aliyunecsConfig',
accessKeySecret: '',
instanceType: DEFAULT_INSTANCE_TYPE,
ioOptimized: 'optimized',
type: 'aliyunecsConfig',
accessKeySecret: '',
instanceType: DEFAULT_INSTANCE_TYPE,
ioOptimized: 'optimized',
internetChargeType: DEFAULT_INTERNET_CHARGE_TYPE,
});
set(this, 'model.engineInstallURL', 'http://dev-tool.oss-cn-shenzhen.aliyuncs.com/docker-install/1.13.1.sh');

View File

@ -54,15 +54,22 @@
{{t "nodeDriver.aliyunecs.apiEndpoint.label"}}
</label>
{{#input-or-display
editable=(eq step 1)
value=config.apiEndpoint
}}
{{input
type="text"
class="form-control"
editable=(eq step 1)
value=config.apiEndpoint
placeholder=(t "nodeDriver.aliyunecs.apiEndpoint.placeholder")
}}
}}
<Input
@type="checkbox"
@classNames="form-control"
@checked={{showCustomApiEndpoint}}
/>
{{#if showCustomApiEndpoint}}
<Input
@type="text"
@value={{config.apiEndpoint}}
@classNames="form-control"
@placeholder={{t "nodeDriver.aliyunecs.apiEndpoint.placeholder"}}
/>
{{/if}}
{{/input-or-display}}
</div>
</div>
@ -335,6 +342,21 @@
value=config.imageId
}}
</div>
<div class="col span-6">
<label class="acc-label">
{{t "nodeDriver.aliyunecs.aliyunSLB.label"}}
</label>
<Input
@type="text"
@value={{config.slbId}}
@classNames="form-control"
@placeholder={{t "nodeDriver.aliyunecs.aliyunSLB.placeholder"}}
/>
</div>
</div>
{{#unless config.privateAddressOnly}}
<div class="row">
<div class="col span-6">
<label class="acc-label">
{{t "nodeDriver.aliyunecs.internetMaxBandwidth.label"}}
@ -350,21 +372,29 @@
<div class="input-group-addon bg-default">Mbps</div>
</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<label class="acc-label">
{{t "nodeDriver.aliyunecs.aliyunSLB.label"}}
{{t "nodeDriver.aliyunecs.internetChargeType.label"}}
</label>
{{input
type="text"
class="form-control"
value=config.slbId
placeholder=(t "nodeDriver.aliyunecs.aliyunSLB.placeholder")
}}
<div>
<label class="mr-20 hand">
<RadioButton
@selection={{config.internetChargeType}}
@value="PayByBandwidth"
/>
{{t "nodeDriver.aliyunecs.internetChargeType.payByBandwidth"}}
</label>
<label class="hand">
<RadioButton
@selection={{config.internetChargeType}}
@value="PayByTraffic"
/>
{{t "nodeDriver.aliyunecs.internetChargeType.payByTraffic"}}
</label>
</div>
</div>
</div>
{{/unless}}
<div class="row">
<div class="col span-6">

View File

@ -8738,7 +8738,7 @@ nodeDriver:
placeholder: Your Aliyun Account Access Key Secret
provided: Provided
apiEndpoint:
label: API Endpoint (Optional)
label: Private Aliyun API Server Endpoint
placeholder: Private Aliyun API Server Endpoint
instanceOptionsSection:
label: Instance
@ -8758,6 +8758,10 @@ nodeDriver:
aliyunSLB:
label: Aliyun SLB ID
placeholder: Aliyun SLB ID
internetChargeType:
label: EIP Charge Type
payByBandwidth: Pay By Bandwidth
payByTraffic: Pay By Traffic
storageSection:
label: Storage
detail: Configure the storage for the instances that will be created by this template.

View File

@ -8735,8 +8735,8 @@ nodeDriver:
placeholder: 阿里云访问秘钥所对应的令牌
provided: 已提供
apiEndpoint:
label: '(可选)阿里云私有部署API地址'
placeholder: 阿里云私有部署API地址
label: '私有阿里云API地址'
placeholder: 私有阿里云API地址
instanceOptionsSection:
label: 实例
detail: 设置即将创建的阿里云实例
@ -8755,6 +8755,10 @@ nodeDriver:
aliyunSLB:
label: 阿里云SLB ID
placeholder: 阿里云SLB ID
internetChargeType:
label: EIP计费方式
payByBandwidth: 按带宽计费
payByTraffic: 按流量计费
storageSection:
label: 存储
detail: 配置通过该模版创建的实例的存储选项