Skip to content
This repository was archived by the owner on Aug 20, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions HCCGo/app/js/WelcomeCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
welcomeModule = angular.module('HccGoApp.WelcomeCtrl', [ ]);

welcomeModule.controller('welcomeCtrl', ['$scope', '$log', '$timeout', 'connectionService', 'notifierService', '$location', 'preferencesManager', 'updaterService', 'analyticsService', 'dbService', function($scope, $log, $timeout, connectionService, notifierService, $location, preferencesManager, updaterService, analyticsService, dbService) {

updaterService.start();
angular.element('#betaModal').modal('show');

$('#betaModal').on('shown.bs.modal', function () {
// get the locator for an input in your modal. Here I'm focusing on
// the element with the id of myInput
Expand All @@ -18,7 +18,7 @@ welcomeModule.controller('welcomeCtrl', ['$scope', '$log', '$timeout', 'connecti

$scope.loadingDescription = "Please enter your credentials.";
var $selector = $('#clusterSelect').selectize({

createOnBlur: true,
labelField: 'label',
searchField: 'label',
Expand All @@ -39,7 +39,7 @@ welcomeModule.controller('welcomeCtrl', ['$scope', '$log', '$timeout', 'connecti
new_object.type = 'slurm';
$scope.clusters.push(new_object);
callback(new_object);

}

});
Expand All @@ -61,18 +61,18 @@ welcomeModule.controller('welcomeCtrl', ['$scope', '$log', '$timeout', 'connecti

var connectUrl = selection.getValue();
var curValue = 25;
$scope.selectedCluster = $.grep($scope.clusters, function(e) {return e.url == connectUrl})[0];
$scope.selectedCluster = $.grep($scope.clusters, function(e) {return e.url == connectUrl})[0];

$('#submitprogress').css('width', curValue+'%').attr('aria-valuenow', curValue);

$log.log("Got " + $scope.username + " for login");

curValue = 50;
$('#submitprogress').css('width', curValue+'%').attr('aria-valuenow', curValue);

$scope.loadingDescription = "Attempting to login...";
$log.log("Starting login process", 'warning');

connectionService.initiateConnection($scope.username, $scope.password, connectUrl, $scope.selectedCluster.label, userPrompt, function(err) {
if (err) {
$log.error("Got error from connection");
Expand All @@ -82,27 +82,27 @@ welcomeModule.controller('welcomeCtrl', ['$scope', '$log', '$timeout', 'connecti
$('#submitprogress').css('width', curValue+'%').attr('aria-valuenow', curValue);
$scope.loadingDescription = "Login failed. Please try again.";
analyticsService.event('login', 'fail');
}
}
else {
$scope.$apply(function() {
analyticsService.event('login', 'success');
$location.path("/cluster");
$log.debug("Cluster label: " + $scope.selectedCluster.label);
});
}
}
});
};

$scope.transformCustom = function(customUrl) {
$scope.transformCustom = function(customUrl) {

$log.log("Got custom attribute: " + customUrl);
return { label: customUrl, url: customUrl, type: 'slurm'};

};


userPrompt = function(prompt, finishFunc) {

$scope.$apply(function() {
var curValue = 75;
$('#submitprogress').css('width', curValue+'%').attr('aria-valuenow', curValue);
Expand All @@ -112,6 +112,7 @@ welcomeModule.controller('welcomeCtrl', ['$scope', '$log', '$timeout', 'connecti
$('#promptModal').on('shown.bs.modal', function () {
$('#userPromptInput').focus();
});
$("#promptModal").modal({keyboard: false});
$("#promptModal").modal('show');
$scope.finishFunc = finishFunc;
});
Expand Down