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
Conversation
@@ -4,6 +4,7 @@ export const selectProject: angular.IComponentOptions = { | |||
bindings: { | |||
selectedProject: '=', | |||
nameTaken: '<', | |||
onNewProjectNameChanged: '&', |
There was a problem hiding this comment.
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;
});
There was a problem hiding this comment.
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)}"> |
There was a problem hiding this comment.
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}">
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Is the "Create" button disabled until the user changes the name after an |
if (e.data.reason === 'AlreadyExists') { | ||
this.ctrl.projectNameTaken = true; | ||
this.ctrl.wizardDone = false; | ||
this.ctrl.currentStep = "Configuration"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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! :-)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
86c1198
to
19700be
Compare
@@ -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); |
There was a problem hiding this comment.
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.
… of ProjectNameTaken
19700be
to
9391600
Compare
Partial fix for console#1955