Remove unused demo project
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
apply plugin: "org.flywaydb.flyway"
|
||||
|
||||
dependencies {
|
||||
compile project(':dbt-core')
|
||||
|
||||
runtime ratpack.dependency('handlebars')
|
||||
runtime ratpack.dependency('h2')
|
||||
runtime ratpack.dependency('jdbc-tx')
|
||||
|
||||
compile 'org.flywaydb:flyway-core:5.0.7'
|
||||
runtime 'org.slf4j:slf4j-simple:1.7.25'
|
||||
}
|
||||
|
||||
flyway {
|
||||
url = 'jdbc:h2:mem:dbtdb'
|
||||
user = 'SA'
|
||||
}
|
||||
run.dependsOn(flywayMigrate)
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 Devsoap Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.devsoap.dbt.demo
|
||||
|
||||
import org.flywaydb.core.Flyway
|
||||
import ratpack.service.Service
|
||||
import ratpack.service.StartEvent
|
||||
|
||||
import javax.sql.DataSource
|
||||
|
||||
class FlywayMigrationService implements Service {
|
||||
|
||||
@Override
|
||||
void onStart(StartEvent event){
|
||||
new Flyway(dataSource: event.registry.get(DataSource)).migrate()
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
create table LOGS (
|
||||
LOG_ID int not null,
|
||||
LOG_VALUE varchar(100) not null
|
||||
);
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 Devsoap Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import com.devsoap.dbt.DBTModule
|
||||
import com.devsoap.dbt.demo.FlywayMigrationService
|
||||
import com.devsoap.dbt.services.TransactionManagerService
|
||||
import org.h2.jdbcx.JdbcDataSource
|
||||
import ratpack.form.Form
|
||||
import ratpack.handlebars.HandlebarsModule
|
||||
import ratpack.http.Status
|
||||
|
||||
import javax.sql.DataSource
|
||||
|
||||
import static ratpack.groovy.Groovy.ratpack
|
||||
import static ratpack.handlebars.Template.handlebarsTemplate
|
||||
|
||||
/*
|
||||
* Ratpack main configuration
|
||||
*/
|
||||
ratpack {
|
||||
|
||||
/*
|
||||
* Configure application bindings
|
||||
*/
|
||||
bindings {
|
||||
|
||||
/*
|
||||
* Render views with Handlebars
|
||||
*/
|
||||
module HandlebarsModule
|
||||
|
||||
/*
|
||||
* Configure dbt module to point to correct ledger and executor instances
|
||||
*/
|
||||
module (DBTModule) { config ->
|
||||
config.ledger.remoteUrl = 'http://localhost:5050/ledger'
|
||||
config.executor.remoteUrl = 'http://localhost:5050/executor'
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure data source to use H2 in-memory database
|
||||
*/
|
||||
bindInstance(DataSource, new JdbcDataSource(url: 'jdbc:h2:mem:dbtdb;DB_CLOSE_DELAY=-1', user: ''))
|
||||
|
||||
/*
|
||||
* Migrate Flyway migrations at application start
|
||||
*/
|
||||
bind FlywayMigrationService
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Configure API endpoints
|
||||
*/
|
||||
handlers {
|
||||
|
||||
/*
|
||||
* Render index.html at root url
|
||||
*/
|
||||
get {
|
||||
render handlebarsTemplate('index.html')
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a new query to the current transaction
|
||||
*/
|
||||
post('addQueryToTransaction') {
|
||||
def transactionManager = get(TransactionManagerService)
|
||||
parse(Form).then { Form form ->
|
||||
def query = form.get('query')
|
||||
def transactionId = form.get('transactionId')
|
||||
if(transactionId) {
|
||||
transactionManager.execute(transactionId) {
|
||||
it.query(query)
|
||||
} .then {
|
||||
response.send(it.toString())
|
||||
}
|
||||
} else {
|
||||
transactionManager.execute {
|
||||
it.query(query)
|
||||
} .then {
|
||||
response.send(it.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Executes the current transaction by marking the transaction as complete and executing the transaction
|
||||
*/
|
||||
post('executeTransaction') {
|
||||
def transactionManager = get(TransactionManagerService)
|
||||
parse(Form).then { Form form ->
|
||||
def transactionId = form.get('transactionId')
|
||||
transactionManager.execute(transactionId) {
|
||||
it.complete()
|
||||
}.onError {
|
||||
response.status(Status.of(501))
|
||||
response.send(it.message)
|
||||
}.then {
|
||||
response.send(it.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds the query to a new transaction and executes the transaction immediately
|
||||
*/
|
||||
post('executeQuery') {
|
||||
def transactionManager = get(TransactionManagerService)
|
||||
parse(Form).then { Form form ->
|
||||
def query = form.get('query')
|
||||
transactionManager.execute {
|
||||
it.query(query).complete()
|
||||
} .then {
|
||||
response.send(it.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
<link rel="stylesheet" href="http://esironal.github.io/cmtouch/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="http://esironal.github.io/cmtouch/addon/hint/show-hint.css">
|
||||
<script src="http://esironal.github.io/cmtouch/lib/codemirror.js"></script>
|
||||
<script src="http://esironal.github.io/cmtouch/mode/javascript/javascript.js"></script>
|
||||
<script src="http://esironal.github.io/cmtouch/mode/css/css.js"></script>
|
||||
<script src="http://esironal.github.io/cmtouch/addon/selection/active-line.js"></script>
|
||||
<script src="http://esironal.github.io/cmtouch/addon/edit/matchbrackets.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||||
<style type="text/css">.CodeMirror { font-size: 10px;width: 100%;height: 100%;}</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main style="width:50%;height:100%;float:left">
|
||||
<h2>Transactions</h2>
|
||||
<form id="addQueryForm" action='/'>
|
||||
<input type="hidden" name="transactionId" id="transactionId" />
|
||||
<input name="query" style="width:300px" placeholder="Add query here..." />
|
||||
<button type="submit">Submit Query</button>
|
||||
<button id="submitAndExecute">Submit&Execute Query</button>
|
||||
</form>
|
||||
<form id="executeTransactionForm" action='/'>
|
||||
<input type="hidden" name="transactionId" id="transactionId" />
|
||||
<button id='executeTransactionButton' type="submit">Execute Transaction</button>
|
||||
</form>
|
||||
</main>
|
||||
|
||||
<aside style="width:50%;height:100%;float:right" >
|
||||
<h2>Ledger</h2>
|
||||
<div id="ledger-content"></div>
|
||||
</aside>
|
||||
|
||||
<script type="text/javascript">
|
||||
var editor = CodeMirror(document.getElementById("ledger-content"), {
|
||||
mode: "application/json",
|
||||
lineWrapping: true,
|
||||
lineNumbers: true,
|
||||
styleActiveLine: true,
|
||||
matchBrackets: true
|
||||
});
|
||||
|
||||
function refreshLedger() {
|
||||
$.get('/ledger', function(data) {
|
||||
editor.setValue(JSON.stringify(data.reverse(), null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
function addQueryToTransaction(event) {
|
||||
event.preventDefault();
|
||||
var queryData = $('form#addQueryForm').serialize();
|
||||
$.post( '/addQueryToTransaction', queryData, function(data) {
|
||||
$('input#transactionId').val(data.id);
|
||||
$('button#executeTransactionButton').show();
|
||||
refreshLedger();
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function executeTransaction(event) {
|
||||
event.preventDefault();
|
||||
var queryData = $('form#executeTransactionForm').serialize();
|
||||
$.post( '/executeTransaction', queryData, function(data) {
|
||||
$('input#transactionId').val(null);
|
||||
$('button#executeTransactionButton').hide();
|
||||
refreshLedger();
|
||||
}, 'json').fail(function(response) {
|
||||
alert(response.responseText);
|
||||
});
|
||||
}
|
||||
|
||||
function executeSingleQueryTransaction(event) {
|
||||
event.preventDefault();
|
||||
var queryData = $('form#addQueryForm').serialize();
|
||||
$.post( '/executeQuery', queryData, function(data) {
|
||||
$('input#transactionId').val(null);
|
||||
$('button#executeTransactionButton').hide();
|
||||
refreshLedger();
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$( "#addQueryForm" ).submit(addQueryToTransaction);
|
||||
$( "#executeTransactionForm" ).submit(executeTransaction);
|
||||
$('button#executeTransactionButton').hide();
|
||||
$('button#submitAndExecute').click(executeSingleQueryTransaction);
|
||||
window.onload = refreshLedger();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Core framework
|
||||
include 'dbt-core'
|
||||
include 'dbt-test'
|
||||
include 'dbt-demo'
|
||||
include 'docker-executor'
|
||||
include 'docker-ledger'
|
||||
|
||||
// Docker services
|
||||
include 'docker-executor'
|
||||
project(':docker-executor').name = 'dbt-executor'
|
||||
|
||||
include 'docker-ledger'
|
||||
project(':docker-ledger').name = 'dbt-ledger'
|
||||
|
||||
Reference in New Issue
Block a user