Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
saikksub committed Jan 20, 2019
1 parent afaa5ce commit 0d448c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/renderer/components/Home.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<template>
<div id="wrapper"
@click="onClickHome"
@dragover="$platform !== 'win32' && showDrag()"
@dragleave="$platform !== 'win32' && hideDrag()"
@dragover="showDrag"
@drop="dropFile">
<!-- layouts -->
<sidebar :rootFs="rootFs"/>
Expand Down
16 changes: 13 additions & 3 deletions src/renderer/store/modules/config/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const uniqid = require('uniqid')
const remote = require('electron').remote

let logger = null
let dragOverTimer = null

function registerForSqlReady (context) {
ipcRenderer.on('sql_ready', function (event, data) {
Expand Down Expand Up @@ -37,7 +38,7 @@ export default {
table: 'user'
}
})
const dateISOString = new Date().toISOString()
const dateISOString = new Date().toISOString().replace(/:/g, '_')
const logPath = nodePath.join(
remote.app.getPath('logs'),
'dbfs_explorer',
Expand Down Expand Up @@ -180,10 +181,19 @@ export default {
closeDialog: function (context, { name }) {
context.commit('setInertDialog', { name })
},
showDrag: function (context, ev) {
showDrag: function (context, e) {
e && e.preventDefault()
if (dragOverTimer) {
clearInterval(dragOverTimer)
dragOverTimer = null
}
context.commit('setDragActive')
dragOverTimer = setInterval(() => {
context.dispatch('hideDrag')
}, 200)
},
hideDrag: function (context) {
hideDrag: function (context, e) {
e && e.preventDefault()
context.commit('setDragInert')
},
dropFile: function (context, event) {
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/store/modules/navigator/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import TransferActivity from '@/threads/TransferActivity'

let transferActivity = null

const fs = require('fs')
const nodePath = require('path')
const base64 = require('file-base64')

Expand Down Expand Up @@ -223,7 +222,6 @@ export default {
}
// Convert base64 string into small chunks
const chunks = base64String.match(new RegExp('.{1,' + 256000 + '}', 'g'))
fs.writeFileSync('/Users/kksai/Test/base64_decode/upload', chunks.toString())
// Add new thread worker or job into thread pool
// NOTE: By default 2 threads will be spawned. User can configure this any time.
// Threads will be created based on CPU cores
Expand Down
4 changes: 0 additions & 4 deletions src/renderer/threads/TransferActivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ AddBlock.prototype.cancelJob = function ({ transferId }) {

function uploadHandler ({ url, token, transferId, handle, chunks, endpoint }, done, progress) {
console.log('on entry uploadHandler', transferId)
const fs = this.require('fs')
const axios = this.require('axios')
const forEach = this.require('async-foreach').forEach
const chunksLength = chunks.length - 1
Expand Down Expand Up @@ -133,7 +132,6 @@ function uploadHandler ({ url, token, transferId, handle, chunks, endpoint }, do
})
}, function () {
console.log('all done')
fs.writeFileSync('/Users/kksai/Test/base64_decode/stream', uploadStream.toString())
// Close handle
axios.post(
`${url}/api/2.0/dbfs/close`,
Expand All @@ -159,7 +157,6 @@ function uploadHandler ({ url, token, transferId, handle, chunks, endpoint }, do
function downloadHandler ({ url, token, transferId, endpoint, file, targetPath }, done, progress) {
console.log('on entry downloadHandler')
console.log('thread entry id', transferId, file, endpoint, url, token, targetPath)
const fs = this.require('fs')
const base64 = this.require('file-base64')
const EventEmitter = this.require('events')
const axios = this.require('axios')
Expand Down Expand Up @@ -215,7 +212,6 @@ function downloadHandler ({ url, token, transferId, endpoint, file, targetPath }
} else {
console.log('totalSizeBytes', totalSizeBytes)
console.log('finishedSizeBytes', finishedSizeBytes)
fs.writeFileSync('/Users/kksai/Test/base64_decode/download', base64String.toString())
// Decode base64 file
base64.decode(`${base64String.toString()}`, targetPath, function (err) {
if (!err) {
Expand Down

0 comments on commit 0d448c1

Please sign in to comment.