chore: Configure API channel name and thumbnail (#2398)

This commit is contained in:
Pranav Raj S
2021-06-08 00:22:36 +05:30
committed by GitHub
parent 9e56565a30
commit 1ebab21cfa
7 changed files with 37 additions and 14 deletions

View File

@@ -21,7 +21,9 @@ class DashboardController < ActionController::Base
'PRIVACY_URL', 'PRIVACY_URL',
'DISPLAY_MANIFEST', 'DISPLAY_MANIFEST',
'CREATE_NEW_ACCOUNT_FROM_DASHBOARD', 'CREATE_NEW_ACCOUNT_FROM_DASHBOARD',
'CHATWOOT_INBOX_TOKEN' 'CHATWOOT_INBOX_TOKEN',
'API_CHANNEL_NAME',
'API_CHANNEL_THUMBNAIL'
).merge( ).merge(
APP_VERSION: Chatwoot.config[:version] APP_VERSION: Chatwoot.config[:version]
) )

View File

@@ -31,8 +31,9 @@
} }
img { img {
width: 50%;
@include margin($space-normal auto); @include margin($space-normal auto);
flex: 1;
width: 50%;
} }
.channel__title{ .channel__title{

View File

@@ -17,9 +17,13 @@
src="~dashboard/assets/images/channels/telegram.png" src="~dashboard/assets/images/channels/telegram.png"
/> />
<img <img
v-if="channel.key === 'api'" v-if="channel.key === 'api' && !channel.thumbnail"
src="~dashboard/assets/images/channels/api.png" src="~dashboard/assets/images/channels/api.png"
/> />
<img
v-if="channel.key === 'api' && channel.thumbnail"
:src="channel.thumbnail"
/>
<img <img
v-if="channel.key === 'email'" v-if="channel.key === 'email'"
src="~dashboard/assets/images/channels/email.png" src="~dashboard/assets/images/channels/email.png"

View File

@@ -29,16 +29,6 @@ export default {
}, },
data() { data() {
return { return {
channelList: [
{ key: 'website', name: 'Website' },
{ key: 'facebook', name: 'Facebook' },
{ key: 'twitter', name: 'Twitter' },
{ key: 'twilio', name: 'Twilio' },
{ key: 'email', name: 'Email' },
{ key: 'api', name: 'API' },
{ key: 'telegram', name: 'Telegram' },
{ key: 'line', name: 'Line' },
],
enabledFeatures: {}, enabledFeatures: {},
}; };
}, },
@@ -46,8 +36,26 @@ export default {
account() { account() {
return this.$store.getters['accounts/getAccount'](this.accountId); return this.$store.getters['accounts/getAccount'](this.accountId);
}, },
channelList() {
const { apiChannelName, apiChannelThumbnail } = this.globalConfig;
return [
{ key: 'website', name: 'Website' },
{ key: 'facebook', name: 'Facebook' },
{ key: 'twitter', name: 'Twitter' },
{ key: 'twilio', name: 'Twilio' },
{ key: 'email', name: 'Email' },
{
key: 'api',
name: apiChannelName || 'API',
thumbnail: apiChannelThumbnail,
},
{ key: 'telegram', name: 'Telegram' },
{ key: 'line', name: 'Line' },
];
},
...mapGetters({ ...mapGetters({
accountId: 'getCurrentAccountId', accountId: 'getCurrentAccountId',
globalConfig: 'globalConfig/get',
}), }),
}, },
mounted() { mounted() {

View File

@@ -49,7 +49,7 @@
Email Email
</span> </span>
<span v-if="item.channel_type === 'Channel::Api'"> <span v-if="item.channel_type === 'Channel::Api'">
Api {{ globalConfig.apiChannelName || 'API' }}
</span> </span>
</td> </td>

View File

@@ -1,4 +1,6 @@
const { const {
API_CHANNEL_NAME: apiChannelName,
API_CHANNEL_THUMBNAIL: apiChannelThumbnail,
APP_VERSION: appVersion, APP_VERSION: appVersion,
BRAND_NAME: brandName, BRAND_NAME: brandName,
CHATWOOT_INBOX_TOKEN: chatwootInboxToken, CHATWOOT_INBOX_TOKEN: chatwootInboxToken,
@@ -13,6 +15,8 @@ const {
} = window.globalConfig || {}; } = window.globalConfig || {};
const state = { const state = {
apiChannelName,
apiChannelThumbnail,
appVersion, appVersion,
brandName, brandName,
chatwootInboxToken, chatwootInboxToken,

View File

@@ -36,3 +36,7 @@
- name: CHATWOOT_INBOX_HMAC_KEY - name: CHATWOOT_INBOX_HMAC_KEY
value: value:
locked: false locked: false
- name: API_CHANNEL_NAME
value:
- name: API_CHANNEL_THUMBNAIL
value: