Skip to content

Commit 0dda14b

Browse files
committed
Added 'no projects and cant create' empty state to process-template, deploy-image, and from-file
1 parent db5675a commit 0dda14b

11 files changed

+557
-501
lines changed

app/scripts/directives/deployImage.js

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ angular.module("openshiftConsole")
2525
controller: function($scope) {
2626
// Must be initialized the controller. The link function is too late.
2727
$scope.forms = {};
28+
$scope.noProjectsCantCreate = false;
2829
},
2930
link: function($scope) {
3031
$scope.input = {
@@ -44,6 +45,10 @@ angular.module("openshiftConsole")
4445
value: ''
4546
}];
4647

48+
$scope.$on('no-projects-cannot-create', function() {
49+
$scope.noProjectsCantCreate = true;
50+
});
51+
4752
var orderByDisplayName = $filter('orderByDisplayName');
4853
var getErrorDetails = $filter('getErrorDetails');
4954

app/scripts/directives/deployImageDialog.js

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
if (!$routeParams.project) {
2828
ctrl.showProjectName = true;
2929
}
30+
$scope.$on('no-projects-cannot-create', function() {
31+
ctrl.deployForm.$setValidity('required', false);
32+
ctrl.deployImageNewAppCreated = false;
33+
});
3034
};
3135

3236
ctrl.deployImage = function() {

app/scripts/directives/fromFile.js

+6
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ angular.module("openshiftConsole")
2323
templateUrl: "views/directives/from-file.html",
2424
controller: function($scope) {
2525
var aceEditorSession;
26+
$scope.noProjectsCantCreate = false;
27+
2628
var humanizeKind = $filter('humanizeKind');
2729
var getErrorDetails = $filter('getErrorDetails');
2830
TaskList.clear();
2931

32+
$scope.$on('no-projects-cannot-create', function() {
33+
$scope.noProjectsCantCreate = true;
34+
});
35+
3036
$scope.input = {
3137
selectedProject: $scope.project
3238
};

app/scripts/directives/fromFileDialog.js

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
if (!$routeParams.project) {
3232
ctrl.showProjectName = true;
3333
}
34+
$scope.$on('no-projects-cannot-create', function() {
35+
ctrl.importForm.$setValidity('required', false);
36+
});
3437
};
3538

3639
function getIconClass() {

app/scripts/directives/processTemplate.js

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
var displayName = $filter('displayName');
5151
var humanize = $filter('humanize');
5252

53+
ctrl.noProjectsCantCreate = false;
54+
5355
function getHelpLinks(template) {
5456
var helpLinkName = /^helplink\.(.*)\.title$/;
5557
var helpLinkURL = /^helplink\.(.*)\.url$/;
@@ -80,6 +82,11 @@
8082
ctrl.template = angular.copy(ctrl.template);
8183
ctrl.templateDisplayName = displayName(ctrl.template);
8284
ctrl.selectedProject = ctrl.project;
85+
86+
$scope.$on('no-projects-cannot-create', function() {
87+
ctrl.noProjectsCantCreate = true;
88+
});
89+
8390
setTemplateParams();
8491
};
8592

app/scripts/directives/processTemplateDialog.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@
8787
ctrl.preSelectedProject = ctrl.selectedProject = ctrl.project;
8888
listProjects();
8989

90+
ctrl.noProjectsCantCreate = false;
91+
$scope.$on('no-projects-cannot-create', function() {
92+
ctrl.noProjectsCantCreate = true;
93+
});
94+
9095
ctrl.projectEmptyState = {
9196
title: 'No Project Selected',
9297
info: 'Please select a project from the dropdown to load Templates from that project.'
@@ -259,7 +264,7 @@
259264
ctrl.resultsStep.allowed = ctrl.configStep.valid;
260265

261266
validityWatcher = $scope.$watch("$ctrl.form.$valid", function(isValid) {
262-
ctrl.configStep.valid = isValid && ctrl.selectedProject;
267+
ctrl.configStep.valid = isValid && !ctrl.noProjectsCantCreate && ctrl.selectedProject;
263268
ctrl.resultsStep.allowed = isValid;
264269
});
265270
}

0 commit comments

Comments
 (0)