Smart UI commands - implementing the open classic view example

Hi,

Really hoping that someone in the know reads this and responds. I'm trying to implement a Smart UI command. For my needs, I am using the open.classic.command from the Smart UI SDK sample (Content Server 21.4, btw). I'm integrating with another smart UI extension that adds a Vue dialog to the interface which I don't want to interfere with, so generating a <mymodule>-all.js file is what I'm trying to avoid.

The existing extensions work and I have them deployed in OTHome\support\<mymodule>\smartui\bundles, and I have a <mymodule>-extensions.json file in OTHome\support\<mymodule>\smartui\. The sample code came from

CSUI SDK Home\samples\commands\open.classic

I tried two approaches to this:

1) Don't use existing <mymodule>-index.json and <mymodule>-all.js

2) use the existing and add the sample code to <mymodule>-all.js and add to the list in <mymodule>-index.js

Neither approach gave me a command, but in both approaches I can see my open.classic JS files being loaded (I put console.log() statements in them both).

For the first use case, I added to my <mymodule>-extensions.json file as per the readme in the sample code folder. I then added the contents of the open.classic folder under OTHome\support\<mymodule>\smartui\commands.

For the second use case, I added the two extensions from open.classic to the <mymodule>-index.json file in the bundles directory and added the code to both to the <mymodule>-all.js file in my bundle.

In both examples, I see any console.log() statements in the Javascript that I may add, so they are being loaded in both scenarios, but the command is never being added. I even added a default enabled method to the open.classic.command.js file to so I could make it conditional. It never gets called.

So the overarching question is this: what am I missing? Assuming I'm not missing anything, is there anything missing from the sample code? Should the sample code not have an enabled method? If not, why not?

Thanks in advance

-Hugh

Tagged:

Comments

  • PS I took another sample command, the Hello command and same thing as with the open.classic - I see it loading the JS for the command JS but I never see the command itself being invoked. I also never see the enabled: method on the Hello ever get called (the open.classic.command has no enabled method surprisingly).

    -Hugh

  • Hi Jan,

    I appreciate the posting. This is far more comprehensive than ANY documentation I've found on smart UI from OpenText (@OpenText, are you listening?). However, I'm still getting the same results as with the approaches I had already tried. That is, I can see that the JS code for the command does get executed (well, loaded as I have a log statement in the function body to indicate that at least it's running the file).

    As with my previous attempts, I never ever see anything show up in the commands list. There appears to be something else. Can anyone tell me where I should be looking for a command to register itself and where I can review that registry? This appears to be in JS not Oscript.

    -Hugh

  • I got a little further with this. I didn't get the open.classic example to work but I did get the rename example to work. To make it work, I had to in my source use define and require which then get replaced with csui.define, and csui.require in <module>-all.js

    The really odd thing was that anything in the impl folder in the rename example had to be copied directly across to my OTHome\support\<module> directory under commands, and there I had to manually replace define and require. I now recall, and will try this next....I probably have to add all the files in the impl like rename.view.js to the template <module>-all.js.

    Once I see that all working, the next step will be to figure out how to combine with an existing <module>-all.js that has vue code.

    -Hugh

  • Ferdinand Prantl
    Ferdinand Prantl E Community Moderator

    If you want to introduce a new command, you have to add it to some Smart UI extension. You can use libraries like Vue and load their build output with or without RequireJS, but you will not be able to avoid exposing the features with -all.js and -index.json in a Smart UI project. If you want the feature written with View only on a particular page, you can try wrapping in in a WebReport widget.

    The sample source files are not supposed to be deployed to support like OTHome\support\<mymodule>\smartui\commands. The RequireJS optimiser introduces the csui namespace and module names exzcept for bundling all sources to -all.js. While it is possible to prepare a build output meant to be consumed by the productive application, it does not make sense from performance reasons.

    The sample code is supposed to be copied to a Smart UI project and the module names renamed accordingly. The Smart UI project can be built and deployed as usual. Every example should include a documentation file describing it.

    If you compile the Vue output to AMD/ES5, you will be able to include it as other RequireJS modules. Otherwise you can insert the .js and .css assets to document.head by a custom code in a RequireJS module.


  • Hello All,

    I was able to get v21.4.0 SmartUI SDK generator working and make the OScript Module.

    I then was able to get the Open Classic Page 'sample' working and I was able also able to remove a bunch of junk from the Smart UI from this post:

    https://forums.opentext.com/forums/developer/discussion/310029/smart-view-action-bar-changes



    -MC