From f5ad0dbc21c71cb77a1d6361de30559b0cd9aeaa Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 26 Dec 2016 12:37:05 -0500 Subject: [PATCH] update sync dialogs --- .../emby-webcomponents/.bower.json | 8 +- .../emby-webcomponents/itemcontextmenu.js | 14 +-- .../metadataeditor/metadataeditor.js | 6 +- .../emby-webcomponents/strings/en-US.json | 28 +++++- .../emby-webcomponents/sync/syncjobeditor.js | 22 ++--- .../emby-webcomponents/sync/syncjoblist.js | 85 +++++++++++++++---- .../emby-webcomponents/sync/synctoggle.js | 9 +- dashboard-ui/css/librarybrowser.css | 2 +- dashboard-ui/mysync.html | 11 --- dashboard-ui/scripts/mysync.js | 40 +-------- dashboard-ui/scripts/syncactivity.js | 33 +------ dashboard-ui/syncactivity.html | 13 --- 12 files changed, 124 insertions(+), 147 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index d3304bb8be..2aba635581 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -14,12 +14,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.4.399", - "_release": "1.4.399", + "version": "1.4.400", + "_release": "1.4.400", "_resolution": { "type": "version", - "tag": "1.4.399", - "commit": "b926b582df014a7b2b54e93dca167db73d59bbcb" + "tag": "1.4.400", + "commit": "8b3fe5c5f8044cccac68ca4535c2c818d160899e" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.1", diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js index 6729fb88c7..4a614a715a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js +++ b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js @@ -71,6 +71,13 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', } } + if (item.CanDownload && appHost.supports('filedownload')) { + commands.push({ + name: globalize.translate('sharedcomponents#Download'), + id: 'download' + }); + } + if (itemHelper.canEdit(user, item)) { if (options.edit !== false && item.Type !== 'SeriesTimer') { @@ -106,13 +113,6 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', } } - if (item.CanDownload && appHost.supports('filedownload')) { - commands.push({ - name: globalize.translate('sharedcomponents#Download'), - id: 'download' - }); - } - if (options.identify !== false) { if (itemHelper.canIdentify(user, item.Type)) { commands.push({ diff --git a/dashboard-ui/bower_components/emby-webcomponents/metadataeditor/metadataeditor.js b/dashboard-ui/bower_components/emby-webcomponents/metadataeditor/metadataeditor.js index e7a7b1e39e..2dd6cbe1da 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/metadataeditor/metadataeditor.js +++ b/dashboard-ui/bower_components/emby-webcomponents/metadataeditor/metadataeditor.js @@ -765,11 +765,11 @@ showElement('#fldParentIndexNumber'); if (item.Type === "Episode") { - context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelSeasonNumber')); + context.querySelector('#txtParentIndexNumber').label(globalize.translate('sharedcomponents#LabelSeasonNumber')); } else if (item.Type === "Audio") { - context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelDiscNumber')); + context.querySelector('#txtParentIndexNumber').label(globalize.translate('sharedcomponents#LabelDiscNumber')); } else { - context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelParentNumber')); + context.querySelector('#txtParentIndexNumber').label(globalize.translate('sharedcomponents#LabelParentNumber')); } } else { hideElement('#fldParentIndexNumber', context); diff --git a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json index e4bb749a2e..124c0ccc27 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json +++ b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json @@ -49,6 +49,8 @@ "CloudSyncFeatureDescription": "Sync your media to the cloud for easy backup, archiving, and converting.", "CoverArtFeatureDescription": "Cover Art creates fun covers and other treatments to help you personalize your media images.", "CoverArt": "Cover Art", + "ButtonCancelSyncJob": "Cancel sync", + "CancelSyncJobConfirmation": "Cancelling the sync job will remove synced media from the device during the next sync process. Are you sure you wish to proceed?", "CinemaModeFeatureDescription": "Cinema Mode gives you the true cinema experience with trailers and custom intros before the feature.", "HeaderFreeApps": "Free Emby Apps", "FreeAppsFeatureDescription": "Enjoy free access to Emby apps for your devices.", @@ -206,8 +208,8 @@ "LabelEpisodeNumber": "Episode number:", "LabelTrackNumber": "Track number:", "LabelNumber": "Number:", - "LabelDiscNumber": "Disc number", - "LabelParentNumber": "Parent number", + "LabelDiscNumber": "Disc number:", + "LabelParentNumber": "Parent number:", "SortName": "Sort name", "ReleaseDate": "Release date", "Continuing": "Continuing", @@ -232,11 +234,14 @@ "GuestStar": "Guest star", "Producer": "Producer", "Writer": "Writer", + "MessageNoSyncJobsFound": "No sync jobs found. Create sync jobs using the Sync buttons found throughout the app.", + "MessageNoDownloadsFound": "No offline downloads. Make your media available offline by clicking Make Available Offline throughout the app.", "InstallingPackage": "Installing {0}", "PackageInstallCompleted": "{0} installation completed.", "PackageInstallFailed": "{0} installation failed.", "PackageInstallCancelled": "{0} installation cancelled.", "SeriesYearToPresent": "{0} - Present", + "ValueOneItem": "1 item", "ValueOneSong": "1 song", "ValueSongCount": "{0} songs", "ValueOneMovie": "1 movie", @@ -269,6 +274,7 @@ "LabelQuality": "Quality:", "LabelSyncNoTargetsHelp": "It looks like you don't currently have any apps that support sync.", "DownloadScheduled": "Download scheduled", + "HeaderSyncRequiresSub": "Sync requires an active Emby Premiere subscription.", "LearnMore": "Learn more", "LabelProfile": "Profile:", "LabelBitrateMbps": "Bitrate (Mbps):", @@ -352,7 +358,23 @@ "MessageDidYouKnowCinemaMode2": "Cinema Mode gives you the true cinema experience with trailers and custom intros before the main feature.", "HeaderPlayMyMedia": "Play my Media", "HeaderDiscoverEmbyPremiere": "Discover Emby Premiere", + "Items": "Items", "OneChannel": "One channel", "ConfirmRemoveDownload": "Remove download?", - "AddedOnValue": "Added {0}" + "RemoveDownload": "Remove download", + "AddedOnValue": "Added {0}", + "RemovingFromDevice": "Removing from device", + "RemoveFromDevice": "Remove from device", + "KeepOnDevice": "Keep on device", + "CancelDownload": "Cancel download", + "SyncJobItemStatusReadyToTransfer": "Ready to Transfer", + "SyncJobItemStatusSyncedMarkForRemoval": "Removing from device", + "SyncJobItemStatusQueued": "Queued", + "SyncJobItemStatusConverting": "Converting", + "SyncJobItemStatusTransferring": "Transferring", + "SyncJobItemStatusSynced": "Downloaded", + "SyncJobItemStatusFailed": "Failed", + "SyncJobItemStatusRemovedFromDevice": "Removed from device", + "SyncJobItemStatusCancelled": "Cancelled", + "Retry": "Retry" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/sync/syncjobeditor.js b/dashboard-ui/bower_components/emby-webcomponents/sync/syncjobeditor.js index d5c9832c14..94dfe18d8d 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/sync/syncjobeditor.js +++ b/dashboard-ui/bower_components/emby-webcomponents/sync/syncjobeditor.js @@ -62,10 +62,10 @@ } else { html += '
'; } - html += globalize.translate('SyncJobItemStatus' + jobItem.Status); + html += globalize.translate('sharedcomponents#SyncJobItemStatus' + jobItem.Status); if (jobItem.Status == 'Synced' && jobItem.IsMarkedForRemoval) { html += '
'; - html += globalize.translate('SyncJobItemStatusSyncedMarkForRemoval'); + html += globalize.translate('sharedcomponents#RemovingFromDevice'); } html += '
'; @@ -92,7 +92,7 @@ var html = ''; - html += '

' + globalize.translate('HeaderItems') + '

'; + html += '

' + globalize.translate('sharedcomponents#Items') + '

'; html += '
'; @@ -133,33 +133,27 @@ var menuItems = []; - if (status == 'Failed') { + if (status == 'Failed' || status == 'Cancelled') { menuItems.push({ - name: globalize.translate('ButtonQueueForRetry'), - id: 'retry' - }); - } - else if (status == 'Cancelled') { - menuItems.push({ - name: globalize.translate('ButtonReenable'), + name: globalize.translate('sharedcomponents#Retry'), id: 'retry' }); } else if (status == 'Queued' || status == 'Transferring' || status == 'Converting' || status == 'ReadyToTransfer') { menuItems.push({ - name: globalize.translate('ButtonCancelItem'), + name: globalize.translate('sharedcomponents#CancelDownload'), id: 'cancel' }); } else if (status == 'Synced' && remove) { menuItems.push({ - name: globalize.translate('ButtonUnmarkForRemoval'), + name: globalize.translate('sharedcomponents#KeepOnDevice'), id: 'unmarkforremoval' }); } else if (status == 'Synced') { menuItems.push({ - name: globalize.translate('ButtonMarkForRemoval'), + name: globalize.translate('sharedcomponents#RemoveFromDevice'), id: 'markforremoval' }); } diff --git a/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js b/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js index f5de8da7f1..31b0c503ea 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js +++ b/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js @@ -1,4 +1,4 @@ -define(['serverNotifications', 'events', 'loading', 'connectionManager', 'imageLoader', 'dom', 'globalize', 'listViewStyle'], function (serverNotifications, events, loading, connectionManager, imageLoader, dom, globalize) { +define(['serverNotifications', 'events', 'loading', 'connectionManager', 'imageLoader', 'dom', 'globalize', 'registrationServices', 'listViewStyle'], function (serverNotifications, events, loading, connectionManager, imageLoader, dom, globalize, registrationServices) { 'use strict'; function onSyncJobsUpdated(e, apiClient, data) { @@ -20,10 +20,15 @@ require(['confirm'], function (confirm) { var msg = listInstance.options.isLocalSync ? -globalize.translate('ConfirmRemoveDownload') : -globalize.translate('CancelSyncJobConfirmation'); +globalize.translate('sharedcomponents#ConfirmRemoveDownload') : +globalize.translate('sharedcomponents#CancelSyncJobConfirmation'); - confirm(msg).then(function () { + confirm({ + + text: msg, + primary: 'cancel' + + }).then(function () { loading.show(); var apiClient = getApiClient(listInstance); @@ -94,10 +99,10 @@ globalize.translate('CancelSyncJobConfirmation'); textLines.push(job.Name); - if (job.ItemCount == 1) { - textLines.push(globalize.translate('ValueItemCount', job.ItemCount)); + if (job.ItemCount === 1) { + textLines.push(globalize.translate('sharedcomponents#ValueOneItem')); } else { - textLines.push(globalize.translate('ValueItemCountPlural', job.ItemCount)); + textLines.push(globalize.translate('sharedcomponents#ItemCount', job.ItemCount)); } if (textLines >= 3) { @@ -165,10 +170,10 @@ globalize.translate('CancelSyncJobConfirmation'); html += '
'; - html += '
' + targetName + '
'; + html += '

' + targetName + '

'; html += '
'; - html += '
'; + html += '
'; hasOpenSection = true; } } @@ -180,13 +185,13 @@ globalize.translate('CancelSyncJobConfirmation'); html += '
'; } - var elem = listInstance.options.element; + var elem = listInstance.options.element.querySelector('.syncJobListContent'); if (!html) { if (isLocalSync) { - html = '
' + globalize.translate('MessageDownloadsFound') + '
'; + html = '
' + globalize.translate('sharedcomponents#MessageNoDownloadsFound') + '
'; } else { - html = '
' + globalize.translate('MessageNoSyncJobsFound') + '
'; + html = '
' + globalize.translate('sharedcomponents#MessageNoSyncJobsFound') + '
'; } } @@ -260,16 +265,16 @@ globalize.translate('CancelSyncJobConfirmation'); if (status == 'Cancelled') { menuItems.push({ - name: globalize.translate('ButtonDelete'), + name: globalize.translate('sharedcomponents#Delete'), id: 'delete' }); } else { var txt = listInstance.options.isLocalSync ? -globalize.translate('RemoveDownload') : -globalize.translate('ButtonCancelSyncJob'); +globalize.translate('sharedcomponents#RemoveDownload') : +globalize.translate('sharedcomponents#ButtonCancelSyncJob'); menuItems.push({ - name: globalize.translate(txt), + name: txt, id: 'cancel' }); } @@ -312,7 +317,14 @@ globalize.translate('ButtonCancelSyncJob'); if (listItem) { var jobId = listItem.getAttribute('data-id'); // edit job - events.trigger(listInstance, 'jobedit', [jobId, listInstance.options.serverId]); + require(['syncJobEditor'], function (syncJobEditor) { + syncJobEditor.show({ + serverId: listInstance.options.serverId, + jobId: jobId + }).then(function () { + fetchData(listInstance); + }); + }); } } @@ -327,8 +339,47 @@ globalize.translate('ButtonCancelSyncJob'); options.element.addEventListener('click', onClickHandler); this.onClickHandler = onClickHandler; + options.element.innerHTML = '
'; + fetchData(this); startListening(this); + + initSupporterInfo(options.element, getApiClient(this)); + } + + function showSupporterInfo(context) { + + var html = ' -
-

diff --git a/dashboard-ui/scripts/mysync.js b/dashboard-ui/scripts/mysync.js index 0e0d009b9f..4d154d3dbf 100644 --- a/dashboard-ui/scripts/mysync.js +++ b/dashboard-ui/scripts/mysync.js @@ -1,32 +1,6 @@ define(['apphost', 'globalize', 'syncJobList', 'events', 'localsync', 'emby-button', 'paper-icon-button-light'], function (appHost, globalize, syncJobList, events, localSync) { 'use strict'; - function initSupporterInfo(view, params) { - - view.querySelector('.btnSyncSupporter').addEventListener('click', function () { - - requirejs(["registrationServices"], function (registrationServices) { - registrationServices.validateFeature('sync'); - }); - }); - - view.querySelector('.supporterPromotion .mainText').innerHTML = globalize.translate('HeaderSyncRequiresSupporterMembership'); - - var apiClient = ApiClient; - apiClient.getPluginSecurityInfo().then(function (regInfo) { - - if (regInfo.IsMBSupporter) { - view.querySelector('.supporterPromotionContainer').classList.add('hide'); - } else { - view.querySelector('.supporterPromotionContainer').classList.remove('hide'); - } - - }, function () { - - view.querySelector('.supporterPromotionContainer').classList.remove('hide'); - }); - } - return function (view, params) { var interval; @@ -71,22 +45,12 @@ view.querySelector('.localSyncStatus').classList.add('hide'); } - initSupporterInfo(view, params); var mySyncJobList = new syncJobList({ isLocalSync: params.mode === 'offline', serverId: ApiClient.serverId(), userId: params.mode === 'offline' ? null : ApiClient.getCurrentUserId(), - element: view.querySelector('.syncActivity') - }); - - events.on(mySyncJobList, 'jobedit', function (e, jobId, serverId) { - - require(['syncJobEditor'], function (syncJobEditor) { - syncJobEditor.show({ - serverId: ApiClient.serverId(), - jobId: jobId - }); - }); + element: view.querySelector('.syncActivity'), + mode: params.mode }); view.addEventListener('viewbeforeshow', function () { diff --git a/dashboard-ui/scripts/syncactivity.js b/dashboard-ui/scripts/syncactivity.js index a64633aa3c..607a3bf83e 100644 --- a/dashboard-ui/scripts/syncactivity.js +++ b/dashboard-ui/scripts/syncactivity.js @@ -21,43 +21,14 @@ }]; } - function initSupporterInfo(view, params) { - - view.querySelector('.supporterPromotion .mainText').innerHTML = globalize.translate('HeaderSyncRequiresSupporterMembership'); - - var apiClient = ApiClient; - apiClient.getPluginSecurityInfo().then(function (regInfo) { - - if (regInfo.IsMBSupporter) { - view.querySelector('.supporterPromotionContainer').classList.add('hide'); - } else { - view.querySelector('.supporterPromotionContainer').classList.remove('hide'); - } - - }, function () { - - view.querySelector('.supporterPromotionContainer').classList.remove('hide'); - }); - } - return function (view, params) { - initSupporterInfo(view, params); var mySyncJobList = new syncJobList({ isLocalSync: params.mode === 'offline', serverId: ApiClient.serverId(), userId: params.mode === 'offline' ? null : ApiClient.getCurrentUserId(), - element: view.querySelector('.syncActivity') - }); - - events.on(mySyncJobList, 'jobedit', function (e, jobId, serverId) { - - require(['syncJobEditor'], function (syncJobEditor) { - syncJobEditor.show({ - serverId: ApiClient.serverId(), - jobId: jobId - }); - }); + element: view.querySelector('.syncActivity'), + mode: params.mode }); view.addEventListener('viewshow', function () { diff --git a/dashboard-ui/syncactivity.html b/dashboard-ui/syncactivity.html index 920f1d4b1b..84b8a960ea 100644 --- a/dashboard-ui/syncactivity.html +++ b/dashboard-ui/syncactivity.html @@ -17,19 +17,6 @@