mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-31 19:50:44 +00:00
add test credentials button to settings
This commit is contained in:
parent
31277be90b
commit
be901a6f8a
4 changed files with 17 additions and 13 deletions
|
|
@ -51,7 +51,7 @@
|
|||
if (!res || res.error) {
|
||||
$log.log('FRONTEND_REQUEST', currentRequest);
|
||||
$log.log('RESPONSE', res);
|
||||
SimpleToast('ERROR', 'Jira Request failed: ' + currentRequest.clientRequest.apiMethod + ' – ' + (res && res.error), 'ERROR');
|
||||
SimpleToast('ERROR', 'Jira Request failed: ' + currentRequest.clientRequest.apiMethod + ' – ' + (res && res.error));
|
||||
currentRequest.defer.reject(res);
|
||||
} else {
|
||||
currentRequest.defer.resolve(res);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,15 @@
|
|||
|
||||
/* @ngInject */
|
||||
function SimpleToast($mdToast) {
|
||||
const DEFAULT_HIDE_DELAY = 4000;
|
||||
|
||||
return (textContent, type, hideDelay) => {
|
||||
|
||||
if (!type) {
|
||||
return $mdToast.show($mdToast.simple()
|
||||
.textContent(textContent)
|
||||
.capsule(false)
|
||||
.hideDelay(hideDelay || 4000)
|
||||
.hideDelay(hideDelay || DEFAULT_HIDE_DELAY)
|
||||
.position('bottom'));
|
||||
} else {
|
||||
let icon;
|
||||
|
|
@ -54,7 +57,7 @@ ${textContent}
|
|||
</div>
|
||||
</md-toast>
|
||||
`,
|
||||
hideDelay: hideDelay || 4000
|
||||
hideDelay: hideDelay || DEFAULT_HIDE_DELAY
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -99,7 +99,12 @@
|
|||
aria-label="Update issue description on jira if task notes are updated">
|
||||
Update issue description on jira if task notes are updated
|
||||
</md-switch>
|
||||
|
||||
<md-button aria-label="Test credentials"
|
||||
class="md-primary md-raised"
|
||||
ng-click="vm.testJiraCredentials()">
|
||||
<ng-md-icon icon="import_export"></ng-md-icon>
|
||||
Test credentials
|
||||
</md-button>
|
||||
<section>
|
||||
<h3 class="md-subtitle">Worklog</h3>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
.controller('SettingsCtrl', SettingsCtrl);
|
||||
|
||||
/* @ngInject */
|
||||
function SettingsCtrl($localStorage, $window, $scope, Projects, Dialogs, DEFAULT_THEME, THEMES, IS_ELECTRON, SimpleToast, $mdDialog) {
|
||||
function SettingsCtrl($localStorage, $window, $scope, Projects, Dialogs, DEFAULT_THEME, THEMES, IS_ELECTRON, SimpleToast, $mdDialog, Jira) {
|
||||
let vm = this;
|
||||
const _ = $window._;
|
||||
|
||||
|
|
@ -77,14 +77,10 @@
|
|||
};
|
||||
|
||||
// jira stuff
|
||||
vm.saveJiraSettings = (settings) => {
|
||||
$localStorage.jiraSettings = $localStorage.jiraSettings = settings;
|
||||
// for some reason project needs to be updated directly
|
||||
if ($localStorage.currentProject && $localStorage.currentProject.data) {
|
||||
$localStorage.currentProject.data.jiraSettings = settings;
|
||||
}
|
||||
|
||||
SimpleToast('SUCCESS', 'Jira settings saved');
|
||||
vm.testJiraCredentials = () => {
|
||||
Jira.getSuggestions().then(() => {
|
||||
SimpleToast('SUCCESS', 'Connection successful!');
|
||||
});
|
||||
};
|
||||
|
||||
// theme stuff
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue