Compare commits
No commits in common. "c708d1ec426685102ee11e1562f9c976395e1dbe" and "7ae24131c857b11e37fecbbe94d2d95c9925c414" have entirely different histories.
c708d1ec42
...
7ae24131c8
2
build.sh
2
build.sh
|
@ -4,7 +4,7 @@ if [ -d unpack ]; then
|
|||
sudo rm -rf unpack
|
||||
fi
|
||||
|
||||
version="1.0.0"
|
||||
version="3.0.4"
|
||||
|
||||
mkdir -p unpack/DEBIAN
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ Architecture: all
|
|||
Priority: optional
|
||||
Maintainer: Yutent <yutent.io@gmail.com>
|
||||
Installed-Size: {{size}}
|
||||
Depends: python3-webengine-gtk3 (>=0.7.0)
|
||||
Depends: python3-webengine-gtk3 (>=0.6.1)
|
||||
Homepage: https://git.wkit.fun/appcat/dooke
|
||||
Author: yutent
|
||||
Description: docker管理面板。
|
||||
|
|
|
@ -146,7 +146,8 @@ class Docker:
|
|||
def start(self, id = ''):
|
||||
cmd = 'docker start ' + id
|
||||
out = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
|
||||
print('stdout', out.stdout.decode())
|
||||
print('stderr', out.stderr.decode())
|
||||
return out.stderr.decode().strip()
|
||||
|
||||
|
||||
|
@ -154,7 +155,8 @@ class Docker:
|
|||
def stop(self, id = ''):
|
||||
cmd = 'docker stop ' + id
|
||||
out = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
|
||||
print('stdout', out.stdout.decode())
|
||||
print('stderr', out.stderr.decode())
|
||||
return out.stderr.decode().strip()
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ from webengine.gtk3 import WebEngine, create_setting, create_hmr_server, create_
|
|||
from _window import Window
|
||||
from _docker import Docker
|
||||
|
||||
# from utils import run_async
|
||||
|
||||
|
||||
APP_ID = 'fun.wkit.dooke'
|
||||
|
@ -49,7 +50,7 @@ class Application(Gtk.Application):
|
|||
def bridge_handler(self, ev, params):
|
||||
_error = None
|
||||
output = None
|
||||
|
||||
# print(ev, params)
|
||||
match ev:
|
||||
case 'docker':
|
||||
action = params['action']
|
||||
|
@ -95,6 +96,7 @@ class Application(Gtk.Application):
|
|||
_error = client.rmi(params.get('id'))
|
||||
|
||||
|
||||
|
||||
return (_error, output)
|
||||
|
||||
|
||||
|
@ -117,6 +119,6 @@ if __name__ == "__main__":
|
|||
try:
|
||||
app = Application()
|
||||
app.run(sys.argv)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
except Exception as err:
|
||||
print(err)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import{css as p,html as c,Component as l,bind as a,unbind as d,styleMap as f,offset as h,outsideClick as m,clearOutsideClick as x}from"wkit";import"../base/button.js";const w="\u8BF7\u786E\u8BA4\u4F60\u7684\u64CD\u4F5C!";class b extends l{static props={title:"str!",confirmButtonType:"str!primary",disabled:!1};static styles=[p`:host{display:inline-flex}.container{position:relative}.container .wrapper{cursor:pointer}:host([disabled]){opacity:.6}:host([disabled]) .container .wrapper{cursor:not-allowed}.tooltip{display:none;position:fixed;z-index:9;justify-content:center;align-items:center;max-width:260px;min-width:32px;padding:8px 12px 12px;border-radius:3px;font-size:var(--wc-popconfirm-font, 14px);background:var(--wc-popconfirm-background, #fff);color:var(--wc-popconfirm-color, var(--color-dark-1));box-shadow:0 0 3px var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.3));word-break:break-all;-webkit-user-select:none;user-select:none}.tooltip::after{position:absolute;display:block;width:8px;height:8px;border-radius:2px;background:var(--wc-popconfirm-background, #fff);content:"";transform:rotate(45deg);box-shadow:-1px -1px 0 var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.1))}.tooltip[placement=left-top]::after{right:16px;bottom:-4px;box-shadow:1px 1px 0 var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.1))}.tooltip[placement=left-bottom]::after{right:16px;top:-4px}.tooltip[placement=right-top]::after{left:16px;bottom:-4px;box-shadow:1px 1px 0 var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.1))}.tooltip[placement=right-bottom]::after{left:16px;top:-4px}`,p`.title{display:flex;align-items:center;gap:6px;padding:8px 0;--wc-icon-size: 16px}.title wc-icon{flex-shrink:0;color:var(--wc-popconfirm-icon-color, var(--color-red-1))}:host([hide-icon]) .title wc-icon{display:none}.actions{display:flex;justify-content:flex-end;gap:4px;margin-top:8px}.actions wc-button{min-width:40px;height:20px;font-size:12px}.actions wc-button:first-child{--wc-button-border-color: none}`];#t=!1;#i(n){let{left:t,top:e}=h(this),s="left",o={display:"block"},r=document.documentElement.scrollTop;if(!(this.disabled||this.#t)){if(t<260||t>260&&window.innerWidth-t>260)s="right",t-=12,t<0&&(t=0),o.left=t+"px";else{let i=window.innerWidth-t-this.clientWidth-12;i<0&&(i=0),o.right=i+"px"}if(e<160)e+=8+this.clientHeight,s+="-bottom",o.top=e+"px";else{let i=window.innerHeight-e+8;s+="-top",o.bottom=i+"px",r>0&&(o.transform=`translateY(-${r}px)`)}this.#t=!0,this.$refs.tips.setAttribute("placement",s),this.$refs.tips.style.cssText=f(o),this.$refs.tips.$animate()}}#o(){this.#t&&(this.#t=!1,this.$refs.tips.$animate(!0))}#e(){this.$emit("confirm"),this.#o()}mounted(){this._outFn=m(this,n=>this.#o()),this._scrollFn=a(document,"scroll",n=>{if(this.#t){let t=document.documentElement.scrollTop;this.$refs.tips.style.transform=`translateY(-${t}px)`}})}unmounted(){d(document,"scroll",this._scrollFn),x(this._outFn)}render(){return c`
|
||||
import{css as p,html as c,Component as l,bind as a,unbind as f,styleMap as d,offset as h,outsideClick as m,clearOutsideClick as x}from"wkit";import"../base/button.js";const w="\u8BF7\u786E\u8BA4\u4F60\u7684\u64CD\u4F5C!";class u extends l{static props={title:"str!",confirmButtonType:"str!primary"};static styles=[p`:host{display:inline-flex}.container{position:relative}.tooltip{display:none;position:fixed;z-index:9;justify-content:center;align-items:center;max-width:260px;min-width:32px;padding:8px 12px 12px;border-radius:3px;font-size:var(--wc-popconfirm-font, 14px);background:var(--wc-popconfirm-background, #fff);color:var(--wc-popconfirm-color, var(--color-dark-1));box-shadow:0 0 3px var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.3));word-break:break-all;-webkit-user-select:none;user-select:none}.tooltip::after{position:absolute;display:block;width:8px;height:8px;border-radius:2px;background:var(--wc-popconfirm-background, #fff);content:"";transform:rotate(45deg);box-shadow:-1px -1px 0 var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.1))}.tooltip[placement=left-top]::after{right:16px;bottom:-4px;box-shadow:1px 1px 0 var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.1))}.tooltip[placement=left-bottom]::after{right:16px;top:-4px}.tooltip[placement=right-top]::after{left:16px;bottom:-4px;box-shadow:1px 1px 0 var(--wc-popconfirm-shadow, rgba(0, 0, 0, 0.1))}.tooltip[placement=right-bottom]::after{left:16px;top:-4px}`,p`.title{display:flex;align-items:center;gap:6px;padding:8px 0;--wc-icon-size: 16px}.title wc-icon{flex-shrink:0;color:var(--wc-popconfirm-icon-color, var(--color-red-1))}:host([hide-icon]) .title wc-icon{display:none}.actions{display:flex;justify-content:flex-end;gap:4px;margin-top:8px}.actions wc-button{min-width:40px;height:20px;font-size:12px}.actions wc-button:first-child{--wc-button-border-color: none}`];#t=!1;#i(s){let{left:t,top:e}=h(this),n="left",o={display:"block"},r=document.documentElement.scrollTop;if(!this.#t){if(t<260||t>260&&window.innerWidth-t>260)n="right",t-=12,t<0&&(t=0),o.left=t+"px";else{let i=window.innerWidth-t-this.clientWidth-12;i<0&&(i=0),o.right=i+"px"}if(e<160)e+=8+this.clientHeight,n+="-bottom",o.top=e+"px";else{let i=window.innerHeight-e+8;n+="-top",o.bottom=i+"px",r>0&&(o.transform=`translateY(-${r}px)`)}this.#t=!0,this.$refs.tips.setAttribute("placement",n),this.$refs.tips.style.cssText=d(o),this.$refs.tips.$animate()}}#o(){this.#t&&(this.#t=!1,this.$refs.tips.$animate(!0))}#e(){this.$emit("confirm"),this.#o()}mounted(){this._outFn=m(this,s=>this.#o()),this._scrollFn=a(document,"scroll",s=>{if(this.#t){let t=document.documentElement.scrollTop;this.$refs.tips.style.transform=`translateY(-${t}px)`}})}unmounted(){f(document,"scroll",this._scrollFn),x(this._outFn)}render(){return c`
|
||||
<main class="container">
|
||||
<div class="wrapper" @click=${this.#i}>
|
||||
<slot></slot>
|
||||
|
@ -19,4 +19,4 @@ import{css as p,html as c,Component as l,bind as a,unbind as d,styleMap as f,off
|
|||
</footer>
|
||||
</div>
|
||||
</main>
|
||||
`}}b.reg("popconfirm");
|
||||
`}}u.reg("popconfirm");
|
||||
|
|
|
@ -111,6 +111,8 @@ class Home extends Component {
|
|||
}
|
||||
|
||||
.action {
|
||||
cursor: pointer;
|
||||
|
||||
&.red {
|
||||
color: var(--color-red-1);
|
||||
}
|
||||
|
@ -143,7 +145,6 @@ class Home extends Component {
|
|||
let list = await docker.containers(this.#all)
|
||||
|
||||
list.forEach(it => {
|
||||
it.disabled = false
|
||||
it.image = it.image.split(':')
|
||||
it.cmd = it.cmd.replace(/^"|"$/g, '')
|
||||
it.port = it.port
|
||||
|
@ -179,13 +180,10 @@ class Home extends Component {
|
|||
|
||||
async #toggleStat(item) {
|
||||
//
|
||||
item.disabled = true
|
||||
if (item.state === STATE_RUNNING) {
|
||||
await docker.stop(item.id)
|
||||
layer.toast('容器已经停止', 'success')
|
||||
} else {
|
||||
await docker.start(item.id)
|
||||
layer.toast('容器已经启动', 'success')
|
||||
}
|
||||
this.#fetch()
|
||||
}
|
||||
|
@ -257,7 +255,6 @@ class Home extends Component {
|
|||
it.state === STATE_RUNNING ? '停止' : '启动'
|
||||
}此容器?`}
|
||||
@confirm=${ev => this.#toggleStat(it)}
|
||||
disabled=${it.disabled}
|
||||
>
|
||||
<span
|
||||
class="action ${it.state === STATE_RUNNING
|
||||
|
@ -270,7 +267,6 @@ class Home extends Component {
|
|||
<wc-popconfirm
|
||||
title="是否要删除此容器?"
|
||||
@confirm=${ev => this.#remove(it)}
|
||||
disabled=${it.disabled}
|
||||
>
|
||||
<span class="action">🗑</span>
|
||||
</wc-popconfirm>
|
||||
|
|
|
@ -95,6 +95,8 @@ class Images extends Component {
|
|||
color: var(--color-blue-1);
|
||||
}
|
||||
.action {
|
||||
cursor: pointer;
|
||||
|
||||
&.red {
|
||||
color: var(--color-red-1);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ class Networks extends Component {
|
|||
}
|
||||
|
||||
.action {
|
||||
cursor: pointer;
|
||||
|
||||
&.red {
|
||||
color: var(--color-red-1);
|
||||
}
|
||||
|
|
|
@ -95,6 +95,8 @@ class Services extends Component {
|
|||
color: var(--color-blue-1);
|
||||
}
|
||||
.action {
|
||||
cursor: pointer;
|
||||
|
||||
&.red {
|
||||
color: var(--color-red-1);
|
||||
}
|
||||
|
|
|
@ -98,6 +98,8 @@ class Volumes extends Component {
|
|||
}
|
||||
|
||||
.action {
|
||||
cursor: pointer;
|
||||
|
||||
&.red {
|
||||
color: var(--color-red-1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue