Commit c55eb51e authored by Justin Ho's avatar Justin Ho

Fix loading state of Link / Unlink buttons

- Do not reset loading state since page will reload anyway
- Fix styling of subscriptions table
parent 55762458
...@@ -55,8 +55,6 @@ export default { ...@@ -55,8 +55,6 @@ export default {
error?.response?.data?.error || error?.response?.data?.error ||
s__('Integrations|Failed to link namespace. Please try again.'), s__('Integrations|Failed to link namespace. Please try again.'),
); );
})
.finally(() => {
this.isLoading = false; this.isLoading = false;
}); });
}, },
......
...@@ -20,6 +20,11 @@ export default { ...@@ -20,6 +20,11 @@ export default {
default: [], default: [],
}, },
}, },
data() {
return {
loadingItem: null,
};
},
fields: [ fields: [
{ {
key: 'name', key: 'name',
...@@ -28,11 +33,12 @@ export default { ...@@ -28,11 +33,12 @@ export default {
{ {
key: 'created_at', key: 'created_at',
label: __('Added'), label: __('Added'),
tdClass: 'gl-vertical-align-middle!', tdClass: 'gl-vertical-align-middle! gl-w-20p',
}, },
{ {
key: 'actions', key: 'actions',
label: '', label: '',
tdClass: 'gl-text-right gl-vertical-align-middle! jira-subscription-actions',
}, },
], ],
i18n: { i18n: {
...@@ -44,12 +50,15 @@ export default { ...@@ -44,12 +50,15 @@ export default {
methods: { methods: {
isEmpty, isEmpty,
onClick(item) { onClick(item) {
this.loadingItem = item;
removeSubscription(item.unlink_path) removeSubscription(item.unlink_path)
.then(() => { .then(() => {
reloadPage(); reloadPage();
}) })
.catch(() => {}); .catch(() => {
return item; this.loadingItem = null;
});
}, },
}, },
}; };
...@@ -70,9 +79,12 @@ export default { ...@@ -70,9 +79,12 @@ export default {
<timeago-tooltip :time="item.created_at" /> <timeago-tooltip :time="item.created_at" />
</template> </template>
<template #cell(actions)="{ item }"> <template #cell(actions)="{ item }">
<gl-button category="secondary" :loading="false" @click.prevent="onClick(item)">{{ <gl-button
__('Unlink') category="secondary"
}}</gl-button> :loading="loadingItem === item"
@click.prevent="onClick(item)"
>{{ __('Unlink') }}</gl-button
>
</template> </template>
</gl-table> </gl-table>
</div> </div>
......
...@@ -100,3 +100,7 @@ svg { ...@@ -100,3 +100,7 @@ svg {
} }
} }
} }
.jira-subscription-actions {
width: 88px;
}
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