diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 365638fc78..4f79628247 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -2425,6 +2425,11 @@ lines.push(item.ProductionYear || ''); } + if (options.showChannelName) { + + lines.push(item.ChannelName || ''); + } + if (options.showAirTime) { var airTimeText; diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 5dae5e7c1a..1a824a248b 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -229,6 +229,27 @@ } } + function deleteTimer(id, itemsContainer) { + + require(['confirm'], function (confirm) { + + confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () { + + Dashboard.showLoadingMsg(); + + ApiClient.cancelLiveTvTimer(id).then(function () { + + require(['toast'], function (toast) { + toast(Globalize.translate('MessageRecordingCancelled')); + }); + + Dashboard.hideLoadingMsg(); + itemsContainer.dispatchEvent(new CustomEvent('timercancelled', {})); + }); + }); + }); + } + function showContextMenu(card, options) { var displayContextItem = card; @@ -323,8 +344,16 @@ }); } + if (itemType == 'Timer' && user.Policy.EnableLiveTvManagement) { + items.push({ + name: Globalize.translate('ButtonCancel'), + id: 'canceltimer', + ironIcon: 'cancel' + }); + } + items.push({ - name: Globalize.translate('ButtonOpen'), + name: itemType == 'Timer' ? Globalize.translate('ButtonEdit') : Globalize.translate('ButtonOpen'), id: 'open', ironIcon: 'folder-open' }); @@ -581,6 +610,9 @@ case 'externalplayer': LibraryBrowser.playInExternalPlayer(itemId); break; + case 'canceltimer': + deleteTimer(itemId, $(card).parents('.itemsContainer')[0]); + break; case 'share': require(['sharingmanager'], function (sharingManager) { sharingManager.showMenu({ diff --git a/dashboard-ui/scripts/livetvcomponents.js b/dashboard-ui/scripts/livetvcomponents.js index cbd3ede7e2..772e109616 100644 --- a/dashboard-ui/scripts/livetvcomponents.js +++ b/dashboard-ui/scripts/livetvcomponents.js @@ -12,108 +12,13 @@ shape: "square", showTitle: true, showAirTime: true, + showChannelName: true, lazy: true, cardLayout: true, showDetailsMenu: true }); return Promise.resolve(html); - - return new Promise(function (resolve, reject) { - - require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () { - var html = ''; - var index = ''; - var imgUrl; - - for (var i = 0, length = timers.length; i < length; i++) { - - var timer = timers[i]; - - var startDateText = LibraryBrowser.getFutureDateText(datetime.parseISO8601Date(timer.StartDate, true)); - - if (startDateText != index) { - - if (index) { - html += ''; - html += ''; - } - - html += '
'; - html += '

' + startDateText + '

'; - html += '
'; - index = startDateText; - } - - html += ''; - - var program = timer.ProgramInfo || {}; - - imgUrl = null; - if (program.ImageTags && program.ImageTags.Primary) { - - imgUrl = ApiClient.getScaledImageUrl(program.Id, { - height: 80, - tag: program.ImageTags.Primary, - type: "Primary" - }); - } - - if (imgUrl) { - html += ''; - } - else if (program.IsKids) { - html += ''; - } - else if (program.IsSports) { - html += ''; - } - else if (program.IsMovie) { - html += ''; - } - else if (program.IsNews) { - html += ''; - } - else { - html += ''; - } - - html += ''; - html += ''; - - html += '
'; - html += timer.Name; - html += '
'; - - html += '
'; - html += datetime.getDisplayTime(timer.StartDate); - html += ' - ' + datetime.getDisplayTime(timer.EndDate); - html += '
'; - - html += '
'; - html += '
'; - - if (timer.SeriesTimerId) { - html += '
'; - html += '
'; - html += '
'; - html += '
'; - html += '
'; - } - - html += ''; - - html += '
'; - } - - if (timers.length) { - html += '
'; - html += '
'; - } - - resolve(html); - }); - }); } window.LiveTvHelpers = { diff --git a/dashboard-ui/scripts/livetvrecordings.js b/dashboard-ui/scripts/livetvrecordings.js index 1844c9abc5..9f78b5b91f 100644 --- a/dashboard-ui/scripts/livetvrecordings.js +++ b/dashboard-ui/scripts/livetvrecordings.js @@ -108,26 +108,6 @@ }); } - function deleteTimer(page, id) { - - require(['confirm'], function (confirm) { - - confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () { - - Dashboard.showLoadingMsg(); - - ApiClient.cancelLiveTvTimer(id).then(function () { - - require(['toast'], function (toast) { - toast(Globalize.translate('MessageRecordingCancelled')); - }); - - reload(page); - }); - }); - }); - } - function renderTimers(page, timers) { LiveTvHelpers.getTimersHtml(timers).then(function (html) { @@ -143,13 +123,6 @@ elem.querySelector('.itemsContainer').innerHTML = html; ImageLoader.lazyChildren(elem); - - $('.btnDeleteTimer', elem).on('click', function () { - - var id = this.getAttribute('data-timerid'); - - deleteTimer(page, id); - }); }); } @@ -181,11 +154,16 @@ }); } + window.LiveTvPage.initRecordingsTab = function (page, tabContent) { + + tabContent.querySelector('#upcomingRecordings .itemsContainer').addEventListener('timercancelled', function () { + reload(tabContent); + }); + }; + window.LiveTvPage.renderRecordingsTab = function (page, tabContent) { - if (LibraryBrowser.needsRefresh(tabContent)) { - reload(tabContent); - } + reload(tabContent); }; }); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvsuggested.js b/dashboard-ui/scripts/livetvsuggested.js index c42977dc3b..9e65f2c69d 100644 --- a/dashboard-ui/scripts/livetvsuggested.js +++ b/dashboard-ui/scripts/livetvsuggested.js @@ -165,6 +165,7 @@ break; case 3: depends.push('scripts/livetvrecordings'); + initMethod = 'initRecordingsTab'; renderMethod = 'renderRecordingsTab'; break; case 4: