Skip to content

Commit da29de7

Browse files
committed
fixx(front): skip rendering empty job account
The association.account field is empty in Slurm REST API v0.0.43 and v0.0.44. This is probably a regression in Slurm: https://support.schedmd.com/show_bug.cgi?id=24215 This leads to an error when the JobFieldRaw is rendering with an empty query parameter for account link. Then skip rendering of JobFieldRaw component on empty account as a workaround.
1 parent 54b46af commit da29de7

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

frontend/src/views/JobView.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,19 @@ onMounted(() => {
260260
</span>
261261
</a>
262262
</dt>
263-
<component :is="field.component" v-bind="field.props" />
263+
<!--
264+
If the account is empty, do not render the component. This is actually a
265+
workaround for this Slurm bug:
266+
267+
https://support.schedmd.com/show_bug.cgi?id=24215
268+
269+
With Slurm REST API v0.0.43 and v0.0.44, this field is always empty.
270+
-->
271+
<component
272+
v-if="!(field.id === 'account' && data.association.account === '')"
273+
:is="field.component"
274+
v-bind="field.props"
275+
/>
264276
</div>
265277
</dl>
266278
</div>

frontend/tests/views/JobView.spec.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,26 @@ describe('JobView.vue', () => {
4848
expect(backButton.text()).toBe('Back to jobs')
4949
// Check some jobs fields
5050

51-
// User field has RouterLink, so check RouterLink component and props
51+
// User field has RouterLink, so check JobFieldRaw component and props
5252
const userField = wrapper.get('dl div#user').getComponent(JobFieldRaw)
5353
expect(userField.props('field')).toBe(jobRunning.user)
5454
expect(userField.props('to')).toEqual({
5555
name: 'user',
5656
params: { cluster: 'foo', user: jobRunning.user }
5757
})
5858

59-
// Account field has RouterLink, so check RouterLink component and props
60-
const accountField = wrapper.get('dl div#account').getComponent(JobFieldRaw)
61-
expect(accountField.props('field')).toBe(jobRunning.association.account)
62-
expect(accountField.props('to')).toEqual({
63-
name: 'account',
64-
params: { cluster: 'foo', account: jobRunning.association.account }
65-
})
66-
59+
// Account field has RouterLink, so check JobFieldRaw component and props.
60+
// If the account is empty, the component is not rendered. This is actually a
61+
// workaround for this Slurm bug:
62+
// https://support.schedmd.com/show_bug.cgi?id=24215
63+
if (jobRunning.association.account !== '') {
64+
const accountField = wrapper.get('dl div#account').getComponent(JobFieldRaw)
65+
expect(accountField.props('field')).toBe(jobRunning.association.account)
66+
expect(accountField.props('to')).toEqual({
67+
name: 'account',
68+
params: { cluster: 'foo', account: jobRunning.association.account }
69+
})
70+
}
6771
// Fields without RouterLink should have text directly accessible
6872
expect(wrapper.get('dl div#group dd').text()).toBe(jobRunning.group)
6973
expect(wrapper.get('dl div#priority dd').text()).toBe(jobRunning.priority.number.toString())

0 commit comments

Comments
 (0)