diff --git a/component/pom.xml b/component/pom.xml index 49db4a6..50c9eba 100644 --- a/component/pom.xml +++ b/component/pom.xml @@ -66,7 +66,6 @@ org.webjars.npm bootstrap-icons ${bootstrap-icons.version} - provided diff --git a/component/src/main/resources/application.properties b/component/src/main/resources/application.properties index d31670b..5e6c08e 100644 --- a/component/src/main/resources/application.properties +++ b/component/src/main/resources/application.properties @@ -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 diff --git a/component/src/main/resources/templates/BlogPostResource/blogPost.html b/component/src/main/resources/templates/BlogPostResource/blogPost.html index 2184661..e65191f 100644 --- a/component/src/main/resources/templates/BlogPostResource/blogPost.html +++ b/component/src/main/resources/templates/BlogPostResource/blogPost.html @@ -18,51 +18,6 @@ - - {/extraJs} {#extraBundle} @@ -142,7 +97,7 @@

{blogPost.title}

{/if}
- Leave a thumbs up if you liked it + Leave a thumbs up if you liked it
diff --git a/component/src/main/resources/web/blogpage/blog-index.js b/component/src/main/resources/web/blogpage/blog-index.js index de0257a..a8eced5 100644 --- a/component/src/main/resources/web/blogpage/blog-index.js +++ b/component/src/main/resources/web/blogpage/blog-index.js @@ -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"); + } + }); + }); + }); + } + }); + }); diff --git a/doc/cluster.md b/doc/cluster.md index ad0719d..ddcee21 100644 --- a/doc/cluster.md +++ b/doc/cluster.md @@ -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 diff --git a/service/src/main/resources/application.properties b/service/src/main/resources/application.properties index fa2ae5e..58ef7aa 100644 --- a/service/src/main/resources/application.properties +++ b/service/src/main/resources/application.properties @@ -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} +