code cleanup with eslint and checkstyle
This commit is contained in:
parent
9afd19be0a
commit
cccd722f44
28
extensions/database/.eslintrc.json
Normal file
28
extensions/database/.eslintrc.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"double"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -20,10 +20,16 @@
|
|||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
<nature>ch.acanda.eclipse.pmd.builder.PMDNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
This project is an extension for Google Refine that provides a way to import database data using JDBC.
|
This project is an extension for OpenRefine that provides a way to import database data using JDBC.
|
||||||
|
|
||||||
|
|
||||||
INSTALL
|
INSTALL
|
||||||
|
|
||||||
1. Before installing this extension download Google Refine code from http://code.google.com/p/google-refine/source/checkout.
|
1. Before installing this extension download OpenRefine code from http://code.google.com/p/google-refine/source/checkout.
|
||||||
|
|
||||||
2. Pull this extension's code into folder database under folder /extensions.
|
2. Pull this extension's code into folder database under folder /extensions.
|
||||||
For more information on how to write a Google Refine extensions and where to put the files see http://code.google.com/p/google-refine/wiki/WriteAnExtension
|
For more information on how to write a OpenRefine extensions and where to put the files see http://code.google.com/p/google-refine/wiki/WriteAnExtension
|
||||||
|
|
||||||
The folder structure should resemble this:
|
The folder structure should resemble this:
|
||||||
grefine-all/
|
grefine-all/
|
||||||
|
@ -1,34 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Tony Opara
|
||||||
Copyright 2010, Google Inc.
|
* All rights reserved.
|
||||||
All rights reserved.
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
||||||
modification, are permitted provided that the following conditions are
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
met:
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* Redistributions of source code must retain the above copyright
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
notice, this list of conditions and the following disclaimer.
|
* and/or other materials provided with the distribution.
|
||||||
* Redistributions in binary form must reproduce the above
|
*
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
in the documentation and/or other materials provided with the
|
* endorse or promote products derived from this software without specific
|
||||||
distribution.
|
* prior written permission.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
*
|
||||||
contributors may be used to endorse or promote products derived from
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
this software without specific prior written permission.
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -63,11 +59,11 @@ function registerCommands() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function registerOperations() {
|
function registerOperations() {
|
||||||
logger.info("Database Operations Registered successfully...");
|
logger.info("Database Operations Registered successfully...");
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerFunctions() {
|
function registerFunctions() {
|
||||||
logger.info("Database Functions Registered successfully...");
|
logger.info("Database Functions Registered successfully...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,8 +108,8 @@ function init() {
|
|||||||
module,
|
module,
|
||||||
[
|
[
|
||||||
"styles/jquery.contextMenu.css",
|
"styles/jquery.contextMenu.css",
|
||||||
"styles/pure.css",
|
"styles/pure.css",
|
||||||
"styles/bootstrap.css",
|
"styles/bootstrap.css",
|
||||||
"styles/database-import.less"
|
"styles/database-import.less"
|
||||||
|
|
||||||
]
|
]
|
||||||
@ -134,13 +130,13 @@ function init() {
|
|||||||
* Function invoked to handle each request in a custom way.
|
* Function invoked to handle each request in a custom way.
|
||||||
*/
|
*/
|
||||||
function process(path, request, response) {
|
function process(path, request, response) {
|
||||||
|
|
||||||
|
|
||||||
var method = request.getMethod();
|
var method = request.getMethod();
|
||||||
|
|
||||||
logger.info('receiving request for ' + path);
|
logger.info('receiving request for ' + path);
|
||||||
logger.info('receiving method for ' + method);
|
logger.info('receiving method for ' + method);
|
||||||
|
|
||||||
if (path == "/" || path == "") {
|
if (path == "/" || path == "") {
|
||||||
var context = {};
|
var context = {};
|
||||||
context.version = version;
|
context.version = version;
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
*#
|
*#
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Google Refine Database Extension v$version</title>
|
<title>OpenRefine Database Extension v$version</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Google Refine DATABASE Extension v$version</h1>
|
<h1>OpenRefine DATABASE Extension v$version</h1>
|
||||||
<h2>by Tony O <tcbuzor@gmail.com></h2>
|
<h2>by Tony Opara <tcbuzor@gmail.com></h2>
|
||||||
<p>The JDBC extension allows OpenRefine to read
|
<p>The JDBC extension allows OpenRefine to read
|
||||||
(and write, soon) data from JDBC compatible databases(MySQL, PostgreSQL, Oracle).
|
(and write, soon) data from JDBC compatible databases(MySQL, PostgreSQL, MariaDB).
|
||||||
</p>
|
</p>
|
||||||
<h3>Known Limitations</h3>
|
<h3>Known Limitations</h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -1,35 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Tony Opara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
|
* endorse or promote products derived from this software without specific
|
||||||
|
* prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright 2010, Google Inc.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
|
||||||
in the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
* Neither the name of Google Inc. nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$.contextMenu({
|
$.contextMenu({
|
||||||
selector: '.context-menu-one',
|
selector: '.context-menu-one',
|
||||||
@ -61,146 +58,140 @@ var DatabaseExtension = {};
|
|||||||
DatabaseExtension.currentConnection = {};
|
DatabaseExtension.currentConnection = {};
|
||||||
|
|
||||||
DatabaseExtension.handleSavedConnectionClicked = function(menuKey, connectionName) {
|
DatabaseExtension.handleSavedConnectionClicked = function(menuKey, connectionName) {
|
||||||
var jdbcConnectionInfo = {};
|
var jdbcConnectionInfo = {};
|
||||||
jdbcConnectionInfo.connectionName = connectionName;
|
jdbcConnectionInfo.connectionName = connectionName;
|
||||||
|
|
||||||
if(menuKey == "edit"){
|
if(menuKey === "edit"){
|
||||||
DatabaseExtension.handleEditConnectionClicked(connectionName);
|
DatabaseExtension.handleEditConnectionClicked(connectionName);
|
||||||
|
|
||||||
}else if(menuKey == "delete"){
|
}else if(menuKey === "delete"){
|
||||||
DatabaseExtension.handleDeleteConnectionClicked(connectionName);
|
DatabaseExtension.handleDeleteConnectionClicked(connectionName);
|
||||||
|
|
||||||
}else if(menuKey == "connect"){
|
}else if(menuKey === "connect"){
|
||||||
DatabaseExtension.handleConnectClicked(connectionName);
|
DatabaseExtension.handleConnectClicked(connectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DatabaseExtension.handleConnectClicked = function(connectionName) {
|
DatabaseExtension.handleConnectClicked = function(connectionName) {
|
||||||
|
|
||||||
$.get(
|
$.get(
|
||||||
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
||||||
null,
|
null,
|
||||||
|
|
||||||
function(savedDatabaseConfig) {
|
function(savedDatabaseConfig) {
|
||||||
|
|
||||||
if(savedDatabaseConfig){
|
if(savedDatabaseConfig){
|
||||||
|
|
||||||
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
||||||
var databaseConfig = {};
|
var databaseConfig = {};
|
||||||
databaseConfig.connectionName = savedConfig.connectionName;
|
databaseConfig.connectionName = savedConfig.connectionName;
|
||||||
databaseConfig.databaseType = savedConfig.databaseType;
|
databaseConfig.databaseType = savedConfig.databaseType;
|
||||||
databaseConfig.databaseServer = savedConfig.databaseHost;
|
databaseConfig.databaseServer = savedConfig.databaseHost;
|
||||||
databaseConfig.databasePort = savedConfig.databasePort;
|
databaseConfig.databasePort = savedConfig.databasePort;
|
||||||
databaseConfig.databaseUser = savedConfig.databaseUser;
|
databaseConfig.databaseUser = savedConfig.databaseUser;
|
||||||
databaseConfig.databasePassword = savedConfig.databasePassword;
|
databaseConfig.databasePassword = savedConfig.databasePassword;
|
||||||
databaseConfig.initialDatabase = savedConfig.databaseName;
|
databaseConfig.initialDatabase = savedConfig.databaseName;
|
||||||
databaseConfig.initialSchema = savedConfig.databaseSchema;
|
databaseConfig.initialSchema = savedConfig.databaseSchema;
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
"command/database/connect",
|
"command/database/connect",
|
||||||
databaseConfig,
|
databaseConfig,
|
||||||
|
|
||||||
function(databaseInfo) {
|
function(databaseInfo) {
|
||||||
|
|
||||||
if(databaseInfo){
|
if(databaseInfo){
|
||||||
DatabaseExtension.currentConnection.databaseInfo;
|
DatabaseExtension.currentConnection.databaseInfo;
|
||||||
$( "#currentConnectionNameInput" ).val(databaseConfig.connectionName);
|
$( "#currentConnectionNameInput" ).val(databaseConfig.connectionName);
|
||||||
$( "#currentDatabaseTypeInput" ).val(databaseConfig.databaseType);
|
$( "#currentDatabaseTypeInput" ).val(databaseConfig.databaseType);
|
||||||
$( "#currentDatabaseUserInput" ).val(databaseConfig.databaseUser);
|
$( "#currentDatabaseUserInput" ).val(databaseConfig.databaseUser);
|
||||||
$( "#currentDatabasePasswordInput" ).val(databaseConfig.databasePassword);
|
$( "#currentDatabasePasswordInput" ).val(databaseConfig.databasePassword);
|
||||||
$( "#currentDatabaseHostInput" ).val(databaseConfig.databaseServer);
|
$( "#currentDatabaseHostInput" ).val(databaseConfig.databaseServer);
|
||||||
$( "#currentDatabasePortInput" ).val(databaseConfig.databasePort);
|
$( "#currentDatabasePortInput" ).val(databaseConfig.databasePort);
|
||||||
$( "#currentInitialDatabaseInput" ).val(databaseConfig.initialDatabase);
|
$( "#currentInitialDatabaseInput" ).val(databaseConfig.initialDatabase);
|
||||||
|
|
||||||
var connectionParam = "Connection[" + databaseConfig.connectionName + "] :: "
|
var connectionParam = "Connection[" + databaseConfig.connectionName + "] :: "
|
||||||
+ "jdbc:"
|
+ "jdbc:"
|
||||||
+ databaseConfig.databaseType + "://"
|
+ databaseConfig.databaseType + "://"
|
||||||
+ databaseConfig.databaseServer + ":"
|
+ databaseConfig.databaseServer + ":"
|
||||||
+ databaseConfig.databasePort + "/"
|
+ databaseConfig.databasePort + "/"
|
||||||
+ databaseConfig.initialDatabase;
|
+ databaseConfig.initialDatabase;
|
||||||
|
|
||||||
$( "#connectionParameterSpan" ).text(connectionParam);
|
$( "#connectionParameterSpan" ).text(connectionParam);
|
||||||
$( "#newConnectionDiv" ).hide();
|
$( "#newConnectionDiv" ).hide();
|
||||||
$( "#sqlEditorDiv" ).show();
|
$( "#sqlEditorDiv" ).show();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
window.alert("Unable to establish connection to database");
|
window.alert("Unable to establish connection to database");
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||||
alert( textStatus + ':' + errorThrown );
|
alert( textStatus + ':' + errorThrown );
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DatabaseExtension.handleDeleteConnectionClicked = function(connectionName) {
|
DatabaseExtension.handleDeleteConnectionClicked = function(connectionName) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'command/database/saved-connection' + '?' + $.param({"connectionName": connectionName}),
|
url: 'command/database/saved-connection' + '?' + $.param({"connectionName": connectionName}),
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
contentType:'application/json',
|
contentType:'application/json',
|
||||||
data: null,
|
data: null,
|
||||||
success: function(settings) {
|
success: function(settings) {
|
||||||
if(settings){
|
if(settings){
|
||||||
|
|
||||||
$( "#menuListUl" ).empty();
|
$( "#menuListUl" ).empty();
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(settings.savedConnections,function(index,savedConnection){
|
$.each(settings.savedConnections,function(index,savedConnection){
|
||||||
|
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||||
// items.push('<li class="context-menu-one pure-menu-item"><a href="#" class="pure-menu-link">'
|
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||||
// + savedConnection.connectionName
|
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||||
// + '</a></li>');
|
})
|
||||||
|
|
||||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
$( "#menuListUl" ).append(items.join(''));
|
||||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
}
|
||||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
}
|
||||||
})
|
}).fail(function( jqXhr, textStatus, errorThrown ){
|
||||||
|
|
||||||
$( "#menuListUl" ).append(items.join(''));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).fail(function( jqXhr, textStatus, errorThrown ){
|
|
||||||
alert( textStatus + ':' + errorThrown );
|
alert( textStatus + ':' + errorThrown );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseExtension.handleEditConnectionClicked = function(connectionName) {
|
DatabaseExtension.handleEditConnectionClicked = function(connectionName) {
|
||||||
|
|
||||||
$.get(
|
$.get(
|
||||||
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
||||||
null,
|
null,
|
||||||
function(savedDatabaseConfig) {
|
function(savedDatabaseConfig) {
|
||||||
|
|
||||||
if(savedDatabaseConfig){
|
if(savedDatabaseConfig){
|
||||||
|
|
||||||
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
||||||
$( "#connectionName" ).val(savedConfig.connectionName);
|
$( "#connectionName" ).val(savedConfig.connectionName);
|
||||||
$( "#databaseTypeSelect" ).val(savedConfig.databaseType);
|
$( "#databaseTypeSelect" ).val(savedConfig.databaseType);
|
||||||
$( "#databaseHost" ).val(savedConfig.databaseHost);
|
$( "#databaseHost" ).val(savedConfig.databaseHost);
|
||||||
$( "#databasePort" ).val(savedConfig.databasePort);
|
$( "#databasePort" ).val(savedConfig.databasePort);
|
||||||
$( "#databaseUser" ).val(savedConfig.databaseUser);
|
$( "#databaseUser" ).val(savedConfig.databaseUser);
|
||||||
$( "#databasePassword" ).val(savedConfig.databasePassword);
|
$( "#databasePassword" ).val(savedConfig.databasePassword);
|
||||||
$( "#initialDatabase" ).val(savedConfig.databaseName);
|
$( "#initialDatabase" ).val(savedConfig.databaseName);
|
||||||
$( "#initialSchema" ).val(savedConfig.databaseSchema);
|
$( "#initialSchema" ).val(savedConfig.databaseSchema);
|
||||||
$( "#newConnectionControlDiv" ).hide();
|
$( "#newConnectionControlDiv" ).hide();
|
||||||
$( "#editConnectionControlDiv" ).show();
|
$( "#editConnectionControlDiv" ).show();
|
||||||
$( "#newConnectionDiv" ).show();
|
$( "#newConnectionDiv" ).show();
|
||||||
$('#sqlEditorDiv').hide();
|
$('#sqlEditorDiv').hide();
|
||||||
$("#connectionName").attr('readonly', 'readonly');
|
$("#connectionName").attr('readonly', 'readonly');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,50 +1,46 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Tony Opara
|
||||||
Copyright 2011, Google Inc.
|
* All rights reserved.
|
||||||
All rights reserved.
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
||||||
modification, are permitted provided that the following conditions are
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
met:
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* Redistributions of source code must retain the above copyright
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
notice, this list of conditions and the following disclaimer.
|
* and/or other materials provided with the distribution.
|
||||||
* Redistributions in binary form must reproduce the above
|
*
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
in the documentation and/or other materials provided with the
|
* endorse or promote products derived from this software without specific
|
||||||
distribution.
|
* prior written permission.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
*
|
||||||
contributors may be used to endorse or promote products derived from
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
this software without specific prior written permission.
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Internationalization init
|
//Internationalization init
|
||||||
var lang = navigator.language.split("-")[0]
|
var lang = navigator.language.split("-")[0]
|
||||||
|| navigator.userLanguage.split("-")[0];
|
|| navigator.userLanguage.split("-")[0];
|
||||||
var dictionary = "";
|
var dictionary = "";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "command/core/load-language?",
|
url : "command/core/load-language?",
|
||||||
type : "POST",
|
type : "POST",
|
||||||
async : false,
|
async : false,
|
||||||
data : {
|
data : {
|
||||||
module : "database",
|
module : "database",
|
||||||
},
|
},
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
dictionary = data;
|
dictionary = data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.i18n.setDictionary(dictionary);
|
$.i18n.setDictionary(dictionary);
|
||||||
// End internationalization
|
// End internationalization
|
||||||
@ -64,312 +60,312 @@ Refine.DatabaseImportController = function(createProjectUI) {
|
|||||||
Refine.CreateProjectUI.controllers.push(Refine.DatabaseImportController);
|
Refine.CreateProjectUI.controllers.push(Refine.DatabaseImportController);
|
||||||
|
|
||||||
Refine.DatabaseImportController.prototype.startImportingDocument = function(queryInfo) {
|
Refine.DatabaseImportController.prototype.startImportingDocument = function(queryInfo) {
|
||||||
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["preparing"]);
|
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["preparing"]);
|
||||||
//alert(queryInfo.query);
|
//alert(queryInfo.query);
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/create-importing-job",
|
"command/core/create-importing-job",
|
||||||
null,
|
null,
|
||||||
function(data) {
|
function(data) {
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/importing-controller?" + $.param({
|
"command/core/importing-controller?" + $.param({
|
||||||
"controller": "database/database-import-controller",
|
"controller": "database/database-import-controller",
|
||||||
"subCommand": "initialize-parser-ui"
|
"subCommand": "initialize-parser-ui"
|
||||||
}),
|
}),
|
||||||
queryInfo,
|
queryInfo,
|
||||||
|
|
||||||
function(data2) {
|
function(data2) {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
||||||
if (data2.status == 'ok') {
|
if (data2.status == 'ok') {
|
||||||
self._queryInfo = queryInfo;
|
self._queryInfo = queryInfo;
|
||||||
self._jobID = data.jobID;
|
self._jobID = data.jobID;
|
||||||
self._options = data2.options;
|
self._options = data2.options;
|
||||||
|
|
||||||
self._showParsingPanel();
|
self._showParsingPanel();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
alert(data2.message);
|
alert(data2.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseImportController.prototype.getOptions = function() {
|
Refine.DatabaseImportController.prototype.getOptions = function() {
|
||||||
var options = {
|
var options = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var parseIntDefault = function(s, def) {
|
var parseIntDefault = function(s, def) {
|
||||||
try {
|
try {
|
||||||
var n = parseInt(s);
|
var n = parseInt(s);
|
||||||
if (!isNaN(n)) {
|
if (!isNaN(n)) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
return def;
|
return def;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (this._parsingPanelElmts.skipCheckbox[0].checked) {
|
if (this._parsingPanelElmts.skipCheckbox[0].checked) {
|
||||||
options.skipDataLines = parseIntDefault(this._parsingPanelElmts.skipInput[0].value, 0);
|
options.skipDataLines = parseIntDefault(this._parsingPanelElmts.skipInput[0].value, 0);
|
||||||
} else {
|
} else {
|
||||||
options.skipDataLines = 0;
|
options.skipDataLines = 0;
|
||||||
}
|
}
|
||||||
if (this._parsingPanelElmts.limitCheckbox[0].checked) {
|
if (this._parsingPanelElmts.limitCheckbox[0].checked) {
|
||||||
options.limit = parseIntDefault(this._parsingPanelElmts.limitInput[0].value, -1);
|
options.limit = parseIntDefault(this._parsingPanelElmts.limitInput[0].value, -1);
|
||||||
} else {
|
} else {
|
||||||
options.limit = -1;
|
options.limit = -1;
|
||||||
}
|
}
|
||||||
options.storeBlankRows = this._parsingPanelElmts.storeBlankRowsCheckbox[0].checked;
|
options.storeBlankRows = this._parsingPanelElmts.storeBlankRowsCheckbox[0].checked;
|
||||||
options.storeBlankCellsAsNulls = this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox[0].checked;
|
options.storeBlankCellsAsNulls = this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox[0].checked;
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseImportController.prototype._showParsingPanel = function() {
|
Refine.DatabaseImportController.prototype._showParsingPanel = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this._parsingPanel.unbind().empty().html(
|
this._parsingPanel.unbind().empty().html(
|
||||||
DOM.loadHTML("database",'scripts/index/database-parsing-panel.html'));
|
DOM.loadHTML("database",'scripts/index/database-parsing-panel.html'));
|
||||||
|
|
||||||
this._parsingPanelElmts = DOM.bind(this._parsingPanel);
|
this._parsingPanelElmts = DOM.bind(this._parsingPanel);
|
||||||
|
|
||||||
this._parsingPanelElmts.startOverButton.html($.i18n._('database-parsing')["start-over"]);
|
this._parsingPanelElmts.startOverButton.html($.i18n._('database-parsing')["start-over"]);
|
||||||
this._parsingPanelElmts.database_conf_pars.html($.i18n._('database-parsing')["conf-pars"]);
|
this._parsingPanelElmts.database_conf_pars.html($.i18n._('database-parsing')["conf-pars"]);
|
||||||
this._parsingPanelElmts.database_proj_name.html($.i18n._('database-parsing')["proj-name"]);
|
this._parsingPanelElmts.database_proj_name.html($.i18n._('database-parsing')["proj-name"]);
|
||||||
this._parsingPanelElmts.createProjectButton.html($.i18n._('database-parsing')["create-proj"]);
|
this._parsingPanelElmts.createProjectButton.html($.i18n._('database-parsing')["create-proj"]);
|
||||||
this._parsingPanelElmts.database_options.html($.i18n._('database-parsing')["option"]);
|
this._parsingPanelElmts.database_options.html($.i18n._('database-parsing')["option"]);
|
||||||
this._parsingPanelElmts.previewButton.html($.i18n._('database-parsing')["preview-button"]);
|
this._parsingPanelElmts.previewButton.html($.i18n._('database-parsing')["preview-button"]);
|
||||||
this._parsingPanelElmts.database_updating.html($.i18n._('database-parsing')["updating-preview"]);
|
this._parsingPanelElmts.database_updating.html($.i18n._('database-parsing')["updating-preview"]);
|
||||||
this._parsingPanelElmts.database_discard_next.html($.i18n._('database-parsing')["discard-next"]);
|
this._parsingPanelElmts.database_discard_next.html($.i18n._('database-parsing')["discard-next"]);
|
||||||
this._parsingPanelElmts.database_discard.html($.i18n._('database-parsing')["discard"]);
|
this._parsingPanelElmts.database_discard.html($.i18n._('database-parsing')["discard"]);
|
||||||
this._parsingPanelElmts.database_limit_next.html($.i18n._('database-parsing')["limit-next"]);
|
this._parsingPanelElmts.database_limit_next.html($.i18n._('database-parsing')["limit-next"]);
|
||||||
this._parsingPanelElmts.database_limit.html($.i18n._('database-parsing')["limit"]);
|
this._parsingPanelElmts.database_limit.html($.i18n._('database-parsing')["limit"]);
|
||||||
this._parsingPanelElmts.database_store_row.html($.i18n._('database-parsing')["store-row"]);
|
this._parsingPanelElmts.database_store_row.html($.i18n._('database-parsing')["store-row"]);
|
||||||
this._parsingPanelElmts.database_store_cell.html($.i18n._('database-parsing')["store-cell"]);
|
this._parsingPanelElmts.database_store_cell.html($.i18n._('database-parsing')["store-cell"]);
|
||||||
|
|
||||||
if (this._parsingPanelResizer) {
|
if (this._parsingPanelResizer) {
|
||||||
$(window).unbind('resize', this._parsingPanelResizer);
|
$(window).unbind('resize', this._parsingPanelResizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._parsingPanelResizer = function() {
|
this._parsingPanelResizer = function() {
|
||||||
var elmts = self._parsingPanelElmts;
|
var elmts = self._parsingPanelElmts;
|
||||||
var width = self._parsingPanel.width();
|
var width = self._parsingPanel.width();
|
||||||
var height = self._parsingPanel.height();
|
var height = self._parsingPanel.height();
|
||||||
var headerHeight = elmts.wizardHeader.outerHeight(true);
|
var headerHeight = elmts.wizardHeader.outerHeight(true);
|
||||||
var controlPanelHeight = 250;
|
var controlPanelHeight = 250;
|
||||||
|
|
||||||
elmts.dataPanel
|
elmts.dataPanel
|
||||||
.css("left", "0px")
|
.css("left", "0px")
|
||||||
.css("top", headerHeight + "px")
|
.css("top", headerHeight + "px")
|
||||||
.css("width", (width - DOM.getHPaddings(elmts.dataPanel)) + "px")
|
.css("width", (width - DOM.getHPaddings(elmts.dataPanel)) + "px")
|
||||||
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.dataPanel)) + "px");
|
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.dataPanel)) + "px");
|
||||||
elmts.progressPanel
|
elmts.progressPanel
|
||||||
.css("left", "0px")
|
.css("left", "0px")
|
||||||
.css("top", headerHeight + "px")
|
.css("top", headerHeight + "px")
|
||||||
.css("width", (width - DOM.getHPaddings(elmts.progressPanel)) + "px")
|
.css("width", (width - DOM.getHPaddings(elmts.progressPanel)) + "px")
|
||||||
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.progressPanel)) + "px");
|
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.progressPanel)) + "px");
|
||||||
|
|
||||||
elmts.controlPanel
|
elmts.controlPanel
|
||||||
.css("left", "0px")
|
.css("left", "0px")
|
||||||
.css("top", (height - controlPanelHeight) + "px")
|
.css("top", (height - controlPanelHeight) + "px")
|
||||||
.css("width", (width - DOM.getHPaddings(elmts.controlPanel)) + "px")
|
.css("width", (width - DOM.getHPaddings(elmts.controlPanel)) + "px")
|
||||||
.css("height", (controlPanelHeight - DOM.getVPaddings(elmts.controlPanel)) + "px");
|
.css("height", (controlPanelHeight - DOM.getVPaddings(elmts.controlPanel)) + "px");
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).resize(this._parsingPanelResizer);
|
$(window).resize(this._parsingPanelResizer);
|
||||||
this._parsingPanelResizer();
|
this._parsingPanelResizer();
|
||||||
|
|
||||||
this._parsingPanelElmts.startOverButton.click(function() {
|
this._parsingPanelElmts.startOverButton.click(function() {
|
||||||
// explicitly cancel the import job
|
// explicitly cancel the import job
|
||||||
Refine.CreateProjectUI.cancelImportingJob(self._jobID);
|
Refine.CreateProjectUI.cancelImportingJob(self._jobID);
|
||||||
|
|
||||||
delete self._jobID;
|
delete self._jobID;
|
||||||
delete self._options;
|
delete self._options;
|
||||||
|
|
||||||
self._createProjectUI.showSourceSelectionPanel();
|
self._createProjectUI.showSourceSelectionPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
this._parsingPanelElmts.createProjectButton.click(function() { self._createProject(); });
|
this._parsingPanelElmts.createProjectButton.click(function() { self._createProject(); });
|
||||||
this._parsingPanelElmts.previewButton.click(function() { self._updatePreview(); });
|
this._parsingPanelElmts.previewButton.click(function() { self._updatePreview(); });
|
||||||
//alert("datetime::" + $.now());
|
//alert("datetime::" + $.now());
|
||||||
//this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.connectionName + "_" + this._queryInfo.databaseUser + "_" + $.now();
|
//this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.connectionName + "_" + this._queryInfo.databaseUser + "_" + $.now();
|
||||||
this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.databaseServer + "_" + this._queryInfo.initialDatabase + "_" + $.now();
|
this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.databaseServer + "_" + this._queryInfo.initialDatabase + "_" + $.now();
|
||||||
|
|
||||||
|
|
||||||
if (this._options.limit > 0) {
|
if (this._options.limit > 0) {
|
||||||
this._parsingPanelElmts.limitCheckbox.prop("checked", true);
|
this._parsingPanelElmts.limitCheckbox.prop("checked", true);
|
||||||
this._parsingPanelElmts.limitInput[0].value = this._options.limit.toString();
|
this._parsingPanelElmts.limitInput[0].value = this._options.limit.toString();
|
||||||
}
|
}
|
||||||
if (this._options.skipDataLines > 0) {
|
if (this._options.skipDataLines > 0) {
|
||||||
this._parsingPanelElmts.skipCheckbox.prop("checked", true);
|
this._parsingPanelElmts.skipCheckbox.prop("checked", true);
|
||||||
this._parsingPanelElmts.skipInput.value[0].value = this._options.skipDataLines.toString();
|
this._parsingPanelElmts.skipInput.value[0].value = this._options.skipDataLines.toString();
|
||||||
}
|
}
|
||||||
if (this._options.storeBlankRows) {
|
if (this._options.storeBlankRows) {
|
||||||
this._parsingPanelElmts.storeBlankRowsCheckbox.prop("checked", true);
|
this._parsingPanelElmts.storeBlankRowsCheckbox.prop("checked", true);
|
||||||
}
|
}
|
||||||
if (this._options.storeBlankCellsAsNulls) {
|
if (this._options.storeBlankCellsAsNulls) {
|
||||||
this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox.prop("checked", true);
|
this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox.prop("checked", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var onChange = function() {
|
var onChange = function() {
|
||||||
self._scheduleUpdatePreview();
|
self._scheduleUpdatePreview();
|
||||||
};
|
};
|
||||||
this._parsingPanel.find("input").bind("change", onChange);
|
this._parsingPanel.find("input").bind("change", onChange);
|
||||||
this._parsingPanel.find("select").bind("change", onChange);
|
this._parsingPanel.find("select").bind("change", onChange);
|
||||||
|
|
||||||
this._createProjectUI.showCustomPanel(this._parsingPanel);
|
this._createProjectUI.showCustomPanel(this._parsingPanel);
|
||||||
this._updatePreview();
|
this._updatePreview();
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseImportController.prototype._scheduleUpdatePreview = function() {
|
Refine.DatabaseImportController.prototype._scheduleUpdatePreview = function() {
|
||||||
if (this._timerID != null) {
|
if (this._timerID != null) {
|
||||||
window.clearTimeout(this._timerID);
|
window.clearTimeout(this._timerID);
|
||||||
this._timerID = null;
|
this._timerID = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this._timerID = window.setTimeout(function() {
|
this._timerID = window.setTimeout(function() {
|
||||||
self._timerID = null;
|
self._timerID = null;
|
||||||
self._updatePreview();
|
self._updatePreview();
|
||||||
}, 500); // 0.5 second
|
}, 500); // 0.5 second
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseImportController.prototype._updatePreview = function() {
|
Refine.DatabaseImportController.prototype._updatePreview = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
// alert("query::" + this._queryInfo.query);
|
// alert("query::" + this._queryInfo.query);
|
||||||
this._parsingPanelElmts.dataPanel.hide();
|
this._parsingPanelElmts.dataPanel.hide();
|
||||||
this._parsingPanelElmts.progressPanel.show();
|
this._parsingPanelElmts.progressPanel.show();
|
||||||
this._queryInfo.options = JSON.stringify(this.getOptions());
|
this._queryInfo.options = JSON.stringify(this.getOptions());
|
||||||
//alert("options:" + this._queryInfo.options);
|
//alert("options:" + this._queryInfo.options);
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/importing-controller?" + $.param({
|
"command/core/importing-controller?" + $.param({
|
||||||
"controller": "database/database-import-controller",
|
"controller": "database/database-import-controller",
|
||||||
"jobID": this._jobID,
|
"jobID": this._jobID,
|
||||||
"subCommand": "parse-preview"
|
"subCommand": "parse-preview"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
this._queryInfo,
|
this._queryInfo,
|
||||||
|
|
||||||
function(result) {
|
function(result) {
|
||||||
if (result.status == "ok") {
|
if (result.status == "ok") {
|
||||||
self._getPreviewData(function(projectData) {
|
self._getPreviewData(function(projectData) {
|
||||||
self._parsingPanelElmts.progressPanel.hide();
|
self._parsingPanelElmts.progressPanel.hide();
|
||||||
self._parsingPanelElmts.dataPanel.show();
|
self._parsingPanelElmts.dataPanel.show();
|
||||||
|
|
||||||
new Refine.PreviewTable(projectData, self._parsingPanelElmts.dataPanel.unbind().empty());
|
new Refine.PreviewTable(projectData, self._parsingPanelElmts.dataPanel.unbind().empty());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
alert(result.message);
|
alert(result.message);
|
||||||
//self._parsingPanelElmts.progressPanel.hide();
|
//self._parsingPanelElmts.progressPanel.hide();
|
||||||
alert('Errors:\n' +
|
alert('Errors:\n' +
|
||||||
(result.message) ? result.message : Refine.CreateProjectUI.composeErrorMessage(job));
|
(result.message) ? result.message : Refine.CreateProjectUI.composeErrorMessage(job));
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseImportController.prototype._getPreviewData = function(callback, numRows) {
|
Refine.DatabaseImportController.prototype._getPreviewData = function(callback, numRows) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var result = {};
|
var result = {};
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/get-models?" + $.param({ "importingJobID" : this._jobID }),
|
"command/core/get-models?" + $.param({ "importingJobID" : this._jobID }),
|
||||||
null,
|
null,
|
||||||
function(data) {
|
function(data) {
|
||||||
for (var n in data) {
|
for (var n in data) {
|
||||||
if (data.hasOwnProperty(n)) {
|
if (data.hasOwnProperty(n)) {
|
||||||
result[n] = data[n];
|
result[n] = data[n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/get-rows?" + $.param({
|
"command/core/get-rows?" + $.param({
|
||||||
"importingJobID" : self._jobID,
|
"importingJobID" : self._jobID,
|
||||||
"start" : 0,
|
"start" : 0,
|
||||||
"limit" : numRows || 100 // More than we parse for preview anyway
|
"limit" : numRows || 100 // More than we parse for preview anyway
|
||||||
}),
|
}),
|
||||||
null,
|
null,
|
||||||
function(data) {
|
function(data) {
|
||||||
result.rowModel = data;
|
result.rowModel = data;
|
||||||
callback(result);
|
callback(result);
|
||||||
},
|
},
|
||||||
"jsonp"
|
"jsonp"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseImportController.prototype._createProject = function() {
|
Refine.DatabaseImportController.prototype._createProject = function() {
|
||||||
var projectName = $.trim(this._parsingPanelElmts.projectNameInput[0].value);
|
var projectName = $.trim(this._parsingPanelElmts.projectNameInput[0].value);
|
||||||
if (projectName.length == 0) {
|
if (projectName.length == 0) {
|
||||||
window.alert("Please name the project.");
|
window.alert("Please name the project.");
|
||||||
this._parsingPanelElmts.projectNameInput.focus();
|
this._parsingPanelElmts.projectNameInput.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var options = this.getOptions();
|
var options = this.getOptions();
|
||||||
options.projectName = projectName;
|
options.projectName = projectName;
|
||||||
|
|
||||||
this._queryInfo.options = JSON.stringify(options);
|
this._queryInfo.options = JSON.stringify(options);
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/importing-controller?" + $.param({
|
"command/core/importing-controller?" + $.param({
|
||||||
"controller": "database/database-import-controller",
|
"controller": "database/database-import-controller",
|
||||||
"jobID": this._jobID,
|
"jobID": this._jobID,
|
||||||
"subCommand": "create-project"
|
"subCommand": "create-project"
|
||||||
}),
|
}),
|
||||||
this._queryInfo,
|
this._queryInfo,
|
||||||
function(o) {
|
function(o) {
|
||||||
if (o.status == 'error') {
|
if (o.status == 'error') {
|
||||||
alert(o.message);
|
alert(o.message);
|
||||||
} else {
|
} else {
|
||||||
var start = new Date();
|
var start = new Date();
|
||||||
var timerID = window.setInterval(
|
var timerID = window.setInterval(
|
||||||
function() {
|
function() {
|
||||||
self._createProjectUI.pollImportJob(
|
self._createProjectUI.pollImportJob(
|
||||||
start,
|
start,
|
||||||
self._jobID,
|
self._jobID,
|
||||||
timerID,
|
timerID,
|
||||||
function(job) {
|
function(job) {
|
||||||
return "projectID" in job.config;
|
return "projectID" in job.config;
|
||||||
},
|
},
|
||||||
function(jobID, job) {
|
function(jobID, job) {
|
||||||
//alert("jobID::" + jobID + " job :" + job);
|
//alert("jobID::" + jobID + " job :" + job);
|
||||||
window.clearInterval(timerID);
|
window.clearInterval(timerID);
|
||||||
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
||||||
document.location = "project?project=" + job.config.projectID;
|
document.location = "project?project=" + job.config.projectID;
|
||||||
},
|
},
|
||||||
function(job) {
|
function(job) {
|
||||||
alert(Refine.CreateProjectUI.composeErrorMessage(job));
|
alert(Refine.CreateProjectUI.composeErrorMessage(job));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
1000
|
1000
|
||||||
);
|
);
|
||||||
self._createProjectUI.showImportProgressPanel($.i18n._('database-import')["creating"], function() {
|
self._createProjectUI.showImportProgressPanel($.i18n._('database-import')["creating"], function() {
|
||||||
// stop the timed polling
|
// stop the timed polling
|
||||||
window.clearInterval(timerID);
|
window.clearInterval(timerID);
|
||||||
|
|
||||||
// explicitly cancel the import job
|
// explicitly cancel the import job
|
||||||
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
||||||
|
|
||||||
self._createProjectUI.showSourceSelectionPanel();
|
self._createProjectUI.showSourceSelectionPanel();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<div bind="wizardHeader" class="database-importing-wizard-header">
|
<div bind="wizardHeader" class="database-importing-wizard-header">
|
||||||
<div class="grid-layout layout-tightest layout-full">
|
<div class="grid-layout layout-tightest layout-full">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="1%"><button bind="startOverButton" class="button">« Start Over</button></td>
|
<td width="1%"><button bind="startOverButton" class="button">« Start Over</button></td>
|
||||||
<td width="98%" bind="database_conf_pars"></td>
|
<td width="98%" bind="database_conf_pars"></td>
|
||||||
<td style="text-align: right;" bind="database_proj_name"></td>
|
<td style="text-align: right;" bind="database_proj_name"></td>
|
||||||
<td width="1%"><input class="inline" type="text" size="30" bind="projectNameInput" /></td>
|
<td width="1%"><input class="inline" type="text" size="30" bind="projectNameInput" /></td>
|
||||||
<td width="1%"><button bind="createProjectButton" class="button button-primary"></button></td>
|
<td width="1%"><button bind="createProjectButton" class="button button-primary"></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div bind="dataPanel" class="database-importing-parsing-data-panel"></div>
|
<div bind="dataPanel" class="database-importing-parsing-data-panel"></div>
|
||||||
<div bind="progressPanel" class="database-importing-progress-data-panel">
|
<div bind="progressPanel" class="database-importing-progress-data-panel">
|
||||||
@ -17,37 +17,37 @@
|
|||||||
<span bind="database_updating"></span>
|
<span bind="database_updating"></span>
|
||||||
</div>
|
</div>
|
||||||
<div bind="controlPanel" class="database-importing-parsing-control-panel">
|
<div bind="controlPanel" class="database-importing-parsing-control-panel">
|
||||||
<div class="grid-layout layout-normal">
|
<div class="grid-layout layout-normal">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td bind="database_options"></td>
|
<td bind="database_options"></td>
|
||||||
<td><button class="button" bind="previewButton"></button></td>
|
<td><button class="button" bind="previewButton"></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="grid-layout layout-tightest">
|
<div class="grid-layout layout-tightest">
|
||||||
<table>
|
<table>
|
||||||
<tr><td width="1%"><input type="checkbox" bind="skipCheckbox" id="$skip"/></td>
|
<tr><td width="1%"><input type="checkbox" bind="skipCheckbox" id="$skip"/></td>
|
||||||
<td><label for="$skip" bind="database_discard_next"></label></td>
|
<td><label for="$skip" bind="database_discard_next"></label></td>
|
||||||
<td><input bind="skipInput" type="text" class="lightweight" size="2" value="0" />
|
<td><input bind="skipInput" type="text" class="lightweight" size="2" value="0" />
|
||||||
<label for="$skip" bind="database_discard"></label></td>
|
<label for="$skip" bind="database_discard"></label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td width="1%"><input type="checkbox" bind="limitCheckbox" id="$limit" /></td>
|
<tr><td width="1%"><input type="checkbox" bind="limitCheckbox" id="$limit" /></td>
|
||||||
<td><label for="$limit" bind="database_limit_next"></label></td>
|
<td><label for="$limit" bind="database_limit_next"></label></td>
|
||||||
<td><input bind="limitInput" type="text" class="lightweight" size="10" value="0" />
|
<td><input bind="limitInput" type="text" class="lightweight" size="10" value="0" />
|
||||||
<label for="$limit" bind="database_limit"></label></td>
|
<label for="$limit" bind="database_limit"></label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td width="1%"><input type="checkbox" bind="storeBlankRowsCheckbox" id="$store-blank-rows" /></td>
|
<tr><td width="1%"><input type="checkbox" bind="storeBlankRowsCheckbox" id="$store-blank-rows" /></td>
|
||||||
<td colspan="2"><label for="$store-blank-rows" bind="database_store_row"></label></td>
|
<td colspan="2"><label for="$store-blank-rows" bind="database_store_row"></label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td width="1%"><input type="checkbox" bind="storeBlankCellsAsNullsCheckbox" id="$store-blank-cells" /></td>
|
<tr><td width="1%"><input type="checkbox" bind="storeBlankCellsAsNullsCheckbox" id="$store-blank-cells" /></td>
|
||||||
<td colspan="2"><label for="$store-blank-cells" bind="database_store_cell"></label></td>
|
<td colspan="2"><label for="$store-blank-cells" bind="database_store_cell"></label></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,34 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Tony Opara
|
||||||
Copyright 2011, Google Inc.
|
* All rights reserved.
|
||||||
All rights reserved.
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
||||||
modification, are permitted provided that the following conditions are
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
met:
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* Redistributions of source code must retain the above copyright
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
notice, this list of conditions and the following disclaimer.
|
* and/or other materials provided with the distribution.
|
||||||
* Redistributions in binary form must reproduce the above
|
*
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
in the documentation and/or other materials provided with the
|
* endorse or promote products derived from this software without specific
|
||||||
distribution.
|
* prior written permission.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
*
|
||||||
contributors may be used to endorse or promote products derived from
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
this software without specific prior written permission.
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Refine.DatabaseSourceUI = function(controller) {
|
Refine.DatabaseSourceUI = function(controller) {
|
||||||
@ -59,108 +55,108 @@ Refine.DatabaseSourceUI.prototype.attachUI = function(body) {
|
|||||||
|
|
||||||
|
|
||||||
this._elmts.newConnectionButton.click(function(evt) {
|
this._elmts.newConnectionButton.click(function(evt) {
|
||||||
self._resetDatabaseImportForm();
|
self._resetDatabaseImportForm();
|
||||||
$( "#newConnectionDiv" ).show();
|
$( "#newConnectionDiv" ).show();
|
||||||
$( "#sqlEditorDiv" ).hide();
|
$( "#sqlEditorDiv" ).hide();
|
||||||
// self._body.find('.newConnectionDiv').show();
|
// self._body.find('.newConnectionDiv').show();
|
||||||
// self._body.find('.sqlEditorDiv').hide();
|
// self._body.find('.sqlEditorDiv').hide();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this._elmts.databaseTypeSelect.change(function(event) {
|
this._elmts.databaseTypeSelect.change(function(event) {
|
||||||
var type = $( "#databaseTypeSelect" ).val();
|
var type = $( "#databaseTypeSelect" ).val();
|
||||||
if(type === "postgresql"){
|
if(type === "postgresql"){
|
||||||
$( "#databaseUser" ).val("postgres");
|
$( "#databaseUser" ).val("postgres");
|
||||||
$( "#databasePort" ).val("5432");
|
$( "#databasePort" ).val("5432");
|
||||||
}else if(type === "mysql"){
|
}else if(type === "mysql"){
|
||||||
$( "#databaseUser" ).val("root");
|
$( "#databaseUser" ).val("root");
|
||||||
$( "#databasePort" ).val("3306");
|
$( "#databasePort" ).val("3306");
|
||||||
}else if(type === "mariadb"){
|
}else if(type === "mariadb"){
|
||||||
$( "#databaseUser" ).val("root");
|
$( "#databaseUser" ).val("root");
|
||||||
$( "#databasePort" ).val("3306");
|
$( "#databasePort" ).val("3306");
|
||||||
}else{
|
}else{
|
||||||
$( "#databaseUser" ).val("root");
|
$( "#databaseUser" ).val("root");
|
||||||
$( "#databasePort" ).val("3306");
|
$( "#databasePort" ).val("3306");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._elmts.testDatabaseButton.click(function(evt) {
|
this._elmts.testDatabaseButton.click(function(evt) {
|
||||||
|
|
||||||
if(self._validateNewConnectionForm() == true){
|
if(self._validateNewConnectionForm() === true){
|
||||||
self._testDatabaseConnect(self._getConnectionInfo());
|
self._testDatabaseConnect(self._getConnectionInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this._elmts.databaseConnectButton.click(function(evt) {
|
this._elmts.databaseConnectButton.click(function(evt) {
|
||||||
|
|
||||||
if(self._validateNewConnectionForm() == true){
|
if(self._validateNewConnectionForm() === true){
|
||||||
self._connect(self._getConnectionInfo());
|
self._connect(self._getConnectionInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this._elmts.saveConnectionButton.click(function(evt) {
|
this._elmts.saveConnectionButton.click(function(evt) {
|
||||||
|
|
||||||
if(self._validateNewConnectionForm() == true){
|
if(self._validateNewConnectionForm() == true){
|
||||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||||
if (connectionNameInput.length === 0) {
|
if (connectionNameInput.length === 0) {
|
||||||
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
||||||
} else{
|
} else{
|
||||||
self._saveConnection(self._getConnectionInfo());
|
self._saveConnection(self._getConnectionInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this._elmts.executeQueryButton.click(function(evt) {
|
this._elmts.executeQueryButton.click(function(evt) {
|
||||||
var jdbcQueryInfo = {};
|
var jdbcQueryInfo = {};
|
||||||
jdbcQueryInfo.connectionName = $( "#currentConnectionNameInput" ).val();
|
jdbcQueryInfo.connectionName = $( "#currentConnectionNameInput" ).val();
|
||||||
jdbcQueryInfo.databaseType = $( "#currentDatabaseTypeInput" ).val();
|
jdbcQueryInfo.databaseType = $( "#currentDatabaseTypeInput" ).val();
|
||||||
jdbcQueryInfo.databaseServer = $( "#currentDatabaseHostInput" ).val();
|
jdbcQueryInfo.databaseServer = $( "#currentDatabaseHostInput" ).val();
|
||||||
jdbcQueryInfo.databasePort = $( "#currentDatabasePortInput" ).val();
|
jdbcQueryInfo.databasePort = $( "#currentDatabasePortInput" ).val();
|
||||||
jdbcQueryInfo.databaseUser = $( "#currentDatabaseUserInput" ).val();
|
jdbcQueryInfo.databaseUser = $( "#currentDatabaseUserInput" ).val();
|
||||||
jdbcQueryInfo.databasePassword = $( "#currentDatabasePasswordInput" ).val();
|
jdbcQueryInfo.databasePassword = $( "#currentDatabasePasswordInput" ).val();
|
||||||
jdbcQueryInfo.initialDatabase = $( "#currentInitialDatabaseInput" ).val();
|
jdbcQueryInfo.initialDatabase = $( "#currentInitialDatabaseInput" ).val();
|
||||||
jdbcQueryInfo.query = $.trim($( "#queryTextArea" ).val());
|
jdbcQueryInfo.query = $.trim($( "#queryTextArea" ).val());
|
||||||
|
|
||||||
// if(jdbcQueryInfo.query && jdbcQueryInfo.query.length > 0 ) {
|
// if(jdbcQueryInfo.query && jdbcQueryInfo.query.length > 0 ) {
|
||||||
// self._executeQuery(jdbcQueryInfo);
|
// self._executeQuery(jdbcQueryInfo);
|
||||||
// }else{
|
// }else{
|
||||||
// window.alert($.i18n._('database-source')["alert-query"]);
|
// window.alert($.i18n._('database-source')["alert-query"]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(self.validateQuery(jdbcQueryInfo.query)) {
|
if(self.validateQuery(jdbcQueryInfo.query)) {
|
||||||
self._executeQuery(jdbcQueryInfo);
|
self._executeQuery(jdbcQueryInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this._elmts.editConnectionButton.click(function(evt) {
|
this._elmts.editConnectionButton.click(function(evt) {
|
||||||
|
|
||||||
if(self._validateNewConnectionForm() == true){
|
if(self._validateNewConnectionForm() == true){
|
||||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||||
if (connectionNameInput.length === 0) {
|
if (connectionNameInput.length === 0) {
|
||||||
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
||||||
} else{
|
} else{
|
||||||
self._editConnection(self._getConnectionInfo());
|
self._editConnection(self._getConnectionInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this._elmts.cancelEditConnectionButton.click(function(evt) {
|
this._elmts.cancelEditConnectionButton.click(function(evt) {
|
||||||
self._resetDatabaseImportForm();
|
self._resetDatabaseImportForm();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//load saved connections from settings file in user home directory
|
//load saved connections from settings file in user home directory
|
||||||
@ -174,43 +170,43 @@ Refine.DatabaseSourceUI.prototype.focus = function() {
|
|||||||
|
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype.validateQuery = function(query) {
|
Refine.DatabaseSourceUI.prototype.validateQuery = function(query) {
|
||||||
//alert("query::" + query);
|
//alert("query::" + query);
|
||||||
if(!query || query.length <= 0 ) {
|
if(!query || query.length <= 0 ) {
|
||||||
window.alert($.i18n._('database-source')["alert-query"]);
|
window.alert($.i18n._('database-source')["alert-query"]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var allCapsQuery = query.toUpperCase();
|
var allCapsQuery = query.toUpperCase();
|
||||||
|
|
||||||
if(allCapsQuery.indexOf('DROP') > -1){
|
if(allCapsQuery.indexOf('DROP') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DROP");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DROP");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('TRUNCATE') > -1){
|
}else if(allCapsQuery.indexOf('TRUNCATE') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " TRUNCATE");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " TRUNCATE");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('DELETE') > -1){
|
}else if(allCapsQuery.indexOf('DELETE') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DELETE");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DELETE");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('ROLLBACK') > -1){
|
}else if(allCapsQuery.indexOf('ROLLBACK') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ROLLBACK");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ROLLBACK");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('SHUTDOWN') > -1){
|
}else if(allCapsQuery.indexOf('SHUTDOWN') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " SHUTDOWN");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " SHUTDOWN");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('INSERT') > -1){
|
}else if(allCapsQuery.indexOf('INSERT') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " INSERT");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " INSERT");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('ALTER') > -1){
|
}else if(allCapsQuery.indexOf('ALTER') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ALTER");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ALTER");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('UPDATE') > -1){
|
}else if(allCapsQuery.indexOf('UPDATE') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " UPDATE");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " UPDATE");
|
||||||
return false;
|
return false;
|
||||||
}else if(allCapsQuery.indexOf('LIMIT') > -1){
|
}else if(allCapsQuery.indexOf('LIMIT') > -1){
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " LIMIT");
|
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " LIMIT");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ((allCapsQuery.indexOf('DROP') > -1) || (allCapsQuery.indexOf('TRUNCATE') > -1) ||
|
// if ((allCapsQuery.indexOf('DROP') > -1) || (allCapsQuery.indexOf('TRUNCATE') > -1) ||
|
||||||
// (allCapsQuery.indexOf('DELETE') > -1) || (allCapsQuery.indexOf('ROLLBACK') > -1)
|
// (allCapsQuery.indexOf('DELETE') > -1) || (allCapsQuery.indexOf('ROLLBACK') > -1)
|
||||||
// || (allCapsQuery.indexOf('SHUTDOWN') > -1) || (allCapsQuery.indexOf('INSERT') > -1)
|
// || (allCapsQuery.indexOf('SHUTDOWN') > -1) || (allCapsQuery.indexOf('INSERT') > -1)
|
||||||
@ -219,265 +215,265 @@ Refine.DatabaseSourceUI.prototype.validateQuery = function(query) {
|
|||||||
// window.alert($.i18n._('database-source')["alert-invalid-query-keyword"]);
|
// window.alert($.i18n._('database-source')["alert-invalid-query-keyword"]);
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(!allCapsQuery.startsWith('SELECT')) {
|
if(!allCapsQuery.startsWith('SELECT')) {
|
||||||
window.alert($.i18n._('database-source')["alert-invalid-query-select"]);
|
window.alert($.i18n._('database-source')["alert-invalid-query-select"]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._editConnection = function(connectionInfo) {
|
Refine.DatabaseSourceUI.prototype._editConnection = function(connectionInfo) {
|
||||||
//alert("database user:" + connectionInfo.databaseUser);
|
//alert("database user:" + connectionInfo.databaseUser);
|
||||||
var self = this;
|
var self = this;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'command/database/saved-connection',
|
url: 'command/database/saved-connection',
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
contentType:'application/x-www-form-urlencoded',
|
contentType:'application/x-www-form-urlencoded',
|
||||||
data: connectionInfo,
|
data: connectionInfo,
|
||||||
success: function(settings) {
|
success: function(settings) {
|
||||||
if(settings){
|
if(settings){
|
||||||
$( "#menuListUl" ).empty();
|
$( "#menuListUl" ).empty();
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(settings.savedConnections,function(index,savedConnection){
|
$.each(settings.savedConnections,function(index,savedConnection){
|
||||||
// items.push('<a href="#" class="list-group-item list-group-item-action">'
|
// items.push('<a href="#" class="list-group-item list-group-item-action">'
|
||||||
// + '<span class="context-menu-one context-menu-text" >' + savedConnection.connectionName + '</span>'
|
// + '<span class="context-menu-one context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||||
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
||||||
|
|
||||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||||
})
|
})
|
||||||
|
|
||||||
$( "#menuListUl" ).append(items.join(''));
|
$( "#menuListUl" ).append(items.join(''));
|
||||||
window.alert($.i18n._('database-source')["alert-connection-edit"]);
|
window.alert($.i18n._('database-source')["alert-connection-edit"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).fail(function( jqXhr, textStatus, errorThrown ){
|
}).fail(function( jqXhr, textStatus, errorThrown ){
|
||||||
alert( textStatus + ':' + errorThrown );
|
alert( textStatus + ':' + errorThrown );
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._executeQuery = function(jdbcQueryInfo) {
|
Refine.DatabaseSourceUI.prototype._executeQuery = function(jdbcQueryInfo) {
|
||||||
var self = this;
|
var self = this;
|
||||||
//remove start line
|
//remove start line
|
||||||
|
|
||||||
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["checking"]);
|
|
||||||
//$("#executeQueryBtn").text('Please wait ...').attr('disabled','disabled');
|
|
||||||
|
|
||||||
$.post(
|
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["checking"]);
|
||||||
"command/database/test-query",
|
//$("#executeQueryBtn").text('Please wait ...').attr('disabled','disabled');
|
||||||
jdbcQueryInfo,
|
|
||||||
function(jdbcConnectionResult) {
|
$.post(
|
||||||
// $("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
"command/database/test-query",
|
||||||
dismiss();
|
jdbcQueryInfo,
|
||||||
self._controller.startImportingDocument(jdbcQueryInfo);
|
function(jdbcConnectionResult) {
|
||||||
|
// $("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
||||||
},
|
dismiss();
|
||||||
"json"
|
self._controller.startImportingDocument(jdbcQueryInfo);
|
||||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
|
||||||
//$("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
},
|
||||||
dismiss();
|
"json"
|
||||||
|
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||||
|
//$("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
||||||
|
dismiss();
|
||||||
alert( textStatus + ':' + errorThrown );
|
alert( textStatus + ':' + errorThrown );
|
||||||
});
|
});
|
||||||
//remove end line
|
//remove end line
|
||||||
|
|
||||||
//self._controller.startImportingDocument(jdbcQueryInfo);
|
//self._controller.startImportingDocument(jdbcQueryInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._saveConnection = function(jdbcConnectionInfo) {
|
Refine.DatabaseSourceUI.prototype._saveConnection = function(jdbcConnectionInfo) {
|
||||||
var self = this;
|
var self = this;
|
||||||
$.post(
|
$.post(
|
||||||
"command/database/saved-connection",
|
"command/database/saved-connection",
|
||||||
jdbcConnectionInfo,
|
jdbcConnectionInfo,
|
||||||
function(settings) {
|
function(settings) {
|
||||||
if(settings){
|
if(settings){
|
||||||
|
|
||||||
// self._elmts.scListGroupDiv.empty();
|
// self._elmts.scListGroupDiv.empty();
|
||||||
self._elmts.menuListUl.empty();
|
self._elmts.menuListUl.empty();
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(settings.savedConnections,function(index,savedConnection){
|
$.each(settings.savedConnections,function(index,savedConnection){
|
||||||
|
|
||||||
// items.push('<a href="#" class="list-group-item list-group-item-action">'
|
// items.push('<a href="#" class="list-group-item list-group-item-action">'
|
||||||
// + '<span class="context-menu-one context-menu-text" >' + savedConnection.connectionName + '</span>'
|
// + '<span class="context-menu-one context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||||
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
||||||
|
|
||||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||||
})
|
})
|
||||||
|
|
||||||
self._elmts.menuListUl.append(items.join(''));
|
self._elmts.menuListUl.append(items.join(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||||
alert( textStatus + ':' + errorThrown );
|
alert( textStatus + ':' + errorThrown );
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._loadSavedConnections = function() {
|
Refine.DatabaseSourceUI.prototype._loadSavedConnections = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
$.get(
|
$.get(
|
||||||
"command/database/saved-connection",
|
"command/database/saved-connection",
|
||||||
null,
|
null,
|
||||||
function(settings) {
|
function(settings) {
|
||||||
if(settings){
|
if(settings){
|
||||||
|
|
||||||
self._elmts.menuListUl.empty();
|
self._elmts.menuListUl.empty();
|
||||||
//self._elmts.scListGroupDiv.empty();
|
//self._elmts.scListGroupDiv.empty();
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(settings.savedConnections,function(index,savedConnection){
|
$.each(settings.savedConnections,function(index,savedConnection){
|
||||||
|
|
||||||
// items.push('<a href="#" class="list-group-item list-group-item-action context-menu-one">'
|
// items.push('<a href="#" class="list-group-item list-group-item-action context-menu-one">'
|
||||||
// + '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
// + '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||||
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
||||||
|
|
||||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
self._elmts.menuListUl.append(items.join(''));
|
self._elmts.menuListUl.append(items.join(''));
|
||||||
// self._elmts.scListGroupDiv.append(items.join(''));
|
// self._elmts.scListGroupDiv.append(items.join(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._testDatabaseConnect = function(jdbcConnectionInfo) {
|
Refine.DatabaseSourceUI.prototype._testDatabaseConnect = function(jdbcConnectionInfo) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
$.post(
|
$.post(
|
||||||
"command/database/test-connect",
|
"command/database/test-connect",
|
||||||
jdbcConnectionInfo,
|
jdbcConnectionInfo,
|
||||||
function(jdbcConnectionResult) {
|
function(jdbcConnectionResult) {
|
||||||
if(jdbcConnectionResult && jdbcConnectionResult.connectionResult == true){
|
if(jdbcConnectionResult && jdbcConnectionResult.connectionResult == true){
|
||||||
window.alert("Test Connection Succeeded!");
|
window.alert("Test Connection Succeeded!");
|
||||||
}else{
|
}else{
|
||||||
window.alert("Unable to establish connection to database");
|
window.alert("Unable to establish connection to database");
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||||
alert( textStatus + ':' + errorThrown );
|
alert( textStatus + ':' + errorThrown );
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._connect = function(jdbcConnectionInfo) {
|
Refine.DatabaseSourceUI.prototype._connect = function(jdbcConnectionInfo) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
$.post(
|
$.post(
|
||||||
"command/database/connect",
|
"command/database/connect",
|
||||||
jdbcConnectionInfo,
|
jdbcConnectionInfo,
|
||||||
function(databaseInfo) {
|
function(databaseInfo) {
|
||||||
|
|
||||||
if(databaseInfo){
|
if(databaseInfo){
|
||||||
$( "#currentConnectionNameInput" ).val(jdbcConnectionInfo.connectionName);
|
$( "#currentConnectionNameInput" ).val(jdbcConnectionInfo.connectionName);
|
||||||
$( "#currentDatabaseTypeInput" ).val(jdbcConnectionInfo.databaseType);
|
$( "#currentDatabaseTypeInput" ).val(jdbcConnectionInfo.databaseType);
|
||||||
$( "#currentDatabaseUserInput" ).val(jdbcConnectionInfo.databaseUser);
|
$( "#currentDatabaseUserInput" ).val(jdbcConnectionInfo.databaseUser);
|
||||||
$( "#currentDatabasePasswordInput" ).val(jdbcConnectionInfo.databasePassword);
|
$( "#currentDatabasePasswordInput" ).val(jdbcConnectionInfo.databasePassword);
|
||||||
$( "#currentDatabaseHostInput" ).val(jdbcConnectionInfo.databaseServer);
|
$( "#currentDatabaseHostInput" ).val(jdbcConnectionInfo.databaseServer);
|
||||||
$( "#currentDatabasePortInput" ).val(jdbcConnectionInfo.databasePort);
|
$( "#currentDatabasePortInput" ).val(jdbcConnectionInfo.databasePort);
|
||||||
$( "#currentInitialDatabaseInput" ).val(jdbcConnectionInfo.initialDatabase);
|
$( "#currentInitialDatabaseInput" ).val(jdbcConnectionInfo.initialDatabase);
|
||||||
|
|
||||||
var connectionParam = "Connection :: "
|
var connectionParam = "Connection :: "
|
||||||
+ "jdbc:"
|
+ "jdbc:"
|
||||||
+ jdbcConnectionInfo.databaseType + "://"
|
+ jdbcConnectionInfo.databaseType + "://"
|
||||||
+ jdbcConnectionInfo.databaseServer + ":"
|
+ jdbcConnectionInfo.databaseServer + ":"
|
||||||
+ jdbcConnectionInfo.databasePort + "/"
|
+ jdbcConnectionInfo.databasePort + "/"
|
||||||
+ jdbcConnectionInfo.initialDatabase;
|
+ jdbcConnectionInfo.initialDatabase;
|
||||||
|
|
||||||
//alert("connectionParam::" + connectionParam);
|
//alert("connectionParam::" + connectionParam);
|
||||||
$( "#connectionParameterSpan" ).text(connectionParam);
|
$( "#connectionParameterSpan" ).text(connectionParam);
|
||||||
// self._body.find('.newConnectionDiv').hide();
|
// self._body.find('.newConnectionDiv').hide();
|
||||||
// self._body.find('.sqlEditorDiv').show();
|
// self._body.find('.sqlEditorDiv').show();
|
||||||
$( "#newConnectionDiv" ).hide();
|
$( "#newConnectionDiv" ).hide();
|
||||||
$( "#sqlEditorDiv" ).show();
|
$( "#sqlEditorDiv" ).show();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
window.alert("Unable to establish connection to database");
|
window.alert("Unable to establish connection to database");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||||
alert( textStatus + ':' + errorThrown );
|
alert( textStatus + ':' + errorThrown );
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._getConnectionInfo = function() {
|
Refine.DatabaseSourceUI.prototype._getConnectionInfo = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var jdbcConnectionInfo = {};
|
var jdbcConnectionInfo = {};
|
||||||
jdbcConnectionInfo.connectionName = $.trim(self._elmts.connectionNameInput[0].value);
|
jdbcConnectionInfo.connectionName = $.trim(self._elmts.connectionNameInput[0].value);
|
||||||
jdbcConnectionInfo.databaseType = $.trim(self._elmts.databaseTypeSelect[0].value);
|
jdbcConnectionInfo.databaseType = $.trim(self._elmts.databaseTypeSelect[0].value);
|
||||||
jdbcConnectionInfo.databaseServer = $.trim(self._elmts.databaseHostInput[0].value);
|
jdbcConnectionInfo.databaseServer = $.trim(self._elmts.databaseHostInput[0].value);
|
||||||
jdbcConnectionInfo.databasePort = $.trim(self._elmts.databasePortInput[0].value);
|
jdbcConnectionInfo.databasePort = $.trim(self._elmts.databasePortInput[0].value);
|
||||||
jdbcConnectionInfo.databaseUser = $.trim(self._elmts.databaseUserInput[0].value);
|
jdbcConnectionInfo.databaseUser = $.trim(self._elmts.databaseUserInput[0].value);
|
||||||
jdbcConnectionInfo.databasePassword = $.trim(self._elmts.databasePasswordInput[0].value);
|
jdbcConnectionInfo.databasePassword = $.trim(self._elmts.databasePasswordInput[0].value);
|
||||||
jdbcConnectionInfo.initialDatabase = $.trim(self._elmts.initialDatabaseInput[0].value);
|
jdbcConnectionInfo.initialDatabase = $.trim(self._elmts.initialDatabaseInput[0].value);
|
||||||
jdbcConnectionInfo.initialSchema = $.trim(self._elmts.initialSchemaInput[0].value);
|
jdbcConnectionInfo.initialSchema = $.trim(self._elmts.initialSchemaInput[0].value);
|
||||||
return jdbcConnectionInfo;
|
return jdbcConnectionInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._validateNewConnectionForm = function() {
|
Refine.DatabaseSourceUI.prototype._validateNewConnectionForm = function() {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||||
var databaseTypeSelect = $.trim(self._elmts.databaseTypeSelect[0].value);
|
var databaseTypeSelect = $.trim(self._elmts.databaseTypeSelect[0].value);
|
||||||
var databaseHostInput = $.trim(self._elmts.databaseHostInput[0].value);
|
var databaseHostInput = $.trim(self._elmts.databaseHostInput[0].value);
|
||||||
var databasePortInput = $.trim(self._elmts.databasePortInput[0].value);
|
var databasePortInput = $.trim(self._elmts.databasePortInput[0].value);
|
||||||
var databaseUserInput = $.trim(self._elmts.databaseUserInput[0].value);
|
var databaseUserInput = $.trim(self._elmts.databaseUserInput[0].value);
|
||||||
var databasePasswordInput = $.trim(self._elmts.databasePasswordInput[0].value);
|
var databasePasswordInput = $.trim(self._elmts.databasePasswordInput[0].value);
|
||||||
var initialDatabaseInput = $.trim(self._elmts.initialDatabaseInput[0].value);
|
var initialDatabaseInput = $.trim(self._elmts.initialDatabaseInput[0].value);
|
||||||
var initialSchemaInput = $.trim(self._elmts.initialSchemaInput[0].value);
|
var initialSchemaInput = $.trim(self._elmts.initialSchemaInput[0].value);
|
||||||
|
|
||||||
if (databaseHostInput.length === 0) {
|
if (databaseHostInput.length === 0) {
|
||||||
window.alert($.i18n._('database-source')["alert-server"]);
|
window.alert($.i18n._('database-source')["alert-server"]);
|
||||||
return false;
|
return false;
|
||||||
}else if(databasePortInput.length === 0){
|
}else if(databasePortInput.length === 0){
|
||||||
window.alert($.i18n._('database-source')["alert-port"]);
|
window.alert($.i18n._('database-source')["alert-port"]);
|
||||||
return false;
|
return false;
|
||||||
}else if(databaseUserInput.length === 0){
|
}else if(databaseUserInput.length === 0){
|
||||||
window.alert($.i18n._('database-source')["alert-user"]);
|
window.alert($.i18n._('database-source')["alert-user"]);
|
||||||
return false;
|
return false;
|
||||||
}else if(initialDatabaseInput.length === 0){
|
}else if(initialDatabaseInput.length === 0){
|
||||||
window.alert($.i18n._('database-source')["alert-initial-database"]);
|
window.alert($.i18n._('database-source')["alert-initial-database"]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.DatabaseSourceUI.prototype._resetDatabaseImportForm = function() {
|
Refine.DatabaseSourceUI.prototype._resetDatabaseImportForm = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
$( "#connectionName" ).val("127.0.0.1");
|
$( "#connectionName" ).val("127.0.0.1");
|
||||||
$( "#databaseTypeSelect" ).val("postgresql");
|
$( "#databaseTypeSelect" ).val("postgresql");
|
||||||
$( "#databaseHost" ).val("127.0.0.1");
|
$( "#databaseHost" ).val("127.0.0.1");
|
||||||
$( "#databasePort" ).val("5432");
|
$( "#databasePort" ).val("5432");
|
||||||
$( "#databaseUser" ).val("postgres");
|
$( "#databaseUser" ).val("postgres");
|
||||||
$( "#databasePassword" ).val("");
|
$( "#databasePassword" ).val("");
|
||||||
$( "#initialDatabase" ).val("");
|
$( "#initialDatabase" ).val("");
|
||||||
$( "#initialSchema" ).val("");
|
$( "#initialSchema" ).val("");
|
||||||
|
|
||||||
$( "#editConnectionControlDiv" ).hide();
|
$( "#editConnectionControlDiv" ).hide();
|
||||||
$( "#newConnectionControlDiv" ).show();
|
$( "#newConnectionControlDiv" ).show();
|
||||||
$('#connectionName').removeAttr('readonly');
|
$('#connectionName').removeAttr('readonly');
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,48 +1,44 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Tony Opara
|
||||||
Copyright 2011, Google Inc.
|
* All rights reserved.
|
||||||
All rights reserved.
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
||||||
modification, are permitted provided that the following conditions are
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
met:
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* Redistributions of source code must retain the above copyright
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
notice, this list of conditions and the following disclaimer.
|
* and/or other materials provided with the distribution.
|
||||||
* Redistributions in binary form must reproduce the above
|
*
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
in the documentation and/or other materials provided with the
|
* endorse or promote products derived from this software without specific
|
||||||
distribution.
|
* prior written permission.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
*
|
||||||
contributors may be used to endorse or promote products derived from
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
this software without specific prior written permission.
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var dictionary = "";
|
var dictionary = "";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "command/core/load-language?",
|
url : "command/core/load-language?",
|
||||||
type : "POST",
|
type : "POST",
|
||||||
async : false,
|
async : false,
|
||||||
data : {
|
data : {
|
||||||
module : "database",
|
module : "database",
|
||||||
|
|
||||||
},
|
},
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
dictionary = data;
|
dictionary = data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.i18n.setDictionary(dictionary);
|
$.i18n.setDictionary(dictionary);
|
||||||
// End internationalization
|
// End internationalization
|
||||||
|
@ -1,36 +1,31 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Tony Opara
|
||||||
Copyright 2011, Google Inc.
|
* All rights reserved.
|
||||||
All rights reserved.
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
||||||
modification, are permitted provided that the following conditions are
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
met:
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* Redistributions of source code must retain the above copyright
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
notice, this list of conditions and the following disclaimer.
|
* and/or other materials provided with the distribution.
|
||||||
* Redistributions in binary form must reproduce the above
|
*
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
in the documentation and/or other materials provided with the
|
* endorse or promote products derived from this software without specific
|
||||||
distribution.
|
* prior written permission.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
*
|
||||||
contributors may be used to endorse or promote products derived from
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
this software without specific prior written permission.
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
*/
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
@import-less url("theme.less");
|
@import-less url("theme.less");
|
||||||
|
|
||||||
.database-container {
|
.database-container {
|
||||||
@ -85,10 +80,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
background: white;
|
background: white;
|
||||||
padding: @padding_looser;
|
padding: @padding_looser;
|
||||||
}
|
}
|
||||||
|
|
||||||
.context-menu-text {
|
.context-menu-text {
|
||||||
padding: 4px 4px 2px 2px;
|
padding: 4px 4px 2px 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.custom-restricted {
|
.custom-restricted {
|
||||||
@ -114,7 +109,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
}
|
}
|
||||||
.layout-div {
|
.layout-div {
|
||||||
width : 100%;
|
width : 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
.layout-div .connection-div-layout {
|
.layout-div .connection-div-layout {
|
||||||
min-width: 400px;
|
min-width: 400px;
|
||||||
@ -132,7 +127,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
.new-connection-div {
|
.new-connection-div {
|
||||||
margin-left:40px;
|
margin-left:40px;
|
||||||
padding-left:20px;
|
padding-left:20px;
|
||||||
}
|
}
|
||||||
.new-connection-fieldset {
|
.new-connection-fieldset {
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
}
|
}
|
||||||
@ -148,5 +143,5 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -505,9 +505,9 @@ th {
|
|||||||
|
|
||||||
/* IE10 display: -ms-flexbox (and display: flex in IE 11) does not work inside a table; fall back to block and rely on font hack */
|
/* IE10 display: -ms-flexbox (and display: flex in IE 11) does not work inside a table; fall back to block and rely on font hack */
|
||||||
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
||||||
table .pure-g {
|
table .pure-g {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Opera as of 12 on Windows needs word-spacing.
|
/* Opera as of 12 on Windows needs word-spacing.
|
||||||
|
@ -1,34 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Tony Opara
|
||||||
Copyright 2011, Google Inc.
|
* All rights reserved.
|
||||||
All rights reserved.
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
||||||
modification, are permitted provided that the following conditions are
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
met:
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* Redistributions of source code must retain the above copyright
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
notice, this list of conditions and the following disclaimer.
|
* and/or other materials provided with the distribution.
|
||||||
* Redistributions in binary form must reproduce the above
|
*
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
in the documentation and/or other materials provided with the
|
* endorse or promote products derived from this software without specific
|
||||||
distribution.
|
* prior written permission.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
*
|
||||||
contributors may be used to endorse or promote products derived from
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
this software without specific prior written permission.
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
*/
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
@import-less url("../../../../main/webapp/modules/core/styles/theme.less");
|
@import-less url("../../../../main/webapp/modules/core/styles/theme.less");
|
||||||
|
@ -44,7 +44,7 @@ import com.google.refine.importing.ImportingJob;
|
|||||||
|
|
||||||
public class DBQueryResultImportReader implements TableDataReader {
|
public class DBQueryResultImportReader implements TableDataReader {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("DBQueryResultImportReader");
|
private static final Logger logger = LoggerFactory.getLogger("DBQueryResultImportReader");
|
||||||
|
|
||||||
private final ImportingJob job;
|
private final ImportingJob job;
|
||||||
private final String querySource;
|
private final String querySource;
|
||||||
|
@ -44,7 +44,7 @@ import com.google.refine.importing.ImportingJob;
|
|||||||
|
|
||||||
public class DBQueryResultPreviewReader implements TableDataReader {
|
public class DBQueryResultPreviewReader implements TableDataReader {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("DBQueryResultPreviewReader");
|
private static final Logger logger = LoggerFactory.getLogger("DBQueryResultPreviewReader");
|
||||||
|
|
||||||
private final ImportingJob job;
|
private final ImportingJob job;
|
||||||
private final String querySource;
|
private final String querySource;
|
||||||
|
@ -63,7 +63,7 @@ import com.google.refine.util.ParsingUtilities;
|
|||||||
|
|
||||||
public class DatabaseImportController implements ImportingController {
|
public class DatabaseImportController implements ImportingController {
|
||||||
|
|
||||||
final static Logger logger = LoggerFactory.getLogger("DatabaseImportController");
|
private static final Logger logger = LoggerFactory.getLogger("DatabaseImportController");
|
||||||
protected RefineServlet servlet;
|
protected RefineServlet servlet;
|
||||||
public static int DEFAULT_PREVIEW_LIMIT = 100;
|
public static int DEFAULT_PREVIEW_LIMIT = 100;
|
||||||
public static String OPTIONS_KEY = "options";
|
public static String OPTIONS_KEY = "options";
|
||||||
|
@ -47,7 +47,7 @@ import edu.mit.simile.butterfly.ButterflyModuleImpl;
|
|||||||
|
|
||||||
public class DatabaseModuleImpl extends ButterflyModuleImpl implements Jsonizable {
|
public class DatabaseModuleImpl extends ButterflyModuleImpl implements Jsonizable {
|
||||||
|
|
||||||
final static Logger logger = LoggerFactory.getLogger("DatabaseModuleImpl");
|
private static final Logger logger = LoggerFactory.getLogger("DatabaseModuleImpl");
|
||||||
|
|
||||||
public static DatabaseModuleImpl instance;
|
public static DatabaseModuleImpl instance;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ import com.google.refine.extension.database.pgsql.PgSQLDatabaseService;
|
|||||||
|
|
||||||
public abstract class DatabaseService {
|
public abstract class DatabaseService {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("DatabaseService");
|
private static final Logger logger = LoggerFactory.getLogger("DatabaseService");
|
||||||
|
|
||||||
|
|
||||||
public static class DBType {
|
public static class DBType {
|
||||||
|
@ -46,7 +46,7 @@ import com.google.refine.io.FileProjectManager;
|
|||||||
|
|
||||||
public class DatabaseUtils {
|
public class DatabaseUtils {
|
||||||
|
|
||||||
final static Logger logger = LoggerFactory.getLogger("DatabaseUtils");
|
private static final Logger logger = LoggerFactory.getLogger("DatabaseUtils");
|
||||||
|
|
||||||
|
|
||||||
private final static String DATABASE_EXTENSION_DIR = "dbextension";
|
private final static String DATABASE_EXTENSION_DIR = "dbextension";
|
||||||
|
@ -50,7 +50,7 @@ import com.google.refine.extension.database.model.DatabaseInfo;
|
|||||||
|
|
||||||
public class ConnectCommand extends DatabaseCommand {
|
public class ConnectCommand extends DatabaseCommand {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("ConnectCommand");
|
private static final Logger logger = LoggerFactory.getLogger("ConnectCommand");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
@ -44,7 +44,6 @@ import com.google.refine.extension.database.DatabaseServiceException;
|
|||||||
|
|
||||||
public abstract class DatabaseCommand extends Command {
|
public abstract class DatabaseCommand extends Command {
|
||||||
|
|
||||||
final static protected Logger logger = LoggerFactory.getLogger("jdbcCommand");
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
|
@ -50,7 +50,7 @@ import com.google.refine.extension.database.model.DatabaseInfo;
|
|||||||
|
|
||||||
public class ExecuteQueryCommand extends DatabaseCommand {
|
public class ExecuteQueryCommand extends DatabaseCommand {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("QueryCommand");
|
private static final Logger logger = LoggerFactory.getLogger("ExecuteQueryCommand");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
@ -48,7 +48,7 @@ import com.google.refine.extension.database.DatabaseUtils;
|
|||||||
|
|
||||||
public class SavedConnectionCommand extends DatabaseCommand {
|
public class SavedConnectionCommand extends DatabaseCommand {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("SavedConnectionCommand");
|
private static final Logger logger = LoggerFactory.getLogger("SavedConnectionCommand");
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,7 +48,7 @@ import com.google.refine.extension.database.DatabaseServiceException;
|
|||||||
|
|
||||||
public class TestConnectCommand extends DatabaseCommand {
|
public class TestConnectCommand extends DatabaseCommand {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("TestConnectCommand");
|
private static final Logger logger = LoggerFactory.getLogger("TestConnectCommand");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
@ -50,7 +50,7 @@ import com.google.refine.extension.database.model.DatabaseInfo;
|
|||||||
|
|
||||||
public class TestQueryCommand extends DatabaseCommand {
|
public class TestQueryCommand extends DatabaseCommand {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("TestQueryCommand");
|
private static final Logger logger = LoggerFactory.getLogger("TestQueryCommand");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
@ -43,7 +43,7 @@ import com.google.refine.extension.database.SQLType;
|
|||||||
|
|
||||||
public class MariaDBConnectionManager {
|
public class MariaDBConnectionManager {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("MariaDBConnectionManager");
|
private static final Logger logger = LoggerFactory.getLogger("MariaDBConnectionManager");
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
private SQLType type;
|
private SQLType type;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ import com.google.refine.extension.database.mysql.MySQLConnectionManager;
|
|||||||
|
|
||||||
public class MariaDBDatabaseService extends DatabaseService {
|
public class MariaDBDatabaseService extends DatabaseService {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("MariaDBDatabaseService");
|
private static final Logger logger = LoggerFactory.getLogger("MariaDBDatabaseService");
|
||||||
|
|
||||||
public static final String DB_NAME = "mariadb";
|
public static final String DB_NAME = "mariadb";
|
||||||
public static final String DB_DRIVER = "org.mariadb.jdbc.Driver";
|
public static final String DB_DRIVER = "org.mariadb.jdbc.Driver";
|
||||||
|
@ -42,7 +42,7 @@ import com.google.refine.extension.database.SQLType;
|
|||||||
|
|
||||||
public class MySQLConnectionManager {
|
public class MySQLConnectionManager {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("MySQLConnectionManager");
|
private static final Logger logger = LoggerFactory.getLogger("MySQLConnectionManager");
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
private SQLType type;
|
private SQLType type;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import com.mysql.jdbc.ResultSetMetaData;
|
|||||||
public class MySQLDatabaseService extends DatabaseService {
|
public class MySQLDatabaseService extends DatabaseService {
|
||||||
|
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger("MySQLDatabaseService");
|
private static final Logger logger = LoggerFactory.getLogger("MySQLDatabaseService");
|
||||||
|
|
||||||
public static final String DB_NAME = "mysql";
|
public static final String DB_NAME = "mysql";
|
||||||
public static final String DB_DRIVER = "com.mysql.jdbc.Driver";
|
public static final String DB_DRIVER = "com.mysql.jdbc.Driver";
|
||||||
|
@ -43,7 +43,7 @@ import com.google.refine.extension.database.SQLType;
|
|||||||
|
|
||||||
public class PgSQLConnectionManager {
|
public class PgSQLConnectionManager {
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger("PgSQLConnectionManager");
|
private static final Logger logger = LoggerFactory.getLogger("PgSQLConnectionManager");
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
private SQLType type;
|
private SQLType type;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import com.google.refine.extension.database.mysql.MySQLConnectionManager;
|
|||||||
|
|
||||||
public class PgSQLDatabaseService extends DatabaseService {
|
public class PgSQLDatabaseService extends DatabaseService {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger("PgSQLDatabaseService");
|
private static final Logger logger = LoggerFactory.getLogger("PgSQLDatabaseService");
|
||||||
|
|
||||||
public static final String DB_NAME = "postgresql";
|
public static final String DB_NAME = "postgresql";
|
||||||
public static final String DB_DRIVER = "org.postgresql.Driver";
|
public static final String DB_DRIVER = "org.postgresql.Driver";
|
||||||
|
@ -198,8 +198,8 @@ public class DBExtensionTestUtils {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNextIMEI(int i) {
|
private String getNextIMEI(int index) {
|
||||||
|
index++;
|
||||||
// byte[] array = new byte[16]; // length is bounded by 7
|
// byte[] array = new byte[16]; // length is bounded by 7
|
||||||
// new Random().nextBytes(array);
|
// new Random().nextBytes(array);
|
||||||
// String generatedString = new String(array, Charset.forName("UTF-8"));
|
// String generatedString = new String(array, Charset.forName("UTF-8"));
|
||||||
@ -210,27 +210,32 @@ public class DBExtensionTestUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int getMNC(int i) {
|
private int getMNC(int index) {
|
||||||
|
index++;
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return mncMap.get(rand.nextInt(3));
|
return mncMap.get(rand.nextInt(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getMCC(int i) {
|
private int getMCC(int index) {
|
||||||
|
index++;
|
||||||
// System.out.println(rand.nextInt(3));
|
// System.out.println(rand.nextInt(3));
|
||||||
return mccMap.get(rand.nextInt(3));
|
return mccMap.get(rand.nextInt(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Date getNextEndDate(int i) {
|
private Date getNextEndDate(int index) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
index++;
|
||||||
return new Date(System.currentTimeMillis() + 1);
|
return new Date(System.currentTimeMillis() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Date getNextStartDate(int i) {
|
private Date getNextStartDate(int index) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
index++;
|
||||||
return new Date(System.currentTimeMillis());
|
return new Date(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNextUeId(int i) {
|
private String getNextUeId(int index) {
|
||||||
|
index++;
|
||||||
int n = 300000000 + rand.nextInt(900000000);
|
int n = 300000000 + rand.nextInt(900000000);
|
||||||
|
|
||||||
return "" + n;
|
return "" + n;
|
||||||
|
@ -7,11 +7,12 @@ public class DBQueryResultImportReaderTest {
|
|||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
public void beforeTest() {
|
public void beforeTest() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNextRowOfCells() {
|
public void testGetNextRowOfCells() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,12 @@ public class DBQueryResultPreviewReaderTest {
|
|||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
public void beforeTest() {
|
public void beforeTest() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNextRowOfCells() {
|
public void testGetNextRowOfCells() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,18 @@ public class DatabaseImportControllerTest {
|
|||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
public void beforeTest() {
|
public void beforeTest() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoGet() {
|
public void testDoGet() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoPost() {
|
public void testDoPost() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,17 +76,17 @@ public class SavedConnectionCommandTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoGet() {
|
public void testDoGet() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoPut() {
|
public void testDoPut() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoDelete() {
|
public void testDoDelete() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,51 +7,52 @@ public class MariaDBDatabaseServiceTest {
|
|||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
public void beforeTest() {
|
public void beforeTest() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetDatabaseUrl() {
|
public void testGetDatabaseUrl() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetConnection() {
|
public void testGetConnection() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTestConnection() {
|
public void testTestConnection() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConnect() {
|
public void testConnect() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExecuteQuery() {
|
public void testExecuteQuery() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBuildLimitQuery() {
|
public void testBuildLimitQuery() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetRows() {
|
public void testGetRows() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetInstance() {
|
public void testGetInstance() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetColumnsDatabaseConfigurationString() {
|
public void testGetColumnsDatabaseConfigurationString() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,51 +7,52 @@ public class MySQLDatabaseServiceTest {
|
|||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
public void beforeTest() {
|
public void beforeTest() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetDatabaseUrl() {
|
public void testGetDatabaseUrl() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetConnection() {
|
public void testGetConnection() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTestConnection() {
|
public void testTestConnection() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConnect() {
|
public void testConnect() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExecuteQuery() {
|
public void testExecuteQuery() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBuildLimitQuery() {
|
public void testBuildLimitQuery() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetRows() {
|
public void testGetRows() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetInstance() {
|
public void testGetInstance() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetColumnsDatabaseConfigurationString() {
|
public void testGetColumnsDatabaseConfigurationString() {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,25 +36,25 @@ public class PgSQLDatabaseServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
@Parameters("dbName")
|
@Parameters("dbName")
|
||||||
public void testGetConnection(@Optional("postgres") String dbName) {
|
public void testGetConnection(@Optional("postgres") String dbName) {
|
||||||
System.out.println("dbName::" + dbName);
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Parameters("dbName")
|
@Parameters("dbName")
|
||||||
public void testTestConnection(@Optional("postgres") String dbName) {
|
public void testTestConnection(@Optional("postgres") String dbName) {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Parameters("dbName")
|
@Parameters("dbName")
|
||||||
public void testConnect(@Optional("postgres") String dbName) {
|
public void testConnect(@Optional("postgres") String dbName) {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Parameters("dbName")
|
@Parameters("dbName")
|
||||||
public void testExecuteQuery(@Optional("postgres") String dbName) {
|
public void testExecuteQuery(@Optional("postgres") String dbName) {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -67,19 +67,19 @@ public class PgSQLDatabaseServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
@Parameters("dbName")
|
@Parameters("dbName")
|
||||||
public void testGetRows(@Optional("postgres") String dbName) {
|
public void testGetRows(@Optional("postgres") String dbName) {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Parameters("dbName")
|
@Parameters("dbName")
|
||||||
public void testGetInstance(@Optional("postgres") String dbName) {
|
public void testGetInstance(@Optional("postgres") String dbName) {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Parameters("dbName")
|
@Parameters("dbName")
|
||||||
public void testGetColumns(@Optional("postgres") String dbName) {
|
public void testGetColumns(@Optional("postgres") String dbName) {
|
||||||
|
//add test logic
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user