@fdm-monster/client-next 0.0.1 → 0.0.2
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/.yarn/install-state.gz +0 -0
- package/dist/assets/MaterialIcons-Regular-BjXOXp5c.eot +0 -0
- package/dist/assets/MaterialIcons-Regular-DEUTIz1o.ttf +0 -0
- package/dist/assets/MaterialIcons-Regular-DOtZ65Va.woff2 +0 -0
- package/dist/assets/MaterialIcons-Regular-FsbMSDLx.woff +0 -0
- package/dist/assets/index-CHzfWKPO.css +5 -0
- package/dist/assets/index-CnWtkGvw.js +90 -0
- package/dist/assets/index-CnWtkGvw.js.map +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/img/DavidZwart.jpg +0 -0
- package/dist/img/OIG.JYDC2RaWdz7g9.jpg +0 -0
- package/dist/img/OIG.jpg +0 -0
- package/dist/img/icons/android-chrome-256x256.png +0 -0
- package/dist/img/icons/android-chrome-384x384.png +0 -0
- package/dist/img/icons/android-chrome-512x512.png +0 -0
- package/dist/img/icons/favicon.svg +1 -0
- package/dist/img/logo.png +0 -0
- package/dist/img/logo.svg +1 -0
- package/dist/img/manifest.webmanifest +33 -0
- package/dist/img/octoprint-tentacle.svg +144 -0
- package/dist/img/thumbail_unknown.jpg +0 -0
- package/dist/img/vbanner.jpg +0 -0
- package/dist/index.html +24 -0
- package/dist/robots.txt +2 -0
- package/package.json +1 -1
- package/.all-contributorsrc +0 -57
- package/.editorconfig +0 -5
- package/.eslintrc.js +0 -126
- package/.github/FUNDING.yml +0 -3
- package/.github/workflows/release-client.yml +0 -94
- package/.github/workflows/vue-publish.yml +0 -26
- package/.prettierignore +0 -15
- package/.whitesource +0 -12
- package/renovate.json +0 -30
- package/src/App.vue +0 -60
- package/src/AppLoader.vue +0 -383
- package/src/assets/adjectives.json +0 -1468
- package/src/assets/logo.svg +0 -6
- package/src/assets/nouns.json +0 -4309
- package/src/auto-imports.d.ts +0 -139
- package/src/backend/app.service.ts +0 -39
- package/src/backend/auth.service.ts +0 -56
- package/src/backend/base.service.ts +0 -57
- package/src/backend/batch.service.ts +0 -37
- package/src/backend/camera-stream.service.ts +0 -33
- package/src/backend/custom-gcode.service.ts +0 -11
- package/src/backend/dto/octoprint-settings.dto.ts +0 -168
- package/src/backend/first-time-setup.service.ts +0 -17
- package/src/backend/floor.service.ts +0 -84
- package/src/backend/index.ts +0 -4
- package/src/backend/print-completions.service.ts +0 -11
- package/src/backend/printer-file.service.ts +0 -91
- package/src/backend/printer-group.service.ts +0 -62
- package/src/backend/printer-job.service.ts +0 -20
- package/src/backend/printer-settings.service.ts +0 -28
- package/src/backend/printers.service.ts +0 -136
- package/src/backend/server-private.service.ts +0 -55
- package/src/backend/server.api.ts +0 -132
- package/src/backend/settings.service.ts +0 -85
- package/src/backend/user.service.ts +0 -51
- package/src/components/AboutHelp/AboutView.vue +0 -164
- package/src/components/CameraGrid/CameraGridView.vue +0 -111
- package/src/components/FirstTimeSetup/FirstTimeSetupView.vue +0 -354
- package/src/components/Generic/Actions/PrinterConnectionAction.vue +0 -56
- package/src/components/Generic/Actions/PrinterCreateAction.vue +0 -22
- package/src/components/Generic/Actions/PrinterDeleteAction.vue +0 -29
- package/src/components/Generic/Actions/PrinterQuickStopAction.vue +0 -35
- package/src/components/Generic/Actions/PrinterSettingsAction.vue +0 -35
- package/src/components/Generic/Actions/PrinterUrlAction.vue +0 -24
- package/src/components/Generic/Actions/RefreshFilesAction.vue +0 -50
- package/src/components/Generic/Actions/SyncPrinterNameAction.vue +0 -36
- package/src/components/Generic/Dialogs/AddOrUpdateCameraStreamDialog.vue +0 -131
- package/src/components/Generic/Dialogs/AddOrUpdateFloorDialog.vue +0 -141
- package/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue +0 -303
- package/src/components/Generic/Dialogs/BaseDialog.vue +0 -81
- package/src/components/Generic/Dialogs/BatchJsonCreateDialog.vue +0 -109
- package/src/components/Generic/Dialogs/BatchReprintDialog.vue +0 -190
- package/src/components/Generic/Dialogs/PrinterChecksPanel.vue +0 -37
- package/src/components/Generic/Dialogs/PrinterControlDialog.vue +0 -202
- package/src/components/Generic/Dialogs/PrinterMaintenanceDialog.vue +0 -130
- package/src/components/Generic/Dialogs/YamlImportExportDialog.vue +0 -186
- package/src/components/Generic/Dialogs/dialog.constants.ts +0 -19
- package/src/components/Generic/FileExplorerSideNav.vue +0 -734
- package/src/components/Generic/Loaders/GridLoader.vue +0 -68
- package/src/components/Generic/NavigationDrawer.vue +0 -69
- package/src/components/Generic/PrintJobsMenu.vue +0 -148
- package/src/components/Generic/Snackbars/AppErrorSnackbar.vue +0 -64
- package/src/components/Generic/Snackbars/AppInfoSnackbar.vue +0 -63
- package/src/components/Generic/Snackbars/AppProgressSnackbar.vue +0 -158
- package/src/components/Generic/Vuetify/TooltipButton.vue +0 -47
- package/src/components/HelpOverlay/HelpOverlay.vue +0 -57
- package/src/components/Login/LoginForm.vue +0 -206
- package/src/components/Login/LoginView.spec.ts +0 -64
- package/src/components/Login/LoginView.vue +0 -65
- package/src/components/Login/Logo.vue +0 -13
- package/src/components/Login/PermissionDenied.vue +0 -109
- package/src/components/Login/RegistrationForm.vue +0 -207
- package/src/components/Login/RegistrationView.vue +0 -17
- package/src/components/Login/__snapshots__/LoginView.spec.ts.snap +0 -1051
- package/src/components/NotFound/NotFoundView.vue +0 -39
- package/src/components/PrintStatistics/PrintStatistics.vue +0 -168
- package/src/components/PrintStatistics/PrintStatisticsView.vue +0 -15
- package/src/components/PrinterGrid/HomeToolbar.vue +0 -90
- package/src/components/PrinterGrid/PrinterGrid.vue +0 -164
- package/src/components/PrinterGrid/PrinterGridTile.vue +0 -438
- package/src/components/PrinterGrid/PrinterGridView.vue +0 -210
- package/src/components/PrinterList/FileControlList.vue +0 -40
- package/src/components/PrinterList/PrinterDetails.vue +0 -91
- package/src/components/PrinterList/PrintersView.vue +0 -492
- package/src/components/Settings/AccountSettings.vue +0 -163
- package/src/components/Settings/DiagnosticsSettings.vue +0 -137
- package/src/components/Settings/EmergencyCommands.vue +0 -265
- package/src/components/Settings/FloorSettings.vue +0 -276
- package/src/components/Settings/GridSettings.vue +0 -127
- package/src/components/Settings/OctoPrintSettings.vue +0 -188
- package/src/components/Settings/ServerProtectionSettings.vue +0 -370
- package/src/components/Settings/SettingsView.vue +0 -73
- package/src/components/Settings/SoftwareUpgradeSettings.vue +0 -297
- package/src/components/Settings/UserManagementSettings.vue +0 -257
- package/src/components/TopBar.vue +0 -147
- package/src/components.d.ts +0 -70
- package/src/directives/file-upload.directive.ts +0 -117
- package/src/directives/printer-drop-position.directive.ts +0 -92
- package/src/env.d.ts +0 -6
- package/src/main.ts +0 -76
- package/src/models/batch/reprint.dto.ts +0 -79
- package/src/models/batch.model.ts +0 -11
- package/src/models/camera-streams/camera-stream.ts +0 -19
- package/src/models/floors/floor.model.ts +0 -30
- package/src/models/octoprint/connection-options.model.ts +0 -8
- package/src/models/plugins/firmware-updates/prusa-firmware-release.model.ts +0 -57
- package/src/models/print-completions/print-completions.model.ts +0 -49
- package/src/models/printers/crud/create-printer.model.ts +0 -26
- package/src/models/printers/file-upload-commands.model.ts +0 -4
- package/src/models/printers/gcode/gcode-analysis.model.ts +0 -30
- package/src/models/printers/printer-current-job.model.ts +0 -90
- package/src/models/printers/printer-file.model.ts +0 -48
- package/src/models/printers/printer.model.ts +0 -18
- package/src/models/server/client-releases.model.ts +0 -27
- package/src/models/server/export-yaml.model.ts +0 -11
- package/src/models/server/features.model.ts +0 -37
- package/src/models/server/github-rate-limit.model.ts +0 -21
- package/src/models/server/version.model.ts +0 -14
- package/src/models/settings/printer-file-clean-settings.model.ts +0 -5
- package/src/models/settings/server-settings.dto.ts +0 -19
- package/src/models/settings/settings.model.ts +0 -57
- package/src/models/socketio-messages/socketio-message.model.ts +0 -53
- package/src/models/uploads/queued-upload.model.ts +0 -12
- package/src/models/user.model.ts +0 -15
- package/src/plugins/README.md +0 -3
- package/src/plugins/index.ts +0 -17
- package/src/plugins/vuetify.ts +0 -53
- package/src/router/index.ts +0 -192
- package/src/router/route-names.ts +0 -14
- package/src/router/utils.ts +0 -23
- package/src/shared/alert.events.ts +0 -14
- package/src/shared/app.constants.ts +0 -23
- package/src/shared/auth.constants.ts +0 -34
- package/src/shared/dialog.composable.ts +0 -41
- package/src/shared/drag.constants.ts +0 -19
- package/src/shared/experimental.constants.ts +0 -1
- package/src/shared/http-client.ts +0 -162
- package/src/shared/noun-adjectives.data.ts +0 -24
- package/src/shared/printer-grid.constants.ts +0 -5
- package/src/shared/printer-state.constants.ts +0 -194
- package/src/shared/snackbar.composable.ts +0 -66
- package/src/shared/socketio.service.ts +0 -104
- package/src/store/auth.store.ts +0 -255
- package/src/store/connection.store.ts +0 -66
- package/src/store/dialog.store.ts +0 -114
- package/src/store/features.store.ts +0 -57
- package/src/store/floor.store.ts +0 -173
- package/src/store/grid.store.ts +0 -10
- package/src/store/index.ts +0 -4
- package/src/store/printer-state.store.ts +0 -246
- package/src/store/printer.store.ts +0 -236
- package/src/store/profile.store.ts +0 -25
- package/src/store/settings.store.ts +0 -64
- package/src/store/test-printer.store.ts +0 -70
- package/src/store/uploads.store.ts +0 -75
- package/src/styles/README.md +0 -3
- package/src/styles/settings.scss +0 -10
- package/src/types/global.d.ts +0 -15
- package/src/utils/array.utils.ts +0 -15
- package/src/utils/date.utils.ts +0 -5
- package/src/utils/download-file.util.ts +0 -25
- package/src/utils/error.utils.ts +0 -3
- package/src/utils/file-size.util.ts +0 -11
- package/src/utils/id.type.ts +0 -1
- package/src/utils/sentry.util.ts +0 -8
- package/src/utils/test.util.ts +0 -30
- package/src/utils/time.utils.ts +0 -2
- package/src/utils/uploads-state.utils.ts +0 -58
- package/src/utils/validation.utils.ts +0 -14
- package/src/vite-env.d.ts +0 -7
- package/test/setup-axios-mock.ts +0 -15
- /package/{src/assets/logo.png → dist/assets/logo-CJVdjy51.png} +0 -0
- /package/{src/assets → dist/img/icons}/android-chrome-192x192.png +0 -0
package/src/router/index.ts
DELETED
|
@@ -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
|
-
}
|
package/src/router/utils.ts
DELETED
|
@@ -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
|
-
}
|