Skip to content

Commit

Permalink
Fix container view (mobile layout) (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartinou authored Oct 5, 2024
1 parent a4d5f01 commit d5fc051
Show file tree
Hide file tree
Showing 10 changed files with 412 additions and 1,284 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ script:

# Pull vaultwarden
- docker pull vaultwarden/server
- docker pull vaultwarden/server:1.32.0-alpine
- docker pull vaultwarden/server:1.32.1-alpine

# Pull youtubedl
- docker pull jeeaaasustest/youtube-dl
Expand Down Expand Up @@ -141,7 +141,7 @@ script:
- docker run -d --name hub_traefik_245 --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+.\d+$' traefik:2.4.5
- docker run -d --name hub_traefik_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' traefik

- docker run -d --name hub_vaultwarden_1222 --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+.\d+-alpine$' -e I_REALLY_WANT_VOLATILE_STORAGE=true vaultwarden/server:1.32.0-alpine
- docker run -d --name hub_vaultwarden_1222 --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+.\d+-alpine$' -e I_REALLY_WANT_VOLATILE_STORAGE=true vaultwarden/server:1.32.1-alpine
- docker run -d --name hub_vaultwarden_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' -e I_REALLY_WANT_VOLATILE_STORAGE=true vaultwarden/server

- docker run -d --name hub_youtubedb_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' jeeaaasustest/youtube-dl
Expand Down
1,573 changes: 344 additions & 1,229 deletions app/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
"eslint-plugin-import": "2.30.0",
"eslint-plugin-jest": "28.8.3",
"jest": "29.7.0",
"nodemon": "3.1.4"
"nodemon": "3.1.5"
}
}
9 changes: 7 additions & 2 deletions app/store/container.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Container store.
*/
const { byString, byValue } = require('sort-es');
const { byString, byValues } = require('sort-es');
const log = require('../log').child({ component: 'store' });
const { validate: validateContainer } = require('../model/container');
const {
Expand Down Expand Up @@ -72,7 +72,12 @@ function getContainers(query = {}) {
}
const containerList = containers.find(filter).map((item) => validateContainer(item.data));
return containerList.sort(
byValue((container) => container.name, byString()),
byValues([
[(container) => container.watcher, byString()],
[(container) => container.image.registry.name, byString()],
[(container) => container.name, byString()],
[(container) => container.image.tag.value, byString()],
]),
);
}

Expand Down
8 changes: 4 additions & 4 deletions app/watchers/providers/docker/Docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ function getTagCandidates(container, tags, logContainer) {
filteredTags = filteredTags.filter((tag) => !excludeTagsRegex.test(tag));
}

if (filteredTags.length === 0) {
logContainer.warn('No tags found after filtering check you regex filters');
}

