From 9c350bca7cccb825ecae8c8cd5d93dc56355b0c0 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 20 Oct 2017 08:50:20 -0400 Subject: [PATCH] Added 'no projects and cant create' empty state to process-template, deploy-image, and from-file --- app/scripts/directives/deployImage.js | 5 + app/scripts/directives/deployImageDialog.js | 4 + app/scripts/directives/fromFile.js | 6 + app/scripts/directives/fromFileDialog.js | 3 + app/scripts/directives/processTemplate.js | 7 + .../directives/processTemplateDialog.js | 7 +- app/views/directives/deploy-image.html | 374 +++++----- app/views/directives/from-file.html | 54 +- app/views/directives/process-template.html | 28 +- dist/scripts/scripts.js | 674 +++++++++--------- dist/scripts/templates.js | 10 +- 11 files changed, 614 insertions(+), 558 deletions(-) diff --git a/app/scripts/directives/deployImage.js b/app/scripts/directives/deployImage.js index b545add05b..f375a01aad 100644 --- a/app/scripts/directives/deployImage.js +++ b/app/scripts/directives/deployImage.js @@ -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 = { @@ -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'); diff --git a/app/scripts/directives/deployImageDialog.js b/app/scripts/directives/deployImageDialog.js index be5ea8eee0..50c814686d 100644 --- a/app/scripts/directives/deployImageDialog.js +++ b/app/scripts/directives/deployImageDialog.js @@ -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() { diff --git a/app/scripts/directives/fromFile.js b/app/scripts/directives/fromFile.js index 7ea9982e66..f395520c97 100644 --- a/app/scripts/directives/fromFile.js +++ b/app/scripts/directives/fromFile.js @@ -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 }; diff --git a/app/scripts/directives/fromFileDialog.js b/app/scripts/directives/fromFileDialog.js index cc8bbada74..34772c6adc 100644 --- a/app/scripts/directives/fromFileDialog.js +++ b/app/scripts/directives/fromFileDialog.js @@ -31,6 +31,9 @@ if (!$routeParams.project) { ctrl.showProjectName = true; } + $scope.$on('no-projects-cannot-create', function() { + ctrl.importForm.$setValidity('required', false); + }); }; function getIconClass() { diff --git a/app/scripts/directives/processTemplate.js b/app/scripts/directives/processTemplate.js index dc50216206..5f9966f66d 100644 --- a/app/scripts/directives/processTemplate.js +++ b/app/scripts/directives/processTemplate.js @@ -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$/; @@ -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(); }; diff --git a/app/scripts/directives/processTemplateDialog.js b/app/scripts/directives/processTemplateDialog.js index 2b02ae6a3e..1c9137d21e 100644 --- a/app/scripts/directives/processTemplateDialog.js +++ b/app/scripts/directives/processTemplateDialog.js @@ -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.' @@ -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; }); } diff --git a/app/views/directives/deploy-image.html b/app/views/directives/deploy-image.html index 222840429f..05159b0397 100644 --- a/app/views/directives/deploy-image.html +++ b/app/views/directives/deploy-image.html @@ -1,206 +1,208 @@
-

- Deploy an existing image from an image stream tag or docker pull spec. -

- -
-
- -
-
- -
- - Service account default will need image pull authority to deploy images - from {{istag.namespace}}. You can grant authority with the command: - -

- oc policy add-role-to-user system:image-puller system:serviceaccount:{{input.selectedProject.metadata.name}}:default -n {{istag.namespace}} -

+ +

+ Deploy an existing image from an image stream tag or docker pull spec. +

+ +
+
+
-
- -
- -
-
-
- -
- - - - -
-
- Image search is only available for existing projects. +
+ +
+ + Service account default will need image pull authority to deploy images + from {{istag.namespace}}. You can grant authority with the command: + +

+ oc policy add-role-to-user system:image-puller system:serviceaccount:{{input.selectedProject.metadata.name}}:default -n {{istag.namespace}} +

+
+ +
+
+
+
+ +
+ + + + +
+
+ Image search is only available for existing projects. +
+
+
-
- -
-
-
-
-

Select an image stream tag or enter an image name.

-

Loading image metadata for {{imageName | stripSHA}}...

-
-
-
" );