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_INSTANCE_TYPE = 'ecs.g5.large';
const DEFAULT_INTERNET_CHARGE_TYPE = 'PayByBandwidth';
export default Component.extend(NodeDriver, { export default Component.extend(NodeDriver, {
intl: service(), intl: service(),
@ -32,11 +33,22 @@ export default Component.extend(NodeDriver, {
images: null, images: null,
instanceTypes: null, instanceTypes: null,
ecsClient: null, showCustomApiEndpoint: false,
step: 1, ecsClient: null,
step: 1,
config: alias('model.aliyunecsConfig'), 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: { actions: {
alyLogin(cb) { alyLogin(cb) {
setProperties(this, { 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() { diskCategoryChoicesDidChange: observer('diskCategoryChoices.@each.value', function() {
const systemDiskCategory = get(this, 'config.systemDiskCategory'); const systemDiskCategory = get(this, 'config.systemDiskCategory');
let found = get(this, 'diskCategoryChoices').findBy('value', systemDiskCategory); let found = get(this, 'diskCategoryChoices').findBy('value', systemDiskCategory);
@ -333,10 +351,11 @@ export default Component.extend(NodeDriver, {
bootstrap() { bootstrap() {
const config = get(this, 'globalStore').createRecord({ const config = get(this, 'globalStore').createRecord({
type: 'aliyunecsConfig', type: 'aliyunecsConfig',
accessKeySecret: '', accessKeySecret: '',
instanceType: DEFAULT_INSTANCE_TYPE, instanceType: DEFAULT_INSTANCE_TYPE,
ioOptimized: 'optimized', 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'); 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"}} {{t "nodeDriver.aliyunecs.apiEndpoint.label"}}
</label> </label>
{{#input-or-display {{#input-or-display
editable=(eq step 1) editable=(eq step 1)
value=config.apiEndpoint
}}
{{input
type="text"
class="form-control"
value=config.apiEndpoint 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}} {{/input-or-display}}
</div> </div>
</div> </div>
@ -335,6 +342,21 @@
value=config.imageId value=config.imageId
}} }}
</div> </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"> <div class="col span-6">
<label class="acc-label"> <label class="acc-label">
{{t "nodeDriver.aliyunecs.internetMaxBandwidth.label"}} {{t "nodeDriver.aliyunecs.internetMaxBandwidth.label"}}
@ -350,21 +372,29 @@
<div class="input-group-addon bg-default">Mbps</div> <div class="input-group-addon bg-default">Mbps</div>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col span-6"> <div class="col span-6">
<label class="acc-label"> <label class="acc-label">
{{t "nodeDriver.aliyunecs.aliyunSLB.label"}} {{t "nodeDriver.aliyunecs.internetChargeType.label"}}
</label> </label>
{{input <div>
type="text" <label class="mr-20 hand">
class="form-control" <RadioButton
value=config.slbId @selection={{config.internetChargeType}}
placeholder=(t "nodeDriver.aliyunecs.aliyunSLB.placeholder") @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>
</div> </div>
{{/unless}}
<div class="row"> <div class="row">
<div class="col span-6"> <div class="col span-6">

View File

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

View File

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