Skip to content

Commit

Permalink
Fixed various assets issues and db connexion
Browse files Browse the repository at this point in the history
  • Loading branch information
gdevxy committed Dec 29, 2024
1 parent 04c7ad3 commit 09e2183
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 47 deletions.
1 change: 0 additions & 1 deletion component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap-icons</artifactId>
<version>${bootstrap-icons.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down
2 changes: 2 additions & 0 deletions component/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ quarkus.jackson.serialization-inclusion=non-null
quarkus.jackson.accept-case-insensitive-enums=true

# web-bundler
quarkus.web-bundler.dependencies.compile-only=false

quarkus.web-bundler.bundle.utils=true
quarkus.web-bundler.bundle.utils.key=utils
quarkus.web-bundler.bundle.utils.dir=utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,6 @@
<script src="/webjars/highlightjs/languages/json.min.js"></script>
<script src="/webjars/highlightjs/languages/xml.min.js"></script>
<script>hljs.highlightAll();</script>
<script src="/_static/jquery/dist/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("#btnRate").on('click', function (e) {

if($(e.target).hasClass("thumbs-up-success")) {

$.ajax({
type: 'POST',
url: `/blog-posts/{blogPost.id}/thumbs-down`,
success: function () {
$(`#btnRate`).removeClass("thumbs-up-success").removeClass("pulse");
},
error: function (err) {
$(`#btnRate`).addClass("tada");
}
});

} else {

grecaptcha.ready(function () {
grecaptcha
.execute("6Lc7vagqAAAAAKi_E_E275yxYo_B80-RvOVmVaid", { action: "submit" })
.then(function (token) {
$.ajax({
type: 'POST',
url: `/blog-posts/{blogPost.id}/thumbs-up`,
dataType: 'json',
contentType: "application/json",
data: JSON.stringify({
captcha: token
}),
success: function () {
$(`#btnRate`).addClass("thumbs-up-success").addClass("pulse");
},
error: function (err) {
$(`#btnRate`).addClass("tada");
}
});
});
});
}
});
});
</script>
{/extraJs}

{#extraBundle}
Expand Down Expand Up @@ -142,7 +97,7 @@ <h1 class="card-title">{blogPost.title}</h1>
<div class="col text-end">
{/if}
<div class="blog-paragraph">
Leave a thumbs up if you liked it <span class="ps-2"><button id="btnRate" type="button" class="btn btn-dark bi bi-hand-thumbs-up-fill {#if thumbsUpEnabled}thumbs-up-success{/}"></button></span>
Leave a thumbs up if you liked it <span class="ps-2"><button id="btnRate" name="{blogPost.id}" type="button" class="btn btn-dark bi bi-hand-thumbs-up-fill {#if thumbsUpEnabled}thumbs-up-success{/}"></button></span>
</div>
</div>
</div>
Expand Down
44 changes: 44 additions & 0 deletions component/src/main/resources/web/blogpage/blog-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,48 @@ $(document).ready(function() {
});

checkScrollPosition();

$("#btnRate").on('click', function (e) {

const btn = $(e.target);

if(btn.hasClass("thumbs-up-success")) {

$.ajax({
type: 'POST',
url: `/blog-posts/${btn.attr("name")}/thumbs-down`,
success: function () {
btn.removeClass("thumbs-up-success").removeClass("pulse");
},
error: function (err) {
btn.addClass("tada");
}
});

} else {

grecaptcha.ready(function () {
grecaptcha
.execute("6Lc7vagqAAAAAKi_E_E275yxYo_B80-RvOVmVaid", { action: "submit" })
.then(function (token) {
$.ajax({
type: 'POST',
url: `/blog-posts/${btn.attr("name")}/thumbs-up`,
dataType: 'json',
contentType: "application/json",
data: JSON.stringify({
captcha: token
}),
success: function () {
btn.addClass("thumbs-up-success").addClass("pulse");
},
error: function (err) {
btn.addClass("tada");
}
});
});
});
}
});

});
4 changes: 4 additions & 0 deletions doc/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ some debugging actions
kubectl describe clusterissuer letsencrypt-prod
kubectl describe ingress gdevxy-ingress
```

## Database

Add egress rule to load balancer config for port <XXXX>
6 changes: 6 additions & 0 deletions service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ quarkus.cache.caffeine.blog-post-tags.expire-after-write=1h
# Database
quarkus.datasource.username=${GDEVXY_DATABASE_USERNAME:test}
quarkus.datasource.password=${GDEVXY_DATABASE_PASSWORD:test}
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://gdevxy-gdevxy.b.aivencloud.com:28151/defaultdb?sslmode=require

quarkus.datasource.devservices.enabled=true
quarkus.datasource.devservices.db-name=defaultdb
quarkus.datasource.devservices.port=5432

quarkus.datasource.reactive.max-size=9
quarkus.datasource.reactive.url=postgresql://localhost:5432/defaultdb
%prod.quarkus.datasource.reactive.url=postgresql://gdevxy-gdevxy.b.aivencloud.com:28151/defaultdb?sslmode=require
quarkus.datasource.reactive.trust-all=true

# Flyway
quarkus.flyway.active=true
quarkus.flyway.migrate-at-start=true

# Google Captcha
google.captcha.secret=${GOOGLE_CAPTCHA_SECRET:test}

0 comments on commit 09e2183

Please sign in to comment.