Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • kometa 23 posts 76 karma points
    Sep 24, 2019 @ 18:35
    kometa
    0

    Custom dashboard

    Hi,

    Could anybody advise me if it's possible to add a custom dashboard into Umbraco8 using Razor or Web User Control instead of AngularJS?

    Thanks!

  • Casper 70 posts 308 karma points
    Sep 25, 2019 @ 12:29
    Casper
    0

    It is not possible. You don't have to use Angular, your dashboard could be just html. But if you need Umbraco services(witch you probably do) you have to go with Angular in order to use the services you need.

    If you need a boilerplate for creating a dashboard with Angular, then take a look at the modelsbuilder dashboard. You can find it in your Umbraco install -> /App_Plugins/ModelsBuilder/...

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 25, 2019 @ 12:53
    Dave Woestenborghs
    0

    Hi kometa,

    Here you can find a tutorial on how to add a dashboard : https://our.umbraco.com/documentation/Extending/Dashboards/

    I don't know what you want to show. But a dashboard that shows a iframe could be a option.

    Dave

  • kometa 23 posts 76 karma points
    Sep 25, 2019 @ 14:33
    kometa
    0

    Thank you for your suggestions.

    To this new dashboard I need a feature to export data to a .csv file from a custom database table. I'm afraid the iframe solution won't be good :-(

    It seems like my only option is to follow this quide https://our.umbraco.com/documentation/Tutorials/Creating-a-Property-Editor/part-4 but if anyone has a better solution, please advise.

    Thanks!

  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    Sep 26, 2019 @ 06:44
    Søren Kottal
    0

    Hi Kometa

    Basically what you need is the following:

    On your html dashboard, you can place a link for your API controller (like /umbraco/backoffice/yourapi/export).

    You don't need to use Angular for this, except if you need some kind of configuration for your export (and even then, you could still just create a <form> in your html, posting that one to your controller.

  • kometa 23 posts 76 karma points
    Sep 26, 2019 @ 07:09
    kometa
    0

    Thanks Søren! I think, I will go with your suggestion.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 25, 2019 @ 14:36
    Dave Woestenborghs
    0

    I don't think a property editor is the way to go. Property editors are meant for editing content. And you have to use angular for that. And that is something you didn't want if I read your original post

    Why is a iframe not an option ?

    Dave

  • kometa 23 posts 76 karma points
    Sep 25, 2019 @ 14:44
    kometa
    0

    Hi Dave,

    I thought that the iframe solution is not a good one, as it will need a source URL and I wouldn't want to have the export feature accessible from a browser.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 26, 2019 @ 06:18
    Dave Woestenborghs
    0

    Why you think the iframe solution is not a good one. If you want to use a razor view or webforms this is the only option.

    And what you mean with it needs a source url ?

    Dave

  • kometa 23 posts 76 karma points
    Sep 26, 2019 @ 07:17
    kometa
    0

    Hi Dave,

    The iframe code needs a "src" link, which should be linking to an existing page, which means that this page, holding the export feature could be accessed from a web browser, too (and that I would like to avoid).

    Please correct me if I'm wrong.

    Thanks!

  • Graham Davis 110 posts 376 karma points
    Oct 25, 2019 @ 12:49
    Graham Davis
    1

    Hi Kometa,

    You can create a custom dashboard using MVC and Partial Views. Here are the starting pieces you will need to do it.

    You will need to create you dashboard under the App_Plugins folder. Mine is called zpmConfig

    1. You will need a Controller

    [PluginController("zpmConfig")]
    [OutputCache(NoStore = true, Duration = 0)]
    public class zpmConfigController : SurfaceController
    {
        public ActionResult zLayout()
        {
            return PartialView("~/App_Plugins/zpmConfig/Views/shared/zLayout.cshtml");
        }
    }
    

    2. You will need a Starting View (zLayout.cshtml)

        @Html.Partial("~/App_Plugins/zpmConfig/Views/Shared/_RequiredScripts_CDN.cshtml")
    <script src="~/App_Plugins/zpmConfig/scripts/zLayout.js"></script>
    <link href="~/App_Plugins/zpmConfig/Content/zLayout.css" rel="stylesheet" />
    <div id="zbdApp">
        <header>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 col-xl-6">
                        <label id="PageTitle">Website Configuration</label>
                        <div id="PageTitleAccount"></div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 col-xl-6">
                        @Html.Partial("~/App_Plugins/zpmConfig/Views/Shared/_dbButtons.cshtml")
                    </div>
                </div>
            </div>
        </header>
    
        <div class="body-content container-fluid">
            <div id="DataContent">
            </div>
        </div>
        <footer>
            <div class="">
                <div class="row">
                </div>
            </div>
        </footer>
        @Html.Partial("~/App_Plugins/zpmConfig/Views/Shared/_zbdFramework.cshtml")
    </div>
    
    <script>
        $("#DataContent").load("/umbraco/backoffice/Plugins/zpmConfig/zpmConfig/Index");
    </script>
    

    3. In the root folder of your project, create a file named package.manifest

    {
      "sections": [
        {
          "alias": "zpmConfig",
          "name": "Site Setup"
        }
      ],
      "dashboards": [
        {
          "alias": "zpmConfigDashboard",
          "view": "/umbraco/backoffice/Plugins/zpmConfig/zLayout",
          "sections": [ "zpmConfig" ],
          "access": [
            { "grant": "admin" }
          ],
          "weight": 20
        }
      ]
    }
    

    4. When you first Login to the Umbraco backoffice, the new section will not be available to you. Go to Users and assign the permissions to use it.

    enter image description here

    5. Logout, close the browser and then log back into the Umbraco BackOffice. Your new dashboard should be available to you.

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft