diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 1d18d31ef92382a2ac30d5dd485734ed7c9739f6..6500fda913b10097ab826641ca9a7a211857e7eb 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -267,6 +267,7 @@ "BotHelpers_userFields": "User Fields", "BotHelpers_userFields_Description": "CSV of user fields that can be accessed by bots helper methods.", "Branch": "Branch", + "Broadcast_Connected_Instances": "Broadcast Connected Instances", "Bugsnag_api_key": "Bugsnag API Key", "busy": "busy", "Busy": "Busy", @@ -362,6 +363,7 @@ "CROWD_Reject_Unauthorized": "Reject Unauthorized", "CRM_Integration": "CRM Integration", "Current_Chats": "Current Chats", + "Current_Status": "Current Status", "Custom": "Custom", "Custom_Emoji": "Custom Emoji", "Custom_Emoji_Add": "Add New Emoji", @@ -706,6 +708,7 @@ "Install_FxOs_follow_instructions": "Please confirm the app installation on your device (press \"Install\" when prompted).", "Installation": "Installation", "Installed_at": "Installed at", + "Instance_Record": "Instance Record", "Instructions_to_your_visitor_fill_the_form_to_send_a_message": "Instructions to your visitor fill the form to send a message", "Impersonate_user": "Impersonate User", "Impersonate_user_description": "When enabled, integration posts as the user that triggered integration", @@ -1256,6 +1259,7 @@ "Reset_password": "Reset password", "Restart": "Restart", "Restart_the_server": "Restart the server", + "Retry_Count": "Retry Count", "Role": "Role", "Role_Editing": "Role Editing", "Role_removed": "Role removed", @@ -1560,6 +1564,7 @@ "Unread_Rooms": "Unread Rooms", "Unread_Rooms_Mode": "Unread Rooms Mode", "Unstar_Message": "Remove Star", + "Updated_at": "Updated at", "Upload_file_description": "File description", "Upload_file_name": "File name", "Upload_file_question": "Upload file?", @@ -1719,4 +1724,4 @@ "your_message_optional": "your message (optional)", "Your_password_is_wrong": "Your password is wrong!", "Your_push_was_sent_to_s_devices": "Your push was sent to %s devices" -} \ No newline at end of file +} diff --git a/packages/rocketchat-ui-admin/client/adminInfo.coffee b/packages/rocketchat-ui-admin/client/adminInfo.coffee index 51cea0151143e0ea030a56660898f75a0c0f4049..1bfaedf4c899ec0fda22f0cc9d51990bd139fa6f 100644 --- a/packages/rocketchat-ui-admin/client/adminInfo.coffee +++ b/packages/rocketchat-ui-admin/client/adminInfo.coffee @@ -5,6 +5,8 @@ Template.adminInfo.helpers return Template.instance().ready.get() statistics: -> return Template.instance().statistics.get() + instances: -> + return Template.instance().instances.get() inGB: (size) -> if size > 1073741824 return _.numberFormat(size / 1024 / 1024 / 1024, 2) + ' GB' @@ -52,13 +54,20 @@ Template.adminInfo.onRendered -> Template.adminInfo.onCreated -> instance = @ @statistics = new ReactiveVar {} + @instances = new ReactiveVar [] @ready = new ReactiveVar false if RocketChat.authz.hasAllPermission('view-statistics') Meteor.call 'getStatistics', (error, statistics) -> - instance.ready.set true if error handleError(error) else instance.statistics.set statistics + Meteor.call 'instances/get', (error, instances) -> + instance.ready.set true + if error + handleError(error) + else + instance.instances.set instances + diff --git a/packages/rocketchat-ui-admin/client/adminInfo.html b/packages/rocketchat-ui-admin/client/adminInfo.html index e3d5358d08ebf8ff3b1168349e6ea421d504f01a..c900a7c6dac682b4b03ce3be339b1d69a33a759b 100644 --- a/packages/rocketchat-ui-admin/client/adminInfo.html +++ b/packages/rocketchat-ui-admin/client/adminInfo.html @@ -226,6 +226,50 @@ </tr> </table> + {{#if instances}} + <h3>{{_ "Broadcast_Connected_Instances"}}</h3> + {{#each instances}} + <table class="statistics-table secondary-background-color"> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Address"}}</th> + <td class="border-component-color">{{address}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Auth"}}</th> + <td class="border-component-color">{{broadcastAuth}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Current_Status"}} > {{_ "Connected"}}</th> + <td class="border-component-color">{{currentStatus.connected}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Current_Status"}} > {{_ "Retry_Count"}}</th> + <td class="border-component-color">{{currentStatus.retryCount}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Current_Status"}} > {{_ "Status"}}</th> + <td class="border-component-color">{{currentStatus.status}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Instance_Record"}} > {{_ "ID"}}</th> + <td class="border-component-color">{{instanceRecord._id}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Instance_Record"}} > {{_ "PID"}}</th> + <td class="border-component-color">{{instanceRecord.pid}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Instance_Record"}} > {{_ "Created_at"}}</th> + <td class="border-component-color">{{formatDate instanceRecord._createdAt}}</td> + </tr> + <tr class="admin-table-row"> + <th class="content-background-color border-component-color">{{_ "Instance_Record"}} > {{_ "Updated_at"}}</th> + <td class="border-component-color">{{formatDate instanceRecord._updatedAt}}</td> + </tr> + </table> + {{/each}} + {{/if}} + <button type="button" class="button primary refresh">Refresh</button> {{else}} {{_ "Loading..."}} diff --git a/packages/rocketchat-ui/client/lib/fileUpload.coffee b/packages/rocketchat-ui/client/lib/fileUpload.coffee index 55507fe06189668c34d6907074167a26b5f58fe6..e4494b7d78683b94332b90b20b9f7b2505f282f0 100644 --- a/packages/rocketchat-ui/client/lib/fileUpload.coffee +++ b/packages/rocketchat-ui/client/lib/fileUpload.coffee @@ -9,6 +9,8 @@ getUploadPreview = (file, callback) -> # If greater then 10MB don't try and show a preview if file.file.size > 10 * 1000000 callback(file, null) + else if not file.file.type? + callback(file, null) else if file.file.type.indexOf('audio') > -1 or file.file.type.indexOf('video') > -1 or file.file.type.indexOf('image') > -1 file.type = file.file.type.split('/')[0] diff --git a/server/stream/streamBroadcast.js b/server/stream/streamBroadcast.js index 6de334e34b95565b97435f040812b28d5fcf95fc..b9b43639eae8cabb9e1bd0aad6d8282f14b9daed 100644 --- a/server/stream/streamBroadcast.js +++ b/server/stream/streamBroadcast.js @@ -257,3 +257,18 @@ function startStreamBroadcast() { Meteor.startup(function() { return startStreamBroadcast(); }); + +Meteor.methods({ + 'instances/get'() { + if (!RocketChat.authz.hasPermission(Meteor.userId(), 'view-statistics')) { + throw new Meteor.Error('error-action-not-allowed', 'List instances is not allowed', { + method: 'instances/get' + }); + } + + return Object.keys(connections).map(address => { + const conn = connections[address]; + return Object.assign({ address, currentStatus: conn._stream.currentStatus }, _.pick(conn, 'instanceRecord', 'broadcastAuth')); + }); + } +});