mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
Merge pull request #1585 from Camc314/migrate-to-ES6-32
Migration of wizard/ to ES6 modules
This commit is contained in:
commit
79336d778c
@ -171,6 +171,11 @@
|
||||
"src/controllers/dashboard/networking.js",
|
||||
"src/controllers/dashboard/playback.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/controllers/shows/episodes.js",
|
||||
"src/controllers/shows/tvgenres.js",
|
||||
"src/controllers/shows/tvlatest.js",
|
||||
|
@ -1,5 +1,4 @@
|
||||
define(['loading'], function (loading) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
|
||||
function onFinish() {
|
||||
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);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loading) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-button';
|
||||
import 'emby-select';
|
||||
|
||||
function save(page) {
|
||||
loading.show();
|
||||
var apiClient = ApiClient;
|
||||
var config = {};
|
||||
const apiClient = ApiClient;
|
||||
const config = {};
|
||||
config.EnableRemoteAccess = page.querySelector('#chkRemoteAccess').checked;
|
||||
config.EnableAutomaticPortMapping = page.querySelector('#chkEnableUpnp').checked;
|
||||
apiClient.ajax({
|
||||
@ -27,7 +29,7 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||
return false;
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
|
||||
view.addEventListener('viewshow', function () {
|
||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||
@ -35,5 +37,4 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||
view.addEventListener('viewhide', function () {
|
||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loading) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-button';
|
||||
import 'emby-select';
|
||||
|
||||
function save(page) {
|
||||
loading.show();
|
||||
var apiClient = ApiClient;
|
||||
const apiClient = ApiClient;
|
||||
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
|
||||
config.PreferredMetadataLanguage = page.querySelector('#selectLanguage').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) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
var culture = languages[i];
|
||||
for (let i = 0, length = languages.length; i < length; i++) {
|
||||
const culture = languages[i];
|
||||
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) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = allCountries.length; i < length; i++) {
|
||||
var culture = allCountries[i];
|
||||
for (let i = 0, length = allCountries.length; i < length; i++) {
|
||||
const culture = allCountries[i];
|
||||
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) {
|
||||
loading.show();
|
||||
var apiClient = ApiClient;
|
||||
var promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
||||
var promise2 = apiClient.getCultures();
|
||||
var promise3 = apiClient.getCountries();
|
||||
const apiClient = ApiClient;
|
||||
const promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
||||
const promise2 = apiClient.getCultures();
|
||||
const promise3 = apiClient.getCountries();
|
||||
Promise.all([promise1, promise2, promise3]).then(function (responses) {
|
||||
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 function (view, params) {
|
||||
export default function (view, params) {
|
||||
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
|
||||
view.addEventListener('viewshow', function () {
|
||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||
@ -80,5 +82,4 @@ define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loa
|
||||
view.addEventListener('viewhide', function () {
|
||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import 'emby-button';
|
||||
import 'emby-select';
|
||||
|
||||
function loadPage(page, config, languageOptions) {
|
||||
$('#selectLocalizationLanguage', page).html(languageOptions.map(function (l) {
|
||||
@ -10,7 +12,7 @@ define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading
|
||||
|
||||
function save(page) {
|
||||
loading.show();
|
||||
var apiClient = ApiClient;
|
||||
const apiClient = ApiClient;
|
||||
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
|
||||
config.UICulture = $('#selectLocalizationLanguage', page).val();
|
||||
apiClient.ajax({
|
||||
@ -28,15 +30,15 @@ define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading
|
||||
return false;
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
$('.wizardStartForm', view).on('submit', onSubmit);
|
||||
view.addEventListener('viewshow', function () {
|
||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||
loading.show();
|
||||
var page = this;
|
||||
var apiClient = ApiClient;
|
||||
var promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
||||
var promise2 = apiClient.getJSON(apiClient.getUrl('Localization/Options'));
|
||||
const page = this;
|
||||
const apiClient = ApiClient;
|
||||
const promise1 = apiClient.getJSON(apiClient.getUrl('Startup/Configuration'));
|
||||
const promise2 = apiClient.getJSON(apiClient.getUrl('Localization/Options'));
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
loadPage(page, responses[0], responses[1]);
|
||||
});
|
||||
@ -44,5 +46,4 @@ define(['jQuery', 'loading', 'emby-button', 'emby-select'], function ($, loading
|
||||
view.addEventListener('viewhide', function () {
|
||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'emby-button'], function (loading, globalize) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import globalize from 'globalize';
|
||||
import 'dashboardcss';
|
||||
import 'emby-input';
|
||||
import 'emby-button';
|
||||
|
||||
function getApiClient() {
|
||||
return ApiClient;
|
||||
@ -17,7 +20,7 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||
|
||||
function submit(form) {
|
||||
loading.show();
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
apiClient.ajax({
|
||||
type: 'POST',
|
||||
data: {
|
||||
@ -29,10 +32,10 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
var form = this;
|
||||
const form = this;
|
||||
|
||||
if (form.querySelector('#txtManualPassword').value != form.querySelector('#txtPasswordConfirm').value) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('PasswordMatchError'));
|
||||
});
|
||||
} else {
|
||||
@ -45,8 +48,8 @@ define(['loading', 'globalize', 'dashboardcss', 'emby-input', 'emby-button', 'em
|
||||
|
||||
function onViewShow() {
|
||||
loading.show();
|
||||
var page = this;
|
||||
var apiClient = getApiClient();
|
||||
const page = this;
|
||||
const apiClient = getApiClient();
|
||||
apiClient.getJSON(apiClient.getUrl('Startup/User')).then(function (user) {
|
||||
page.querySelector('#txtUsername').value = user.Name || '';
|
||||
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.addEventListener('viewshow', function () {
|
||||
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');
|
||||
});
|
||||
view.addEventListener('viewshow', onViewShow);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user