@inriver/inri 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.eslintrc.js +5 -5
- package/azure/pipelines/single-build-release.yml +6 -0
- package/azure/pipelines/templates/deployFramework.yml +50 -0
- package/componentProperties.d.ts +8 -8
- package/configs/base-eslint-config.js +36 -36
- package/configs/base-tailwind-config.js +149 -149
- package/i18n.ts +11 -11
- package/index.ts +29 -29
- package/package.json +7 -2
- package/src/components/CAutoBreadcrumbs.vue +72 -72
- package/src/components/CBtn.vue +98 -98
- package/src/components/CColorPicker.vue +55 -55
- package/src/components/CContextMenu.vue +29 -29
- package/src/components/CDatePicker.vue +51 -51
- package/src/components/CDeleteTileBtn.vue +52 -52
- package/src/components/CDialog.vue +253 -253
- package/src/components/CDialogCloseBtn.vue +9 -9
- package/src/components/CDirtyCheck.vue +68 -68
- package/src/components/CDrawer.vue +44 -44
- package/src/components/CDrawerButton.vue +91 -91
- package/src/components/CExpansionItem.vue +57 -57
- package/src/components/CExpansionItemWithCheckbox.vue +41 -41
- package/src/components/CFileDropzone.vue +114 -114
- package/src/components/CGrid.vue +101 -101
- package/src/components/CHeader.vue +10 -10
- package/src/components/CHeaderLinks.vue +61 -61
- package/src/components/CHeaderMenuLink.vue +51 -51
- package/src/components/CHeaderSearch.vue +142 -142
- package/src/components/CIconBtn.vue +70 -70
- package/src/components/CMenuItem.vue +66 -66
- package/src/components/CPageContainer.vue +11 -11
- package/src/components/CPageError.vue +24 -24
- package/src/components/CPageSpinner.vue +18 -18
- package/src/components/CSearch.vue +45 -45
- package/src/components/CSection.vue +29 -29
- package/src/components/CSectionTitle.vue +8 -8
- package/src/components/CSelect.vue +208 -208
- package/src/components/CSlideEffect.vue +62 -62
- package/src/components/CSpinner.vue +107 -107
- package/src/components/CTableActions.vue +16 -16
- package/src/components/CTileBtn.vue +178 -178
- package/src/components/CTimePicker.vue +42 -42
- package/src/components/CToggleGridView.vue +26 -26
- package/src/components/CToggleSidebarBtn.vue +19 -19
- package/src/components/CTooltip.vue +44 -44
- package/src/components/CTreeNode.vue +39 -39
- package/src/components/cards/CBannerCard.vue +103 -103
- package/src/components/cards/CSmallCard.vue +149 -149
- package/src/components/internal-components/ConfirmDialog.vue +78 -78
- package/src/composables/useDialog.ts +46 -46
- package/src/composables/useDirtyCheck.ts +25 -25
- package/src/composables/useDoubleClickListener.ts +28 -28
- package/src/composables/useSelectable.ts +62 -62
- package/src/composables/useTruncateChips.ts +46 -46
- package/src/i18n/de/index.ts +17 -17
- package/src/i18n/en/index.ts +84 -84
- package/src/i18n/es/index.ts +7 -7
- package/src/i18n/fr/index.ts +7 -7
- package/src/init/initInriFramework.ts +37 -37
- package/src/init/useInriApp.ts +55 -55
- package/src/layouts/CLayoutBlank.vue +7 -7
- package/src/layouts/CLayoutWithBackButton.vue +50 -50
- package/src/layouts/CLayoutWithSidebars.vue +46 -46
- package/src/layouts/layout-fragments/CPageAutoBreadcrumbs.vue +6 -6
- package/src/layouts/layout-fragments/CPageBackButton.vue +18 -18
- package/src/layouts/layout-fragments/CPageBlank.vue +20 -20
- package/src/layouts/layout-fragments/CPageFlexCol.vue +5 -5
- package/src/layouts/layout-fragments/CPageLeftSidebar.vue +5 -5
- package/src/layouts/layout-fragments/CPageMainContent.vue +5 -5
- package/src/layouts/layout-fragments/CPageOuterWrapper.vue +5 -5
- package/src/layouts/layout-fragments/CPageRightSidebar.vue +5 -5
- package/src/layouts/layout-fragments/CPageTitle.vue +34 -34
- package/src/plugins/dialog.ts +45 -45
- package/src/plugins/errors/ErrorFactories.ts +59 -59
- package/src/plugins/errors/Errors.ts +156 -156
- package/src/plugins/errors/Exception.ts +6 -6
- package/src/plugins/errors/globalErrorHandler.ts +21 -21
- package/src/plugins/errors/handleError.ts +34 -34
- package/src/plugins/errors/logger.ts +16 -16
- package/src/plugins/errors/vueErrorHandler.ts +26 -26
- package/src/plugins/globalAppConfig.ts +25 -25
- package/src/plugins/i18n.ts +46 -46
- package/src/plugins/inriIcons.ts +58 -58
- package/src/plugins/inriverQuasarComponentConfigurations.ts +67 -67
- package/src/plugins/library.ts +119 -119
- package/src/plugins/notify.ts +153 -153
- package/src/plugins/quasar-user-options.ts +19 -19
- package/src/plugins/validationRules.ts +292 -292
- package/src/shims-vue.d.ts +6 -6
- package/src/stores/inriStore.ts +54 -54
- package/src/stores/interfaceLanguageStore.ts +27 -27
- package/src/styles/_css-variables.scss +101 -101
- package/src/styles/_reset.scss +67 -67
- package/src/styles/_transitions.scss +9 -9
- package/src/styles/_utils.scss +15 -15
- package/src/styles/components/_breadcrumbs.scss +3 -3
- package/src/styles/components/_checkboxes.scss +17 -17
- package/src/styles/components/_chips.scss +17 -17
- package/src/styles/components/_forms.scss +203 -203
- package/src/styles/components/_menu.scss +12 -12
- package/src/styles/components/_notifications.scss +24 -24
- package/src/styles/components/_q-editor.scss +14 -14
- package/src/styles/components/_radio-buttons.scss +17 -17
- package/src/styles/components/_tables.scss +92 -92
- package/src/styles/components/_tooltips.scss +5 -5
- package/src/styles/components/_tree.scss +86 -86
- package/src/styles/components/_truncated-chips.scss +39 -39
- package/src/styles/main.scss +45 -45
- package/src/styles/quasar.variables.scss +50 -50
- package/src/styles/tailwind/index.css +2 -2
- package/src/typings.d.ts +70 -70
- package/src/utils/colorUtils.ts +73 -73
- package/src/utils/errorUtils.ts +37 -37
- package/src/utils/fileUtils.ts +57 -57
- package/src/utils/helpers.ts +6 -6
- package/src/utils/routeUtils.ts +23 -23
- package/tsconfig.json +34 -34
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
import { i18n } from '../i18n'
|
|
2
|
-
|
|
3
|
-
const $t = i18n.global.t
|
|
4
|
-
const $te = i18n.global.te
|
|
5
|
-
|
|
6
|
-
// ---------
|
|
7
|
-
// Interfaces
|
|
8
|
-
// ---------
|
|
9
|
-
export interface BaseError {
|
|
10
|
-
title: string,
|
|
11
|
-
msg: string,
|
|
12
|
-
err: any,
|
|
13
|
-
isAxiosError: boolean,
|
|
14
|
-
status?: number
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface BaseErrorArguments {
|
|
18
|
-
defaultTitle?: string,
|
|
19
|
-
defaultMsg?: string,
|
|
20
|
-
title?: string,
|
|
21
|
-
msg?: string,
|
|
22
|
-
err: any
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// ---------
|
|
26
|
-
// Implementations
|
|
27
|
-
// ---------
|
|
28
|
-
export class GenericError implements BaseError {
|
|
29
|
-
title: string
|
|
30
|
-
msg: string
|
|
31
|
-
err: any
|
|
32
|
-
isAxiosError = false
|
|
33
|
-
|
|
34
|
-
constructor (
|
|
35
|
-
public args: BaseErrorArguments,
|
|
36
|
-
private defaultTitle = $t('inri.error.error'),
|
|
37
|
-
private defaultMsg = $t('inri.error.error_occurred'),
|
|
38
|
-
) {
|
|
39
|
-
this.defaultTitle = args?.defaultTitle || this.defaultTitle
|
|
40
|
-
this.defaultMsg = args?.defaultMsg || this.defaultMsg
|
|
41
|
-
this.title = args?.title ?? this.defaultTitle
|
|
42
|
-
this.msg = args?.msg ?? this.defaultMsg
|
|
43
|
-
this.err = args.err
|
|
44
|
-
|
|
45
|
-
this.processError()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
private processError () {
|
|
49
|
-
let errorMessage
|
|
50
|
-
|
|
51
|
-
if (this.err.type === 'unhandledrejection') {
|
|
52
|
-
errorMessage = this.err.reason?.toString() || $t('inri.error.unknown_error')
|
|
53
|
-
} else {
|
|
54
|
-
errorMessage = this.err.msg || this.err.toString()
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (this.msg === this.defaultMsg) {
|
|
58
|
-
this.msg = errorMessage
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export class AxiosError implements BaseError {
|
|
64
|
-
title: string
|
|
65
|
-
msg: string
|
|
66
|
-
err: any
|
|
67
|
-
isAxiosError = true
|
|
68
|
-
status = -1
|
|
69
|
-
|
|
70
|
-
constructor (
|
|
71
|
-
public args: BaseErrorArguments,
|
|
72
|
-
private defaultTitle = $t('inri.error.network_error'),
|
|
73
|
-
private defaultMsg = $t('inri.error.error_occurred'),
|
|
74
|
-
) {
|
|
75
|
-
this.title = args?.title ?? this.defaultTitle
|
|
76
|
-
this.msg = args?.msg ?? this.defaultMsg
|
|
77
|
-
this.err = args.err
|
|
78
|
-
|
|
79
|
-
this.processError()
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private processError () {
|
|
83
|
-
let errorMessage
|
|
84
|
-
|
|
85
|
-
if (this.err.response) {
|
|
86
|
-
// The request was made and the server responded with a status code
|
|
87
|
-
// that falls out of the range of 2xx
|
|
88
|
-
|
|
89
|
-
this.status = this.err.response.status
|
|
90
|
-
errorMessage = $te(`inri.error.${this.err.response.data?.errorDescription}`)
|
|
91
|
-
? $t(`inri.error.${this.err.response.data?.errorDescription}`)
|
|
92
|
-
: null
|
|
93
|
-
} else if (this.err.request) {
|
|
94
|
-
// The request was made but no response was received
|
|
95
|
-
// `this.err.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
96
|
-
// http.ClientRequest in node.js
|
|
97
|
-
|
|
98
|
-
this.status = this.err.request.status
|
|
99
|
-
errorMessage = this.err.request.statusText
|
|
100
|
-
} else {
|
|
101
|
-
// Something happened in setting up the request that triggered an Error
|
|
102
|
-
|
|
103
|
-
errorMessage = this.err.message
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (errorMessage && this.msg === this.defaultMsg) {
|
|
107
|
-
this.msg = errorMessage
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// ---------
|
|
113
|
-
// Extensions
|
|
114
|
-
// ---------
|
|
115
|
-
export class UnauthorizedError extends AxiosError {
|
|
116
|
-
constructor (public args: BaseErrorArguments) {
|
|
117
|
-
super(
|
|
118
|
-
args,
|
|
119
|
-
$t('inri.error.unauthorized'),
|
|
120
|
-
$t('inri.error.session_expired'),
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export class NotFoundError extends AxiosError {
|
|
126
|
-
constructor (public args: BaseErrorArguments) {
|
|
127
|
-
super(
|
|
128
|
-
args,
|
|
129
|
-
$t('inri.error.not_found'),
|
|
130
|
-
$t('inri.error.requested_asset_not_found'),
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export class ServiceUnavailableError extends AxiosError {
|
|
136
|
-
constructor (public args: BaseErrorArguments) {
|
|
137
|
-
super(
|
|
138
|
-
args,
|
|
139
|
-
$t('inri.error.service_unavailable'),
|
|
140
|
-
$t('inri.error.service_unavailable_try_again'),
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// ---------
|
|
146
|
-
// Specific error subtypes
|
|
147
|
-
// ---------
|
|
148
|
-
export class FolderNotFoundError extends AxiosError {
|
|
149
|
-
constructor (public args: BaseErrorArguments) {
|
|
150
|
-
super(
|
|
151
|
-
args,
|
|
152
|
-
$t('inri.error.not_found'),
|
|
153
|
-
$t('inri.error.could_not_retrieve_assets'),
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
1
|
+
import { i18n } from '../i18n'
|
|
2
|
+
|
|
3
|
+
const $t = i18n.global.t
|
|
4
|
+
const $te = i18n.global.te
|
|
5
|
+
|
|
6
|
+
// ---------
|
|
7
|
+
// Interfaces
|
|
8
|
+
// ---------
|
|
9
|
+
export interface BaseError {
|
|
10
|
+
title: string,
|
|
11
|
+
msg: string,
|
|
12
|
+
err: any,
|
|
13
|
+
isAxiosError: boolean,
|
|
14
|
+
status?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface BaseErrorArguments {
|
|
18
|
+
defaultTitle?: string,
|
|
19
|
+
defaultMsg?: string,
|
|
20
|
+
title?: string,
|
|
21
|
+
msg?: string,
|
|
22
|
+
err: any
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ---------
|
|
26
|
+
// Implementations
|
|
27
|
+
// ---------
|
|
28
|
+
export class GenericError implements BaseError {
|
|
29
|
+
title: string
|
|
30
|
+
msg: string
|
|
31
|
+
err: any
|
|
32
|
+
isAxiosError = false
|
|
33
|
+
|
|
34
|
+
constructor (
|
|
35
|
+
public args: BaseErrorArguments,
|
|
36
|
+
private defaultTitle = $t('inri.error.error'),
|
|
37
|
+
private defaultMsg = $t('inri.error.error_occurred'),
|
|
38
|
+
) {
|
|
39
|
+
this.defaultTitle = args?.defaultTitle || this.defaultTitle
|
|
40
|
+
this.defaultMsg = args?.defaultMsg || this.defaultMsg
|
|
41
|
+
this.title = args?.title ?? this.defaultTitle
|
|
42
|
+
this.msg = args?.msg ?? this.defaultMsg
|
|
43
|
+
this.err = args.err
|
|
44
|
+
|
|
45
|
+
this.processError()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private processError () {
|
|
49
|
+
let errorMessage
|
|
50
|
+
|
|
51
|
+
if (this.err.type === 'unhandledrejection') {
|
|
52
|
+
errorMessage = this.err.reason?.toString() || $t('inri.error.unknown_error')
|
|
53
|
+
} else {
|
|
54
|
+
errorMessage = this.err.msg || this.err.toString()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (this.msg === this.defaultMsg) {
|
|
58
|
+
this.msg = errorMessage
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export class AxiosError implements BaseError {
|
|
64
|
+
title: string
|
|
65
|
+
msg: string
|
|
66
|
+
err: any
|
|
67
|
+
isAxiosError = true
|
|
68
|
+
status = -1
|
|
69
|
+
|
|
70
|
+
constructor (
|
|
71
|
+
public args: BaseErrorArguments,
|
|
72
|
+
private defaultTitle = $t('inri.error.network_error'),
|
|
73
|
+
private defaultMsg = $t('inri.error.error_occurred'),
|
|
74
|
+
) {
|
|
75
|
+
this.title = args?.title ?? this.defaultTitle
|
|
76
|
+
this.msg = args?.msg ?? this.defaultMsg
|
|
77
|
+
this.err = args.err
|
|
78
|
+
|
|
79
|
+
this.processError()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private processError () {
|
|
83
|
+
let errorMessage
|
|
84
|
+
|
|
85
|
+
if (this.err.response) {
|
|
86
|
+
// The request was made and the server responded with a status code
|
|
87
|
+
// that falls out of the range of 2xx
|
|
88
|
+
|
|
89
|
+
this.status = this.err.response.status
|
|
90
|
+
errorMessage = $te(`inri.error.${this.err.response.data?.errorDescription}`)
|
|
91
|
+
? $t(`inri.error.${this.err.response.data?.errorDescription}`)
|
|
92
|
+
: null
|
|
93
|
+
} else if (this.err.request) {
|
|
94
|
+
// The request was made but no response was received
|
|
95
|
+
// `this.err.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
96
|
+
// http.ClientRequest in node.js
|
|
97
|
+
|
|
98
|
+
this.status = this.err.request.status
|
|
99
|
+
errorMessage = this.err.request.statusText
|
|
100
|
+
} else {
|
|
101
|
+
// Something happened in setting up the request that triggered an Error
|
|
102
|
+
|
|
103
|
+
errorMessage = this.err.message
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (errorMessage && this.msg === this.defaultMsg) {
|
|
107
|
+
this.msg = errorMessage
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ---------
|
|
113
|
+
// Extensions
|
|
114
|
+
// ---------
|
|
115
|
+
export class UnauthorizedError extends AxiosError {
|
|
116
|
+
constructor (public args: BaseErrorArguments) {
|
|
117
|
+
super(
|
|
118
|
+
args,
|
|
119
|
+
$t('inri.error.unauthorized'),
|
|
120
|
+
$t('inri.error.session_expired'),
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export class NotFoundError extends AxiosError {
|
|
126
|
+
constructor (public args: BaseErrorArguments) {
|
|
127
|
+
super(
|
|
128
|
+
args,
|
|
129
|
+
$t('inri.error.not_found'),
|
|
130
|
+
$t('inri.error.requested_asset_not_found'),
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export class ServiceUnavailableError extends AxiosError {
|
|
136
|
+
constructor (public args: BaseErrorArguments) {
|
|
137
|
+
super(
|
|
138
|
+
args,
|
|
139
|
+
$t('inri.error.service_unavailable'),
|
|
140
|
+
$t('inri.error.service_unavailable_try_again'),
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ---------
|
|
146
|
+
// Specific error subtypes
|
|
147
|
+
// ---------
|
|
148
|
+
export class FolderNotFoundError extends AxiosError {
|
|
149
|
+
constructor (public args: BaseErrorArguments) {
|
|
150
|
+
super(
|
|
151
|
+
args,
|
|
152
|
+
$t('inri.error.not_found'),
|
|
153
|
+
$t('inri.error.could_not_retrieve_assets'),
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export class Exception {
|
|
2
|
-
constructor (public msg: string, public error) {
|
|
3
|
-
this.msg = msg
|
|
4
|
-
this.error = error
|
|
5
|
-
}
|
|
6
|
-
}
|
|
1
|
+
export class Exception {
|
|
2
|
+
constructor (public msg: string, public error) {
|
|
3
|
+
this.msg = msg
|
|
4
|
+
this.error = error
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import handleError from './handleError'
|
|
2
|
-
|
|
3
|
-
// Handle errors outside of components
|
|
4
|
-
window.addEventListener('error', (event) => {
|
|
5
|
-
handleError(
|
|
6
|
-
{
|
|
7
|
-
err: event,
|
|
8
|
-
caughtBy: 'window eventListener on error',
|
|
9
|
-
},
|
|
10
|
-
)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
// Handle rejected promises outside components
|
|
14
|
-
window.addEventListener('unhandledrejection', (event) => {
|
|
15
|
-
handleError(
|
|
16
|
-
{
|
|
17
|
-
err: event,
|
|
18
|
-
caughtBy: 'window eventListener on unhandledrejection',
|
|
19
|
-
},
|
|
20
|
-
)
|
|
21
|
-
})
|
|
1
|
+
import handleError from './handleError'
|
|
2
|
+
|
|
3
|
+
// Handle errors outside of components
|
|
4
|
+
window.addEventListener('error', (event) => {
|
|
5
|
+
handleError(
|
|
6
|
+
{
|
|
7
|
+
err: event,
|
|
8
|
+
caughtBy: 'window eventListener on error',
|
|
9
|
+
},
|
|
10
|
+
)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Handle rejected promises outside components
|
|
14
|
+
window.addEventListener('unhandledrejection', (event) => {
|
|
15
|
+
handleError(
|
|
16
|
+
{
|
|
17
|
+
err: event,
|
|
18
|
+
caughtBy: 'window eventListener on unhandledrejection',
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
})
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { Exception } from './Exception'
|
|
2
|
-
import { ErrorFactory } from './ErrorFactories'
|
|
3
|
-
import logger from './logger'
|
|
4
|
-
import notify from '../notify'
|
|
5
|
-
import dialog from '../dialog'
|
|
6
|
-
|
|
7
|
-
export default function handleError (errInfoObj, vueInfoObj?) {
|
|
8
|
-
const err = errInfoObj.err
|
|
9
|
-
|
|
10
|
-
if (err instanceof Exception) {
|
|
11
|
-
const parsedError = ErrorFactory.createHelpfulError({
|
|
12
|
-
defaultMsg: err.msg,
|
|
13
|
-
err: err.error,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
dialog.info({
|
|
17
|
-
title: parsedError.title,
|
|
18
|
-
text: parsedError.msg,
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
errInfoObj.handledBy = 'handleError'
|
|
22
|
-
logger.logTrace(errInfoObj, vueInfoObj)
|
|
23
|
-
} else if (err) {
|
|
24
|
-
const parsedError = ErrorFactory.createHelpfulError({ err })
|
|
25
|
-
notify.error(parsedError.msg)
|
|
26
|
-
|
|
27
|
-
if (err.type === 'unhandledrejection') {
|
|
28
|
-
errInfoObj.handledBy = '-'
|
|
29
|
-
logger.logTrace(errInfoObj, vueInfoObj)
|
|
30
|
-
} else {
|
|
31
|
-
logger.logException(err)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
import { Exception } from './Exception'
|
|
2
|
+
import { ErrorFactory } from './ErrorFactories'
|
|
3
|
+
import logger from './logger'
|
|
4
|
+
import notify from '../notify'
|
|
5
|
+
import dialog from '../dialog'
|
|
6
|
+
|
|
7
|
+
export default function handleError (errInfoObj, vueInfoObj?) {
|
|
8
|
+
const err = errInfoObj.err
|
|
9
|
+
|
|
10
|
+
if (err instanceof Exception) {
|
|
11
|
+
const parsedError = ErrorFactory.createHelpfulError({
|
|
12
|
+
defaultMsg: err.msg,
|
|
13
|
+
err: err.error,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
dialog.info({
|
|
17
|
+
title: parsedError.title,
|
|
18
|
+
text: parsedError.msg,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
errInfoObj.handledBy = 'handleError'
|
|
22
|
+
logger.logTrace(errInfoObj, vueInfoObj)
|
|
23
|
+
} else if (err) {
|
|
24
|
+
const parsedError = ErrorFactory.createHelpfulError({ err })
|
|
25
|
+
notify.error(parsedError.msg)
|
|
26
|
+
|
|
27
|
+
if (err.type === 'unhandledrejection') {
|
|
28
|
+
errInfoObj.handledBy = '-'
|
|
29
|
+
logger.logTrace(errInfoObj, vueInfoObj)
|
|
30
|
+
} else {
|
|
31
|
+
logger.logException(err)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
init () {
|
|
3
|
-
// TODO: Init logger
|
|
4
|
-
},
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
-
logTrace (errInfoObj, vueInfoObj?) {
|
|
7
|
-
console.log('LOGGING TRACE')
|
|
8
|
-
console.log(errInfoObj)
|
|
9
|
-
// TODO: Log something
|
|
10
|
-
},
|
|
11
|
-
logException (error) {
|
|
12
|
-
console.log('LOGGING EXCEPTION')
|
|
13
|
-
console.log(error)
|
|
14
|
-
// TODO: Log something
|
|
15
|
-
},
|
|
16
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
init () {
|
|
3
|
+
// TODO: Init logger
|
|
4
|
+
},
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
logTrace (errInfoObj, vueInfoObj?) {
|
|
7
|
+
console.log('LOGGING TRACE')
|
|
8
|
+
console.log(errInfoObj)
|
|
9
|
+
// TODO: Log something
|
|
10
|
+
},
|
|
11
|
+
logException (error) {
|
|
12
|
+
console.log('LOGGING EXCEPTION')
|
|
13
|
+
console.log(error)
|
|
14
|
+
// TODO: Log something
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import handleError from './handleError'
|
|
2
|
-
import { Exception } from './Exception'
|
|
3
|
-
import { ComponentPublicInstance } from 'vue'
|
|
4
|
-
|
|
5
|
-
export function VueErrorHandler (app) {
|
|
6
|
-
// Exception handling within Vue components
|
|
7
|
-
app.config.errorHandler = (err, vm: ComponentPublicInstance | null, info: string) => {
|
|
8
|
-
let exception
|
|
9
|
-
|
|
10
|
-
if (err instanceof Exception) {
|
|
11
|
-
exception = err
|
|
12
|
-
} else {
|
|
13
|
-
exception = new Exception(err.message, err)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
handleError(
|
|
17
|
-
{
|
|
18
|
-
err: exception,
|
|
19
|
-
caughtBy: 'app.config.errorHandler',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
info: info,
|
|
23
|
-
},
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
import handleError from './handleError'
|
|
2
|
+
import { Exception } from './Exception'
|
|
3
|
+
import { ComponentPublicInstance } from 'vue'
|
|
4
|
+
|
|
5
|
+
export function VueErrorHandler (app) {
|
|
6
|
+
// Exception handling within Vue components
|
|
7
|
+
app.config.errorHandler = (err, vm: ComponentPublicInstance | null, info: string) => {
|
|
8
|
+
let exception
|
|
9
|
+
|
|
10
|
+
if (err instanceof Exception) {
|
|
11
|
+
exception = err
|
|
12
|
+
} else {
|
|
13
|
+
exception = new Exception(err.message, err)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
handleError(
|
|
17
|
+
{
|
|
18
|
+
err: exception,
|
|
19
|
+
caughtBy: 'app.config.errorHandler',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
info: info,
|
|
23
|
+
},
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { App } from 'vue'
|
|
2
|
-
import { rules } from './validationRules'
|
|
3
|
-
import notify from './notify'
|
|
4
|
-
import dialog from './dialog'
|
|
5
|
-
import { colors } from '../utils/colorUtils'
|
|
6
|
-
import { quasarComponentConfigurations } from './inriverQuasarComponentConfigurations'
|
|
7
|
-
|
|
8
|
-
// register components
|
|
9
|
-
export const registerAppConfigurations = (Vue: App): void => {
|
|
10
|
-
// Expose $validate in templates
|
|
11
|
-
Vue.config.globalProperties.$validate = rules
|
|
12
|
-
|
|
13
|
-
// Expose $notify in templates
|
|
14
|
-
Vue.config.globalProperties.$notify = notify
|
|
15
|
-
|
|
16
|
-
// Expose $dialog in templates
|
|
17
|
-
Vue.config.globalProperties.$dialog = dialog
|
|
18
|
-
|
|
19
|
-
// Expose colors so it's easy to loop them on demo pages
|
|
20
|
-
Vue.config.globalProperties.$colors = colors
|
|
21
|
-
|
|
22
|
-
// Configurations that can be used on quasar components. Example:
|
|
23
|
-
// <q-input v-bind="$inri.input" />
|
|
24
|
-
Vue.config.globalProperties.$inri = quasarComponentConfigurations
|
|
25
|
-
}
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import { rules } from './validationRules'
|
|
3
|
+
import notify from './notify'
|
|
4
|
+
import dialog from './dialog'
|
|
5
|
+
import { colors } from '../utils/colorUtils'
|
|
6
|
+
import { quasarComponentConfigurations } from './inriverQuasarComponentConfigurations'
|
|
7
|
+
|
|
8
|
+
// register components
|
|
9
|
+
export const registerAppConfigurations = (Vue: App): void => {
|
|
10
|
+
// Expose $validate in templates
|
|
11
|
+
Vue.config.globalProperties.$validate = rules
|
|
12
|
+
|
|
13
|
+
// Expose $notify in templates
|
|
14
|
+
Vue.config.globalProperties.$notify = notify
|
|
15
|
+
|
|
16
|
+
// Expose $dialog in templates
|
|
17
|
+
Vue.config.globalProperties.$dialog = dialog
|
|
18
|
+
|
|
19
|
+
// Expose colors so it's easy to loop them on demo pages
|
|
20
|
+
Vue.config.globalProperties.$colors = colors
|
|
21
|
+
|
|
22
|
+
// Configurations that can be used on quasar components. Example:
|
|
23
|
+
// <q-input v-bind="$inri.input" />
|
|
24
|
+
Vue.config.globalProperties.$inri = quasarComponentConfigurations
|
|
25
|
+
}
|
package/src/plugins/i18n.ts
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { createI18n } from 'vue-i18n'
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import en from '../i18n/en'
|
|
4
|
-
|
|
5
|
-
// Preload English (required if we want a fallback language)
|
|
6
|
-
const i18n = createI18n({
|
|
7
|
-
locale: 'en',
|
|
8
|
-
fallbackLocale: 'en',
|
|
9
|
-
messages: {
|
|
10
|
-
en: en,
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const loadedLanguages = ['en']
|
|
15
|
-
|
|
16
|
-
function setI18nLanguage (lang) {
|
|
17
|
-
i18n.global.locale = lang
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
document.querySelector('html').setAttribute('lang', lang)
|
|
20
|
-
return lang
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// This will load our own custom i18n translation files
|
|
24
|
-
export function loadi18nLanguageAsync (lang) {
|
|
25
|
-
// If the same language
|
|
26
|
-
if (i18n.global.locale === lang) {
|
|
27
|
-
return Promise.resolve(setI18nLanguage(lang))
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// If the language was already loaded
|
|
31
|
-
if (loadedLanguages.includes(lang)) {
|
|
32
|
-
return Promise.resolve(setI18nLanguage(lang))
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// If the language hasn't been loaded yet
|
|
36
|
-
return import(
|
|
37
|
-
/* webpackChunkName: "lang-[request]" */ '@/i18n/' + lang).then(
|
|
38
|
-
messages => {
|
|
39
|
-
i18n.global.setLocaleMessage(lang, messages.default)
|
|
40
|
-
loadedLanguages.push(lang)
|
|
41
|
-
return setI18nLanguage(lang)
|
|
42
|
-
},
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { i18n }
|
|
1
|
+
import { createI18n } from 'vue-i18n'
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import en from '../i18n/en'
|
|
4
|
+
|
|
5
|
+
// Preload English (required if we want a fallback language)
|
|
6
|
+
const i18n = createI18n({
|
|
7
|
+
locale: 'en',
|
|
8
|
+
fallbackLocale: 'en',
|
|
9
|
+
messages: {
|
|
10
|
+
en: en,
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const loadedLanguages = ['en']
|
|
15
|
+
|
|
16
|
+
function setI18nLanguage (lang) {
|
|
17
|
+
i18n.global.locale = lang
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
document.querySelector('html').setAttribute('lang', lang)
|
|
20
|
+
return lang
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// This will load our own custom i18n translation files
|
|
24
|
+
export function loadi18nLanguageAsync (lang) {
|
|
25
|
+
// If the same language
|
|
26
|
+
if (i18n.global.locale === lang) {
|
|
27
|
+
return Promise.resolve(setI18nLanguage(lang))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// If the language was already loaded
|
|
31
|
+
if (loadedLanguages.includes(lang)) {
|
|
32
|
+
return Promise.resolve(setI18nLanguage(lang))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// If the language hasn't been loaded yet
|
|
36
|
+
return import(
|
|
37
|
+
/* webpackChunkName: "lang-[request]" */ '@/i18n/' + lang).then(
|
|
38
|
+
messages => {
|
|
39
|
+
i18n.global.setLocaleMessage(lang, messages.default)
|
|
40
|
+
loadedLanguages.push(lang)
|
|
41
|
+
return setI18nLanguage(lang)
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { i18n }
|