From f1c42012701018a5315a66b978c14636f9766c51 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Thu, 21 May 2020 14:49:55 +0200 Subject: [PATCH] fix system loading handle --- src/core/BaseApplication.coffee | 11 +++++++++++ src/core/gui.coffee | 5 +---- src/packages/Syslog/PushNotification.coffee | 4 ++-- src/packages/Syslog/Syslog.coffee | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/core/BaseApplication.coffee b/src/core/BaseApplication.coffee index e63fbc7..11b0df4 100644 --- a/src/core/BaseApplication.coffee +++ b/src/core/BaseApplication.coffee @@ -54,6 +54,17 @@ class BaseApplication extends this.OS.GUI.BaseModel path = "#{@meta().path}/scheme.html" @.render path + load: (promise) -> + q = @_api.mid() + new Promise (resolve, reject) => + @_api.loading q, @name + promise.then () => + @_api.loaded q, @name, "OK" + resolve() + .catch (e) => + @_api.loaded q, @name, "FAIL" + reject e + bindKey: (k, f) -> arr = k.split "-" return unless arr.length is 2 diff --git a/src/core/gui.coffee b/src/core/gui.coffee index 52ced63..a0c61b8 100644 --- a/src/core/gui.coffee +++ b/src/core/gui.coffee @@ -180,17 +180,14 @@ Ant.OS.GUI = if not Ant.OS.APP[app] # first load it Ant.OS.GUI.loadApp(app).then (a) -> - console.log "apploaded" Ant.OS.PM.createProcess a, Ant.OS.APP[a], args .catch (e) -> - console.log e Ant.OS.announcer.osfail __("Unable to launch: {0}", app), e else # now launch it if Ant.OS.APP[app] Ant.OS.PM.createProcess app, Ant.OS.APP[app], args - .catch (e)-> - console.log e + .catch (e) -> Ant.OS.announcer.osfail __("Unable to launch: {0}", app), e dock: (app, meta) -> # dock an application to a dock diff --git a/src/packages/Syslog/PushNotification.coffee b/src/packages/Syslog/PushNotification.coffee index afd4f6f..9e6f1b4 100644 --- a/src/packages/Syslog/PushNotification.coffee +++ b/src/packages/Syslog/PushNotification.coffee @@ -32,9 +32,11 @@ class PushNotification extends this.OS.GUI.BaseService if b and @iconclass is "fa fa-bars" @iconclass = "fa fa-spinner fa-spin" @update() + $(@_gui.workspace).css "cursor", "wait" else if not b and @iconclass is "fa fa-spinner fa-spin" @iconclass = "fa fa-bars" @update() + $(@_gui.workspace).css "cursor", "auto" main: -> @mlist = @find "notifylist" @@ -51,14 +53,12 @@ class PushNotification extends this.OS.GUI.BaseService @subscribe "loading", (o) => @pending.push o.id - $(@_gui.workspace).css "cursor", "wait" @spin true @subscribe "loaded", (o) => i = @pending.indexOf o.id @pending.splice i, 1 if i >= 0 @spin false if @pending.length is 0 - $(@_gui.workspace).css "cursor", "auto" @nzone.set "height", "100%" @fzone.set "height", "100%" diff --git a/src/packages/Syslog/Syslog.coffee b/src/packages/Syslog/Syslog.coffee index 7ac9035..8d00239 100644 --- a/src/packages/Syslog/Syslog.coffee +++ b/src/packages/Syslog/Syslog.coffee @@ -1,6 +1,6 @@ Ant = this -class BugListItemTag extends Ant.OS.GUI.tag["afx-list-item-proto"] +class BugListItemTag extends this.OS.GUI.tag["afx-list-item-proto"] constructor: (r, o) -> super r, o @@ -25,7 +25,7 @@ class BugListItemTag extends Ant.OS.GUI.tag["afx-list-item-proto"] ] } -Ant.OS.GUI.define "afx-bug-list-item", BugListItemTag +this.OS.GUI.define "afx-bug-list-item", BugListItemTag class Syslog extends this.OS.GUI.BaseApplication constructor: (args) ->