Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start a new session #53

Merged
4 commits merged into from Feb 13, 2019
Merged
Show file tree
Hide file tree
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
29 changes: 25 additions & 4 deletions PolyDeploy/Clients/Deploy/src/js/controllers/ResultController.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = ['$scope', 'SessionService',
function ($scope, SessionService) {
module.exports = ['$scope', '$state','SessionService',
function ($scope, $state, SessionService) {

// Wait for session.
SessionService.sessionPromise.then(
Expand All @@ -18,6 +18,29 @@
}
});

// Start a new deploy.
$scope.restart = function () {

// Create a new session.
SessionService.newSession()
.then(function () {

// Navigate back to beginning.
$state.go('install.upload');
});
};

// Is the install complete?
$scope.isComplete = function () {

var session = $scope.session;

// Is the session complete?
return session
&& session.Status
&& session.Status === 2;
};

// Current status.
$scope.currentStatus = function (session) {

Expand Down Expand Up @@ -80,8 +103,6 @@
panelClass = modPackage.Success ? 'panel-success' : 'panel-danger';
}

console.log(panelClass);

return panelClass;
};

Expand Down
18 changes: 17 additions & 1 deletion PolyDeploy/Clients/Deploy/src/js/services/SessionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
// Gets a new session from the API.
function newSession() {

// Is there an interval promise?
if (sessionRefreshInterval) {

// Cancel it.
$interval.cancel(sessionRefreshInterval);
}

// Get a session from the API.
sessionPromise = SessionDataService.create().then(
function (session) {
Expand All @@ -36,6 +43,16 @@
return SessionDataService.get(session.Guid).then(
function (sessionUpdate) {

// Do we need to stop refreshing?
if (sessionUpdate
&& sessionUpdate.Status
&& sessionUpdate.Status === 2) {

// Complete, no need to continue refreshing.
$interval.cancel(sessionRefreshInterval);
}

// Replace current session data.
replace(sessionObject, sessionUpdate);

return sessionObject;
Expand All @@ -51,7 +68,6 @@
function (session) {

// Get session summary.
console.log('GetSummary: ' + session.Guid);
return SessionDataService.summary(session.Guid);
});
}
Expand Down
6 changes: 6 additions & 0 deletions PolyDeploy/Clients/Deploy/src/js/templates/result.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ <h2>Installing</h2>
<h4>{{ currentStatus(session) }}</h4>
<!-- /Current -->

<button
type="button"
class="btn btn-primary"
ng-disabled="!isComplete()"
ng-click="restart()">New Session</button>

<div class="row">

<!-- Packages -->
Expand Down