mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-08-01 20:12:11 +00:00
add option to update task in jira if it is updated locally
This commit is contained in:
parent
27e690b35f
commit
565fa78e59
6 changed files with 39 additions and 3 deletions
|
|
@ -57,6 +57,7 @@
|
|||
isFirstLogin: true,
|
||||
isWorklogEnabled: true,
|
||||
isAutoWorklog: false,
|
||||
isUpdateIssueFromLocal: false,
|
||||
isAddWorklogOnSubTaskDone: true,
|
||||
defaultTransitionInProgress: undefined,
|
||||
defaultTransitionDone: undefined,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
controllerAs: 'vm',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
ngModel: '='
|
||||
ngModel: '=',
|
||||
onChanged: '&'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -50,6 +51,9 @@
|
|||
//previewEl.css('height', textareaEl[0].offsetHeight);
|
||||
//previewEl[0].height = textareaEl[0].offsetHeight;
|
||||
vm.showEdit = false;
|
||||
if (angular.isFunction(vm.onChanged)) {
|
||||
vm.onChanged();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,6 +168,30 @@
|
|||
}
|
||||
};
|
||||
|
||||
this.updateIssueDescription = (task) => {
|
||||
if (!$localStorage.jiraSettings.isUpdateIssueFromLocal) {
|
||||
return $q.reject('Jira: jiraSettings.isUpdateIssueFromLocal is deactivated');
|
||||
}
|
||||
|
||||
if (task.originalKey && task.notes) {
|
||||
let request = {
|
||||
config: $localStorage.jiraSettings,
|
||||
apiMethod: 'updateIssue',
|
||||
arguments: [task.originalKey, {
|
||||
fields: {
|
||||
description: task.notes
|
||||
}
|
||||
}]
|
||||
};
|
||||
return this.sendRequest(request).then(() => {
|
||||
SimpleToast('Jira: Description updated for ' + task.originalKey);
|
||||
});
|
||||
} else {
|
||||
SimpleToast('Jira: Not enough parameters for updateIssueDescription.');
|
||||
return $q.reject('Jira: Not enough parameters for updateIssueDescription.');
|
||||
}
|
||||
};
|
||||
|
||||
this.checkUpdatesForTicket = (task) => {
|
||||
let defer = $q.defer();
|
||||
if (task && task.originalKey) {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,10 @@
|
|||
ng-model="vm.r.jiraSettings.jqlQuery">
|
||||
<div class="hint">e.g.: assignee = "{{ vm.r.jiraSettings.userName }}" AND resolution = Unresolved ORDER BY updatedDate DESC</div>
|
||||
</md-input-container>
|
||||
|
||||
<md-switch ng-model="vm.r.jiraSettings.isUpdateIssueFromLocal"
|
||||
aria-label="Update issue description on jira if task notes are updated">
|
||||
Update issue description on jira if task notes are updated
|
||||
</md-switch>
|
||||
|
||||
<section>
|
||||
<h3 class="md-subtitle">Worklog</h3>
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
<section>
|
||||
<div class="md-caption">Notes</div>
|
||||
<div md-whiteframe="4">
|
||||
<inline-markdown ng-model="task.notes"></inline-markdown>
|
||||
<inline-markdown ng-model="task.notes" on-changed="vm.onTaskNotesChanged(task)"></inline-markdown>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -159,6 +159,10 @@
|
|||
ShortSyntax(task);
|
||||
};
|
||||
|
||||
vm.onTaskNotesChanged = (task) => {
|
||||
Jira.updateIssueDescription(task);
|
||||
};
|
||||
|
||||
vm.onTaskDone = (task) => {
|
||||
if (task.isDone) {
|
||||
Jira.addWorklog(task);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue