You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vs...@apache.org on 2017/06/15 11:07:25 UTC
ambari git commit: AMBARI-21153.Hdfs directory viewer should be
changed from tree view to list view.(Venkata Sairam)
Repository: ambari
Updated Branches:
refs/heads/trunk d06fba350 -> a06b6e1d2
AMBARI-21153.Hdfs directory viewer should be changed from tree view to list view.(Venkata Sairam)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a06b6e1d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a06b6e1d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a06b6e1d
Branch: refs/heads/trunk
Commit: a06b6e1d287ca7ed5e63bf74f2c955aa2ec1dbc9
Parents: d06fba3
Author: Venkata Sairam <ve...@gmail.com>
Authored: Thu Jun 15 16:36:21 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Thu Jun 15 16:36:34 2017 +0530
----------------------------------------------------------------------
.../addon/components/directory-viewer.js | 324 +++++++++++++------
.../hdfs-directory-viewer/addon/styles/app.css | 190 +++++++++++
.../templates/components/directory-viewer.hbs | 145 +++++++++
.../addon/utils/viewer-config.js | 4 +
.../ui/hdfs-directory-viewer/bower.json | 1 -
.../resources/ui/hdfs-directory-viewer/index.js | 3 -
.../ui/hdfs-directory-viewer/package.json | 5 +-
7 files changed, 562 insertions(+), 110 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b6e1d/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/components/directory-viewer.js
----------------------------------------------------------------------
diff --git a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/components/directory-viewer.js b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/components/directory-viewer.js
index 991d122..2f2b547 100644
--- a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/components/directory-viewer.js
+++ b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/components/directory-viewer.js
@@ -21,27 +21,81 @@ import layout from '../templates/components/directory-viewer';
export default Ember.Component.extend({
layout,
+ counter: 0,
config: Ember.Object.create({}),
classNames: ['directory-viewer'],
startPath: '/',
- treeData: Ember.A(),
+ folderName:'',
+ isDirectory: true,
+ isFile: true,
+ fileBrowserHeight: '850',
+ fileBrowserWidth: '650',
+ maxBreadCrumbsCount: 3,
+ elipsisLength: 8,
+ isFolderCreationSuccess: null,
+ isFolderCreationFailure: null,
+ isFolderCreationprogress:false,
+ // homeDirectory: '/app-logs/cstm-hdfs/logs',
+ fileSystem: Ember.A(),
currentPath: Ember.computed.oneWay('startPath'),
- currentQueryParam: Ember.computed('currentPath', function() {
+ currentPathArray: [{'path':'/'}],
+ breadCrumbs: {},
+ isCreateFolder : false,
+ folderAccessError: {},
+ createFolderError: {},
+ filteredFileSytemInfo: Ember.computed('fileSystem', 'isDirectory', 'isFile', function() {
+ return this.get('fileSystem').filter( (record) => {
+ if(record.traverse) {
+ return true;
+ }
+ if(this.get('isDirectory') && this.get('isFile')) {
+ return record.isDirectory || !record.isDirectory;
+ }
+ if(this.get('isDirectory')) {
+ return record.isDirectory;
+ }
+ if(this.get('isFile')) {
+ return !record.isDirectory;
+ }
+ return;
+ });
+ }),
+ currentQueryParam: Ember.computed('currentPath', 'homeDirectory', function() {
+ if(this.get('counter') === 1 && this.get('homeDirectory')){
+ this.set('currentPath', this.get('homeDirectory'));
+ }
return Ember.$.param({path: this.get('currentPath')});
}),
-
+ createFolderQueryParam: Ember.computed('currentPath', 'homeDirectory', 'folderName', function() {
+ return {path: this.get('currentPath')+"/"+this.get('folderName')};
+ }),
+ isDataLoading: true,
startFetch: Ember.on('didInitAttrs', function() {
+ if(this.get('width')) {
+ this.set('fileBrowserWidth', this.get('width'));
+ }
+ if(this.get('height')) {
+ this.set('fileBrowserHeight', this.get('height'));
+ }
this.fetchData();
}),
-
-
+ setFileBroswerHeightAndWidth: Ember.on('didInsertElement', function() {
+ Ember.$('.top-header, #file-view-unix').css('width', this.get('fileBrowserWidth'));
+ }),
fetchData: function() {
+ this.incrementProperty('counter');
+ this.startFileSystemFetchProgress();
+ this.set('folderAccessError', {});
this.listPath(this.get('currentQueryParam')).then(
(response) => {
let list = this.filterDirectoriesIfRequired(response.files);
- this.modifyTreeViewData(list);
+ this.stopFileSystemFetchProgress();
+ this.modifyFileSystemData(list);
}, (error) => {
+ this.set('folderAccessError', error.responseJSON);
this.sendAction('errorAction', error);
+ this.set('errorMsg', 'Error while accessing.Please try again.');
+ this.stopFileSystemFetchProgress();
}
);
},
@@ -57,7 +111,29 @@ export default Ember.Component.extend({
headers: headers
});
},
-
+ createFolder() {
+ let deferred = Ember.RSVP.defer();
+ let config = this.get('config');
+ let listUrl = config.createDirectoryUrl();
+ let headers = config.getHeaders();
+ headers = this.setHeadersForMkdir(headers);
+ Ember.$.ajax(listUrl, {
+ headers: headers,
+ method:'PUT',
+ data:JSON.stringify(this.get('createFolderQueryParam'))
+ }).done(function(data){
+ deferred.resolve(data);
+ }).fail(function(data){
+ deferred.reject(data);
+ });
+ return deferred.promise;
+ },
+ setHeadersForMkdir(headers) {
+ headers['Accept'] = 'application/json';
+ headers.dataType = 'json';
+ headers['Content-Type'] = 'application/json; charset=UTF-8';
+ return headers;
+ },
filterDirectoriesIfRequired: function(files) {
let showOnlyDirectories = this.get('config.showOnlyDirectories');
return files.filter((entry) => {
@@ -65,7 +141,7 @@ export default Ember.Component.extend({
});
},
- modifyTreeViewData: function(response) {
+ modifyFileSystemData: function(response) {
let paths = response.map((entry) => {
let isDirectory = entry.isDirectory;
let icon = isDirectory ? this.get('config.folderIcon') : this.get('config.fileIcon');
@@ -74,122 +150,160 @@ export default Ember.Component.extend({
pathSegment: this.getNameForPath(entry.path),
isDirectory: isDirectory,
icon: icon,
- text: this.getNameForPath(entry.path)
+ permission: entry.permission,
+ text: this.getNameForPath(entry.path),
+ selectedClass: ''
};
if(isDirectory) {
data.nodes = Ember.A();
}
return data;
});
-
- var currentPath = this.get('currentPath');
- var newTreeData = Ember.copy(this.get('treeData'), true);
- if(currentPath === '/') {
- newTreeData = paths;
- } else {
- this.insertPathToTreeData(newTreeData, paths, currentPath.substring(1));
- }
-
- this.set('treeData', newTreeData);
- this.send('refreshTreeView');
+ this.setCurrentPathAsList();
+ paths = this.insertRootAsFirstPath(paths, this.get('currentPath'));
+ this.setBreadCrumbsAndListMenu();
+ this.set('fileSystem', paths);
+ this.set('errorMsg', null);
+ this.stopFileSystemFetchProgress();
},
-
- insertPathToTreeData(treeData, paths, pathSegment) {
- let firstPathSegment;
- if (pathSegment.indexOf('/') !== -1) {
- firstPathSegment = pathSegment.substring(0, pathSegment.indexOf('/'));
- } else {
- firstPathSegment = pathSegment;
+ insertRootAsFirstPath(paths, currentPath) {
+ if(currentPath !== '/') {
+ paths.unshift({traverse:true, path: this.get('currentPathArray')[this.get('currentPathArray').length-2 >=0 ?this.get('currentPathArray').length-2:this.get('currentPathArray').length-1].path});
}
-
- if(treeData.length === 0) {
- treeData.pushObjects(paths);
+ return paths;
+ },
+ setBreadCrumbsAndListMenu() {
+ let currentPathArray = this.get('currentPathArray');
+ if(currentPathArray.length > this.get('maxBreadCrumbsCount')){
+ this.set("breadCrumbs", {'dropDownMenu': currentPathArray.splice(0, currentPathArray.length - this.get('maxBreadCrumbsCount')), 'breadCrumbsMenu': currentPathArray.splice(0, currentPathArray.length)});
} else {
- treeData.forEach((entry) => {
- entry.state = {};
- if (entry.pathSegment === firstPathSegment) {
- entry.state.expanded = true;
- if(entry.nodes.length === 0) {
- paths.forEach((pathEntry) => {
- entry.nodes.push(pathEntry);
- });
- } else {
- this.insertPathToTreeData(entry.nodes, paths, pathSegment.substring(pathSegment.indexOf('/') + 1));
- }
- } else {
- this.collapseAll(entry);
- }
- });
+ this.set("breadCrumbs", {'breadCrumbsMenu': currentPathArray});
}
},
-
- collapseAll: function(node) {
- if (Ember.isNone(node.state)) {
- node.state = {};
- }
- node.state.expanded = false;
- if(!Ember.isNone(node.nodes)) {
- node.nodes.forEach((entry) => {
- this.collapseAll(entry);
- });
+ shortenName(name) {
+ return name.length > this.get('elipsisLength') ? name.substring(0, this.get('elipsisLength'))+'...':name;
+ },
+ setCurrentPathAsList() {
+ let currentPath = this.get('currentPath'), relPath = "", currentPathArr = currentPath.split('/');
+ if(currentPath === "/") {
+ currentPathArr = [""];
}
+ this.set('currentPathArray', []);
+ currentPathArr.forEach(function(item, i) {
+ if(i !== 1) {
+ relPath = relPath + "/"+ item;
+ } else if(i === 1){
+ relPath = relPath + currentPathArr[i];
+ }
+ console.log(relPath+" is relPath");
+ if(i === currentPathArr.length-1){
+ if(0 === currentPathArr.length-1) {
+ this.get('currentPathArray').push({'path':relPath, 'fullFileName' : item, 'name':item?this.shortenName(item):'root', isCurrentFolder: true, isRoot:true});
+ } else{
+ this.get('currentPathArray').push({'path':relPath, 'fullFileName' : item, 'name':item?this.shortenName(item):'root', isCurrentFolder: true});
+ }
+ } else if(i === 0){
+ this.get('currentPathArray').push({'path':relPath, 'fullFileName' : item, 'name':item?this.shortenName(item):'root', isRoot:true});
+ } else {
+ this.get('currentPathArray').push({'path':relPath ,'fullFileName' : item, 'name':item?this.shortenName(item):'root'});
+ }
+ }.bind(this));
},
-
getNameForPath: function(path) {
return path.substring(path.lastIndexOf("/") + 1);
},
-
- collapseAllExceptPath: function(pathSegment) {
- let collapseAll = function(nodes, pathSegment) {
- var firstPathSegment;
- if (pathSegment.indexOf('/') !== -1) {
- firstPathSegment = pathSegment.substring(0, pathSegment.indexOf('/'));
- } else {
- firstPathSegment = pathSegment;
- }
-
- nodes.forEach((entry) => {
- if (Ember.isNone(entry.state)) {
- entry.state = {};
- }
- if(firstPathSegment !== entry.pathSegment) {
- entry.state.expanded = false;
- } else {
- entry.state.expanded = true;
- collapseAll(entry.nodes, pathSegment.substring(pathSegment.indexOf('/') + 1));
- }
- });
- };
- var newTreeData = this.get('treeData');
- collapseAll(newTreeData, pathSegment);
- this.set('treeData', newTreeData);
- this.send('refreshTreeView');
+ stopFolderCreationProgress() {
+ this.set('isFolderCreationprogress', false);
+ },
+ startFolderCreationProgress() {
+ this.set('isFolderCreationprogress', true);
+ },
+ stopFileSystemFetchProgress() {
+ this.set('isDataLoading', false);
+ },
+ startFileSystemFetchProgress() {
+ this.set('isDataLoading', true);
+ },
+ resetFolderCreationMenuValidation() {
+ this.set('isFolderCreationSuccess', false);
+ this.set('isFolderCreationFailure', false);
+ },
+ folderCreationSuccess() {
+ this.set('createFolderError', {});
+ this.set('isFolderCreationSuccess', true);
+ this.set('isFolderCreationFailure', false);
+ },
+ folderCreationFailure() {
+ this.set('isFolderCreationSuccess', false);
+ this.set('isFolderCreationFailure', true);
+ },
+ resetGoToPathMenuValidation() {
+ this.set('isGoToFolderSuccess', false);
+ this.set('isGoToFolderFailure', false);
+ },
+ hideGoToPathMenu() {
+ this.set('isGoToFolder', false);
+ },
+ hideCreateFolderMenu() {
+ this.set('isCreateFolder', false);
},
-
actions: {
- refreshTreeView() {
- Ember.run.later(() => {
- this.$().treeview({
- data: this.get('treeData'),
- expandIcon: this.get('config.expandIcon'),
- collapseIcon: this.get('config.collapseIcon'),
- //emptyIcon: "fa",
- showBorder: false,
- onNodeSelected: (event, data) => {
- this.set('currentPath', data.path);
- this.sendAction('pathSelectAction', {path: data.path, isDirectory: data.isDirectory});
- },
- onNodeExpanded: (event, data) => {
- this.set('currentPath', data.path);
- if (!Ember.isNone(data.nodes) && data.nodes.length === 0) {
- var node = this.$().treeview('getNode', data.nodeId);
- node.icon = "fa fa-refresh fa-spin";
- this.fetchData();
- } else {
- this.collapseAllExceptPath(data.path.substring(1));
- }
+ toggleCreateFolderMenu() {
+ if(this.get('isGoToFolder')) {
+ this.hideGoToPathMenu();
+ }
+ this.toggleProperty('isCreateFolder');
+ this.resetFolderCreationMenuValidation();
+ },
+ toggleGoToFolderMenu() {
+ if(this.get('isCreateFolder')) {
+ this.hideCreateFolderMenu();
+ }
+ this.toggleProperty('isGoToFolder');
+ this.resetGoToPathMenuValidation();
+ },
+ createFolder() {
+ if(Ember.isBlank(this.get('currentPath'))) {
+ return true;
+ }
+ this.startFolderCreationProgress();
+ this.set('createFolderError', {});
+ this.createFolder().then(function() {
+ this.send('drillToPath', this.get('currentPath'));
+ this.folderCreationSuccess();
+ this.stopFolderCreationProgress();
+ }.bind(this)).catch(function(e) {
+ this.set('createFolderError', e.responseJSON);
+ this.folderCreationFailure();
+ this.stopFolderCreationProgress();
+ console.error(e);
+ }.bind(this));
+ },
+ goToFolder() {
+ if(Ember.isBlank(this.get('currentPath'))) {
+ return true;
+ }
+ this.send('drillToPath', this.get('currentPath'));
+ },
+ drillToPath(path, fileItem) {
+ if(fileItem) {
+ this.sendAction('pathSelectAction', fileItem);
+ }
+ if(path.indexOf('/') !== 0){
+ this.set('errorMsg', 'Invalid path.');
+ return;
+ }
+ this.set('currentPath', path);
+ this.fetchData();
+ },
+ selectRow(index, fileItem) {
+ this.sendAction('pathSelectAction', fileItem);
+ this.get('fileSystem').forEach(function(item, i) {
+ if(index === i && !item.traverse){
+ Ember.set(item, "selectedClass", "row-selected");
+ } else {
+ Ember.set(item, "selectedClass", "");
}
- });
});
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b6e1d/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/styles/app.css
----------------------------------------------------------------------
diff --git a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/styles/app.css b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/styles/app.css
new file mode 100644
index 0000000..828a827
--- /dev/null
+++ b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/styles/app.css
@@ -0,0 +1,190 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.directory-viewer{
+ width: 500px;
+}
+.directory-viewer-wrap {
+ width: 600px;
+ height: 500px;
+ border: 1px solid #e2e2e2;
+}
+
+.directory-viewer .container-wrap {
+ position:relative;
+ height:400px;
+}
+.directory-viewer .top-header {
+ position: relative;
+ padding-left: 0px;
+ padding-right: 0px;
+ padding-bottom: 5px;
+ width: 500px;
+ border-bottom:1px solid #e2e2e2;
+}
+.directory-viewer .row-selected {
+ background-color:#c7ddef!important
+}
+.directory-viewer .file-row {
+ padding-top: 10px;
+ padding-bottom: 10px;
+ border-bottom: 1px solid #e2e2e2;
+}
+.directory-viewer .dropdown-menu>li>a {
+ display: block;
+ padding: 3px 20px;
+ clear: both;
+ font-weight: 400;
+ line-height: 1.42857143;
+ color: #337ab7;
+ white-space: nowrap;
+}
+.directory-viewer .file-row:hover {
+ background-color: #f5f5f5;
+}
+.directory-viewer .mod-icon {
+ font-size:1.5em
+}
+.directory-viewer .elipsisClass{
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -o-text-overflow: ellipsis;
+ white-space: nowrap;
+ width: 50%;
+}
+.directory-viewer .elipsis-link{
+ overflow: initial;
+ text-overflow: ellipsis;
+ -o-text-overflow: ellipsis;
+ white-space: nowrap;
+ width: 50px;
+}
+.directory-viewer .pointer {
+ cursor: pointer;
+}
+.directory-viewer .breadcrumbs-label {
+ display: inline-block;
+ padding: 8px;
+}
+.directory-viewer #file-view-unix {
+ width:500px;
+ position:relative;
+ overflow:auto;
+}
+.directory-viewer .padding-left-10px {
+ padding-left: 10px;
+}
+.directory-viewer .padding-right-10px {
+ padding-right: 10px;
+}
+.directory-viewer .home-icon {
+ top:3px;
+ font-size:1.5em;
+ position:relative;
+}
+.directory-viewer .breadcrumb {
+ background-color:white;
+ margin-bottom:0px;
+ padding: 0px;
+}
+.directory-viewer .container-fluid {
+ position:relative;
+ height:400px;
+}
+.directory-viewer .folder-name {
+ width:100% !important;
+}
+.directory-viewer .add-folder {
+ padding: 10px;
+ height: auto;
+ padding-top:0px;
+ padding-left:10px;
+ padding-bottom:4px;
+ margin-top:3px;
+ left:16px;
+}
+.directory-viewer .go-to-folder {
+ height: auto;
+ padding-right: 0px;
+ padding-left: 10px;
+ padding-bottom: 4px;
+ margin-top:3px;
+ left: 8px;
+}
+.directory-viewer .btn-action {
+ padding: 5px 10px;
+}
+.directory-viewer #folderPath, .directory-viewer #folderName {
+ height: 32px;
+ top: 2px;
+ position: relative;
+}
+.directory-viewer .margin-right-5 {
+ margin-right: 5px !important;
+}
+.directory-viewer a, .directory-viewer .file-system-count {
+ color: #337ab7;
+}
+.directory-viewer .top-header button.btn{
+ color: #fff !important;
+}
+
+.directory-viewer .form-group{
+ padding-left:0px;
+ width:90%;
+}
+
+.directory-viewer button{
+ position:relative;
+ top:2px;
+ left:5px;
+}
+
+.directory-viewer .file-creation-status {
+ margin-top:10px;
+ margin-bottom:0px;
+}
+
+.directory-viewer .file-creation-success {
+ color:green;
+}
+
+.directory-viewer .file-creation-failure {
+ color:red;
+}
+
+.directory-viewer .inline {
+ display:inline-block;
+}
+
+.directory-viewer .file-viewer-settings {
+ position:relative;
+ top:5px;
+}
+
+.directory-viewer .no-padding {
+ padding:0px;
+}
+
+.directory-viewer .file-system-status {
+ margin-top:10px;
+ padding-left:20px;
+}
+
+.directory-viewer .file-system-count {
+ text-align:center;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b6e1d/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/templates/components/directory-viewer.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/templates/components/directory-viewer.hbs b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/templates/components/directory-viewer.hbs
index 75339c5..a4a66ac 100644
--- a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/templates/components/directory-viewer.hbs
+++ b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/templates/components/directory-viewer.hbs
@@ -15,4 +15,149 @@
* See the License for the specific language governing permissions and
* limitations under the License.
}}
+<div class="pull-left col-sm-6 top-header">
+{{#if isGoToFolder}}
+ <div class="container-fluid go-to-folder">
+ <div class="form-inline">
+ <div class="form-group">
+ {{input class="form-control col-sm-4 folder-name" id="folderPath" placeholder="Enter folder path" name="folderPath" value=currentPath}}
+ </div>
+ <button type="button" class="btn btn-sm btn-default btn-primary btn-action" {{action "goToFolder"}}><i aria-hidden="true" class="fa fa-arrow-circle-right"></i></button>
+ <button type="button" class="btn btn-sm btn-default btn-danger btn-action" {{action "toggleGoToFolderMenu"}}>
+ <i class="fa fa-times" aria-hidden="true"></i>
+ </button>
+ </div>
+ </div>
+{{else if isCreateFolder}}
+ <div class="container-fluid add-folder">
+ <div class="form-inline">
+ <div class="form-group">
+ {{input class="form-control col-sm-4 folder-name" id="folderName" placeholder="Enter folder name" name="folderName" value=currentPath}}
+ </div>
+ <button type="button" class="btn btn-sm btn-default btn-primary" {{action "createFolder"}}><i class="fa fa-plus-circle" aria-hidden="true"></i></button>
+ <button type="button" class="btn btn-sm btn-default btn-danger" {{action "toggleCreateFolderMenu"}}><i class="fa fa-times" aria-hidden="true"></i></button>
+ {{#if isFolderCreationSuccess}}
+ <div class="file-creation-status">
+ <strong class="file-creation-success">Folder have been created.</strong>
+ </div>
+ {{/if}}
+ {{#if isFolderCreationFailure}}
+ <div class="file-creation-status">
+ <strong class="file-creation-failure">Folder creation failed.</strong>
+ <div class="file-creation-failure">
+ {{createFolderError.message}}
+ </div>
+ </div>
+ {{/if}}
+ {{#if isFolderCreationprogress}}
+ <div class="loading-data" class="file-creation-status">
+ <i class="fa fa-spinner fa-pulse fa-1x fa-fw"></i>Creating the folder...
+ </div>
+ {{/if}}
+ </div>
+ </div>
+{{else}}
+
+ {{#if breadCrumbs.dropDownMenu}}
+ <li class="inline">
+ <div class="dropdown">
+ <a class="dropdown-toggle" d="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
+ <span class="fa-stack">
+ <i class="fa fa-folder-o fa-stack-1x mod-icon" aria-hidden="true"></i>
+ <i class="fa fa-caret-down fa-stack-1x" aria-hidden="true"></i>
+ </span>
+ </a>
+ <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
+ {{#each breadCrumbs.dropDownMenu as |crumb index|}}
+ <li><a {{action "drillToPath" crumb.path}}> <div title={{crumb.fullFileName}} class="elipsis-link pointer inline">{{crumb.name}}</div></a></li>
+ {{/each}}
+ </ul>
+ </div>
+ </li> /
+ {{/if}}
+ <div class="bs-example breadcrumbs-label">
+ <ul class="breadcrumb">
+ <li>
+ {{#each breadCrumbs.breadCrumbsMenu as |pathItem|}}
+ {{#if pathItem.isRoot}}
+ <a {{action "drillToPath" pathItem.path}}><i class="fa fa-folder-o home-icon" aria-hidden="true"></i></a> >
+ {{else if pathItem.isCurrentFolder}}
+ <span title={{pathItem.fullFileName}}>{{pathItem.name}}</span>
+ {{else}}
+ <a {{action "drillToPath" pathItem.path}}><div class="pointer inline" title={{pathItem.fullFileName}}>{{pathItem.name}}</div></a> >
+ {{/if}}
+ {{/each}}
+ </li>
+ </ul>
+ </div>
+
+ <div class="pull-right file-viewer-settings">
+ <li class="breadcrumbs-label no-padding">
+ <div class="dropdown">
+ <a class="dropdown-toggle" d="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
+ <span class="btn btn-sm btn-default">
+ <i class="fa fa-cog" aria-hidden="true"></i>
+ <i class="fa fa-caret-down" aria-hidden="true"></i>
+ </span>
+ </a>
+ <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
+ <li><a>{{input type="checkbox" class="margin-right-5" name="dir" checked=isDirectory}}Directories</a></li>
+ <li><a>{{input type="checkbox" class="margin-right-5" name="file" checked=isFile}}Files</a></li>
+ </ul>
+ </div>
+ </li>
+ <span {{ action "drillToPath" currentPath}} class="btn btn-sm btn-default">
+ <i class="fa fa-refresh" aria-hidden="true"></i>
+ </span>
+ <button type="button" class="btn btn-sm btn-primary" {{action "toggleCreateFolderMenu"}}>
+ <i class="fa fa-plus-circle" aria-hidden="true"></i>{{!-- New Folder --}}
+ </button>
+ <button type="button" class="btn btn-sm btn-primary" {{action "toggleGoToFolderMenu"}}>
+ <i aria-hidden="true" class="fa fa-arrow-circle-o-right"></i> {{!-- Go To --}}
+ </button>
+ </div>
+{{/if}}
+</div>
+<div id="file-view-unix">
+ {{#if isDataLoading}}
+ <div class="loading-data file-system-status">
+ <i class="fa fa-spinner fa-pulse fa-1x fa-fw"></i>Fetching data...
+ </div>
+ {{else if errorMsg}}
+ <div class="file-system-status">
+ <strong class="file-creation-failure">{{errorMsg}}</strong>
+ <div class="file-creation-failure">
+ {{folderAccessError.message}}
+ </div>
+ </div>
+ {{else}}
+ {{#if filteredFileSytemInfo}}
+ <div class="container-fluid">
+ {{#ember-collection items=filteredFileSytemInfo cell-layout=(fixed-grid-layout fileBrowserWidth 41) as |item index|}}
+ <div class="row file-row {{item.selectedClass}}" {{action 'selectRow' index item}}>
+ {{#if item.traverse}}
+ <div class="col-sm-8">
+ <a class="padding-left-10px pointer" {{action "drillToPath" item.path item}}>
+ <i class="fa fa-reply padding-right-10px" aria-hidden="true"></i>
+ </a>
+ </div>
+ {{else if item.isDirectory }}
+ <div class="col-sm-6 elipsisClass">
+ <a title={{item.text}} class="padding-left-10px pointer" {{action "drillToPath" item.path item}}>
+ <i class="fa fa-folder-o padding-right-10px" aria-hidden="true"></i>{{ item.text }}
+ </a>
+ </div>
+ {{else}}
+ <div class="col-sm-6 elipsisClass" title={{item.text}}>
+ <i class="fa fa-file padding-left-10px padding-right-10px" aria-hidden="true"></i>{{ item.text }}
+ </div>
+ {{/if}}
+ </div>
+ {{/ember-collection}}
+ </div>
+ {{else}}
+ No files or folders.
+ {{/if}}
+ {{/if}}
+</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b6e1d/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/utils/viewer-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/utils/viewer-config.js b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/utils/viewer-config.js
index 64773c6..4f3fb5e 100644
--- a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/utils/viewer-config.js
+++ b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/addon/utils/viewer-config.js
@@ -54,6 +54,10 @@ export default Ember.Object.extend({
*/
listDirectoryUrl(pathParams) {
return `/listdir?${pathParams}`;
+ },
+
+ createDirectoryUrl() {
+ return '/mkdir';
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b6e1d/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/bower.json
----------------------------------------------------------------------
diff --git a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/bower.json b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/bower.json
index f016904..206b8bd 100644
--- a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/bower.json
+++ b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/bower.json
@@ -10,7 +10,6 @@
"loader.js": "^3.5.0",
"qunit": "~1.20.0",
"bootstrap": "~3.3.6",
- "bootstrap-treeview": "~1.2.0",
"font-awesome": "~4.5.0"
},
"resolutions": {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b6e1d/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/index.js b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/index.js
index dc074d7..762c281 100644
--- a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/index.js
+++ b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/index.js
@@ -23,10 +23,7 @@ module.exports = {
name: 'hdfs-directory-viewer',
included: function(app) {
this._super.included(app);
-
app.import(app.bowerDirectory + '/bootstrap/dist/css/bootstrap.css');
app.import(app.bowerDirectory + '/bootstrap/dist/js/bootstrap.js');
- app.import(app.bowerDirectory + '/bootstrap-treeview/src/js/bootstrap-treeview.js');
- app.import(app.bowerDirectory + '/bootstrap-treeview/dist/bootstrap-treeview.min.css');
}
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b6e1d/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/package.json
----------------------------------------------------------------------
diff --git a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/package.json b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/package.json
index 66a7b20..90e4357 100644
--- a/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/package.json
+++ b/contrib/views/commons/src/main/resources/ui/hdfs-directory-viewer/package.json
@@ -36,7 +36,10 @@
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-resolver": "^2.0.3",
- "ember-try": "~0.0.8"
+ "ember-try": "~0.0.8",
+ "ember-truth-helpers": "1.2.0",
+ "ember-collection": "git://github.com/emberjs/ember-collection.git#4dbe10b7498886e277fc21b28139924f908d1926"
+
},
"keywords": [
"ember-addon"