Extendable bundle?
Invincible83 opened this issue · 5 comments
Hello,
Is there any way to extend setup
plugin in bundle
? I would like to add a new page with extra settings. However I want to keep the OpenPlatform intact.
I'm thinking something like this:
bundles/openplatform.bundle
plugins/setup/--index.js
plugins/setup/public/mypage.html
Hi @Invincible83,
we have added a small support for extending setup
interface.
Quick summary:
- create a new plugin (your own)
- add a type
exports.type = 'setup';
- and then you should see your plugin in the setup UI
Hello,
Nice. This is extactly what I mean. Is there something else I should do? I'm trying it and this is where I get, as far. (I used the profiles
plugin from openplatform-application for testing)
This is the openplatform directory structure
bundles/openplatform.bundle
plugins/profiles/index.js
plugins/profiles/public/index.html
plugins/profiles/...
index.js
exports.icon = 'ti ti-totaljs';
exports.name = '@(Profiles)';
exports.position = 2;
exports.permissions = [{ id: 'profiles', name: 'Profiles' }];
exports.visible = user => user.sa || user.permissions.includes('profiles');
exports.type = 'setup'; // extends the `setup` plugin
exports.routes = [
{ url: '/profiles/{id}/', html: 'detail' }
];
exports.install = function() {
ROUTE('+API /api/ -profiles *Profiles --> list');
};
It kind of works. I have profiles
link in setup menu. Yet, when I click on it, I get this errors in the console
mytesting.com/_profiles/pages/setup.html?language=en 404 (Not Found)
jC: invalid response for IMPORT("/_profiles/pages/setup.html") [{…}]
Sorry to bother you,
Thank you
I tested it. I don't know about it, but you must move the file /public/index.html
to /public/pages/index.html
and it will work. Be careful with API endpoints, they must be in the form /setup/
.
Can you please upload your testing version?
As far I see, there https://github.com/totaljs/openplatform/blob/master/plugins/setup/index.js#L55-L63 is no obj.routes
even in setup/index.html
it's counting on it. https://github.com/totaljs/openplatform/blob/master/plugins/setup/index.html#L80C1-L86
And there is static setup.html
. I believe this should be index.html
. https://github.com/totaljs/openplatform/blob/master/plugins/setup/index.html#L79
Sure, so I had some time to spare and did some tests. I found that my suspicions were correct. It's the /setup.html
in the component. The second I changed it to /index.html
, it started working.
https://github.com/totaljs/openplatform/blob/master/plugins/setup/index.html#L79C95-L79C112