Skip to content

Commit

Permalink
Merge pull request heckenmann#462 from heckenmann/feature/some-things
Browse files Browse the repository at this point in the history
Feature/some things
  • Loading branch information
heckenmann authored May 12, 2024
2 parents f4845fc + 5df4d85 commit bb7e63a
Show file tree
Hide file tree
Showing 15 changed files with 220 additions and 107 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ Feedback would be nice.
- [Getting started](#getting-started)
- [Development](#development)

----
![whales](screenshots/whales.jpg)


## Tools
Special thanks to JetBrains for supporting this project with <a href="https://www.jetbrains.com/community/opensource/#support" target="_blank">Open Source development licenses</a>.

<a href="https://www.jetbrains.com/" target="_blank"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_square.svg" height="80px" alt="JetBrains Black Box Logo logo." /></a>
<a href="https://www.jetbrains.com/go/" target="_blank"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/GoLand_icon.svg" height="80px" alt="GoLand logo." /></a>
<a href="https://www.jetbrains.com/webstorm/" target="_blank"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/WebStorm_icon.svg" height="80px" alt="WebStorm logo." /></a>

----

## Frameworks & Libraries
- [ApexCharts](https://apexcharts.com/)
- [Bootstrap](https://getbootstrap.com/)
Expand All @@ -37,7 +39,7 @@ Special thanks to JetBrains for supporting this project with <a href="https://ww
- [Jotai](https://jotai.org/)
- [React](https://reactjs.org/)

----

## Screenshots

![Horizontal Dashboard](screenshots/dashboard_h.jpeg)
Expand All @@ -50,7 +52,7 @@ Special thanks to JetBrains for supporting this project with <a href="https://ww
![Logs Form](screenshots/logs.jpeg)
![Logs](screenshots/logs-f.jpeg)

----

## Getting started
### Tags
|Tag|Description|Image|
Expand All @@ -62,6 +64,7 @@ Special thanks to JetBrains for supporting this project with <a href="https://ww
### Configuration
Docker Swarm Dashboard supports environment variables for configuration

* `DSD_HTTP_PORT`: HTTP port within the container. Usually does not need to be changed. Default is 8080.
* `DSD_HANDLE_LOGS`: Set to `false` to prevent fetching and displaying logs.
* `DSD_DASHBOARD_LAYOUT`: Default dashboard layout. Either `row` (default) or `column`.
* `DSD_HIDE_SERVICE_STATES`: Comma-separated list of states to not show in the main dashboard.
Expand All @@ -72,7 +75,7 @@ Docker Swarm Dashboard supports environment variables for configuration
```
docker pull ghcr.io/heckenmann/docker-swarm-dashboard:master
```
----

### docker-compose.yml
```
---
Expand All @@ -93,7 +96,7 @@ services:
environment:
DOCKER_API_VERSION: 1.35
```
----

### docker-compose.yml with traefik and basic auth
This configuration sets a password for access. It is importand to configure ssl in traefik for better security.

Expand Down Expand Up @@ -144,14 +147,14 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
```

----

### Deploy on docker-swarm
From the directory with docker-compose.yml run:
```
docker stack deploy --compose-file docker-compose.yml docker-swarm-dashboard
```

----

### logs-generator (for testing)
```
docker service create --name logger chentex/random-logger:latest 50 200
Expand Down
7 changes: 5 additions & 2 deletions app-src/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const { defineConfig } = require("cypress");
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:3000',
viewportWidth: 1920,
viewportHeight: 1080,
},
});
})
10 changes: 10 additions & 0 deletions app-src/cypress/e2e/about.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('About Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'About').click()
cy.document().its('body').should('contain', 'Docker Swarm Dashboard')
})
})
})
57 changes: 57 additions & 0 deletions app-src/cypress/e2e/dashboardh.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Dashboard horizontal Tests', () => {
it('Dashboard horizontal', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager1').click()
cy.contains('button', 'JSON')

cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager2').click()
cy.contains('button', 'JSON')

cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager3').click()
cy.contains('button', 'JSON')

cy.contains('a', 'Dashboard').click()
cy.contains('div', 'dsd_docker-swarm-dashboard').click()
cy.contains('button', 'JSON')
cy.contains('button', 'Table')
})
})

it('Filter by service name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('th > div', 'dsd_docker-swarm-dashboard')
cy.contains('th > div', 'logger')
cy.get('input[placeholder="Filter services by service name"]').type('dsd')
cy.contains('th > div', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]')
.clear()
.type('logger')
cy.contains('th > div', 'logger')
cy.contains('th > div', 'dsd_docker-swarm-dashboard').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]').clear()
})
})

