@fdm-monster/client-next 0.0.1 → 0.0.3

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.
Files changed (199) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/RELEASE_NOTES.MD +28 -1
  3. package/dist/assets/MaterialIcons-Regular-BjXOXp5c.eot +0 -0
  4. package/dist/assets/MaterialIcons-Regular-DEUTIz1o.ttf +0 -0
  5. package/dist/assets/MaterialIcons-Regular-DOtZ65Va.woff2 +0 -0
  6. package/dist/assets/MaterialIcons-Regular-FsbMSDLx.woff +0 -0
  7. package/dist/assets/index-CHzfWKPO.css +5 -0
  8. package/dist/assets/index-WVqTlgq7.js +90 -0
  9. package/dist/assets/index-WVqTlgq7.js.map +1 -0
  10. package/dist/favicon.ico +0 -0
  11. package/dist/img/DavidZwart.jpg +0 -0
  12. package/dist/img/OIG.JYDC2RaWdz7g9.jpg +0 -0
  13. package/dist/img/OIG.jpg +0 -0
  14. package/dist/img/icons/android-chrome-256x256.png +0 -0
  15. package/dist/img/icons/android-chrome-384x384.png +0 -0
  16. package/dist/img/icons/android-chrome-512x512.png +0 -0
  17. package/dist/img/icons/favicon.svg +1 -0
  18. package/dist/img/logo.png +0 -0
  19. package/dist/img/logo.svg +1 -0
  20. package/dist/img/manifest.webmanifest +33 -0
  21. package/dist/img/octoprint-tentacle.svg +144 -0
  22. package/dist/img/thumbail_unknown.jpg +0 -0
  23. package/dist/img/vbanner.jpg +0 -0
  24. package/dist/index.html +24 -0
  25. package/dist/robots.txt +2 -0
  26. package/package.json +1 -1
  27. package/.all-contributorsrc +0 -57
  28. package/.editorconfig +0 -5
  29. package/.eslintrc.js +0 -126
  30. package/.github/FUNDING.yml +0 -3
  31. package/.github/workflows/release-client.yml +0 -94
  32. package/.github/workflows/vue-publish.yml +0 -26
  33. package/.prettierignore +0 -15
  34. package/.whitesource +0 -12
  35. package/renovate.json +0 -30
  36. package/src/App.vue +0 -60
  37. package/src/AppLoader.vue +0 -383
  38. package/src/assets/adjectives.json +0 -1468
  39. package/src/assets/logo.svg +0 -6
  40. package/src/assets/nouns.json +0 -4309
  41. package/src/auto-imports.d.ts +0 -139
  42. package/src/backend/app.service.ts +0 -39
  43. package/src/backend/auth.service.ts +0 -56
  44. package/src/backend/base.service.ts +0 -57
  45. package/src/backend/batch.service.ts +0 -37
  46. package/src/backend/camera-stream.service.ts +0 -33
  47. package/src/backend/custom-gcode.service.ts +0 -11
  48. package/src/backend/dto/octoprint-settings.dto.ts +0 -168
  49. package/src/backend/first-time-setup.service.ts +0 -17
  50. package/src/backend/floor.service.ts +0 -84
  51. package/src/backend/index.ts +0 -4
  52. package/src/backend/print-completions.service.ts +0 -11
  53. package/src/backend/printer-file.service.ts +0 -91
  54. package/src/backend/printer-group.service.ts +0 -62
  55. package/src/backend/printer-job.service.ts +0 -20
  56. package/src/backend/printer-settings.service.ts +0 -28
  57. package/src/backend/printers.service.ts +0 -136
  58. package/src/backend/server-private.service.ts +0 -55
  59. package/src/backend/server.api.ts +0 -132
  60. package/src/backend/settings.service.ts +0 -85
  61. package/src/backend/user.service.ts +0 -51
  62. package/src/components/AboutHelp/AboutView.vue +0 -164
  63. package/src/components/CameraGrid/CameraGridView.vue +0 -111
  64. package/src/components/FirstTimeSetup/FirstTimeSetupView.vue +0 -354
  65. package/src/components/Generic/Actions/PrinterConnectionAction.vue +0 -56
  66. package/src/components/Generic/Actions/PrinterCreateAction.vue +0 -22
  67. package/src/components/Generic/Actions/PrinterDeleteAction.vue +0 -29
  68. package/src/components/Generic/Actions/PrinterQuickStopAction.vue +0 -35
  69. package/src/components/Generic/Actions/PrinterSettingsAction.vue +0 -35
  70. package/src/components/Generic/Actions/PrinterUrlAction.vue +0 -24
  71. package/src/components/Generic/Actions/RefreshFilesAction.vue +0 -50
  72. package/src/components/Generic/Actions/SyncPrinterNameAction.vue +0 -36
  73. package/src/components/Generic/Dialogs/AddOrUpdateCameraStreamDialog.vue +0 -131
  74. package/src/components/Generic/Dialogs/AddOrUpdateFloorDialog.vue +0 -141
  75. package/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue +0 -303
  76. package/src/components/Generic/Dialogs/BaseDialog.vue +0 -81
  77. package/src/components/Generic/Dialogs/BatchJsonCreateDialog.vue +0 -109
  78. package/src/components/Generic/Dialogs/BatchReprintDialog.vue +0 -190
  79. package/src/components/Generic/Dialogs/PrinterChecksPanel.vue +0 -37
  80. package/src/components/Generic/Dialogs/PrinterControlDialog.vue +0 -202
  81. package/src/components/Generic/Dialogs/PrinterMaintenanceDialog.vue +0 -130
  82. package/src/components/Generic/Dialogs/YamlImportExportDialog.vue +0 -186
  83. package/src/components/Generic/Dialogs/dialog.constants.ts +0 -19
  84. package/src/components/Generic/FileExplorerSideNav.vue +0 -734
  85. package/src/components/Generic/Loaders/GridLoader.vue +0 -68
  86. package/src/components/Generic/NavigationDrawer.vue +0 -69
  87. package/src/components/Generic/PrintJobsMenu.vue +0 -148
  88. package/src/components/Generic/Snackbars/AppErrorSnackbar.vue +0 -64
  89. package/src/components/Generic/Snackbars/AppInfoSnackbar.vue +0 -63
  90. package/src/components/Generic/Snackbars/AppProgressSnackbar.vue +0 -158
  91. package/src/components/Generic/Vuetify/TooltipButton.vue +0 -47
  92. package/src/components/HelpOverlay/HelpOverlay.vue +0 -57
  93. package/src/components/Login/LoginForm.vue +0 -206
  94. package/src/components/Login/LoginView.spec.ts +0 -64
  95. package/src/components/Login/LoginView.vue +0 -65
  96. package/src/components/Login/Logo.vue +0 -13
  97. package/src/components/Login/PermissionDenied.vue +0 -109
  98. package/src/components/Login/RegistrationForm.vue +0 -207
  99. package/src/components/Login/RegistrationView.vue +0 -17
  100. package/src/components/Login/__snapshots__/LoginView.spec.ts.snap +0 -1051
  101. package/src/components/NotFound/NotFoundView.vue +0 -39
  102. package/src/components/PrintStatistics/PrintStatistics.vue +0 -168
  103. package/src/components/PrintStatistics/PrintStatisticsView.vue +0 -15
  104. package/src/components/PrinterGrid/HomeToolbar.vue +0 -90
  105. package/src/components/PrinterGrid/PrinterGrid.vue +0 -164
  106. package/src/components/PrinterGrid/PrinterGridTile.vue +0 -438
  107. package/src/components/PrinterGrid/PrinterGridView.vue +0 -210
  108. package/src/components/PrinterList/FileControlList.vue +0 -40
  109. package/src/components/PrinterList/PrinterDetails.vue +0 -91
  110. package/src/components/PrinterList/PrintersView.vue +0 -492
  111. package/src/components/Settings/AccountSettings.vue +0 -163
  112. package/src/components/Settings/DiagnosticsSettings.vue +0 -137
  113. package/src/components/Settings/EmergencyCommands.vue +0 -265
  114. package/src/components/Settings/FloorSettings.vue +0 -276
  115. package/src/components/Settings/GridSettings.vue +0 -127
  116. package/src/components/Settings/OctoPrintSettings.vue +0 -188
  117. package/src/components/Settings/ServerProtectionSettings.vue +0 -370
  118. package/src/components/Settings/SettingsView.vue +0 -73
  119. package/src/components/Settings/SoftwareUpgradeSettings.vue +0 -297
  120. package/src/components/Settings/UserManagementSettings.vue +0 -257
  121. package/src/components/TopBar.vue +0 -147
  122. package/src/components.d.ts +0 -70
  123. package/src/directives/file-upload.directive.ts +0 -117
  124. package/src/directives/printer-drop-position.directive.ts +0 -92
  125. package/src/env.d.ts +0 -6
  126. package/src/main.ts +0 -76
  127. package/src/models/batch/reprint.dto.ts +0 -79
  128. package/src/models/batch.model.ts +0 -11
  129. package/src/models/camera-streams/camera-stream.ts +0 -19
  130. package/src/models/floors/floor.model.ts +0 -30
  131. package/src/models/octoprint/connection-options.model.ts +0 -8
  132. package/src/models/plugins/firmware-updates/prusa-firmware-release.model.ts +0 -57
  133. package/src/models/print-completions/print-completions.model.ts +0 -49
  134. package/src/models/printers/crud/create-printer.model.ts +0 -26
  135. package/src/models/printers/file-upload-commands.model.ts +0 -4
  136. package/src/models/printers/gcode/gcode-analysis.model.ts +0 -30
  137. package/src/models/printers/printer-current-job.model.ts +0 -90
  138. package/src/models/printers/printer-file.model.ts +0 -48
  139. package/src/models/printers/printer.model.ts +0 -18
  140. package/src/models/server/client-releases.model.ts +0 -27
  141. package/src/models/server/export-yaml.model.ts +0 -11
  142. package/src/models/server/features.model.ts +0 -37
  143. package/src/models/server/github-rate-limit.model.ts +0 -21
  144. package/src/models/server/version.model.ts +0 -14
  145. package/src/models/settings/printer-file-clean-settings.model.ts +0 -5
  146. package/src/models/settings/server-settings.dto.ts +0 -19
  147. package/src/models/settings/settings.model.ts +0 -57
  148. package/src/models/socketio-messages/socketio-message.model.ts +0 -53
  149. package/src/models/uploads/queued-upload.model.ts +0 -12
  150. package/src/models/user.model.ts +0 -15
  151. package/src/plugins/README.md +0 -3
  152. package/src/plugins/index.ts +0 -17
  153. package/src/plugins/vuetify.ts +0 -53
  154. package/src/router/index.ts +0 -192
  155. package/src/router/route-names.ts +0 -14
  156. package/src/router/utils.ts +0 -23
  157. package/src/shared/alert.events.ts +0 -14
  158. package/src/shared/app.constants.ts +0 -23
  159. package/src/shared/auth.constants.ts +0 -34
  160. package/src/shared/dialog.composable.ts +0 -41
  161. package/src/shared/drag.constants.ts +0 -19
  162. package/src/shared/experimental.constants.ts +0 -1
  163. package/src/shared/http-client.ts +0 -162
  164. package/src/shared/noun-adjectives.data.ts +0 -24
  165. package/src/shared/printer-grid.constants.ts +0 -5
  166. package/src/shared/printer-state.constants.ts +0 -194
  167. package/src/shared/snackbar.composable.ts +0 -66
  168. package/src/shared/socketio.service.ts +0 -104
  169. package/src/store/auth.store.ts +0 -255
  170. package/src/store/connection.store.ts +0 -66
  171. package/src/store/dialog.store.ts +0 -114
  172. package/src/store/features.store.ts +0 -57
  173. package/src/store/floor.store.ts +0 -173
  174. package/src/store/grid.store.ts +0 -10
  175. package/src/store/index.ts +0 -4
  176. package/src/store/printer-state.store.ts +0 -246
  177. package/src/store/printer.store.ts +0 -236
  178. package/src/store/profile.store.ts +0 -25
  179. package/src/store/settings.store.ts +0 -64
  180. package/src/store/test-printer.store.ts +0 -70
  181. package/src/store/uploads.store.ts +0 -75
  182. package/src/styles/README.md +0 -3
  183. package/src/styles/settings.scss +0 -10
  184. package/src/types/global.d.ts +0 -15
  185. package/src/utils/array.utils.ts +0 -15
  186. package/src/utils/date.utils.ts +0 -5
  187. package/src/utils/download-file.util.ts +0 -25
  188. package/src/utils/error.utils.ts +0 -3
  189. package/src/utils/file-size.util.ts +0 -11
  190. package/src/utils/id.type.ts +0 -1
  191. package/src/utils/sentry.util.ts +0 -8
  192. package/src/utils/test.util.ts +0 -30
  193. package/src/utils/time.utils.ts +0 -2
  194. package/src/utils/uploads-state.utils.ts +0 -58
  195. package/src/utils/validation.utils.ts +0 -14
  196. package/src/vite-env.d.ts +0 -7
  197. package/test/setup-axios-mock.ts +0 -15
  198. /package/{src/assets/logo.png → dist/assets/logo-CJVdjy51.png} +0 -0
  199. /package/{src/assets → dist/img/icons}/android-chrome-192x192.png +0 -0
@@ -1,192 +0,0 @@
1
- import { createRouter, createWebHistory } from 'vue-router'
2
- import PrinterGridView from '@/components/PrinterGrid/PrinterGridView.vue'
3
- import PrintersView from '@/components/PrinterList/PrintersView.vue'
4
- import Settings from '@/components/Settings/SettingsView.vue'
5
- import UserManagementSettings from '@/components/Settings/UserManagementSettings.vue'
6
- import OctoPrintSettings from '@/components/Settings/OctoPrintSettings.vue'
7
- import FloorSettings from '@/components/Settings/FloorSettings.vue'
8
- import AboutView from '@/components/AboutHelp/AboutView.vue'
9
- import EmergencyCommands from '@/components/Settings/EmergencyCommands.vue'
10
- import NotFoundView from '@/components/NotFound/NotFoundView.vue'
11
- import { useAuthStore } from '@/store/auth.store'
12
- import { RouteNames } from './route-names'
13
- import PermissionDenied from '../components/Login/PermissionDenied.vue'
14
- import LoginView from '../components/Login/LoginView.vue'
15
- import RegistrationView from '../components/Login/RegistrationView.vue'
16
- import CameraGridView from '../components/CameraGrid/CameraGridView.vue'
17
- import FirstTimeSetupView from '../components/FirstTimeSetup/FirstTimeSetupView.vue'
18
- import AccountSettings from '../components/Settings/AccountSettings.vue'
19
- import GridSettings from '../components/Settings/GridSettings.vue'
20
- import ServerProtectionSettings from '../components/Settings/ServerProtectionSettings.vue'
21
- import SoftwareUpgradeSettings from '../components/Settings/SoftwareUpgradeSettings.vue'
22
- import DiagnosticsSettings from '../components/Settings/DiagnosticsSettings.vue'
23
- import PrintStatisticsView from '../components/PrintStatistics/PrintStatisticsView.vue'
24
-
25
- const NeedsAuth = {
26
- requiresAuth: true
27
- }
28
-
29
- const NoAuth = {
30
- requiresAuth: false
31
- }
32
-
33
- const router = createRouter({
34
- history: createWebHistory(import.meta.env.BASE_URL),
35
- routes: [
36
- {
37
- path: '/',
38
- name: RouteNames.Home,
39
- meta: NeedsAuth,
40
- component: PrinterGridView
41
- },
42
- {
43
- path: '/first-time-setup',
44
- name: RouteNames.FirstTimeSetup,
45
- meta: NoAuth,
46
- component: FirstTimeSetupView
47
- },
48
- {
49
- path: '/login',
50
- name: RouteNames.Login,
51
- meta: NoAuth,
52
- component: LoginView
53
- },
54
- {
55
- path: '/registration',
56
- name: RouteNames.Registration,
57
- meta: NoAuth,
58
- component: RegistrationView
59
- },
60
- {
61
- path: '/printers',
62
- name: RouteNames.PrintersView,
63
- meta: NeedsAuth,
64
- component: PrintersView
65
- },
66
- {
67
- path: '/cameras',
68
- name: RouteNames.CameraGridView,
69
- component: CameraGridView
70
- },
71
- {
72
- path: '/settings',
73
- component: Settings,
74
- meta: NeedsAuth,
75
- children: [
76
- {
77
- path: '',
78
- meta: NeedsAuth,
79
- redirect: '/settings/grid'
80
- },
81
- {
82
- path: 'account',
83
- meta: NeedsAuth,
84
- component: AccountSettings
85
- },
86
- {
87
- path: 'server-protection',
88
- meta: NeedsAuth,
89
- component: ServerProtectionSettings
90
- },
91
- {
92
- path: 'grid',
93
- meta: NeedsAuth,
94
- component: GridSettings
95
- },
96
- {
97
- path: 'floors',
98
- meta: NeedsAuth,
99
- component: FloorSettings
100
- },
101
- {
102
- path: 'user-management',
103
- meta: NeedsAuth,
104
- component: UserManagementSettings
105
- },
106
- {
107
- path: 'octoprint',
108
- meta: NeedsAuth,
109
- component: OctoPrintSettings
110
- },
111
- {
112
- path: 'emergency-commands',
113
- meta: NeedsAuth,
114
- component: EmergencyCommands
115
- },
116
- {
117
- path: 'software-upgrade',
118
- meta: NeedsAuth,
119
- component: SoftwareUpgradeSettings
120
- },
121
- {
122
- path: 'diagnostics',
123
- meta: NeedsAuth,
124
- component: DiagnosticsSettings
125
- }
126
- ]
127
- },
128
- // {
129
- // path: "/repair-log",
130
- // name: "Repair Log",
131
- // component: RepairLogView,
132
- // },
133
- {
134
- path: '/statistics',
135
- name: RouteNames.PrintStatistics,
136
- meta: NeedsAuth,
137
- component: PrintStatisticsView
138
- },
139
- {
140
- path: '/about',
141
- name: 'About',
142
- component: AboutView
143
- },
144
- {
145
- path: '/permission-denied',
146
- name: RouteNames.PermissionDenied,
147
- meta: NeedsAuth,
148
- component: PermissionDenied
149
- },
150
- {
151
- path: '/:pathMatch(.*)*',
152
- name: 'NotFound',
153
- component: NotFoundView
154
- }
155
- ]
156
- })
157
-
158
- router.beforeEach(async (to, from, next) => {
159
- // This prevents login page from being shown when already logged in
160
- const authStore = useAuthStore()
161
-
162
- // Note that we do not let loginRequired === null coerce to false as that means its not loaded
163
- if (!to?.meta?.requiresAuth || authStore.loginRequired === false) {
164
- console.debug(`No auth required on route ${to.fullPath}`)
165
- return next()
166
- }
167
- // TODO why is this here again? This causes the app not to initialize properly (SocketIO/settings in AppLoader)
168
- // else if (authStore.loginRequired === null) {
169
- // return next();
170
- // }
171
- else {
172
- console.debug(
173
- `Auth required on route ${to.fullPath} (loginRequired=${authStore.loginRequired}, registration=${authStore.registration}, wizardState=${authStore.wizardState}, requiresAuth=${to?.meta?.requiresAuth})`
174
- )
175
- }
176
-
177
- authStore.loadTokens()
178
- if (!authStore.hasAuthToken && !authStore.hasRefreshToken) {
179
- console.debug('Not logged in, redirecting to login page')
180
- if (from.path == '/login') {
181
- throw new Error('Already on login page, cannot redirect')
182
- }
183
- return next({
184
- path: '/login',
185
- query: { redirect: to.fullPath }
186
- })
187
- }
188
-
189
- return next()
190
- })
191
-
192
- export default router
@@ -1,14 +0,0 @@
1
- export const RouteNames = {
2
- Home: 'Home',
3
- Login: 'Login',
4
- Registration: 'Registration',
5
- PrintersView: 'PrintersView',
6
- Settings: 'Settings',
7
- CameraGridView: 'CameraGridView',
8
- PrintStatistics: 'Print Statistics',
9
- About: 'About',
10
- PermissionDenied: 'PermissionDenied',
11
- NotFound: 'NotFound',
12
- FirstTimeSetup: 'FirstTimeSetup',
13
- ServerProtection: 'ServerProtection'
14
- }
@@ -1,23 +0,0 @@
1
- import { Router } from 'vue-router'
2
- import { RouteNames } from './route-names'
3
-
4
- export async function routeToPath(router: Router, name: string) {
5
- return router.push({ name })
6
- }
7
-
8
- export async function routeToLogin(router: Router) {
9
- // Prevent redundant or circular routing
10
- if (router.currentRoute.value.path === '/login') {
11
- console.log('routeToLogin: already at login page')
12
- return
13
- }
14
- return routeToPath(router, RouteNames.Login)
15
- }
16
-
17
- export async function routeToHome(router: Router) {
18
- // Prevent redundant or circular routing
19
- if (router.currentRoute.value.path === '/') {
20
- return
21
- }
22
- return routeToPath(router, RouteNames.Home)
23
- }
@@ -1,14 +0,0 @@
1
- export enum InfoEventType {
2
- UPLOAD_BACKEND,
3
- UPLOAD_FRONTEND
4
- }
5
-
6
- export const eventTypeToMessage = (type: InfoEventType, count: number) => {
7
- if (type === InfoEventType.UPLOAD_BACKEND) {
8
- return `Server is sending file(s) (${count})`
9
- } else if (type === InfoEventType.UPLOAD_FRONTEND) {
10
- return `Uploading file(s) to server (${count})`
11
- } else {
12
- return 'Uploading file(s)'
13
- }
14
- }
@@ -1,23 +0,0 @@
1
- export const isDevEnv = true // process.env.NODE_ENV === 'development'
2
- export const isProdEnv = false // process.env.NODE_ENV === 'production'
3
-
4
- export interface AppConstants {
5
- apiKeyLength: number
6
- maxPort: number
7
- maxPrinterNameLength: number
8
- maxPrinterGroupNameLength: number
9
- maxPrinterGroupLocationX: number
10
- maxPrinterGroupLocationY: number
11
- minPrinterFloorNameLength: number
12
- }
13
-
14
- export const generateAppConstants = (): Readonly<AppConstants> =>
15
- Object.freeze({
16
- apiKeyLength: 32,
17
- maxPort: 65535,
18
- maxPrinterNameLength: 25,
19
- maxPrinterGroupNameLength: 30, // Doesn't exist on backend
20
- maxPrinterGroupLocationX: 4,
21
- maxPrinterGroupLocationY: 4,
22
- minPrinterFloorNameLength: 3
23
- }) as Readonly<AppConstants>
@@ -1,34 +0,0 @@
1
- export interface PermissionDeniedEvent {
2
- roles?: string[]
3
- permissions?: string[]
4
- error?: string
5
- url?: string
6
- }
7
-
8
- export const AUTH_ERROR_REASON = {
9
- IncorrectCredentials: 'IncorrectCredentials',
10
- InvalidOrExpiredRefreshToken: 'InvalidOrExpiredRefreshToken',
11
- InvalidOrExpiredAuthToken: 'InvalidOrExpiredAuthToken',
12
- PasswordChangeRequired: 'PasswordChangeRequired',
13
- LoginRequired: 'LoginRequired',
14
- AccountNotVerified: 'AccountNotVerified'
15
- }
16
-
17
- export function convertAuthErrorReason(error: string) {
18
- switch (error) {
19
- case AUTH_ERROR_REASON.IncorrectCredentials:
20
- return 'Incorrect credentials'
21
- case AUTH_ERROR_REASON.InvalidOrExpiredRefreshToken:
22
- return 'Invalid or expired refresh token'
23
- case AUTH_ERROR_REASON.InvalidOrExpiredAuthToken:
24
- return 'Invalid or expired auth token'
25
- case AUTH_ERROR_REASON.PasswordChangeRequired:
26
- return 'Password change required'
27
- case AUTH_ERROR_REASON.LoginRequired:
28
- return 'Login required'
29
- case AUTH_ERROR_REASON.AccountNotVerified:
30
- return 'Account not verified'
31
- default:
32
- return 'Authentication error'
33
- }
34
- }
@@ -1,41 +0,0 @@
1
- import { useDialogsStore } from '@/store/dialog.store'
2
- import { DialogName } from '@/components/Generic/Dialogs/dialog.constants'
3
- import { watchEffect } from 'vue'
4
-
5
- export function useDialog<T = any, O = any>(dialogId: DialogName) {
6
- const dialogStore = useDialogsStore()
7
-
8
- async function openDialog(context?: T) {
9
- const beforeOpenedCallback = dialogStore.getBeforeOpenedCallback(dialogId)
10
- if (beforeOpenedCallback) {
11
- await beforeOpenedCallback(context)
12
- }
13
-
14
- dialogStore.openDialogWithContext(dialogId, context)
15
-
16
- const openedCallback = dialogStore.getOpenedCallback(dialogId)
17
- if (openedCallback) {
18
- await openedCallback(context)
19
- }
20
- }
21
-
22
- return {
23
- dialogId,
24
- dialogStore,
25
- openDialog,
26
- context: () => dialogStore.getContext(dialogId),
27
- closeDialog: (output?: O) => dialogStore.closeDialog(dialogId, output),
28
- isDialogOpened: () => dialogStore.isDialogOpened(dialogId),
29
- handleAsync: async (input: T): Promise<O> => {
30
- await openDialog(input)
31
-
32
- return new Promise<O>((resolve) => {
33
- watchEffect(() => {
34
- if (!dialogStore.isDialogOpened(dialogId)) {
35
- resolve(dialogStore.getOutput(dialogId))
36
- }
37
- })
38
- })
39
- }
40
- }
41
- }
@@ -1,19 +0,0 @@
1
- import { IdType } from '@/utils/id.type'
2
-
3
- export const dragAppId = 'FDM-Monster-Client-Vue2'
4
-
5
- export enum INTENT {
6
- PRINTER_PLACE = 'PRINTER_PLACE'
7
- }
8
-
9
- export function isPrinterPlaceDataTransfer(data: PrinterPlace) {
10
- if (!data?.appId?.length || !data?.intent?.length) return false
11
-
12
- return data.appId === dragAppId && data.intent === INTENT.PRINTER_PLACE
13
- }
14
-
15
- export interface PrinterPlace {
16
- appId: string
17
- intent: string
18
- printerId: IdType
19
- }
@@ -1 +0,0 @@
1
- export const whitelistSettingsHidden = true
@@ -1,162 +0,0 @@
1
- import axios, { AxiosError, AxiosRequestConfig, HttpStatusCode } from 'axios'
2
- import { useAuthStore } from '@/store/auth.store'
3
- import { useEventBus } from '@vueuse/core'
4
- import {
5
- convertAuthErrorReason,
6
- PermissionDeniedEvent
7
- } from '@/shared/auth.constants'
8
- import { captureException } from '@sentry/vue'
9
-
10
- /**
11
- * Made async for future possibility of getting base URI externally or asynchronously
12
- */
13
- export async function getBaseUri() {
14
- // return process.env.NODE_ENV === "development" ? "https://demo.fdm-monster.net" : "";
15
- return process.env.NODE_ENV === 'development' ? 'http://localhost:4000/' : '/' // Same-origin policy
16
- }
17
-
18
- export async function getHttpClient(
19
- withAuth: boolean = true,
20
- autoHandle401: boolean = true
21
- ) {
22
- const instance = axios.create({
23
- baseURL: await getBaseUri()
24
- })
25
-
26
- instance.interceptors.request.use((config) => {
27
- console.debug(
28
- `${config.method?.toUpperCase().padEnd(6)} ${config.url?.padEnd(
29
- 25
30
- )} WithAuth: ${withAuth
31
- ?.toString()
32
- .padEnd(7)} AutoHandle401: ${autoHandle401
33
- ?.toString()
34
- .padEnd(7)} BaseURL: ${config.baseURL}`
35
- )
36
- return config
37
- })
38
-
39
- if (withAuth) {
40
- instance.interceptors.request.use(
41
- async (config) => {
42
- const authStore = useAuthStore()
43
- authStore.loadTokens()
44
- if (authStore.hasAuthToken) {
45
- config.headers.Authorization = `Bearer ${authStore.token}`
46
- }
47
-
48
- return config
49
- },
50
- (error) => {
51
- console.error('Error in axios request interceptor', error)
52
- return Promise.reject(error)
53
- }
54
- )
55
- }
56
-
57
- if (!autoHandle401) {
58
- return instance
59
- }
60
-
61
- instance.interceptors.response.use(
62
- (response) => response,
63
- async (error: AxiosError) => {
64
- const { response, config } = error
65
- if (!response) {
66
- console.error('No response was returned by axios', error)
67
- return Promise.reject({
68
- message: `No response was returned by axios - URL ${config?.url}`,
69
- stack: error.stack
70
- })
71
- }
72
-
73
- // Special code
74
- if (response.status === HttpStatusCode.FailedDependency) {
75
- return Promise.reject(error)
76
- }
77
-
78
- if (
79
- ![HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden].includes(
80
- response.status
81
- )
82
- ) {
83
- // Timeout issues etc?
84
- console.error(
85
- 'Error in axios response interceptor which is not 401 or 403',
86
- error
87
- )
88
- captureException(error)
89
- return Promise.reject({
90
- message: `${error.message} - URL ${config?.url}`,
91
- stack: error.stack
92
- })
93
- }
94
-
95
- if (response.status === HttpStatusCode.Forbidden) {
96
- const data = error?.response?.data as {
97
- error?: string
98
- roles?: string[]
99
- permissions?: string[]
100
- }
101
- console.error('[HttpClient] 403 Forbidden', data)
102
- useEventBus<PermissionDeniedEvent>('auth:permission-denied').emit({
103
- roles: data?.roles,
104
- permissions: data?.permissions,
105
- error: data?.error,
106
- url: config?.url
107
- })
108
- return Promise.reject(error)
109
- }
110
-
111
- const authStore = useAuthStore()
112
- authStore.loadTokens()
113
-
114
- // Detect if this is a special reason code, and if so, don't handle it here
115
- const { reasonCode, url } = authStore.extractSpecialReasonCode(error)
116
- if (reasonCode) {
117
- await authStore.logout(false, convertAuthErrorReason(reasonCode))
118
- console.error(
119
- `[AuthStore] 401 Unauthorized - emitting 'auth:${reasonCode}' with reason ${reasonCode}`
120
- )
121
- useEventBus(`auth:${reasonCode}`).emit({
122
- url,
123
- error: error.message,
124
- reasonCode
125
- })
126
- return Promise.reject(error)
127
- }
128
-
129
- // If this is called on AppLoader and failing, poll it if status 0
130
- await authStore.checkAuthenticationRequirements()
131
-
132
- // If this fails, the server is just confused
133
- const { success, handled } =
134
- await authStore.verifyOrRefreshLoginOnceOrLogout()
135
- if (handled) {
136
- return Promise.reject(error)
137
- }
138
- if (success) {
139
- if (!config?.url) {
140
- throw new Error('No URL in axios config, cannot retry')
141
- }
142
-
143
- console.debug('Redoing request without interceptors', config?.url)
144
- const newConfig: AxiosRequestConfig = config
145
- if (!newConfig.headers) {
146
- newConfig.headers = {}
147
- }
148
- newConfig.headers.Authorization = `Bearer ${authStore.token}`
149
- return axios(newConfig)
150
- }
151
-
152
- console.error("[HttpClient] 401 Unauthorized - emitting 'auth:failure'")
153
- useEventBus('auth:failure').emit({
154
- url: config?.url,
155
- error: error.message
156
- })
157
-
158
- return Promise.reject(error)
159
- }
160
- )
161
- return instance
162
- }
@@ -1,24 +0,0 @@
1
- import adjectives from '../assets/adjectives.json'
2
- import nouns from '../assets/nouns.json'
3
-
4
- function capitalize(val: string) {
5
- if (!val) return ''
6
- return val.charAt(0).toUpperCase() + val.slice(1)
7
- }
8
-
9
- export function newRandomNamePair() {
10
- const randomAdjective = Math.round(Math.random() * 1124)
11
- const randomNoun = Math.round(Math.random() * 3260)
12
-
13
- return `${capitalize(adjectives[randomAdjective])} ${capitalize(nouns[randomNoun])}`
14
- }
15
-
16
- export function generateInitials(name: string) {
17
- if (name === null) return '?'
18
- const initials = name
19
- ?.replace(/[^a-zA-Z ]/g, '')
20
- ?.split(' ')
21
- .slice(0, 3)
22
- .reduce((acc, subname) => acc + subname[0], '')
23
- return initials?.replace('undefined', '')
24
- }
@@ -1,5 +0,0 @@
1
- // Should not be adjusted unless the grid system is changed to support other than 12
2
- export const totalVuetifyColumnCount = 12
3
-
4
- export const rowOptions = [1, 2, 3, 4, 5, 6, 7, 8].map((v) => v * 2)
5
- export const colOptions = [1, 2, 3, 4, 6].map((v) => v * 2)