#4076 Access Branches
This commit is contained in:
parent
73a442bc1f
commit
fc84414286
61
src/main.js
61
src/main.js
|
@ -48,7 +48,7 @@ var App = {
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
var width = 420;
|
var width = 420;
|
||||||
var height = 420;
|
var height = 500;
|
||||||
|
|
||||||
window.resizeTo(width, height);
|
window.resizeTo(width, height);
|
||||||
window.moveTo((screen.width - width) / 2, (screen.height - height) / 2);
|
window.moveTo((screen.width - width) / 2, (screen.height - height) / 2);
|
||||||
|
@ -137,6 +137,25 @@ var App = {
|
||||||
this.onEnterClick();
|
this.onEnterClick();
|
||||||
} else
|
} else
|
||||||
this.resetForm(true);
|
this.resetForm(true);
|
||||||
|
|
||||||
|
/* revisar
|
||||||
|
var sql = "SELECT name FROM vn.mdbBranch";
|
||||||
|
mysqlConn.query(sql, function(err, rows, fields) {
|
||||||
|
rows.forEach(function(row) {
|
||||||
|
this.$('branch').add(new Option(row.name));
|
||||||
|
});
|
||||||
|
});*/
|
||||||
|
/*
|
||||||
|
this.$('branch').add(new Option('master','master'));
|
||||||
|
this.$('branch').add(new Option('test','test'));
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
this.$('branch').value = this.getBranch();
|
||||||
|
if(this.$('branch').value != this.getBranch()){
|
||||||
|
this.$('branch').value = 'master';
|
||||||
|
}*/
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetForm: function(clearPassword) {
|
resetForm: function(clearPassword) {
|
||||||
|
@ -223,21 +242,24 @@ var App = {
|
||||||
try {
|
try {
|
||||||
var user = this.$('user').value;
|
var user = this.$('user').value;
|
||||||
var password = this.$('password').value;
|
var password = this.$('password').value;
|
||||||
|
var branch = this.$('branch').value;
|
||||||
|
|
||||||
if (!user || user === '')
|
if (!user || user === '')
|
||||||
throw new Error(_('Enter a user name'));
|
throw new Error(_('Enter a user name'));
|
||||||
if (!password || password === '')
|
if (!password || password === '')
|
||||||
throw new Error(_('Enter a password'));
|
throw new Error(_('Enter a password'));
|
||||||
|
if (!password || password === '')
|
||||||
|
throw new Error(_('Select a branch'));
|
||||||
|
|
||||||
this.regWrite(Conf.dsPath, 'UID', user);
|
this.regWrite(Conf.dsPath, 'UID', user);
|
||||||
this.regWrite(Conf.dsPath, 'PWD', password);
|
this.regWrite(Conf.dsPath, 'PWD', password);
|
||||||
|
|
||||||
var version = this.fetchVersion();
|
var version = this.fetchVersion();
|
||||||
|
|
||||||
if (version !== null) {
|
if (version !== null) {
|
||||||
this.disableUi(true, _('Updating'));
|
this.disableUi(true, _('Updating'));
|
||||||
var remoteFile = version
|
var remoteFile = version
|
||||||
? '.archive/'+ this.module +'/'+ version +'.7z'
|
? '.archive/'+ this.module +'/'+ branch +'/'+ version +'.7z'
|
||||||
: this.module +'.7z?'+ new Date().getTime();
|
: this.module +'.7z?'+ new Date().getTime();
|
||||||
remoteFile = Conf.remoteUrl +'/'+ remoteFile;
|
remoteFile = Conf.remoteUrl +'/'+ remoteFile;
|
||||||
|
|
||||||
|
@ -301,8 +323,14 @@ var App = {
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = "SELECT version FROM versiones WHERE programa = '"+ this.module +"'";
|
// revisar var sql = "SELECT version FROM versiones WHERE programa = '"+ this.module +"'";
|
||||||
|
var sql = "SELECT version " +
|
||||||
|
" FROM vn.mdbVersion " +
|
||||||
|
" WHERE app = '"+ this.module +"' " +
|
||||||
|
" AND branchFk = '" + this.$('branch').value + "'";
|
||||||
|
// var sql = "SELECT version FROM versiones WHERE programa = '"+ this.module +"'";
|
||||||
|
|
||||||
var rs = mysqlConn.execute(sql);
|
var rs = mysqlConn.execute(sql);
|
||||||
|
|
||||||
var version = rs.EOF ? false : parseInt(rs.fields(0).value);
|
var version = rs.EOF ? false : parseInt(rs.fields(0).value);
|
||||||
|
@ -528,6 +556,29 @@ var App = {
|
||||||
try {
|
try {
|
||||||
this.shell.regDelete(path);
|
this.shell.regDelete(path);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Gets information about the branch config in access
|
||||||
|
*
|
||||||
|
* @return {string} Branch name, master if cannot
|
||||||
|
*/
|
||||||
|
getBranch: function() {
|
||||||
|
|
||||||
|
var branch = 'master';
|
||||||
|
try {
|
||||||
|
var mdbConn = new ActiveXObject('ADODB.Connection');
|
||||||
|
mdbConn.open(this.getOdbcString({
|
||||||
|
'Provider': 'Microsoft.Jet.OLEDB.4.0',
|
||||||
|
'Data Source': this.mdbFile
|
||||||
|
}));
|
||||||
|
|
||||||
|
var rs = new ActiveXObject('ADODB.Recordset');
|
||||||
|
rs.Open('SELECT branch FROM tblVariables', mdbConn);
|
||||||
|
branch = String(rs('branch'));
|
||||||
|
rs.close();
|
||||||
|
mdbConn.close();
|
||||||
|
} catch (e) {}
|
||||||
|
return branch;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,13 @@
|
||||||
alt="Verdnatura"/>
|
alt="Verdnatura"/>
|
||||||
<div id="fields">
|
<div id="fields">
|
||||||
<div id="inputs">
|
<div id="inputs">
|
||||||
|
<div>
|
||||||
|
<label for="branch">Branch</label>
|
||||||
|
<select id="branch" >
|
||||||
|
<option>master</option>
|
||||||
|
<option>test</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="user">Usuario</label>
|
<label for="user">Usuario</label>
|
||||||
<input id="user" type="text"/>
|
<input id="user" type="text"/>
|
||||||
|
@ -40,6 +47,7 @@
|
||||||
<label for="password">Contraseña</label>
|
<label for="password">Contraseña</label>
|
||||||
<input id="password" type="password"/>
|
<input id="password" type="password"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="checkbox">
|
<div id="checkbox">
|
||||||
<input id="remember" type="checkbox"/>
|
<input id="remember" type="checkbox"/>
|
||||||
|
|
Loading…
Reference in New Issue