Sfoglia il codice sorgente

修复远程 hosts 刷新时如果内容无变化 loading 状态不停止的问题。 #198

oldj 8 anni fa
parent
commit
aa41dd4773

File diff suppressed because it is too large
+ 0 - 1
app/bundle.js


+ 1 - 1
app/server/actions/checkNeedRemoteRefresh.js

@@ -9,7 +9,7 @@ const saveHosts = require('./saveHosts')
 const checkOne = require('./checkOneRemoteHosts')
 
 function isHostsEqual(hosts1, hosts2) {
-  return hosts1.id === hosts2.id && hosts1.content === hosts2.content
+  return hosts1.id === hosts2.id && hosts1.content === hosts2.content && hosts1.last_refresh === hosts2.last_refresh
 }
 
 function isListEqual (list1, list2) {

+ 1 - 1
app/version.js

@@ -1 +1 @@
-exports.version = [3,3,5,5231];
+exports.version = [3,3,5,5234];

+ 1 - 0
ui/app.jsx

@@ -73,6 +73,7 @@ export default class App extends React.Component {
       console.log('checkNeedRemoteRefresh')
       Agent.pact('checkNeedRemoteRefresh', list)
         .then(list => {
+          Agent.emit('refresh_end')
           if (!list) return
           Agent.emit('list_updated', list)
         })

+ 1 - 1
ui/events/check_hosts_refresh.js

@@ -11,9 +11,9 @@ module.exports = (app, hosts) => {
   let list = app.state.list
   Agent.pact('checkNeedRemoteRefresh', list, hosts)
     .then(list => {
+      Agent.emit('refresh_end', hosts.id)
       if (!list) return
       Agent.emit('list_updated', list)
-      Agent.emit('refresh_end', hosts.id)
     })
     .catch(e => {
       console.log(e)

+ 7 - 1
ui/frame/edit.jsx

@@ -88,11 +88,17 @@ export default class EditPrompt extends React.Component {
       }
     })
 
-    Agent.on('refresh_end', id => {
+    Agent.on('refresh_end', (id) => {
       if (this.state.is_loading) {
         this.setState({
           is_loading: false
         })
+
+        if (id && id === this.current_hosts.id) {
+          this.setState({
+            last_refresh: this.current_hosts.last_refresh
+          })
+        }
       }
     })
   }

Some files were not shown because too many files changed in this diff