public async Task <FlowConfig> GetDefaultConfig(TokenDictionary tokens = null) { var config = await CommonsData.GetByName(CommonDataName_DefaultFlowConfig); if (tokens != null) { config = tokens.Resolve(config); } return(FlowConfig.From(config)); }
public async Task <FlowConfig> GetFlowConfigByInputType(string inputType, TokenDictionary tokens = null) { var flowConfigName = this.GetFlowConfigName(inputType); var config = await CommonsData.GetByName(flowConfigName); if (tokens != null) { config = tokens.Resolve(config); } return(FlowConfig.From(config)); }
public async Task TestConfigSaved() { string flowName = "localconfiggentest"; var input = await File.ReadAllTextAsync(@"Resource\guiInput.json"); var inputJson = JsonConfig.From(input); var result = await this.FlowOperation.SaveFlowConfig(FlowGuiConfig.From(inputJson)); Assert.IsTrue(result.IsSuccess, result.Message); var actualJson = await this.FlowOperation.GetFlowByName(flowName); var expectedJson = FlowConfig.From(await File.ReadAllTextAsync(@"Resource\flowSaved.json")); foreach (var match in EntityConfig.Match(expectedJson, actualJson)) { Assert.AreEqual(expected: match.Item2, actual: match.Item3, message: $"path:{match.Item1}"); } }
public async Task <FlowConfig> Build(FlowGuiConfig inputGuiConfig) { var defaultConfig = await FlowData.GetFlowConfigByInputType(inputGuiConfig.Input.InputType); var config = defaultConfig ?? FlowConfig.From(JsonConfig.CreateEmpty()); // Set the flowName. This will be the case for new flow creation if (string.IsNullOrWhiteSpace(inputGuiConfig.Name)) { string flowName = GenerateValidFlowName(inputGuiConfig.DisplayName); config.Name = flowName; inputGuiConfig.Name = flowName; } var guiConfig = await HandleSensitiveData(inputGuiConfig); config.Name = guiConfig?.Name ?? config.Name; config.DisplayName = guiConfig?.DisplayName ?? config.DisplayName; config.Gui = guiConfig.ToJson()._jt; return(FlowConfig.From(config.ToString())); }
public async Task TestConfigSaved() { await CommonData.Add(FlowDataManager.CommonDataName_DefaultFlowConfig, @"Resource\flowDefault.json"); var input = await File.ReadAllTextAsync(@"Resource\guiInput.json"); var inputJson = JsonConfig.From(input); var result = await this.FlowOperation.SaveFlowConfig(FlowGuiConfig.From(inputJson)); Assert.IsTrue(result.IsSuccess, result.Message); var actualJson = await this.FlowOperation.GetFlowByName("configgentest"); var expectedJson = FlowConfig.From(await File.ReadAllTextAsync(@"Resource\flowSaved.json")); foreach (var match in EntityConfig.Match(expectedJson, actualJson)) { Assert.AreEqual(expected: match.Item2, actual: match.Item3, message: $"path:{match.Item1}"); } Cleanup(); }
public async Task <FlowConfig> GetByName(string flowName) { var json = await this.Storage.GetByName(flowName, DataCollectionName); return(FlowConfig.From(json)); }