Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[externalComponent] Add persistence support for external component #15223

Conversation

shiqimei
Copy link
Contributor

@shiqimei shiqimei commented Aug 21, 2019

深度截图_选择区域_20190821221305

@shiqimei shiqimei changed the title [WIP] Add persistence support for external component [externalComponent] Add persistence support for external component Aug 21, 2019
@shiqimei shiqimei requested a review from d-gubert August 21, 2019 15:26
@d-gubert
Copy link
Member

Hey @lolimay , apparently the file externalComponent.js has been removed? Is it intended?

import { Meteor } from 'meteor/meteor';

export function setItem(appId, key, value) {
Meteor.call('externalComponentStorage:setItem', appId, key, value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're moving from Meteor Methods to REST endpoints, in an effort to minimize our dependency on Meteor. Please change this approach accordingly :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Will re-implement it with REST API.

@shiqimei
Copy link
Contributor Author

Hey @lolimay, apparently the file externalComponent.js has been removed? Is it intended?

Yeah, I moved externalComponent.js into app/apps/externalComponent folder and change its name to index.js. I also add a new file persistence.js in this folder to keep all externalCompoent related files together. Any suggestions?

@d-gubert
Copy link
Member

Yeah, I moved externalComponent.js into app/apps/externalComponent folder and change its name to index.js. I also add a new file persistence.js in this folder to keep all externalCompoent related files together. Any suggestions?

Oh, I see! It's ok, then :)

@shiqimei shiqimei requested a review from d-gubert August 31, 2019 07:32
import { setItem, getItem, getAll, clear, removeItem } from './persistence';

Meteor.startup(function() {
window.addEventListener('message', async ({ data, source }) => {
Copy link
Member

@d-gubert d-gubert Aug 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment here, we can work on that later on.

I think this part of the code should live in the Apps-Engine, as a AppsEngineUIHost or something similar. Then, we can keep the communication logic in one repo and make sure they are compatible for every Apps-Engine version.

As it is currently implemented, apps would have not only a dependency to the Apps-Engine version, but a dependency to Rocket.Chat's version as well, and things will begin to get "messier", harder to maintain.

Of course, if we move this part into the Apps-Engine, we are going to need some dependencies to be injected in the AppsEngineUIHost class, as it won't have easy access to Meteor variable, for instance, similarly to the bridges used for the server side of the engine. But we are going to benefit from moving away from tight coupling to the Meteor framework, which is a big plus :)

@shiqimei
Copy link
Contributor Author

shiqimei commented Sep 9, 2019

The related changes in the Rocket.Chat.Apps-engine repo is here: RocketChat/Rocket.Chat.Apps-engine#135

@shiqimei shiqimei closed this Oct 18, 2019
@shiqimei shiqimei deleted the Apps-Engine.UI.ExtraComponent.Members branch October 18, 2019 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants