maikelm
maikelm

Reputation: 403

Create a new page in dashboard designer in WSO2 DAS

I try to create a new page inside dashboard designer jaggery application in Data Analytic Server (DAS) of wso2. For this purpose I add in /themes/template a new template, in this case delete-gadget.jag, I add a new controller in /controllers with the same name delete-gadget.jag. In /themes/template I update the index.jag and add a new link for the delete-gaget.jag. When clicked this link the application say 404.

This is my code:

in /controllers/delete-gadget.jag:

<%
(function() {
    if (!user) {
        sendLogin();
        return;
    }

    if(userDomain !== (urlDomain || superDomain)) {
        response.sendError(401, 'designer access not authorized of this tenant');
        return;
    }
	
	var configs = require('/configs/designer.json');

    if (!utils.allowed(user.roles, configs.designers)) {
        response.sendError(401, 'designer access not authorized');
        return;
    }

    include(utils.resolvePath('templates/delete-gadget.jag'));
} ()); %>

Add the new link in /themes/template/index.jag:

<li><a href="<%=tenantedUrlPrefix%>delete-gadget">
    <span class="fw-stack">
    <i class="fw fw-ring fw-stack-2x"></i>
    <i class="fw fw-delete fw-stack-1x"></i>
    </span> <%= i18n.localize("delete.gadget.lable")%></a>
 </li>

enter image description here

When I clik in this link:

enter image description here

Upvotes: 2

Views: 159

Answers (1)

yeiniel
yeiniel

Reputation: 2456

You need to add the route definition on the jaggery.conf file at the root folder of the jaggery application. In your case is the file <WSO2DAS_HOME>/repository/deployment/server/jaggeryapps/portal/jaggery.conf. I recommend you start by duplicating the entry for creating a new gadget and then making the relevant changes. In your case it will be adding on the urlMappings list the following item:

{
  "url": "/create-gadget",
  "path": "/routers/tenant.jag"
},

Upvotes: 2

Related Questions