Skip to content

Commit 0b89f47

Browse files
authored
Merge branch 'dev' into feat/image_capture
2 parents 3a57836 + 6e48a57 commit 0b89f47

17 files changed

+22467
-32
lines changed

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/application/ApplicationApiServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private Mono<Void> autoGrantPermissionsByFolderDefault(String applicationId, @Nu
170170

171171
@Override
172172
public Flux<ApplicationInfoView> getRecycledApplications(String name) {
173-
return userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(null, ApplicationStatus.RECYCLED, false, name);
173+
return userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(null, ApplicationStatus.RECYCLED, false, name, 0, 0);
174174
}
175175

176176
private Mono<Void> checkCurrentUserApplicationPermission(String applicationId, ResourceAction action) {

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/application/ApplicationController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,11 @@ public Mono<ResponseView<UserHomepageView>> getUserHomePage(@RequestParam(requir
160160
public Mono<ResponseView<List<ApplicationInfoView>>> getApplications(@RequestParam(required = false) Integer applicationType,
161161
@RequestParam(required = false) ApplicationStatus applicationStatus,
162162
@RequestParam(defaultValue = "true") boolean withContainerSize,
163-
@RequestParam(required = false) String name) {
163+
@RequestParam(required = false) String name,
164+
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
165+
@RequestParam(required = false, defaultValue = "0") Integer pageSize) {
164166
ApplicationType applicationTypeEnum = applicationType == null ? null : ApplicationType.fromValue(applicationType);
165-
return userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationTypeEnum, applicationStatus, withContainerSize, name)
167+
return userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationTypeEnum, applicationStatus, withContainerSize, name, pageNum, pageSize)
166168
.collectList()
167169
.map(ResponseView::success);
168170
}

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/application/ApplicationEndpoints.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ public Mono<ResponseView<Boolean>> updateEditState(@PathVariable String applicat
166166
public Mono<ResponseView<List<ApplicationInfoView>>> getApplications(@RequestParam(required = false) Integer applicationType,
167167
@RequestParam(required = false) ApplicationStatus applicationStatus,
168168
@RequestParam(defaultValue = "true") boolean withContainerSize,
169-
@RequestParam(required = false) String name);
169+
@RequestParam(required = false) String name,
170+
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
171+
@RequestParam(required = false, defaultValue = "0") Integer pageSize);
170172

171173
@Operation(
172174
tags = TAG_APPLICATION_MANAGEMENT,

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/home/FolderApiService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public interface FolderApiService {
2727

2828
Mono<Void> upsertLastViewTime(@Nullable String folderId);
2929

30-
Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name);
30+
Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name, Integer pageNum, Integer pageSize);
3131

3232
Mono<Void> grantPermission(String folderId, Set<String> userIds, Set<String> groupIds, ResourceRole role);
3333

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/home/FolderApiServiceImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ public Mono<Void> upsertLastViewTime(@Nullable String folderId) {
233233
* @return flux of {@link ApplicationInfoView} or {@link FolderInfoView}
234234
*/
235235
@Override
236-
public Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name) {
237-
return buildApplicationInfoViewTree(applicationType, name)
236+
public Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name, Integer pageNum, Integer pageSize) {
237+
var retMono = buildApplicationInfoViewTree(applicationType, name)
238238
.flatMap(tree -> {
239239
FolderNode<ApplicationInfoView, FolderInfoView> folderNode = tree.get(folderId);
240240
if (folderNode == null) {
@@ -264,7 +264,9 @@ public Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType
264264
});
265265
})
266266
.flatMapIterable(tuple -> tuple.getT1().getChildren())
267-
.map(node -> {
267+
.skip(pageNum * pageSize);
268+
if(pageSize > 0) retMono = retMono.take(pageSize);
269+
return retMono.map(node -> {
268270
if (node instanceof ElementNode<ApplicationInfoView, FolderInfoView> elementNode) {
269271
return elementNode.getSelf();
270272
}
@@ -284,7 +286,7 @@ private Mono<Tree<ApplicationInfoView, FolderInfoView>> buildApplicationInfoView
284286
.cache();
285287

286288
Flux<ApplicationInfoView> applicationInfoViewFlux =
287-
userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationType, ApplicationStatus.NORMAL, false, null)
289+
userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationType, ApplicationStatus.NORMAL, false, null, 0, 0)
288290
.cache();
289291

290292
Mono<Map<String, String>> application2FolderMapMono = applicationInfoViewFlux

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/home/FolderController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ public Mono<ResponseView<FolderInfoView>> update(@RequestBody Folder folder) {
7070
@Override
7171
public Mono<ResponseView<List<?>>> getElements(@RequestParam(value = "id", required = false) String folderId,
7272
@RequestParam(value = "applicationType", required = false) ApplicationType applicationType,
73-
@RequestParam(required = false) String name) {
73+
@RequestParam(required = false) String name,
74+
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
75+
@RequestParam(required = false, defaultValue = "0") Integer pageSize) {
7476
String objectId = gidService.convertFolderIdToObjectId(folderId);
75-
return folderApiService.getElements(objectId, applicationType, name)
77+
return folderApiService.getElements(objectId, applicationType, name, pageNum, pageSize)
7678
.collectList()
7779
.delayUntil(__ -> folderApiService.upsertLastViewTime(objectId))
7880
.map(ResponseView::success);

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/home/FolderEndpoints.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ public interface FolderEndpoints
7070
@GetMapping("/elements")
7171
public Mono<ResponseView<List<?>>> getElements(@RequestParam(value = "id", required = false) String folderId,
7272
@RequestParam(value = "applicationType", required = false) ApplicationType applicationType,
73-
@RequestParam(required = false) String name);
73+
@RequestParam(required = false) String name,
74+
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
75+
@RequestParam(required = false, defaultValue = "0") Integer pageSize);
7476

7577
@Operation(
7678
tags = TAG_FOLDER_MANAGEMENT,

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/home/UserHomeApiService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface UserHomeApiService {
2424
Mono<UserHomepageView> getUserHomePageView(ApplicationType applicationType);
2525

2626
Flux<ApplicationInfoView> getAllAuthorisedApplications4CurrentOrgMember(@Nullable ApplicationType applicationType,
27-
@Nullable ApplicationStatus applicationStatus, boolean withContainerSize, @Nullable String name);
27+
@Nullable ApplicationStatus applicationStatus, boolean withContainerSize, @Nullable String name, Integer pageNum, Integer pageSize);
2828

2929
Flux<BundleInfoView> getAllAuthorisedBundles4CurrentOrgMember(@Nullable BundleStatus bundleStatus);
3030

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/home/UserHomeApiServiceImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public Mono<UserHomepageView> getUserHomePageView(ApplicationType applicationTyp
157157
}
158158

159159
return organizationService.getById(currentOrgId)
160-
.zipWith(folderApiService.getElements(null, applicationType, null).collectList())
160+
.zipWith(folderApiService.getElements(null, applicationType, null, 0, 0).collectList())
161161
.map(tuple2 -> {
162162
Organization organization = tuple2.getT1();
163163
List<?> list = tuple2.getT2();
@@ -189,7 +189,7 @@ public Mono<UserHomepageView> getUserHomePageView(ApplicationType applicationTyp
189189

190190
@Override
191191
public Flux<ApplicationInfoView> getAllAuthorisedApplications4CurrentOrgMember(@Nullable ApplicationType applicationType,
192-
@Nullable ApplicationStatus applicationStatus, boolean withContainerSize, @Nullable String name) {
192+
@Nullable ApplicationStatus applicationStatus, boolean withContainerSize, @Nullable String name, Integer pageNum, Integer pageSize) {
193193

194194
return sessionUserService.getVisitorOrgMemberCache()
195195
.flatMapMany(orgMember -> {
@@ -207,7 +207,9 @@ public Flux<ApplicationInfoView> getAllAuthorisedApplications4CurrentOrgMember(@
207207
&& (isNull(name) || StringUtils.containsIgnoreCase(application.getName(), name)))
208208
.cache()
209209
.collectList()
210-
.flatMapIterable(Function.identity());
210+
.flatMapIterable(Function.identity())
211+
.skip((long) pageNum * pageSize);
212+
if(pageSize > 0) applicationFlux = applicationFlux.take(pageSize);
211213

212214
// last view time
213215
Mono<Map<String, Instant>> applicationLastViewTimeMapMono = userApplicationInteractionService.findByUserId(visitorId)

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/npm/PrivateNpmRegistryController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public class PrivateNpmRegistryController implements PrivateNpmRegistryEndpoint{
3535
private final ApplicationServiceImpl applicationServiceImpl;
3636

3737
@Override
38-
public Mono<ResponseEntity<Resource>> getNpmPackageMeta(String applicationId, String name) {
39-
return forwardToNodeService(applicationId, name, NPM_REGISTRY_METADATA);
38+
public Mono<ResponseEntity<Resource>> getNpmPackageMeta(String applicationId, String path) {
39+
return forwardToNodeService(applicationId, path, NPM_REGISTRY_METADATA);
4040
}
4141

4242
@Override

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/npm/PrivateNpmRegistryEndpoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public interface PrivateNpmRegistryEndpoint {
2121
summary = "Get NPM registry Metadata",
2222
description = "Retrieve the metadata of private NPM registry package."
2323
)
24-
@GetMapping("/registry/{applicationId}/{name}")
25-
public Mono<ResponseEntity<Resource>> getNpmPackageMeta(@PathVariable String applicationId, @PathVariable String name);
24+
@GetMapping("/registry/{applicationId}/{*path}")
25+
public Mono<ResponseEntity<Resource>> getNpmPackageMeta(@PathVariable String applicationId, @PathVariable String path);
2626

2727
@Operation(
2828
tags = TAG_NPM_REGISTRY_MANAGEMENT,

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/service/FolderApiServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void updateByGid() {
137137
public void move() {
138138

139139
Mono<? extends List<?>> mono = folderApiService.move("app01", "folder02")
140-
.then(folderApiService.getElements("folder02", null, null).collectList());
140+
.then(folderApiService.getElements("folder02", null, null, 0, 0).collectList());
141141

142142
StepVerifier.create(mono)
143143
.assertNext(list -> {

server/node-service/src/plugins/openAi/index.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,27 @@ import { ConfigToType, DataSourcePlugin } from "lowcoder-sdk/dataSource";
66
import { runOpenApi } from "../openApi";
77
import { parseOpenApi, ParseOpenApiOptions } from "../openApi/parse";
88

9-
const spec = readYaml(path.join(__dirname, "./openAi.yaml"));
9+
const spec_1_2_0 = readYaml(path.join(__dirname, "./openAI_v1.2.0.yaml"));
10+
const spec_2_3_0 = readYaml(path.join(__dirname, "./openAI_v2.3.0.yaml"));
11+
1012
const specs = {
11-
"v1.0": spec as OpenAPIV3.Document,
13+
"v1.0": spec_1_2_0,
14+
"v2.3": spec_2_3_0,
1215
}
1316

1417
const dataSourceConfig = {
1518
type: "dataSource",
1619
params: [
1720
{
18-
key: "ApiKey.value",
21+
key: "serverURL",
22+
type: "textInput",
23+
label: "Service URL",
24+
rules: [{ required: true }],
25+
placeholder: "https://<your-cloud-instance>",
26+
tooltip: "Input the Service url of your OpenAI or compatible instance. For OpenAI, it is https://api.openai.com/v1",
27+
},
28+
{
29+
key: "apiKey",
1930
type: "password",
2031
label: "API Key",
2132
rules: [{ required: true }],
@@ -28,7 +39,7 @@ const dataSourceConfig = {
2839
key: "specVersion",
2940
type: "select",
3041
tooltip: "Version of the spec file.",
31-
placeholder: "v1.0",
42+
placeholder: "v2.3",
3243
options: specsToOptions(specs)
3344
},
3445
],
@@ -61,10 +72,13 @@ const openAiPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
6172
};
6273
},
6374
run: function (actionData, dataSourceConfig): Promise<any> {
75+
const { serverURL, apiKey } = dataSourceConfig;
6476
const runApiDsConfig = {
6577
url: "",
66-
serverURL: "",
67-
dynamicParamsConfig: dataSourceConfig,
78+
serverURL: serverURL,
79+
dynamicParamsConfig: {
80+
"ApiKeyAuth.value": apiKey,
81+
},
6882
specVersion: dataSourceConfig.specVersion,
6983
};
7084
return runOpenApi(actionData, runApiDsConfig, version2spec(specs, dataSourceConfig.specVersion) as OpenAPIV3.Document);

0 commit comments

Comments
 (0)