Skip to content

Commit

Permalink
Merge branch 'dev' into calendar-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
FalkWolsky authored Dec 4, 2024
2 parents 3a00b21 + b06d729 commit 0ec2a69
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ const onDrop = async (
const nameGenerator = editorState.getNameGenerator();
const compInfo = parseCompType(compType);
const compName = nameGenerator.genItemName(compInfo.compName);
const isLazyLoadComp = uiCompRegistry[compType as UICompType]?.lazyLoad;
let defaultDataFn = undefined;

if (!compInfo.isRemote) {
if (isLazyLoadComp) {
const {
defaultDataFnName,
defaultDataFnPath,
Expand All @@ -237,6 +238,8 @@ const onDrop = async (
const module = await import(`../../${defaultDataFnPath}.tsx`);
defaultDataFn = module[defaultDataFnName];
}
} else if(!compInfo.isRemote) {
defaultDataFn = uiCompRegistry[compType as UICompType]?.defaultDataFn;
}

const widgetValue: GridItemDataType = {
Expand Down
4 changes: 2 additions & 2 deletions client/packages/lowcoder/src/comps/comps/rootComp.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "comps/comps/layout/navLayout";
import "comps/comps/layout/mobileTabLayout";
// import "comps/comps/layout/navLayout";
// import "comps/comps/layout/mobileTabLayout";

import { CompAction, CompActionTypes } from "lowcoder-core";
import { EditorContext, EditorState } from "comps/editorState";
Expand Down
62 changes: 27 additions & 35 deletions client/packages/lowcoder/src/comps/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import "comps/comps/layout/navLayout";
import "comps/comps/layout/mobileTabLayout";

import cnchar from "cnchar";
import { trans } from "i18n";
import { remoteComp } from "./comps/remoteComp/remoteComp";
Expand Down Expand Up @@ -113,6 +116,17 @@ import {
KanbanCompIcon,

} from "lowcoder-design";
import { ModuleComp } from "./comps/moduleComp/moduleComp";
import { TableComp } from "./comps/tableComp/tableComp";
import { defaultTableData } from "./comps/tableComp/mockTableComp";
import { ContainerComp, defaultContainerData } from "./comps/containerComp/containerComp";
import { ColumnLayoutComp } from "./comps/columnLayout/columnLayout";
import { TabbedContainerComp } from "./comps/tabs/tabbedContainerComp";
import { ButtonComp } from "./comps/buttonComp/buttonComp";
import { TextComp } from "./comps/textComp";
import { SelectComp } from "./comps/selectInputComp/selectComp";
import { InputComp } from "./comps/textInputComp/inputComp";
import { TextAreaComp } from "./comps/textInputComp/textAreaComp";

type Registry = {
[key in UICompType]?: UICompManifest;
Expand Down Expand Up @@ -340,19 +354,16 @@ export var uiCompMap: Registry = {
name: trans("uiComp.tableCompName"),
enName: "Table",
description: trans("uiComp.tableCompDesc"),
categories: ["dashboards"],
categories: ["dashboards", "projectmanagement"],
icon: TableCompIcon,
keywords: trans("uiComp.tableCompKeywords"),
lazyLoad: true,
compName: "TableComp",
compPath: "comps/tableComp/index",
comp: TableComp,
layoutInfo: {
w: 12,
h: 40,
},
withoutLoading: true,
defaultDataFnName: "defaultTableData",
defaultDataFnPath: "comps/tableComp/mockTableComp",
defaultDataFn: defaultTableData,
},

pivotTable: {
Expand Down Expand Up @@ -450,9 +461,7 @@ export var uiCompMap: Registry = {
categories: ["layout"],
icon: ColumnLayoutCompIcon,
keywords: trans("uiComp.responsiveLayoutCompKeywords"),
lazyLoad: true,
compName: "ColumnLayoutComp",
compPath: "comps/columnLayout/index",
comp: ColumnLayoutComp,
withoutLoading: true,
layoutInfo: {
w: 24,
Expand Down Expand Up @@ -502,9 +511,7 @@ export var uiCompMap: Registry = {
categories: ["layout"],
icon: TabbedContainerCompIcon,
keywords: trans("uiComp.tabbedContainerCompKeywords"),
lazyLoad: true,
compName: "TabbedContainerComp",
compPath: "comps/tabs/index",
comp: TabbedContainerComp,
withoutLoading: true,
layoutInfo: {
w: 12,
Expand Down Expand Up @@ -540,18 +547,15 @@ export var uiCompMap: Registry = {
categories: ["layout"],
icon: ContainerCompIcon,
keywords: trans("uiComp.containerCompKeywords"),
lazyLoad: true,
compName: "ContainerComp",
compPath: "comps/containerComp/containerComp",
comp: ContainerComp,
withoutLoading: true,
layoutInfo: {
w: 12,
h: 25,
// static: true,
delayCollision: true,
},
defaultDataFnName: "defaultContainerData",
defaultDataFnPath: "comps/containerComp/containerComp",
defaultDataFn: defaultContainerData,
},
listView: {
name: trans("uiComp.listViewCompName"),
Expand Down Expand Up @@ -927,9 +931,7 @@ export var uiCompMap: Registry = {
categories: ["forms"],
icon: InputCompIcon,
keywords: trans("uiComp.inputCompKeywords"),
lazyLoad: true,
compName: "InputComp",
compPath: "comps/textInputComp/inputComp",
comp: InputComp,
layoutInfo: {
w: 6,
h: 6,
Expand Down Expand Up @@ -972,9 +974,7 @@ export var uiCompMap: Registry = {
categories: ["forms"],
icon: TextAreaCompIcon,
keywords: trans("uiComp.textAreaCompKeywords"),
lazyLoad: true,
compName: "TextAreaComp",
compPath: "comps/textInputComp/textAreaComp",
comp: TextAreaComp,
layoutInfo: {
w: 6,
h: 12,
Expand Down Expand Up @@ -1141,9 +1141,7 @@ export var uiCompMap: Registry = {
categories: ["forms"],
icon: ButtonCompIcon,
keywords: trans("uiComp.buttonCompKeywords"),
lazyLoad: true,
compName: "ButtonComp",
compPath: "comps/buttonComp/buttonComp",
comp: ButtonComp,
layoutInfo: {
w: 6,
h: 6,
Expand Down Expand Up @@ -1563,9 +1561,7 @@ export var uiCompMap: Registry = {
categories: ["forms", "itemHandling"],
icon: SelectCompIcon,
keywords: trans("uiComp.selectCompKeywords"),
lazyLoad: true,
compName: "SelectComp",
compPath: "comps/selectInputComp/selectComp",
comp: SelectComp,
layoutInfo: {
w: 6,
h: 5,
Expand Down Expand Up @@ -1705,9 +1701,7 @@ export var uiCompMap: Registry = {
description: trans("uiComp.moduleCompDesc"),
categories: [],
keywords: trans("uiComp.moduleCompKeywords"),
lazyLoad: true,
compName: "ModuleComp",
compPath: "comps/moduleComp/moduleComp",
comp: ModuleComp,
layoutInfo: {
w: 12,
h: 40,
Expand All @@ -1723,9 +1717,7 @@ export var uiCompMap: Registry = {
categories: ["dashboards", "layout", "multimedia"],
icon: TextCompIcon,
keywords: trans("uiComp.textCompKeywords"),
compName: "TextComp",
lazyLoad: true,
compPath: "comps/textComp",
comp: TextComp,
layoutInfo: {
w: 6,
h: 24,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ public Map<String, Object> getEditingApplicationDSL() {
return dsl;
}

public String getCategory() {
if(editingApplicationDSL == null || editingApplicationDSL.get("settings") == null) return "";
Object settingsObject = editingApplicationDSL.get("settings");
if (settingsObject instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Object> settings = (Map<String, Object>) editingApplicationDSL.get("settings");
return (String) settings.get("category");
} else {
return "";
}
}

public Map<String, Object> getEditingApplicationDSLOrNull() {return editingApplicationDSL; }

public Object getLiveContainerSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import jakarta.annotation.Nonnull;
import org.lowcoder.domain.application.model.Application;
import org.lowcoder.domain.application.model.ApplicationStatus;
import org.springframework.data.mongodb.repository.Aggregation;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import org.springframework.stereotype.Repository;
Expand All @@ -16,16 +17,16 @@
public interface ApplicationRepository extends ReactiveMongoRepository<Application, String>, CustomApplicationRepository {

// publishedApplicationDSL : 0 -> excludes publishedApplicationDSL from the return
@Query(fields = "{ publishedApplicationDSL : 0 , editingApplicationDSL : 0 }")
@Aggregation(pipeline = {"{ $project: { 'editingApplicationDSL.settings.category': 1, _id: 1, gid: 1, organizationId: 1, name: 1, applicationType: 1, applicationStatus: 1, publicToAll: 1, publicToMarketplace: 1, agencyProfile: 1, editingUserId: 1, lastEditedAt: 1, createdAt: 1, updatedAt: 1, createdBy: 1, modifiedBy: 1, _class: 1}}"})
Flux<Application> findByOrganizationId(String organizationId);


@Override
@Nonnull
@Query(fields = "{ publishedApplicationDSL : 0 , editingApplicationDSL : 0 }")
@Aggregation(pipeline = {"{ $project: { 'editingApplicationDSL.settings.category': 1, _id: 1, gid: 1, organizationId: 1, name: 1, applicationType: 1, applicationStatus: 1, publicToAll: 1, publicToMarketplace: 1, agencyProfile: 1, editingUserId: 1, lastEditedAt: 1, createdAt: 1, updatedAt: 1, createdBy: 1, modifiedBy: 1, _class: 1}}"})
Mono<Application> findById(@Nonnull String id);

@Query(fields = "{ publishedApplicationDSL : 0 , editingApplicationDSL : 0 }")
@Aggregation(pipeline = {"{ $project: { 'editingApplicationDSL.settings.category': 1, _id: 1, gid: 1, organizationId: 1, name: 1, applicationType: 1, applicationStatus: 1, publicToAll: 1, publicToMarketplace: 1, agencyProfile: 1, editingUserId: 1, lastEditedAt: 1, createdAt: 1, updatedAt: 1, createdBy: 1, modifiedBy: 1, _class: 1}}"})
Flux<Application> findByGid(@Nonnull String gid);

Mono<Long> countByOrganizationIdAndApplicationStatus(String organizationId, ApplicationStatus applicationStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public interface ApplicationApiService {
Mono<ApplicationView> create(ApplicationEndpoints.CreateApplicationRequest createApplicationRequest);

Flux<ApplicationInfoView> getRecycledApplications(String name);
Flux<ApplicationInfoView> getRecycledApplications(String name, String category);

Mono<ApplicationView> delete(String applicationId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ private Mono<Void> autoGrantPermissionsByFolderDefault(String applicationId, @Nu
}

@Override
public Flux<ApplicationInfoView> getRecycledApplications(String name) {
return userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(null, ApplicationStatus.RECYCLED, false, name);
public Flux<ApplicationInfoView> getRecycledApplications(String name, String category) {
return userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(null, ApplicationStatus.RECYCLED, false, name, category);
}

private Mono<Void> checkCurrentUserApplicationPermission(String applicationId, ResourceAction action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public Mono<ResponseView<Boolean>> restore(@PathVariable String applicationId) {
}

@Override
public Mono<ResponseView<List<ApplicationInfoView>>> getRecycledApplications(@RequestParam(required = false) String name) {
return applicationApiService.getRecycledApplications(name)
public Mono<ResponseView<List<ApplicationInfoView>>> getRecycledApplications(@RequestParam(required = false) String name, @RequestParam(required = false) String category) {
return applicationApiService.getRecycledApplications(name, category)
.collectList()
.map(ResponseView::success);
}
Expand Down Expand Up @@ -159,13 +159,14 @@ public Mono<ResponseView<UserHomepageView>> getUserHomePage(@RequestParam(requir

@Override
public Mono<ResponseView<List<ApplicationInfoView>>> getApplications(@RequestParam(required = false) Integer applicationType,
@RequestParam(required = false) ApplicationStatus applicationStatus,
@RequestParam(defaultValue = "true") boolean withContainerSize,
@RequestParam(required = false) String name,
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
@RequestParam(required = false, defaultValue = "0") Integer pageSize) {
@RequestParam(required = false) ApplicationStatus applicationStatus,
@RequestParam(defaultValue = "true") boolean withContainerSize,
@RequestParam(required = false) String name,
@RequestParam(required = false) String category,
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
@RequestParam(required = false, defaultValue = "0") Integer pageSize) {
ApplicationType applicationTypeEnum = applicationType == null ? null : ApplicationType.fromValue(applicationType);
var flux = userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationTypeEnum, applicationStatus, withContainerSize, name).cache();
var flux = userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationTypeEnum, applicationStatus, withContainerSize, name, category).cache();
Mono<Long> countMono = flux.count();
var flux1 = flux.skip((long) (pageNum - 1) * pageSize);
if(pageSize > 0) flux1 = flux1.take(pageSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public interface ApplicationEndpoints
description = "List all the recycled Lowcoder Applications in the recycle bin where the authenticated or impersonated user has access."
)
@GetMapping("/recycle/list")
public Mono<ResponseView<List<ApplicationInfoView>>> getRecycledApplications(@RequestParam(required = false) String name);
public Mono<ResponseView<List<ApplicationInfoView>>> getRecycledApplications(@RequestParam(required = false) String name, @RequestParam(required = false) String category);

@Operation(
tags = TAG_APPLICATION_MANAGEMENT,
Expand Down Expand Up @@ -167,6 +167,7 @@ public Mono<ResponseView<List<ApplicationInfoView>>> getApplications(@RequestPar
@RequestParam(required = false) ApplicationStatus applicationStatus,
@RequestParam(defaultValue = "true") boolean withContainerSize,
@RequestParam(required = false) String name,
@RequestParam(required = false) String category,
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
@RequestParam(required = false, defaultValue = "0") Integer pageSize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface FolderApiService {

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

Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name);
Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name, @Nullable String category);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ public Mono<Void> upsertLastViewTime(@Nullable String folderId) {
* @return flux of {@link ApplicationInfoView} or {@link FolderInfoView}
*/
@Override
public Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name) {
return buildApplicationInfoViewTree(applicationType, name)
public Flux<?> getElements(@Nullable String folderId, @Nullable ApplicationType applicationType, @Nullable String name, @Nullable String category) {
return buildApplicationInfoViewTree(applicationType, name, category)
.flatMap(tree -> {
FolderNode<ApplicationInfoView, FolderInfoView> folderNode = tree.get(folderId);
if (folderNode == null) {
Expand Down Expand Up @@ -278,13 +278,13 @@ private Mono<Tree<Object, Folder>> buildFolderTree(String orgId) {
.map(folders -> new Tree<>(folders, Folder::getId, Folder::getParentFolderId, Collections.emptyList(), null, null));
}

private Mono<Tree<ApplicationInfoView, FolderInfoView>> buildApplicationInfoViewTree(@Nullable ApplicationType applicationType, @Nullable String name) {
private Mono<Tree<ApplicationInfoView, FolderInfoView>> buildApplicationInfoViewTree(@Nullable ApplicationType applicationType, @Nullable String name, @Nullable String category) {

Mono<OrgMember> orgMemberMono = sessionUserService.getVisitorOrgMemberCache()
.cache();

Flux<ApplicationInfoView> applicationInfoViewFlux =
userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationType, ApplicationStatus.NORMAL, false, name)
userHomeApiService.getAllAuthorisedApplications4CurrentOrgMember(applicationType, ApplicationStatus.NORMAL, false, name, category)
.cache();

Mono<Map<String, String>> application2FolderMapMono = applicationInfoViewFlux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ public Mono<ResponseView<FolderInfoView>> update(@RequestBody Folder folder) {
public Mono<PageResponseView<?>> getElements(@RequestParam(value = "id", required = false) String folderId,
@RequestParam(value = "applicationType", required = false) ApplicationType applicationType,
@RequestParam(required = false) String name,
@RequestParam(required = false) String category,
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
@RequestParam(required = false, defaultValue = "0") Integer pageSize) {
String objectId = gidService.convertFolderIdToObjectId(folderId);
var flux = folderApiService.getElements(objectId, applicationType, name).cache();
var flux = folderApiService.getElements(objectId, applicationType, name, category).cache();
var countMono = flux.count();
var flux1 = flux.skip((long) (pageNum - 1) * pageSize);
if(pageSize > 0) flux1 = flux1.take(pageSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public interface FolderEndpoints
public Mono<PageResponseView<?>> getElements(@RequestParam(value = "id", required = false) String folderId,
@RequestParam(value = "applicationType", required = false) ApplicationType applicationType,
@RequestParam(required = false) String name,
@RequestParam(required = false) String category,
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
@RequestParam(required = false, defaultValue = "0") Integer pageSize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface UserHomeApiService {
Mono<UserHomepageView> getUserHomePageView(ApplicationType applicationType);

Flux<ApplicationInfoView> getAllAuthorisedApplications4CurrentOrgMember(@Nullable ApplicationType applicationType,
@Nullable ApplicationStatus applicationStatus, boolean withContainerSize, @Nullable String name);
@Nullable ApplicationStatus applicationStatus, boolean withContainerSize, @Nullable String name, @Nullable String category);

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

Expand Down
Loading

0 comments on commit 0ec2a69

Please sign in to comment.