Skip to content

Commit

Permalink
kie-tools-2483: sonataflow-quarkus-devui: send the DevUI webapp a par…
Browse files Browse the repository at this point in the history
…ameter to recognize we are in a local cluster (apache#2510)
  • Loading branch information
wmedvede authored Aug 6, 2024
1 parent b982107 commit 084154c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,18 @@ public CardPageBuildItem pages(

String openapiPath = getProperty(configurationBuildItem, systemPropertyBuildItems, "quarkus.smallrye-openapi.path");
String devUIUrl = getProperty(configurationBuildItem, systemPropertyBuildItems, "kogito.dev-ui.url");
String dataIndexUrl = getProperty(configurationBuildItem, systemPropertyBuildItems, "kogito.data-index.url");
String dataIndexUrl = null;

cardPageBuildItem.addBuildTimeData("extensionBasePath", uiPath);
cardPageBuildItem.addBuildTimeData("openapiPath", openapiPath);
cardPageBuildItem.addBuildTimeData("devUIUrl", devUIUrl);
cardPageBuildItem.addBuildTimeData("dataIndexUrl", dataIndexUrl);

boolean isLocalCluster = ConfigProvider.getConfig().getOptionalValue(IS_LOCAL_CLUSTER, Boolean.class).orElse(false);
boolean isLocalCluster = ConfigProvider.getConfig().getOptionalValue(IS_LOCAL_CLUSTER, Boolean.class).orElse(true);
cardPageBuildItem.addBuildTimeData("isLocalCluster", isLocalCluster);
if (!isLocalCluster) {
dataIndexUrl = getProperty(configurationBuildItem, systemPropertyBuildItems, "kogito.data-index.url");
}
cardPageBuildItem.addBuildTimeData("dataIndexUrl", dataIndexUrl);

cardPageBuildItem.addPage(Page.webComponentPageBuilder()
.componentLink("qwc-sonataflow-quarkus-devui.js")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
/*
* Copyright 2024 Red Hat, Inc. and/or its affiliates.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { html, LitElement } from "lit";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
/*
* Copyright 2024 Red Hat, Inc. and/or its affiliates.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.kie.sonataflow.swf.tools.runtime.rpc;
Expand Down Expand Up @@ -43,6 +46,9 @@ public class SonataFlowQuarkusExtensionJsonRPCService {

public static final String ALL_WORKFLOWS_IDS_QUERY = "{ \"operationName\": \"getAllProcessesIds\", \"query\": \"query getAllProcessesIds{ ProcessInstances{ id } }\" }";

/**
* Configures if the sonataflow-quarkus-devui will execute deployed in a k8s.
*/
public static final String IS_LOCAL_CLUSTER = "sonataflow.devui.isLocalCluster";

private WebClient dataIndexWebClient;
Expand All @@ -58,7 +64,7 @@ public SonataFlowQuarkusExtensionJsonRPCService(Vertx vertx) {

@PostConstruct
public void init() {
isLocalCluster = ConfigProvider.getConfig().getOptionalValue(IS_LOCAL_CLUSTER, Boolean.class).orElse(false);
isLocalCluster = ConfigProvider.getConfig().getOptionalValue(IS_LOCAL_CLUSTER, Boolean.class).orElse(true);
if (!isLocalCluster) {
Optional<String> dataIndexURL = ConfigProvider.getConfig().getOptionalValue(DATA_INDEX_URL, String.class);
dataIndexURL.ifPresent(this::initDataIndexWebClient);
Expand Down

0 comments on commit 084154c

Please sign in to comment.