General Technical Discussions for Service

Get Involved. Join the Conversation.

Topic

    mikewaldron
    time_t's In BUI Extension Paths
    Topic posted April 21, 2019 by mikewaldron Red Ribbon: 250+ Points 
    65 Views, 4 Comments
    Title:
    time_t's In BUI Extension Paths
    Summary:
    Paths to BUI extension components seem to include a time_t in the path - when does this change?
    Content:

    We've started writing a lot of extensions for the Agent Browser UI (BUI), and we've pretty well converged on Vue.js as our Javascript application framework of choice. When building for production, we need to be able to tell Vue's build process where the "publicPath" is. I know how to do this, and I can get the value from Chrome's developer tools in the application tab. However, the path looks like this:

    /AgentWeb/api/agentbrowserui/api/agentBrowserExtensions/1550253505000/browserExtension/mjw%20Testbed

    where the "1550253505000" appears to be a time_t (seconds since the epoch, in this case April 21, 2019 @2237).

    My question is this: When does that path component change? Is it set when an extension is first created and then fixed for that extension's lifetime? That appears to be the case, but I need to know for sure before I commit to relying on it in a production extension.

     

    Comment

     

    • Rajan Davis

      Hi Mike,

      I have built a BUI extension with Vue and am kind of perplexed as to what you're trying to accomplish here.

      You probably don't need this build process unless you are building a full on Vue application. If that is the case, I could be mistaken but I believe that this would need to match whatever comes off of the "/AgentWeb/" url for the Browser UI and not the location of where you BUI code resides (according to the Vue docs).

      If you're just building a single component, you can probably avoid this build step and use something like uglify-js to concatenate and compress your files (that's what I did with my example).

      Again, I could be mistaken, but I think what you're doing is really outside of what was envisioned for BUI, but is very common in non-OSvC platforms. With that said, I am not sure if there is a best practice or right way to do what you're accomplishing, so take what I said with a grain of salt.

      Hope this helps,

      Raj

      • mikewaldron

        Having learned most of this modern Javascript framework jazz within the last year, I can tell you that the frustrating thing about it is there seem to be very few straightforward answers. Typically, even on a platform like StackOverflow, a guy is more likely to hear "Use a different/better/my favorite tool/approach!" than he is to get an answer to the question he asked.

        Thank you for your input, but we're very close to finalizing a develop/build methodology for BUI/Vue.js after ~9 months of work, so I'm less than excited about starting over or making fundamental changes to how we're doing things.

        • Rajan Davis

           I have 2 ideas of what might be a happier path:

          1. Load your bundled scripts into the CP assets folder. The publicPath could then be set as "./euf/assets/themes/<theme-name>/" which avoids some magic timestamp.

          2. Use something like Parcel which requires 0 additional configuration.

          I strongly feel as though relying on some timestamp is a smell... There is probably a much simpler way to accomplish what you're trying to do.

          If you want to talk about this off the boards, send a PM and I can take a look to give better practical advice.

          Kind Regards,

          Raj

          • mikewaldron

            This is a valid point. Let me noodle on it.

            Update: 'pon further consideration, I share your concern that relying on a timestamp is a smell. But that's kind of my original question, restated: I know I can get to those extension components using the path that apparently includes a timestamp, but I'm nervous about counting on that in an extension that's being deployed to production. Really, I'd be happier if there was some kind of path like

            /AgentWeb/api/agentbrowserui/api/agentBrowserExtensions/LATEST/browserExtension/mjw%20Testbed

            I could use that would always point to the most-recently-deployed version of the extension. I haven't found such a thing in the documentation, but if it existed, that would put my mind on the issue to rest.

            I'll take a look at Parcel, but I'm also not comfortable using the CP assets folder for something that's not actually a CP asset.