Merge branch 'testing-common-ssh'

This commit is contained in:
Michael Jumper
2015-08-13 14:16:21 -07:00
7 changed files with 60 additions and 13 deletions

View File

@@ -586,6 +586,16 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
return !!$scope.filesystemMenuContents && $scope.menu.shown;
};
// Automatically refresh display when filesystem menu is shown
$scope.$watch('isFilesystemMenuShown()', function refreshFilesystem() {
// Refresh filesystem, if defined
var filesystem = $scope.filesystemMenuContents;
if (filesystem)
ManagedFilesystem.refresh(filesystem, filesystem.currentDirectory);
});
/**
* Returns the full path to the given file as an ordered array of parent
* directories.

View File

@@ -142,22 +142,48 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser(
// Create from internal template
var element = angular.element($interpolate(fileTemplate)(file));
// Double-clicking on unknown file types will do nothing
var fileAction = function doNothing() {};
// Change current directory when directories are clicked
if ($scope.isDirectory(file)) {
element.addClass('directory');
element.on('click', function changeDirectory() {
fileAction = function changeDirectory() {
$scope.changeDirectory(file);
});
};
}
// Initiate downloads when normal files are clicked
else if ($scope.isNormalFile(file)) {
element.addClass('normal-file');
element.on('click', function downloadFile() {
fileAction = function downloadFile() {
$scope.downloadFile(file);
});
};
}
// Mark file as focused upon click
element.on('click', function handleFileClick() {
// Fire file-specific action if already focused
if (element.hasClass('focused')) {
fileAction();
element.removeClass('focused');
}
// Otherwise mark as focused
else {
element.parent().children().removeClass('focused');
element.addClass('focused');
}
});
// Prevent text selection during navigation
element.on('selectstart', function avoidSelect(e) {
e.preventDefault();
e.stopPropagation();
});
return element;
};
@@ -222,6 +248,11 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser(
}); // end retrieve file template
// Refresh file browser when any upload completes
$scope.$on('guacUploadComplete', function uploadComplete(event, filename) {
ManagedFilesystem.refresh($scope.filesystem, $scope.filesystem.currentDirectory);
});
}]
};

View File

@@ -29,6 +29,12 @@
.file-browser .list-item .caption {
white-space: nowrap;
border: 1px solid transparent;
}
.file-browser .list-item.focused .caption {
border: 1px dotted rgba(0, 0, 0, 0.5);
background: rgba(204, 221, 170, 0.5);
}
/* Directory / file icons */

View File

@@ -25,6 +25,7 @@
position: absolute;
right: 0;
bottom: 0;
z-index: 20;
font-size: 0.8em;
padding: 0.5em;
@@ -35,6 +36,6 @@
}
#file-transfer-dialog .transfer-manager {
border: 1px solid rgba(0, 0, 0, 0.125);
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.125);
border: 1px solid rgba(0, 0, 0, 0.5);
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);
}

View File

@@ -21,13 +21,6 @@
THE SOFTWARE.
-->
<!-- Parent directory -->
<div class="list-item directory previous" ng-show="filesystem.currentDirectory.parent">
<div class="caption" ng-click="changeDirectory(filesystem.currentDirectory.parent)">
<div class="icon"></div>..
</div>
</div>
<!-- Current directory contents -->
<div class="current-directory-contents"></div>

View File

@@ -138,6 +138,9 @@ angular.module('client').factory('ManagedFileDownload', ['$rootScope', '$injecto
ManagedFileTransferState.setStreamState(managedFileDownload.transferState,
ManagedFileTransferState.StreamState.CLOSED);
// Notify of upload completion
$rootScope.$broadcast('guacDownloadComplete', filename);
});
};

View File

@@ -211,6 +211,9 @@ angular.module('client').factory('ManagedFileUpload', ['$rootScope', '$injector'
ManagedFileTransferState.setStreamState(managedFileUpload.transferState,
ManagedFileTransferState.StreamState.CLOSED);
// Notify of upload completion
$rootScope.$broadcast('guacUploadComplete', file.name);
}
// Otherwise, update progress