Example #1
0
        public void ViewForm(ProjectFormModel projectForm, string environmentId)
        {
            FormViewViewModel formViewViewModel = _formViewModelFactory();

            ProjectResource project = _repositoryFactory.CurrentInstance.GetProject(projectForm.ProjectId);
            EnvironmentResource environment = _repositoryFactory.CurrentInstance.GetEnvironment(environmentId);
            IEnumerable<MachineResource> machines = _repositoryFactory.CurrentInstance.GetMachines(environmentId);
            List<string> roles = _repositoryFactory.CurrentInstance.GetRoles();
            IList<DeploymentStepResource> deploymentProcessSteps = _repositoryFactory.CurrentInstance.GetDeploymentProcessSteps(project);
            Dictionary<string, string> actionsDictionary = deploymentProcessSteps.GetActionsDictionary();

            Dictionary<ScopeField, ScopeValue> scopeDictionary = new Dictionary<ScopeField, ScopeValue>
            {
                {ScopeField.Environment, new ScopeValue(environmentId)},
                {ScopeField.Machine, new ScopeValue(machines.Select(mc => mc.Id))},
                {ScopeField.Role, new ScopeValue(roles)},
                {ScopeField.Action, new ScopeValue(actionsDictionary.Select(ac => ac.Value))}
            };

            formViewViewModel.Title = $"View Variables - {project.Name} - {environment.Name}";
            formViewViewModel.ProjectId = project.Id;

            List<ResourceVariableSetPair> variableSets = _repositoryFactory.CurrentInstance.GetVariableSetResources(project);

            VariableCollection variables = variableSets.GetProjectVariables(project, scopeDictionary);

            Entities.Form form = _sqlRepository.GetForm(projectForm.FormId);

            FormResources formResources = new FormResources(form, variables, environment, machines, roles, actionsDictionary);

            formViewViewModel.Show(_shellService.ShellView, formResources);
            formViewViewModel.Dispose();
        }
Example #2
0
        public void EditForm(ProjectFormModel projectForm)
        {
       
            FormEditViewModel formEditViewModel = _formEditViewModelFactory();

            formEditViewModel.Show(_shellService.ShellView, projectForm);
            formEditViewModel.Dispose();
        }