Skip to content

Commit

Permalink
Merge branch 'dev' into nav-layout-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
FalkWolsky authored Nov 20, 2023
2 parents b06fa7e + d3ef400 commit a3389a4
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 52 deletions.
2 changes: 1 addition & 1 deletion client/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.5
2.1.7
2 changes: 1 addition & 1 deletion client/packages/lowcoder-design/src/components/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ export const sectionNames = {
validation: trans("prop.validation"),
layout: trans("prop.layout"),
style: trans("prop.style"),
meetings : trans("prop.meetings"),
meetings : trans("prop.meetings"), // added by Falk Wolsky
};
12 changes: 12 additions & 0 deletions client/packages/lowcoder/src/components/CompName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { GreyTextColor } from "constants/style";
import { UICompType } from "comps/uiCompRegistry";
import { trans } from "i18n";
import { getComponentDocUrl } from "comps/utils/compDocUtil";
import { getComponentPlaygroundUrl } from "comps/utils/compDocUtil";
import { parseCompType } from "comps/utils/remote";

const CompDiv = styled.div<{ width?: number; hasSearch?: boolean; showSearch?: boolean }>`
Expand Down Expand Up @@ -78,6 +79,7 @@ export const CompName = (props: Iprops) => {
const compType = selectedComp.children.compType.getView() as UICompType;
const compInfo = parseCompType(compType);
const docUrl = getComponentDocUrl(compType);
const playgroundUrl = getComponentPlaygroundUrl(compType);

const items: EditPopoverItemType[] = [];

Expand All @@ -99,6 +101,16 @@ export const CompName = (props: Iprops) => {
});
}

if (playgroundUrl) {
items.push({
text: trans("comp.menuViewPlayground"),
onClick: () => {
window.open(playgroundUrl, "_blank");
},
});
}


if (compInfo.isRemote) {
items.push({
text: trans("comp.menuUpgradeToLatest"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,16 +378,29 @@ let MTComp = (function () {
useEffect(() => {
if (rtmChannelResponse) {
rtmClient.on("MessageFromPeer", function (message, peerId) {
setRtmMessages(message.text);
setRtmMessages((prevMessages: any[]) => {
// Check if the messages array exceeds the maximum limit
if (prevMessages.length >= 500) {
prevMessages.pop(); // Remove the oldest message
}
return [...prevMessages, {"peermessage" : JSON.parse(message.text + ""), "from" : peerId}];
});
});

rtmChannelResponse.on("ChannelMessage", function (message, memberId) {
setRtmMessages(message.text);
dispatch(
changeChildAction("messages", getData(rtmMessages).data, false)
);
setRtmMessages((prevMessages: any[]) => {
// Check if the messages array exceeds the maximum limit
if (prevMessages.length >= 500) {
prevMessages.pop(); // Remove the oldest message
}
return [...prevMessages, {"channelmessage" : JSON.parse(message.text + ""), "from" : memberId}];
});

dispatch(changeChildAction("messages", getData(rtmMessages).data, false));
});
}
}, [rtmChannelResponse]);


useEffect(() => {
if (client) {
Expand All @@ -399,11 +412,11 @@ let MTComp = (function () {
setUserLeft(user);
});
client.on("volume-indicator", (volumeInfos: any) => {
if (volumeInfos.length == 0) return;
if (volumeInfos.length === 0) return;
volumeInfos.map((volumeInfo: any) => {
const speaking = volumeInfo.level >= 30;
if (
volumeInfo.uid == userId &&
volumeInfo.uid === userId &&
props.localUser.value.speaking != speaking
) {
setLocalUserSpeaking(speaking);
Expand Down Expand Up @@ -671,21 +684,20 @@ MTComp = withMethodExposing(MTComp, [
},
execute: async (comp, values) => {
if (!comp.children.meetingActive.getView().value) return;
let otherData =
values !== undefined && values[1] !== undefined ? values[1] : "";
let toUsers: any =
let messagedata =
values !== undefined && values[0] !== undefined ? values[0] : "";
let toUsers: any =
values !== undefined && values[1] !== undefined ? values[1] : "";

let message: any = {
time: Date.now(),
from: comp.children.localUser.getView().value,
message: messagedata,
};
message["data"] = otherData;

if (toUsers.length > 0 && toUsers[0] !== undefined) {
let peers = toUsers?.map((u: any) => u.user);
peers.forEach((p: any) => {
sendPeerMessageRtm(message, String(p));
toUsers.forEach((peer: any) => {
message.to = peer;
sendPeerMessageRtm(message, String(peer));
});
} else {
sendMessageRtm(message);
Expand Down
11 changes: 11 additions & 0 deletions client/packages/lowcoder/src/comps/utils/compDocUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ export function getComponentDocUrl(compType: UICompType) {
return trans("docUrls.components", { compType });
}
}
export function getComponentPlaygroundUrl(compType: UICompType) {
if (!compType) {
return "";
}
switch (compType) {
case "module":
return trans("docUrls.module");
default:
return trans("playground.url", { compType });
}
}
15 changes: 9 additions & 6 deletions client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ export const en = {
validate: "Validation message",
border: "Border",
borderRadius: "Border radius",
borderwidth: "Border width",
background: "Background",
headerBackground: "Header background",
footerBackground: "Footer background",
Expand Down Expand Up @@ -906,6 +907,7 @@ export const en = {
},
comp: {
menuViewDocs: "View documentation",
menuViewPlayground: "View playground",
menuUpgradeToLatest: "Upgrade to latest version",
nameNotEmpty: "Can not be empty",
nameRegex:
Expand Down Expand Up @@ -2273,13 +2275,13 @@ export const en = {
},
docUrls: {
docHome: "https://docs.lowcoder.cloud/",
components: "https://app.lowcoder.cloud/components?n={compType}",
module: "",
components: "https://app.lowcoder.cloud/components/{compType}",
module: "https://docs.lowcoder.cloud/lowcoder-documentation/build-applications/create-a-new-app/modules",
optionList: "",
terms: "",
privacy: "",
aboutUs: "",
changeLog: "",
terms: "https://lowcoder.cloud/terms",
privacy: "https://lowcoder.cloud/privacy",
aboutUs: "https://lowcoder.cloud/about",
changeLog: "https://github.com/lowcoder-org/lowcoder/releases",
introVideo: "",
devNpmPlugin:
"https://docs.lowcoder.cloud/lowcoder-extension/develop-data-source-plugins",
Expand Down Expand Up @@ -2536,6 +2538,7 @@ export const en = {
justify: "Justify both ends",
},
playground: {
url: "https://app.lowcoder.cloud/playground/{compType}/1",
data: "Data",
preview: "Preview",
property: "Properties",
Expand Down
4 changes: 3 additions & 1 deletion client/packages/lowcoder/src/i18n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ uiComp: {
},
comp: {
menuViewDocs: "查看文档",
menuViewPlayground: "查看组件游乐场",
menuUpgradeToLatest: "升级到最新版本",
nameNotEmpty: "不能为空",
nameRegex: "必须以字母开头,只能包含字母、数字和下划线(_)",
Expand Down Expand Up @@ -2107,7 +2108,7 @@ toggleButton: {
},
docUrls: {
docHome: "https://docs.lowcoder.cloud/",
components: "https://app.lowcoder.cloud/components?n={compType}",
components: "https://app.lowcoder.cloud/components/{compType}",
module: "",
optionList: "",
terms: "",
Expand Down Expand Up @@ -2392,6 +2393,7 @@ componentDoc: {
justify: "两端对齐",
},
playground: {
url: "https://app.lowcoder.cloud/playground/{compType}/1",
data: "数据",
preview: "预览",
property: "属性",
Expand Down
35 changes: 27 additions & 8 deletions deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,17 @@ CMD [ "sh" , "/lowcoder/api-service/entrypoint.sh" ]
##
FROM ubuntu:jammy as build-node-service

RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl ca-certificates build-essential
RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl ca-certificates build-essential gnupg

# Add nodejs repo and keys
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

# Download nodejs and install yarn
RUN curl -sL https://deb.nodesource.com/setup_19.x | bash - \
&& apt-get install --no-install-recommends -y nodejs \
&& npm install -g yarn
RUN apt-get update \
&& apt-get install --no-install-recommends -y nodejs \
&& npm install -g yarn

# Copy and build the node-service app
COPY server/node-service/ /lowcoder/node-service/app/
Expand All @@ -93,9 +98,16 @@ RUN chmod +x /lowcoder/node-service/*.sh
FROM ubuntu:jammy as lowcoder-ce-node-service
LABEL maintainer="lowcoder"

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl ca-certificates \
&& curl -sL https://deb.nodesource.com/setup_19.x | bash - \
&& apt-get install --no-install-recommends -y nodejs gosu \
RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl ca-certificates gnupg

# Add nodejs repo and keys
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

# Download nodejs and install yarn
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y nodejs gosu \
&& npm install -g yarn \
&& rm -rf /var/cache/apt/lists \
&& addgroup --system --gid 9001 lowcoder \
Expand Down Expand Up @@ -167,13 +179,20 @@ EXPOSE 3443
FROM lowcoder-ce-frontend
LABEL maintainer="lowcoder"

RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl ca-certificates gnupg

# Add nodejs repo and keys
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list


# Install required packages
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y bash gnupg curl lsb-release \
&& curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb bullseye main" | tee /etc/apt/sources.list.d/redis.list \
&& curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg arch=amd64,arm64] http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list \
&& curl -sL https://deb.nodesource.com/setup_19.x | bash - \
&& if [ "$(dpkg --print-architecture)" = "amd64" ] || [ "$(dpkg --print-architecture)" = "i386" ]; then \
curl -sL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_$(dpkg --print-architecture).deb --output libssl1.1_1.1.1f-1ubuntu2_$(dpkg --print-architecture).deb; \
else \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.lowcoder.sdk.auth;

import static org.lowcoder.sdk.auth.constants.Oauth2Constants.INSTANCE_ID_PLACEHOLDER;
import static org.lowcoder.sdk.auth.constants.Oauth2Constants.BASE_URL_PLACEHOLDER;
import static org.lowcoder.sdk.auth.constants.Oauth2Constants.REALM_PLACEHOLDER;

import com.fasterxml.jackson.annotation.JsonCreator;
Expand All @@ -15,7 +15,7 @@
@Getter
public class Oauth2KeycloakAuthConfig extends Oauth2SimpleAuthConfig
{
protected String instanceId;
protected String baseUrl;
protected String realm;

@JsonCreator
Expand All @@ -27,12 +27,12 @@ public Oauth2KeycloakAuthConfig(
@JsonProperty("sourceName") String sourceName,
@JsonProperty("clientId") String clientId,
@JsonProperty("clientSecret") String clientSecret,
@JsonProperty("instanceId") String instanceId,
@JsonProperty("baseUrl") String baseUrl,
@JsonProperty("realm") String realm,
@JsonProperty("authType") String authType)
{
super(id, enable, enableRegister, source, sourceName, clientId, clientSecret, authType);
this.instanceId = instanceId;
this.baseUrl = baseUrl;
this.realm = realm;
}

Expand All @@ -42,7 +42,7 @@ public Oauth2KeycloakAuthConfig(
public String replaceAuthUrlClientIdPlaceholder(String url)
{
return super.replaceAuthUrlClientIdPlaceholder(url)
.replace(INSTANCE_ID_PLACEHOLDER, instanceId)
.replace(BASE_URL_PLACEHOLDER, baseUrl)
.replace(REALM_PLACEHOLDER, realm);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.lowcoder.sdk.auth;

import static org.lowcoder.sdk.auth.constants.Oauth2Constants.INSTANCE_ID_PLACEHOLDER;
import static org.lowcoder.sdk.auth.constants.Oauth2Constants.BASE_URL_PLACEHOLDER;

import javax.annotation.Nullable;

Expand All @@ -14,7 +14,7 @@
@Getter
public class Oauth2OryAuthConfig extends Oauth2SimpleAuthConfig {

protected String instanceId;
protected String baseUrl;

@JsonCreator
public Oauth2OryAuthConfig(
Expand All @@ -25,14 +25,14 @@ public Oauth2OryAuthConfig(
String sourceName,
String clientId,
String clientSecret,
String instanceId,
String baseUrl,
String authType) {
super(id, enable, enableRegister, source, sourceName, clientId, clientSecret, authType);
this.instanceId = instanceId;
this.baseUrl = baseUrl;
}

@Override
public String replaceAuthUrlClientIdPlaceholder(String url) {
return super.replaceAuthUrlClientIdPlaceholder(url).replace(INSTANCE_ID_PLACEHOLDER, instanceId);
return super.replaceAuthUrlClientIdPlaceholder(url).replace(BASE_URL_PLACEHOLDER, baseUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Oauth2Constants {
public static final String STATE_PLACEHOLDER = "$STATE";
public static final String REALM_PLACEHOLDER = "$REALM";

public static final String INSTANCE_ID_PLACEHOLDER = "$INSTANCE_ID";
public static final String BASE_URL_PLACEHOLDER = "$BASE_URL";

// authorize url
public static final String GITHUB_AUTHORIZE_URL = "https://github.com/login/oauth/authorize"
Expand All @@ -27,14 +27,14 @@ public class Oauth2Constants {
+ "&scope=openid email profile"
+ "&prompt=select_account";

public static final String ORY_AUTHORIZE_URL = "https://" + INSTANCE_ID_PLACEHOLDER + "/oauth2/auth"
public static final String ORY_AUTHORIZE_URL = BASE_URL_PLACEHOLDER + "/oauth2/auth"
+ "?response_type=code"
+ "&client_id=" + CLIENT_ID_PLACEHOLDER
+ "&redirect_uri=" + REDIRECT_URL_PLACEHOLDER
+ "&state=" + STATE_PLACEHOLDER
+ "&scope=openid email profile offline_access";

public static final String KEYCLOAK_AUTHORIZE_URL = "https://" + INSTANCE_ID_PLACEHOLDER + "/realms/" + REALM_PLACEHOLDER + "/protocol/openid-connect/auth"
public static final String KEYCLOAK_AUTHORIZE_URL = BASE_URL_PLACEHOLDER + "/realms/" + REALM_PLACEHOLDER + "/protocol/openid-connect/auth"
+ "?response_type=code"
+ "&client_id=" + CLIENT_ID_PLACEHOLDER
+ "&redirect_uri=" + REDIRECT_URL_PLACEHOLDER
Expand Down
Loading

0 comments on commit a3389a4

Please sign in to comment.