@******************************************************************************************************* // ModbusConfig.cshtml - Gbtc // // Copyright © 2016, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this // file except in compliance with the License. You may obtain a copy of the License at: // // http://opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 07/08/2016 - J. Ritchie Carroll // Generated original version of source code. // //****************************************************************************************************** // To use in an ASP.NET destination project, include a ModbusConfig.cshtml view with following content: // // @using GSF.Web // @section StyleSheets{@Html.Raw(ViewBag.StyleSheetsSection?.ToString())} // @Html.RenderResource("ModbusAdapters.ModbusConfig.cshtml") // @section Scripts{@Html.Raw(ViewBag.ScriptsSection?.ToString())} // //****************************************************************************************************** // To use in a self-hosted web project, include a ModbusConfig.cshtml view with following content: // // @using GSF.Web.Model // @using .Model // @inherits ExtendedTemplateBase // @section StyleSheets{@Html.Raw(ViewBag.StyleSheetsSection.ToString())} // @{Layout = "Layout.cshtml";} // @Html.RenderResource("ModbusAdapters.ModbusConfig.cshtml") // @section Scripts{@Html.Raw(ViewBag.ScriptsSection.ToString())} // //*****************************************************************************************************@ @* ReSharper disable UnknownCssClass *@ @* ReSharper disable Html.PathError *@ @* ReSharper disable InlineOutVariableDeclaration *@ @* ReSharper disable ArrangeAccessorOwnerBody *@ @using System @using System.Collections.Generic @using System.Net.Http @using GSF @using GSF.Data.Model @using GSF.Security @using GSF.Web @using GSF.Web.Model @using GSF.Web.Shared @using ModbusAdapters.Model @inherits ExtendedTemplateBase @{ const string ModbusRoot = "/@ModbusAdapters"; // Layout will depend on rendering environment, so do not specify one ViewBag.HidePageTitle = true; ViewBag.Title = "Modbus Configuration Editor"; if (ViewBag.ModbusLogo == null) { ViewBag.ModbusLogo = ModbusRoot + "/Images/ModbusConfigEditor.png"; } const string ReadSequencePanelType = "panel-success"; const string WriteSequencePanelType = "panel-warning"; DataContext dataContext = ViewBag.DataContext; HttpRequestMessage request = ViewBag.Request; Dictionary parameters = request.QueryParameters(); string parameter; int deviceID; if (!parameters.TryGetValue("DeviceID", out parameter) || !int.TryParse(parameter, out deviceID)) { deviceID = 0; } parameters.TryGetValue("ShowMenu", out parameter); if (string.IsNullOrEmpty(parameter)) { parameter = "true"; } ViewBag.ShowMenu = parameter.ParseBoolean(); parameters.TryGetValue("HideLogo", out parameter); if (string.IsNullOrEmpty(parameter)) { parameter = "false"; } ViewBag.HideLogo = parameter.ParseBoolean(); bool userIsEditor = UserIsEditor(); } @functions { // This function simply limits access to UI elements that the user does not have access to, server-side // functions will further validate user rights even if UI restriction was somehow bypassed public bool UserIsEditor() { SecurityPrincipal securityPrincipal = ViewBag.SecurityPrincipal as SecurityPrincipal; if ((object)securityPrincipal == null) return false; return securityPrincipal.IsInRole("Administrator") || securityPrincipal.IsInRole("Editor"); } } @section StyleSheets { } @section Scripts { }

Modbus Configuration Map Builder Instance:
@if (!ViewBag.HideLogo) { }

@* Connection Settings and Status Panel *@
Not Connected       
ms
ms

            
@* Primary Buttons Panel *@
@* Reorderable Mapping Sequences Panel *@
Warning: minimum total read time for all sequence groups exceeds defined polling rate.
Total Sequences: Total Sequence Groups: Minimum Total Read Time: msTotal Reads/Writes:
  •   @**@
    Warning: devices may not respond to reading or writing more than 100 registers in a single sequence group.
    Sequence Groups: Minimum Read Time: ms
    Type Address Description    
@* JSON Sequences Display Panel *@

    
@* TCP Connection String Builder *@ @* UDP Connection String Builder *@ @* Serial Connection String Builder *@ @* Save Device Connection Dialog *@ @{ ViewBag.StyleSheetsSection = RenderSection("StyleSheets").ToString(); ViewBag.ScriptsSection = RenderSection("Scripts").ToString(); }