mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 17:58:22 +01:00
update MarketPlace
This commit is contained in:
parent
8ae2f529f7
commit
d9bd567271
@ -9,18 +9,54 @@ class RepositoryDialog extends this.OS.GUI.BaseDialog
|
|||||||
main: () ->
|
main: () ->
|
||||||
me = @
|
me = @
|
||||||
@list = @find "repo-list"
|
@list = @find "repo-list"
|
||||||
ls = ({ text: v.name, iconclass: "fa fa-link", url: v.url
|
@list.set "onlistdbclick", (e) ->
|
||||||
} for v in @systemsetting.system.repositories)
|
selidx = me.list.get "selidx"
|
||||||
@url = @find "repo-url"
|
return unless selidx >= 0
|
||||||
@list.set "onlistselect", (e) ->
|
sel = me.systemsetting.system.repositories[selidx]
|
||||||
($ me.url).html e.data.url
|
me.openDialog "PromptDialog", (e) ->
|
||||||
@list.set "items", ls
|
m = e.match /\[([^\]]*)\]\s*(.*)/
|
||||||
|
return me.error "Wrong format: it should be [name] url" if not m or m.length isnt 3
|
||||||
|
sel.name = m[1]
|
||||||
|
sel.text = sel.name
|
||||||
|
sel.url = m[2]
|
||||||
|
me.refreshList()
|
||||||
|
, "Edit repository", { label: "Format : [name]url", value: "[#{e.data.text}] #{e.data.url}" }
|
||||||
|
|
||||||
|
(@find "btadd").set "onbtclick", (e) ->
|
||||||
|
me.openDialog "PromptDialog", (e) ->
|
||||||
|
m = e.match /\[([^\]]*)\]\s*(.*)/
|
||||||
|
return me.error "Wrong format: it should be [name] url" if not m or m.length isnt 3
|
||||||
|
me.systemsetting.system.repositories.push {
|
||||||
|
name: m[1],
|
||||||
|
url: m[2],
|
||||||
|
text: m[1],
|
||||||
|
i: me.systemsetting.system.repositories.length
|
||||||
|
}
|
||||||
|
me.refreshList()
|
||||||
|
, "Add repository", { label: "Format : [name]url" }
|
||||||
|
(@find "btdel").set "onbtclick", (e) ->
|
||||||
|
selidx = me.list.get "selidx"
|
||||||
|
return unless selidx >= 0
|
||||||
|
me.systemsetting.system.repositories.splice selidx, selidx
|
||||||
|
me.refreshList()
|
||||||
|
(@find "btquit").set "onbtclick", (e) -> me.quit()
|
||||||
|
@refreshList()
|
||||||
|
refreshList: () ->
|
||||||
|
ls = ({
|
||||||
|
text: v.name,
|
||||||
|
iconclass: "fa fa-link",
|
||||||
|
url: v.url,
|
||||||
|
complex: true,
|
||||||
|
detail: [{ text: v.url }]
|
||||||
|
} for v in @systemsetting.system.repositories)
|
||||||
|
@list.set "items", ls
|
||||||
|
onexit: (e) ->
|
||||||
|
@parent.repo.set "items", @systemsetting.system.repositories
|
||||||
|
@parent.dialog = undefined if @parent
|
||||||
RepositoryDialog.scheme = """
|
RepositoryDialog.scheme = """
|
||||||
<afx-app-window data-id = "repository-dialog-win" apptitle="Repositories" width="250" height="250">
|
<afx-app-window data-id = "repository-dialog-win" apptitle="Repositories" width="250" height="250">
|
||||||
<afx-vbox >
|
<afx-vbox >
|
||||||
<afx-list-view data-id="repo-list"></afx-list-view>
|
<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-hbox data-height = "30">
|
||||||
<afx-button data-id = "btadd" text = "[+]" data-width="30"></afx-button>
|
<afx-button data-id = "btadd" text = "[+]" data-width="30"></afx-button>
|
||||||
<afx-button data-id = "btdel" text = "[-]" data-width="30"></afx-button>
|
<afx-button data-id = "btdel" text = "[-]" data-width="30"></afx-button>
|
||||||
|
@ -7,12 +7,6 @@ class MarketPlace extends this.OS.GUI.BaseApplication
|
|||||||
me = @
|
me = @
|
||||||
@installdir = @systemsetting.system.pkgpaths.user
|
@installdir = @systemsetting.system.pkgpaths.user
|
||||||
# test repository
|
# test repository
|
||||||
@systemsetting.system.repositories.push {
|
|
||||||
text: "Antos repository"
|
|
||||||
url: "https://os.localhost:9195/repo/packages.json"
|
|
||||||
name: "Antos repository"
|
|
||||||
selected:true
|
|
||||||
} if @systemsetting.system.repositories.length is 0
|
|
||||||
@repo = @find "repo"
|
@repo = @find "repo"
|
||||||
@repo.set "onlistselect", (e) ->
|
@repo.set "onlistselect", (e) ->
|
||||||
return unless e.data
|
return unless e.data
|
||||||
|
Loading…
Reference in New Issue
Block a user