it('Filter by stack name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('th > div', 'dsd_docker-swarm-dashboard')
cy.contains('th > div', 'logger')
cy.contains('select', 'Service').select('Stack')
cy.get('input[placeholder="Filter services by stack name"]').type('dsd')
cy.contains('th > div', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by stack name"]')
.clear()
.type('logger')
cy.contains('th > div', 'logger').should('not.exist')
cy.contains('th > div', 'dsd_docker-swarm-dashboard').should('not.exist')
cy.get('input[placeholder="Filter services by stack name"]').clear()
})
})
})
48 changes: 48 additions & 0 deletions app-src/cypress/e2e/dashboardv.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Dashboard vertical Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard').click()
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('th', 'manager1').click()
})
})

it('Filter by service name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard')
cy.contains('td', 'logger')
cy.get('input[placeholder="Filter services by service name"]').type('dsd')
cy.contains('th > div', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]')
.clear()
.type('logger')
cy.contains('td', 'logger')
cy.contains('td', 'dsd_docker-swarm-dashboard').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]').clear()
})
})

it('Filter by stack name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard')
cy.contains('td', 'logger')
cy.contains('select', 'Service').select('Stack')
cy.get('input[placeholder="Filter services by stack name"]').type('dsd')
cy.contains('td', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by stack name"]')
.clear()
.type('logger')
cy.contains('td', 'logger').should('not.exist')
cy.contains('td', 'dsd_docker-swarm-dashboard').should('not.exist')
})
})
})
18 changes: 18 additions & 0 deletions app-src/cypress/e2e/nodes.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Nodes Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager2').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager3').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker2').click()
})
})
})
11 changes: 11 additions & 0 deletions app-src/cypress/e2e/ports.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Ports Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Ports').click()
cy.contains('td', '8080')
cy.contains('td', 'dsd_docker-swarm-dashboard')
})
})
})
11 changes: 11 additions & 0 deletions app-src/cypress/e2e/settings.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Settings Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Settings').click()
cy.get('input:eq(1)').click()
cy.get('input:eq(2)').click()
})
})
})
96 changes: 3 additions & 93 deletions app-src/cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -1,97 +1,7 @@
describe('UI Tests', () => {
it('Timeline', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Timeline').click()
})
})

it('Stacks', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Stacks').click()
cy.contains('td', 'docker-swarm-dashboard')
cy.contains('h5', 'dsd').click()
})
})

it('Nodes', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager2').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager3').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker2').click()
})
})

it('Tasks', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Tasks').click()
})
})

it('Ports', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Ports').click()
cy.contains('td', '8080')
cy.contains('td', 'dsd_docker-swarm-dashboard')
})
})

it('About', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'About').click()
cy.document().its('body').should('contain', 'Docker Swarm Dashboard')
})
})

it('Settings', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Settings').click()
cy.get('input:eq(1)').click()
cy.get('input:eq(2)').click()
})
})

it('Dashboard horizontal', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager1').click()
cy.contains('button', 'JSON').click()
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager2').click()
cy.contains('button', 'JSON').click()
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager3').click()
cy.contains('button', 'JSON').click()
cy.contains('a', 'Dashboard').click()
cy.contains('div', 'dsd_docker-swarm-dashboard').click()
cy.contains('button', 'JSON').click()
cy.contains('button', 'Table').click()
})
})

it('Dashboard vertical', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard').click()
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('th', 'manager1').click()
})
})
})
describe('UI Tests', () => {})

function visitBaseUrlAndTest(fn) {
const baseUrl =
'http://localhost:3000#base="http%3A%2F%2Flocalhost%3A3001%2F"'
cy.viewport(1920, 1080)
cy.visit(baseUrl)
export function visitBaseUrlAndTest(fn) {
cy.visit('#base="http%3A%2F%2Flocalhost%3A3001%2F"')

fn()

Expand Down
11 changes: 11 additions & 0 deletions app-src/cypress/e2e/stacks.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Stacks Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Stacks').click()
cy.contains('td', 'docker-swarm-dashboard')
cy.contains('h5', 'dsd').click()
})
})
})
9 changes: 9 additions & 0 deletions app-src/cypress/e2e/tasks.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Tasks Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Tasks').click()
})
})
})
9 changes: 9 additions & 0 deletions app-src/cypress/e2e/timeline.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Timeline Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Timeline').click()
})
})
})
Loading

0 comments on commit bb7e63a

Please sign in to comment.