Skip to content

Commit

Permalink
Merge pull request #6352 from rvsia/17666276catalog-name
Browse files Browse the repository at this point in the history
Show name in success catalog form messages

(cherry picked from commit aa9be06)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1784187
  • Loading branch information
himdel authored and simaishi committed Dec 16, 2019
1 parent a34a37e commit c1fc0f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/catalog_controller.rb
Expand Up @@ -637,7 +637,7 @@ def st_catalog_edit
@in_a_form = false
replace_right_cell
when "save", "add"
add_flash(_("Catalog was saved"))
add_flash(_("Catalog \"%{name}\" was saved") % {:name => params[:name]})
@changed = session[:changed] = false
@in_a_form = false
@edit = session[:edit] = nil
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/components/catalog-form/catalog-form.jsx
Expand Up @@ -68,7 +68,7 @@ class CatalogForm extends Component {
}, {
skipErrors: [400],
})
.then(() => miqAjaxButton('/catalog/st_catalog_edit?button=add'))
.then(() => miqAjaxButton('/catalog/st_catalog_edit?button=add', { name: values.name }))
.catch(error => add_flash(this.handleError(error), 'error'));
}

Expand Down Expand Up @@ -104,7 +104,7 @@ class CatalogForm extends Component {
}

return Promise.all(promises)
.then(([{ id }]) => miqAjaxButton(`/catalog/st_catalog_edit/${id}?button=save`))
.then(([{ id }]) => miqAjaxButton(`/catalog/st_catalog_edit/${id}?button=save`, { name: values.name }))
.catch(error => add_flash(this.handleError(error), 'error'));
};

Expand Down
6 changes: 3 additions & 3 deletions app/javascript/spec/catalog-form/catalog-form.spec.js
Expand Up @@ -161,7 +161,7 @@ describe('Catalog form component', () => {
};
wrapper.instance().submitValues(values).then(() => {
expect(fetchMock.called(urlCreate)).toBe(true);
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit?button=add');
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit?button=add', { name: 'Some name' });
done();
});
});
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('Catalog form component', () => {
wrapper.instance().submitValues(values).then(() => {
expect(fetchMock.called(apiBase)).toBe(true);
expect(fetchMock.called(`${apiBase}/service_templates`)).toBe(true);
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save');
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save', { name: 'Some name' });
done();
});
});
Expand All @@ -275,7 +275,7 @@ describe('Catalog form component', () => {
wrapper.instance().submitValues(values).then(() => {
expect(fetchMock.called(apiBase)).toBe(true);
expect(fetchMock.called(`${apiBase}/service_templates`)).toBe(false);
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save');
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save', { name: 'Some name' });
done();
});
});
Expand Down

0 comments on commit c1fc0f3

Please sign in to comment.