rinoux
6 years ago
11 changed files with 317 additions and 75 deletions
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 33 KiB |
@ -0,0 +1,18 @@
|
||||
package com.fr.plugin.hdfs.repository.decision; |
||||
|
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.browser.RequestClient; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
|
||||
/** |
||||
* Created by rinoux on 2018/11/26. |
||||
*/ |
||||
public class HDFSFileServerComponent extends Component { |
||||
public static HDFSFileServerComponent KEY = new HDFSFileServerComponent(); |
||||
|
||||
|
||||
@Override |
||||
public ScriptPath script(RequestClient req) { |
||||
return ScriptPath.build("com/fr/plugin/hdfs/repository/decision/js/bundle.js"); |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.plugin.hdfs.repository.decision; |
||||
|
||||
import com.fr.decision.fun.SystemOptionProvider; |
||||
import com.fr.decision.fun.impl.AbstractSystemOptionProvider; |
||||
import com.fr.decision.web.MainComponent; |
||||
import com.fr.stable.fun.mark.API; |
||||
import com.fr.web.struct.Atom; |
||||
|
||||
/** |
||||
* Created by rinoux on 2018/11/26. |
||||
*/ |
||||
@API(level = SystemOptionProvider.CURRENT_LEVEL) |
||||
public class HDFSFileServerOption extends AbstractSystemOptionProvider { |
||||
@Override |
||||
public String id() { |
||||
return "hdfs_file_server"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public int sortIndex() { |
||||
return 2; |
||||
} |
||||
|
||||
@Override |
||||
public Atom attach() { |
||||
return MainComponent.KEY; |
||||
} |
||||
|
||||
@Override |
||||
public Atom client() { |
||||
return HDFSFileServerComponent.KEY; |
||||
} |
||||
} |
@ -0,0 +1,179 @@
|
||||
BI.config("dec.constant.intelligence.cluster.file.server", function (items) { |
||||
items.push({ |
||||
value: "HDFS", // 地址栏显示的hash值
|
||||
id: "decision-intelligence-cluster-file-hdfs", // id
|
||||
text: BI.i18nText(""), // 文字
|
||||
cardType: "dec.intelligence.cluster.file.hdfs", |
||||
}); |
||||
return items; |
||||
}); |
||||
|
||||
|
||||
!(function () { |
||||
var LABEL_WIDTH = 116, EDITOR_WIDTH = 300; |
||||
var HDFS = BI.inherit(BI.Widget, { |
||||
|
||||
props: { |
||||
baseCls: "dec-cluster-ftp", |
||||
value: {} |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dec.model.intelligence.cluster.file.hdfs", { |
||||
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", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("Dec-Please_Input"), |
||||
text: BI.i18nText("Dec-Basic_Host"), |
||||
value: this.model.host, |
||||
ref: function (_ref) { |
||||
self.hostRow = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setHost(this.getValue()); |
||||
} |
||||
}] |
||||
}, { |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("Dec-Please_Input"), |
||||
text: BI.i18nText("Dec-Server_Port"), |
||||
value: this.model.port, |
||||
ref: function (_ref) { |
||||
self.portRow = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setPort(this.getValue()); |
||||
} |
||||
}] |
||||
}, |
||||
{ |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("终端用户"), |
||||
text: BI.i18nText("Principal"), |
||||
value: this.model.principal, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setPrincipal(this.getValue()); |
||||
} |
||||
}] |
||||
}, |
||||
{ |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("keyTab文件路径"), |
||||
text: BI.i18nText("keyTab"), |
||||
value: this.model.keyTab, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setKeyTab(this.getValue()); |
||||
} |
||||
}] |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return { |
||||
host: this.model.host, |
||||
port: BI.parseInt(this.model.port), |
||||
principal: this.model.principal, |
||||
keyTab: this.model.keyTab |
||||
}; |
||||
}, |
||||
|
||||
validation: function () { |
||||
var valid = true, host = this.model.host, port = this.model.port; |
||||
if (!(/^[a-zA-Z0-9._-]+(\.[a-zA-Z]{2,6})?$/.test(host))) { |
||||
this.hostRow.showError(BI.i18nText("Dec-Error_Format")); |
||||
valid = false; |
||||
} |
||||
if (BI.isEmpty(host)) { |
||||
this.hostRow.showError(BI.i18nText("Dec-Error_Null")); |
||||
valid = false; |
||||
} |
||||
if (!(/^[0-9]+$/.test(port))) { |
||||
this.portRow.showError(BI.i18nText("Dec-Error_Format")); |
||||
valid = false; |
||||
} |
||||
if (BI.isEmptyString(port)) { |
||||
this.portRow.showError(BI.i18nText("Dec-Error_Null")); |
||||
valid = false; |
||||
} |
||||
return valid; |
||||
} |
||||
}); |
||||
BI.shortcut("dec.intelligence.cluster.file.hdfs", HDFS); |
||||
})(); |
||||
|
||||
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
|
||||
state: function () { |
||||
var val = this.options.value; |
||||
return { |
||||
host: val.host, |
||||
port: val.port, |
||||
principal: val.principal, |
||||
keyTab: val.keyTab |
||||
}; |
||||
}, |
||||
|
||||
computed: { |
||||
encodingArray: function () { |
||||
return BI.map(DecCst.EncodeConstants.ENCODING_ARRAY, function (i, v) { |
||||
return { |
||||
value: v |
||||
}; |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
setHost: function (v) { |
||||
this.model.host = v; |
||||
}, |
||||
|
||||
setPort: function (v) { |
||||
this.model.port = v; |
||||
}, |
||||
|
||||
setPrincipal: function (v) { |
||||
this.model.principal = v; |
||||
}, |
||||
|
||||
setKeyTab: function (v) { |
||||
this.model.keyTab = v; |
||||
} |
||||
} |
||||
}); |
||||
BI.model("dec.model.intelligence.cluster.file.hdfs", Model); |
||||
})(); |
Loading…
Reference in new issue