Skip to content

Commit aa9be06

Browse files
authored
Merge pull request #6352 from rvsia/17666276catalog-name
Show name in success catalog form messages
2 parents e12b346 + d111a71 commit aa9be06

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

app/controllers/catalog_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def st_catalog_edit
631631
@in_a_form = false
632632
replace_right_cell
633633
when "save", "add"
634-
add_flash(_("Catalog was saved"))
634+
add_flash(_("Catalog \"%{name}\" was saved") % {:name => params[:name]})
635635
@changed = session[:changed] = false
636636
@in_a_form = false
637637
@edit = session[:edit] = nil

app/javascript/components/catalog-form/catalog-form.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CatalogForm extends Component {
6868
}, {
6969
skipErrors: [400],
7070
})
71-
.then(() => miqAjaxButton('/catalog/st_catalog_edit?button=add'))
71+
.then(() => miqAjaxButton('/catalog/st_catalog_edit?button=add', { name: values.name }))
7272
.catch(error => add_flash(this.handleError(error), 'error'));
7373
}
7474

@@ -104,7 +104,7 @@ class CatalogForm extends Component {
104104
}
105105

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

app/javascript/spec/catalog-form/catalog-form.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('Catalog form component', () => {
163163
};
164164
wrapper.children().instance().submitValues(values).then(() => {
165165
expect(fetchMock.called(urlCreate)).toBe(true);
166-
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit?button=add');
166+
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit?button=add', { name: 'Some name' });
167167
done();
168168
});
169169
});
@@ -252,7 +252,7 @@ describe('Catalog form component', () => {
252252
wrapper.children().instance().submitValues(values).then(() => {
253253
expect(fetchMock.called(apiBase)).toBe(true);
254254
expect(fetchMock.called(`${apiBase}/service_templates`)).toBe(true);
255-
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save');
255+
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save', { name: 'Some name' });
256256
done();
257257
});
258258
});
@@ -277,7 +277,7 @@ describe('Catalog form component', () => {
277277
wrapper.children().instance().submitValues(values).then(() => {
278278
expect(fetchMock.called(apiBase)).toBe(true);
279279
expect(fetchMock.called(`${apiBase}/service_templates`)).toBe(false);
280-
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save');
280+
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/catalog/st_catalog_edit/1001?button=save', { name: 'Some name' });
281281
done();
282282
});
283283
});

0 commit comments

Comments
 (0)