コード例 #1
0
        public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result)
        {
            var allFeaturesState = step as AllFeaturesDeploymentStep;

            if (allFeaturesState == null)
            {
                return;
            }

            var features = await _moduleService.GetAvailableFeaturesAsync();

            result.Steps.Add(new JObject(
                                 new JProperty("name", "Feature"),
                                 new JProperty("enable", features.Where(f => f.IsEnabled).Select(f => f.Descriptor.Id).ToArray()),
                                 new JProperty("disable", features.Where(f => !f.IsEnabled).Select(f => f.Descriptor.Id).ToArray())
                                 ));
        }
コード例 #2
0
        private async Task EnableFeature(string id)
        {
            var availableFeatures = await _moduleService.GetAvailableFeaturesAsync();

            var contentFields = availableFeatures.FirstOrDefault(f => f.Descriptor.Id == id);

            if (contentFields != null)
            {
                if (!contentFields.IsEnabled)
                {
                    _logger.LogInformation($"Enabling {id}");
                    await _moduleService.EnableFeaturesAsync(new[] { id });
                }
            }
            else
            {
                _logger.LogError($"Unable to find {id} features required for Transformalize.");
            }
        }