Market now can update package to newer version

This commit is contained in:
Xuan Sang LE
2018-03-21 11:21:33 +01:00
parent 1b4f117060
commit da342ea574
22 changed files with 112 additions and 35 deletions

View File

@ -29,7 +29,7 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
item = me.grid.get "selected"
return unless item
app = _PM.appByPid item[0].value
app.quit() if app
app.quit(true) if app
header = [{width:50,value: "__(Pid)"},{value:"__(Name)"}, {value:"__(Type)", width:80},{width:75,value: "__(Alive (ms))"}]
@gdata =

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-heartbeat",
"mimes":["none"]

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-cubes",
"mimes":[

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"Internet",
"iconclass":"fa fa-book",
"mimes":["none"]

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"Programming",
"iconclass":"fa fa-puzzle-piece",
"mimes":["none"]

View File

@ -9,7 +9,7 @@
"credit": "dedicated to some one here",
"licences": "GPLv3"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"mimes":["*"]
}

View File

@ -8,7 +8,7 @@
"credit": "dedicated to some one here",
"licences": "GPLv3"
},
"version":"0.1a",
"version":"0.0.2-a",
"category":"System",
"icon": "icon.png",
"mimes":["none"]

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-hdd-o",
"mimes":["dir"]

View File

@ -7,7 +7,7 @@
"email": "xsang.le@gmail.com",
"licences": "GPLv3"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"Office",
"iconclass": "fa fa-sitemap",
"mimes":["text/.*graphviz"]

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"Utils",
"iconclass":"fa fa-leanpub",
"mimes":["text/.*"]

View File

@ -48,9 +48,10 @@ class MarketPlace extends this.OS.GUI.BaseApplication
return unless app
me._gui.launch app.className if app.className
@btinstall.set "onbtclick", (e) ->
me.install e
return me.update() if me.btinstall.get "dirty"
me.install()
@btremove.set "onbtclick", (e) ->
me.uninstall e
me.uninstall()
@bindKey "CTRL-R", () ->
me.openDialog new RepositoryDialog()
fetchApps: (url) ->
@ -67,15 +68,28 @@ class MarketPlace extends this.OS.GUI.BaseApplication
me = @
($ @container).css "visibility", "visible"
( $ @appname ).html d.name
(@find "vstat").set "text", ""
if d.description
d.description.asFileHandler().read (text) ->
converter = new showdown.Converter()
($ me.appdesc).html converter.makeHtml text
else
($ me.appdesc).empty()
if @systemsetting.system.packages[d.className]
pkgcache = @systemsetting.system.packages
@btinstall.set "text", "__(Install)"
@btinstall.set "dirty", false
if pkgcache[d.className]
vs = pkgcache[d.className].version
ovs = d.version
($ @btinstall).hide()
if vs and ovs
vs = vs.__v()
ovs = ovs.__v()
if ovs.nt vs
@btinstall.set "dirty", true
@btinstall.set "text", "__(Update)"
($ @btinstall).show()
(@find "vstat").set "text", __("Your application version is older ({0} < {1})", vs, ovs)
($ @btremove).show()
($ @btexec).show()
else
@ -97,7 +111,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
}
]
install: (e) ->
install: (f) ->
me = @
app = @applist.get "selected"
return unless app
@ -134,7 +148,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
, (err, s) ->
return me.error __("Cannot down load the app {0}", err) if err
uninstall: (e) ->
uninstall: (f) ->
me = @
sel = @applist.get "selected"
name = sel.className
@ -148,12 +162,21 @@ class MarketPlace extends this.OS.GUI.BaseApplication
return me.error __("Cannot uninstall package: {0}", r.error) if r.error
me.notify __("Package uninstalled")
delete me.systemsetting.system.packages[name]
window.OS.PM.killAll name
delete window.OS.APP[name]
me._gui.unloadApp name
me._gui.refreshSystemMenu()
me.appDetail sel
f() if f
, __("Uninstall") ,
{ text: __("Uninstall : {0}?", app.name) }
{ text: __("Uninstall: {0}?", app.name) }
update: () ->
me = @
new Promise (r, e) ->
me.uninstall () ->
r()
.then () ->
me.install()
mkdirs: (n, list, f) ->
me = @
if list.length is 0

View File

@ -61,6 +61,15 @@ afx-app-window[data-id="marketplace-win"] ul[data-id='app-detail'] span{
afx-app-window[data-id="marketplace-win"] span.info-header{
font-weight: bold;
}
afx-app-window[data-id="marketplace-win"] afx-label[data-id="vstat"] {
font-size: 11px;
color: chocolate;
}
afx-app-window[data-id="marketplace-win"] p.stat {
margin: 0;
padding:0;
margin-bottom: 10px;
}
afx-app-window[data-id = "repository-dialog-win"] afx-list-view[data-id="repo-list"] ul.complex-content > li{
font-size: 11px;
font-style: italic;

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-adn",
"mimes":["none"]

View File

@ -7,14 +7,15 @@
<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-hbox data-height = "grow">
<div style = "text-align:left;">
<afx-button data-id = "bt-remove" text = "__(Uninstall)"></afx-button>
<afx-button data-id = "bt-exec" text = "__(Launch)"></afx-button>
<afx-button data-id = "bt-install" text = "__(Install)" ></afx-button>
<p class="stat"><afx-label data-id="vstat"></afx-label></p>
</div>
</afx-hbox>
<div>
<div data-height = "grow">
<p data-id = "app-desc"></p>
<ul data-id = "app-detail"></ul>
</div>

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-pencil-square-o",
"mimes":[

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"Utils",
"iconclass":"fa fa-eye",
"mimes":["[^\/]*/.*pdf", "image/.*"]

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-wrench",
"mimes":["none"]

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1a",
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-terminal",
"mimes":["none"]