mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Migration of wizard to ES6 modules
This commit is contained in:
parent
a9246f8f39
commit
c11977c9fe
6 changed files with 235 additions and 227 deletions
|
@ -141,6 +141,11 @@
|
||||||
"src/controllers/dashboard/logs.js",
|
"src/controllers/dashboard/logs.js",
|
||||||
"src/controllers/user/subtitles.js",
|
"src/controllers/user/subtitles.js",
|
||||||
"src/controllers/dashboard/plugins/repositories.js",
|
"src/controllers/dashboard/plugins/repositories.js",
|
||||||
|
"src/controllers/wizard/finish.js",
|
||||||
|
"src/controllers/wizard/remoteaccess.js",
|
||||||
|
"src/controllers/wizard/settings.js",
|
||||||
|
"src/controllers/wizard/start.js",
|
||||||
|
"src/controllers/wizard/user.js",
|
||||||
"src/elements/emby-tabs/emby-tabs.js",
|
"src/elements/emby-tabs/emby-tabs.js",
|
||||||
"src/elements/emby-scroller/emby-scroller.js",
|
"src/elements/emby-scroller/emby-scroller.js",
|
||||||
"src/elements/emby-radio/emby-radio.js",
|
"src/elements/emby-radio/emby-radio.js",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
define(['loading'], function (loading) {
|
import loading from 'loading';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function onFinish() {
|
function onFinish() {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
@ -12,7 +11,6 @@ define(['loading'], function (loading) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
view.querySelector('.btnWizardNext').addEventListener('click', onFinish);
|
view.querySelector('.btnWizardNext').addEventListener('click', onFinish);
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loading) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import 'emby-checkbox';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'emby-select';
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var apiClient = ApiClient;
|
const apiClient = ApiClient;
|
||||||
var config = {};
|
const config = {};
|
||||||
config.EnableRemoteAccess = page.querySelector('#chkRemoteAccess').checked;
|
config.EnableRemoteAccess = page.querySelector('#chkRemoteAccess').checked;
|
||||||
config.EnableAutomaticPortMapping = page.querySelector('#chkEnableUpnp').checked;
|
config.EnableAutomaticPortMapping = page.querySelector('#chkEnableUpnp').checked;
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
|
@ -27,7 +29,7 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
|
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||||
|
@ -35,5 +37,4 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||||
view.addEventListener('viewhide', function () {
|
view.addEventListener('viewhide', function () {
|
||||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loading) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import 'emby-checkbox';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'emby-select';
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var apiClient = ApiClient;
|
const apiClient = ApiClient;
|
||||||
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
|
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
|
||||||
config.PreferredMetadataLanguage = page.querySelector('#selectLanguage').value;
|
config.PreferredMetadataLanguage = page.querySelector('#selectLanguage').value;
|
||||||
config.MetadataCountryCode = page.querySelector('#selectCountry').value;
|
config.MetadataCountryCode = page.querySelector('#selectCountry').value;
|
||||||
|
@ -19,11 +21,11 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateLanguages(select, languages) {
|
function populateLanguages(select, languages) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += "<option value=''></option>";
|
html += "<option value=''></option>";
|
||||||
|
|
||||||
for (var i = 0, length = languages.length; i < length; i++) {
|
for (let i = 0, length = languages.length; i < length; i++) {
|
||||||
var culture = languages[i];
|
const culture = languages[i];
|
||||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +33,11 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateCountries(select, allCountries) {
|
function populateCountries(select, allCountries) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += "<option value=''></option>";
|
html += "<option value=''></option>";
|
||||||
|
|
||||||
for (var i = 0, length = allCountries.length; i < length; i++) {
|
for (let i = 0, length = allCountries.length; i < length; i++) {
|
||||||
var culture = allCountries[i];
|
const culture = allCountries[i];
|
||||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +54,10 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||||
|
|
||||||
function reload(page) {
|
function reload(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var apiClient = ApiClient;
|
const apiClient = ApiClient;
|
||||||
var promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
const promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
||||||
var promise2 = apiClient.getCultures();
|
const promise2 = apiClient.getCultures();
|
||||||
var promise3 = apiClient.getCountries();
|
const promise3 = apiClient.getCountries();
|
||||||
Promise.all([promise1, promise2, promise3]).then(function (responses) {
|
Promise.all([promise1, promise2, promise3]).then(function (responses) {
|
||||||
reloadData(page, responses[0], responses[1], responses[2]);
|
reloadData(page, responses[0], responses[1], responses[2]);
|
||||||
});
|
});
|
||||||
|
@ -71,7 +73,7 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
|
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||||
|
@ -80,5 +82,4 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||||
view.addEventListener('viewhide', function () {
|
view.addEventListener('viewhide', function () {
|
||||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'emby-select';
|
||||||
|
|
||||||
function loadPage(page, config, languageOptions) {
|
function loadPage(page, config, languageOptions) {
|
||||||
$('#selectLocalizationLanguage', page).html(languageOptions.map(function (l) {
|
$('#selectLocalizationLanguage', page).html(languageOptions.map(function (l) {
|
||||||
|
@ -10,7 +12,7 @@ define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var apiClient = ApiClient;
|
const apiClient = ApiClient;
|
||||||
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
|
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
|
||||||
config.UICulture = $('#selectLocalizationLanguage', page).val();
|
config.UICulture = $('#selectLocalizationLanguage', page).val();
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
|
@ -28,15 +30,15 @@ define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
$('.wizardStartForm', view).on('submit', onSubmit);
|
$('.wizardStartForm', view).on('submit', onSubmit);
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||||
loading.show();
|
loading.show();
|
||||||
var page = this;
|
const page = this;
|
||||||
var apiClient = ApiClient;
|
const apiClient = ApiClient;
|
||||||
var promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
const promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
||||||
var promise2 = apiClient.getJSON(apiClient.getUrl('Localization/Options'));
|
const promise2 = apiClient.getJSON(apiClient.getUrl('Localization/Options'));
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
loadPage(page, responses[0], responses[1]);
|
loadPage(page, responses[0], responses[1]);
|
||||||
});
|
});
|
||||||
|
@ -44,5 +46,4 @@ define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading
|
||||||
view.addEventListener('viewhide', function () {
|
view.addEventListener('viewhide', function () {
|
||||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'emby-button'], function (loading, globalize) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import 'dashboardcss';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
function getApiClient() {
|
function getApiClient() {
|
||||||
return ApiClient;
|
return ApiClient;
|
||||||
|
@ -17,7 +20,7 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||||
|
|
||||||
function submit(form) {
|
function submit(form) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var apiClient = getApiClient();
|
const apiClient = getApiClient();
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
|
@ -29,7 +32,7 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
var form = this;
|
const form = this;
|
||||||
|
|
||||||
if (form.querySelector('#txtManualPassword').value != form.querySelector('#txtPasswordConfirm').value) {
|
if (form.querySelector('#txtManualPassword').value != form.querySelector('#txtPasswordConfirm').value) {
|
||||||
require(['toast'], function (toast) {
|
require(['toast'], function (toast) {
|
||||||
|
@ -45,8 +48,8 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||||
|
|
||||||
function onViewShow() {
|
function onViewShow() {
|
||||||
loading.show();
|
loading.show();
|
||||||
var page = this;
|
const page = this;
|
||||||
var apiClient = getApiClient();
|
const apiClient = getApiClient();
|
||||||
apiClient.getJSON(apiClient.getUrl('Startup/User')).then(function (user) {
|
apiClient.getJSON(apiClient.getUrl('Startup/User')).then(function (user) {
|
||||||
page.querySelector('#txtUsername').value = user.Name || '';
|
page.querySelector('#txtUsername').value = user.Name || '';
|
||||||
page.querySelector('#txtManualPassword').value = user.Password || '';
|
page.querySelector('#txtManualPassword').value = user.Password || '';
|
||||||
|
@ -54,7 +57,7 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
view.querySelector('.wizardUserForm').addEventListener('submit', onSubmit);
|
view.querySelector('.wizardUserForm').addEventListener('submit', onSubmit);
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||||
|
@ -63,5 +66,4 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||||
});
|
});
|
||||||
view.addEventListener('viewshow', onViewShow);
|
view.addEventListener('viewshow', onViewShow);
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue