ok
This commit is contained in:
@@ -21,6 +21,7 @@ namespace JiraTimeBotForm.Configuration
|
|||||||
public TimeSpan ActivationTime { get; set; }
|
public TimeSpan ActivationTime { get; set; }
|
||||||
public bool AddCommentsToWorklog { get; set; }
|
public bool AddCommentsToWorklog { get; set; }
|
||||||
public WorkType WorkType { get; set; }
|
public WorkType WorkType { get; set; }
|
||||||
|
public string JiraQuery { get; set; }
|
||||||
|
|
||||||
public static Settings LoadAndCheck(Action settingsSource, Action<string> errorMessageReporter)
|
public static Settings LoadAndCheck(Action settingsSource, Action<string> errorMessageReporter)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,9 +41,26 @@ namespace JiraTimeBotForm.JiraIntegration
|
|||||||
|
|
||||||
var userName = settings.JiraUserName;
|
var userName = settings.JiraUserName;
|
||||||
|
|
||||||
var jql = $"status changed by '{userName}' during (\"{date.Value:yyyy-MM-dd}\",\"{date.Value:yyyy-MM-dd}\")";
|
var jql = settings.JiraQuery;
|
||||||
var affectedIssues = jira.Issues.GetIssuesFromJqlAsync(jql, 50, 0, cancellationToken).Result.ToList();
|
if (string.IsNullOrEmpty(jql))
|
||||||
return affectedIssues;
|
{
|
||||||
|
jql = $"status changed by '%USER%' during (\"%DATE%\",\"%DATE%\")";
|
||||||
|
}
|
||||||
|
|
||||||
|
jql = jql.Replace("%USER%", userName);
|
||||||
|
jql = jql.Replace("%DATE%", $"{date.Value:yyyy-MM-dd}");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<Issue> affectedIssues =
|
||||||
|
jira.Issues.GetIssuesFromJqlAsync(jql, 50, 0, cancellationToken).Result.ToList();
|
||||||
|
return affectedIssues;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Error($"Ошибка получения информации из JIRA: {ex.InnerException?.Message}");
|
||||||
|
return new List<Issue>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date = null, bool dummy = false, bool addCommentsToWorklog = false)
|
public void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date = null, bool dummy = false, bool addCommentsToWorklog = false)
|
||||||
|
|||||||
+28
-5
@@ -44,6 +44,8 @@
|
|||||||
this.btnSave = new System.Windows.Forms.Button();
|
this.btnSave = new System.Windows.Forms.Button();
|
||||||
this.cboWorkType = new System.Windows.Forms.ComboBox();
|
this.cboWorkType = new System.Windows.Forms.ComboBox();
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
|
this.txtJQL = new System.Windows.Forms.TextBox();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label5
|
// label5
|
||||||
@@ -131,7 +133,7 @@
|
|||||||
// label3
|
// label3
|
||||||
//
|
//
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Location = new System.Drawing.Point(16, 180);
|
this.label3.Location = new System.Drawing.Point(16, 206);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(91, 13);
|
this.label3.Size = new System.Drawing.Size(91, 13);
|
||||||
this.label3.TabIndex = 30;
|
this.label3.TabIndex = 30;
|
||||||
@@ -140,7 +142,7 @@
|
|||||||
// actTime
|
// actTime
|
||||||
//
|
//
|
||||||
this.actTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
|
this.actTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
|
||||||
this.actTime.Location = new System.Drawing.Point(109, 176);
|
this.actTime.Location = new System.Drawing.Point(109, 202);
|
||||||
this.actTime.Name = "actTime";
|
this.actTime.Name = "actTime";
|
||||||
this.actTime.Size = new System.Drawing.Size(100, 20);
|
this.actTime.Size = new System.Drawing.Size(100, 20);
|
||||||
this.actTime.TabIndex = 29;
|
this.actTime.TabIndex = 29;
|
||||||
@@ -148,7 +150,7 @@
|
|||||||
// chkAddComments
|
// chkAddComments
|
||||||
//
|
//
|
||||||
this.chkAddComments.AutoSize = true;
|
this.chkAddComments.AutoSize = true;
|
||||||
this.chkAddComments.Location = new System.Drawing.Point(39, 202);
|
this.chkAddComments.Location = new System.Drawing.Point(46, 242);
|
||||||
this.chkAddComments.Name = "chkAddComments";
|
this.chkAddComments.Name = "chkAddComments";
|
||||||
this.chkAddComments.Size = new System.Drawing.Size(133, 17);
|
this.chkAddComments.Size = new System.Drawing.Size(133, 17);
|
||||||
this.chkAddComments.TabIndex = 31;
|
this.chkAddComments.TabIndex = 31;
|
||||||
@@ -157,7 +159,7 @@
|
|||||||
//
|
//
|
||||||
// btnSave
|
// btnSave
|
||||||
//
|
//
|
||||||
this.btnSave.Location = new System.Drawing.Point(61, 236);
|
this.btnSave.Location = new System.Drawing.Point(61, 276);
|
||||||
this.btnSave.Name = "btnSave";
|
this.btnSave.Name = "btnSave";
|
||||||
this.btnSave.Size = new System.Drawing.Size(75, 23);
|
this.btnSave.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnSave.TabIndex = 32;
|
this.btnSave.TabIndex = 32;
|
||||||
@@ -176,6 +178,7 @@
|
|||||||
this.cboWorkType.Name = "cboWorkType";
|
this.cboWorkType.Name = "cboWorkType";
|
||||||
this.cboWorkType.Size = new System.Drawing.Size(99, 21);
|
this.cboWorkType.Size = new System.Drawing.Size(99, 21);
|
||||||
this.cboWorkType.TabIndex = 34;
|
this.cboWorkType.TabIndex = 34;
|
||||||
|
this.cboWorkType.SelectedIndexChanged += new System.EventHandler(this.cboWorkType_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// label6
|
// label6
|
||||||
//
|
//
|
||||||
@@ -186,11 +189,29 @@
|
|||||||
this.label6.TabIndex = 35;
|
this.label6.TabIndex = 35;
|
||||||
this.label6.Text = "Режим работы:";
|
this.label6.Text = "Режим работы:";
|
||||||
//
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.AutoSize = true;
|
||||||
|
this.label7.Location = new System.Drawing.Point(74, 179);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(29, 13);
|
||||||
|
this.label7.TabIndex = 37;
|
||||||
|
this.label7.Text = "JQL:";
|
||||||
|
//
|
||||||
|
// txtJQL
|
||||||
|
//
|
||||||
|
this.txtJQL.Location = new System.Drawing.Point(109, 176);
|
||||||
|
this.txtJQL.Name = "txtJQL";
|
||||||
|
this.txtJQL.Size = new System.Drawing.Size(99, 20);
|
||||||
|
this.txtJQL.TabIndex = 36;
|
||||||
|
//
|
||||||
// frmSettings
|
// frmSettings
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(220, 268);
|
this.ClientSize = new System.Drawing.Size(220, 311);
|
||||||
|
this.Controls.Add(this.label7);
|
||||||
|
this.Controls.Add(this.txtJQL);
|
||||||
this.Controls.Add(this.label6);
|
this.Controls.Add(this.label6);
|
||||||
this.Controls.Add(this.cboWorkType);
|
this.Controls.Add(this.cboWorkType);
|
||||||
this.Controls.Add(this.btnSave);
|
this.Controls.Add(this.btnSave);
|
||||||
@@ -236,5 +257,7 @@
|
|||||||
private System.Windows.Forms.Button btnSave;
|
private System.Windows.Forms.Button btnSave;
|
||||||
private System.Windows.Forms.ComboBox cboWorkType;
|
private System.Windows.Forms.ComboBox cboWorkType;
|
||||||
private System.Windows.Forms.Label label6;
|
private System.Windows.Forms.Label label6;
|
||||||
|
private System.Windows.Forms.Label label7;
|
||||||
|
private System.Windows.Forms.TextBox txtJQL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,8 @@ namespace JiraTimeBotForm.UI
|
|||||||
chkAddComments.Checked = settings.AddCommentsToWorklog;
|
chkAddComments.Checked = settings.AddCommentsToWorklog;
|
||||||
txtRoundTo.Text = settings.RountToMinutes.ToString();
|
txtRoundTo.Text = settings.RountToMinutes.ToString();
|
||||||
cboWorkType.SelectedIndex = (int) settings.WorkType;
|
cboWorkType.SelectedIndex = (int) settings.WorkType;
|
||||||
|
txtJQL.Text = settings.JiraQuery;
|
||||||
|
txtJQL.Enabled = settings.WorkType == WorkType.JiraLogs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings ReadSettingsAndLock()
|
public Settings ReadSettingsAndLock()
|
||||||
@@ -50,7 +52,8 @@ namespace JiraTimeBotForm.UI
|
|||||||
//DummyMode = txtDummyMode.Checked,
|
//DummyMode = txtDummyMode.Checked,
|
||||||
AddCommentsToWorklog = chkAddComments.Checked,
|
AddCommentsToWorklog = chkAddComments.Checked,
|
||||||
RountToMinutes = roundTo,
|
RountToMinutes = roundTo,
|
||||||
WorkType = (WorkType) cboWorkType.SelectedIndex
|
WorkType = (WorkType) cboWorkType.SelectedIndex,
|
||||||
|
JiraQuery = txtJQL.Text,
|
||||||
};
|
};
|
||||||
|
|
||||||
//LockUnlock(false);
|
//LockUnlock(false);
|
||||||
@@ -73,5 +76,10 @@ namespace JiraTimeBotForm.UI
|
|||||||
{
|
{
|
||||||
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
|
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cboWorkType_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
txtJQL.Enabled = (cboWorkType.SelectedIndex == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user