Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<md-dialog flex="50">
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools md-portal">
|
||||
<span>{{header}} to {{currentDir}}</span>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="cancel()">
|
||||
<md-icon aria-label="Close dialog">close</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<md-dialog-content flex>
|
||||
<div layout="row" flex="100" class="md-dialog-content" id="fileInputDiv">
|
||||
<repo-file-input id="fileInput" name="file" ng-model="uploadFile" accepts="false" flex></repo-file-input>
|
||||
</div>
|
||||
<div layout="row" flex="100" class="md-dialog-content">
|
||||
<md-input-container flex>
|
||||
<label>Hash Value</label>
|
||||
<input type="text" id="fileName" ng-model="model.hashValue" required>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div ng-show="loadingBlock" class="loadingFade"></div>
|
||||
<div class="loadingModal" ng-show="loadingBlock">
|
||||
<md-progress-circular md-mode="indeterminate" md-diameter="80" class="md-hue-2"></md-progress-circular>
|
||||
</div>
|
||||
</md-dialog-content>
|
||||
<md-dialog-actions layout="row" class="modal-footer">
|
||||
<div class="text-danger text-center">{{error}}</div>
|
||||
<md-button id="okButton" class="md-raised md-primary" ng-click="ok()" ng-disabled="!valid">OK</md-button>
|
||||
<md-button id="cancelButton" class="md-raised md-warn" ng-click="cancel()">Cancel</md-button>
|
||||
</md-dialog-actions>
|
||||
</md-dialog>
|
||||
@@ -0,0 +1,73 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.common.partials.uploadpatchfile', ['ui.router'])
|
||||
.controller('UploadPatchFileCtrl', UploadPatchFileCtrlController);
|
||||
|
||||
function UploadPatchFileCtrlController($scope, modalInstance, $state, cache, $mdDialog, fileProvider, UploadFile, portalUtils) {
|
||||
|
||||
$scope.header = modalInstance.header;
|
||||
$scope.currentDir = modalInstance.currentDir;
|
||||
|
||||
$scope.uploadFile = undefined;
|
||||
|
||||
$scope.loadingBlock = false;
|
||||
|
||||
$scope.model = { };
|
||||
|
||||
$scope.valid = false;
|
||||
|
||||
$scope.$watch('model', function(){
|
||||
if ($scope.model.hashValue === undefined || $scope.model.hashValue.trim() === '') {
|
||||
$scope.valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($scope.uploadFile === undefined) {
|
||||
$scope.valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.valid = true;
|
||||
|
||||
}, true);
|
||||
|
||||
/**
|
||||
* OK button handler
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.ok = function () {
|
||||
$scope.loadingBlock = true;
|
||||
fileProvider.uploadFile([new UploadFile().init($scope.uploadFile)], $scope.model.hashValue, $scope.currentDir).then(function(data) {
|
||||
$scope.loadingBlock = false;
|
||||
portalUtils.toast('File uploaded successfully', ['top', 'left'], 2000);
|
||||
$mdDialog.hide();
|
||||
}).catch(function(err) {
|
||||
$scope.loadingBlock = false;
|
||||
$scope.error = err.message;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel button handler.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.cancel = function () {
|
||||
//Dismiss the modal
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
if ($scope.mCache !== undefined) {
|
||||
$scope.mCache.unlisten();
|
||||
}
|
||||
});
|
||||
|
||||
} //end UploadPatchFileCtrlController function
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user