Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qs web-components #58

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ pom.xml.versionsBackup
release.properties
.flattened-pom.xml

# web-bundler uses it for IDE support
node_modules/
ia3andy marked this conversation as resolved.
Show resolved Hide resolved

# Eclipse
.project
.classpath
Expand Down
2 changes: 2 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,5 @@ you will need to set up a few things manually:
== License

This project is licensed under the Apache License Version 2.0.

The web assets in `src/main/resources/web` are licensed under the Creative Commons Attribution 3.0 International License.
136 changes: 127 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.quarkus.search</groupId>
<artifactId>search-quarkus-io</artifactId>
Expand Down Expand Up @@ -28,7 +27,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.version>3.9.0</quarkus.version>
<quarkus.version>3.9.1</quarkus.version>
<revision>999-SNAPSHOT</revision>
<skipITs>true</skipITs>
<surefire-plugin.version>3.2.5</surefire-plugin.version>
Expand All @@ -38,6 +37,7 @@
<version.impsort-maven-plugin>1.9.0</version.impsort-maven-plugin>
<!-- This version needs to match the version in src/main/docker/opensearch-custom.Dockerfile -->
<version.opensearch>2.12</version.opensearch>
<version.quarkus-web-bundler>1.4.0</version.quarkus-web-bundler>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -80,6 +80,31 @@
<artifactId>jgettext</artifactId>
<version>0.15.1</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.helm</groupId>
<artifactId>quarkus-helm</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.playwright</groupId>
<artifactId>quarkus-playwright</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lit</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lodash</artifactId>
<version>4.17.21</version>
</dependency>
<dependency>
<groupId>org.mvnpm.at.types</groupId>
<artifactId>lodash</artifactId>
<version>4.17.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
Expand All @@ -105,7 +130,12 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.web-bundler</groupId>
<artifactId>quarkus-web-bundler</artifactId>
<version>${version.quarkus-web-bundler}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -117,7 +147,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
<artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -163,15 +193,37 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-cache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.helm</groupId>
<artifactId>quarkus-helm</artifactId>
<version>1.2.3</version>
</dependency>

<!-- Web Dependencies -->
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lit</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lodash</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm.at.types</groupId>
<artifactId>lodash</artifactId>
<scope>provided</scope>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand All @@ -190,10 +242,13 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<groupId>io.quarkiverse.playwright</groupId>
<artifactId>quarkus-playwright</artifactId>
<version>0.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
Expand Down Expand Up @@ -339,4 +394,67 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Locked dependencies for mvnpm (Update with 'mvn io.mvnpm:locker-maven-plugin:LATEST:lock -Dunlocked') -->
<id>locker</id>
<activation>
ia3andy marked this conversation as resolved.
Show resolved Hide resolved
<property>
<name>!unlocked</name>
</property>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mvnpm.at.lit-labs</groupId>
<artifactId>ssr-dom-shim</artifactId>
<version>1.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mvnpm.at.lit</groupId>
<artifactId>reactive-element</artifactId>
<version>2.0.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mvnpm.at.types</groupId>
<artifactId>lodash</artifactId>
<version>4.17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm.at.types</groupId>
<artifactId>trusted-types</artifactId>
<version>2.0.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lit-element</artifactId>
<version>4.0.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lit-html</artifactId>
<version>3.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lit</artifactId>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>lodash</artifactId>
<version>4.17.21</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>
</project>
15 changes: 15 additions & 0 deletions src/main/java/io/quarkus/search/app/SearchService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import jakarta.validation.constraints.Max;
Expand All @@ -19,6 +20,8 @@
import io.quarkus.search.app.entity.Language;
import io.quarkus.search.app.entity.QuarkusVersionAndLanguageRoutingBinder;

import io.quarkus.runtime.LaunchMode;

import org.hibernate.Length;
import org.hibernate.search.engine.search.common.BooleanOperator;
import org.hibernate.search.engine.search.common.ValueConvert;
Expand All @@ -28,6 +31,8 @@
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.jboss.resteasy.reactive.RestQuery;

import io.vertx.ext.web.Router;

@ApplicationScoped
@Path("/")
public class SearchService {
Expand All @@ -39,6 +44,16 @@ public class SearchService {
@Inject
SearchSession session;

public void init(@Observes Router router) {
if (LaunchMode.current().isDevOrTest()) {
return;
}
// DISABLE the index.html route in production
router.getWithRegex("/(index\\.html)?").order(Integer.MIN_VALUE).handler(rc -> {
rc.response().setStatusCode(404).end();
});
}

@GET
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Search for Guides")
Expand Down
12 changes: 11 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ quarkus.http.header."X-Content-Type-Options".value=nosniff
quarkus.http.header."X-Frame-Options".value=deny
quarkus.http.header."Strict-Transport-Security".value=max-age=31536000; includeSubDomains

quarkus.resteasy-reactive.path=/api
quarkus.rest.path=/api

########################
# Hibernate
Expand Down Expand Up @@ -114,6 +114,8 @@ quarkus.test.integration-test-profile=integrationtest
%dev,test,integrationtest.indexing.scheduled.cron=off
# Allow localhost in particular
%dev.quarkus.http.cors.origins=/.*/
%dev.quarkus.http.header."Access-Control-Allow-Private-Network".value=true


########################
# Logging
Expand Down Expand Up @@ -233,3 +235,11 @@ quarkus.helm.values."@.opensearch.resources.limits.cpu".value=2000m
quarkus.helm.values."@.opensearch.resources.requests.cpu".value=500m
quarkus.helm.values."@.opensearch.resources.limits.memory".value=2Gi
quarkus.helm.values."@.opensearch.resources.requests.memory".value=1.9Gi

########################
# Web Bundler config
########################
quarkus.web-bundler.loaders.data-url=svg
quarkus.web-bundler.loaders.file=
quarkus.web-bundler.bundle-redirect=true
quarkus.web-bundler.dependencies.node-modules=node_modules
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/main/resources/web/app/assets/icons/docsicon-pdf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions src/main/resources/web/app/assets/icons/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import tutorials from './docsicon-tutorials.svg';
import guides from './docsicon-guides.svg';
import howto from './docsicon-guides.svg';
import pdf from './docsicon-pdf.svg';
import concepts from './docsicon-concepts.svg';
import reference from './docsicon-reference.svg';
import quarkus from './quarkus_icon_default.svg';
import quarkiverse from './quarkiverse_icon_default.svg';
import loading from './loading.svg';

const icons = {
docs: {
tutorials,
guides,
howto,
pdf,
concepts,
reference
},
origins: {
quarkus,
quarkiverse
},
loading
}

export default icons;
Loading
Loading