jellyfin-web/dashboard-ui/scripts/reports.js

1 line
21 KiB
JavaScript
Raw Normal View History

2017-03-25 14:32:04 -07:00
define(["jQuery","libraryBrowser","loading","fnchecked"],function($,libraryBrowser,loading){"use strict";function getTable(result){var html="";return html+='<table id="tblReport" data-role="table" data-mode="reflow" class="tblLibraryReport stripedTable ui-responsive table-stroke detailTable" style="display:table;">',html+="<thead>",result.Headers.map(function(header){var cellHtml='<th data-priority="persist">';header.ShowHeaderLabel&&(header.SortField&&(cellHtml+='<a class="lnkColumnSort" href="#" data-sortfield="'+header.SortField+'" style="text-decoration:underline;">'),cellHtml+=header.Name||"&nbsp;",header.SortField&&(cellHtml+="</a>",header.SortField===defaultSortBy&&(cellHtml+="Descending"===query.SortOrder?'<span style="font-weight:bold;margin-left:5px;vertical-align:top;">&darr;</span>':'<span style="font-weight:bold;margin-left:5px;vertical-align:top;">&uarr;</span>'))),cellHtml+="</th>",html+=cellHtml}),html+="</thead>",html+="<tbody>",result.IsGrouped===!1?result.Rows.map(function(row){html+=getRow(result.Headers,row)}):result.Groups.map(function(group){html+='<tr style="background-color: rgb(51, 51, 51);">',html+='<th scope="rowgroup" colspan="'+result.Headers.length+'">'+(group.Name||"&nbsp;")+"</th>",html+="</tr>",group.Rows.map(function(row){html+=getRow(result.Headers,row)}),html+="<tr>",html+='<th scope="rowgroup" colspan="'+result.Headers.length+'">&nbsp;</th>',html+="</tr>"}),html+="</tbody>",html+="</table>"}function getRow(rHeaders,rRow){var html="";html+="<tr>";for(var j=0;j<rHeaders.length;j++){var rHeader=rHeaders[j],rItem=rRow.Columns[j];html+=getItem(rHeader,rRow,rItem)}return html+="</tr>"}function getItem(rHeader,rRow,rItem){var html="";switch(html+="<td>",rHeader.ItemViewType){case"None":html+=rItem.Name;break;case"Detail":var id=rRow.Id;rItem.Id&&(id=rItem.Id),html+='<a href="itemdetails.html?id='+id+'">'+rItem.Name+"</a>";break;case"Edit":html+='<a href="edititemmetadata.html?id='+rRow.Id+'">'+rItem.Name+"</a>";break;case"List":html+='<a href="itemlist.html?id='+rRow.Id+'">'+rItem.Name+"</a>";break;case"ItemByNameDetails":html+='<a href="itemdetails.html?id='+rItem.Id+"&context="+rRow.RowType+'">'+rItem.Name+"</a>";break;case"EmbeddedImage":rRow.HasEmbeddedImage&&(html+='<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>');break;case"SubtitleImage":rRow.HasSubtitles&&(html+='<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>');break;case"TrailersImage":rRow.HasLocalTrailer&&(html+='<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>');break;case"SpecialsImage":rRow.HasSpecials&&(html+='<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>');break;case"LockDataImage":rRow.HasLockData&&(html+='<i class="md-icon">lock</i>');break;case"TagsPrimaryImage":rRow.HasImageTagsPrimary||(html+='<a href="edititemimages.html?id='+rRow.Id+'"><img src="css/images/editor/missingprimaryimage.png" title="Missing primary image." style="width:18px"/></a>');break;case"TagsBackdropImage":rRow.HasImageTagsBackdrop||"Episode"!==rRow.RowType&&"Season"!==rRow.RowType&&"Audio"!==rRow.MediaType&&"TvChannel"!==rRow.RowType&&"MusicAlbum"!==rRow.RowType&&(html+='<a href="edititemimages.html?id='+rRow.Id+'"><img src="css/images/editor/missingbackdrop.png" title="Missing backdrop image." style="width:18px"/></a>');break;case"TagsLogoImage":rRow.HasImageTagsLogo||"Movie"!==rRow.RowType&&"Trailer"!==rRow.RowType&&"Series"!==rRow.RowType&&"MusicArtist"!==rRow.RowType&&"BoxSet"!==rRow.RowType||(html+='<a href="edititemimages.html?id='+rRow.Id+'"><img src="css/images/editor/missinglogo.png" title="Missing logo image." style="width:18px"/></a>');break;case"UserPrimaryImage":if(rRow.UserId){var userImage=ApiClient.getUserImageUrl(rRow.UserId,{height:24,type:"Primary"});html+=userImage?'<img src="'+userImage+'" />':""}break;case"StatusImage":rRow.HasLo