Skip to content

Dev > Main 2.4.10 #1241

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

Merged
merged 24 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6fa4c5f
added min-width feature in stepControl
MenamAfzal Sep 26, 2024
a9f53f0
pull from origin
MenamAfzal Oct 3, 2024
4a9e441
Merge branch 'dev' into fix/stepControl
MenamAfzal Oct 3, 2024
5609af5
set api_url for npm packages
raheeliftikhar5 Oct 4, 2024
a9f94b2
Fixed /api/npm/package/* endpoint response type
goldants Oct 4, 2024
66b527b
fix events data mapping in calendar
raheeliftikhar5 Oct 5, 2024
5c37d58
add applicationid param to private npm repository endpoint
dragonpoo Oct 8, 2024
79f8f03
send appId in registry/package endpoints
raheeliftikhar5 Oct 8, 2024
a839beb
enable anonymous api
dragonpoo Oct 8, 2024
6a8b55d
Boomi as DataSource
Oct 9, 2024
c35cc2a
Boomi as DataSource
Oct 9, 2024
d205a54
Boomi as DataSource
Oct 9, 2024
75fc901
Merge pull request #1231 from lowcoder-org/feature-private-repo
FalkWolsky Oct 9, 2024
3385d27
Merge branch 'dev' into feature-boomi-datasource
FalkWolsky Oct 9, 2024
08631d1
Updating Yarn Lock file
Oct 9, 2024
8393147
Merge pull request #1237 from lowcoder-org/feature-boomi-datasource
FalkWolsky Oct 9, 2024
31f1cac
Merge pull request #1225 from MenamAfzal/fix/stepControl
FalkWolsky Oct 9, 2024
28cb379
fix null registry settings
dragonpoo Oct 10, 2024
5dbcd8d
Merge pull request #1239 from lowcoder-org/feature-private-repo
FalkWolsky Oct 10, 2024
04e6731
Update Boomi Specs
Oct 10, 2024
db2bce4
Hiding Boomi as for now for cyclic references
Oct 10, 2024
b8f41c2
Hiding Boomi as for now for cyclic references
Oct 10, 2024
9cad22d
Update Yarn Lock file
Oct 10, 2024
d632bbd
send applicationId for npm plugins
raheeliftikhar5 Oct 10, 2024
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
2 changes: 1 addition & 1 deletion client/packages/lowcoder-comps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lowcoder-comps",
"version": "2.4.18",
"version": "2.4.19",
"type": "module",
"license": "MIT",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,34 +84,67 @@ function fixOldData(oldData: any) {
if(!Boolean(oldData)) return;
let {events, resourcesEvents, ...data } = oldData;
let allEvents: any[] = [];
let isDynamicEventData = false;

if (events && typeof events === 'string') {
let eventsList = JSON.parse(events);
if (eventsList && eventsList.length) {
eventsList = eventsList?.map(event => {
const {title, ...eventData} = event;
return {
...eventData,
label: title, // replace title field with label
}
});
allEvents = allEvents.concat(eventsList);
try {
let eventsList = JSON.parse(events);
if (eventsList && eventsList.length) {
eventsList = eventsList?.map(event => {
const {title, ...eventData} = event;
return {
...eventData,
label: title, // replace title field with label
}
});
allEvents = allEvents.concat(eventsList);
}
} catch (_) {
isDynamicEventData = true;
}
}
if (resourcesEvents && typeof resourcesEvents === 'string') {
let resourceEventsList = JSON.parse(resourcesEvents);
if (resourceEventsList && resourceEventsList.length) {
resourceEventsList = resourceEventsList?.map(event => {
const {title, ...eventData} = event;
return {
...eventData,
label: title, // replace title field with label
}
});
allEvents = allEvents.concat(resourceEventsList);
}
try {
let resourceEventsList = JSON.parse(resourcesEvents);
if (resourceEventsList && resourceEventsList.length) {
resourceEventsList = resourceEventsList?.map(event => {
const {title, ...eventData} = event;
return {
...eventData,
label: title, // replace title field with label
}
});
allEvents = allEvents.concat(resourceEventsList);
}
} catch (_) {}
}

if (isDynamicEventData) {
return {
...data,
events: {
manual: {
manual: allEvents,
},
mapData: {
data: events,
mapData: {
id: "{{item.id}}",
label: "{{item.title}}",
detail: "{{item.detail}}",
start: "{{item.start}}",
end: "{{item.end}}",
color: "{{item.color}}",
allDay: "{{item.allDay}}",
groupId: "{{item.groupId}}",
resourceId: "{{item.resourceId}}",
}
},
optionType: "map",
},
};
}

if (allEvents.length) {
return {
...data,
Expand All @@ -121,11 +154,23 @@ function fixOldData(oldData: any) {
},
mapData: {
data: JSON.stringify(allEvents, null, 2),
mapData: {
id: "{{item.id}}",
label: "{{item.title}}",
detail: "{{item.detail}}",
start: "{{item.start}}",
end: "{{item.end}}",
color: "{{item.color}}",
allDay: "{{item.allDay}}",
groupId: "{{item.groupId}}",
resourceId: "{{item.resourceId}}",
}
},
optionType: "manual",
},
};
}

return {
...data,
events,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import {
} from "types/remoteComp";

async function npmLoader(
remoteInfo: RemoteCompInfo
{
appId,
...remoteInfo
}: RemoteCompInfo & {appId?: string}
): Promise<CompConstructor | null> {

// Falk: removed "packageVersion = "latest" as default value fir packageVersion - to ensure no automatic version jumping.
const localPackageVersion = remoteInfo.packageVersion || "latest";
const { packageName, packageVersion, compName } = remoteInfo;
const entry = `${NPM_PLUGIN_ASSETS_BASE_URL}/${packageName}@${localPackageVersion}/index.js`;
const entry = `${NPM_PLUGIN_ASSETS_BASE_URL}/${appId}/${packageName}@${localPackageVersion}/index.js`;

try {
const module = await import(
Expand Down Expand Up @@ -51,7 +54,7 @@ async function bundleLoader(
return comp;
}

export const loaders: Record<RemoteCompSource, RemoteCompLoader> = {
export const loaders: Record<RemoteCompSource, RemoteCompLoader<RemoteCompInfo & {appId?: string}>> = {
npm: npmLoader,
bundle: bundleLoader,
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { CompContext } from "@lowcoder-ee/comps/utils/compContext";
import React from "react";
import type { AppState } from "@lowcoder-ee/redux/reducers";
import { useSelector } from "react-redux";
import { useApplicationId } from "@lowcoder-ee/util/hooks";

const ViewError = styled.div`
display: flex;
Expand Down Expand Up @@ -51,7 +52,7 @@ interface RemoteCompReadyAction {

interface RemoteCompViewProps {
isLowcoderComp?: boolean;
loadComp: (packageVersion?: string) => Promise<void>;
loadComp: (packageVersion?: string, appId?: string) => Promise<void>;
loadingElement?: () => React.ReactNode;
errorElement?: (error: any) => React.ReactNode;
source?: RemoteCompSource;
Expand All @@ -62,6 +63,7 @@ const RemoteCompView = React.memo((props: React.PropsWithChildren<RemoteCompView
const [error, setError] = useState<any>("");
const editorState = useContext(EditorContext);
const compState = useContext(CompContext);
const appId = useApplicationId();
const lowcoderCompPackageVersion = editorState?.getAppSettings().lowcoderCompVersion || 'latest';
const latestLowcoderCompsVersion = useSelector((state: AppState) => state.npmPlugin.packageVersion['lowcoder-comps']);

Expand All @@ -79,7 +81,7 @@ const RemoteCompView = React.memo((props: React.PropsWithChildren<RemoteCompView

useMount(() => {
setError("");
loadComp(packageVersion).catch((e) => {
loadComp(packageVersion, appId).catch((e) => {
setError(String(e));
});
});
Expand Down Expand Up @@ -117,7 +119,7 @@ export function remoteComp<T extends RemoteCompInfo = RemoteCompInfo>(
this.compValue = params.value;
}

private async load(packageVersion = 'latest') {
private async load(packageVersion = 'latest', appId = 'none') {
if (!remoteInfo) {
return;
}
Expand All @@ -129,7 +131,7 @@ export function remoteComp<T extends RemoteCompInfo = RemoteCompInfo>(
log.error("loader not found, remote info:", remoteInfo);
return;
}
const RemoteExportedComp = await finalLoader({...remoteInfo, packageVersion});
const RemoteExportedComp = await finalLoader({...remoteInfo, packageVersion, appId});
if (!RemoteExportedComp) {
return;
}
Expand Down Expand Up @@ -159,7 +161,7 @@ export function remoteComp<T extends RemoteCompInfo = RemoteCompInfo>(
<RemoteCompView
key={key}
isLowcoderComp={remoteInfo?.packageName === 'lowcoder-comps'}
loadComp={(packageVersion?: string) => this.load(packageVersion)}
loadComp={(packageVersion?: string, appId?: string) => this.load(packageVersion, appId)}
loadingElement={loadingElement}
source={remoteInfo?.source}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const StepsChildrenMap = {
style: styleControl(StepsStyle , 'style'),
viewRef: RefControl<HTMLDivElement>,
animationStyle: styleControl(AnimationStyle ,'animationStyle' ),
showVerticalScrollbar: withDefault(BoolControl, false),
showScrollBars: withDefault(BoolControl, false),
minHorizontalWidth: withDefault(RadiusControl, ''),
};

Expand Down Expand Up @@ -182,7 +182,7 @@ let StepControlBasicComp = (function () {
padding: "0px",
}}
overflow="scroll"
hideScrollbar={!props.showVerticalScrollbar}>
hideScrollbar={!props.showScrollBars}>
<Steps
initial={props.initialValue.value -1}
current={current}
Expand All @@ -197,6 +197,7 @@ let StepControlBasicComp = (function () {
>
{props.options.map((option, index) => (
<Steps.Step
style={{minWidth:props.minHorizontalWidth || '100%'}}
key={index}
title={option.label}
subTitle={option.subTitle}
Expand Down Expand Up @@ -234,15 +235,6 @@ let StepControlBasicComp = (function () {
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
<Section name={sectionNames.layout}>
{children.autoHeight.getPropertyView()}
{!children.autoHeight.getView() && (
children.showVerticalScrollbar.propertyView({
label: trans("prop.showVerticalScrollbar"),
})
)}
{children.minHorizontalWidth.propertyView({
label: trans("prop.minHorizontalWidth"),
placeholder: '100px',
})}
{children.size.propertyView({
label: trans("step.size"),
radioButton: true,
Expand All @@ -261,15 +253,23 @@ let StepControlBasicComp = (function () {
radioButton: true,
})
}
{children.direction.getView() == "horizontal" && (
children.minHorizontalWidth.propertyView({
label: trans("prop.minHorizontalWidth"),
placeholder: '100px',
})
)}
{!children.autoHeight.getView() && (
children.showScrollBars.propertyView({
label: trans("prop.scrollbar"),
})
)}
{ children.displayType.getView() != "inline" && !children.showIcons.getView() && (
children.showDots.propertyView({label: trans("step.showDots")}
))}
{ children.displayType.getView() != "inline" && !children.showDots.getView() && (
children.showIcons.propertyView({label: trans("step.showIcons")}
))}
{!children.autoHeight.getView() && (
children.showVerticalScrollbar.propertyView({label: trans("prop.showVerticalScrollbar")})
)}
</Section>
)}

Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/comps/utils/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function parseCompType(compType: string) {
}

export async function getNpmPackageMeta(packageName: string) {
const res = await axios.get<NpmPackageMeta>(`${NPM_REGISTRY_URL}/${packageName}`);
const res = await axios.get<NpmPackageMeta>(`${NPM_REGISTRY_URL}/none/${packageName}`);
if (res.status >= 400) {
return null;
}
Expand Down
10 changes: 7 additions & 3 deletions client/packages/lowcoder/src/constants/npmPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export const SERVER_HOST = `${REACT_APP_NODE_SERVICE_URL ?? ""}`;
export const NPM_REGISTRY_URL = `${SERVER_HOST}/node-service/api/npm/registry`;
export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/node-service/api/npm/package`;
// export const SERVER_HOST = `${REACT_APP_NODE_SERVICE_URL ?? ""}`;
// export const NPM_REGISTRY_URL = `${SERVER_HOST}/node-service/api/npm/registry`;
// export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/node-service/api/npm/package`;

export const SERVER_HOST = `${REACT_APP_API_SERVICE_URL ?? ""}`;
export const NPM_REGISTRY_URL = `${SERVER_HOST}/api/npm/registry`;
export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/api/npm/package`;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { LowcoderCompMeta } from "types/remoteComp";
import { TransparentImg } from "util/commonUtils";
import { ModuleIcon } from "lowcoder-design";
import { NPM_PLUGIN_ASSETS_BASE_URL } from "constants/npmPlugins";
import { useApplicationId } from "@lowcoder-ee/index.sdk";

const ItemWrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -75,10 +76,11 @@ interface PluginCompItemProps {
}

export function PluginCompItem(props: PluginCompItemProps) {
const appId = useApplicationId();
const { packageName, packageVersion, compName, compMeta, onDrag } = props;
const compType = getRemoteCompType("npm", packageName, packageVersion, compName);

const icon = `${NPM_PLUGIN_ASSETS_BASE_URL}/${packageName}@${packageVersion}/${compMeta.icon}`;
const icon = `${NPM_PLUGIN_ASSETS_BASE_URL}/${appId}/${packageName}@${packageVersion}/${compMeta.icon}`;

return (
<ItemWrapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";
import { EmptyContent } from "components/EmptyContent";
import { LinkButton } from "lowcoder-design";
import { useShallowEqualSelector } from "util/hooks";
import { useApplicationId, useShallowEqualSelector } from "util/hooks";
import { useContext, useEffect, useMemo, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { AppState } from "redux/reducers";
Expand Down Expand Up @@ -55,6 +55,7 @@ interface PluginViewProps {
export function PluginItem(props: PluginViewProps) {
const { name, onRemove } = props;
const dispatch = useDispatch();
const appId = useApplicationId();
const { onDrag, searchValue } = useContext(RightContext);
const [loading, setLoading] = useState(false);
const packageMeta = useShallowEqualSelector(
Expand All @@ -67,7 +68,7 @@ export function PluginItem(props: PluginViewProps) {

useEffect(() => {
setLoading(true);
axios.get<NpmPackageMeta>(`${NPM_REGISTRY_URL}/${name}`).then((res) => {
axios.get<NpmPackageMeta>(`${NPM_REGISTRY_URL}/${appId}/${name}`).then((res) => {
if (res.status >= 400) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.ORGANIZATION_URL + "/*/datasourceTypes"), // datasource types
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.ORGANIZATION_URL + "/byuser/*"),
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.DATASOURCE_URL + "/jsDatasourcePlugins"),
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.NPM_REGISTRY + "/**"),
ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, "/api/docs/**")
)
.permitAll()
Expand Down
Loading
Loading