Migrate routes.js to ES6

This commit is contained in:
MrTimscampi 2020-08-01 05:36:36 +02:00
parent 1349914e7e
commit af93c4a798
3 changed files with 142 additions and 90 deletions

View file

@ -1,18 +1,21 @@
define([
'jQuery',
'emby-button',
'emby-input',
'scripts/livetvcomponents',
'paper-icon-button-light',
'emby-itemscontainer',
'emby-collapse',
'emby-select',
'livetvcss',
'emby-checkbox',
'emby-slider',
'listViewStyle',
'dashboardcss',
'detailtablecss'], function () {
import 'emby-button';
import 'emby-input';
import 'scripts/livetvcomponents';
import 'paper-icon-button-light';
import 'emby-itemscontainer';
import 'emby-collapse';
import 'emby-select';
import 'livetvcss';
import 'emby-checkbox';
import 'emby-slider';
import 'listViewStyle';
import 'dashboardcss';
import 'detailtablecss';
/* eslint-disable indent */
console.groupCollapsed('defining core routes');
function defineRoute(newRoute) {
var path = newRoute.alias ? newRoute.alias : newRoute.path;
console.debug('defining route: ' + path);
@ -20,8 +23,6 @@ define([
Emby.Page.addRoute(path, newRoute);
}
console.debug('defining core routes');
defineRoute({
alias: '/addserver.html',
path: '/controllers/session/addServer/index.html',
@ -30,6 +31,7 @@ define([
startup: true,
controller: 'session/addServer/index'
});
defineRoute({
alias: '/selectserver.html',
path: '/controllers/session/selectServer/index.html',
@ -39,6 +41,7 @@ define([
controller: 'session/selectServer/index',
type: 'selectserver'
});
defineRoute({
alias: '/login.html',
path: '/controllers/session/login/index.html',
@ -48,6 +51,7 @@ define([
controller: 'session/login/index',
type: 'login'
});
defineRoute({
alias: '/forgotpassword.html',
path: '/controllers/session/forgotPassword/index.html',
@ -55,6 +59,7 @@ define([
startup: true,
controller: 'session/forgotPassword/index'
});
defineRoute({
alias: '/forgotpasswordpin.html',
path: '/controllers/session/redeemPassword/index.html',
@ -68,42 +73,41 @@ define([
alias: '/mypreferencesmenu.html',
path: '/controllers/user/menu/index.html',
autoFocus: false,
transition: 'fade',
controller: 'user/menu/index'
});
defineRoute({
alias: '/myprofile.html',
path: '/controllers/user/profile/index.html',
autoFocus: false,
transition: 'fade',
controller: 'user/profile/index'
});
defineRoute({
alias: '/mypreferencesdisplay.html',
path: '/controllers/user/display/index.html',
autoFocus: false,
transition: 'fade',
controller: 'user/display/index'
});
defineRoute({
alias: '/mypreferenceshome.html',
path: '/controllers/user/home/index.html',
autoFocus: false,
transition: 'fade',
controller: 'user/home/index'
});
defineRoute({
alias: '/mypreferencesplayback.html',
path: '/controllers/user/playback/index.html',
autoFocus: false,
transition: 'fade',
controller: 'user/playback/index'
});
defineRoute({
alias: '/mypreferencessubtitles.html',
path: '/controllers/user/subtitles/index.html',
autoFocus: false,
transition: 'fade',
controller: 'user/subtitles/index'
});
@ -113,42 +117,49 @@ define([
roles: 'admin',
controller: 'dashboard/dashboard'
});
defineRoute({
path: '/dashboardgeneral.html',
controller: 'dashboard/general',
autoFocus: false,
roles: 'admin'
});
defineRoute({
path: '/networking.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/networking'
});
defineRoute({
path: '/devices.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/devices/devices'
});
defineRoute({
path: '/device.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/devices/device'
});
defineRoute({
path: '/dlnaprofile.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/profile'
});
defineRoute({
path: '/dlnaprofiles.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/profiles'
});
defineRoute({
alias: '/addplugin.html',
path: '/controllers/dashboard/plugins/add/index.html',
@ -156,52 +167,61 @@ define([
roles: 'admin',
controller: 'dashboard/plugins/add/index'
});
defineRoute({
path: '/library.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/mediaLibrary'
});
defineRoute({
path: '/librarydisplay.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/librarydisplay'
});
defineRoute({
path: '/dlnasettings.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/settings'
});
defineRoute({
path: '/edititemmetadata.html',
controller: 'edititemmetadata',
autoFocus: false
});
defineRoute({
path: '/encodingsettings.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/encodingsettings'
});
defineRoute({
path: '/log.html',
roles: 'admin',
controller: 'dashboard/logs'
});
defineRoute({
path: '/metadataimages.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/metadataImages'
});
defineRoute({
path: '/metadatanfo.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/metadatanfo'
});
defineRoute({
alias: '/notificationsetting.html',
path: '/controllers/dashboard/notifications/notification/index.html',
@ -209,6 +229,7 @@ define([
roles: 'admin',
controller: 'dashboard/notifications/notification/index'
});
defineRoute({
alias: '/notificationsettings.html',
path: '/controllers/dashboard/notifications/notifications/index.html',
@ -216,12 +237,14 @@ define([
autoFocus: false,
roles: 'admin'
});
defineRoute({
path: '/playbackconfiguration.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/playback'
});
defineRoute({
alias: '/availableplugins.html',
path: '/controllers/dashboard/plugins/available/index.html',
@ -229,6 +252,7 @@ define([
roles: 'admin',
controller: 'dashboard/plugins/available/index'
});
defineRoute({
alias: '/repositories.html',
path: '/controllers/dashboard/plugins/repositories/index.html',
@ -241,67 +265,72 @@ define([
path: '/home.html',
autoFocus: false,
controller: 'home',
transition: 'fade',
type: 'home'
});
defineRoute({
path: '/search.html',
controller: 'searchpage'
});
defineRoute({
path: '/list.html',
autoFocus: false,
controller: 'list',
transition: 'fade'
controller: 'list'
});
defineRoute({
alias: '/details',
path: '/controllers/itemDetails/index.html',
controller: 'itemDetails/index',
autoFocus: false,
transition: 'fade'
autoFocus: false
});
defineRoute({
path: '/livetv.html',
controller: 'livetv/livetvsuggested',
autoFocus: false,
transition: 'fade'
autoFocus: false
});
defineRoute({
path: '/livetvguideprovider.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvguideprovider'
});
defineRoute({
path: '/livetvsettings.html',
autoFocus: false,
controller: 'livetvsettings'
});
defineRoute({
path: '/livetvstatus.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvstatus'
});
defineRoute({
path: '/livetvtuner.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvtuner'
});
defineRoute({
path: '/movies.html',
autoFocus: false,
controller: 'movies/moviesrecommended',
transition: 'fade'
controller: 'movies/moviesrecommended'
});
defineRoute({
path: '/music.html',
controller: 'music/musicrecommended',
autoFocus: false,
transition: 'fade'
autoFocus: false
});
defineRoute({
alias: '/installedplugins.html',
path: '/controllers/dashboard/plugins/installed/index.html',
@ -309,41 +338,46 @@ define([
roles: 'admin',
controller: 'dashboard/plugins/installed/index'
});
defineRoute({
path: '/scheduledtask.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/scheduledtasks/scheduledtask'
});
defineRoute({
path: '/scheduledtasks.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/scheduledtasks/scheduledtasks'
});
defineRoute({
path: '/serveractivity.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/serveractivity'
});
defineRoute({
path: '/apikeys.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/apikeys'
});
defineRoute({
path: '/streamingsettings.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/streaming'
});
defineRoute({
path: '/tv.html',
autoFocus: false,
controller: 'shows/tvrecommended',
transition: 'fade'
controller: 'shows/tvrecommended'
});
defineRoute({
@ -352,29 +386,34 @@ define([
roles: 'admin',
controller: 'dashboard/users/useredit'
});
defineRoute({
path: '/userlibraryaccess.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/userlibraryaccess'
});
defineRoute({
path: '/usernew.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/usernew'
});
defineRoute({
path: '/userparentalcontrol.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/userparentalcontrol'
});
defineRoute({
path: '/userpassword.html',
autoFocus: false,
controller: 'dashboard/users/userpasswordpage'
});
defineRoute({
path: '/userprofiles.html',
autoFocus: false,
@ -389,6 +428,7 @@ define([
anonymous: true,
controller: 'wizard/remote/index'
});
defineRoute({
alias: '/wizardfinish.html',
path: '/controllers/wizard/finish/index.html',
@ -396,12 +436,14 @@ define([
anonymous: true,
controller: 'wizard/finish/index'
});
defineRoute({
path: '/wizardlibrary.html',
autoFocus: false,
anonymous: true,
controller: 'dashboard/mediaLibrary'
});
defineRoute({
alias: '/wizardsettings.html',
path: '/controllers/wizard/settings/index.html',
@ -409,6 +451,7 @@ define([
anonymous: true,
controller: 'wizard/settings/index'
});
defineRoute({
alias: '/wizardstart.html',
path: '/controllers/wizard/start/index.html',
@ -416,6 +459,7 @@ define([
anonymous: true,
controller: 'wizard/start/index'
});
defineRoute({
alias: '/wizarduser.html',
path: '/controllers/wizard/user/index.html',
@ -427,7 +471,6 @@ define([
defineRoute({
alias: '/video',
path: '/controllers/playback/video/index.html',
transition: 'fade',
controller: 'playback/video/index',
autoFocus: false,
type: 'video-osd',
@ -435,16 +478,17 @@ define([
fullscreen: true,
enableMediaControl: false
});
defineRoute({
alias: '/queue',
path: '/controllers/playback/queue/index.html',
controller: 'playback/queue/index',
autoFocus: false,
transition: 'fade',
fullscreen: true,
supportsThemeMedia: true,
enableMediaControl: false
});
defineRoute({
path: '/configurationpage',
autoFocus: false,
@ -458,9 +502,13 @@ define([
isDefaultRoute: true,
autoFocus: false
});
defineRoute({
path: '/index.html',
autoFocus: false,
isDefaultRoute: true
});
});
console.groupEnd('defining core routes');
/* eslint-enable indent */