Title says it all. We should then redirect to the "Fields" tab, like we currently always do in D7, when the button is used.

I don't think the same would make sense when adding a server, since there is no more configuration to make.

Comments

drunken monkey’s picture

Title: Add ‘save and edit configuration’ option to creation form » Add a "Save and edit" button to the "Add index" page
Project: Search API (8.x) » Search API
Version: » 8.x-1.x-dev
Issue summary: View changes
p-neyens’s picture

Assigned: Unassigned » p-neyens
rosinegrean’s picture

Assigned: p-neyens » rosinegrean
Status: Active » Needs review
StatusFileSize
new1.04 KB

I'm not sure if p-neyens is still working on this, but here is a patch for it.

drunken monkey’s picture

Issue tags: +Needs tests
StatusFileSize
new1.47 KB

Great, thanks a lot!
Already looks quite good, I just had some style changes. Patch attached.

Also, there are a few other changes I'd like to discuss before committing:
- First off, it would be great if we could add a test for this. Maybe just in the IntegrationTest use this button when creating an index.
- The "Delete" button/link has some special code to keep the destination GET parameter intact. Should we add that here, too?

rosinegrean’s picture

StatusFileSize
new2.29 KB
new832 bytes

Hello,

I've added a test for this button in IntegrationTest like you mentioned.

For the destination issue, I'm not sure if this is the case. I tried to apply the same logic as for delete, but since the entity is not created yet i could not get the "fields" url in a clean way. In your patch i saw you changed

$form_state->setRedirect('entity.search_api_index.fields', array('search_api_index' => $this->getEntity()->id()));

with $form_state->setRedirectUrl($this->getEntity()->urlInfo('fields'));

Should i use for destination the first approach ? Or do you know something better ?

Status: Needs review » Needs work

The last submitted patch, 5: 2230979-5--save_and_edit.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
StatusFileSize
new660 bytes
new2.25 KB

Sorry for that, for some reason i can't run tests for Search API on my local machine because PHP crashes.
Hope this new patch will do the trick.

Status: Needs review » Needs work

The last submitted patch, 7: 2230979-7--save_and_edit.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new2.25 KB
new890 bytes

Thanks for the additional work!

Should i use for destination the first approach ? Or do you know something better ?

Ah, let's just forget about the destination there. I don't think a redirect after creating an index is as much of a use case as after deleting it.

I think the bug in the test was that you do a drupalPostForm() on the current page (which is the old index's view page) instead of on the "Add index" page. Revised patch attached, hopefully this one will work.

Status: Needs review » Needs work

The last submitted patch, 9: 2230979-9--save_and_edit.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
StatusFileSize
new2.28 KB
new526 bytes
rosinegrean’s picture

Thanks, looks good to me now.
Not sure why the test did not run, but after it passes i will mark it reviewed.

rosinegrean’s picture

Status: Needs review » Reviewed & tested by the community

Good to go

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Great, committed.
Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.