From d7f5295949de0679c5157207d18d140e7bc7dc3a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 18 Aug 2017 18:40:00 +0100 Subject: [PATCH 1/4] untested WIP for supporting multiple widgets properly --- src/ScalarAuthClient.js | 5 ++++- src/components/views/elements/AppTile.js | 2 +- src/components/views/rooms/AuxPanel.js | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ScalarAuthClient.js b/src/ScalarAuthClient.js index b1d17b93a9..dddd01b9f9 100644 --- a/src/ScalarAuthClient.js +++ b/src/ScalarAuthClient.js @@ -76,10 +76,13 @@ class ScalarAuthClient { return defer.promise; } - getScalarInterfaceUrlForRoom(roomId, screen) { + getScalarInterfaceUrlForRoom(roomId, screen, id) { var url = SdkConfig.get().integrations_ui_url; url += "?scalar_token=" + encodeURIComponent(this.scalarToken); url += "&room_id=" + encodeURIComponent(roomId); + if (id) { + url += '&integ_id=' + id; + } if (screen) { url += '&screen=' + encodeURIComponent(screen); } diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index a78b802ad7..72cba73075 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -122,7 +122,7 @@ export default React.createClass({ _onEditClick: function(e) { console.log("Edit widget ID ", this.props.id); const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); - const src = this._scalarClient.getScalarInterfaceUrlForRoom(this.props.room.roomId, 'type_' + this.props.type); + const src = this._scalarClient.getScalarInterfaceUrlForRoom(this.props.room.roomId, 'type_' + this.props.type, this.props.id); Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, { src: src, }, "mx_IntegrationsManager"); diff --git a/src/components/views/rooms/AuxPanel.js b/src/components/views/rooms/AuxPanel.js index 8fa805d3cf..69fe209580 100644 --- a/src/components/views/rooms/AuxPanel.js +++ b/src/components/views/rooms/AuxPanel.js @@ -129,7 +129,10 @@ module.exports = React.createClass({ ); let appsDrawer = null; + let appCount = 0; if(UserSettingsStore.isFeatureEnabled('matrix_apps') && this.props.showApps) { + const appsStateEvents = this.props.room.currentState.getStateEvents('im.vector.modular.widgets'); + if (appsStateEvents) appCount = appsStateEvents.length; appsDrawer = +
{ appsDrawer } { fileDropTarget } { callView } From b7569a983158b756b60a4a7fd94ed83f0d8b0ca7 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Mon, 21 Aug 2017 15:29:11 +0100 Subject: [PATCH 2/4] Revert auxPanel changes (this should already have been fixed in a separate PR). --- src/components/views/rooms/AuxPanel.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/views/rooms/AuxPanel.js b/src/components/views/rooms/AuxPanel.js index 69fe209580..a50743a25d 100644 --- a/src/components/views/rooms/AuxPanel.js +++ b/src/components/views/rooms/AuxPanel.js @@ -129,10 +129,7 @@ module.exports = React.createClass({ ); let appsDrawer = null; - let appCount = 0; if(UserSettingsStore.isFeatureEnabled('matrix_apps') && this.props.showApps) { - const appsStateEvents = this.props.room.currentState.getStateEvents('im.vector.modular.widgets'); - if (appsStateEvents) appCount = appsStateEvents.length; appsDrawer = +
{ appsDrawer } { fileDropTarget } { callView } From 74ab7c9bb3713894e4f57213dcd903574877ea12 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 22 Aug 2017 09:59:27 +0100 Subject: [PATCH 3/4] Fix encoding --- src/ScalarAuthClient.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScalarAuthClient.js b/src/ScalarAuthClient.js index dddd01b9f9..0b753cf3ab 100644 --- a/src/ScalarAuthClient.js +++ b/src/ScalarAuthClient.js @@ -81,7 +81,7 @@ class ScalarAuthClient { url += "?scalar_token=" + encodeURIComponent(this.scalarToken); url += "&room_id=" + encodeURIComponent(roomId); if (id) { - url += '&integ_id=' + id; + url += '&integ_id=' + encodeURIComponent(id); } if (screen) { url += '&screen=' + encodeURIComponent(screen); From a69cc9169fcd45d4d97970991c4d9db95f7b2f2d Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 22 Aug 2017 10:04:57 +0100 Subject: [PATCH 4/4] lint fix. --- src/components/views/elements/AppTile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 72cba73075..4883bcf6b1 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -122,7 +122,8 @@ export default React.createClass({ _onEditClick: function(e) { console.log("Edit widget ID ", this.props.id); const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); - const src = this._scalarClient.getScalarInterfaceUrlForRoom(this.props.room.roomId, 'type_' + this.props.type, this.props.id); + const src = this._scalarClient.getScalarInterfaceUrlForRoom( + this.props.room.roomId, 'type_' + this.props.type, this.props.id); Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, { src: src, }, "mx_IntegrationsManager");