diff options
Diffstat (limited to 'src/internal-server/app/Controllers/Http/UserController.js')
-rw-r--r-- | src/internal-server/app/Controllers/Http/UserController.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/internal-server/app/Controllers/Http/UserController.js b/src/internal-server/app/Controllers/Http/UserController.js index 9a9d76636..a9c67a1b2 100644 --- a/src/internal-server/app/Controllers/Http/UserController.js +++ b/src/internal-server/app/Controllers/Http/UserController.js | |||
@@ -26,6 +26,7 @@ const apiRequest = (url, route, method, auth) => | |||
26 | .then(data => data.json()) | 26 | .then(data => data.json()) |
27 | .then(json => resolve(json)); | 27 | .then(json => resolve(json)); |
28 | } catch (error) { | 28 | } catch (error) { |
29 | // eslint-disable-next-line no-console | ||
29 | console.log(error); | 30 | console.log(error); |
30 | reject(); | 31 | reject(); |
31 | } | 32 | } |
@@ -197,7 +198,7 @@ class UserController { | |||
197 | const services = await apiRequest(server, 'me/services', 'GET', token); | 198 | const services = await apiRequest(server, 'me/services', 'GET', token); |
198 | 199 | ||
199 | for (const service of services) { | 200 | for (const service of services) { |
200 | await this._createAndCacheService(service, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 201 | await this._createAndCacheService(service, serviceIdTranslation); |
201 | } | 202 | } |
202 | } catch (error) { | 203 | } catch (error) { |
203 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; | 204 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; |
@@ -209,7 +210,7 @@ class UserController { | |||
209 | const workspaces = await apiRequest(server, 'workspace', 'GET', token); | 210 | const workspaces = await apiRequest(server, 'workspace', 'GET', token); |
210 | 211 | ||
211 | for (const workspace of workspaces) { | 212 | for (const workspace of workspaces) { |
212 | await this._createWorkspace(workspace, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 213 | await this._createWorkspace(workspace, serviceIdTranslation); |
213 | } | 214 | } |
214 | } catch (error) { | 215 | } catch (error) { |
215 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; | 216 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; |
@@ -257,6 +258,7 @@ class UserController { | |||
257 | try { | 258 | try { |
258 | file = JSON.parse(request.input('file')); | 259 | file = JSON.parse(request.input('file')); |
259 | } catch (error) { | 260 | } catch (error) { |
261 | // eslint-disable-next-line no-console | ||
260 | console.log(error); | 262 | console.log(error); |
261 | return response.send( | 263 | return response.send( |
262 | 'Could not import: Invalid file, could not read file', | 264 | 'Could not import: Invalid file, could not read file', |
@@ -272,7 +274,7 @@ class UserController { | |||
272 | // Import services | 274 | // Import services |
273 | try { | 275 | try { |
274 | for (const service of file.services) { | 276 | for (const service of file.services) { |
275 | await this._createAndCacheService(service, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 277 | await this._createAndCacheService(service, serviceIdTranslation); |
276 | } | 278 | } |
277 | } catch (error) { | 279 | } catch (error) { |
278 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; | 280 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; |
@@ -282,7 +284,7 @@ class UserController { | |||
282 | // Import workspaces | 284 | // Import workspaces |
283 | try { | 285 | try { |
284 | for (const workspace of file.workspaces) { | 286 | for (const workspace of file.workspaces) { |
285 | await this._createWorkspace(workspace, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 287 | await this._createWorkspace(workspace, serviceIdTranslation); |
286 | } | 288 | } |
287 | } catch (error) { | 289 | } catch (error) { |
288 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; | 290 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; |
@@ -302,6 +304,7 @@ class UserController { | |||
302 | ); | 304 | ); |
303 | 305 | ||
304 | if (workspace.services) { | 306 | if (workspace.services) { |
307 | // eslint-disable-next-line no-param-reassign | ||
305 | workspace.services = convertToJSON(workspace.services); | 308 | workspace.services = convertToJSON(workspace.services); |
306 | } | 309 | } |
307 | const services = | 310 | const services = |
@@ -311,6 +314,7 @@ class UserController { | |||
311 | ) | 314 | ) |
312 | : []; | 315 | : []; |
313 | if (workspace.data) { | 316 | if (workspace.data) { |
317 | // eslint-disable-next-line no-param-reassign | ||
314 | workspace.data = convertToJSON(workspace.data); | 318 | workspace.data = convertToJSON(workspace.data); |
315 | } | 319 | } |
316 | 320 | ||
@@ -334,9 +338,11 @@ class UserController { | |||
334 | ); | 338 | ); |
335 | 339 | ||
336 | // store the old serviceId as the key for future lookup | 340 | // store the old serviceId as the key for future lookup |
341 | // eslint-disable-next-line no-param-reassign | ||
337 | serviceIdTranslation[service.serviceId] = newServiceId; | 342 | serviceIdTranslation[service.serviceId] = newServiceId; |
338 | 343 | ||
339 | if (service.settings) { | 344 | if (service.settings) { |
345 | // eslint-disable-next-line no-param-reassign | ||
340 | service.settings = convertToJSON(service.settings); | 346 | service.settings = convertToJSON(service.settings); |
341 | } | 347 | } |
342 | 348 | ||