-
Notifications
You must be signed in to change notification settings - Fork 231
/
Copy pathdeployImageDialog.js
73 lines (65 loc) · 1.79 KB
/
deployImageDialog.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'use strict';
(function() {
angular.module('openshiftConsole').component('deployImageDialog', {
controller: [
'$scope',
'$routeParams',
'DataService',
DeployImageDialog
],
controllerAs: '$ctrl',
bindings: {
project: '<', //handle create project optionally
context: '<',
onDialogClosed: '&'
},
templateUrl: 'views/directives/deploy-image-dialog.html'
});
function DeployImageDialog($scope, $routeParams, DataService) {
var ctrl = this;
ctrl.$onInit = function() {
ctrl.loginBaseUrl = DataService.openshiftAPIBaseUrl();
ctrl.currentStep = "Image";
// if on the landing page, show the project name in next-steps
if (!$routeParams.project) {
ctrl.showProjectName = true;
}
};
ctrl.deployImage = function() {
$scope.$broadcast('newAppFromDeployImage');
};
$scope.$on('deployImageNewAppCreated', function(event, message) {
ctrl.selectedProject = message.project;
ctrl.appName = message.appName;
ctrl.deployImageNewAppCreated = true;
ctrl.currentStep = "Results";
});
ctrl.close = function() {
var cb = ctrl.onDialogClosed();
if (_.isFunction(cb)) {
cb();
}
ctrl.wizardDone = false;
return true;
};
ctrl.stepChanged = function(step) {
if (step.stepId === 'results') {
ctrl.nextButtonTitle = "Close";
ctrl.wizardDone = true;
} else {
ctrl.nextButtonTitle = "Deploy";
}
};
ctrl.nextCallback = function (step) {
if (step.stepId === 'image') {
ctrl.deployImage();
return false; // don't actually navigate yet
}
else if (step.stepId === 'results') {
ctrl.close();
return false;
}
return true;
};
}
})();