gerlowskija commented on PR #2050:
URL: https://github.com/apache/solr/pull/2050#issuecomment-1804329062

   Alright, made some good progress here:
   1. The generated JS client is is produced via the `solr:api:buildJSClient` 
task, and `assemblePackaging` now copies the generated JS files into a sub-dir 
of the webapp's `libs/` directory.  So the Admin UI _should_ be able to access 
it, if it can find the right way to import it (see below)
   2. I've picked "Delete Collection" as a good example for dogfooding the new 
client.  (I chose this mostly because it's a simple API call that the Admin UI 
only makes in a single place). The latest commit swaps in some code to delete 
collections using our new client, and it looks very manageable.
   
   But....
   
   I'm struggling to actually test this because **I can't figure out how to 
correctly import the library/module**. 😬   I've added a script tag (`<script 
type="module" src="libs/solr/index.js"></script>`) to 
`solr/webapp/web/index.html`, which seems like it finds the generated JS code.  
But loading the main page of the Admin UI triggers a long run of import errors 
in the console:
   
   ```
   Failed to load resource: the server responded with a status of 404 (Not 
Found)        ApiClient:1
   Failed to load resource: the server responded with a status of 404 (Not 
Found).       BackupDeletionData:1
   Failed to load resource: the server responded with a status of 404 (Not 
Found)        AddReplicaPropertyRequestBody:1
   ...
   ```
   
   It looks like these errors correspond to imports near the top of 
`libs/solr/index.js`.  One thing that jumps out at me in those errors is that 
it looks like we're importing the right filenames/paths, but with the 
file-extension missing entirely.  Not sure what to make of that, but figured it 
might ring a bell for someone with more JS experience.
   
   Possibly related, the README produced with the generated client includes 
some instructions on building and publishing the JS code as an NPM package.  We 
don't run a Node server or use npm in the Admin UI as far as I can tell, so I 
was hoping that we could avoid any sort of "packaging", beyond copying the JS 
files into the webapp's `lib/` directory as I've done.  But maybe that's the 
root of the problems above in some way.
   
   Would love some help from anyone more familiar with JS (and maybe Node) 
development.  Maybe @janhoy or @MarcusSorealheis if either of you get a few 
minutes?  We're so close to getting this in, I hate to see this blocked so near 
to the finish line.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to