mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2025-07-12 22:03:29 +02:00
Update apps categories
This commit is contained in:
15
Dockman/build/debug/README.md
Normal file
15
Dockman/build/debug/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Dockman
|
||||
This is an example project, generated by AntOS Development Kit
|
||||
|
||||
## Howto
|
||||
Use the CodePad command palette to access to the SDK functionalities:
|
||||
|
||||
1. Create new project
|
||||
2. Init the project from the current folder located in side bar
|
||||
3. Build and run the project
|
||||
4. Release the project in zip package
|
||||
|
||||
## Set up build target
|
||||
|
||||
Open the `project.json` file from the current project tree and add/remove
|
||||
build target entries. Save the file
|
141
Dockman/build/debug/api.lua
Normal file
141
Dockman/build/debug/api.lua
Normal file
@ -0,0 +1,141 @@
|
||||
local args=...
|
||||
|
||||
local handle = {}
|
||||
|
||||
local result = function(data)
|
||||
return { error = false, result = data }
|
||||
end
|
||||
|
||||
local error = function(msg)
|
||||
return {error = msg, result = false}
|
||||
end
|
||||
|
||||
local exec = function(host, rcmd, decode)
|
||||
local user = SESSION.user
|
||||
if not user then return nil end
|
||||
local cmd = "ssh -tt "..user.."@"..host.." "..rcmd
|
||||
if decode then
|
||||
cmd = cmd.." --format \\'{{json .}}\\'"
|
||||
end
|
||||
local f = assert(io.popen(cmd, 'r'))
|
||||
local s = assert(f:read('*a'))
|
||||
f:close()
|
||||
if decode then
|
||||
s = s:gsub('[\n\r]+', ',')
|
||||
return JSON.decodeString("["..s.."null]")
|
||||
else
|
||||
return s
|
||||
end
|
||||
end
|
||||
|
||||
handle.list_image = function(data)
|
||||
local res = exec(data.host, "docker image ls", true)
|
||||
if not res then
|
||||
return error("Unable to fetch image list")
|
||||
end
|
||||
-- inspect images
|
||||
for i,v in ipairs(res) do
|
||||
v.Detail = exec(data.host, "docker image inspect "..v.ID, true)[1]
|
||||
v.text = v.Detail.RepoTags[1]
|
||||
if not v.text or v.text == "" then
|
||||
v.text = v.ID
|
||||
end
|
||||
end
|
||||
return result(res)
|
||||
end
|
||||
|
||||
handle.list_container = function(data)
|
||||
local res = exec(data.host, "docker ps -a -f ancestor="..data.image, true)
|
||||
if not res then
|
||||
return error("Unable to fetch container list")
|
||||
end
|
||||
for i,v in ipairs(res) do
|
||||
v.Detail = exec(data.host, "docker container inspect "..v.ID, true)[1]
|
||||
v.text = v.Names
|
||||
|
||||
if v.Detail.State.Running then
|
||||
v.iconclass = "fa fa-circle running"
|
||||
else
|
||||
v.iconclass = "fa fa-circle stop"
|
||||
end
|
||||
end
|
||||
return result(res)
|
||||
end
|
||||
|
||||
handle.run_container = function(data)
|
||||
local res = exec(data.host, "docker start "..data.id, false)
|
||||
res = res:gsub('[\n\r]+', '')
|
||||
if res == data.id then
|
||||
return result("OK")
|
||||
else
|
||||
return error(res)
|
||||
end
|
||||
end
|
||||
|
||||
handle.pull_image = function(data)
|
||||
local res = exec(data.host, "docker pull "..data.image, false)
|
||||
return result(std.b64encode(res))
|
||||
end
|
||||
|
||||
|
||||
handle.rm_image = function(data)
|
||||
local res = exec(data.host, "docker rmi "..data.id.."; sleep 2", false)
|
||||
return result(res)
|
||||
end
|
||||
|
||||
handle.create_container = function(data)
|
||||
local cmd = "docker run "
|
||||
for k,v in pairs(data.parameters) do
|
||||
k = k:gsub(" ", "")
|
||||
if k:len() == 1 then
|
||||
cmd = cmd.." -"..k.." \""..v.."\" "
|
||||
else
|
||||
if k:match("^e_.*") then
|
||||
cmd = cmd.." -e \""..k:gsub("e_","").."="..v.."\" "
|
||||
else
|
||||
cmd = cmd.." --"..k
|
||||
if v ~= "" then
|
||||
cmd = cmd.."=\""..v.."\" "
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cmd = cmd.."--detach=true "..data.image
|
||||
|
||||
local res = exec(data.host, cmd, false)
|
||||
return result(res)
|
||||
end
|
||||
|
||||
handle.stop_container = function(data)
|
||||
local res = exec(data.host, "docker stop "..data.id, false)
|
||||
res = res:gsub('[\n\r]+', '')
|
||||
if res == data.id then
|
||||
return result("OK")
|
||||
else
|
||||
return error(res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
handle.rm_container = function(data)
|
||||
local res = exec(data.host, "docker stop "..data.id, false)
|
||||
res = res:gsub('[\n\r]+', '')
|
||||
if res == data.id then
|
||||
local res = exec(data.host, "docker rm "..data.id, false)
|
||||
res = res:gsub('[\n\r]+', '')
|
||||
if res == data.id then
|
||||
return result("OK")
|
||||
else
|
||||
error(res)
|
||||
end
|
||||
else
|
||||
return error(res)
|
||||
end
|
||||
end
|
||||
|
||||
if args.action and handle[args.action] then
|
||||
return handle[args.action](args.args)
|
||||
else
|
||||
return error("Invalid action parameter")
|
||||
end
|
34
Dockman/build/debug/main.css
Normal file
34
Dockman/build/debug/main.css
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
afx-app-window[data-id="Dockman"] .tab-wrapper button {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="Dockman"] .header .label-text {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="Dockman"] afx-label.header
|
||||
{
|
||||
border-bottom: 1px solid #116cd6;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="Dockman"] .tab-wrapper {
|
||||
border-bottom: 1px solid #116cd6;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="Dockman"] .tab-wrapper afx-list-view> .list-container {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="Dockman"] afx-tree-view .afx_folder_item .itemname .label-text {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="Dockman"] .running:before{
|
||||
color: green;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="Dockman"] .stop:before{
|
||||
color: red;
|
||||
}
|
1
Dockman/build/debug/main.js
Normal file
1
Dockman/build/debug/main.js
Normal file
File diff suppressed because one or more lines are too long
16
Dockman/build/debug/package.json
Normal file
16
Dockman/build/debug/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"pkgname": "Dockman",
|
||||
"app":"Dockman",
|
||||
"name":"Remote Docker Manager",
|
||||
"description":"Remote Docker Manager",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.1.0-b",
|
||||
"category":"Development",
|
||||
"iconclass":"fa fa-cubes",
|
||||
"mimes":["none"],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
25
Dockman/build/debug/scheme.html
Normal file
25
Dockman/build/debug/scheme.html
Normal file
@ -0,0 +1,25 @@
|
||||
<afx-app-window data-id="Dockman" apptitle="__(Remote Docker Manager)" width="650" height="450" >
|
||||
<afx-vbox>
|
||||
<afx-hbox data-height="23" class="tab-wrapper">
|
||||
<afx-button data-id="add" text="" iconclass="fa fa-plus-square" data-width="23"></afx-button>
|
||||
<afx-tab-bar data-id="host-tab-bar" closable="true"></afx-tab-bar>
|
||||
</afx-hbox>
|
||||
<afx-hbox>
|
||||
<afx-vbox data-width="250">
|
||||
<afx-label text = "__(Images)" class="header" iconclass='fa fa-square' data-height="23"></afx-label>
|
||||
<afx-list-view data-id="img-list"></afx-list-view>
|
||||
<afx-resizer data-height = "3"></afx-resizer>
|
||||
<afx-label text = "__(Containers)" class="header" iconclass='fa fa-square' data-height="23"></afx-label>
|
||||
<afx-list-view data-id="container-list"></afx-list-view>
|
||||
</afx-vbox>
|
||||
<afx-resizer data-width="3"></afx-resizer>
|
||||
<afx-vbox>
|
||||
<!--afx-label text = "__(Detail)" class="header" iconclass='fa fa-square' data-height="23"></afx-label-->
|
||||
<afx-tree-view data-id="obj-view"></afx-tree-view>
|
||||
<div data-height="25"></div>
|
||||
</afx-vbox>
|
||||
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
|
||||
</afx-app-window>
|
Reference in New Issue
Block a user