Fix sonarqube issues
This commit is contained in:
parent
be9f964c18
commit
a3949c1889
30 changed files with 58 additions and 59 deletions
|
@ -97,7 +97,7 @@ import alert from './alert';
|
|||
}
|
||||
|
||||
instance.items = result.Items;
|
||||
renderList(elem, apiClient, result, startIndex, limit);
|
||||
renderList(elem, apiClient, result);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ function render() {
|
|||
}
|
||||
|
||||
class appFooter {
|
||||
constructor(options) {
|
||||
constructor() {
|
||||
const self = this;
|
||||
|
||||
self.element = render(options);
|
||||
self.element = render();
|
||||
self.add = function (elem) {
|
||||
self.element.appendChild(elem);
|
||||
};
|
||||
|
@ -33,4 +33,4 @@ class appFooter {
|
|||
}
|
||||
}
|
||||
|
||||
export default new appFooter({});
|
||||
export default new appFooter();
|
||||
|
|
|
@ -47,7 +47,7 @@ import ServerConnections from '../ServerConnections';
|
|||
backdropImage.classList.add('backdropImageFadeIn');
|
||||
parent.appendChild(backdropImage);
|
||||
|
||||
if (!enableAnimation(backdropImage)) {
|
||||
if (!enableAnimation()) {
|
||||
if (existingBackdropImage && existingBackdropImage.parentNode) {
|
||||
existingBackdropImage.parentNode.removeChild(existingBackdropImage);
|
||||
}
|
||||
|
|
|
@ -275,12 +275,12 @@ import template from './homeScreenSettings.template.html';
|
|||
return html;
|
||||
}
|
||||
|
||||
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
||||
function renderPerLibrarySettings(context, user, userViews) {
|
||||
const elem = context.querySelector('.perLibrarySettings');
|
||||
let html = '';
|
||||
|
||||
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||
html += getPerLibrarySettingsHtml(userViews[i], user, userSettings, apiClient);
|
||||
html += getPerLibrarySettingsHtml(userViews[i], user);
|
||||
}
|
||||
|
||||
elem.innerHTML = html;
|
||||
|
@ -297,7 +297,7 @@ import template from './homeScreenSettings.template.html';
|
|||
Promise.all([promise1, promise2]).then(responses => {
|
||||
renderViewOrder(context, user, responses[0]);
|
||||
|
||||
renderPerLibrarySettings(context, user, responses[0].Items, userSettings, apiClient);
|
||||
renderPerLibrarySettings(context, user, responses[0].Items);
|
||||
|
||||
renderViews(context, user, responses[1]);
|
||||
|
||||
|
|
|
@ -140,17 +140,17 @@ import ServerConnections from '../ServerConnections';
|
|||
if (section === 'latestmedia') {
|
||||
loadRecentlyAdded(elem, apiClient, user, userViews);
|
||||
} else if (section === 'librarytiles' || section === 'smalllibrarytiles' || section === 'smalllibrarytiles-automobile' || section === 'librarytiles-automobile') {
|
||||
loadLibraryTiles(elem, apiClient, user, userSettings, 'smallBackdrop', userViews, allSections);
|
||||
loadLibraryTiles(elem, apiClient, user, userSettings, 'smallBackdrop', userViews);
|
||||
} else if (section === 'librarybuttons') {
|
||||
loadlibraryButtons(elem, apiClient, user, userSettings, userViews);
|
||||
} else if (section === 'resume') {
|
||||
loadResumeVideo(elem, apiClient, userId);
|
||||
loadResumeVideo(elem, apiClient);
|
||||
} else if (section === 'resumeaudio') {
|
||||
loadResumeAudio(elem, apiClient, userId);
|
||||
loadResumeAudio(elem, apiClient);
|
||||
} else if (section === 'activerecordings') {
|
||||
loadLatestLiveTvRecordings(elem, true, apiClient, userId);
|
||||
loadLatestLiveTvRecordings(elem, true, apiClient);
|
||||
} else if (section === 'nextup') {
|
||||
loadNextUp(elem, apiClient, userId);
|
||||
loadNextUp(elem, apiClient);
|
||||
} else if (section === 'onnow' || section === 'livetv') {
|
||||
return loadOnNow(elem, apiClient, user);
|
||||
} else {
|
||||
|
|
|
@ -142,7 +142,7 @@ import '../elements/emby-button/emby-button';
|
|||
|
||||
tabsElem = tabsContainerElem.querySelector('[is="emby-tabs"]');
|
||||
|
||||
configureSwipeTabs(view, tabsElem, getTabContainersFn);
|
||||
configureSwipeTabs(view, tabsElem);
|
||||
|
||||
tabsElem.addEventListener('beforetabchange', function (e) {
|
||||
const tabContainers = getTabContainersFn();
|
||||
|
|
|
@ -42,7 +42,7 @@ import template from './metadataEditor.template.html';
|
|||
toast(globalize.translate('MessageItemSaved'));
|
||||
|
||||
loading.hide();
|
||||
closeDialog(true);
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
const apiClient = getApiClient();
|
||||
|
@ -319,7 +319,7 @@ import template from './metadataEditor.template.html';
|
|||
|
||||
bindAll(context.querySelectorAll('.btnCancel'), 'click', function (event) {
|
||||
event.preventDefault();
|
||||
closeDialog(false);
|
||||
closeDialog();
|
||||
});
|
||||
|
||||
context.querySelector('.btnMore').addEventListener('click', function (e) {
|
||||
|
@ -1066,15 +1066,15 @@ import template from './metadataEditor.template.html';
|
|||
|
||||
currentContext = dlg;
|
||||
|
||||
init(dlg, ServerConnections.getApiClient(serverId));
|
||||
init(dlg);
|
||||
|
||||
reload(dlg, itemId, serverId);
|
||||
}
|
||||
|
||||
export default {
|
||||
show: function (itemId, serverId) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return show(itemId, serverId, resolve, reject);
|
||||
return new Promise(function (resolve) {
|
||||
return show(itemId, serverId, resolve);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1091,7 +1091,7 @@ import template from './metadataEditor.template.html';
|
|||
|
||||
currentContext = elem;
|
||||
|
||||
init(elem, ServerConnections.getApiClient(serverId));
|
||||
init(elem);
|
||||
reload(elem, itemId, serverId);
|
||||
|
||||
focusManager.autoFocus(elem);
|
||||
|
|
|
@ -440,13 +440,13 @@ import confirm from '../confirm/confirm';
|
|||
deltaY = 100;
|
||||
}
|
||||
if (deltaX >= 5 || deltaY >= 5) {
|
||||
onMouseOut(e);
|
||||
onMouseOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchEnd(e) {
|
||||
onMouseOut(e);
|
||||
function onTouchEnd() {
|
||||
onMouseOut();
|
||||
}
|
||||
|
||||
function onMouseDown(e) {
|
||||
|
|
|
@ -77,7 +77,7 @@ function showNotification(options, timeoutMs, apiClient) {
|
|||
resetRegistration();
|
||||
|
||||
if (serviceWorkerRegistration) {
|
||||
showPersistentNotification(title, options, timeoutMs);
|
||||
showPersistentNotification(title, options);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2048,7 +2048,7 @@ class PlaybackManager {
|
|||
return player.play(options);
|
||||
}
|
||||
|
||||
function playWithIntros(items, options, user) {
|
||||
function playWithIntros(items, options) {
|
||||
let playStartIndex = options.startIndex || 0;
|
||||
let firstItem = items[playStartIndex];
|
||||
|
||||
|
@ -2065,7 +2065,7 @@ class PlaybackManager {
|
|||
}
|
||||
|
||||
if (firstItem.MediaType === 'Photo' || firstItem.MediaType === 'Book') {
|
||||
return playOther(items, options, user);
|
||||
return playOther(items, options);
|
||||
}
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(firstItem.ServerId);
|
||||
|
|
|
@ -79,7 +79,7 @@ function reload(context, id) {
|
|||
|
||||
const apiClient = ServerConnections.getApiClient(currentServerId);
|
||||
apiClient.getLiveTvTimer(id).then(function (result) {
|
||||
renderTimer(context, result, apiClient);
|
||||
renderTimer(context, result);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ function fetchData(instance) {
|
|||
instance.TimerId = program.TimerId;
|
||||
instance.Status = program.Status;
|
||||
instance.SeriesTimerId = program.SeriesTimerId;
|
||||
loadData(options.parent, program, apiClient);
|
||||
loadData(options.parent, program);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -727,12 +727,12 @@ export default function () {
|
|||
});
|
||||
context.querySelector('.btnAudioTracks').addEventListener('click', function (e) {
|
||||
if (currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem) {
|
||||
showAudioMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem);
|
||||
showAudioMenu(context, currentPlayer, e.target);
|
||||
}
|
||||
});
|
||||
context.querySelector('.btnSubtitles').addEventListener('click', function (e) {
|
||||
if (currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem) {
|
||||
showSubtitleMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem);
|
||||
showSubtitleMenu(context, currentPlayer, e.target);
|
||||
}
|
||||
});
|
||||
context.querySelector('.btnStop').addEventListener('click', function () {
|
||||
|
@ -946,7 +946,7 @@ export default function () {
|
|||
};
|
||||
|
||||
self.onShow = function () {
|
||||
onShow(dlg, window.location.hash);
|
||||
onShow(dlg);
|
||||
};
|
||||
|
||||
self.destroy = function () {
|
||||
|
|
|
@ -89,7 +89,7 @@ import template from './searchfields.template.html';
|
|||
class SearchFields {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
embed(options.element, this, options);
|
||||
embed(options.element, this);
|
||||
}
|
||||
focus() {
|
||||
this.options.element.querySelector('.searchfields-txtSearch').focus();
|
||||
|
|
|
@ -603,7 +603,7 @@ import template from './searchresults.template.html';
|
|||
class SearchResults {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
embed(options.element, this, options);
|
||||
embed(options.element, this);
|
||||
}
|
||||
search(value) {
|
||||
const apiClient = ServerConnections.getApiClient(this.options.serverId);
|
||||
|
|
|
@ -161,9 +161,9 @@ function showEditor(options, resolve) {
|
|||
}
|
||||
|
||||
export function show(options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(function (resolve) {
|
||||
hasChanges = false;
|
||||
showEditor(options, resolve, reject);
|
||||
showEditor(options, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ class NoActivePlayer extends SyncPlay.Players.GenericPlayer {
|
|||
if (typeof commandHandler === 'function') {
|
||||
commandHandler(command, player);
|
||||
} else {
|
||||
defaultAction(command, player);
|
||||
defaultAction(command);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,8 +163,7 @@ function tunerPicker() {
|
|||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
||||
}
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(options.serverId);
|
||||
discoverDevices(dlg, apiClient);
|
||||
discoverDevices(dlg);
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||
|
|
|
@ -224,11 +224,11 @@ import confirm from '../../components/confirm/confirm';
|
|||
loading.hide();
|
||||
}
|
||||
|
||||
function pollForInfo(view, apiClient, forceUpdate) {
|
||||
function pollForInfo(view, apiClient) {
|
||||
apiClient.getSessions({
|
||||
ActiveWithinSeconds: 960
|
||||
}).then(function (sessions) {
|
||||
renderInfo(view, sessions, forceUpdate);
|
||||
renderInfo(view, sessions);
|
||||
});
|
||||
apiClient.getScheduledTasks().then(function (tasks) {
|
||||
renderRunningTasks(view, tasks);
|
||||
|
@ -745,14 +745,14 @@ import confirm from '../../components/confirm/confirm';
|
|||
|
||||
function onPackageInstalling(evt, apiClient) {
|
||||
if (apiClient.serverId() === serverId) {
|
||||
pollForInfo(view, apiClient, true);
|
||||
pollForInfo(view, apiClient);
|
||||
reloadSystemInfo(view, apiClient);
|
||||
}
|
||||
}
|
||||
|
||||
function onPackageInstallationCompleted(evt, apiClient) {
|
||||
if (apiClient.serverId() === serverId) {
|
||||
pollForInfo(view, apiClient, true);
|
||||
pollForInfo(view, apiClient);
|
||||
reloadSystemInfo(view, apiClient);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import alert from '../../components/alert';
|
|||
config.EnableExtraThumbsDuplication = form.querySelector('#chkEnableExtraThumbs').checked;
|
||||
ApiClient.updateNamedConfiguration(metadataKey, config).then(function () {
|
||||
Dashboard.processServerConfigurationUpdateResult();
|
||||
showConfirmMessage(config);
|
||||
showConfirmMessage();
|
||||
});
|
||||
});
|
||||
return false;
|
||||
|
|
|
@ -146,7 +146,7 @@ import toast from '../../../components/toast/toast';
|
|||
}
|
||||
ApiClient.updateUser(user).then(function () {
|
||||
ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
|
||||
onSaveComplete(page, user);
|
||||
onSaveComplete();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ import toast from '../../../components/toast/toast';
|
|||
user.Policy.BlockedChannels = null;
|
||||
user.Policy.BlockedMediaFolders = null;
|
||||
ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
|
||||
onSaveComplete(page);
|
||||
onSaveComplete();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ import toast from '../../../components/toast/toast';
|
|||
user.Policy.AccessSchedules = getSchedulesFromPage(page);
|
||||
user.Policy.BlockedTags = getBlockedTagsFromPage(page);
|
||||
ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
|
||||
onSaveComplete(page);
|
||||
onSaveComplete();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -146,14 +146,14 @@ import cardBuilder from '../../../components/cardbuilder/cardBuilder';
|
|||
return '';
|
||||
}
|
||||
|
||||
function getUserSectionHtml(users, addConnectIndicator) {
|
||||
function getUserSectionHtml(users) {
|
||||
return users.map(function (u__q) {
|
||||
return getUserHtml(u__q, addConnectIndicator);
|
||||
return getUserHtml(u__q);
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function renderUsers(page, users) {
|
||||
page.querySelector('.localUsers').innerHTML = getUserSectionHtml(users, true);
|
||||
page.querySelector('.localUsers').innerHTML = getUserSectionHtml(users);
|
||||
}
|
||||
|
||||
function loadData(page) {
|
||||
|
|
|
@ -296,7 +296,7 @@ function onDevicesListClick(e) {
|
|||
$(document).on('pageinit', '#liveTvStatusPage', function () {
|
||||
const page = this;
|
||||
$('.btnAddDevice', page).on('click', function () {
|
||||
addDevice(this);
|
||||
addDevice();
|
||||
});
|
||||
$('.formAddDevice', page).on('submit', function () {
|
||||
submitAddDeviceForm(page);
|
||||
|
|
|
@ -222,7 +222,7 @@ import Dashboard from '../../scripts/clientUtils';
|
|||
const userId = ApiClient.getCurrentUserId();
|
||||
loadResume(tabContent, userId, parentId);
|
||||
loadLatest(tabContent, userId, parentId);
|
||||
loadSuggestions(tabContent, userId, parentId);
|
||||
loadSuggestions(tabContent, userId);
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
|
|
|
@ -112,7 +112,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
|||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
updateFilterControls(page);
|
||||
updateFilterControls();
|
||||
let html;
|
||||
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
|
@ -304,7 +304,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
|||
|
||||
this.renderTab = function () {
|
||||
reloadItems(tabContent);
|
||||
updateFilterControls(tabContent);
|
||||
updateFilterControls();
|
||||
};
|
||||
|
||||
this.destroy = function () {};
|
||||
|
|
|
@ -426,7 +426,7 @@ import { appRouter } from '../../../components/appRouter';
|
|||
if (state.NowPlayingItem) {
|
||||
isEnabled = true;
|
||||
updatePlayerStateInternal(event, player, state);
|
||||
updatePlaylist(player);
|
||||
updatePlaylist();
|
||||
enableStopOnBack(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import '../../assets/css/scrollstyles.scss';
|
|||
return null;
|
||||
}
|
||||
|
||||
function removeActivePanelClass(tabs, index) {
|
||||
const tabPanel = getTabPanel(tabs, index);
|
||||
function removeActivePanelClass() {
|
||||
const tabPanel = getTabPanel();
|
||||
if (tabPanel) {
|
||||
tabPanel.classList.remove('is-active');
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ import '../../assets/css/scrollstyles.scss';
|
|||
}
|
||||
}));
|
||||
if (previousIndex != null && previousIndex !== index) {
|
||||
removeActivePanelClass(tabs, previousIndex);
|
||||
removeActivePanelClass();
|
||||
}
|
||||
|
||||
const newPanel = getTabPanel(tabs, index);
|
||||
const newPanel = getTabPanel();
|
||||
|
||||
if (newPanel) {
|
||||
// animate new panel ?
|
||||
|
|
|
@ -101,7 +101,7 @@ function processUpdatedSessions(instance, sessions, apiClient) {
|
|||
if (session) {
|
||||
normalizeImages(session, apiClient);
|
||||
|
||||
const eventNames = getChangedEvents(instance.lastPlayerData, session);
|
||||
const eventNames = getChangedEvents(instance.lastPlayerData);
|
||||
instance.lastPlayerData = session;
|
||||
|
||||
for (let i = 0, length = eventNames.length; i < length; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue