Commit 1f3cf0f6 authored by Mihkel Putrinš's avatar Mihkel Putrinš

cleanup and nicer progressbar

parent 04404871
...@@ -23,9 +23,9 @@ if (IS_DEV) { ...@@ -23,9 +23,9 @@ if (IS_DEV) {
} }
app.on('ready', function() { app.on('ready', function() {
var home_path = app.getPath('home') USER_PATH = path.join(app.getPath('temp'), 'user.json')
USER_PATH = path.join(home_path, 'user.json')
// windows['authWindow'] = new BrowserWindow({ width: 900, height: 600, show: true, "web-preferences": {partition: ''} })
windows['authWindow'] = new BrowserWindow({ width: 900, height: 600, show: true, "web-preferences": {partition: "persist:panustaja (build " + (pjson.build) + ")"} }) windows['authWindow'] = new BrowserWindow({ width: 900, height: 600, show: true, "web-preferences": {partition: "persist:panustaja (build " + (pjson.build) + ")"} })
var title = pjson.name + ' v.' + pjson.version + (pjson.version.indexOf('-') > -1 ? pjson.build : '') + ' | Logi sisse' var title = pjson.name + ' v.' + pjson.version + (pjson.version.indexOf('-') > -1 ? pjson.build : '') + ' | Logi sisse'
windows['authWindow'].center() windows['authWindow'].center()
...@@ -49,14 +49,14 @@ app.on('ready', function() { ...@@ -49,14 +49,14 @@ app.on('ready', function() {
// + '\n"' + user_url + '"' // + '\n"' + user_url + '"'
// , buttons:['ok'] // , buttons:['ok']
// }) // })
// require('dialog').showMessageBox({type:'info', message:'HOME: ' + home_path, buttons:['ok']}) // console.log(windows['authWindow'].webContents.session.cookies);
windows['authWindow'].webContents.savePage(USER_PATH, 'HTMLOnly', function(err) { windows['authWindow'].webContents.savePage(USER_PATH, 'HTMLOnly', function(err) {
if (err) { if (err) {
require('dialog').showMessageBox({type:'info', message:'peale salvestamist: katki' + err, buttons:['ok']}) require('dialog').showMessageBox({type:'info', message:'peale salvestamist: katki' + err, buttons:['ok']})
console.log("Error:", err) console.log("Error:", err)
process.exit() process.exit()
} else { } else {
var view_path = path.join(__dirname, 'views', 'main.jade') var view_path = path.join(app.getAppPath(), 'code', 'views', 'main.jade')
// require('dialog').showMessageBox({type:'info', message:'peale salvestamist: korras\n' // require('dialog').showMessageBox({type:'info', message:'peale salvestamist: korras\n'
// + 'Laen lehte: file://' + view_path, buttons:['ok']}) // + 'Laen lehte: file://' + view_path, buttons:['ok']})
mainWindow.webContents.loadUrl('file://' + view_path) mainWindow.webContents.loadUrl('file://' + view_path)
......
...@@ -17,9 +17,6 @@ var pjson = require(path.join(__dirname, '..', '..', 'package.json')) ...@@ -17,9 +17,6 @@ var pjson = require(path.join(__dirname, '..', '..', 'package.json'))
UPLOADER_VERSION = pjson.name + ' v.' + pjson.version + (pjson.version.indexOf('-') > -1 ? pjson.build : '') UPLOADER_VERSION = pjson.name + ' v.' + pjson.version + (pjson.version.indexOf('-') > -1 ? pjson.build : '')
var ipc = require('ipc') var ipc = require('ipc')
// ipc.send('userdata-query')
// ipc.on('userdata-reply', function(user_data) {
// })
var b2s = require(path.join(__dirname, '..', 'bytesToSize.js')) var b2s = require(path.join(__dirname, '..', 'bytesToSize.js'))
...@@ -31,11 +28,11 @@ var dom_resource_stats = document.getElementById('resourceStats') ...@@ -31,11 +28,11 @@ var dom_resource_stats = document.getElementById('resourceStats')
var renderer_interval var renderer_interval
setTimeout(function () { setTimeout(function () {
var home_path = app.getPath('home') USER_PATH = path.join(app.getPath('temp'), 'user.json')
USER_PATH = path.join(home_path, 'user.json')
// dialog.showMessageBox({type:'info', message:'loeme faili: ' + USER_PATH, buttons:['ok']})
fs.readFile(USER_PATH, 'utf8', function(err, data_json) { fs.readFile(USER_PATH, 'utf8', function(err, data_json) {
if (err) throw (err)
// dialog.showMessageBox({type:'info', message:'fail avatud: ' + USER_PATH, buttons:['ok']}) // dialog.showMessageBox({type:'info', message:'fail avatud: ' + USER_PATH, buttons:['ok']})
// dialog.showMessageBox({type:'info', message:data_json, buttons:['ok']})
var data = JSON.parse(data_json) var data = JSON.parse(data_json)
if (op.get(data, 'result.user_id', false)) { if (op.get(data, 'result.user_id', false)) {
user_data['user_id'] = op.get(data, 'result.user_id') user_data['user_id'] = op.get(data, 'result.user_id')
...@@ -44,6 +41,7 @@ setTimeout(function () { ...@@ -44,6 +41,7 @@ setTimeout(function () {
document.getElementById('userName').innerHTML = user_data.name document.getElementById('userName').innerHTML = user_data.name
var title = UPLOADER_VERSION + ' | ' + user_data['name'] var title = UPLOADER_VERSION + ' | ' + user_data['name']
ipc.send('setTitle', title) ipc.send('setTitle', title)
setFormState('select')
} else { } else {
ipc.send('log', 'User data incomplete.') ipc.send('log', 'User data incomplete.')
ipc.send('data', data) ipc.send('data', data)
...@@ -177,6 +175,8 @@ var setFormState = function setFormState(state) { ...@@ -177,6 +175,8 @@ var setFormState = function setFormState(state) {
document.getElementById('uploading').setAttribute('hidden', '') document.getElementById('uploading').setAttribute('hidden', '')
document.getElementById('uploadResource').setAttribute('hidden', '') document.getElementById('uploadResource').setAttribute('hidden', '')
document.getElementById('resourceName').setAttribute('hidden', '') document.getElementById('resourceName').setAttribute('hidden', '')
// ---
// document.getElementById('uploading').removeAttribute('hidden')
break break
case 'loading': case 'loading':
document.getElementById('loading').removeAttribute('hidden') document.getElementById('loading').removeAttribute('hidden')
...@@ -219,4 +219,3 @@ var setFormState = function setFormState(state) { ...@@ -219,4 +219,3 @@ var setFormState = function setFormState(state) {
break break
} }
} }
setFormState('select')
#resourceProgressbarOuter { #resourceProgressbarOuter {
width: 100%; width: 100%;
border-radius: 25px; border-radius: 25px;
height: 6px; height: 9px;
background-color: #cdf; background-color: #E8E8C3;
border: 0px solid black; border: 0px solid black;
} }
#resourceProgressbarInner { #resourceProgressbarInner {
width: 0%; width: 0%;
border-radius: 25px; border-radius: 25px;
height: 100%; height: 100%;
background-color: #79b; background-color: #92CC6F;
/*border: 0px solid green;*/ /*border: 0px solid green;*/
} }
#fileProgressbarOuter { #fileProgressbarOuter {
width: 100%; width: 100%;
border-radius: 25px; border-radius: 25px;
height: 6px; height: 9px;
background-color: #cdf; background-color: #cdf;
border: 0px solid black; border: 0px solid black;
} }
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
width: 0%; width: 0%;
border-radius: 25px; border-radius: 25px;
height: 100%; height: 100%;
background-color: #79b; background-color: #0065CA;
/*border: 0px solid green;*/ /*border: 0px solid green;*/
} }
...@@ -9,7 +9,7 @@ html ...@@ -9,7 +9,7 @@ html
body body
h1#userName() Tere h1#userName() Tere
div#selectLocal div#selectLocal(hidden)
p#selectLocalMessage Palun vali fail(id) ja/või kataloog(id), mida soovid üles laadida. p#selectLocalMessage Palun vali fail(id) ja/või kataloog(id), mida soovid üles laadida.
button#selectLocalButton(onclick='selectLocal()') Vali button#selectLocalButton(onclick='selectLocal()') Vali
div#resourceName(hidden='') div#resourceName(hidden='')
...@@ -32,12 +32,12 @@ html ...@@ -32,12 +32,12 @@ html
span#uploadTotalResources 0 span#uploadTotalResources 0
div#resourceProgressbarOuter div#resourceProgressbarOuter
div#resourceProgressbarInner div#resourceProgressbarInner
div#fileProgressbarInner
span= 'Failid: ' span= 'Failid: '
span#uploadedSize 0 span#uploadedSize 0
span / span /
span#uploadTotalSize 0 span#uploadTotalSize 0
div#fileProgressbarOuter //- div#fileProgressbarOuter
div#fileProgressbarInner
pre#status pre#status
div#thankYou(hidden='') Aitäh! div#thankYou(hidden='') Aitäh!
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "Panustaja", "name": "Panustaja",
"description": "Ressursikataloogi upitamiseks keeleressurside Entu repositooriumisse.", "description": "Ressursikataloogi upitamiseks keeleressurside Entu repositooriumisse.",
"version": "1.0.1-d", "version": "1.0.1-d",
"build": 64, "build": 88,
"main": "./code/app.js", "main": "./code/app.js",
"license": "CC-SA", "license": "CC-SA",
"private": true, "private": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment