/// <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; }
private void BuildOutConfig <T>(List <DashboardControlBuilder <T> > outputs, DashboardConfiguration config) where T : UC_OutputBase, IDashboardControl, new() { foreach (var output in outputs) { output.BuildConfig(config); } }
protected string FindNodeTitle( DashboardConfiguration config, string nodeName) { var nodeConfig = FindNodeConfiguration(config, nodeName); return(nodeConfig == null ? nodeName + " Node" : nodeName + " - " + nodeConfig.Title); }
/// <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); }
public DashboardPreview(Window parent, DashboardConfiguration config) { this.parent = parent; this.config = config; InitializeComponent(); this.Title = this.config.Display; }
private void BuildInConfig <T>(List <DashboardControlBuilder <T> > inputs, DashboardConfiguration config) where T : UC_InputBase, IDashboardControl, new() { foreach (var input in inputs) { input.BuildConfig(config); } }
/// <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; } } }
/// <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); }
protected override void Seed(NoDaysOffAppContext context) { TenantConfiguration.Seed(context); DashboardConfiguration.Seed(context); DayConfiguration.Seed(context); TileConfiguration.Seed(context); BoundedContextConfiguration.Seed(context); }
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); }
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; }
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)); }
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); }
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); }
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()); }
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 })); }
protected IDashboardConfiguration CreateDashboardConfiguration() { var dashboardConfiguration = new DashboardConfiguration { ApiConfiguration = Configuration .GetSection(ConfigurationConsts.ApiConfiguration) .Get <ApiConfiguration>(), }; return(dashboardConfiguration); }
public StickySessionStats( DrawingElement drawing, StickySessionNode stickySession, DashboardConfiguration dashboardConfiguration, DashboardConfiguration.NodeConfiguration nodeConfiguration) : base( drawing, stickySession, dashboardConfiguration, new[] { new StickySessionTile(drawing, stickySession, nodeConfiguration, dashboardConfiguration.TrafficIndicator) }) { }
public LeastConnectionsStats( DrawingElement drawing, LeastConnectionsNode leastConnections, DashboardConfiguration dashboardConfiguration, DashboardConfiguration.NodeConfiguration nodeConfiguration) : base( drawing, leastConnections, dashboardConfiguration, new[] { new LeastConnectionsTile(drawing, leastConnections, nodeConfiguration, dashboardConfiguration.TrafficIndicator) }) { }
public RoundRobinStats( DrawingElement drawing, RoundRobinNode roundRobin, DashboardConfiguration dashboardConfiguration, DashboardConfiguration.NodeConfiguration nodeConfiguration) : base( drawing, roundRobin, dashboardConfiguration, new[] { new RoundRobinTile(drawing, roundRobin, nodeConfiguration, dashboardConfiguration.TrafficIndicator) }) { }
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); }
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); }
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); }
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); }
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"); }
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()); } }
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"); }
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>())); }
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")); }
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); }