Merge pull request #4811 from grafixeyehero/fix-music-mode

Fix music artists page mode
This commit is contained in:
Bill Thornton 2023-09-29 09:40:51 -04:00 committed by GitHub
commit 273af701ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -9,7 +9,7 @@ import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
export default function (view, params, tabContent) {
export default function (view, params, tabContent, options) {
function getPageData() {
const key = getSavedQueryKey();
let pageData = data[key];
@ -45,7 +45,7 @@ export default function (view, params, tabContent) {
}
function getSavedQueryKey() {
return `${params.topParentId}-${this.mode}`;
return `${params.topParentId}-${options.mode}`;
}
const onViewStyleChange = () => {
@ -67,7 +67,7 @@ export default function (view, params, tabContent) {
loading.show();
isLoading = true;
const query = getQuery();
const promise = this.mode == 'albumartists' ?
const promise = options.mode == 'albumartists' ?
ApiClient.getAlbumArtists(ApiClient.getCurrentUserId(), query) :
ApiClient.getArtists(ApiClient.getCurrentUserId(), query);
promise.then((result) => {
@ -169,7 +169,7 @@ export default function (view, params, tabContent) {
import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => {
const filterDialog = new FilterDialog({
query: getQuery(),
mode: this.mode,
mode: options.mode,
serverId: ApiClient.serverId()
});
Events.on(filterDialog, 'filterchange', function () {

View File

@ -260,6 +260,14 @@ export default function (view, params) {
mainTabsManager.setTabs(view, currentTabIndex, getTabs, getTabContainers, onBeforeTabChange, onTabChange);
}
function getMode(index) {
if (index === 2) {
return 'albumartists';
} else if (index === 3) {
return 'artists';
}
}
const getTabController = (page, index, callback) => {
let depends;
@ -306,13 +314,9 @@ export default function (view, params) {
if (index === 1) {
controller = this;
} else {
controller = new ControllerFactory(view, params, tabContent);
}
if (index == 2) {
controller.mode = 'albumartists';
} else if (index == 3) {
controller.mode = 'artists';
controller = new ControllerFactory(view, params, tabContent, {
mode: getMode(index)
});
}
tabControllers[index] = controller;