Developing admin plugin

Vote:
 

Hi!

We have developed an admin plugin, which I have packaged as a nuget package. I am trying to make it work in another project, but it can't find the aspx-file. Where should I put the file? I have tried to put it in the root, in the modules/protected folder etc. But I get 404.

Could someone please post an example of how the nuspec should be configured and how the Url should be set in the GuiPlugin attribute, thanks.

nuspec:

<file src="Views\<folder>\Index.aspx" target="content\modules\_protected\<folder>\" />

Controller:

[GuiPlugIn(Url = ""

#204768
Jun 17, 2019 13:55
Vote:
 

Hey Torunn,

Have you checked out this documentation regarding creating addons? Some things to try:

  1. When adding the file to nuspec, make sure to include the full target path
    <file src="Views\<folder>\Index.aspx" target="Content\modules\_protected\<folder>\Views\Index.aspx" />
  2. There is a GuidPluginAttribute property UrlFromModuleFolder that will look for a url relative to the modules folder.
  3. Make sure your package contains a module.config that specifies the package name that will be added to the modules/_protected folder

For debugging I would try first updating your nuspec file and making sure that the Index.aspx and whatever other view files you have are correctly added to the modules/_protected folder first. Once you confirm that, if you are still getting 404 errors, you can see if you GuiPlugin attribute properties need to be updated.

If that doesn't work let us know.

#204782
Jun 17, 2019 22:56
Vote:
 

Thanks, David, the module.config file helped. Now it finds the view, but the model used in the view is null. Could it be because it doesn't find the controller? I tried adding som routing in the module.config with no luck.

#204792
Jun 18, 2019 12:08
Vote:
 

Its hard to say without seeing more of the code. Some things I would suggest checking out:

  1. Make sure your controller has the write plugin and authorization attributes
  2. Verify your routing in the module.config. Especially if you are using things like controller prefixes. It should look something like the following for the controller NansenCustomAdminPluginController:
    <routes>
        <route controllerPrefix="Nansen">
          <defaults>
            <add key="controller" value="CustomAdminPlugin" />
            <add key="action" value="Index" />
            <add key="id" value="" />
          </defaults>
        </route>
      </routes>​
  3. Since it sounds like its returning your view correctly, I would just double check the logic within your controller to verify that there are not any instances where it would be returning null. Or replacing the existing logic with just assigning default values to the model to rule out any issues with the routing.
#204798
Jun 18, 2019 15:37
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.