Skip to content

Commit ea7477c

Browse files
authored
Merge pull request lowcoder-org#127 from jerry-goodman/develop
pr_20221215
2 parents 000e8d7 + f5eeb28 commit ea7477c

File tree

15 files changed

+118
-42
lines changed

15 files changed

+118
-42
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ If you have any questions, please feel free to contact us or share with our comm
6060
## 💻 Deployment Options
6161
You can access Openblocks from [cloud-hosted version](https://cloud.openblocks.dev/) at any time, or use the following resources for deploying Openblocks on different platforms:
6262
- [Docker](https://docs.openblocks.dev/self-hosting)
63+
- [DigitalOcean](https://docs.openblocks.dev/self-hosting/digitalocean)
6364

6465
## 💪 Contributing
6566
- Language support: If you have experience with a language that isn't currently supported by our product, send us a pull request.

client/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.1
1+
1.1.2

client/packages/openblocks/src/comps/controls/colorControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const ColorContainer = styled.div`
1212
align-items: flex-start;
1313
justify-content: space-between;
1414
float: right;
15-
gap: 8px;
15+
gap: 6px;
1616
margin-left: -24px;
1717
> div:nth-of-type(1) {
1818
margin: 3px 0;

client/packages/openblocks/src/i18n/locales/en.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ export const en = {
14481448
},
14491449
pluginSetting: {
14501450
title: "Plugins",
1451-
npmPluginTitle: "NPM plugins",
1451+
npmPluginTitle: "npm plugins",
14521452
npmPluginDesc: "Set up npm plugins for all applications in the current workspace.",
14531453
npmPluginEmpty: "No npm plugins were added.",
14541454
npmPluginAddButton: "Add a npm plugin",
@@ -1830,7 +1830,7 @@ export const en = {
18301830
pluginExisted: "This npm plugin already existed",
18311831
compNotFound: "Component {compName} not found.",
18321832
addPluginModalTitle: "Add npm plugin",
1833-
pluginNameLabel: "NPM package's URL or name",
1833+
pluginNameLabel: "npm package's URL or name",
18341834
noCompText: "No components.",
18351835
compsLoading: "Loading...",
18361836
removePluginBtnText: "Remove",

client/packages/openblocks/src/pages/tutorials/editorTutorials.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { trans } from "i18n";
3232
import { i18nObjs } from "../../i18n/index";
3333
import { DatasourceInfo, HttpConfig } from "api/datasourceApi";
3434
import { enObj } from "i18n/locales";
35+
import { QUICK_REST_API_ID } from "constants/datasourceConstants";
3536

3637
const tourSteps: Step[] = [
3738
{
@@ -172,11 +173,6 @@ function addQuery(editorState: EditorState, datasourceInfos: DatasourceInfo[]) {
172173
);
173174
} else {
174175
// there's no sample data source, fall back to api source
175-
const apiDataSource = datasourceInfos.find(
176-
(info) =>
177-
info.datasource.type === "restApi" &&
178-
(info.datasource.datasourceConfig as HttpConfig).url === ""
179-
);
180176
queriesComp.dispatch(
181177
queriesComp.pushAction({
182178
id: id,
@@ -186,7 +182,7 @@ function addQuery(editorState: EditorState, datasourceInfos: DatasourceInfo[]) {
186182
path: i18nObjs.editorTutorials.mockDataUrl || enObj.editorTutorials.mockDataUrl,
187183
bodyType: "application/json",
188184
},
189-
datasourceId: apiDataSource?.datasource.id,
185+
datasourceId: QUICK_REST_API_ID,
190186
triggerType: "manual",
191187
})
192188
);
@@ -227,11 +223,11 @@ export default function EditorTutorials() {
227223

228224
const openTableData = () => {
229225
const ele = document.getElementsByClassName(leftCompListClassName)[0];
230-
const table = ele?.getElementsByClassName("ant-tree-title")[1];
226+
const table = ele?.getElementsByClassName("ant-tree-title")[0];
231227
if (table) {
232228
(table as HTMLDivElement)?.click();
233229
}
234-
}
230+
};
235231

236232
const handleJoyrideCallback = (data: CallBackProps) => {
237233
const { status, index, action, type } = data;

server/openblocks-domain/src/main/java/com/openblocks/domain/configurations/MongoConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class MongoConfig {
4747

4848
@PostConstruct
4949
public void init() {
50-
mappingMongoConverter.setMapKeyDotReplacement("_");
50+
mappingMongoConverter.setMapKeyDotReplacement("##OB_REPLACE##");
5151
}
5252

5353
@Bean

server/openblocks-domain/src/main/java/com/openblocks/domain/organization/service/OrgMemberServiceImpl.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.List;
99
import java.util.Map;
1010

11+
import org.apache.commons.lang3.StringUtils;
1112
import org.springframework.beans.factory.annotation.Autowired;
1213
import org.springframework.stereotype.Service;
1314

@@ -21,6 +22,9 @@
2122
import com.openblocks.infra.annotation.PossibleEmptyMono;
2223
import com.openblocks.infra.birelation.BiRelation;
2324
import com.openblocks.infra.birelation.BiRelationService;
25+
import com.openblocks.sdk.config.CommonConfig;
26+
import com.openblocks.sdk.config.CommonConfig.Workspace;
27+
import com.openblocks.sdk.constants.WorkspaceMode;
2428

2529
import lombok.extern.slf4j.Slf4j;
2630
import reactor.core.publisher.Flux;
@@ -42,6 +46,9 @@ public class OrgMemberServiceImpl implements OrgMemberService {
4246
@Autowired
4347
private OrganizationService organizationService;
4448

49+
@Autowired
50+
private CommonConfig commonConfig;
51+
4552
@Override
4653
public Mono<List<OrgMember>> getOrganizationMembers(String orgId, int page, int count) {
4754
return emptyMonoIfEmptyList(biRelationService.getBySourceId(ORG_MEMBER, orgId)
@@ -66,6 +73,23 @@ public Flux<OrgMember> getAllActiveOrgs(String userId) {
6673
.filter(organization -> organization.getState() != OrganizationState.DELETED)
6774
.map(Organization::getId)
6875
.collectList()
76+
// enterprise mode
77+
.flatMap(orgIds -> {
78+
Workspace workspace = commonConfig.getWorkspace();
79+
if (workspace.getMode() == WorkspaceMode.ENTERPRISE) {
80+
if (StringUtils.isNotBlank(workspace.getEnterpriseOrgId())) {
81+
if (orgIds.contains(workspace.getEnterpriseOrgId())) {
82+
return Mono.just(List.of(workspace.getEnterpriseOrgId()));
83+
}
84+
return addMember(workspace.getEnterpriseOrgId(), userId, MemberRole.MEMBER)
85+
.thenReturn(List.of(workspace.getEnterpriseOrgId()));
86+
}
87+
if (orgIds.size() > 1) {
88+
return Mono.just(orgIds.subList(0, 1));
89+
}
90+
}
91+
return Mono.just(orgIds);
92+
})
6993
.map(HashSet::new)
7094
.cache();
7195

server/openblocks-plugins/graphqlPlugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<dependency>
108108
<groupId>org.springframework.boot</groupId>
109109
<artifactId>spring-boot-starter-webflux</artifactId>
110-
<version>2.5.12</version>
110+
<version>2.5.5</version>
111111
<scope>test</scope>
112112
</dependency>
113113
<dependency>

server/openblocks-plugins/graphqlPlugin/src/main/java/com/openblocks/plugin/graphql/GraphQLExecutor.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import static com.google.common.base.MoreObjects.firstNonNull;
44
import static com.openblocks.plugin.graphql.GraphQLError.GRAPHQL_EXECUTION_ERROR;
5-
import static com.openblocks.plugin.graphql.utils.GraphQLBodyUtils.convertToGraphQLPOSTBodyFormat;
5+
import static com.openblocks.plugin.graphql.utils.GraphQLBodyUtils.convertToGraphQLBody;
66
import static com.openblocks.sdk.exception.PluginCommonError.JSON_PARSE_ERROR;
77
import static com.openblocks.sdk.exception.PluginCommonError.QUERY_ARGUMENT_ERROR;
88
import static com.openblocks.sdk.exception.PluginCommonError.QUERY_EXECUTION_ERROR;
@@ -264,11 +264,7 @@ public Mono<QueryExecutionResult> executeQuery(Object o, GraphQLQueryExecutionCo
264264
.exchangeStrategies(EXCHANGE_STRATEGIES)
265265
.build();
266266
if (!GRAPHQL_TYPE.equalsIgnoreCase(contentType)) {
267-
try {
268-
context.setQueryBody(convertToGraphQLPOSTBodyFormat(context));
269-
} catch (PluginException e) {
270-
return Mono.error(e);
271-
}
267+
context.setQueryBody(convertToGraphQLBody(context));
272268
}
273269
BodyInserter<?, ? super ClientHttpRequest> bodyInserter = buildBodyInserter(
274270
context.isEncodeParams(),
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
package com.openblocks.plugin.graphql.utils;
22

3-
import org.json.JSONObject;
3+
import java.util.HashMap;
4+
import java.util.Map;
45

5-
import com.fasterxml.jackson.databind.JsonNode;
66
import com.openblocks.plugin.graphql.model.GraphQLQueryExecutionContext;
7-
import com.openblocks.sdk.exception.PluginException;
7+
import com.openblocks.sdk.util.JsonUtils;
88

99

1010
public class GraphQLBodyUtils {
1111

1212
public static final String QUERY_KEY = "query";
1313
public static final String VARIABLES_KEY = "variables";
1414

15-
public static String convertToGraphQLPOSTBodyFormat(GraphQLQueryExecutionContext graphQLQueryExecutionContext) throws PluginException {
16-
JSONObject query = new JSONObject();
17-
query.put(QUERY_KEY, graphQLQueryExecutionContext.getQueryBody());
18-
JsonNode variables = graphQLQueryExecutionContext.getVariablesParams();
19-
query.put(VARIABLES_KEY, variables);
20-
return query.toString();
15+
public static String convertToGraphQLBody(GraphQLQueryExecutionContext graphQLQueryExecutionContext) {
16+
Map<String, Object> map = new HashMap<>();
17+
map.put(QUERY_KEY, graphQLQueryExecutionContext.getQueryBody());
18+
map.put(VARIABLES_KEY, graphQLQueryExecutionContext.getVariablesParams());
19+
return JsonUtils.toJson(map);
2120
}
2221
}

0 commit comments

Comments
 (0)