/
MultipleIntegrationHooks.vue
107 lines (107 loc) 路 2.64 KB
/
MultipleIntegrationHooks.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
<div class="row ">
<div class="small-8 columns with-right-space ">
<table v-if="hasConnectedHooks" class="woot-table">
<thead>
<th v-for="hookHeader in hookHeaders" :key="hookHeader">
{{ hookHeader }}
</th>
<th v-if="isHookTypeInbox">
{{ $t('INTEGRATION_APPS.LIST.INBOX') }}
</th>
</thead>
<tbody>
<tr v-for="hook in hooks" :key="hook.id">
<td
v-for="property in hook.properties"
:key="property"
class="hook-item"
>
{{ property }}
</td>
<td v-if="isHookTypeInbox" class="hook-item">
{{ inboxName(hook) }}
</td>
<td class="button-wrapper">
<woot-button
v-tooltip.top="$t('INTEGRATION_APPS.LIST.DELETE.BUTTON_TEXT')"
variant="smooth"
color-scheme="alert"
size="tiny"
icon="dismiss-circle"
class-names="grey-btn"
@click="$emit('delete', hook)"
>
</woot-button>
</td>
</tr>
</tbody>
</table>
<p v-else class="no-items-error-message">
{{
$t('INTEGRATION_APPS.NO_HOOK_CONFIGURED', {
integrationId: integration.id,
})
}}
</p>
</div>
<div class="small-4 columns">
<p>
<b>{{ integration.name }}</b>
</p>
<p
v-html="
$t(
`INTEGRATION_APPS.SIDEBAR_DESCRIPTION.${integration.name.toUpperCase()}`,
{ installationName: globalConfig.installationName }
)
"
/>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import hookMixin from './hookMixin';
export default {
mixins: [hookMixin],
props: {
integration: {
type: Object,
default: () => ({}),
},
},
computed: {
...mapGetters({
globalConfig: 'globalConfig/get',
}),
hookHeaders() {
return this.integration.visible_properties;
},
hooks() {
if (!this.hasConnectedHooks) {
return [];
}
const { hooks } = this.integration;
return hooks.map(hook => ({
...hook,
id: hook.id,
properties: this.hookHeaders.map(property =>
hook.settings[property] ? hook.settings[property] : '--'
),
}));
},
},
mounted() {},
methods: {
inboxName(hook) {
return hook.inbox ? hook.inbox.name : '';
},
},
};
</script>
<style scoped lang="scss">
.hook-item {
word-break: break-word;
}
</style>