-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSelectSlackChannel.vue
More file actions
82 lines (78 loc) · 2.12 KB
/
SelectSlackChannel.vue
File metadata and controls
82 lines (78 loc) · 2.12 KB
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
<!--
Matomo - free/libre analytics platform
@link https://matomo.org
@license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
-->
<template>
<div class='slack'>
<Field
uicontrol="text"
name="channelID"
:title="translate('Slack_ChannelId')"
class="slack"
:model-value="modelValue"
:disabled="!isSlackOauthTokenAdded"
@update:model-value="$emit('update:modelValue', $event)"
>
<template v-slot:inline-help>
<div id="slackChannelIDHelp" class="inline-help-node">
<span
v-if="!isSlackOauthTokenAdded"
style="margin-right:3.5px"
v-html="$sanitize(getSlackOAuthTokenNotAddedHelpText)"
>
</span>
<span
v-else
v-html="$sanitize(getSlackChannelHelpText)"
>
</span>
</div>
</template>
</Field>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { MatomoUrl, translate, externalLink } from 'CoreHome';
import { Field } from 'CorePluginsAdmin';
export default defineComponent({
props: {
modelValue: String,
isSlackOauthTokenAdded: {
type: Boolean,
default: false,
},
withIntroduction: Boolean,
},
emits: ['update:modelValue'],
components: {
Field,
},
methods: {
linkTo(params: QueryParameters) {
return `?${MatomoUrl.stringify({
...MatomoUrl.urlParsed.value,
...params,
})}`;
},
},
computed: {
getSlackOAuthTokenNotAddedHelpText() {
const link = this.linkTo({ module: 'CoreAdminHome', action: 'generalSettings', updated: null });
return translate(
'Slack_NoOauthTokenAdded',
`<a href="${link}#/Slack" rel="noreferrer noopener" target="_blank">`,
'</a>',
);
},
getSlackChannelHelpText() {
return translate(
'Slack_SlackEnterYourSlackChannelIdHelpText',
externalLink('https://matomo.org/faq/reports/how-to-integrate-slack-for-scheduled-reports/#step-2-set-up-slack-in-matomo'),
'</a>',
);
},
},
});
</script>