Skip to content

Commit

Permalink
Release 5.8.15
Browse files Browse the repository at this point in the history
### Changelog:
* Fix(frontend): Not empty action button label and view title.

See merge request vst/vst-utils!614
  • Loading branch information
onegreyonewhite committed Nov 27, 2023
2 parents a414224 + 32d8182 commit b203b50
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend_src/vstutils/views/ViewConstructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,11 @@ export default class ViewConstructor {
};
if (!isEmpty) {
operationOptions.action = params;
operationOptions.title = params.title;
const view = new ActionView(operationOptions, null);
const executeAction = {
...this.dictionary.paths.operations.action.execute,
title: operationOptions[ACTION_NAME] || operationOptions.title,
title: operationOptions[ACTION_NAME] || params.title,
confirmationRequired,
isFileResponse,
};
Expand Down
33 changes: 33 additions & 0 deletions frontend_src/vstutils/views/__tests__/actions-generation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,37 @@ describe('ViewConstructor', () => {
expect(app.views.get('/user/{id}/disable/')).toBeUndefined();
expect(app.views.get('/user/{id}/').actions.get('disable')).toBeTruthy();
});

test('x-title will be used as action label and view title', async () => {
const app = await createApp({
schema: createSchema({
paths: {
'/user/{id}/some_action/': {
parameters: [{ name: 'id', in: 'path', required: true, type: 'integer' }],
post: {
operationId: 'user_some_action',
parameters: [
{
name: 'data',
in: 'body',
required: true,
schema: { $ref: '#/definitions/User' },
},
],
responses: {
200: {
schema: { $ref: '#/definitions/User' },
},
},
'x-title': 'Customized label',
},
},
},
}),
});

const view = app.views.get('/user/{id}/some_action/');
expect(view.actions.get('execute').title).toBe('Customized label');
expect(view.getTitle()).toBe('Customized label');
});
});
2 changes: 1 addition & 1 deletion vstutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# pylint: disable=django-not-available
__version__: str = '5.8.14'
__version__: str = '5.8.15'

0 comments on commit b203b50

Please sign in to comment.