Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dave-lang/webmin-docker
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.4.1
Choose a base ref
...
head repository: dave-lang/webmin-docker
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.4.2
Choose a head ref
  • 2 commits
  • 7 files changed
  • 2 contributors

Commits on May 23, 2024

  1. Update issue templates

    dave-lang authored May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    77bb545 View commit details
  2. Show running status as icon, only appropriate actions

    dave-lang committed May 23, 2024
    Copy the full SHA
    5659f19 View commit details
Showing with 100 additions and 7 deletions.
  1. +32 −0 .github/ISSUE_TEMPLATE/bug_report.md
  2. +20 −0 .github/ISSUE_TEMPLATE/feature_request.md
  3. +6 −1 README.md
  4. +23 −0 docker/docker-lib.pl
  5. +18 −4 docker/index.cgi
  6. +1 −0 docker/lang/en
  7. +0 −2 tools/docker-compose.yml
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Versions (please complete the following information):**
- OS: [e.g. iOS]
- Webmin version
- Module Version [e.g. 0.4]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem?**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered or similar features elsewhere**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -16,11 +16,16 @@ Once installed a new option 'Docker Containers' will appear in the menu under 'S

Docker configuration has been setup to allow easier development.

This environment has webmin and docker already installed, along with a very basic Ubuntu 18 docker config ready to start in the container (Docker in Docker).
This environment has Webmin and Docker already installed, along with a very basic Ubuntu 18 docker config ready to start in the container (Docker in Docker).

The plugin is installed in the Webmin environment via shared folder, changes will appear immediately.

1. `cd tools`
2. `docker-compose up -d` to run docker compose as daemon
3. Open http://localhost:10000 to access the webmin console
4. Login is `root` + `password`, this can be adjusted in the Dockerfile

To burn and recreate the environment use `docker-compose down -v`

Use `docker exec -it webmin_master /bin/bash` to get a SSH console.

23 changes: 23 additions & 0 deletions docker/docker-lib.pl
Original file line number Diff line number Diff line change
@@ -166,4 +166,27 @@ sub circular_grid

# return ui_grid_table(\@stats, 1);
return $result;
}

sub starts_with
{
my ($str, $prefix) = @_;
return substr($str, 0, length($prefix)) eq $prefix;
}

sub get_container_up
{
my ($status) = @_;
return starts_with($status, "Up ");
}

sub get_status_icon
{
my ($status) = @_;

my ($up) = get_container_up($status);
my ($color) = $up ? 'green' : 'red';

return '<span style="font-weight: bold; font-size: 140%; color: ' . $color . '; float: left; padding-right: 10px">'
. ($up ? "&check;" : "&cross;") . '</span>';
}
22 changes: 18 additions & 4 deletions docker/index.cgi
Original file line number Diff line number Diff line change
@@ -39,16 +39,30 @@ if ($fail) {
print &ui_submit(text('label_refresh'));
print &ui_form_end(),"<br>\n";

print ui_columns_start([&text('label_name'), &text('label_label'), &text('label_runningfor'), &text('label_cpu'), &text('label_mem'), ' ' ]);
print '<style>.panel-body tr td { padding: 5px 22px 7px 22px !important} </style>';
print ui_columns_start([
&text('label_name'),
&text('label_label'),
&text('label_running'),
&text('label_runningfor'),
&text('label_cpu'),
&text('label_mem'),
' '
]);

foreach my $u (@containers) {
my ($status) = $u->{'status'};

print ui_columns_row([
html_escape($u->{'name'}),
html_escape($u->{'image'}),
html_escape($u->{'status'}),
get_status_icon($status),
html_escape($status),
html_escape($stats{$u->{'id'}}{'cpu'}),
html_escape($stats{$u->{'id'}}{'memUsage'}) . " (" . html_escape($stats{$u->{'id'}}{'mem'}) . ")",
sprintf("<a href='command.cgi?c=start&container=%s'>%s</a>", urlize($u->{'name'}), &text('label_start')),
sprintf("<a href='command.cgi?c=stop&container=%s'>%s</a>", urlize($u->{'name'}), &text('label_stop')),
get_container_up($status) ?
sprintf("<a href='command.cgi?c=stop&container=%s'>%s</a>", urlize($u->{'name'}), &text('label_stop'))
: sprintf("<a href='command.cgi?c=start&container=%s'>%s</a>", urlize($u->{'name'}), &text('label_start')),
sprintf("<a href='command.cgi?c=restart&container=%s'>%s</a>", urlize($u->{'name'}), &text('label_restart')),
&ui_link('container.cgi?tab=log&container=' . urlize($u->{'id'}), 'View log'),
&ui_link('container.cgi?tab=inspect&container=' . urlize($u->{'id'}), 'Inspect')
1 change: 1 addition & 0 deletions docker/lang/en
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ command_err=Command could not be run

label_name=Name
label_label=Label
label_running=Running
label_runningfor=Running for
label_cpu=CPU
label_mem=MEM
2 changes: 0 additions & 2 deletions tools/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ services:
build:
context: ./
volumes:
#- ../nut/:/etc/webmin/nut:rw
#- ../pihole:/etc/webmin/pihole:rw
- ../docker:/usr/share/webmin/docker:rw
- ./dind:/home/dind:rw
ports: