Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update browser: update discord link #39

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion browser/src/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ a {
}

.wrapper{
width: 16rem;
width: 16.6rem;
max-width: 100%;
margin: auto;
overflow: hidden;
Expand All @@ -105,6 +105,9 @@ body,
.wrapper {
font-size: 110px;
}
.wrapper{
width: 16.4rem;
}
}

@media screen and (max-width:1600px){
Expand Down
118 changes: 98 additions & 20 deletions browser/src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<div class="fes-icon">
<div class="fes-icon-logo">
<a href="https://filswan.medium.com/" target="_block"><img :src="share_img1" alt=""></a>
<a href="https://twitter.com/filswan1" target="_block"><img :src="share_img2" alt=""></a>
<a href="https://discord.com/invite/KKGhy8ZqzK" target="_block"><img :src="share_img10" alt=""></a>
<a href="https://twitter.com/0xfilswan" target="_block"><img :src="share_img2" alt=""></a>
<a href="https://github.com/filswan" target="_block"><img :src="share_img3" alt=""></a>
<a href="https://www.facebook.com/filswan.technology" target="_block"><img :src="share_img5" alt=""></a>
<!-- <a href="https://www.facebook.com/filswan.technology" target="_block"><img :src="share_img5" alt=""></a>
<a href="https://filswan.slack.com" target="_block"><img :src="share_img7" alt=""></a>
<a href="https://youtube.com/channel/UCcvrZdNqFWYl3FwfcHS9xIg" target="_block"><img :src="share_img8" alt=""></a>
<a href="https://youtube.com/channel/UCcvrZdNqFWYl3FwfcHS9xIg" target="_block"><img :src="share_img8" alt=""></a> -->
<a href="https://t.me/filswan" target="_block"><img :src="share_img9" alt=""></a>
<a href="https://discord.gg/MSXGzVsSYf" target="_block"><img :src="share_img10" alt=""></a>
</div>
<div class="fes-icon-copy">
<span>© 2022 FilSwan Canada</span>
Expand Down Expand Up @@ -71,12 +71,7 @@
<i class="el-icon-plus" :class="{'el-icon-plus-new': addFileShow}" @click.stop="addToggle"></i>
</div>

<div class="progressStyle" v-show="drawer">
<progress id="progressBar01" value="0" max="100" style="width: 100%;"></progress>
<div class="speed">
<span id="time"></span><span id="percentage"></span>
</div>
</div>
<div class="progressStyle" id="progressStyle"></div>
<el-backtop target=".wrapper"></el-backtop>
</div>

Expand Down Expand Up @@ -148,13 +143,15 @@ export default {
writable: true
},
fileList: [],
fileListIndexNow: 0,
actionUrl: '',
prefixData: '',
homeClick: false,
addArr: [],
progressArr: {
ot: 0,
oloaded: 0
oloaded: 0,
percentage_new: 0,
},
percentage_new: 0,
drawer: false,
Expand Down Expand Up @@ -429,8 +426,15 @@ export default {
// console.log('httpRequest', file);
},
onChange(file, fileList) {
let _this = this
// console.log('onChange', file, fileList);
let _this = this
// console.log('onChange', file, fileList, fileList.indexOf(fileList.filter(d=>d.name == file.name)[0]));
_this.fileListIndexNow += 1
let indexNow = _this.fileListIndexNow
let progressArr = {
ot: 0,
oloaded: 0,
percentage_new: 0
}
let regexp = /[#\\?]/
if(regexp.test(file.name)){
_this.$message.error('The filename cannot contain any of the following characters # ? \\');
Expand Down Expand Up @@ -460,7 +464,35 @@ export default {
let postUrl = _this.data_api + '/minio/upload/' + _this.currentBucket + '/' + prefix + file.name
let formData = new FormData(); //Create Empty

document.getElementById("progressBar01").value = 0
var evs = {};
evs.indexNow = document.createElement('div');
var div1 = document.createElement('div');
var progress = document.createElement('progress');
var span = document.createElement('span');
var span1 = document.createElement('span1');
evs.indexNow.id= "div" + indexNow
evs.indexNow.className= "div"
evs.indexNow.style.width = '100%'
evs.indexNow.style.margin = '0.1rem 0.2rem'

div1.id = 'speed' + indexNow
div1.className = 'speed'

progress.id = 'progressBar0' + indexNow
progress.value = 0
progress.max = 100
progress.style.width = '100%'

span.id= "time" + indexNow
span1.id= "percentage" + indexNow

document.getElementById('progressStyle').appendChild(evs.indexNow);
document.getElementById('div' + indexNow).appendChild(progress);
document.getElementById('div' + indexNow).appendChild(div1);
document.getElementById('speed' + indexNow).appendChild(span);
document.getElementById('speed' + indexNow).appendChild(span1);

// document.getElementById("progressBar01").value = 0
let xhr
xhr = new XMLHttpRequest()
xhr.open("PUT", postUrl, true)
Expand Down Expand Up @@ -522,11 +554,53 @@ export default {
//xhr.send(file.raw)
}

xhr.upload.onprogress = _this.progressFunction;//Implementation of upload progress call method
// xhr.upload.onprogress = _this.progressFunction;//Implementation of upload progress call method
xhr.upload.onprogress = function(evt){
let progressBar = document.getElementById("progressBar0"+indexNow);
let percentageDiv = document.getElementById("percentage"+indexNow);
if (evt.lengthComputable) {//
progressBar.max = evt.total;
progressBar.value = evt.loaded;
progressArr.percentage_new = Math.round(evt.loaded / evt.total * 100);
percentageDiv.innerHTML = "(" + Math.round(evt.loaded / evt.total * 100) + "%)";
}

let time = document.getElementById("time"+indexNow);
let nt = new Date().getTime();//Get current time
var pertime = (nt - progressArr.ot)/1000; //Calculate the time difference from the last time this method was called to the present, unit: s
progressArr.ot = new Date().getTime(); //Reassign time for next calculation

var perload = evt.loaded - progressArr.oloaded; //Calculate the file size uploaded by this segment, unit B
progressArr.oloaded = evt.loaded;//Reassign the uploaded file size, calculated with the following times

//Upload speed calculation
var speed = perload/pertime;//unit b/s
var bspeed = speed;
var units = 'b/s'; //unit
if(speed/1024>1){
speed = speed/1024;
units = 'k/s';
}
if(speed/1024>1){
speed = speed/1024;
units = 'M/s';
}
speed = speed.toFixed(1);
//Remaining time
var resttime = ((evt.total-evt.loaded)/bspeed).toFixed(1);
time.innerHTML = speed+units;
if(bspeed==0)
time.innerHTML = 'Upload cancelled';
if(!resttime || resttime <= 0){
//Notification.closeAll()
document.getElementById('progressStyle').removeChild(evs.indexNow)
return true
}
};//Implementation of upload progress call method
xhr.upload.onloadstart = function(){//Upload start execution method
_this.progressArr.ot = new Date().getTime(); //Set upload start time
_this.progressArr.oloaded = 0;//Set the file size to 0 when uploading starts
_this.percentage_new = 0
progressArr.ot = new Date().getTime(); //Set upload start time
progressArr.oloaded = 0;//Set the file size to 0 when uploading starts
progressArr.percentage_new = 0
_this.drawer = true
};
xhr.send(file.raw)
Expand Down Expand Up @@ -582,6 +656,7 @@ export default {
let _this = this
_this.getData()
localStorage.removeItem('addrWeb')
console.log('update time: 2022-03-25')
},
};
</script>
Expand Down Expand Up @@ -773,10 +848,13 @@ export default {
background: #00b7ff none repeat scroll 0% 0%;
font-size: 14px;
color: #fff;
padding: 0.2rem 0.4rem;
// padding: 0.2rem 0.4rem;
width: 360px;
display: flex;
flex-wrap: wrap;
div{
margin: 0.1rem 0.2rem;
}
.el-progress /deep/{
width: 100%;
.el-progress-bar{
Expand All @@ -795,7 +873,7 @@ export default {
justify-content: center;
align-items: center;
width: 100%;
margin: 0.2rem 0 0;
margin: 0;
}
}
}
Expand Down
19 changes: 14 additions & 5 deletions browser/src/components/shareDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
<el-row class="share_right" v-if="shareFileShow && activeOn == 'online'">
<el-button
class="shareFileCoinSend" @click="submitForm('ruleForm')"
:disabled="ruleForm.duration_tip" :style="{'opacity':ruleForm.duration_tip?'0.3':'1'}">Send</el-button>
:disabled="ruleForm.duration_tip || ruleForm.request_status"
:style="{'opacity':ruleForm.duration_tip || ruleForm.request_status?'0.3':'1'}">Send</el-button>
<el-col :span="24">
<!--h4 v-if="shareObjectShow">Share to Filecoin</h4-->
<h4>Backup to Filecoin</h4>
Expand Down Expand Up @@ -235,7 +236,8 @@ export default {
dealCID: '',
loadSign: true,
page: 0,
total: 1
total: 1,
request_status: false
},
rules: {
minerId: [
Expand Down Expand Up @@ -362,9 +364,13 @@ export default {
if(val.indexOf('.') > -1){
let array = val.split('.')
array[0] = array[0]>0 ? array[0].replace(/\b(0+)/gi,"") : '0'
if(!array[1]) {
this.ruleForm.price = array[0]
return false
}
this.ruleForm.price = array[0] + '.' + array[1]
}else{
this.ruleForm.price = val.replace(/\b(0+)/gi,"")
this.ruleForm.price = val > 0 ? val.replace(/\b(0+)/gi,"") : '0'
}
this.ruleForm.price_tip = false
}else if(type == 2){
Expand Down Expand Up @@ -503,9 +509,10 @@ export default {
"Price": _this.ruleForm.price,
"Duration": String(_this.ruleForm.duration.replace(/[^\d.]/g,'')*24*60*2) //(The number of days entered by the user on the UI needs to be converted into epoch to the backend. For example, 10 days is 10*24*60*2)
}
_this.ruleForm.request_status = true
axios.post(postUrl, minioDeal, {headers: {
'Authorization':"Bearer "+ _this.$store.getters.accessToken
}}).then((response) => {
}}).then(async (response) => {
let json = response.data
if (json.status == 'success') {
_this.ruleForm.dealCID = json.data.dealCid
Expand All @@ -515,12 +522,14 @@ export default {
});
}else{
_this.$message.error(json.message);
return false
}
_this.loadShare = false
await _this.timeout(5000)
_this.ruleForm.request_status = false
}).catch(function (error) {
console.log(error);
_this.loadShare = false
_this.ruleForm.request_status = false
});

} else {
Expand Down
13 changes: 12 additions & 1 deletion browser/src/views/minio/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@
</div>
</template>
</el-table-column>
<el-table-column prop="data.duration" label="Duration"></el-table-column>
<el-table-column prop="data.duration" label="Duration">
<template slot-scope="scope">
{{exChangeList[scope.$index].data.duration / 2880}} days
<br>
({{ exChangeList[scope.$index].data.duration_time }})
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
Expand Down Expand Up @@ -478,6 +484,11 @@ export default {
if(item.data){
item.data.visible = false
item.data.visibleDataCid = false
item.data.duration_time =
item.data.duration?
Moment(new Date(((parseInt(item.data.duration)*30 * 1000 + (item.data.timeStamp/1000))))).format("YYYY-MM-DD HH:mm:ss")
:
'-'
item.data.timeStamp = Moment(new Date(item.data.timeStamp/1000)).format('YYYY-MM-DD HH:mm:ss')
}
})
Expand Down