Merge pull request #965 from Squidly271/donate

Docker: Add donate link to context menus
This commit is contained in:
tom mortensen
2021-10-04 11:54:02 -07:00
committed by GitHub
4 changed files with 15 additions and 5 deletions
@@ -311,6 +311,7 @@ class DockerTemplates {
$tmp['registry'] = $tmp['registry'] ?? $this->getTemplateValue($image, 'Registry');
$tmp['Support'] = $tmp['Support'] ?? $this->getTemplateValue($image, 'Support');
$tmp['Project'] = $tmp['Project'] ?? $this->getTemplateValue($image, 'Project');
$tmp['DonateLink'] = $tmp['DonateLink'] ?? $this->getTemplateValue($image, 'DonateLink');
if (!$tmp['updated'] || $reload) {
if ($reload) $DockerUpdate->reloadUpdateStatus($image);
$tmp['updated'] = var_export($DockerUpdate->getUpdateStatus($image),true);
@@ -76,7 +76,8 @@ foreach ($containers as $ct) {
$support = html_entity_decode($info['Support']);
$project = html_entity_decode($info['Project']);
$registry = html_entity_decode($info['registry']);
$menu[] = sprintf("addDockerContainerContext('%s','%s','%s',%s,%s,%s,%s,'%s','%s','%s','%s','%s','%s');", addslashes($name), addslashes($ct['ImageId']), addslashes($template), $running, $paused, $updateStatus, $is_autostart, addslashes($webGui), $shell, $id, addslashes($support), addslashes($project),addslashes($registry));
$donateLink = html_entity_decode($info['DonateLink']);
$menu[] = sprintf("addDockerContainerContext('%s','%s','%s',%s,%s,%s,%s,'%s','%s','%s','%s','%s','%s', '%s');", addslashes($name), addslashes($ct['ImageId']), addslashes($template), $running, $paused, $updateStatus, $is_autostart, addslashes($webGui), $shell, $id, addslashes($support), addslashes($project),addslashes($registry),addslashes($donateLink));
$docker[] = "docker.push({name:'$name',id:'$id',state:$running,pause:$paused,update:$updateStatus});";
$shape = $running ? ($paused ? 'pause' : 'play') : 'square';
$status = $running ? ($paused ? 'paused' : 'started') : 'stopped';
@@ -1,6 +1,6 @@
var eventURL = '/plugins/dynamix.docker.manager/include/Events.php';
function addDockerContainerContext(container, image, template, started, paused, update, autostart, webui, shell, id, Support, Project, Registry) {
function addDockerContainerContext(container, image, template, started, paused, update, autostart, webui, shell, id, Support, Project, Registry, donateLink) {
var opts = [];
if (started && !paused) {
if (webui !== '' && webui != '#') opts.push({text:_('WebUI'), icon:'fa-globe', href:webui, target:'_blank'});
@@ -29,16 +29,23 @@ function addDockerContainerContext(container, image, template, started, paused,
}
opts.push({divider:true});
opts.push({text:_('Remove'), icon:'fa-trash', action:function(e){e.preventDefault(); rmContainer(container, image, id);}});
if (Support) {
if ( Support || Project ) {
opts.push({divider:true});
opts.push({text:_('Support'), icon:'fa-question', href:Support, target:'_blank'});
}
if (Project) {
opts.push({text:_('Project Page'), icon:'fa-life-ring', href:Project, target:'_blank'});
}
if (Support) {
opts.push({text:_('Support'), icon:'fa-question', href:Support, target:'_blank'});
}
if (Registry) {
opts.push({text:_('More Info'),icon:'fa-info-circle', href:Registry, target:'_blank'});
}
if (donateLink) {
opts.push({divider:true});
opts.push({text:_('Donate'),icon:'fa-external-link', href:donateLink,target:'_blank'});
}
context.attach('#'+id, opts);
}
function addDockerImageContext(image, imageTag) {
+2 -1
View File
@@ -50,7 +50,8 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$support = html_entity_decode($info['Support']);
$project = html_entity_decode($info['Project']);
$registry = html_entity_decode($info['registry']);
$menu[] = sprintf("addDockerContainerContext('%s','%s','%s',%s,%s,%s,%s,'%s','%s','%s','%s','%s','%s');", addslashes($name), addslashes($ct['ImageId']), addslashes($template), $running, $paused, $updateStatus, $is_autostart, addslashes($webGui), $shell, $id, addslashes($support), addslashes($project), addslashes($registry));
$donateLink = html_entity_decode($info['DonateLink']);
$menu[] = sprintf("addDockerContainerContext('%s','%s','%s',%s,%s,%s,%s,'%s','%s','%s','%s','%s','%s', '%s');", addslashes($name), addslashes($ct['ImageId']), addslashes($template), $running, $paused, $updateStatus, $is_autostart, addslashes($webGui), $shell, $id, addslashes($support), addslashes($project), addslashes($registry), addslashes($donateLink));
$shape = $running ? ($paused ? 'pause' : 'play') : 'square';
$status = $running ? ($paused ? 'paused' : 'started') : 'stopped';
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');