-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathutils.js
65 lines (58 loc) · 1.67 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
let mytimer = 0
export function delay(callback, ms) {
return function() {
const context = this
const args = arguments
clearTimeout(mytimer)
mytimer = setTimeout(function() {
callback.apply(context, args)
}, ms || 0)
}
}
export function checkOauthConnectionResult(oauthConnectionResult, oauthConnectionErrorMessage) {
if (oauthConnectionResult === 'success') {
showSuccess(t('integration_openproject', 'Successfully connected to OpenProject!'))
} else if (oauthConnectionResult === 'error') {
showError(
t(
'integration_openproject',
'OAuth access token could not be obtained:'
) + ' ' + oauthConnectionErrorMessage
)
}
}
export const STATE = {
OK: 'ok',
ERROR: 'error',
LOADING: 'loading',
NO_TOKEN: 'no-token',
CONNECTION_ERROR: 'connection-error',
FAILED_FETCHING_WORKPACKAGES: 'failed-fetching-workpackages',
}
export const F_MODES = {
VIEW: 0,
EDIT: 1,
DISABLE: 2,
}
export const FORM = {
SERVER: 0,
OP_OAUTH: 1,
NC_OAUTH: 2,
GROUP_FOLDER: 3,
APP_PASSWORD: 4,
}
export const WORKPACKAGES_SEARCH_ORIGIN = {
PROJECT_TAB: 'project-tab',
LINK_MULTIPLE_FILES_MODAL: 'link-multiple-files-modal',
}
export const USER_SETTINGS = {
NAVIGATION_LINK_DESCRIPTION: t('integration_openproject', 'This check will show "OpenProject Icon" in the navigation bar to navigate directly to OpenProject instance.'),
UNIFIED_SEARCH_DESCRIPTION: t('integration_openproject', 'This check will allow to unified or global search for the OpenProject tickets from the Nextcloud.'),
}
export const NO_OPTION_TEXT_STATE = {
START_TYPING: 0,
SEARCHING: 1,
RESULT: 2,
}