コード例 #1
0
        /// <summary>Initialize the editor with existing configuration</summary>
        /// <param name="config"></param>
        public void Init(DashboardConfiguration config)
        {
            foreach (var dataModel in config.InputsBool)
            {
                this.InitInput(dataModel, this.inputsBool);
            }

            foreach (var dataModel in config.InputsNumericHorizontal)
            {
                this.InitInput(dataModel, this.inputsHNum);
            }

            // Outputs
            foreach (var dataModel in config.OutputsBool)
            {
                this.InitOutput(dataModel, this.outputsBool);
            }

            foreach (var dataModel in config.OutputsNumericHorizontal)
            {
                this.InitOutput(dataModel, this.outputsHNum);
            }
            this.txtName.Text = config.Display;
            this.StorageUId   = config.UId;
        }
コード例 #2
0
 private void BuildOutConfig <T>(List <DashboardControlBuilder <T> > outputs, DashboardConfiguration config) where T : UC_OutputBase, IDashboardControl, new()
 {
     foreach (var output in outputs)
     {
         output.BuildConfig(config);
     }
 }
コード例 #3
0
ファイル: NodeStats.cs プロジェクト: unknow321/Gravity
        protected string FindNodeTitle(
            DashboardConfiguration config, string nodeName)
        {
            var nodeConfig = FindNodeConfiguration(config, nodeName);

            return(nodeConfig == null ? nodeName + " Node" : nodeName + " - " + nodeConfig.Title);
        }
コード例 #4
0
 /// <summary>When the dashboard is only used for preview on build</summary>
 /// <param name="config">The current state of the configuration</param>
 public void SetAsPreview(DashboardConfiguration config)
 {
     this.btnConnect.Collapse();
     this.btnDisconnect.Collapse();
     this.spList.Collapse();
     this.Init(config);
 }
コード例 #5
0
 public DashboardPreview(Window parent, DashboardConfiguration config)
 {
     this.parent = parent;
     this.config = config;
     InitializeComponent();
     this.Title = this.config.Display;
 }
コード例 #6
0
 private void BuildInConfig <T>(List <DashboardControlBuilder <T> > inputs, DashboardConfiguration config) where T : UC_InputBase, IDashboardControl, new()
 {
     foreach (var input in inputs)
     {
         input.BuildConfig(config);
     }
 }
コード例 #7
0
        /// <summary>Add managed control config data to the general config</summary>
        /// <param name="config">The general config object</param>
        public void BuildConfig(DashboardConfiguration config)
        {
            foreach (var control in Controls)
            {
                // Note. All the columns are over by 1 since 0 is occupied by event dummy
                DashboardControlDataModel dm = control.StorageInfo;
                switch (this.controlType)
                {
                case ControlType.Undefined:
                    break;

                case ControlType.OutBool:
                    config.OutputsBool.Add(dm);
                    break;

                case  ControlType.OutHorizontal:
                    config.OutputsNumericHorizontal.Add(dm);
                    break;

                case ControlType.InBool:
                    config.InputsBool.Add(dm);
                    break;

                case ControlType.InHorizontal:
                    config.InputsNumericHorizontal.Add(dm);
                    break;
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 启动Orleans仪表盘服务
        /// </summary>
        /// <param name="configure"></param>
        /// <param name="applicationPartTypes"></param>
        /// <returns></returns>
        public static ISiloHost StartDashboardServer(DashboardConfiguration configure, Type[] applicationPartTypes)
        {
            var gatewayPort = configure.GatewayPort;
            var siloPort    = configure.SiloPort;

            var builder = new SiloHostBuilder()
                          // Grain State
                          .AddAdoNetGrainStorage(configure.OrleansStorage, options =>
            {
                options.Invariant        = Invariant;
                options.ConnectionString = configure.ClusterDatabase.ConnectionString;
                options.UseJsonFormat    = true;
            })
                          // Membership
                          .UseAdoNetClustering(options =>
            {
                options.Invariant        = Invariant;
                options.ConnectionString = configure.ClusterDatabase.ConnectionString;
            })
                          .UseDashboard(options =>
            {
                options.Username  = configure.Username;
                options.Password  = configure.Password;
                options.HostSelf  = true;
                options.HideTrace = false;
                options.Port      = configure.Port;
                options.CounterUpdateIntervalMs = configure.UpdateIntervalMs;
            })
                          .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = configure.ClusterId;
                options.ServiceId = configure.ServiceId;
            })
                          .Configure <SerializationProviderOptions>(options =>
            {
                options.SerializationProviders.Add(typeof(ProtobufSerializer).GetTypeInfo());
                options.FallbackSerializationProvider = typeof(ProtobufSerializer).GetTypeInfo();
            })
                          .ConfigureEndpoints(siloPort, gatewayPort)
                          .ConfigureApplicationParts(parts =>
            {
                if (applicationPartTypes != null)
                {
                    foreach (var type in applicationPartTypes)
                    {
                        parts.AddApplicationPart(type.Assembly).WithReferences();
                    }
                }
            })
                          .UseInMemoryReminderService()
                          .ConfigureLogging(log => log.SetMinimumLevel(LogLevel.Warning).AddConsole());

            var host = builder.Build();

            host.StartAsync().Wait();

            Console.WriteLine("Orleans仪表盘已经启动");
            return(host);
        }
コード例 #9
0
 protected override void Seed(NoDaysOffAppContext context)
 {
     TenantConfiguration.Seed(context);
     DashboardConfiguration.Seed(context);
     DayConfiguration.Seed(context);
     TileConfiguration.Seed(context);
     BoundedContextConfiguration.Seed(context);
 }
コード例 #10
0
ファイル: DbInitializer.cs プロジェクト: lulzzz/DblDip
 public static void Initialize(IAppDbContext context, IConfiguration configuration)
 {
     RoleConfiguration.Seed(context, configuration);
     SystemLocationConfiguration.Seed(context, configuration);
     CardConfiguration.Seed(context, configuration);
     UserConfiguration.Seed(context, configuration);
     DashboardConfiguration.Seed(context, configuration);
 }
コード例 #11
0
 public void Update(DashboardConfiguration config)
 {
     // This is where we could harvest some extra info to put in the index extra info
     this.DigitalInputs  = config.InputsBool.Count;
     this.AnalogInputs   = config.InputsNumericHorizontal.Count;
     this.DigitalOutputs = config.OutputsBool.Count;
     this.AnalogOutputs  = config.OutputsNumericHorizontal.Count;
 }
コード例 #12
0
        public async Task <IActionResult> Add([FromBody] DashboardConfiguration config)
        {
            Tables.Dashboard dashboard = config;
            dashboard.UserId = this.UserId;
            await this.TableStore.AddOrUpdateAsync(dashboard);

            return(this.Ok(config));
        }
コード例 #13
0
 public static void Initialize(IDblDipDbContext context, IEventStore store, IConfiguration configuration)
 {
     RoleConfiguration.Seed(store);
     SystemLocationConfiguration.Seed(store, configuration);
     CardConfiguration.Seed(store, context);
     UserConfiguration.Seed(context, store);
     DashboardConfiguration.Seed(context, store);
 }
コード例 #14
0
        public void SetDemo()
        {
            DashboardConfiguration cfg = new DashboardConfiguration();

            cfg.InputsNumericHorizontal.Add(this.dm(12, "Tst PWM 3", BinaryMsgDataType.typeUInt8, 5, 0, 255, 1, 1));
            cfg.OutputsNumericHorizontal.Add(this.dm(12, "Feedback 12", BinaryMsgDataType.typeUInt8, 1, 0, 255, 1, 1));
            cfg.OutputsNumericHorizontal.Add(this.dm(20, "Temperature", BinaryMsgDataType.typeFloat32, 1, -10, 100, 1, 2, 2));
            this.Init(cfg);
        }
コード例 #15
0
        public async Task <IActionResult> Delete([FromRoute] string path, [FromRoute] string id)
        {
            Tables.Dashboard source = new DashboardConfiguration {
                Path = path, Id = id
            };
            source.UserId = this.UserId;
            await this.TableStore.DeleteAsync(source);

            return(this.Ok());
        }
コード例 #16
0
        public async Task <IActionResult> GetTheme([FromRoute] string path, [FromRoute] string id)
        {
            Tables.Dashboard source = new DashboardConfiguration {
                Path = path, Id = id
            };
            source.UserId = this.UserId;
            var result = await this.TableStore.GetAsync(source);

            return(this.Ok(new { Theme = result?.Theme }));
        }
コード例 #17
0
        protected IDashboardConfiguration CreateDashboardConfiguration()
        {
            var dashboardConfiguration = new DashboardConfiguration
            {
                ApiConfiguration = Configuration
                                   .GetSection(ConfigurationConsts.ApiConfiguration)
                                   .Get <ApiConfiguration>(),
            };

            return(dashboardConfiguration);
        }
コード例 #18
0
 public StickySessionStats(
     DrawingElement drawing,
     StickySessionNode stickySession,
     DashboardConfiguration dashboardConfiguration,
     DashboardConfiguration.NodeConfiguration nodeConfiguration)
     : base(
         drawing,
         stickySession,
         dashboardConfiguration,
         new[] { new StickySessionTile(drawing, stickySession, nodeConfiguration, dashboardConfiguration.TrafficIndicator) })
 {
 }
コード例 #19
0
 public LeastConnectionsStats(
     DrawingElement drawing,
     LeastConnectionsNode leastConnections,
     DashboardConfiguration dashboardConfiguration,
     DashboardConfiguration.NodeConfiguration nodeConfiguration)
     : base(
         drawing,
         leastConnections,
         dashboardConfiguration,
         new[] { new LeastConnectionsTile(drawing, leastConnections, nodeConfiguration, dashboardConfiguration.TrafficIndicator) })
 {
 }
コード例 #20
0
ファイル: RoundRobinStats.cs プロジェクト: unknow321/Gravity
 public RoundRobinStats(
     DrawingElement drawing,
     RoundRobinNode roundRobin,
     DashboardConfiguration dashboardConfiguration,
     DashboardConfiguration.NodeConfiguration nodeConfiguration)
     : base(
         drawing,
         roundRobin,
         dashboardConfiguration,
         new[] { new RoundRobinTile(drawing, roundRobin, nodeConfiguration, dashboardConfiguration.TrafficIndicator) })
 {
 }
コード例 #21
0
        public static void Seed(AppDbContext context)
        {
            BehaviourTypeConfiguration.Seed(context);
            CardConfiguration.Seed(context);

            FrequencyTypeConfiguration.Seed(context);
            UserConfiguration.Seed(context);
            TagConfiguration.Seed(context);

            DashboardConfiguration.Seed(context);
            DashboardCardConfiguration.Seed(context);
        }
コード例 #22
0
        public void MapEFToBOList()
        {
            var mapper = new DALDashboardConfigurationMapper();
            DashboardConfiguration entity = new DashboardConfiguration();

            entity.SetProperties("A", "A", "A", "A", "A", "A");

            List <BODashboardConfiguration> response = mapper.MapEFToBO(new List <DashboardConfiguration>()
            {
                entity
            });

            response.Count.Should().Be(1);
        }
コード例 #23
0
        public virtual DashboardConfiguration MapBOToEF(
            BODashboardConfiguration bo)
        {
            DashboardConfiguration efDashboardConfiguration = new DashboardConfiguration();

            efDashboardConfiguration.SetProperties(
                bo.Id,
                bo.IncludedEnvironmentIds,
                bo.IncludedProjectIds,
                bo.IncludedTenantIds,
                bo.IncludedTenantTags,
                bo.JSON);
            return(efDashboardConfiguration);
        }
コード例 #24
0
        public virtual BODashboardConfiguration MapEFToBO(
            DashboardConfiguration ef)
        {
            var bo = new BODashboardConfiguration();

            bo.SetProperties(
                ef.Id,
                ef.IncludedEnvironmentIds,
                ef.IncludedProjectIds,
                ef.IncludedTenantIds,
                ef.IncludedTenantTags,
                ef.JSON);
            return(bo);
        }
コード例 #25
0
        public void MapEFToBO()
        {
            var mapper = new DALDashboardConfigurationMapper();
            DashboardConfiguration entity = new DashboardConfiguration();

            entity.SetProperties("A", "A", "A", "A", "A", "A");

            BODashboardConfiguration response = mapper.MapEFToBO(entity);

            response.Id.Should().Be("A");
            response.IncludedEnvironmentIds.Should().Be("A");
            response.IncludedProjectIds.Should().Be("A");
            response.IncludedTenantIds.Should().Be("A");
            response.IncludedTenantTags.Should().Be("A");
            response.JSON.Should().Be("A");
        }
コード例 #26
0
        private DashboardContext()
        {
            try {
                // Calculate the absolute path to the configuration file
                string path = MapPath("~/Config/Skybrud.Dashboard.config");

                // Load the configuration
                Configuration = DashboardConfiguration.Load(path);
            } catch (Exception ex) {
                // Save the exception to the log
                LogHelper.Error <DashboardContext>("Unable to load configuration file for the Dashboard: " + ex.Message, ex);

                // Initialize an empty configuration (so we have a fallback)
                Configuration = new DashboardConfiguration(new JObject());
            }
        }
コード例 #27
0
        public void MapBOToEF()
        {
            var mapper = new DALDashboardConfigurationMapper();
            var bo     = new BODashboardConfiguration();

            bo.SetProperties("A", "A", "A", "A", "A", "A");

            DashboardConfiguration response = mapper.MapBOToEF(bo);

            response.Id.Should().Be("A");
            response.IncludedEnvironmentIds.Should().Be("A");
            response.IncludedProjectIds.Should().Be("A");
            response.IncludedTenantIds.Should().Be("A");
            response.IncludedTenantTags.Should().Be("A");
            response.JSON.Should().Be("A");
        }
コード例 #28
0
        public async void Get()
        {
            var mock   = new ServiceMockFacade <IDashboardConfigurationRepository>();
            var record = new DashboardConfiguration();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new DashboardConfigurationService(mock.LoggerMock.Object,
                                                            mock.RepositoryMock.Object,
                                                            mock.ModelValidatorMockFactory.DashboardConfigurationModelValidatorMock.Object,
                                                            mock.BOLMapperMockFactory.BOLDashboardConfigurationMapperMock,
                                                            mock.DALMapperMockFactory.DALDashboardConfigurationMapperMock);

            ApiDashboardConfigurationResponseModel response = await service.Get(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>()));
        }
コード例 #29
0
        public LoadBalancerStats(
            DrawingElement drawing,
            LoadBalancerNode loadBalancer,
            DashboardConfiguration dashboardConfiguration,
            DrawingElement[] topSectionElements)
            : base(drawing)
        {
            var topSection    = AddSection();
            var bottomSection = AddSection();

            foreach (var element in topSectionElements)
            {
                topSection.AddChild(element);
            }

            var requestRateData = new Tuple <string, float> [loadBalancer.OutputNodes.Length];

            for (var i = 0; i < loadBalancer.OutputNodes.Length; i++)
            {
                var nodeName  = loadBalancer.OutputNodes[i].Name;
                var nodeTitle = FindNodeTitle(dashboardConfiguration, nodeName);

                requestRateData[i] = new Tuple <string, float>(
                    nodeTitle,
                    (float)loadBalancer.OutputNodes[i].TrafficAnalytics.RequestsPerMinute);
            }

            bottomSection.AddChild(CreatePieChart("Request Rate", "/min", requestRateData, TotalHandling.Sum, "rate_piechart"));

            var requestTimeData = new Tuple <string, float> [loadBalancer.OutputNodes.Length];

            for (var i = 0; i < loadBalancer.OutputNodes.Length; i++)
            {
                var nodeName  = loadBalancer.OutputNodes[i].Name;
                var nodeTitle = FindNodeTitle(dashboardConfiguration, nodeName);

                requestTimeData[i] = new Tuple <string, float>(
                    nodeTitle,
                    (float)loadBalancer.OutputNodes[i].TrafficAnalytics.RequestTime.TotalMilliseconds);
            }

            bottomSection.AddChild(CreatePieChart("Request Time", "ms", requestTimeData, TotalHandling.Maximum, "time_piechart"));
        }
コード例 #30
0
        public DashboardConfiguration GetConfig()
        {
            // TODO - Validate the name?
            DashboardConfiguration config = new DashboardConfiguration()
            {
                Display = this.txtName.Text,
            };

            // For loaded stored configs
            if (!string.IsNullOrWhiteSpace(this.StorageUId))
            {
                config.UId = this.StorageUId;
            }

            this.BuildInConfig(this.inputsBool, config);
            this.BuildInConfig(this.inputsHNum, config);
            this.BuildOutConfig(this.outputsBool, config);
            this.BuildOutConfig(this.outputsHNum, config);
            return(config);
        }