diff --git a/usr/lib/dooke/dooke.py b/usr/lib/dooke/dooke.py index 44a76e7..7fe3a57 100755 --- a/usr/lib/dooke/dooke.py +++ b/usr/lib/dooke/dooke.py @@ -61,11 +61,20 @@ class Application(Gtk.Application): case 'images': output = client.images() + case 'services': + output = client.services() + + case 'volumns': + output = client.volumns() + + case 'networks': + output = client.networks() + case 'rm': - client.rm(params.get('id')) + _error = client.rm(params.get('id')) case 'rmi': - client.rmi(params.get('id')) + _error = client.rmi(params.get('id')) diff --git a/usr/lib/dooke/webapp/utils/index.js b/usr/lib/dooke/webapp/utils/index.js index 9725cbf..425c701 100644 --- a/usr/lib/dooke/webapp/utils/index.js +++ b/usr/lib/dooke/webapp/utils/index.js @@ -8,18 +8,32 @@ import { nextTick } from 'wkit' export function noop() {} -export function getContainers(all = true) { - return native.handler('docker', { action: 'containers', all }) -} +export const docker = { + containers(all = true) { + return native.handler('docker', { action: 'containers', all }) + }, -export function getImages() { - return native.handler('docker', { action: 'images' }) -} + images() { + return native.handler('docker', { action: 'images' }) + }, -export function removeContainer(id) { - return native.handler('docker', { action: 'rm', id }) -} + volumns() { + return native.handler('docker', { action: 'volumns' }) + }, -export function removeImage(id) { - return native.handler('docker', { action: 'rmi', id }) + networks() { + return native.handler('docker', { action: 'networks' }) + }, + + services() { + return native.handler('docker', { action: 'services' }) + }, + + rm(id) { + return native.handler('docker', { action: 'rm', id }) + }, + + rmi(id) { + return native.handler('docker', { action: 'rmi', id }) + } } diff --git a/usr/lib/dooke/webapp/views/home.js b/usr/lib/dooke/webapp/views/home.js index 51caf6b..3d7b4a1 100644 --- a/usr/lib/dooke/webapp/views/home.js +++ b/usr/lib/dooke/webapp/views/home.js @@ -5,7 +5,7 @@ */ import { html, css, Component, classMap, nextTick, outsideClick } from 'wkit' -import { getContainers, removeContainer } from '../utils/index.js' +import { docker } from '../utils/index.js' class Home extends Component { static props = { @@ -138,7 +138,7 @@ class Home extends Component { } async #fetch() { - let list = await getContainers(this.#all) + let list = await docker.containers(this.#all) list.forEach(it => { it.image = it.image.split(':') @@ -171,7 +171,7 @@ class Home extends Component { } async #remove(item) { - await removeContainer(item.id) + await docker.rm(item.id) this.#fetch() } diff --git a/usr/lib/dooke/webapp/views/images.js b/usr/lib/dooke/webapp/views/images.js index cc9dcb3..6e99dee 100644 --- a/usr/lib/dooke/webapp/views/images.js +++ b/usr/lib/dooke/webapp/views/images.js @@ -5,7 +5,7 @@ */ import { html, css, Component, classMap, nextTick, outsideClick } from 'wkit' -import { getImages, removeImage } from '../utils/index.js' +import { docker } from '../utils/index.js' class Images extends Component { static props = { @@ -112,13 +112,11 @@ class Images extends Component { #input = '' async mounted() { - let list = await getImages() - this.#fetch() } async #fetch() { - let list = await getImages() + let list = await docker.images() this.images = list } @@ -132,7 +130,7 @@ class Images extends Component { } async #remove(item) { - await removeImage(item.id) + await docker.rmi(item.id) this.#fetch() }