Skip to content
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
113 changes: 41 additions & 72 deletions deploy/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
position: absolute;
top: 30px; left: 0;
width: 100%; height: calc(100% - 30px);
visibility: hidden;
}

#loading_interface {
Expand Down Expand Up @@ -583,31 +584,6 @@ <h4 id="stages_item_title" class="stages__item_title"></h3>
</div>
</div>
<script>

function simulate_startup(p_window, p_list, p_loading_data_container, p_loading_data_content, p_webview) {
if (p_list.length>0) {
var string = p_list.shift();
p_loading_data_content.innerHTML += '<br/>' + string;
setTimeout(function() {
simulate_startup(p_window, p_list, p_loading_data_container, p_loading_data_content, p_webview);
},2000);
}
// Done with the startup, adjust page and load PGManage
else {
p_loading_data_container.style.display = 'none';

p_window.width = 1280;
p_window.height = 1024;

p_window.x = Math.floor((window.screen.availWidth/2) - (p_window.width/2));
p_window.y = Math.floor((window.screen.availHeight/2) - (p_window.height/2));

document.getElementById('bar_top').style.display = '';
p_webview.style.display = '';
p_webview.src = 'http://192.168.100.21:8000';
}
}

try {
var gui = require('nw.gui');
let win = gui.Window.get();
Expand Down Expand Up @@ -752,6 +728,21 @@ <h4 id="stages_item_title" class="stages__item_title"></h3>
}
});

v_webview.addEventListener('loadstop', () => {
// quit this part if it is not initial loading screen and v_loading_data_container style display is 'none'
if (!!v_loading_data_container.getAttribute("style")) return;

// Prevent intermediate frames from being displayed.
win.hide();

v_loading_data_container.style.display = 'none';
document.getElementById('bar_top').style.display = '';
v_webview.style.visibility = 'visible';

win.setMinimumSize(1024, 768);
initWindowState();
});

const child_process = require('child_process')
const path = require('path')
const url = require('url')
Expand Down Expand Up @@ -817,59 +808,37 @@ <h4 id="stages_item_title" class="stages__item_title"></h3>
process.env.PATH=path.join('/usr/local/bin', path.delimiter, process.env.PATH)
}

setTimeout(function() {
django = child_process.spawn(path.join(global.__dirname,'pgmanage-server/pgmanage-server'),['-A'], { detached: false });
django = child_process.spawn(path.join(global.__dirname,'pgmanage-server/pgmanage-server'),['-A'], { detached: false });

django.stderr.on('data', (data) => {
outputContainer.innerHTML += `<p class="splash__output_text">${data}</p>`
});
django.stderr.on('data', (data) => {
outputContainer.innerHTML += `<p class="splash__output_text">${data}</p>`
});

django.stdout.on('data', (data) => {
lines = data.toString().split('\n');
django.stdout.on('data', (data) => {
lines = data.toString().split('\n');

lines.forEach((line) => {
if(line == '')
return
lines.forEach((line) => {
if(line == '')
return

if (line.substring(0, 4) != 'http') {
let out =`<p class="splash__output_text">${line}</p>`
outputContainer.innerHTML += out
document.getElementById('stages_item_description').innerHTML = ''
if(line.startsWith(' ')) {
document.getElementById('stages_item_description').innerHTML = line
} else {
document.getElementById('stages_item_title').innerHTML = line
}
if (line.substring(0, 4) != 'http') {
let out =`<p class="splash__output_text">${line}</p>`
outputContainer.innerHTML += out
document.getElementById('stages_item_description').innerHTML = ''
if(line.startsWith(' ')) {
document.getElementById('stages_item_description').innerHTML = line
} else {
document.getElementById('stages_item_description').innerHTML = '';
document.getElementById('stages_item_title').innerHTML = 'Opening PGManage...';

(function(value) { setTimeout( function() {
v_loading_data_container.style.display = 'none';
win.setMinimumSize(1024, 768)
initWindowState()
document.getElementById('bar_top').style.display = '';
v_webview.style.display = '';
v_webview.src = value;
}, 500);
})(line);
document.getElementById('stages_item_title').innerHTML = line
}
})
});

},100);

let simulate_startup_list = [
'Initiating phase 1...',
'Phase 1 completed.',
'Initiating phase 2...',
'Phase 2 completed.',
'Loading PGManage...'
];
/*
setTimeout(function(){
simulate_startup(v_window, simulate_startup_list, v_loading_data_container, v_loading_data_content, v_webview);
}, 1100);*/
} else {
document.getElementById('stages_item_description').innerHTML = '';
document.getElementById('stages_item_title').innerHTML = 'Opening PGManage...';

v_webview.src = line;
}
})
});


// GUI controls
function guiMinimize() {
Expand Down
4 changes: 2 additions & 2 deletions deploy/linux/tarbuild/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ cd -
tar -xzvf /deploy/$NWJS_ARCHIVE
mv $NWJS_DIR pgmanage-app_$VERSION
cd pgmanage-app_$VERSION
mkdir pgmanage-server
cp $HOME/pgmanage-server ./pgmanage-server/pgmanage-server

cp -r $HOME/pgmanage-server ./
cp $HOME/process_executor ./pgmanage-server/
# copy index.html .desktop and pgmanage_icon.png to the output dir
cp $HOME/pgmanage/deploy/app/* .
Expand Down
16 changes: 13 additions & 3 deletions pgmanage/pgmanage-lin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,22 @@ pyz = PYZ(a.pure, a.zipped_data,
exe = EXE(pyz,
a.scripts,
[],
a.binaries,
a.zipfiles,
a.datas,
exclude_binaries=True,
name='pgmanage-server',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True )


coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='pgmanage-server',
)