Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In CreateFromBuilder and OrderService wizards, correct error handling of ProjectNameTaken #550

Merged
merged 1 commit into from Nov 7, 2017

Conversation

dtaylor113
Copy link
Contributor

Partial fix for console#1955

image

  • Immediate form validation error if project name already exists for user. Form validation error when 'Project Name already exists' error returned from server (project name not unique across cluster).
  • Form validation error cleared when user starts to type in new project name

@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 6, 2017
@@ -4,6 +4,7 @@ export const selectProject: angular.IComponentOptions = {
bindings: {
selectedProject: '=',
nameTaken: '<',
onNewProjectNameChanged: '&',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't adding a new callback is necessary... The embedding page can just watch selectedProject.metadata.name.

this.$scope.$watch('$ctrl.selectedProject.metadata.name', () => {
  this.ctrl.projectNameTaken = false;
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -58,7 +58,8 @@ <h3 ng-if="$ctrl.canOnlyCreateProject()">Create Project</h3>
ng-if="$ctrl.isNewProject()">
<div class="form-group">
<label for="name" class="control-label required">Project Name</label>
<div ng-class="{'has-error': ($ctrl.forms.createProjectForm.name.$error.pattern && $ctrl.forms.createProjectForm.name.$touched) || $ctrl.nameTaken}">
<div ng-class="{'has-error': ($ctrl.forms.createProjectForm.name.$error.pattern && $ctrl.forms.createProjectForm.name.$touched) ||
($ctrl.nameTaken || $ctrl.forms.createProjectForm.name.$error.oscUnique)}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parens around the last two conditions are unnecessary.

 <div ng-class="{'has-error': ($ctrl.forms.createProjectForm.name.$error.pattern && $ctrl.forms.createProjectForm.name.$touched) ||
                               $ctrl.nameTaken || $ctrl.forms.createProjectForm.name.$error.oscUnique}">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -106,6 +106,7 @@ export class CreateFromBuilderController implements angular.IController {
onShow: this.showResults
};
this.ctrl.steps = [this.infoStep, this.configStep, this.bindStep, this.reviewStep];
this.ctrl.currentStep = "Information";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set this everywhere? I'd think it would only be necessary in the error handler when we change steps back to Configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to set it so that when the error happens, it navigates correctly, else the currentStep will always be "Configuration".

Is the "Create" button disabled until the user changes the name after an AlreadyExists error?

Yes

@spadgett
Copy link
Member

spadgett commented Nov 6, 2017

Is the "Create" button disabled until the user changes the name after an AlreadyExists error?

if (e.data.reason === 'AlreadyExists') {
this.ctrl.projectNameTaken = true;
this.ctrl.wizardDone = false;
this.ctrl.currentStep = "Configuration";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does this result in any flash / flicker when it changes to the results step and back?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does, if that is an issue I can look into wiring up nextCallback() and return `false' to not navigate, not sure if that'll do the trick though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's what we do in the process-template-dialog.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, and then we use eventing to navigate to Results upon success, just more overhead than what I'm doing at the moment, but if we want to avoid the flicker...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this, then there should be no need to set currentStep at all.

Copy link
Contributor Author

@dtaylor113 dtaylor113 Nov 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is OrderService where the wizard steps are: Configure(create/sel proj) -> Bindings -> try to createProjIf neccesary() then createService(), -> Results. I was thinking Configure -> try to createProjIfNeccesary(), if error stay on Conifg page & show error, if success goto Bindings -> createService() -> Results. But it sounded like we didn't want to create proj. in Configure step, rather be able to test if proj name is unique cross-cluster -but there didn't seem to be a method to do this.

In general, I think there should be a "+" next to the project selector which would launch the Create Project dlg, then default the project selector to newly created project. The "Create Project" shouldn't be in the select project dropdown. Perhaps a change for 3.8?

Not sure what to do in the meantime. IMO jumping back to Configure step on projNameAlreadyTaken is a barely noticeable flicker and is a step in the right direction until we address the overall design in 3.8.

@beanh66, @ncameronbritt UX thoughts? -thanks! :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dtaylor113 What you have works for me for 3.7. I had forgotten about the bind step in this dialog.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then I believe I have addressed all review comments. Should I create an issue about the proposed "+" next to the select project dropdown?

@@ -114,11 +113,6 @@ export class SelectProjectController implements angular.IController {
}
}

public onNewProjectNameChange() {
this.ctrl.nameTaken = false;
this.ctrl.forms.createProjectForm.name.$setValidity('nameTaken', !this.ctrl.nameTaken);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to set form validity? I suspect at least one of the dialogs relies on this.

@spadgett spadgett merged commit 69571f0 into openshift:master Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants