TerriaJS / plugin-sample

A sample terriajs plugin that adds a mode for drawing 3d boxes
Apache License 2.0
1 stars 1 forks source link

i can't modify plugin sample #10

Open luca-moscatelli opened 4 months ago

luca-moscatelli commented 4 months ago

i followed the guide to modify the plugin in develop but the plugin dosen't appear in the map i use yarn gulp dev and yarn watch the two command works but on the port 3001 i can't see the plugin i don't kwon if i do something wrong

na9da commented 4 months ago

Hi @luca-moscatelli, thank you for reporting the issue.

Could you let me know which platform you are testing this on - Windows or Linux or maxOS ?

On Windows we have a few known issues, we are readying a new release over the next week which will hopefull fix and improve a few things.

luca-moscatelli commented 4 months ago

i'm on windows 10, im also trying to implement an auth system with Auth0, in your opinion what is the best way to implemented ? it is possible change the view of data in catalog item with auth permission with a ad-hoc plugin ? also the plugin It works if it's installed via node-modules (yarn add -W 'terriajs-plugin-sample') only if packages is empty and not contain plugin-samples but this way i can't develop the plugin.

luca-moscatelli commented 4 months ago

i have this error in packages/plugin-sample after yarn watch : : https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency assets/icons/cube.svg (imported by src/index.ts, src/Views/Main.tsx) [!] Error: The keyword 'interface' is reserved (Note that you need plugins to import files that are not JavaScript) ../../node_modules/terriajs/lib/Models/HasLocalData.ts (1:0) 1: interface HasLocalData { ^ 2: hasLocalData: boolean; 3: setFileInput(file: File): void; Error: The keyword 'interface' is reserved (Note that you need plugins to import files that are not JavaScript) at error (C:\Users\LucaMoscatelli\progetti\TerriaMap\node_modules\rollup\dist\shared\rollup.js:198:30) at Module.error (C:\Users\LucaMoscatelli\progetti\TerriaMap\node_modules\rollup\dist\shared\rollup.js:12560:16) at Module.tryParse (C:\Users\LucaMoscatelli\progetti\TerriaMap\node_modules\rollup\dist\shared\rollup.js:12937:25) at Module.setSource (C:\Users\LucaMoscatelli\progetti\TerriaMap\node_modules\rollup\dist\shared\rollup.js:12842:24) at ModuleLoader.addModuleSource (C:\Users\LucaMoscatelli\progetti\TerriaMap\node_modules\rollup\dist\shared\rollup.js:22090:20)

na9da commented 4 months ago

@luca-moscatelli - Yes, that's the error I was expecting in the current version. We have a PR for a new build system that'll hopefully fix this issue in Windows.

As for implementing OAuth - you can see one approach in https://nsw.digitaltwin.terria.io/ which has a login button at the top that pops a new window where the login happens. On successful login the map is refreshed and the catalog returned by the backend server will include the authenticated items.

This was not implemented as a plugin, the plugin API doesn't yet support features required to do this. Instead this was done by forking and customizing terriamap. A login button can for eg be added using the method described in this doc.

And of course, there are also some custom backend elements to handle the authentication.