mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
refactor: use ItemSortBy from generated SDK
This commit is contained in:
parent
2e4eb68d59
commit
52c150a2e7
2 changed files with 17 additions and 15 deletions
|
@ -7,6 +7,7 @@ import ServerConnections from 'components/ServerConnections';
|
||||||
import dom from 'scripts/dom';
|
import dom from 'scripts/dom';
|
||||||
import globalize from 'scripts/globalize';
|
import globalize from 'scripts/globalize';
|
||||||
import { getBackdropShape, getPortraitShape, getSquareShape } from 'utils/card';
|
import { getBackdropShape, getPortraitShape, getSquareShape } from 'utils/card';
|
||||||
|
import { ItemSortBy } from '@jellyfin/sdk/lib/generated-client/models/item-sort-by';
|
||||||
|
|
||||||
import 'elements/emby-itemscontainer/emby-itemscontainer';
|
import 'elements/emby-itemscontainer/emby-itemscontainer';
|
||||||
import 'elements/emby-scroller/emby-scroller';
|
import 'elements/emby-scroller/emby-scroller';
|
||||||
|
@ -133,7 +134,7 @@ function getFetchDataFn(section) {
|
||||||
return function () {
|
return function () {
|
||||||
const apiClient = this.apiClient;
|
const apiClient = this.apiClient;
|
||||||
const options = {
|
const options = {
|
||||||
SortBy: 'SeriesSortName,SortName',
|
SortBy: [ItemSortBy.SeriesSortName, ItemSortBy.SortName].join(','),
|
||||||
SortOrder: 'Ascending',
|
SortOrder: 'Ascending',
|
||||||
Filters: 'IsFavorite',
|
Filters: 'IsFavorite',
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
|
|
|
@ -13,6 +13,7 @@ import '../elements/emby-scroller/emby-scroller';
|
||||||
import ServerConnections from '../components/ServerConnections';
|
import ServerConnections from '../components/ServerConnections';
|
||||||
import LibraryMenu from '../scripts/libraryMenu';
|
import LibraryMenu from '../scripts/libraryMenu';
|
||||||
import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
|
import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
|
||||||
|
import { ItemSortBy } from '@jellyfin/sdk/lib/generated-client/models/item-sort-by';
|
||||||
|
|
||||||
function getInitialLiveTvQuery(instance, params, startIndex = 0, limit = 300) {
|
function getInitialLiveTvQuery(instance, params, startIndex = 0, limit = 300) {
|
||||||
const query = {
|
const query = {
|
||||||
|
@ -223,7 +224,7 @@ function updateAlphaPickerState(instance) {
|
||||||
if (alphaPicker) {
|
if (alphaPicker) {
|
||||||
const values = instance.getSortValues();
|
const values = instance.getSortValues();
|
||||||
|
|
||||||
if (values.sortBy.indexOf('SortName') !== -1) {
|
if (values.sortBy.indexOf(ItemSortBy.SortName) !== -1) {
|
||||||
alphaPicker.classList.remove('hide');
|
alphaPicker.classList.remove('hide');
|
||||||
instance.itemsContainer.parentNode.classList.add('padded-right-withalphapicker');
|
instance.itemsContainer.parentNode.classList.add('padded-right-withalphapicker');
|
||||||
} else {
|
} else {
|
||||||
|
@ -981,7 +982,7 @@ class ItemsView {
|
||||||
return sortNameOption.value;
|
return sortNameOption.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'IsFolder,' + sortNameOption.value;
|
return `${ItemSortBy.IsFolder},${sortNameOption.value}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSortMenuOptions() {
|
getSortMenuOptions() {
|
||||||
|
@ -990,7 +991,7 @@ class ItemsView {
|
||||||
if (this.params.type === 'Programs') {
|
if (this.params.type === 'Programs') {
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('AirDate'),
|
name: globalize.translate('AirDate'),
|
||||||
value: 'StartDate,SortName'
|
value: [ItemSortBy.StartDate, ItemSortBy.SortName].join(',')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1015,7 +1016,7 @@ class ItemsView {
|
||||||
if (this.params.type !== 'Programs') {
|
if (this.params.type !== 'Programs') {
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('DateAdded'),
|
name: globalize.translate('DateAdded'),
|
||||||
value: 'DateCreated,SortName'
|
value: [ItemSortBy.DateCreated, ItemSortBy.SortName].join(',')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,13 +1030,13 @@ class ItemsView {
|
||||||
option = this.getNameSortOption(this.params);
|
option = this.getNameSortOption(this.params);
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('Folders'),
|
name: globalize.translate('Folders'),
|
||||||
value: 'IsFolder,' + option.value
|
value: `${ItemSortBy.IsFolder},${option.value}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('ParentalRating'),
|
name: globalize.translate('ParentalRating'),
|
||||||
value: 'OfficialRating,SortName'
|
value: [ItemSortBy.OfficialRating, ItemSortBy.SortName].join(',')
|
||||||
});
|
});
|
||||||
option = this.getPlayCountSortOption();
|
option = this.getPlayCountSortOption();
|
||||||
|
|
||||||
|
@ -1045,11 +1046,11 @@ class ItemsView {
|
||||||
|
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('ReleaseDate'),
|
name: globalize.translate('ReleaseDate'),
|
||||||
value: 'ProductionYear,PremiereDate,SortName'
|
value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName].join(',')
|
||||||
});
|
});
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('Runtime'),
|
name: globalize.translate('Runtime'),
|
||||||
value: 'Runtime,SortName'
|
value: [ItemSortBy.Runtime, ItemSortBy.SortName].join(',')
|
||||||
});
|
});
|
||||||
return sortBy;
|
return sortBy;
|
||||||
}
|
}
|
||||||
|
@ -1058,13 +1059,13 @@ class ItemsView {
|
||||||
if (params.type === 'Episode') {
|
if (params.type === 'Episode') {
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('Name'),
|
name: globalize.translate('Name'),
|
||||||
value: 'SeriesSortName,SortName'
|
value: [ItemSortBy.SeriesSortName, ItemSortBy.SortName].join(',')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('Name'),
|
name: globalize.translate('Name'),
|
||||||
value: 'SortName'
|
value: ItemSortBy.SortName
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,7 +1076,7 @@ class ItemsView {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('PlayCount'),
|
name: globalize.translate('PlayCount'),
|
||||||
value: 'PlayCount,SortName'
|
value: [ItemSortBy.PlayCount, ItemSortBy.SortName].join(',')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,7 +1087,7 @@ class ItemsView {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('DatePlayed'),
|
name: globalize.translate('DatePlayed'),
|
||||||
value: 'DatePlayed,SortName'
|
value: [ItemSortBy.DatePlayed, ItemSortBy.SortName].join(',')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,14 +1098,14 @@ class ItemsView {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('CriticRating'),
|
name: globalize.translate('CriticRating'),
|
||||||
value: 'CriticRating,SortName'
|
value: [ItemSortBy.CriticRating, ItemSortBy.SortName].join(',')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunityRatingSortOption() {
|
getCommunityRatingSortOption() {
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('CommunityRating'),
|
name: globalize.translate('CommunityRating'),
|
||||||
value: 'CommunityRating,SortName'
|
value: [ItemSortBy.CommunityRating, ItemSortBy.SortName].join(',')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue