install.js port fix
This commit is contained in:
parent
a51b427c2e
commit
8d408046de
@ -138,22 +138,26 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// DATABASE PORT
|
// DATABASE PORT
|
||||||
let prevPort = $("#port").val();
|
let portField = $("#port");
|
||||||
let prevDbms = $("#type option:selected").val();
|
let typeField = $("#type");
|
||||||
|
|
||||||
|
let prevPort = parseInt(portField.val());
|
||||||
|
let prevDbms = typeField.find("option:selected").val();
|
||||||
function updateDefaultPort() {
|
function updateDefaultPort() {
|
||||||
let defaultPorts = {
|
let defaultPorts = {
|
||||||
"mysql": 3306,
|
"mysql": 3306,
|
||||||
"postgres": 5432
|
"postgres": 5432
|
||||||
};
|
};
|
||||||
|
|
||||||
let curDbms = $("#type option:selected").val();
|
let curDbms = typeField.find("option:selected").val();
|
||||||
if(defaultPorts[prevDbms] === prevPort) {
|
if(defaultPorts[prevDbms] === prevPort) {
|
||||||
$("#port").val(defaultPorts[curDbms]);
|
prevDbms = curDbms;
|
||||||
|
portField.val(prevPort = defaultPorts[curDbms]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDefaultPort();
|
updateDefaultPort();
|
||||||
$("#type").change(function() {
|
typeField.change(function() {
|
||||||
updateDefaultPort();
|
updateDefaultPort();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user