Skip to content

Commit

Permalink
Added 'no projects and cant create' empty state to process-template, …
Browse files Browse the repository at this point in the history
…deploy-image, and from-file
  • Loading branch information
dtaylor113 committed Oct 25, 2017
1 parent bae09d0 commit 7c3fad3
Show file tree
Hide file tree
Showing 11 changed files with 558 additions and 502 deletions.
5 changes: 5 additions & 0 deletions app/scripts/directives/deployImage.js
Expand Up @@ -25,6 +25,7 @@ angular.module("openshiftConsole")
controller: function($scope) {
// Must be initialized the controller. The link function is too late.
$scope.forms = {};
$scope.noProjectsCantCreate = false;
},
link: function($scope) {
$scope.input = {
Expand All @@ -44,6 +45,10 @@ angular.module("openshiftConsole")
value: ''
}];

$scope.$on('no-projects-cannot-create', function() {
$scope.noProjectsCantCreate = true;
});

var orderByDisplayName = $filter('orderByDisplayName');
var getErrorDetails = $filter('getErrorDetails');

Expand Down
4 changes: 4 additions & 0 deletions app/scripts/directives/deployImageDialog.js
Expand Up @@ -27,6 +27,10 @@
if (!$routeParams.project) {
ctrl.showProjectName = true;
}
$scope.$on('no-projects-cannot-create', function() {
ctrl.deployForm.$setValidity('required', false);
ctrl.deployImageNewAppCreated = false;
});
};

ctrl.deployImage = function() {
Expand Down
6 changes: 6 additions & 0 deletions app/scripts/directives/fromFile.js
Expand Up @@ -23,10 +23,16 @@ angular.module("openshiftConsole")
templateUrl: "views/directives/from-file.html",
controller: function($scope) {
var aceEditorSession;
$scope.noProjectsCantCreate = false;

var humanizeKind = $filter('humanizeKind');
var getErrorDetails = $filter('getErrorDetails');
TaskList.clear();

$scope.$on('no-projects-cannot-create', function() {
$scope.noProjectsCantCreate = true;
});

$scope.input = {
selectedProject: $scope.project
};
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/directives/fromFileDialog.js
Expand Up @@ -31,6 +31,9 @@
if (!$routeParams.project) {
ctrl.showProjectName = true;
}
$scope.$on('no-projects-cannot-create', function() {
ctrl.importForm.$setValidity('required', false);
});
};

function getIconClass() {
Expand Down
7 changes: 7 additions & 0 deletions app/scripts/directives/processTemplate.js
Expand Up @@ -50,6 +50,8 @@
var displayName = $filter('displayName');
var humanize = $filter('humanize');

ctrl.noProjectsCantCreate = false;

function getHelpLinks(template) {
var helpLinkName = /^helplink\.(.*)\.title$/;
var helpLinkURL = /^helplink\.(.*)\.url$/;
Expand Down Expand Up @@ -80,6 +82,11 @@
ctrl.template = angular.copy(ctrl.template);
ctrl.templateDisplayName = displayName(ctrl.template);
ctrl.selectedProject = ctrl.project;

$scope.$on('no-projects-cannot-create', function() {
ctrl.noProjectsCantCreate = true;
});

setTemplateParams();
};

Expand Down
7 changes: 6 additions & 1 deletion app/scripts/directives/processTemplateDialog.js
Expand Up @@ -91,6 +91,11 @@
}
listProjects();

ctrl.noProjectsCantCreate = false;
$scope.$on('no-projects-cannot-create', function() {
ctrl.noProjectsCantCreate = true;
});

ctrl.projectEmptyState = {
title: 'No Project Selected',
info: 'Please select a project from the dropdown to load Templates from that project.'
Expand Down Expand Up @@ -272,7 +277,7 @@
ctrl.resultsStep.allowed = ctrl.configStep.valid;

validityWatcher = $scope.$watch("$ctrl.form.$valid", function(isValid) {
ctrl.configStep.valid = isValid && ctrl.selectedProject;
ctrl.configStep.valid = isValid && !ctrl.noProjectsCantCreate && ctrl.selectedProject;
ctrl.resultsStep.allowed = isValid;
});
}
Expand Down

0 comments on commit 7c3fad3

Please sign in to comment.