archesproject / arches

Arches is a web platform for creating, managing, & visualizing geospatial data. Arches was inspired by the needs of the Cultural Heritage community, particularly the widespread need of organizations to build & manage cultural heritage inventories
GNU Affero General Public License v3.0
211 stars 140 forks source link

`create-vue-application` fails when used with a standalone plugin #10984

Open chrabyrd opened 1 month ago

chrabyrd commented 1 month ago

As of #10976 , create-vue-application fails because it's using arches.urls to fetch its i18n data, but javascript.htm -- which is used to stock the data in the arches component, is not used.

STEPS TO REPRODUCE:

  1. Edit this line in js/utils/create-vue-application.js: from:

    return fetch(arches.urls.api_get_frontend_i18n_data).then(function(resp) {

    to:

    return fetch('/api/get_frontend_i18n_data').then(function(resp) {
  2. Create a standalone plugin. Go through the process of creating a plugin but ensure the config property has

    "is_standalone": true

    as a k/v pair, and ensure component is pointing to a Vue component, eg:

    src/ExampleComponent.vue
  3. Visit the plugin. It will not be listed in the sidebar, so you will need to manually navigate to the plugin. eg localhost:8000/plugins/my-plugin

  4. Notice the component loads successfully.

  5. Now revert this line in js/utils/create-vue-application.js: from:

    return fetch('/api/get_frontend_i18n_data').then(function(resp) {

    to:

    return fetch(arches.urls.api_get_frontend_i18n_data).then(function(resp) {
  6. Notice the component fails to load.

PROPOSED SOLUTION

This will allow developers to access arches from standalone plugins while avoiding duplicating the urls themselves

chrabyrd commented 1 month ago

potentially resolved via removing the feature entirely in https://github.com/archesproject/arches/issues/11001 -- however the proposed solution in this ticket will be implemented