Add refreash animation for "Known remotes" import screen

This commit is contained in:
NI
2019-12-31 09:30:35 +08:00
parent 8af9f1a1f1
commit ed2f8157ad
3 changed files with 42 additions and 2 deletions

View File

@@ -444,7 +444,9 @@ export default {
return this.connector.historyRec.export();
},
importKnowns(d) {
return this.connector.historyRec.import(d);
this.connector.historyRec.import(d);
this.connector.knowns = this.connector.historyRec.all();
},
removeKnown(uid) {
this.connector.historyRec.del(uid);

View File

@@ -26,6 +26,28 @@
background: #3a3a3a;
display: flex;
flex-direction: column;
position: relative;
}
#connect-known-list.reloaded {
}
#connect-known-list.reloaded::after {
opacity: 0;
z-index: 2;
content: " ";
display: block;
position: absolute;
width: 100%;
height: 0;
top: -2px;
left: 0;
right: 0;
background: #fff;
animation-name: home-window-display-flash;
animation-duration: 0.5s;
animation-iteration-count: 1;
box-shadow: 0 0 10px #fff;
}
#connect-known-list-list,

View File

@@ -18,7 +18,7 @@
-->
<template>
<div id="connect-known-list">
<div id="connect-known-list" :class="{ reloaded: reloaded }">
<div v-if="knownList.length <= 0" id="connect-known-list-empty">
No known remote available
</div>
@@ -101,12 +101,28 @@ export default {
data() {
return {
knownList: [],
reloaded: false,
busy: false
};
},
watch: {
knowns(newVal) {
// Only play reload animation when we're adding data into the records,
// not reducing
const playReloaded = newVal.length > this.knownList.length;
this.reload(newVal);
if (!playReloaded) {
return;
}
const self = this;
self.reloaded = true;
setTimeout(() => {
self.reloaded = false;
}, 500);
}
},
mounted() {