Skip to content

Commit ec5cd8d

Browse files
committed
Sync documentation of main branch
1 parent 8c2275c commit ec5cd8d

File tree

2 files changed

+111
-18
lines changed

2 files changed

+111
-18
lines changed

_generated-doc/main/infra/quarkus-all-build-items.adoc

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,6 @@ _No Javadoc found_
710710

711711
_No Javadoc found_
712712

713-
`java.util.Map<String,String> configs`
714-
715-
_No Javadoc found_
716-
717713
`java.util.function.Supplier<Map<String,String>> lazyConfigs`
718714

719715
_No Javadoc found_
@@ -773,6 +769,17 @@ _No Javadoc found_
773769

774770

775771

772+
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesCustomizerBuildItem.java[`io.quarkus.deployment.builditem.DevServicesCustomizerBuildItem`, window="_blank"]
773+
[.description]
774+
--
775+
_No Javadoc found_
776+
-- a|`java.util.function.BiFunction<DevServicesResultBuildItem,Startable,Startable> customizer`
777+
778+
_No Javadoc found_
779+
780+
781+
782+
776783
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesLauncherConfigResultBuildItem.java[`io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem`, window="_blank"]
777784
[.description]
778785
--
@@ -798,12 +805,9 @@ _No Javadoc found_
798805
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesRegistryBuildItem.java[`io.quarkus.deployment.builditem.DevServicesRegistryBuildItem`, window="_blank"]
799806
[.description]
800807
--
801-
_No Javadoc found_
802-
-- a|`io.quarkus.devservices.crossclassloader.runtime.RunningDevServicesRegistry tracker`
803-
804-
_No Javadoc found_
805-
806-
`java.util.UUID uuid`
808+
This is a wrapper around the RunningDevServicesRegistry, so the registry can be loaded with the system classloader The QuarkusClassLoader takes care of loading the tracker with the right classloader
809+
This build item is used to manage the lifecycle of dev services across different features and launch modes.
810+
-- a|`java.util.UUID uuid`
807811
808812
_No Javadoc found_
809813

@@ -821,28 +825,47 @@ _No Javadoc found_
821825
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java[`io.quarkus.deployment.builditem.DevServicesResultBuildItem`, window="_blank"]
822826
[.description]
823827
--
824-
BuildItem for running dev services. Combines injected configs to the application with container id (if it exists).
828+
BuildItem for discovered (running) or to be started dev services.
825829
Processors are expected to return this build item not only when the dev service first starts, but also if a running dev service already exists.
826-
`RunningDevService` helps to manage the lifecycle of the running dev service.
830+
Two builders are provided to create this build item:
831+
- `DevServicesResultBuildItem#discovered()` for discovered dev services, provides config to be injected to the application with container id (if it exists).
832+
- `DevServicesResultBuildItem#owned()` for owned dev services, that will be started before application start, provides the startable supplier and config injected to the application and post-start action.
833+
`RunningDevService` is deprecated in favor of builder flavors.
827834
-- a|`java.lang.String name`
828835
829-
_No Javadoc found_
836+
The name of the dev service, usually feature name.
830837
831838
`java.lang.String description`
832839
833-
_No Javadoc found_
840+
A description of the dev service, usually feature name with additional information.
834841
835842
`java.lang.String containerId`
836843
837-
_No Javadoc found_
844+
The container id of the dev service, if it is running in a container. If the dev service is not running in a container, this will be null.
838845
839846
`java.util.Map<String,String> config`
840847
841-
_No Javadoc found_
848+
The map of static application config
842849
843-
`io.quarkus.deployment.builditem.RunnableDevService runnableDevService`
850+
`java.lang.String serviceName`
844851
845-
_No Javadoc found_
852+
If the feature provides multiple dev services, this is the name of the service
853+
854+
`java.lang.Object serviceConfig`
855+
856+
The config object that is used to identify the dev service
857+
858+
`java.util.function.Supplier<Startable> startableSupplier`
859+
860+
Supplier of a startable dev service
861+
862+
`java.util.function.Consumer<Startable> postStartAction`
863+
864+
An action to perform after the dev service has started.
865+
866+
`java.util.Map<String,Function<Startable,String>> applicationConfigProvider`
867+
868+
A map of application config that is dependent on the started service
846869
847870
848871
@@ -9163,6 +9186,10 @@ _No Javadoc found_
91639186

91649187
_No Javadoc found_
91659188

9189+
`java.lang.String headlessComponentLink`
9190+
9191+
_No Javadoc found_
9192+
91669193

91679194

91689195

@@ -9506,6 +9533,10 @@ _No Javadoc found_
95069533

95079534
_No Javadoc found_
95089535

9536+
`java.lang.String headlessComponentLink`
9537+
9538+
_No Javadoc found_
9539+
95099540

95109541

95119542

_versions/main/guides/dev-ui.adoc

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,68 @@ There might be cases where you develop an extension outside of Quarkus core (lik
12951295

12961296
image::dev-ui-jsonrpc-log-v2.png[alt=Dev UI Json RPC Log,role="center"]
12971297

1298+
=== Advanced: Headless Components
1299+
1300+
In rare cases, an extension might need to execute logic *even when its main component is not added to the DOM*. This is typically useful for setting global state or triggering background tasks without displaying any UI.
1301+
1302+
To support this, extensions can declare a *headless component* — a web component with no visual representation that runs automatically on page load.
1303+
1304+
Declare the headless component in your extension:
1305+
1306+
[source,java]
1307+
----
1308+
CardPageBuildItem cardPageBuildItem = new CardPageBuildItem();
1309+
cardPageBuildItem.setHeadlessComponentLink("qwc-chappie-init.js"); // <1>
1310+
----
1311+
<1> Set the path to the headless component JavaScript file (relative to the extension resources).
1312+
1313+
Then create the component alongside your other Dev UI pages:
1314+
1315+
[source,javascript]
1316+
----
1317+
import { LitElement } from 'lit';
1318+
import { JsonRpc } from 'jsonrpc';
1319+
import { assistantState } from 'assistant-state';
1320+
1321+
/**
1322+
* This load on browser load (headless components) to set the initial assistant state
1323+
*/
1324+
class QwcChappieInit extends LitElement {
1325+
1326+
static properties = {
1327+
namespace: {attribute: true}, // <1>
1328+
}
1329+
1330+
connectedCallback() {
1331+
super.connectedCallback();
1332+
this._init().then(() => this.remove()); // <2>
1333+
}
1334+
1335+
async _init() {
1336+
const jsonRpc = new JsonRpc(this.namespace); // <3>
1337+
1338+
jsonRpc.loadConfiguration().then(jsonRpcResponse => {
1339+
if(jsonRpcResponse.result && jsonRpcResponse.result.name){
1340+
assistantState.ready();
1341+
}else{
1342+
assistantState.available();
1343+
}
1344+
});
1345+
}
1346+
1347+
// prevent rendering anything
1348+
createRenderRoot() { // <3>
1349+
return this;
1350+
}
1351+
}
1352+
customElements.define('qwc-chappie-init', QwcChappieInit); // <4>
1353+
----
1354+
<1> The `namespace` attribute will always be provided automatically by Dev UI.
1355+
<2> Perform your logic in `connectedCallback`, then remove the element if no longer needed.
1356+
<3> When using JsonRPC, pass in the provided namespace (instead of `this`, as in normal components).
1357+
<4> Your tag definition have to be the filename without the `.js`
1358+
1359+
12981360
=== Testing
12991361

13001362
You can add tests to your extension that test:

0 commit comments

Comments
 (0)