Commit 4fba6a57 authored by Tom Quirk's avatar Tom Quirk

Simplify jira issues root logic

parent 6a368c33
...@@ -274,9 +274,10 @@ export default { ...@@ -274,9 +274,10 @@ export default {
<gl-skeleton-loading /> <gl-skeleton-loading />
</li> </li>
</ul> </ul>
<template v-else>
<component <component
:is="issuablesWrapper" :is="issuablesWrapper"
v-if="!issuablesLoading && issuables.length" v-if="issuables.length > 0"
class="content-list issuable-list issues-list" class="content-list issuable-list issues-list"
:class="{ 'manual-ordering': isManualOrdering }" :class="{ 'manual-ordering': isManualOrdering }"
v-bind="$options.vueDraggableAttributes" v-bind="$options.vueDraggableAttributes"
...@@ -311,7 +312,9 @@ export default { ...@@ -311,7 +312,9 @@ export default {
</template> </template>
</issuable-item> </issuable-item>
</component> </component>
<slot v-if="!issuablesLoading && !issuables.length" name="empty-state"></slot> <slot v-else name="empty-state"></slot>
</template>
<gl-pagination <gl-pagination
v-if="showPaginationControls" v-if="showPaginationControls"
:per-page="defaultPageSize" :per-page="defaultPageSize"
......
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
return { return {
jiraLogo, jiraLogo,
issues: [], issues: [],
issuesListLoading: false, issuesListLoading: true,
issuesListLoadFailed: false, issuesListLoadFailed: false,
totalIssues: 0, totalIssues: 0,
currentState: this.initialState, currentState: this.initialState,
...@@ -206,19 +206,19 @@ export default { ...@@ -206,19 +206,19 @@ export default {
</template> </template>
<template #reference="{ issuable }"> <template #reference="{ issuable }">
<span v-safe-html="jiraLogo" class="svg-container jira-logo-container"></span> <span v-safe-html="jiraLogo" class="svg-container jira-logo-container"></span>
<span>{{ issuable.references.relative }}</span> <span v-if="issuable">{{ issuable.references.relative }}</span>
</template> </template>
<template #author="{ author }"> <template #author="{ author }">
<gl-sprintf message="%{authorName} in Jira"> <gl-sprintf message="%{authorName} in Jira">
<template #authorName> <template #authorName>
<gl-link class="author-link js-user-link" target="_blank" :href="author.webUrl" <gl-link class="author-link js-user-link" target="_blank" :href="author.webUrl">
>{{ author.name }} {{ author.name }}
</gl-link> </gl-link>
</template> </template>
</gl-sprintf> </gl-sprintf>
</template> </template>
<template #status="{ issuable }"> <template #status="{ issuable }">
{{ issuable.status }} <template v-if="issuable"> {{ issuable.status }} </template>
</template> </template>
<template #empty-state> <template #empty-state>
<jira-issues-list-empty-state <jira-issues-list-empty-state
......
...@@ -120,7 +120,7 @@ describe('JiraIssuesListRoot', () => { ...@@ -120,7 +120,7 @@ describe('JiraIssuesListRoot', () => {
describe('when request fails', () => { describe('when request fails', () => {
it.each` it.each`
APIErrorMessage | expectedRenderedErrorMessage APIErrorMessage | expectedRenderedErrorMessage
${'API error'} | ${'API error'} ${'API error'} | ${'An error occurred while loading issues'}
${undefined} | ${'An error occurred while loading issues'} ${undefined} | ${'An error occurred while loading issues'}
`( `(
'calls `createFlash` with "$expectedRenderedErrorMessage" when API responds with "$APIErrorMessage"', 'calls `createFlash` with "$expectedRenderedErrorMessage" when API responds with "$APIErrorMessage"',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment