diff --git a/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js b/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js index 437cdbdd75..f25f46a3e4 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js +++ b/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js @@ -176,23 +176,22 @@ return new Promise(function (resolve, reject) { - var msg = globalize.translate('ConfirmDeleteItem'); - var title = globalize.translate('HeaderDeleteItem'); + var msg = globalize.translate('sharedcomponents#ConfirmDeleteItem'); + var title = globalize.translate('sharedcomponents#HeaderDeleteItem'); if (itemIds.length > 1) { - msg = globalize.translate('ConfirmDeleteItems'); - title = globalize.translate('HeaderDeleteItems'); + msg = globalize.translate('sharedcomponents#ConfirmDeleteItems'); + title = globalize.translate('sharedcomponents#HeaderDeleteItems'); } require(['confirm'], function (confirm) { confirm(msg, title).then(function () { - var promises = itemIds.map(function (itemId) { apiClient.deleteItem(itemId); }); - resolve(); + Promise.all(promises).then(resolve); }, reject); }); @@ -306,7 +305,7 @@ dispatchNeedsRefresh(); break; case 'delete': - deleteItems(items).then(function () { + deleteItems(apiClient, items).then(function () { embyRouter.goHome(); }); hideSelections(); 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 9f8b3a795a..6b249205f5 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json +++ b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json @@ -252,5 +252,7 @@ "MakeAvailableOffline": "Make available offline", "ServerNameIsRestarting": "Emby Server - {0} is restarting.", "ServerNameIsShuttingDown": "Emby Server - {0} is shutting down.", + "HeaderDeleteItems": "Delete Items", + "ConfirmDeleteItems": "Deleting these items will delete them from both the file system and your media library. Are you sure you wish to continue?", "PleaseRestartServerName": "Please restart Emby Server - {0}." } \ No newline at end of file diff --git a/dashboard-ui/components/syncjoblist/syncjoblist.js b/dashboard-ui/components/syncjoblist/syncjoblist.js new file mode 100644 index 0000000000..3fc451f146 --- /dev/null +++ b/dashboard-ui/components/syncjoblist/syncjoblist.js @@ -0,0 +1,53 @@ +define(['serverNotifications', 'events', 'loading', 'connectionManager'], function (serverNotifications, events, loading, connectionManager) { + + function onSyncJobsUpdated(e, apiClient, data) { + + } + + function renderList(listInstance, items) { + + } + + function fetchData(listInstance) { + + listInstance.lastDataLoad = 0; + loading.show(); + + var options = {}; + var apiClient = connectionManager.getApiClient(listInstance.options.serverId); + + if (listInstance.options.userId) { + options.UserId = listInstance.options.userId; + } + + if (listInstance.options.isLocalSync) { + options.TargetId = apiClient.deviceId(); + } + + return apiClient.getJSON(ApiClient.getUrl('Sync/Jobs', options)).then(function (response) { + + renderList(listInstance, response.Items); + loading.hide(); + }); + } + + function syncJobList(options) { + this.options = options; + + var onSyncJobsUpdatedHandler = onSyncJobsUpdated.bind(this); + this.onSyncJobsUpdatedHandler = null; + events.on(serverNotifications, 'SyncJobs', onSyncJobsUpdatedHandler); + + fetchData(this); + } + + syncJobList.prototype.destroy = function () { + this.options = null; + + var onSyncJobsUpdatedHandler = this.onSyncJobsUpdatedHandler; + this.onSyncJobsUpdatedHandler = null; + events.off(serverNotifications, 'SyncJobs', onSyncJobsUpdatedHandler); + }; + + return syncJobList; +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/addpluginpage.js b/dashboard-ui/scripts/addpluginpage.js index 3a74cd3124..3bd2225e71 100644 --- a/dashboard-ui/scripts/addpluginpage.js +++ b/dashboard-ui/scripts/addpluginpage.js @@ -98,6 +98,99 @@ }); } + function renderPluginInfo(page, pkg, pluginSecurityInfo) { + + if (AppInfo.isNativeApp) { + return; + } + + require(['jQuery'], function ($) { + if (pkg.isPremium) { + $('.premiumPackage', page).show(); + + // Fill in registration info + var regStatus = ""; + if (pkg.isRegistered) { + + regStatus += "

"; + + regStatus += Globalize.translate('MessageFeatureIncludedWithSupporter'); + + } else { + + var expDateTime = new Date(pkg.expDate).getTime(); + var nowTime = new Date().getTime(); + + if (expDateTime <= nowTime) { + regStatus += "

"; + regStatus += Globalize.translate('MessageTrialExpired'); + } else if (expDateTime > new Date(1970, 1, 1).getTime()) { + + regStatus += "

"; + regStatus += Globalize.translate('MessageTrialWillExpireIn').replace('{0}', Math.round(expDateTime - nowTime) / (86400000)); + } + } + + regStatus += "

"; + $('#regStatus', page).html(regStatus); + + if (pluginSecurityInfo.IsMBSupporter) { + $('#regInfo', page).html(pkg.regInfo || ""); + + $('.premiumDescription', page).hide(); + $('.supporterDescription', page).hide(); + + if (pkg.price > 0) { + + $('.premiumHasPrice', page).show(); + $('#featureId', page).val(pkg.featureId); + $('#featureName', page).val(pkg.name); + $('#amount', page).val(pkg.price); + + $('#regPrice', page).html("

" + Globalize.translate('ValuePriceUSD').replace('{0}', "$" + pkg.price.toFixed(2)) + "

"); + $('#ppButton', page).hide(); + + var url = "https://mb3admin.com/admin/service/user/getPayPalEmail?id=" + pkg.owner; + + fetch(url).then(function (response) { + + return response.json(); + + }).then(function (dev) { + + if (dev.payPalEmail) { + $('#payPalEmail', page).val(dev.payPalEmail); + $('#ppButton', page).show(); + + } + }); + + } else { + // Supporter-only feature + $('.premiumHasPrice', page).hide(); + } + } else { + + if (pkg.price) { + $('.premiumDescription', page).show(); + $('.supporterDescription', page).hide(); + $('#regInfo', page).html(""); + + } else { + $('.premiumDescription', page).hide(); + $('.supporterDescription', page).show(); + $('#regInfo', page).html(""); + } + + $('#ppButton', page).hide(); + } + + } else { + $('.premiumPackage', page).hide(); + } + }); + } + function renderPackage(pkg, installedPlugins, pluginSecurityInfo, page) { var installedPlugin = installedPlugins.filter(function (ip) { @@ -133,7 +226,7 @@ $('#developer', page).html(pkg.owner); - RegistrationServices.renderPluginInfo(page, pkg, pluginSecurityInfo); + renderPluginInfo(page, pkg, pluginSecurityInfo); //Ratings and Reviews var ratingHtml = ''; diff --git a/dashboard-ui/scripts/mediacontroller.js b/dashboard-ui/scripts/mediacontroller.js index a7c9ef2745..c148c53e6a 100644 --- a/dashboard-ui/scripts/mediacontroller.js +++ b/dashboard-ui/scripts/mediacontroller.js @@ -462,11 +462,11 @@ return; } - requirejs(["registrationservices"], function () { + requirejs(["registrationservices"], function (registrationServices) { self.playbackTimeLimitMs = null; - RegistrationServices.validateFeature('playback').then(fn, function () { + registrationServices.validateFeature('playback').then(fn, function () { self.playbackTimeLimitMs = lockedTimeLimitMs; startAutoStopTimer(); diff --git a/dashboard-ui/scripts/registrationservices.js b/dashboard-ui/scripts/registrationservices.js index f1059f66e5..c4ebb5dab0 100644 --- a/dashboard-ui/scripts/registrationservices.js +++ b/dashboard-ui/scripts/registrationservices.js @@ -188,96 +188,7 @@ }); } - window.RegistrationServices = { - renderPluginInfo: function (page, pkg, pluginSecurityInfo) { - - require(['jQuery'], function ($) { - if (pkg.isPremium) { - $('.premiumPackage', page).show(); - - // Fill in registration info - var regStatus = ""; - if (pkg.isRegistered) { - - regStatus += "

"; - - regStatus += Globalize.translate('MessageFeatureIncludedWithSupporter'); - - } else { - - var expDateTime = new Date(pkg.expDate).getTime(); - var nowTime = new Date().getTime(); - - if (expDateTime <= nowTime) { - regStatus += "

"; - regStatus += Globalize.translate('MessageTrialExpired'); - } else if (expDateTime > new Date(1970, 1, 1).getTime()) { - - regStatus += "

"; - regStatus += Globalize.translate('MessageTrialWillExpireIn').replace('{0}', Math.round(expDateTime - nowTime) / (86400000)); - } - } - - regStatus += "

"; - $('#regStatus', page).html(regStatus); - - if (pluginSecurityInfo.IsMBSupporter) { - $('#regInfo', page).html(pkg.regInfo || ""); - - $('.premiumDescription', page).hide(); - $('.supporterDescription', page).hide(); - - if (pkg.price > 0) { - - $('.premiumHasPrice', page).show(); - $('#featureId', page).val(pkg.featureId); - $('#featureName', page).val(pkg.name); - $('#amount', page).val(pkg.price); - - $('#regPrice', page).html("

" + Globalize.translate('ValuePriceUSD').replace('{0}', "$" + pkg.price.toFixed(2)) + "

"); - $('#ppButton', page).hide(); - - var url = "https://mb3admin.com/admin/service/user/getPayPalEmail?id=" + pkg.owner; - - fetch(url).then(function (response) { - - return response.json(); - - }).then(function (dev) { - - if (dev.payPalEmail) { - $('#payPalEmail', page).val(dev.payPalEmail); - $('#ppButton', page).show(); - - } - }); - - } else { - // Supporter-only feature - $('.premiumHasPrice', page).hide(); - } - } else { - - if (pkg.price) { - $('.premiumDescription', page).show(); - $('.supporterDescription', page).hide(); - $('#regInfo', page).html(""); - - } else { - $('.premiumDescription', page).hide(); - $('.supporterDescription', page).show(); - $('#regInfo', page).html(""); - } - - $('#ppButton', page).hide(); - } - - } else { - $('.premiumPackage', page).hide(); - } - }); - }, - + return { validateFeature: function (name) { return new Promise(function (resolve, reject) { @@ -297,6 +208,4 @@ shell.openUrl('https://emby.media/premiere'); } }; - - return window.RegistrationServices; }); \ No newline at end of file diff --git a/dashboard-ui/scripts/syncactivity.js b/dashboard-ui/scripts/syncactivity.js index 8d1ea3e983..d081d6cf50 100644 --- a/dashboard-ui/scripts/syncactivity.js +++ b/dashboard-ui/scripts/syncactivity.js @@ -416,8 +416,8 @@ $('.btnSyncSupporter', page).on('click', function () { - requirejs(["registrationservices"], function () { - RegistrationServices.validateFeature('sync'); + requirejs(["registrationservices"], function (registrationServices) { + registrationServices.validateFeature('sync'); }); }); $('.supporterPromotion .mainText', page).html(Globalize.translate('HeaderSyncRequiresSupporterMembership'));