Merge pull request #29 from xetorthio/drag_and_drop_uploads
Allow to drag & drop file uploads to instances
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var app = angular.module('DockerPlay', ['ngMaterial']);
|
||||
var app = angular.module('DockerPlay', ['ngMaterial', 'ngFileUpload']);
|
||||
|
||||
// Automatically redirects user to a new session when bypassing captcha.
|
||||
// Controller keeps code/logic separate from the HTML
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
app.controller('PlayController', ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$window', 'TerminalService', 'KeyboardShortcutService', 'InstanceService', 'SessionService', function($scope, $log, $http, $location, $timeout, $mdDialog, $window, TerminalService, KeyboardShortcutService, InstanceService, SessionService) {
|
||||
app.controller('PlayController', ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$window', 'TerminalService', 'KeyboardShortcutService', 'InstanceService', 'SessionService', 'Upload', function($scope, $log, $http, $location, $timeout, $mdDialog, $window, TerminalService, KeyboardShortcutService, InstanceService, SessionService, Upload) {
|
||||
$scope.sessionId = SessionService.getCurrentSessionId();
|
||||
$scope.instances = [];
|
||||
$scope.idx = {};
|
||||
@@ -32,6 +32,14 @@
|
||||
$scope.deleteInstanceBtnText = 'Delete';
|
||||
$scope.isInstanceBeingDeleted = false;
|
||||
|
||||
$scope.uploadFiles = function (files) {
|
||||
if (files && files.length) {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
Upload.upload({url: '/sessions/' + $scope.sessionId + '/instances/' + $scope.selectedInstance.name + '/uploads', data: {file: files[i]}, method: 'POST'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var selectedKeyboardShortcuts = KeyboardShortcutService.getCurrentShortcuts();
|
||||
|
||||
angular.element($window).bind('resize', function() {
|
||||
|
||||
Reference in New Issue
Block a user