#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Disco.Web.Areas.Config.Views.Expressions
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Web.Helpers;
    using System.Web.Mvc;
    using System.Web.Mvc.Ajax;
    using System.Web.Mvc.Html;
    using System.Web.Routing;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.WebPages;
    using Disco;
    using Disco.Models.Repository;
    using Disco.Services;
    using Disco.Services.Authorization;
    using Disco.Services.Web;
    using Disco.Web;
    using Disco.Web.Extensions;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Expressions/Browser.cshtml")]
    public partial class Browser : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Expressions.BrowserModel>
    {
        public Browser()
        {
        }
        public override void Execute()
        {
            
            #line 2 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
  
    Authorization.Require(Claims.Config.Show);

    ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Expression Browser");
    Html.BundleDeferred("~/Style/jQueryUI/dynatree");
    Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");

            
            #line default
            #line hidden
WriteLiteral("\r\n<div");

WriteLiteral(" id=\"Config_Expressions_Browser\"");

WriteLiteral(">\r\n    Expressions within Disco ICT are based on the <a");

WriteLiteral(" href=\"http://www.springframework.net/\"");

WriteLiteral(" target=\"_blank\"");

WriteLiteral(">Spring.NET Framework</a>. Please refer to the <a");

WriteLiteral(" href=\"http://www.springframework.net/doc-latest/reference/html/expressions.html\"" +
"");

WriteLiteral(" target=\"_blank\"");

WriteLiteral(">Expression Evaluation</a> documentation.\r\n    <h2");

WriteLiteral(" id=\"DeviceScope\"");

WriteLiteral(">\r\n        Device Scope\r\n    </h2>\r\n    <div");

WriteLiteral(" id=\"deviceScopeTree\"");

WriteLiteral(" class=\"expressionTree\"");

WriteLiteral(">\r\n    </div>\r\n    <h2");

WriteLiteral(" id=\"JobScope\"");

WriteLiteral(">\r\n        Job Scope\r\n    </h2>\r\n    <div");

WriteLiteral(" id=\"jobScopeTree\"");

WriteLiteral(" class=\"expressionTree\"");

WriteLiteral(">\r\n    </div>\r\n    <h2");

WriteLiteral(" id=\"UserScope\"");

WriteLiteral(">\r\n        User Scope\r\n    </h2>\r\n    <div");

WriteLiteral(" id=\"userScopeTree\"");

WriteLiteral(" class=\"expressionTree\"");

WriteLiteral(">\r\n    </div>\r\n    <h2");

WriteLiteral(" id=\"Variables\"");

WriteLiteral(">\r\n        Variables\r\n    </h2>\r\n    <div");

WriteLiteral(" id=\"variableScopeTree\"");

WriteLiteral(" class=\"expressionTree\"");

WriteLiteral(">\r\n    </div>\r\n    <h2");

WriteLiteral(" id=\"ExtensionLibraries\"");

WriteLiteral(">\r\n        Extension Libraries\r\n    </h2>\r\n    <div");

WriteLiteral(" id=\"extScopeTree\"");

WriteLiteral(" class=\"expressionTree\"");

WriteLiteral(">\r\n    </div>\r\n");

            
            #line 36 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
    
            
            #line default
            #line hidden
            
            #line 36 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
     if (Model.PluginExtensionLibraries.Any())
    {

            
            #line default
            #line hidden
WriteLiteral("        <h2");

WriteLiteral(" id=\"PluginExtensionLibraries\"");

WriteLiteral(">\r\n            Plugin Extension Libraries\r\n        </h2>\r\n");

WriteLiteral("        <div");

WriteLiteral(" id=\"pluginExtScopeTree\"");

WriteLiteral(" class=\"expressionTree\"");

WriteLiteral(">\r\n        </div>\r\n");

            
            #line 43 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
    }

            
            #line default
            #line hidden
WriteLiteral("</div>\r\n<script");

WriteLiteral(" id=\"expressionBrowserModel\"");

WriteLiteral(" type=\"application/json\"");

WriteLiteral(">\r\n");

            
            #line 46 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
Write(Html.Raw(Json.Encode(Model)));

            
            #line default
            #line hidden
WriteLiteral("\r\n</script>\r\n");

            
            #line 48 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
 using (Html.BeginForm(MVC.API.Expressions.TypeDescriptor(), FormMethod.Post, new { id = "expressionBrowserForm" }))
{
    
            
            #line default
            #line hidden
            
            #line 50 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
Write(Html.AntiForgeryToken());

            
            #line default
            #line hidden
            
            #line 50 "..\..\Areas\Config\Views\Expressions\Browser.cshtml"
                            
}

            
            #line default
            #line hidden
WriteLiteral("<script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(">\r\n    $(function () {\r\n        if (!document.DiscoFunctions) {\r\n            docu" +
"ment.DiscoFunctions = {};\r\n        }\r\n\r\n        const typeLib = {};\r\n        con" +
"st model = JSON.parse($(\'#expressionBrowserModel\').html());\r\n\r\n        function " +
"lazyLoadNode(node) {\r\n            if (node.data.expressionType) {\r\n             " +
"   node.setLazyNodeStatus(DTNodeStatus_Loading);\r\n                loadType(node," +
" node.data.expressionType, node.data.staticMembersOnly);\r\n            } else {\r\n" +
"                if (node.data.memberDescriptor) {\r\n                    loadMembe" +
"r(node);\r\n                } else {\r\n                    node.setLazyNodeStatus(D" +
"TNodeStatus_Ok);\r\n                }\r\n            }\r\n        }\r\n        function " +
"loadMember(memberNode) {\r\n            const previousUpdateMode = memberNode.tree" +
".enableUpdate(false);\r\n            const memberDescriptor = memberNode.data.memb" +
"erDescriptor;\r\n            // Return Type\r\n            memberNode.addChild({ tit" +
"le: \'Returns: \' + memberDescriptor.ReturnType, tooltip: memberDescriptor.ReturnE" +
"xpressionType, isFolder: true, expressionType: memberDescriptor.ReturnExpression" +
"Type, isLazy: true, addClass: \'object\' });\r\n            // Parameters\r\n         " +
"   const parametersNode = memberNode.addChild({ title: \'Parameters\', isFolder: t" +
"rue, addClass: \'parameter\' });\r\n            for (let i = 0; i < memberDescriptor" +
".Parameters.length; i++) {\r\n                const p = memberDescriptor.Parameter" +
"s[i];\r\n                parametersNode.addChild({ title: p.Name + \' [\' + p.Return" +
"Type + \']\', tooltip: p.ReturnExpressionType, addClass: \'object\' });\r\n           " +
" }\r\n            memberNode.setLazyNodeStatus(DTNodeStatus_Ok);\r\n            memb" +
"erNode.tree.enableUpdate(previousUpdateMode);\r\n        }\r\n        function typeL" +
"oaded(parentNode, typeDescriptor) {\r\n            const previousUpdateMode = pare" +
"ntNode.tree.enableUpdate(false);\r\n            for (let i = 0; i < typeDescriptor" +
".Members.length; i++) {\r\n                const memberDescriptor = typeDescriptor" +
".Members[i];\r\n                parentNode.addChild({ title: memberDescriptor.Name" +
", tooltip: memberDescriptor.ReturnType, isFolder: true, addClass: memberDescript" +
"or.Kind, memberDescriptor: memberDescriptor, isLazy: true });\r\n            }\r\n  " +
"          parentNode.setLazyNodeStatus(DTNodeStatus_Ok);\r\n            parentNode" +
".tree.enableUpdate(previousUpdateMode);\r\n        }\r\n\r\n        async function loa" +
"dType(parentNode, type, staticMembersOnly) {\r\n            let typeDef = typeLib[" +
"type];\r\n            if (!typeDef) {\r\n                $form = $(\'#expressionBrows" +
"erForm\');\r\n                const url = $form.attr(\'action\');\r\n                co" +
"nst body = new FormData($form[0]);\r\n                body.append(\'type\', type);\r\n" +
"                if (staticMembersOnly) {\r\n                    body.append(\'stati" +
"cMembersOnly\', staticMembersOnly);\r\n                }\r\n\r\n                const r" +
"esponse = await fetch(url, {\r\n                    method: \'POST\',\r\n             " +
"       body: body\r\n                });\r\n\r\n                if (!response.ok) {\r\n " +
"                   console.error(\'Failed to load type\', response);\r\n            " +
"        return;\r\n                }\r\n\r\n                typeDef = await response.j" +
"son();\r\n\r\n                typeLib[type] = typeDef;\r\n            }\r\n            t" +
"ypeLoaded(parentNode, typeDef);\r\n        }\r\n\r\n        const deviceScopeTree = $(" +
"\'#deviceScopeTree\');\r\n        deviceScopeTree.dynatree({ onLazyRead: lazyLoadNod" +
"e });\r\n        loadType(deviceScopeTree.dynatree(\'getRoot\'), model.DeviceType);\r" +
"\n\r\n        const jobScopeTree = $(\'#jobScopeTree\');\r\n        jobScopeTree.dynatr" +
"ee({ onLazyRead: lazyLoadNode });\r\n        loadType(jobScopeTree.dynatree(\'getRo" +
"ot\'), model.JobType);\r\n\r\n        const userScopeTree = $(\'#userScopeTree\');\r\n   " +
"     userScopeTree.dynatree({ onLazyRead: lazyLoadNode });\r\n        loadType(use" +
"rScopeTree.dynatree(\'getRoot\'), model.UserType);\r\n\r\n        const variableScopeT" +
"ree = $(\'#variableScopeTree\');\r\n        variableScopeTree.dynatree({ onLazyRead:" +
" lazyLoadNode });\r\n        Object.keys(model.Variables).forEach(name => {\r\n     " +
"       const type = model.Variables[name];\r\n            variableScopeTree.dynatr" +
"ee(\'getRoot\').addChild({ title: name, tooltip: type, isFolder: true, addClass: \'" +
"object\', expressionType: type, isLazy: true });\r\n        })\r\n\r\n        const ext" +
"ScopeTree = $(\'#extScopeTree\');\r\n        extScopeTree.dynatree({ onLazyRead: laz" +
"yLoadNode });\r\n        Object.keys(model.ExtensionLibraries).forEach(name => {\r\n" +
"            const type = model.ExtensionLibraries[name];\r\n            extScopeTr" +
"ee.dynatree(\'getRoot\').addChild({ title: name, tooltip: type, isFolder: true, ad" +
"dClass: \'object\', expressionType: type, staticMembersOnly: true, isLazy: true })" +
";\r\n        })\r\n\r\n        const pluginExtScopeTree = $(\'#pluginExtScopeTree\');\r\n " +
"       if (pluginExtScopeTree.length) {\r\n            pluginExtScopeTree.dynatree" +
"({ onLazyRead: lazyLoadNode });\r\n            Object.keys(model.PluginExtensionLi" +
"braries).forEach(name => {\r\n                const type = model.PluginExtensionLi" +
"braries[name];\r\n                pluginExtScopeTree.dynatree(\'getRoot\').addChild(" +
"{ title: name, tooltip: type, isFolder: true, addClass: \'object\', expressionType" +
": type, staticMembersOnly: true, isLazy: true });\r\n            })\r\n        }\r\n  " +
"  });\r\n</script>\r\n");

        }
    }
}
#pragma warning restore 1591
