Skip to content

Commit

Permalink
Deploy shouldn't enable to image is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
jwforres committed May 19, 2017
1 parent 99b13e5 commit eba799a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 28 deletions.
10 changes: 10 additions & 0 deletions app/scripts/directives/deployImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ angular.module("openshiftConsole")
return;
}

$scope.forms.imageSelection.imageName.$setValidity("imageLoaded", true);

var image = $scope.import.image;
if (image) {
$scope.app.name = getName();
Expand Down Expand Up @@ -170,6 +172,14 @@ angular.module("openshiftConsole")

delete $scope.import;
$scope.istag = {};

if (newMode === 'dockerImage') {
$scope.forms.imageSelection.imageName.$setValidity("imageLoaded", false);
}
else {
// reset this to true so it doesn't block form submission
$scope.forms.imageSelection.imageName.$setValidity("imageLoaded", true);
}
});

$scope.$watch('istag', function(istag, old) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/directives/deployImageDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function DeployImageDialog($scope, DataService) {
};

$scope.$on("wizard:stepChanged", function (e, parameters) {
if (parameters.step.stepId === 'next-steps') {
if (parameters.step.stepId === 'results') {
ctrl.nextButtonTitle = "Close";
} else {
ctrl.nextButtonTitle = "Deploy";
Expand Down
52 changes: 27 additions & 25 deletions app/views/directives/deploy-image-dialog.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
<overlay-panel show-panel="$ctrl.visible" show-close="true" handle-close="$ctrl.close">
<!-- TODO what to do with alerts? -->
<div pf-wizard
on-cancel="$ctrl.close()"
on-finish="$ctrl.close()"
next-title="$ctrl.nextButtonTitle"
next-callback="$ctrl.nextCallback"
content-height="600"><!-- TODO switch to use the new content classes instead so we can get dynamic sizing, add option to hide header, add option to hide sidebar, add option to hide back btn -->
on-cancel="$ctrl.close()"
on-finish="$ctrl.close()"
hide-header="true"
hide-back-button="true"
hide-sidebar="true"
next-title="$ctrl.nextButtonTitle"
next-callback="$ctrl.nextCallback"
content-height="600"><!-- TODO switch to use the new content classes instead so we can get dynamic sizing -->
<div pf-wizard-step
step-title="Image"
step-id="image"
step-priority="1"
substeps="false"
ok-to-nav-away="true"
allow-click-nav="false"
next-enabled="!$ctrl.deployForm.$invalid"><!-- TODO enables too soon when using search, need to wait for image to be resolved... -->
step-title="Image"
step-id="image"
step-priority="1"
substeps="false"
ok-to-nav-away="true"
allow-click-nav="false"
next-enabled="!$ctrl.deployForm.$invalid"><!-- TODO enables too soon when using search, need to wait for image to be resolved... -->
<div class="wizard-pf-main-inner-shadow-covers">
<form name="$ctrl.deployForm">
<deploy-image is-dialog="true" project="$ctrl.project" context="$ctrl.context" alerts="$ctrl.alerts"></deploy-image>
</form>
</div>
</div>
<div pf-wizard-step
step-title="Results"
step-id="results"
step-priority="2"
substeps="false"
ok-to-nav-away="true"
allow-click-nav="false">
step-title="Results"
step-id="results"
step-priority="2"
substeps="false"
ok-to-nav-away="true"
allow-click-nav="false">
<div class="wizard-pf-main-inner-shadow-covers">
<next-steps
project="$ctrl.selectedProject"
project-name="$ctrl.selectedProject.metadata.name"
login-base-url="$ctrl.loginBaseUrl"
on-continue="$ctrl.close">
<next-steps project="$ctrl.selectedProject"
project-name="$ctrl.selectedProject.metadata.name"
login-base-url="$ctrl.loginBaseUrl"
on-continue="$ctrl.close">
</next-steps>
</div>
</div>
</div>
</div> <!-- /pf-wizard-step -->
</div> <!-- /pf-wizard -->
</overlay-panel>
5 changes: 3 additions & 2 deletions app/views/directives/deploy-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<p>
Deploy an existing image from an image stream tag or docker pull spec.
</p>
<form>
<ng-form name="forms.imageSelection">
<fieldset ng-disabled="loading">
<div class="radio">
<label>
Expand Down Expand Up @@ -33,6 +33,7 @@
<div class="input-group">
<input type="search"
id="imageName"
name="imageName"
ng-model="imageName"
ng-required="mode === 'dockerImage'"
select-on-focus
Expand All @@ -54,7 +55,7 @@
</div>
</div>
</fieldset>
</form>
</ng-form>

<div ng-if="loading || !import" class="empty-state-message text-muted text-center">
<span class="fa fa-cube icon-lg hero-icon" aria-hidden="true"></span>
Expand Down

0 comments on commit eba799a

Please sign in to comment.