mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 03:09:45 +02:00
add application manager
This commit is contained in:
@ -7,7 +7,7 @@ class PushNotification extends this.OS.GUI.BaseService
|
||||
@pending = []
|
||||
init: ->
|
||||
@view = false
|
||||
path = path = "packages/CoreServices/notifications.html"
|
||||
path = path = "#{@meta().path}/notifications.html"
|
||||
@render path
|
||||
|
||||
spin: (b) ->
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"app":null,
|
||||
"services": [ "Calendar", "PushNotification", "Spotlight" ]
|
||||
"services": [ "Calendar", "PushNotification", "Spotlight" ],
|
||||
"name":"CoreServices",
|
||||
"description":"This is the core services",
|
||||
"info":{
|
||||
|
@ -181,7 +181,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
file.path.asFileHandler()
|
||||
.move "#{me.currdir.path}/#{d}", (r) ->
|
||||
me.error "Fail to rename to #{d}: #{r.error}" if r.error
|
||||
, "Rename", file.filename
|
||||
, "Rename", { label: "File name:", value: file.filename }
|
||||
|
||||
when "#{@name}-rm"
|
||||
return unless file
|
||||
@ -232,7 +232,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
(d) ->
|
||||
me.currdir.mk d, (r) ->
|
||||
me.error "Fail to create #{d}: #{r.error}" if r.error
|
||||
, "New folder"
|
||||
, "New folder", { label: "Folder name:" }
|
||||
|
||||
when "#{@name}-mkf"
|
||||
@openDialog "PromptDialog",
|
||||
@ -240,7 +240,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
fp = "#{me.currdir.path}/#{d}".asFileHandler()
|
||||
fp.write "", (r) ->
|
||||
me.error "Fail to create #{d}: #{r.error}" if r.error
|
||||
, "New file"
|
||||
, "New file", { label: "File name:" }
|
||||
|
||||
when "#{@name}-info"
|
||||
return unless file
|
||||
|
11
src/packages/MarketPlace/Makefile
Normal file
11
src/packages/MarketPlace/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
coffee_files = dialog.coffee main.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
cssfiles = main.css
|
||||
|
||||
copyfiles = repositorydia.html scheme.html package.json
|
||||
|
||||
|
||||
PKG_NAME=MarketPlace
|
||||
include ../pkg.mk
|
18
src/packages/MarketPlace/dialog.coffee
Normal file
18
src/packages/MarketPlace/dialog.coffee
Normal file
@ -0,0 +1,18 @@
|
||||
class RepositoryDialog extends this.OS.GUI.BaseDialog
|
||||
constructor: () ->
|
||||
super "RepositoryDialog"
|
||||
|
||||
init: () ->
|
||||
@render "#{@meta().path}/repositorydia.html"
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@list = @find "repo-list"
|
||||
ls = ({ text: v.name, iconclass: "fa fa-link", url: v.url
|
||||
} for v in @systemsetting.system.repositories)
|
||||
@url = @find "repo-url"
|
||||
@list.set "onlistselect", (e) ->
|
||||
($ me.url).html e.data.url
|
||||
@list.set "items", ls
|
||||
|
||||
this.OS.register "RepositoryDialog", RepositoryDialog
|
66
src/packages/MarketPlace/main.coffee
Normal file
66
src/packages/MarketPlace/main.coffee
Normal file
@ -0,0 +1,66 @@
|
||||
class MarketPlace extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "MarketPlace", args
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
# test repository
|
||||
@systemsetting.system.repositories.push {
|
||||
text: "Antos repository"
|
||||
url: "http://127.0.0.1:9191/repo/packages.json"
|
||||
name: "Antos repository"
|
||||
selected:true
|
||||
} if @systemsetting.system.repositories.length is 0
|
||||
@repo = @find "repo"
|
||||
@repo.set "onlistselect", (e) ->
|
||||
return unless e.data
|
||||
me.fetchApps e.data.url
|
||||
@repo.set "items", @systemsetting.system.repositories
|
||||
|
||||
@applist = @find "applist"
|
||||
@applist.set "onlistselect", (e) ->
|
||||
return unless e.data
|
||||
me.appDetail e.data
|
||||
@container = @find "container"
|
||||
@appname = @find "appname"
|
||||
@appdesc = @find "app-desc"
|
||||
@appdetail = @find "app-detail"
|
||||
@btinstall = @find "bt-install"
|
||||
@btremove = @find "bt-remove"
|
||||
@btexec = @find "bt-exec"
|
||||
($ @container ).css "visibility", "hidden"
|
||||
@btexec.set "onbtclick", (e) ->
|
||||
app = me.applist.get "selected"
|
||||
return unless app
|
||||
me._gui.launch app.className if app.className
|
||||
@btinstall.set "onbtclick", (e) ->
|
||||
me.openDialog "RepositoryDialog"
|
||||
fetchApps: (url) ->
|
||||
me = @
|
||||
@_api.get url, ( d ) ->
|
||||
for v in d
|
||||
v.text = v.name
|
||||
v.iconclass = "fa fa-adn"
|
||||
me.applist.set "items", d
|
||||
, (e, s) ->
|
||||
me.error "Fail to fetch packages list from: #{url}"
|
||||
|
||||
appDetail: (d) ->
|
||||
($ @container).css "visibility", "visible"
|
||||
( $ @appname ).html d.name
|
||||
($ @appdesc).html d.description if d.description
|
||||
|
||||
if @systemsetting.system.packages[d.className]
|
||||
($ @btinstall).hide()
|
||||
($ @btremove).show()
|
||||
($ @btexec).show()
|
||||
else
|
||||
($ @btinstall).show()
|
||||
($ @btremove).hide()
|
||||
($ @btexec).hide()
|
||||
|
||||
($ @appdetail).empty()
|
||||
for k, v of d when k isnt "name" and k isnt "description"
|
||||
($ @appdetail).append $("<li>").append(($ "<span class= 'info-header'>").html k).append $("<span>").html v
|
||||
|
||||
this.OS.register "MarketPlace", MarketPlace
|
59
src/packages/MarketPlace/main.css
Normal file
59
src/packages/MarketPlace/main.css
Normal file
@ -0,0 +1,59 @@
|
||||
afx-app-window[data-id ='marketplace-win'] afx-resizer{
|
||||
background-color: transparent;
|
||||
border-left: 1px solid #cbcbcb;
|
||||
}
|
||||
afx-app-window[data-id ='marketplace-win'] afx-list-view[data-id='applist']{
|
||||
background-color: #f6F6F6;
|
||||
padding:0;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] afx-list-view[data-id='repo'] div.list-container{
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="marketplace-win"] afx-vbox[data-id='container'] {
|
||||
color: #414339;
|
||||
overflow-y: auto;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] afx-vbox[data-id='container'] afx-hbox {
|
||||
padding-left: 10px;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] div[data-id='appname'] {
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
padding: 10px;
|
||||
color: #414339;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="marketplace-win"] div[data-id='appname']:before {
|
||||
content: "\f085";
|
||||
font-family: "FontAwesome";
|
||||
font-size: 25px;
|
||||
font-style: normal;
|
||||
margin-right: 10px;
|
||||
color: #414339;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] p[data-id='app-desc'] {
|
||||
text-align: justify;
|
||||
padding:10px;
|
||||
padding-top: 0;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] ul[data-id='app-detail'] {
|
||||
padding:0;
|
||||
padding-left:10px;
|
||||
display: table;
|
||||
margin: 0;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] ul[data-id='app-detail'] li{
|
||||
padding:0;
|
||||
margin: 0;
|
||||
display: table-row;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] ul[data-id='app-detail'] span{
|
||||
display: table-cell;
|
||||
padding: 5px;
|
||||
padding-bottom: 2px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] span.info-header{
|
||||
font-weight: bold;
|
||||
}
|
13
src/packages/MarketPlace/package.json
Normal file
13
src/packages/MarketPlace/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"app":"MarketPlace",
|
||||
"name":"Application store",
|
||||
"description":"Application store and repository management",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.1a",
|
||||
"category":"System",
|
||||
"iconclass":"fa fa-adn",
|
||||
"mimes":["none"]
|
||||
}
|
12
src/packages/MarketPlace/repositorydia.html
Normal file
12
src/packages/MarketPlace/repositorydia.html
Normal file
@ -0,0 +1,12 @@
|
||||
<afx-app-window data-id = "repository-dialog-win" apptitle="Repositories" width="250" height="250">
|
||||
<afx-vbox >
|
||||
<afx-list-view data-id="repo-list"></afx-list-view>
|
||||
<div data-id="repo-url" data-height="grow"></div>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-button data-id = "btadd" text = "[+]" data-width="30"></afx-button>
|
||||
<afx-button data-id = "btdel" text = "[-]" data-width="30"></afx-button>
|
||||
<div></div>
|
||||
<afx-button data-id = "btquit" text = "Cancel" data-width="50"></afx-button>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
23
src/packages/MarketPlace/scheme.html
Normal file
23
src/packages/MarketPlace/scheme.html
Normal file
@ -0,0 +1,23 @@
|
||||
<afx-app-window data-id = "marketplace-win" apptitle="MarketPlace" width="500" height="400">
|
||||
<afx-hbox >
|
||||
<afx-vbox data-width = "172" data-id = "sidebar" min-width="172">
|
||||
<afx-list-view data-id = "repo" dropdown = "true" data-height= "30" width = "150"></afx-list-view>
|
||||
<afx-list-view data-id = "applist" dropdown = "false" width = "150"></afx-list-view>
|
||||
</afx-vbox>
|
||||
<afx-resizer data-width = "3" ></afx-resizer>
|
||||
<afx-vbox data-id = "container">
|
||||
<div data-id = "appname" data-height = "25"></div>
|
||||
<afx-hbox data-height = "25">
|
||||
<afx-button data-id = "bt-remove" text = "Uninstall" data-width = "65"></afx-button>
|
||||
<afx-button data-id = "bt-exec" text = "Launch" data-width = "50"></afx-button>
|
||||
<afx-button data-id = "bt-install" text = "Install" data-width = "50"></afx-button>
|
||||
<div></div>
|
||||
</afx-hbox>
|
||||
<div>
|
||||
<p data-id = "app-desc"></p>
|
||||
<ul data-id = "app-detail"></ul>
|
||||
</div>
|
||||
</afx-vbox>
|
||||
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
Reference in New Issue
Block a user