|
@@ -376,42 +376,55 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
|
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
ko.bindingHandlers.select2 = {
|
|
ko.bindingHandlers.select2 = {
|
|
|
- init: function(element, valueAccessor, allBindingsAccessor, vm) {
|
|
|
|
|
|
|
+ init: function (element, valueAccessor, allBindingsAccessor, vm) {
|
|
|
var options = ko.toJS(valueAccessor()) || {};
|
|
var options = ko.toJS(valueAccessor()) || {};
|
|
|
|
|
+
|
|
|
|
|
+ if (typeof valueAccessor().update != "undefined") {
|
|
|
|
|
+ if (options.type == "user" && viewModel.selectableHadoopUsers().indexOf(options.update) == -1) {
|
|
|
|
|
+ viewModel.availableHadoopUsers.push({
|
|
|
|
|
+ username: options.update
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ if (options.type == "group" && viewModel.selectableHadoopGroups().indexOf(options.update) == -1) {
|
|
|
|
|
+ viewModel.availableHadoopGroups.push({
|
|
|
|
|
+ name: options.update
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$(element)
|
|
$(element)
|
|
|
.select2(options)
|
|
.select2(options)
|
|
|
- .on("change", function(e){
|
|
|
|
|
- if (typeof e.val != "undefined" && typeof valueAccessor().update != "undefined"){
|
|
|
|
|
|
|
+ .on("change", function (e) {
|
|
|
|
|
+ if (typeof e.val != "undefined" && typeof valueAccessor().update != "undefined") {
|
|
|
valueAccessor().update(e.val);
|
|
valueAccessor().update(e.val);
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- .on("select2-open", function(){
|
|
|
|
|
- $(".select2-input").off("keyup").data("type", options.type).on("keyup", function(e) {
|
|
|
|
|
- if(e.keyCode === 13){
|
|
|
|
|
|
|
+ .on("select2-open", function () {
|
|
|
|
|
+ $(".select2-input").off("keyup").data("type", options.type).on("keyup", function (e) {
|
|
|
|
|
+ if (e.keyCode === 13) {
|
|
|
var _newVal = $(this).val();
|
|
var _newVal = $(this).val();
|
|
|
var _type = $(this).data("type");
|
|
var _type = $(this).data("type");
|
|
|
- if (_type == "user"){
|
|
|
|
|
|
|
+ if (_type == "user") {
|
|
|
viewModel.availableHadoopUsers.push({
|
|
viewModel.availableHadoopUsers.push({
|
|
|
username: _newVal
|
|
username: _newVal
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- if (_type == "group"){
|
|
|
|
|
|
|
+ if (_type == "group") {
|
|
|
viewModel.availableHadoopGroups.push({
|
|
viewModel.availableHadoopGroups.push({
|
|
|
name: _newVal
|
|
name: _newVal
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- $(element).select2("val", _newVal, true);
|
|
|
|
|
|
|
+ $(element).select2("val", _newVal, true);
|
|
|
$(element).select2("close");
|
|
$(element).select2("close");
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- update: function(element, valueAccessor, allBindingsAccessor, vm) {
|
|
|
|
|
- if (typeof valueAccessor().update != "undefined"){
|
|
|
|
|
|
|
+ update: function (element, valueAccessor, allBindingsAccessor, vm) {
|
|
|
|
|
+ if (typeof valueAccessor().update != "undefined") {
|
|
|
$(element).select2("val", valueAccessor().update());
|
|
$(element).select2("val", valueAccessor().update());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-};
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
var INITIAL = ${ initial | n,unicode };
|
|
var INITIAL = ${ initial | n,unicode };
|
|
|
var viewModel = new HdfsViewModel(INITIAL);
|
|
var viewModel = new HdfsViewModel(INITIAL);
|