使用支持S3协议的云存储作为文件服务器。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

176 lines
6.1 KiB

BI.config("dec.constant.intelligence.cluster.file.server", function (items) {
items.push({
value: "S3", // 地址栏显示的hash值
id: "decision-intelligence-cluster-file-s3", // id
text: BI.i18nText(""), // 文字
cardType: "dec.intelligence.cluster.file.s3"
});
return items;
});
!(function () {
var LABEL_WIDTH = 116, EDITOR_WIDTH = 300;
var S3 = BI.inherit(BI.Widget, {
props: {
baseCls: "dec-cluster-ftp",
value: {}
},
_store: function () {
return BI.Models.getModel("dec.model.intelligence.cluster.file.s3", {
value: this.options.value
});
},
watch: {},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
tgap: 15,
items: [
{
type: "dec.label.editor.item",
textWidth: LABEL_WIDTH,
editorWidth: EDITOR_WIDTH,
watermark: BI.i18nText("Plugin-S3_Input"),
text: BI.i18nText("Plugin-S3_End_Point"),
value: this.model.endPoint,
ref: function (_ref) {
self.endPointRow = _ref;
},
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.store.setEndPoint(this.getValue());
}
}]
}, {
type: "dec.label.editor.item",
textWidth: LABEL_WIDTH,
editorWidth: EDITOR_WIDTH,
watermark: BI.i18nText("Plugin-S3_Input"),
text: BI.i18nText("Plugin-S3_Region"),
value: this.model.endPoint,
ref: function (_ref) {
self.regionRow = _ref;
},
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.store.setRegion(this.getValue());
}
}]
}, {
type: "dec.label.editor.item",
textWidth: LABEL_WIDTH,
editorWidth: EDITOR_WIDTH,
watermark: BI.i18nText("Plugin-S3_Input"),
text: BI.i18nText("Plugin-S3_Access_Key_Id"),
value: this.model.accessKeyId,
ref: function (_ref) {
self.portRow = _ref;
},
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.store.setAccessKeyId(this.getValue());
}
}]
},
{
type: "dec.label.editor.item",
textWidth: LABEL_WIDTH,
editorWidth: EDITOR_WIDTH,
watermark: BI.i18nText("Plugin-S3_Access_Key_Secret"),
text: BI.i18nText("Plugin-S3_Access_Key_Secret"),
value: "******",
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.store.setAccessKeySecret(this.getValue());
}
}]
},
{
type: "dec.label.editor.item",
textWidth: LABEL_WIDTH,
editorWidth: EDITOR_WIDTH,
watermark: BI.i18nText("Plugin-S3_Bucket"),
text: BI.i18nText("Plugin-S3_Bucket"),
value: this.model.bucket,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.store.setBucket(this.getValue());
}
}]
}]
};
},
getValue: function () {
return {
endPoint: this.model.endPoint,
region: this.model.region,
accessKeyId: this.model.accessKeyId,
accessKeySecret: this.model.accessKeySecret,
bucket: this.model.bucket
};
},
});
BI.shortcut("dec.intelligence.cluster.file.s3", S3);
})();
!(function () {
var Model = BI.inherit(Fix.Model, {
state: function () {
var val = this.options.value;
return {
endPoint: val.endPoint,
region: val.region,
accessKeyId: val.accessKeyId,
accessKeySecret: val.accessKeySecret,
bucket: val.bucket
};
},
computed: {
encodingArray: function () {
return BI.map(DecCst.EncodeConstants.ENCODING_ARRAY, function (i, v) {
return {
value: v
};
});
}
},
actions: {
setEndPoint: function (v) {
this.model.endPoint = v;
},
setRegion: function (v) {
this.model.region = v;
},
setAccessKeyId: function (v) {
this.model.accessKeyId = v;
},
setAccessKeySecret: function (v) {
this.model.accessKeySecret = v;
},
setBucket: function (v) {
this.model.bucket = v;
}
}
});
BI.model("dec.model.intelligence.cluster.file.s3", Model);
})();