public override bool Validate() { Log(LogMessage.SeverityType.Info, "Checking JIRA filter."); if (filter == null) { Log(LogMessage.SeverityType.Error, "Filter is null."); return(false); } if (!filter.Enabled) { Log(LogMessage.SeverityType.Debug, string.Format("Filter {0} disabled.", filter.Id)); return(true); } try { JiraConnector.Login(); JiraConnector.GetIssuesFromFilter(filter.Id); JiraConnector.Logout(); } catch (Exception) { Log(LogMessage.SeverityType.Error, string.Format("Can't find {0} filter.", filter.Id)); return(false); } Log(LogMessage.SeverityType.Info, "JIRA filter is checked."); return(true); }
public JiraViewModel( IJiraConfiguration jiraConfiguration, IJiraLanguage jiraLanguage, JiraConnector jiraConnector ) { JiraConfiguration = jiraConfiguration; JiraLanguage = jiraLanguage; JiraConnector = jiraConnector; }
public override bool Validate() { try { JiraConnector.Login(); JiraConnector.Logout(); } catch (JiraLoginException) { Log(LogMessage.SeverityType.Error, "Incorrect credentials or JIRA URL."); return(false); } catch (Exception ex) { Log(LogMessage.SeverityType.Error, "Incorrect credentials or JIRA URL. " + ex.Message); return(false); } return(true); }
public override bool Validate() { var result = true; Log(LogMessage.SeverityType.Info, "Checking custom fields."); try { JiraConnector.Login(); var customFields = JiraConnector.GetCustomFields().ToList(); if (!customFields.Any()) { Log(LogMessage.SeverityType.Error, "JIRA doesn't contain custom fields."); return(false); } foreach (var field in fields.Distinct()) { if (string.IsNullOrEmpty(field)) { Log(LogMessage.SeverityType.Debug, "At least one custom field id is empty."); continue; } Log(LogMessage.SeverityType.Info, string.Format("Checking {0} field.", field)); if (!ValidateField(field, customFields)) { result = false; } } } catch (JiraPermissionException ex) { Log(LogMessage.SeverityType.Error, "You don't have permission to get custom fields: " + ex.Message); return(false); } catch (Exception) { Log(LogMessage.SeverityType.Error, "Can't get custom field information."); return(false); } finally { JiraConnector.Logout(); } Log(LogMessage.SeverityType.Info, "All fields checked."); return(result); }
protected override void OnActivate() { // Prepare disposables _disposables?.Dispose(); _disposables = new CompositeDisposable(); // automatically update the DisplayName var greenshotLanguageBinding = JiraLanguage.CreateDisplayNameBinding(this, nameof(IJiraLanguage.LabelJira)); // Make sure the greenshotLanguageBinding is disposed when this is no longer active _disposables.Add(greenshotLanguageBinding); OnUIThread(async() => { try { if (!JiraConnector.IsLoggedIn) { await JiraConnector.LoginAsync(); } } catch (Exception e) { MessageBox.Show(JiraLanguage.LoginError, e.Message); } if (!JiraConnector.IsLoggedIn) { return; } Filters = await JiraConnector.GetFavoriteFiltersAsync(); NotifyOfPropertyChange(nameof(Filters)); if (!JiraConnector.RecentJiras.Any()) { return; } JiraIssue = JiraConnector.RecentJiras.First().JiraIssue; NotifyOfPropertyChange(nameof(JiraIssue)); CanUpload = true; NotifyOfPropertyChange(nameof(CanUpload)); }); base.OnActivate(); }
public JiraForm(JiraConnector jiraConnector) { InitializeComponent(); Icon = GreenshotResources.getGreenshotIcon(); AcceptButton = uploadButton; CancelButton = cancelButton; InitializeComponentText(); _columnSorter = new GreenshotColumnSorter(); jiraListView.ListViewItemSorter = _columnSorter; _jiraConnector = jiraConnector; ChangeModus(false); uploadButton.Enabled = false; Load += OnLoad; }
public override bool Validate() { var result = true; Log(LogMessage.SeverityType.Info, "Checking JIRA projects."); JiraConnector.Login(); var jiraProjects = JiraConnector.GetProjects(); foreach (var project in projects.Where(project => !jiraProjects.Any(x => x.Name.Equals(project.Name)))) { Log(LogMessage.SeverityType.Error, string.Format("Cannot find JIRA project with name '{0}'.", project.Name)); result = false; } JiraConnector.Logout(); Log(LogMessage.SeverityType.Info, "JIRA projects are checked."); return(result); }
public override bool Validate() { var result = true; Log(LogMessage.SeverityType.Info, "Checking JIRA priorities"); JiraConnector.Login(); var jiraPriorities = JiraConnector.GetPriorities(); foreach (var priority in priorities.Where(priority => !jiraPriorities.Any(x => x.Id.Equals(priority.Id)))) { Log(LogMessage.SeverityType.Error, string.Format("Cannot find JIRA priority with identifier {0}", priority.Id)); result = false; } JiraConnector.Logout(); Log(LogMessage.SeverityType.Info, "JIRA priorities are checked"); return(result); }
public async Task Connect() { RestClient = await JiraConnector.Connect(_configSettings.Username, _configSettings.Password, _configSettings.ServiceUri); }