mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #2225 from BaronGreenback/NewPluginController
This commit is contained in:
commit
9f175ee483
2 changed files with 53 additions and 7 deletions
|
@ -7,7 +7,7 @@ import '../../../../elements/emby-button/emby-button';
|
||||||
import Dashboard, { pageIdOn } from '../../../../scripts/clientUtils';
|
import Dashboard, { pageIdOn } from '../../../../scripts/clientUtils';
|
||||||
import confirm from '../../../../components/confirm/confirm';
|
import confirm from '../../../../components/confirm/confirm';
|
||||||
|
|
||||||
function deletePlugin(page, uniqueid, name) {
|
function deletePlugin(page, uniqueid, version, name) {
|
||||||
const msg = globalize.translate('UninstallPluginConfirmation', name);
|
const msg = globalize.translate('UninstallPluginConfirmation', name);
|
||||||
|
|
||||||
confirm({
|
confirm({
|
||||||
|
@ -17,12 +17,26 @@ function deletePlugin(page, uniqueid, name) {
|
||||||
confirmText: globalize.translate('HeaderUninstallPlugin')
|
confirmText: globalize.translate('HeaderUninstallPlugin')
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.uninstallPlugin(uniqueid).then(function () {
|
ApiClient.uninstallPluginByVersion(uniqueid, version).then(function () {
|
||||||
reloadList(page);
|
reloadList(page);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function enablePlugin(page, uniqueid, version) {
|
||||||
|
loading.show();
|
||||||
|
ApiClient.enablePlugin(uniqueid, version).then(function () {
|
||||||
|
reloadList(page);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function disablePlugin(page, uniqueid, version) {
|
||||||
|
loading.show();
|
||||||
|
ApiClient.disablePlugin(uniqueid, version).then(function () {
|
||||||
|
reloadList(page);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function showNoConfigurationMessage() {
|
function showNoConfigurationMessage() {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: globalize.translate('MessageNoPluginConfiguration')
|
message: globalize.translate('MessageNoPluginConfiguration')
|
||||||
|
@ -41,12 +55,18 @@ function getPluginCardHtml(plugin, pluginConfigurationPages) {
|
||||||
})[0];
|
})[0];
|
||||||
const configPageUrl = configPage ? Dashboard.getPluginUrl(configPage.Name) : null;
|
const configPageUrl = configPage ? Dashboard.getPluginUrl(configPage.Name) : null;
|
||||||
let html = '';
|
let html = '';
|
||||||
html += "<div data-id='" + plugin.Id + "' data-name='" + plugin.Name + "' data-removable='" + plugin.CanUninstall + "' class='card backdropCard'>";
|
html += `<div data-id='${plugin.Id}' data-version='${plugin.Version}' data-name='${plugin.Name}' data-removable='${plugin.CanUninstall}' data-status='${plugin.Status}' class='card backdropCard'>`;
|
||||||
html += '<div class="cardBox visualCardBox">';
|
html += '<div class="cardBox visualCardBox">';
|
||||||
html += '<div class="cardScalable">';
|
html += '<div class="cardScalable">';
|
||||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||||
html += configPageUrl ? '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + configPageUrl + '">' : '<div class="cardContent noConfigPluginCard noHoverEffect cardImageContainer emby-button">';
|
html += configPageUrl ? `<a class="cardContent cardImageContainer" is="emby-linkbutton" href="${configPageUrl}">` : '<div class="cardContent noConfigPluginCard noHoverEffect cardImageContainer emby-button">';
|
||||||
html += '<span class="cardImageIcon material-icons folder"></span>';
|
html += '<span class="cardImageIcon';
|
||||||
|
if (plugin.HasImage) {
|
||||||
|
html += `"><img src="/Plugins/${plugin.Id}/${plugin.Version}/Image" style="width:100%;height:auto"/>`;
|
||||||
|
} else {
|
||||||
|
html += ' material-icons folder">';
|
||||||
|
}
|
||||||
|
html += '</span> ';
|
||||||
html += configPageUrl ? '</a>' : '</div>';
|
html += configPageUrl ? '</a>' : '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '<div class="cardFooter">';
|
html += '<div class="cardFooter">';
|
||||||
|
@ -59,7 +79,7 @@ function getPluginCardHtml(plugin, pluginConfigurationPages) {
|
||||||
|
|
||||||
html += "<div class='cardText'>";
|
html += "<div class='cardText'>";
|
||||||
html += configPage && configPage.DisplayName ? configPage.DisplayName : plugin.Name;
|
html += configPage && configPage.DisplayName ? configPage.DisplayName : plugin.Name;
|
||||||
html += '</div>';
|
html += `<br/>${globalize.translate('LabelStatus')} ${plugin.Status}</div>`;
|
||||||
html += "<div class='cardText cardText-secondary'>";
|
html += "<div class='cardText cardText-secondary'>";
|
||||||
html += plugin.Version;
|
html += plugin.Version;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
@ -114,6 +134,8 @@ function showPluginMenu(page, elem) {
|
||||||
const name = card.getAttribute('data-name');
|
const name = card.getAttribute('data-name');
|
||||||
const removable = card.getAttribute('data-removable');
|
const removable = card.getAttribute('data-removable');
|
||||||
const configHref = card.querySelector('.cardContent').getAttribute('href');
|
const configHref = card.querySelector('.cardContent').getAttribute('href');
|
||||||
|
const status = card.getAttribute('data-status');
|
||||||
|
const version = card.getAttribute('data-version');
|
||||||
const menuItems = [];
|
const menuItems = [];
|
||||||
|
|
||||||
if (configHref) {
|
if (configHref) {
|
||||||
|
@ -125,6 +147,22 @@ function showPluginMenu(page, elem) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removable === 'true') {
|
if (removable === 'true') {
|
||||||
|
if (status === 'Disabled') {
|
||||||
|
menuItems.push({
|
||||||
|
name: globalize.translate('EnablePlugin'),
|
||||||
|
id: 'enable',
|
||||||
|
icon: 'mode_enable'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status === 'Active') {
|
||||||
|
menuItems.push({
|
||||||
|
name: globalize.translate('DisablePlugin'),
|
||||||
|
id: 'disable',
|
||||||
|
icon: 'mode_disable'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
name: globalize.translate('ButtonUninstall'),
|
name: globalize.translate('ButtonUninstall'),
|
||||||
id: 'delete',
|
id: 'delete',
|
||||||
|
@ -142,7 +180,13 @@ function showPluginMenu(page, elem) {
|
||||||
Dashboard.navigate(configHref);
|
Dashboard.navigate(configHref);
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
deletePlugin(page, id, name);
|
deletePlugin(page, id, version, name);
|
||||||
|
break;
|
||||||
|
case 'enable':
|
||||||
|
enablePlugin(page, id, version);
|
||||||
|
break;
|
||||||
|
case 'disable':
|
||||||
|
disablePlugin(page, id, version);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1457,6 +1457,8 @@
|
||||||
"LabelEnableIP4Help": "Enables IPv4 functionality.",
|
"LabelEnableIP4Help": "Enables IPv4 functionality.",
|
||||||
"LabelEnableIP4": "Enable IPv4:",
|
"LabelEnableIP4": "Enable IPv4:",
|
||||||
"HeaderNetworking": "IP Protocols",
|
"HeaderNetworking": "IP Protocols",
|
||||||
|
"EnablePlugin": "Enable Plugin",
|
||||||
|
"DisablePlugin": "Disable Plugin",
|
||||||
"YoutubeDenied": "Requested video is not allowed to be played in embedded players.",
|
"YoutubeDenied": "Requested video is not allowed to be played in embedded players.",
|
||||||
"YoutubeNotFound": "Video not found.",
|
"YoutubeNotFound": "Video not found.",
|
||||||
"YoutubePlaybackError": "Requested video cannot be played.",
|
"YoutubePlaybackError": "Requested video cannot be played.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue