Skip to content

Commit

Permalink
Merge pull request #32101 from phillip-kruger/dev-ui-naming
Browse files Browse the repository at this point in the history
Dev UI: Auto naming for JsonRPC and build time data
  • Loading branch information
cescoffier committed Mar 26, 2023
2 parents 89e108d + 63edc9f commit 8a1a768
Show file tree
Hide file tree
Showing 77 changed files with 647 additions and 359 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@

public class ArcDevUIProcessor {

private static final String NAME = "ArC";

@BuildStep(onlyIf = IsDevelopment.class)
public CardPageBuildItem pages(ArcBeanInfoBuildItem arcBeanInfoBuildItem, ArcConfig config) {
DevBeanInfos beanInfos = arcBeanInfoBuildItem.getBeanInfos();

CardPageBuildItem pageBuildItem = new CardPageBuildItem(NAME);
CardPageBuildItem pageBuildItem = new CardPageBuildItem();

List<DevBeanInfo> beans = beanInfos.getBeans();
if (!beans.isEmpty()) {
Expand Down Expand Up @@ -93,7 +91,7 @@ public CardPageBuildItem pages(ArcBeanInfoBuildItem arcBeanInfoBuildItem, ArcCon

@BuildStep(onlyIf = IsDevelopment.class)
JsonRPCProvidersBuildItem createJsonRPCService() {
return new JsonRPCProvidersBuildItem(NAME, ArcJsonRPCService.class);
return new JsonRPCProvidersBuildItem(ArcJsonRPCService.class);
}

private List<DevBeanWithInterceptorInfo> toDevBeanWithInterceptorInfo(List<DevBeanInfo> beans, DevBeanInfos devBeanInfos) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement, html, css} from 'lit';
import { columnBodyRenderer } from '@vaadin/grid/lit.js';
import { beans } from 'arc-data';
import { beans } from 'build-time-data';
import '@vaadin/grid';
import '@vaadin/vertical-layout';
import 'qui-badge';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LitElement, html, css} from 'lit';
import { decorators } from 'arc-data';
import { decorators } from 'build-time-data';

/**
* This component shows the Arc Decorators
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import '@vaadin/checkbox';
* This component shows the Arc Fired Events
*/
export class QwcArcFiredEvents extends LitElement {
jsonRpc = new JsonRpc("ArC");
jsonRpc = new JsonRpc(this);

static styles = css`
.menubar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement, html, css} from 'lit';
import { interceptors } from 'arc-data';
import { interceptors } from 'build-time-data';
import { columnBodyRenderer } from '@vaadin/grid/lit.js';
import '@vaadin/grid';
import '@vaadin/vertical-layout';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '@vaadin/checkbox';
* This component shows the Arc Invocation Trees
*/
export class QwcArcInvocationTrees extends LitElement {
jsonRpc = new JsonRpc("ArC");
jsonRpc = new JsonRpc(this);

static styles = css`
.menubar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement, html, css} from 'lit';
import { observers } from 'arc-data';
import { observers } from 'build-time-data';
import { columnBodyRenderer } from '@vaadin/grid/lit.js';
import '@vaadin/grid';
import '@vaadin/vertical-layout';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import '@vaadin/grid';
import '@vaadin/vertical-layout';
import { columnBodyRenderer } from '@vaadin/grid/lit.js';
import 'qui-badge';
import { removedBeans } from 'arc-data';
import { removedDecorators } from 'arc-data';
import { removedInterceptors } from 'arc-data';
import { removedBeans } from 'build-time-data';
import { removedDecorators } from 'build-time-data';
import { removedInterceptors } from 'build-time-data';

/**
* This component shows the Arc RemovedComponents
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkus.cache.deployment.devconsole;
package io.quarkus.cache.deployment.devui;

import io.quarkus.cache.runtime.devconsole.CacheJsonRPCService;
import io.quarkus.deployment.IsDevelopment;
Expand All @@ -8,11 +8,11 @@
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.Page;

public class CacheDevUiConsoleProcessor {
public class CacheDevUiProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
CardPageBuildItem create(CurateOutcomeBuildItem bi) {
CardPageBuildItem pageBuildItem = new CardPageBuildItem("Cache");
CardPageBuildItem pageBuildItem = new CardPageBuildItem();
pageBuildItem.addPage(Page.webComponentPageBuilder()
.title("Caches")
.componentLink("qwc-cache-caches.js")
Expand All @@ -23,6 +23,6 @@ CardPageBuildItem create(CurateOutcomeBuildItem bi) {

@BuildStep(onlyIf = IsDevelopment.class)
JsonRPCProvidersBuildItem createJsonRPCServiceForCache() {
return new JsonRPCProvidersBuildItem("Cache", CacheJsonRPCService.class);
return new JsonRPCProvidersBuildItem(CacheJsonRPCService.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import '@vaadin/grid/vaadin-grid-sort-column.js';

export class QwcCacheCaches extends LitElement {

jsonRpc = new JsonRpc("Cache");
jsonRpc = new JsonRpc(this);

// Component style
static styles = css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CaffeineDevUIProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
void createCard(BuildProducer<CardPageBuildItem> cardPageBuildItemBuildProducer) {
final CardPageBuildItem card = new CardPageBuildItem("Caffeine");
final CardPageBuildItem card = new CardPageBuildItem();

final PageBuilder versionPage = Page.externalPageBuilder("Version")
.icon("font-awesome-solid:mug-hot")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement, html, css} from 'lit';
import { pages } from 'caffeine-data';
import { pages } from 'build-time-data';
import 'qwc/qwc-extension-link.js';

const NAME = "Caffeine";
Expand All @@ -10,16 +10,13 @@ export class QwcCaffeineCard extends LitElement {
display: flex;
justify-content: flex-start;
}
.description {
padding-bottom: 10px;
}
.logo {
padding-bottom: 10px;
margin-right: 5px;
}
.card-content {
color: var(--lumo-contrast-90pct);
display: flex;
Expand All @@ -28,7 +25,6 @@ export class QwcCaffeineCard extends LitElement {
padding: 10px 10px;
height: 100%;
}
.card-content slot {
display: flex;
flex-flow: column wrap;
Expand Down Expand Up @@ -74,7 +70,9 @@ export class QwcCaffeineCard extends LitElement {
staticLabel="${page.staticLabel}"
dynamicLabel="${page.dynamicLabel}"
streamingLabel="${page.streamingLabel}"
path="${page.id}"
path="${page.id}"
?embed=${page.embed}
externalUrl="${page.metadata.externalUrl}"
webcomponent="${page.componentLink}" >
</qwc-extension-link>
`)}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CardPageBuildItem create(List<AvailableContainerImageExtensionBuildItem> extensi
JsonArray array = extensions.stream().map(AvailableContainerImageExtensionBuildItem::getName).sorted()
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

CardPageBuildItem card = new CardPageBuildItem("Container Image");
CardPageBuildItem card = new CardPageBuildItem();
card.addBuildTimeData("builderTypes", array);
card.addPage(Page.webComponentPageBuilder()
.title("Build Container")
Expand All @@ -40,7 +40,7 @@ CardPageBuildItem create(List<AvailableContainerImageExtensionBuildItem> extensi
@BuildStep(onlyIf = IsDevelopment.class)
JsonRPCProvidersBuildItem createJsonRPCServiceForContainerBuild() {
DevConsoleManager.register("container-image-build-action", build());
return new JsonRPCProvidersBuildItem("ContainerImage", ContainerBuilderJsonRpcService.class);
return new JsonRPCProvidersBuildItem(ContainerBuilderJsonRpcService.class);
}

private Function<Map<String, String>, String> build() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '@vaadin/button';
import {until} from 'lit/directives/until.js';
import '@vaadin/grid';
import '@vaadin/grid/vaadin-grid-sort-column.js';
import {builderTypes} from 'container-image-data';
import {builderTypes} from 'build-time-data';
import '@vaadin/text-field';
import '@vaadin/text-area';
import '@vaadin/form-layout';
Expand All @@ -18,7 +18,7 @@ import '@vaadin/list-box';

export class QwcContainerImageBuild extends LitElement {

jsonRpc = new JsonRpc("ContainerImage");
jsonRpc = new JsonRpc(this);

static properties = {
builders: {type: Array},
Expand All @@ -38,15 +38,17 @@ export class QwcContainerImageBuild extends LitElement {
}
`;


connectedCallback() {
super.connectedCallback();
constructor() {
super();
this.build_in_progress = false;
this.build_complete = false;
this.build_error = false;
this.result = "";

this.builders = builderTypes.list;

this.builders = [];
if(builderTypes){
this.builders = builderTypes.list;
}

this.types = [];
this.types.push({name: "Default", value: ""});
Expand All @@ -65,9 +67,12 @@ export class QwcContainerImageBuild extends LitElement {

_renderForm() {
const _builders = [];
this.builders.map(item => _builders.push({'label': item, 'value': item}));
const _defaultBuilder = _builders[0].label;

let _defaultBuilder = "";
if(this.builders){
this.builders.map(item => _builders.push({'label': item, 'value': item}));
_defaultBuilder = _builders[0].label;
}

const _types = [];
this.types.map(item => _types.push({'label': item.name, 'value': item.value}));
const _defaultType = "jar";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DevConsoleRouteBuildItem devConsoleCleanDatabaseHandler(DatabaseRecorder recorde

@BuildStep(onlyIf = IsDevelopment.class)
CardPageBuildItem create(DataSourcesBuildTimeConfig dataSourceBuildTimeConfig) {
CardPageBuildItem card = new CardPageBuildItem("Datasources");
CardPageBuildItem card = new CardPageBuildItem();

List<String> names = new ArrayList<>();
names.add("<default>");
Expand All @@ -54,7 +54,7 @@ CardPageBuildItem create(DataSourcesBuildTimeConfig dataSourceBuildTimeConfig) {

@BuildStep(onlyIf = IsDevelopment.class)
JsonRPCProvidersBuildItem registerJsonRpcBackend() {
return new JsonRPCProvidersBuildItem("Datasources", DatasourceJsonRpcService.class);
return new JsonRPCProvidersBuildItem(DatasourceJsonRpcService.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import 'qui-alert';
import { columnBodyRenderer } from '@vaadin/grid/lit.js';
import '@vaadin/grid/vaadin-grid-sort-column.js';

import {datasources} from 'datasources-data';
import {datasources} from 'build-time-data';


export class QwcDatasourcesReset extends LitElement {

jsonRpc = new JsonRpc("Datasources");
jsonRpc = new JsonRpc(this);

static styles = css`
.button {
Expand Down Expand Up @@ -53,7 +53,6 @@ export class QwcDatasourcesReset extends LitElement {
return html`${until(this._renderDataSourceTable(), html`<span>Loading datasources...</span>`)}`;
}


_renderDataSourceTable() {
if (this._ds) {
return html`
Expand All @@ -63,7 +62,6 @@ export class QwcDatasourcesReset extends LitElement {
header="Name"
${columnBodyRenderer(this._nameRenderer, [])}>
</vaadin-grid-column>
<vaadin-grid-column auto-width
header="Action"
${columnBodyRenderer(this._actionRenderer, [])}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@

@BuildSteps(onlyIf = { HibernateOrmEnabled.class, IsDevelopment.class })
public class HibernateOrmDevUIProcessor {
private static final String NAME = "Hibernate ORM";

@BuildStep
public CardPageBuildItem create() {
CardPageBuildItem card = new CardPageBuildItem(NAME);
CardPageBuildItem card = new CardPageBuildItem();
card.addPage(Page.webComponentPageBuilder()
.title("Persistence Units")
.componentLink("hibernate-orm-persistence-units.js")
Expand All @@ -46,7 +45,7 @@ public CardPageBuildItem create() {

@BuildStep
JsonRPCProvidersBuildItem createJsonRPCService() {
return new JsonRPCProvidersBuildItem(NAME, HibernateOrmDevJsonRpcService.class);
return new JsonRPCProvidersBuildItem(HibernateOrmDevJsonRpcService.class);
}

@BuildStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class HibernateOrmEntityTypesComponent extends LitElement {
}
`;

jsonRpc = new JsonRpc("Hibernate ORM");
jsonRpc = new JsonRpc(this);

static properties = {
_persistenceUnits: {state: true, type: Array}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class HibernateOrmNamedQueriesComponent extends LitElement {
}
`;

jsonRpc = new JsonRpc("Hibernate ORM");
jsonRpc = new JsonRpc(this);

static properties = {
_persistenceUnits: {state: true, type: Array}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class HibernateOrmPersistenceUnitsComponent extends LitElement {
}
`;

jsonRpc = new JsonRpc("Hibernate ORM");
jsonRpc = new JsonRpc(this);

static properties = {
_persistenceUnits: {state: true, type: Array}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

@BuildSteps(onlyIf = { HibernateSearchEnabled.class, IsDevelopment.class })
public class HibernateSearchElasticsearchDevUIProcessor {
private static final String NAME = "Hibernate Search + Elasticsearch";

@BuildStep
@Record(RUNTIME_INIT)
Expand All @@ -35,7 +34,7 @@ public CardPageBuildItem create(HibernateSearchElasticsearchDevRecorder recorder
.collect(Collectors.toSet());
recorder.initController(runtimeConfig, persistenceUnitNames);

CardPageBuildItem card = new CardPageBuildItem(NAME);
CardPageBuildItem card = new CardPageBuildItem();
card.addPage(Page.webComponentPageBuilder()
.title("Indexed Entity Types")
.componentLink("hibernate-search-orm-elasticsearch-indexed-entity-types.js")
Expand All @@ -57,6 +56,6 @@ AdditionalBeanBuildItem additionalBeans() {

@BuildStep
JsonRPCProvidersBuildItem createJsonRPCService() {
return new JsonRPCProvidersBuildItem(NAME, HibernateSearchElasticsearchDevJsonRpcService.class);
return new JsonRPCProvidersBuildItem(HibernateSearchElasticsearchDevJsonRpcService.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class HibernateSearchOrmElasticsearchIndexedEntitiesComponent extends Lit
}
`;

jsonRpc = new JsonRpc("Hibernate Search + Elasticsearch");
jsonRpc = new JsonRpc(this);

static properties = {
_persistenceUnits: {state: true, type: Array},
Expand Down

0 comments on commit 8a1a768

Please sign in to comment.