From 1911577ad6b7f24533b7a080906b516169a4b99a Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Thu, 1 Jun 2017 09:09:20 -0400 Subject: [PATCH] Update bind types for clarity Depends on https://github.com/openshift/origin-web-common/pull/90 --- app/scripts/directives/bindService.js | 10 +++++---- .../bind-service/bind-service-form.html | 5 ++--- .../directives/bind-service/results.html | 1 + dist/scripts/scripts.js | 10 ++++----- dist/scripts/templates.js | 4 ++-- dist/scripts/vendor.js | 21 +++++++++++-------- 6 files changed, 28 insertions(+), 23 deletions(-) diff --git a/app/scripts/directives/bindService.js b/app/scripts/directives/bindService.js index 97003f1b3c..8b65476c3f 100644 --- a/app/scripts/directives/bindService.js +++ b/app/scripts/directives/bindService.js @@ -71,7 +71,7 @@ function BindService($scope, .concat(replicaSets) .concat(statefulSets); ctrl.applications = _.sortByAll(apiObjects, ['metadata.name', 'kind']); - ctrl.shouldBindToApp = ctrl.applications.length ? "true" : "false"; + ctrl.bindType = ctrl.applications.length ? "application" : "secret-only"; } }; @@ -133,7 +133,7 @@ function BindService($scope, // TODO is it ever realistically possible for target to not be defined at this point if (ctrl.target.kind === 'Instance') { - ctrl.shouldBindToApp = "false"; + ctrl.bindType = "secret-only"; ctrl.appToBind = null; ctrl.serviceToBind = ctrl.target.metadata.name; // Load all the "application" types @@ -168,6 +168,8 @@ function BindService($scope, }); } else { + ctrl.bindType = 'application'; + ctrl.appToBind = ctrl.target; DataService.list({ group: 'servicecatalog.k8s.io', resource: 'instances' @@ -195,13 +197,13 @@ function BindService($scope, ctrl.bindService = function() { var svcToBind = ctrl.target.kind === 'Instance' ? ctrl.target : ctrl.serviceInstances[ctrl.serviceToBind]; - var appToBind = ctrl.target.kind !== 'Instance' ? ctrl.target : ctrl.appToBind; + var application = ctrl.bindType === 'application' ? _.get(ctrl.appToBind, 'metadata.name') : undefined; var context = { namespace: _.get(svcToBind, 'metadata.namespace') }; - BindingService.bindService(context, _.get(svcToBind, 'metadata.name'), _.get(appToBind, 'metadata.name')).then(function(binding){ + BindingService.bindService(context, _.get(svcToBind, 'metadata.name'), application).then(function(binding){ ctrl.binding = binding; ctrl.error = null; diff --git a/app/views/directives/bind-service/bind-service-form.html b/app/views/directives/bind-service/bind-service-form.html index 22f2fcdd55..6f7b08cc10 100644 --- a/app/views/directives/bind-service/bind-service-form.html +++ b/app/views/directives/bind-service/bind-service-form.html @@ -12,8 +12,7 @@ service-class-name="ctrl.serviceClassName" form-name="ctrl.selectionForm" applications="ctrl.applications" - app-to-bind="ctrl.appToBind" - should-bind-to-app="ctrl.shouldBindToApp" - group-by-kind="ctrl.groupByKind"> + bind-type="ctrl.bindType" + app-to-bind="ctrl.appToBind"> diff --git a/app/views/directives/bind-service/results.html b/app/views/directives/bind-service/results.html index 374180cba8..6eb6ab1366 100644 --- a/app/views/directives/bind-service/results.html +++ b/app/views/directives/bind-service/results.html @@ -1,6 +1,7 @@ \n" + "\n" + "
\n" + - "\n" + + "\n" + "\n" + "
" ); $templateCache.put('views/directives/bind-service/results.html', - "\n" + + "\n" + "" ); diff --git a/dist/scripts/vendor.js b/dist/scripts/vendor.js index b6b286b343..bfab1859f9 100644 --- a/dist/scripts/vendor.js +++ b/dist/scripts/vendor.js @@ -59554,8 +59554,8 @@ description:"Name must consist of lower-case letters, numbers, periods, and hyph }), hawtioPluginLoader.addModule("openshiftCommonUI"), angular.module("openshiftCommonUI").run([ "$templateCache", function(a) { "use strict"; a.put("src/components/binding/bindApplicationForm.html", '
\n
\n
\n \n \n Binding to a provisioned service will create a secret containing the information necessary for your application to use the service.\n \n
\n
\n\n
\n
\n
\n \n
\n \n You can create the binding later from your project.\n \n
\n
\n \n
\n \n \n \n {{serviceInstance.metadata.name}}\n \n
\n
\n

\n \n \n There are no bindable services in this project\n \n

\n
\n
\n
\n
\n'), -a.put("src/components/binding/bindResults.html", '
\n
\n \n

\n Pending\n
The binding was created but is not ready yet.
\n

\n
\n
\n
\n \n Success\n

\n {{ctrl.serviceToBind}}\n  has been bound\n  to {{ctrl.applicationToBind}} successfully\n

\n
\n
\n The binding operation created the secret\n {{ctrl.binding.spec.secretName}}\n {{ctrl.binding.spec.secretName}}\n that you may need to reference in your application.\n Its data will be available to your application as environment variables.\n
\n
\n \n Info\n The binding secret will only be available to new pods. You will need to redeploy your application.\n
\n
\n
\n
\n
\n \n Error\n

\n Binding Failed\n

\n
\n
\n \n {{ctrl.error.data.message | upperFirst}}\n \n \n An error occurred creating the binding.\n \n
\n
\n'), -a.put("src/components/binding/bindServiceForm.html", '
\n
\n
\n \n Binding to a provisioned service will create a secret containing the information necessary for your application to use the service.\n
\n
\n\n
\n
\n
\n \n
\n \n \n \n {{$select.selected.metadata.name}}\n – {{$select.selected.kind | humanizeKind : true}}\n \n \n \n \n \n \n
\n \n
\n You can reference this secret later from any application either as environment variables or configuration files mounted as volumes.\n
\n \n
\n You can create the binding later from your project.\n
\n
\n
\n
\n
\n'), +a.put("src/components/binding/bindResults.html", '
\n
\n \n

\n Pending\n
The binding was created but is not ready yet.
\n

\n
\n
\n
\n \n Success\n

\n {{ctrl.serviceToBind}}\n has been bound\n to {{ctrl.applicationToBind}} successfully\n

\n
\n
\n The binding operation created the secret\n {{ctrl.binding.spec.secretName}}\n {{ctrl.binding.spec.secretName}}\n that you may need to reference in your application.\n Its data will be available to your application as environment variables.\n
\n
\n \n Info\n The binding secret will only be available to new pods. You will need to redeploy your application.\n
\n
\n
\n
\n
\n \n Error\n

\n Binding Failed\n

\n
\n
\n \n {{ctrl.error.data.message | upperFirst}}\n \n \n An error occurred creating the binding.\n \n
\n
\n'), +a.put("src/components/binding/bindServiceForm.html", '
\n
\n
\n \n Binding to a provisioned service will create a secret containing the information necessary for your application to use the service.\n
\n
\n\n
\n
\n
\n \n
\n \n \n \n {{$select.selected.metadata.name}}\n – {{$select.selected.kind | humanizeKind : true}}\n \n \n \n \n \n \n
\n \n
\n You can reference this secret later from any application either as environment variables or configuration files mounted as volumes.\n
\n \n
\n You can create the binding later from your project.\n
\n
\n
\n
\n
\n'), a.put("src/components/create-project/createProject.html", '
\n
\n
\n \n \n \n \n
\n A unique name for the project.\n
\n
\n \n Name is required.\n \n
\n
\n \n Name must have at least two characters.\n \n
\n
\n \n Project names may only contain lower-case letters, numbers, and dashes.\n They may not start or end with a dash.\n \n
\n
\n \n This name is already in use. Please choose a different name.\n \n
\n
\n\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n Cancel\n \n
\n
\n
\n'), a.put("src/components/delete-project/delete-project-button.html", '\n'), a.put("src/components/delete-project/delete-project-modal.html", '
\n \n
\n \n \n
\n
\n'), a.put("src/components/delete-project/delete-project.html", '{{label || \'Delete\'}}\n'), a.put("src/components/edit-project/editProject.html", '
\n
\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n Cancel\n \n
\n
\n
\n'), @@ -59589,6 +59589,7 @@ error:"<", binding:"<", progressInline:"@", serviceToBind:"<", +bindType:"@", applicationToBind:"<", showPodPresets:"<", secretHref:"<" @@ -59607,17 +59608,19 @@ controllerAs:"ctrl", bindings:{ serviceClass:"<", serviceClassName:"<", -formName:"=", applications:"<", -appToBind:"=", -createBinding:"=?", +formName:"=", allowNoBinding:"