« Return to Thread: "supplying JavaScript resources"

Re: "supplying JavaScript resources"

by Max Powers :: Rate this Message:

Reply to Author | View in Thread

There are numerous areas that you can extend the Nexus UI, we really should put together a wiki doc for this, just a matter of time ;)
 
But the simplest contribution, is to introduce a new left navigation item and the panel it opens, which can be done as follows in your javascript file
 
Sonatype.repoServer.MyPanel = function( config ) {
  //your panel config
};
Ext.extend(Sonatype.repoServer.MyPanel, Ext.Panel, {
  //your extension to the Panel object
});
Sonatype.Events.addListener( 'nexusNavigationInit', function( nexusPanel ) {
  nexusPanel.add( {
    enabled: Sonatype.lib.Permissions.checkPermission( 'nexus:myperm', Sonatype.lib.Permissions.READ ),
    sectionId: 'st-nexus-config',
    title: 'My Panel',
    tabId: 'my-panel',
    tabCode: Sonatype.repoServer.MyPanel
  } );
} );
 
This is simply listening for the nexusNavigationInit event, and adding navigation items to the panel
 
You can disregard enabled field if you want always visible or you could tie to existing nexus privilege
sectionId should point to the left nav section you want your item in (you can find them all in repoServer/RepoServer.js)
tabId must be unique
tabCode should be the name of your panel object
 
And of course you have the existing panels we have that you can browse for extjs examples (along w/ the extjs site, which has great samples and documentation)
 
There are other contributions that can be made, but this is probably the one that is most commonly used.
 
Should get you started
Max
 
On Tue, Feb 3, 2009 at 4:32 AM, Tamás Cservenák <tamas@...> wrote:
Hi,

yes. You can stack all of yours "static" resources under
src/main/resources/static (the last part "static" is not mandatory):
http://scm.sonatype.org/repobrowser.svn?path=/trunk/nexus/nexus-core-plugins/nexus-lvo-plugin/src/main/resources/&revision=HEAD&name=Nexus

And then you need to create a NexusResourceBundle component with some
unique hint:
http://scm.sonatype.org/showfile.svn?path=/trunk/nexus/nexus-core-plugins/nexus-lvo-plugin/src/main/java/org/sonatype/nexus/plugins/lvo/LvoResourceBundle.java&revision=HEAD&name=Nexus

The getContributedResouces() will just "mount" it to the 2nd param path.

And you have a set of methods where to "contribute" to the index.xml
(if needed).

About actually extending the UI with JS code I can't tell too much :) Damian?

That's all.

~t~

On Tue, Feb 3, 2009 at 1:34 AM, Edelson, Justin
<Justin.Edelson@...> wrote:
>
> According to https://docs.sonatype.com/display/NX/Nexus+UI+Extension, plugins can extend the UI by "supplying JavaScript resources", but it's not yet obvious to me how one does this. Is there some Plexus magic I need to do?
>
> Thanks,
> Justin

---------------------------------------------------------------------
To unsubscribe, e-mail: nexus-dev-unsubscribe@...
For additional commands, e-mail: nexus-dev-help@...


 « Return to Thread: "supplying JavaScript resources"