You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "Kusuma04-dev (via GitHub)" <gi...@apache.org> on 2025/05/07 11:34:38 UTC
[PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Kusuma04-dev opened a new pull request, #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119
closes https://github.com/apache/incubator-kie-tools/issues/3118
This PR enhances the Apply Accelerator workflow:
When an Accelerator is selected from the Apply Accelerator dropdown, a modal window opens.
Inside this Accelerator modal, an AuthSession selector dropdown is now available:
It comes pre-selected with a compatible AuthSession based on the Accelerator’s repository domain.
If no compatible AuthSession is found, users can manually select one from the dropdown.
Based on the selected authentication details (username/password), the modal will display validation messages.
If no compatible authentication is selected, the Apply button remains disabled to prevent invalid submissions.
Accelerator Configuration
To add Accelerators, include entries like the following in your defaultEnvJson.ts:
```
{
name: "testing",
iconUrl: "images/quarkus-logo.png",
gitRepositoryUrl: "https://github.com/Kusuma04-dev/Sample",
gitRepositoryGitRef: "main",
dmnDestinationFolder: "src/main/resources/dmn",
bpmnDestinationFolder: "src/main/resources/bpmn",
otherFilesDestinationFolder: "src/main/resources/others",
},
{
name: "sample quarkus",
iconUrl: "images/quarkus-logo.png",
gitRepositoryUrl: "https://github.com/apache/incubator-kie-sandbox-quarkus-accelerator",
gitRepositoryGitRef: "10.0.x",
dmnDestinationFolder: "src/main/resources/dmn",
bpmnDestinationFolder: "src/main/resources/bpmn",
otherFilesDestinationFolder: "src/main/resources/others",
},
```
PFA example of how UI looks:
<img width="908" alt="Screenshot 2025-05-06 at 11 20 58 PM" src="https://github.com/user-attachments/assets/74eb21c0-e91f-40c0-a309-1f3d4e1663b3" />
To test with a private repository, generate a personal access token with the necessary permissions for the private repo. Add this token to create an AuthSession, then select it in the modal and validate the authentication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078361969
##########
packages/online-editor/src/accelerators/AcceleratorsHooks.tsx:
##########
@@ -128,7 +128,14 @@ export function useAcceleratorsDispatch(workspace: ActiveWorkspace) {
}, [workspace.descriptor.workspaceId, workspaces]);
const applyAcceleratorToWorkspace = useCallback(
- async (accelerator: AcceleratorConfig, currentFile: WorkspaceFile) => {
+ async (
+ accelerator: AcceleratorConfig,
Review Comment:
Yes it is optional
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078287002
##########
packages/online-editor/src/accelerators/AcceleratorsHooks.tsx:
##########
@@ -128,7 +128,14 @@ export function useAcceleratorsDispatch(workspace: ActiveWorkspace) {
}, [workspace.descriptor.workspaceId, workspaces]);
const applyAcceleratorToWorkspace = useCallback(
- async (accelerator: AcceleratorConfig, currentFile: WorkspaceFile) => {
+ async (
+ accelerator: AcceleratorConfig,
+ currentFile: WorkspaceFile,
+ authInfo: {
Review Comment:
`authInfo` can be optional here, right? In the case that the Accelerator is hosted in a public repository (and there's no AuthSession selected in the dropdown)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078377742
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -46,7 +108,12 @@ export function AcceleratorModal(props: Props) {
variant={ModalVariant.medium}
actions={
props.isApplying && [
- <Button key="apply" variant="primary" onClick={props.onApplyAccelerator}>
+ <Button
+ key="apply"
+ variant="primary"
+ onClick={() => props.onApplyAccelerator?.(selectedAuthSessionId)}
+ isDisabled={!isCompatibleAuthSession}
Review Comment:
Yeah , For public repos where no compatible Authsession is there we should enable Apply button to user. So I have enabled it everytime now irrespective of compatible Authsession. Thanks for pointing this @thiagoelg .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg merged PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078360365
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -58,13 +64,27 @@ export function AcceleratorsDropdown(props: Props) {
[setAcceleratorsDropdownOpen]
);
- const onApplyAccelerator = useCallback(() => {
- if (selectedAccelerator) {
- applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile);
- }
- setSelectedAccelerator(undefined);
- setApplyModalOpen(false);
- }, [applyAcceleratorToWorkspace, props.workspaceFile, selectedAccelerator]);
+ const onApplyAccelerator = useCallback(
+ async (authSessionId?: string) => {
+ if (!selectedAccelerator) {
+ console.error("Missing required parameters to apply accelerator");
+ return;
+ }
+ const authSessionObj = authSessions.get(authSessionId || "") as GitAuthSession;
Review Comment:
Ahh Okay .will check it Thiago.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2080381942
##########
packages/online-editor/src/authSessions/AuthSessionSelect.tsx:
##########
@@ -74,6 +74,7 @@ export function AuthSessionSelect(props: {
filter: AuthSessionSelectFilter;
menuAppendTo?: SelectProps["menuAppendTo"];
showOnlyThisAuthProviderGroupWhenConnectingToNewAccount: AuthProviderGroup | undefined;
+ hideConnectToAccountButton?: boolean;
Review Comment:
As we have connect to an account option in other place , i thought like we can connect to an account there and we can show only connected users here , but After discussion , i have removed everything and connect to an account is there now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078258036
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -26,18 +26,84 @@ import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/M
import { Button } from "@patternfly/react-core/dist/js/components/Button";
import { AcceleratorIcon } from "./AcceleratorIcon";
import { Divider } from "@patternfly/react-core/dist/js/components/Divider";
+import { AuthSession, AuthSessionStatus, GitAuthSession, isGitAuthSession } from "../../../authSessions/AuthSessionApi";
+import { Alert } from "@patternfly/react-core/dist/js/components/Alert";
+import {
+ getCompatibleAuthSessionWithUrlDomain,
+ gitAuthSessionSelectFilter,
+ isAuthSessionCompatibleWithUrlDomain,
+} from "../../../authSessions/CompatibleAuthSessions";
+import { AuthProvider } from "../../../authProviders/AuthProvidersApi";
+import { AuthSessionSelect } from "../../../authSessions/AuthSessionSelect";
type Props = {
accelerator: AcceleratorAppliedConfig;
isOpen: boolean;
- onClose: () => any;
+ onClose: () => void;
isApplying?: boolean;
- onApplyAccelerator?: () => void;
+ onApplyAccelerator?: (authSessionId?: string) => void;
+ authProviders: AuthProvider[];
+ authSessions: Map<string, AuthSession>;
+ authSessionStatus: Map<string, AuthSessionStatus>;
};
+function getDomainFromUrl(url: string | undefined): string | undefined {
+ if (!url) return undefined;
+ try {
+ return new URL(url).hostname;
+ } catch {
+ return undefined;
+ }
+}
+
export function AcceleratorModal(props: Props) {
const { i18n } = useOnlineI18n();
+ const urlDomain = useMemo(
+ () => getDomainFromUrl(props.accelerator.gitRepositoryUrl),
+ [props.accelerator.gitRepositoryUrl]
+ );
+
+ const [selectedAuthSessionId, setSelectedAuthSessionId] = useState<string | undefined>(undefined);
+
+ useEffect(() => {
+ const { compatible } = getCompatibleAuthSessionWithUrlDomain({
+ authProviders: props.authProviders,
+ authSessions: props.authSessions,
+ authSessionStatus: props.authSessionStatus,
+ urlDomain,
+ });
+
+ setSelectedAuthSessionId(compatible.length > 0 ? compatible[0].id : "");
+ }, [props.authProviders, props.authSessions, props.authSessionStatus, urlDomain]);
+
+ const selectedAuthSession = useMemo(() => {
+ return selectedAuthSessionId ? props.authSessions.get(selectedAuthSessionId) : undefined;
+ }, [selectedAuthSessionId, props.authSessions]);
+
+ const selectedAuthProvider = useMemo(() => {
+ if (selectedAuthSession && isGitAuthSession(selectedAuthSession)) {
+ return props.authProviders.find((p) => p.id === selectedAuthSession.authProviderId);
+ }
+ return undefined;
+ }, [selectedAuthSession, props.authProviders]);
+
+ const selectedStatus = useMemo(() => {
+ return selectedAuthSession ? props.authSessionStatus.get(selectedAuthSession.id) : undefined;
+ }, [selectedAuthSession, props.authSessionStatus]);
Review Comment:
Yeah I found functions to fetch authsession and authprovider details and updated the same. Thanks for noticing Tiago.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078287624
##########
packages/online-editor/src/accelerators/AcceleratorsHooks.tsx:
##########
@@ -128,7 +128,14 @@ export function useAcceleratorsDispatch(workspace: ActiveWorkspace) {
}, [workspace.descriptor.workspaceId, workspaces]);
const applyAcceleratorToWorkspace = useCallback(
- async (accelerator: AcceleratorConfig, currentFile: WorkspaceFile) => {
+ async (
+ accelerator: AcceleratorConfig,
Review Comment:
`authInfo` can be optional here, right? In the case that the Accelerator is hosted in a public repository (and there's no AuthSession selected in the dropdown)
##########
packages/online-editor/src/authSessions/AuthSessionSelect.tsx:
##########
@@ -151,7 +151,7 @@ export function AuthSessionSelect(props: {
className={props.isPlain ? "kie-tools--masthead-hoverable" : ""}
menuAppendTo={props.menuAppendTo ?? "parent"}
maxHeight={"400px"}
- style={{ minWidth: "400px" }}
+ style={{ minWidth: "300px", maxHeight: "300px", overflowY: "scroll" }}
Review Comment:
There's a `maxHeight={"400px"}` prop just above, but in the style it's set to `300px`. What should we use?
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -46,7 +108,12 @@ export function AcceleratorModal(props: Props) {
variant={ModalVariant.medium}
actions={
props.isApplying && [
- <Button key="apply" variant="primary" onClick={props.onApplyAccelerator}>
+ <Button
+ key="apply"
+ variant="primary"
+ onClick={() => props.onApplyAccelerator?.(selectedAuthSessionId)}
+ isDisabled={!isCompatibleAuthSession}
Review Comment:
What happens when the Accelerator repository is public but there's no compatible AuthSession? Users should be able to apply the accelerator.
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -105,6 +125,9 @@ export function AcceleratorsDropdown(props: Props) {
onApplyAccelerator={onApplyAccelerator}
accelerator={selectedAccelerator}
isApplying={true}
+ authSessions={authSessions}
+ authProviders={authProviders}
+ authSessionStatus={authSessionStatus}
Review Comment:
Same thing here, just use the accelerators inside of the AcceleratorModal component.
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -58,13 +64,27 @@ export function AcceleratorsDropdown(props: Props) {
[setAcceleratorsDropdownOpen]
);
- const onApplyAccelerator = useCallback(() => {
- if (selectedAccelerator) {
- applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile);
- }
- setSelectedAccelerator(undefined);
- setApplyModalOpen(false);
- }, [applyAcceleratorToWorkspace, props.workspaceFile, selectedAccelerator]);
+ const onApplyAccelerator = useCallback(
+ async (authSessionId?: string) => {
+ if (!selectedAccelerator) {
+ console.error("Missing required parameters to apply accelerator");
+ return;
+ }
+ const authSessionObj = authSessions.get(authSessionId || "") as GitAuthSession;
+ try {
+ await applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile, {
+ username: authSessionObj?.login,
+ password: authSessionObj?.token,
+ });
Review Comment:
Since `authSessionId` is optional, when it's not provided can skip passing the `authInfo` argument here.
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -46,7 +108,12 @@ export function AcceleratorModal(props: Props) {
variant={ModalVariant.medium}
actions={
props.isApplying && [
- <Button key="apply" variant="primary" onClick={props.onApplyAccelerator}>
+ <Button
+ key="apply"
+ variant="primary"
+ onClick={() => props.onApplyAccelerator?.(selectedAuthSessionId)}
+ isDisabled={!isCompatibleAuthSession}
Review Comment:
Also, maybe we should let users try to apply the Accelerator even without a compatible AuthSession, we never know what crazy Git providers and authentication methods they might be using... WDYT @tiagobento?
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorIndicator.tsx:
##########
@@ -64,6 +68,9 @@ export function AcceleratorIndicator(props: Props) {
isOpen={isAcceleratorDetailsModalOpen}
onClose={() => setAcceleratorDetailsModalOpen(false)}
accelerator={currentAccelerator}
+ authProviders={authProviders}
+ authSessions={authSessions}
+ authSessionStatus={authSessionStatus}
Review Comment:
Is is possible to use the hooks inside of the `AcceleratorModal` instead of passing the values as props? Just a nitpick, it should work the same.
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -62,9 +129,41 @@ export function AcceleratorModal(props: Props) {
</Title>
<Grid style={{ margin: "1rem 0" }} hasGutter>
{props.isApplying && (
- <GridItem span={12}>
- <i>{i18n.accelerators.acceleratorDescription}</i>
- </GridItem>
+ <>
+ <GridItem span={12}>
+ <i>{i18n.accelerators.acceleratorDescription}</i>
+ </GridItem>
+
+ <GridItem span={12}>
+ <AuthSessionSelect
+ title={`Select Git authentication for '${props.accelerator.name}' Accelerator`}
+ authSessionId={selectedAuthSessionId}
+ setAuthSessionId={(newSelectedAuthSessionId) => {
+ setSelectedAuthSessionId(newSelectedAuthSessionId);
+ accountsDispatch({ kind: AccountsDispatchActionKind.CLOSE });
+ }}
+ isPlain={false}
+ position={SelectPosition.right}
+ filter={gitAuthSessionSelectFilter()}
+ showOnlyThisAuthProviderGroupWhenConnectingToNewAccount={AuthProviderGroup.GIT}
+ />
+ </GridItem>
+
+ {authSession && (
+ <GridItem span={12}>
+ {isCompatibleAuthSession ? (
+ <Alert variant="info" isInline title="Authentication Status">
+ Using {selectedAuthProvider?.domain} credentials for {(authSession as GitAuthSession).login}
+ </Alert>
+ ) : (
+ <Alert variant="danger" isInline title="Authentication Status">
+ Selected account is not compatible with {urlDomain} , where {props.accelerator.name} Accelerator is
+ hosted.
Review Comment:
```suggestion
Selected account is not compatible with {urlDomain}, where {props.accelerator.name} Accelerator is hosted.
```
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -58,13 +64,27 @@ export function AcceleratorsDropdown(props: Props) {
[setAcceleratorsDropdownOpen]
);
- const onApplyAccelerator = useCallback(() => {
- if (selectedAccelerator) {
- applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile);
- }
- setSelectedAccelerator(undefined);
- setApplyModalOpen(false);
- }, [applyAcceleratorToWorkspace, props.workspaceFile, selectedAccelerator]);
+ const onApplyAccelerator = useCallback(
+ async (authSessionId?: string) => {
+ if (!selectedAccelerator) {
+ console.error("Missing required parameters to apply accelerator");
+ return;
+ }
+ const authSessionObj = authSessions.get(authSessionId || "") as GitAuthSession;
Review Comment:
If for whatever reason the selected `authSessionId` is not a `GitAuthSession` the code below will break. We have a `isGitAuthSession` function to validate the type of an AuthSession, you could use that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078312768
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -105,6 +125,9 @@ export function AcceleratorsDropdown(props: Props) {
onApplyAccelerator={onApplyAccelerator}
accelerator={selectedAccelerator}
isApplying={true}
+ authSessions={authSessions}
+ authProviders={authProviders}
+ authSessionStatus={authSessionStatus}
Review Comment:
Same thing here, just use the hooks inside of the AcceleratorModal component.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2077711027
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorIndicator.tsx:
##########
@@ -64,6 +68,10 @@ export function AcceleratorIndicator(props: Props) {
isOpen={isAcceleratorDetailsModalOpen}
onClose={() => setAcceleratorDetailsModalOpen(false)}
accelerator={currentAccelerator}
+ isApplying={true}
Review Comment:
Thanks @tiagobento for pointing this . Yeah it is not needed here , it's an optional param that i have added.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078287002
##########
packages/online-editor/src/accelerators/AcceleratorsHooks.tsx:
##########
@@ -128,7 +128,14 @@ export function useAcceleratorsDispatch(workspace: ActiveWorkspace) {
}, [workspace.descriptor.workspaceId, workspaces]);
const applyAcceleratorToWorkspace = useCallback(
- async (accelerator: AcceleratorConfig, currentFile: WorkspaceFile) => {
+ async (
+ accelerator: AcceleratorConfig,
+ currentFile: WorkspaceFile,
+ authInfo: {
Review Comment:
`authInfo` can be optional here, right? In the case that the Accelerator is hosted in a public repository (and there's no AuthSession selected in the dropdown)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078360754
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorIndicator.tsx:
##########
@@ -64,6 +68,9 @@ export function AcceleratorIndicator(props: Props) {
isOpen={isAcceleratorDetailsModalOpen}
onClose={() => setAcceleratorDetailsModalOpen(false)}
accelerator={currentAccelerator}
+ authProviders={authProviders}
+ authSessions={authSessions}
+ authSessionStatus={authSessionStatus}
Review Comment:
Yes will do
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#issuecomment-2860047622
> Great work @Kusuma04-dev!
>
> I've left some comments inline, most of them are nitpicks, so don't worry too much. Thank you!
Thanks @thiagoelg for reviewing and providing your feedback . I have incorporated the changes. Please validate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078361653
##########
packages/online-editor/src/authSessions/AuthSessionSelect.tsx:
##########
@@ -151,7 +151,7 @@ export function AuthSessionSelect(props: {
className={props.isPlain ? "kie-tools--masthead-hoverable" : ""}
menuAppendTo={props.menuAppendTo ?? "parent"}
maxHeight={"400px"}
- style={{ minWidth: "400px" }}
+ style={{ minWidth: "300px", maxHeight: "300px", overflowY: "scroll" }}
Review Comment:
I see this maxHeight={"400px"} is not getting applied when i remove maxHeight from style . So Will remove this maxHeight={"400px"} and will keep maxHeight in style.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2077723549
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -62,9 +133,39 @@ export function AcceleratorModal(props: Props) {
</Title>
<Grid style={{ margin: "1rem 0" }} hasGutter>
{props.isApplying && (
- <GridItem span={12}>
- <i>{i18n.accelerators.acceleratorDescription}</i>
- </GridItem>
+ <>
+ <GridItem span={12}>
+ <i>{i18n.accelerators.acceleratorDescription}</i>
+ </GridItem>
+
+ <GridItem span={12}>
+ <label htmlFor="auth-session-select">Select Authentication Session:</label>
+ <AuthSessionSelect
+ menuAppendTo={document.body}
+ title={"Select authentication session"}
+ authSessionId={selectedAuthSessionId}
+ setAuthSessionId={setSelectedAuthSessionId}
+ isPlain={false}
+ filter={gitAuthSessionSelectFilter()}
+ showOnlyThisAuthProviderGroupWhenConnectingToNewAccount={undefined}
+ hideConnectToAccountButton={true}
+ />
+ </GridItem>
+
+ {selectedAuthSession && (
+ <GridItem span={12}>
+ {isCompatibleAuthSession ? (
+ <Alert variant="info" isInline title="Authentication Status">
+ Using {selectedAuthProvider?.domain} credentials for {(selectedAuthSession as GitAuthSession).login}
+ </Alert>
+ ) : (
+ <Alert variant="danger" isInline title="Authentication Status">
+ Selected auth session is not compatible with repository domain: {urlDomain}
+ </Alert>
Review Comment:
Yeah, they'll know based on the Apply button, but I thought showing this info might give users a bit more clarity about which account is being used. But I'm okay with simplifying it if we feel it's redundant.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078312185
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -58,13 +64,27 @@ export function AcceleratorsDropdown(props: Props) {
[setAcceleratorsDropdownOpen]
);
- const onApplyAccelerator = useCallback(() => {
- if (selectedAccelerator) {
- applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile);
- }
- setSelectedAccelerator(undefined);
- setApplyModalOpen(false);
- }, [applyAcceleratorToWorkspace, props.workspaceFile, selectedAccelerator]);
+ const onApplyAccelerator = useCallback(
+ async (authSessionId?: string) => {
+ if (!selectedAccelerator) {
+ console.error("Missing required parameters to apply accelerator");
+ return;
+ }
+ const authSessionObj = authSessions.get(authSessionId || "") as GitAuthSession;
+ try {
+ await applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile, {
+ username: authSessionObj?.login,
+ password: authSessionObj?.token,
+ });
Review Comment:
Since `authSessionId` is optional, when it's not provided we can skip passing the `authInfo` argument here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2078359677
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -58,13 +64,27 @@ export function AcceleratorsDropdown(props: Props) {
[setAcceleratorsDropdownOpen]
);
- const onApplyAccelerator = useCallback(() => {
- if (selectedAccelerator) {
- applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile);
- }
- setSelectedAccelerator(undefined);
- setApplyModalOpen(false);
- }, [applyAcceleratorToWorkspace, props.workspaceFile, selectedAccelerator]);
+ const onApplyAccelerator = useCallback(
+ async (authSessionId?: string) => {
+ if (!selectedAccelerator) {
+ console.error("Missing required parameters to apply accelerator");
+ return;
+ }
+ const authSessionObj = authSessions.get(authSessionId || "") as GitAuthSession;
+ try {
+ await applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile, {
+ username: authSessionObj?.login,
+ password: authSessionObj?.token,
+ });
Review Comment:
Yes Thiago.Sure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-issues#3118: Support Accelerators on private repositories and air-gap installations on KIE Sandbox [incubator-kie-tools]
Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on code in PR #3119:
URL: https://github.com/apache/incubator-kie-tools/pull/3119#discussion_r2077582954
##########
packages/online-editor/src/authSessions/AuthSessionSelect.tsx:
##########
@@ -74,6 +74,7 @@ export function AuthSessionSelect(props: {
filter: AuthSessionSelectFilter;
menuAppendTo?: SelectProps["menuAppendTo"];
showOnlyThisAuthProviderGroupWhenConnectingToNewAccount: AuthProviderGroup | undefined;
+ hideConnectToAccountButton?: boolean;
Review Comment:
Why would we want not to show the "connect to account" button?
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorsDropdown.tsx:
##########
@@ -58,13 +64,27 @@ export function AcceleratorsDropdown(props: Props) {
[setAcceleratorsDropdownOpen]
);
- const onApplyAccelerator = useCallback(() => {
- if (selectedAccelerator) {
- applyAcceleratorToWorkspace(selectedAccelerator, props.workspaceFile);
- }
- setSelectedAccelerator(undefined);
- setApplyModalOpen(false);
- }, [applyAcceleratorToWorkspace, props.workspaceFile, selectedAccelerator]);
+ const onApplyAccelerator = useCallback(
+ async (authSessionId?: string) => {
+ if (!selectedAccelerator || !authSessionId) {
+ console.error("Missing required parameters to apply accelerator");
+ return;
+ }
Review Comment:
Not sure this is correct. Not having an authSessionId is fine, as Accelerators may be publicly available.
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -62,9 +133,39 @@ export function AcceleratorModal(props: Props) {
</Title>
<Grid style={{ margin: "1rem 0" }} hasGutter>
{props.isApplying && (
- <GridItem span={12}>
- <i>{i18n.accelerators.acceleratorDescription}</i>
- </GridItem>
+ <>
+ <GridItem span={12}>
+ <i>{i18n.accelerators.acceleratorDescription}</i>
+ </GridItem>
+
+ <GridItem span={12}>
+ <label htmlFor="auth-session-select">Select Authentication Session:</label>
+ <AuthSessionSelect
+ menuAppendTo={document.body}
+ title={"Select authentication session"}
+ authSessionId={selectedAuthSessionId}
+ setAuthSessionId={setSelectedAuthSessionId}
+ isPlain={false}
+ filter={gitAuthSessionSelectFilter()}
+ showOnlyThisAuthProviderGroupWhenConnectingToNewAccount={undefined}
+ hideConnectToAccountButton={true}
+ />
+ </GridItem>
+
+ {selectedAuthSession && (
+ <GridItem span={12}>
+ {isCompatibleAuthSession ? (
+ <Alert variant="info" isInline title="Authentication Status">
+ Using {selectedAuthProvider?.domain} credentials for {(selectedAuthSession as GitAuthSession).login}
+ </Alert>
+ ) : (
+ <Alert variant="danger" isInline title="Authentication Status">
+ Selected auth session is not compatible with repository domain: {urlDomain}
+ </Alert>
Review Comment:
Same here... mentioning "auth session" in the UI.... Probably should stick to something like:
`Selected account is not compatible with '{urlDomain}', where [Accelerator name] Accelerator is hosted.`
And maybe we should not have more UI elements for when everything is working fine? I mean, IMHO the "Apply" button being enabled is enough for people to move forward with applying their Accelerators... WDYT?
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorIndicator.tsx:
##########
@@ -64,6 +68,10 @@ export function AcceleratorIndicator(props: Props) {
isOpen={isAcceleratorDetailsModalOpen}
onClose={() => setAcceleratorDetailsModalOpen(false)}
accelerator={currentAccelerator}
+ isApplying={true}
Review Comment:
Not sure `true` is correct here? Since this is only to display the Accelerator's information...
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -26,18 +26,84 @@ import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/M
import { Button } from "@patternfly/react-core/dist/js/components/Button";
import { AcceleratorIcon } from "./AcceleratorIcon";
import { Divider } from "@patternfly/react-core/dist/js/components/Divider";
+import { AuthSession, AuthSessionStatus, GitAuthSession, isGitAuthSession } from "../../../authSessions/AuthSessionApi";
+import { Alert } from "@patternfly/react-core/dist/js/components/Alert";
+import {
+ getCompatibleAuthSessionWithUrlDomain,
+ gitAuthSessionSelectFilter,
+ isAuthSessionCompatibleWithUrlDomain,
+} from "../../../authSessions/CompatibleAuthSessions";
+import { AuthProvider } from "../../../authProviders/AuthProvidersApi";
+import { AuthSessionSelect } from "../../../authSessions/AuthSessionSelect";
type Props = {
accelerator: AcceleratorAppliedConfig;
isOpen: boolean;
- onClose: () => any;
+ onClose: () => void;
isApplying?: boolean;
- onApplyAccelerator?: () => void;
+ onApplyAccelerator?: (authSessionId?: string) => void;
+ authProviders: AuthProvider[];
+ authSessions: Map<string, AuthSession>;
+ authSessionStatus: Map<string, AuthSessionStatus>;
};
+function getDomainFromUrl(url: string | undefined): string | undefined {
+ if (!url) return undefined;
+ try {
+ return new URL(url).hostname;
+ } catch {
+ return undefined;
+ }
+}
+
export function AcceleratorModal(props: Props) {
const { i18n } = useOnlineI18n();
+ const urlDomain = useMemo(
+ () => getDomainFromUrl(props.accelerator.gitRepositoryUrl),
+ [props.accelerator.gitRepositoryUrl]
+ );
+
+ const [selectedAuthSessionId, setSelectedAuthSessionId] = useState<string | undefined>(undefined);
+
+ useEffect(() => {
+ const { compatible } = getCompatibleAuthSessionWithUrlDomain({
+ authProviders: props.authProviders,
+ authSessions: props.authSessions,
+ authSessionStatus: props.authSessionStatus,
+ urlDomain,
+ });
+
+ setSelectedAuthSessionId(compatible.length > 0 ? compatible[0].id : "");
+ }, [props.authProviders, props.authSessions, props.authSessionStatus, urlDomain]);
+
+ const selectedAuthSession = useMemo(() => {
+ return selectedAuthSessionId ? props.authSessions.get(selectedAuthSessionId) : undefined;
+ }, [selectedAuthSessionId, props.authSessions]);
+
+ const selectedAuthProvider = useMemo(() => {
+ if (selectedAuthSession && isGitAuthSession(selectedAuthSession)) {
+ return props.authProviders.find((p) => p.id === selectedAuthSession.authProviderId);
+ }
+ return undefined;
+ }, [selectedAuthSession, props.authProviders]);
+
+ const selectedStatus = useMemo(() => {
+ return selectedAuthSession ? props.authSessionStatus.get(selectedAuthSession.id) : undefined;
+ }, [selectedAuthSession, props.authSessionStatus]);
Review Comment:
I have the impression this is duplicated code, would you be able to verify please?
##########
packages/online-editor/src/editor/Toolbar/Accelerators/AcceleratorModal.tsx:
##########
@@ -62,9 +133,39 @@ export function AcceleratorModal(props: Props) {
</Title>
<Grid style={{ margin: "1rem 0" }} hasGutter>
{props.isApplying && (
- <GridItem span={12}>
- <i>{i18n.accelerators.acceleratorDescription}</i>
- </GridItem>
+ <>
+ <GridItem span={12}>
+ <i>{i18n.accelerators.acceleratorDescription}</i>
+ </GridItem>
+
+ <GridItem span={12}>
+ <label htmlFor="auth-session-select">Select Authentication Session:</label>
Review Comment:
I don't think we have such a label in other places for the `AuthSessionSelect`. Don't want to make the UI inconsistent for this case...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org