// Semver image -> find higher semver tag
if (container.image.tag.semver) {
if (filteredTags.length === 0) {
logContainer.warn('No tags found after filtering; check you regex filters');
}

// Keep semver only
filteredTags = filteredTags
.filter((tag) => parseSemver(transformTag(container.transformTags, tag)) !== null);
Expand Down
6 changes: 3 additions & 3 deletions app/watchers/providers/docker/Docker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const getTagCandidatesTestCases = [{
test.each(getTagCandidatesTestCases)(
'getTagCandidates should behave as expected',
(item) => {
expect(Docker.__get__('getTagCandidates')(item.source, item.items)).toEqual(item.candidates);
expect(Docker.__get__('getTagCandidates')(item.source, item.items, docker.log)).toEqual(item.candidates);
},
);

Expand Down Expand Up @@ -346,7 +346,7 @@ test('normalizeContainer should return original container when no matching provi
test('findNewVersion should return new image version when found', async () => {
hub.getTags = () => (['7.8.9']);
hub.getImageManifestDigest = () => ({ digest: 'sha256:abcdef', version: 2 });
await expect(docker.findNewVersion(sampleSemver)).resolves.toMatchObject({
await expect(docker.findNewVersion(sampleSemver, docker.log)).resolves.toMatchObject({
tag: '7.8.9',
digest: 'sha256:abcdef',
});
Expand All @@ -355,7 +355,7 @@ test('findNewVersion should return new image version when found', async () => {
test('findNewVersion should return same result as current when no image version found', async () => {
hub.getTags = () => ([]);
hub.getImageManifestDigest = () => ({ digest: 'sha256:abcdef', version: 2 });
await expect(docker.findNewVersion(sampleSemver)).resolves.toMatchObject({
await expect(docker.findNewVersion(sampleSemver, docker.log)).resolves.toMatchObject({
tag: '4.5.6',
digest: 'sha256:abcdef',
});
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 6.6.1
- :fire: [UI] - Fix container view (mobile layout)
- :fire: [API/UI] - Sort by default containers by watcher, registry, name and version

# 6.6.0
- :star: [UI] - Make watcher and registry names visible when container box is collapsed
- :fire: Fix edge case where comparing different tags with identical digests (e.g. `mongo:8` = `mongo:8.0.0`)
Expand Down
46 changes: 23 additions & 23 deletions e2e/features/api-container.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ Feature: WUD Container API Exposure
And response body path $[<index>].result.tag should be <resultTag>
And response body path $[<index>].updateAvailable should be <updateAvailable>
Examples:
| index | containerName | registry | registryUrl | imageName | tag | resultTag | updateAvailable |
| 0 | ecr_sub_sub_test | ecr | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/sub/test | 1.0.0 | 2.0.0 | true |
| 1 | ecr_sub_test | ecr | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/test | 1.0.0 | 2.0.0 | true |
| 2 | ecr_test | ecr | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | test | 1.0.0 | 2.0.0 | true |
| 3 | ghcr_radarr | ghcr | https://ghcr.io/v2 | linuxserver/radarr | 3.2.1.5070-ls105 | 5.11.0.9244-ls241 | true |
| 4 | gitlab_test | gitlab | https://registry.gitlab.com/v2 | manfred-martin/docker-registry-test | 1.0.0 | 2.0.0 | true |
| 5 | hub_homeassistant_202161 | hub | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 | 2024.9.3 | true |
| 6 | hub_homeassistant_latest | hub | https://registry-1.docker.io/v2 | homeassistant/home-assistant | latest | latest | false |
| 7 | hub_nginx_120 | hub | https://registry-1.docker.io/v2 | library/nginx | 1.20-alpine | 1.27-alpine | true |
| 8 | hub_nginx_latest | hub | https://registry-1.docker.io/v2 | library/nginx | latest | latest | true |
| 9 | hub_omnidb_latest | hub | https://registry-1.docker.io/v2 | omnidbteam/omnidb | latest | latest | false |
| 10 | hub_pihole_57 | hub | https://registry-1.docker.io/v2 | pihole/pihole | v5.7 | v5.8.1 | true |
| 11 | hub_pihole_latest | hub | https://registry-1.docker.io/v2 | pihole/pihole | latest | latest | false |
| 12 | hub_pyload_latest | hub | https://registry-1.docker.io/v2 | writl/pyload | latest | latest | false |
| 13 | hub_traefik_245 | hub | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.1.4 | true |
| 14 | hub_traefik_latest | hub | https://registry-1.docker.io/v2 | library/traefik | latest | latest | false |
| 15 | hub_vaultwarden_1222 | hub | https://registry-1.docker.io/v2 | vaultwarden/server | 1.32.0-alpine | 1.32.0-alpine | false |
| 16 | hub_vaultwarden_latest | hub | https://registry-1.docker.io/v2 | vaultwarden/server | latest | latest | false |
| 17 | hub_youtubedb_latest | hub | https://registry-1.docker.io/v2 | jeeaaasustest/youtube-dl | latest | latest | false |
| 18 | lscr_radarr | lscr | https://lscr.io/v2 | linuxserver/radarr | 3.2.1.5070-ls105 | 5.11.0.9244-ls241 | true |
| 19 | quay_prometheus | quay | https://quay.io/v2 | prometheus/prometheus | v2.52.0 | v2.54.1 | true |
| index | registry | containerName | registryUrl | imageName | tag | resultTag | updateAvailable |
| 0 | ecr | ecr_sub_sub_test | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/sub/test | 1.0.0 | 2.0.0 | true |
| 1 | ecr | ecr_sub_test | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/test | 1.0.0 | 2.0.0 | true |
| 2 | ecr | ecr_test | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | test | 1.0.0 | 2.0.0 | true |
| 3 | ghcr | ghcr_radarr | https://ghcr.io/v2 | linuxserver/radarr | 3.2.1.5070-ls105 | 5.11.0.9244-ls241 | true |
| 4 | gitlab | gitlab_test | https://registry.gitlab.com/v2 | manfred-martin/docker-registry-test | 1.0.0 | 2.0.0 | true |
| 5 | hub | hub_homeassistant_202161 | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 | 2024.10.1 | true |
| 6 | hub | hub_homeassistant_latest | https://registry-1.docker.io/v2 | homeassistant/home-assistant | latest | latest | false |
| 7 | hub | hub_nginx_120 | https://registry-1.docker.io/v2 | library/nginx | 1.20-alpine | 1.27-alpine | true |
| 8 | hub | hub_nginx_latest | https://registry-1.docker.io/v2 | library/nginx | latest | latest | true |
| 9 | hub | hub_omnidb_latest | https://registry-1.docker.io/v2 | omnidbteam/omnidb | latest | latest | false |
| 10 | hub | hub_pihole_57 | https://registry-1.docker.io/v2 | pihole/pihole | v5.7 | v5.8.1 | true |
| 11 | hub | hub_pihole_latest | https://registry-1.docker.io/v2 | pihole/pihole | latest | latest | false |
| 12 | hub | hub_pyload_latest | https://registry-1.docker.io/v2 | writl/pyload | latest | latest | false |
| 13 | hub | hub_traefik_245 | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.1.5 | true |
| 14 | hub | hub_traefik_latest | https://registry-1.docker.io/v2 | library/traefik | latest | latest | false |
| 15 | hub | hub_vaultwarden_1222 | https://registry-1.docker.io/v2 | vaultwarden/server | 1.32.1-alpine | 1.32.1-alpine | false |
| 16 | hub | hub_vaultwarden_latest | https://registry-1.docker.io/v2 | vaultwarden/server | latest | latest | false |
| 17 | hub | hub_youtubedb_latest | https://registry-1.docker.io/v2 | jeeaaasustest/youtube-dl | latest | latest | false |
| 18 | lscr | lscr_radarr | https://lscr.io/v2 | linuxserver/radarr | 3.2.1.5070-ls105 | 5.11.0.9244-ls241 | true |
| 19 | quay | quay_prometheus | https://quay.io/v2 | prometheus/prometheus | v2.52.0 | v2.54.1 | true |

Scenario: WUD must allow to get a container with semver
Given I GET /api/containers
Expand Down Expand Up @@ -75,7 +75,7 @@ Feature: WUD Container API Exposure
And response body path $.image.tag.semver should be false
And response body path $.image.digest.value should be sha256:f94d6dd9b5761f33a21bb92848a1f70ea11a1c15f3a142c19a44ea3a4c545a4d
And response body path $.result.tag should be latest
And response body path $.result.digest should be sha256:10b61fc3d8262c8bf44c89aef3d81202ce12b8cba12fff2e32ca5978a2d88c2b
And response body path $.result.digest should be sha256:396c6e925f28fbbed95a475d27c18886289c2bbc53231534dc86c163558b5e4b
And response body path $.updateAvailable should be true

Scenario: WUD must allow to get a container with its link
Expand All @@ -85,7 +85,7 @@ Feature: WUD Container API Exposure
Then response code should be 200
And response body should be valid json
And response body path $.link should be https://github.com/home-assistant/core/releases/tag/2021.6.1
And response body path $.result.link should be https://github.com/home-assistant/core/releases/tag/2024.9.3
And response body path $.result.link should be https://github.com/home-assistant/core/releases/tag/2024.10.1

Scenario: WUD must allow to trigger a watch on a container
Given I GET /api/containers
Expand Down
6 changes: 3 additions & 3 deletions e2e/features/prometheus.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ Feature: Prometheus exposure
| ecr_test | ecr | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | test | 1.0.0 | 2.0.0 | true |
| ghcr_radarr | ghcr | https://ghcr.io/v2 | linuxserver/radarr | 3.2.1.5070-ls105 |5.11.0.9244-ls241 | true |
| gitlab_test | gitlab | https://registry.gitlab.com/v2 | manfred-martin/docker-registry-test | 1.0.0 | 2.0.0 | true |
| hub_homeassistant_202161 | hub | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 | 2024.9.3 | true |
| hub_homeassistant_202161 | hub | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 | 2024.10.1 | true |
| hub_homeassistant_latest | hub | https://registry-1.docker.io/v2 | homeassistant/home-assistant | latest | latest | false |
| hub_nginx_120 | hub | https://registry-1.docker.io/v2 | library/nginx | 1.20-alpine | 1.27-alpine | true |
| hub_nginx_latest | hub | https://registry-1.docker.io/v2 | library/nginx | latest | latest | true |
| hub_omnidb_latest | hub | https://registry-1.docker.io/v2 | omnidbteam/omnidb | latest | latest | false |
| hub_pihole_57 | hub | https://registry-1.docker.io/v2 | pihole/pihole | v5.7 | v5.8.1 | true |
| hub_pihole_latest | hub | https://registry-1.docker.io/v2 | pihole/pihole | latest | latest | false |
| hub_pyload_latest | hub | https://registry-1.docker.io/v2 | writl/pyload | latest | latest | false |
| hub_traefik_245 | hub | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.1.4 | true |
| hub_traefik_245 | hub | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.1.5 | true |
| hub_traefik_latest | hub | https://registry-1.docker.io/v2 | library/traefik | latest | latest | false |
| hub_vaultwarden_1222 | hub | https://registry-1.docker.io/v2 | vaultwarden/server | 1.32.0-alpine | 1.32.0-alpine | false |
| hub_vaultwarden_1222 | hub | https://registry-1.docker.io/v2 | vaultwarden/server | 1.32.1-alpine | 1.32.1-alpine | false |
| hub_vaultwarden_latest | hub | https://registry-1.docker.io/v2 | vaultwarden/server | latest | latest | false |
| hub_youtubedb_latest | hub | https://registry-1.docker.io/v2 | jeeaaasustest/youtube-dl | latest | latest | false |
| lscr_radarr | lscr | https://lscr.io/v2 | linuxserver/radarr | 3.2.1.5070-ls105 |5.11.0.9244-ls241 | true |
Expand Down
Loading

0 comments on commit d5fc051

Please sign in to comment.