|
@@ -33,7 +33,8 @@
|
|
|
showOnFocus: false,
|
|
showOnFocus: false,
|
|
|
skipKeydownEvents: false,
|
|
skipKeydownEvents: false,
|
|
|
skipScrollEvent: false,
|
|
skipScrollEvent: false,
|
|
|
- zIndex: 33000
|
|
|
|
|
|
|
+ zIndex: 33000,
|
|
|
|
|
+ isS3: false
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
function Plugin(element, options) {
|
|
function Plugin(element, options) {
|
|
@@ -212,6 +213,15 @@
|
|
|
var _currentFiles = [];
|
|
var _currentFiles = [];
|
|
|
|
|
|
|
|
function prepareAutocompletePath(path) {
|
|
function prepareAutocompletePath(path) {
|
|
|
|
|
+ if (_this.options.isS3){
|
|
|
|
|
+ if (path.indexOf('s3a://') === 0){
|
|
|
|
|
+ path = path.substr(6);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (path.indexOf('/') === 0){
|
|
|
|
|
+ path = path.substr(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ return path;
|
|
|
|
|
+ }
|
|
|
if (path.indexOf('/') == 0 || /^([a-zA-Z0-9]+):\/\//.test(path))
|
|
if (path.indexOf('/') == 0 || /^([a-zA-Z0-9]+):\/\//.test(path))
|
|
|
return path.substr(0, path.lastIndexOf("/") + 1);
|
|
return path.substr(0, path.lastIndexOf("/") + 1);
|
|
|
if (path.indexOf("/") > 0)
|
|
if (path.indexOf("/") > 0)
|
|
@@ -220,7 +230,10 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function showHdfsAutocomplete(callback) {
|
|
function showHdfsAutocomplete(callback) {
|
|
|
- autocompleteUrl = BASE_PATH + prepareAutocompletePath(_el.val());
|
|
|
|
|
|
|
+ if (_this.options.isS3 && BASE_PATH.indexOf('S3A://') == -1) {
|
|
|
|
|
+ BASE_PATH += 'S3A://';
|
|
|
|
|
+ }
|
|
|
|
|
+ var autocompleteUrl = BASE_PATH + prepareAutocompletePath(_el.val());
|
|
|
$.getJSON(autocompleteUrl + "?pagesize=1000&format=json", function (data) {
|
|
$.getJSON(autocompleteUrl + "?pagesize=1000&format=json", function (data) {
|
|
|
_currentFiles = [];
|
|
_currentFiles = [];
|
|
|
if (data.error == null) {
|
|
if (data.error == null) {
|
|
@@ -242,11 +255,21 @@
|
|
|
var item = $(this).text().trim();
|
|
var item = $(this).text().trim();
|
|
|
var path = autocompleteUrl.substring(BASE_PATH.length);
|
|
var path = autocompleteUrl.substring(BASE_PATH.length);
|
|
|
if (item == "..") { // one folder up
|
|
if (item == "..") { // one folder up
|
|
|
|
|
+ if (_this.options.isS3) {
|
|
|
|
|
+ path = path.substring(0, path.lastIndexOf("/"));
|
|
|
|
|
+ }
|
|
|
_el.val(path.substring(0, path.lastIndexOf("/")));
|
|
_el.val(path.substring(0, path.lastIndexOf("/")));
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
_el.val(path + (path.charAt(path.length - 1) == "/" ? "" : "/") + item);
|
|
_el.val(path + (path.charAt(path.length - 1) == "/" ? "" : "/") + item);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (_this.options.isS3 && _el.val().indexOf('s3a://') === -1) {
|
|
|
|
|
+ var val = _el.val();
|
|
|
|
|
+ if (val.indexOf('/') === 0){
|
|
|
|
|
+ val = val.substr(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ _el.val('s3a://' + val);
|
|
|
|
|
+ }
|
|
|
if ($(this).html().indexOf("folder") > -1) {
|
|
if ($(this).html().indexOf("folder") > -1) {
|
|
|
_el.val(_el.val() + "/");
|
|
_el.val(_el.val() + "/");
|
|
|
_this.options.onPathChange(_el.val());
|
|
_this.options.onPathChange(_el.val());
|
|
@@ -314,6 +337,9 @@
|
|
|
if (!$.data(this, 'plugin_' + pluginName)) {
|
|
if (!$.data(this, 'plugin_' + pluginName)) {
|
|
|
$.data(this, 'plugin_' + pluginName, new Plugin(this, options));
|
|
$.data(this, 'plugin_' + pluginName, new Plugin(this, options));
|
|
|
}
|
|
}
|
|
|
|
|
+ else {
|
|
|
|
|
+ $.data(this, 'plugin_' + pluginName).setOptions(options);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|