Skip to content

Commit

Permalink
sync: hosted cloud (apitable#1592)
Browse files Browse the repository at this point in the history
Submit a pull request for this project.

<!-- If you have an Issue that related to this Pull Request, you can
copy this Issue's description -->

# Why? 
<!-- 
> Related to which issue?
> Why we need this pull request?
> What is the user story for this pull request? 
-->


# What?
<!-- 
> Can you describe this feature in detail?
> Who can benefit from it? 
-->


# How?
<!-- 
> Do you have a simple description of how this pull request is
implemented?
-->

---------

Co-authored-by: Caedman Ziwen Lan <[email protected]>
Co-authored-by: Harry Yep <[email protected]>
Co-authored-by: Zoe <[email protected]>
Co-authored-by: Zoe <[email protected]>
Co-authored-by: Kilian <[email protected]>
Co-authored-by: Aria <[email protected]>
Co-authored-by: ziqiang <[email protected]>
Co-authored-by: Shawn Deng <[email protected]>
Co-authored-by: Chambers <[email protected]>
Co-authored-by: William Chan <[email protected]>
Co-authored-by: wangkailang <[email protected]>
Co-authored-by: Jeremy Yin <[email protected]>
Co-authored-by: quppenge <[email protected]>
Co-authored-by: QuppZhang <[email protected]>
Co-authored-by: XuKecheng <[email protected]>
Co-authored-by: xukecheng <[email protected]>
Co-authored-by: Michael Xiaoliang Chan <[email protected]>
Co-authored-by: yechen <[email protected]>
Co-authored-by: Chalme Cheng Peng <[email protected]>
Co-authored-by: XuKecheng <[email protected]>
Co-authored-by: Evie Wanmei Huang <[email protected]>
  • Loading branch information
22 people authored Jan 29, 2024
1 parent bc14c31 commit 6579041
Show file tree
Hide file tree
Showing 495 changed files with 10,205 additions and 9,970 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.8.0
current_version = 1.9.0
commit = False
tag = False

Expand Down
2 changes: 1 addition & 1 deletion backend-server/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.0
1.9.0
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down Expand Up @@ -128,7 +129,7 @@ public class WidgetServiceImpl implements IWidgetService {
@Resource
private ObjectMapper objectMapper;

@Resource
@Autowired(required = false)
private EntitlementServiceFacade entitlementServiceFacade;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,12 @@ public ResponseData<NodeInfoVo> update(@PathVariable("nodeId") String nodeId,
SpaceHolder.set(spaceId);
// The method includes determining whether the user is in this space.
Long memberId = LoginContext.me().getMemberId(userId, spaceId);
NodePermission nodePermission =
NodeType.CUSTOM_PAGE.equals(iNodeService.getTypeByNodeId(nodeId))
? NodePermission.EDIT_CELL
: NodePermission.MANAGE_NODE;
// check whether the node has the specified operation permission
controlTemplate.checkNodePermission(memberId, nodeId, NodePermission.MANAGE_NODE,
controlTemplate.checkNodePermission(memberId, nodeId, nodePermission,
status -> ExceptionUtil.isTrue(status, PermissionException.NODE_OPERATION_DENIED));
iNodeService.edit(userId, nodeId, nodeOpRo);
return ResponseData.success(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public String getNodeParentId() {

@JsonIgnore
@Override
public List getChildrenNodes() {
public List<NodeShareTree> getChildrenNodes() {
return this.children;
}

Expand Down
4 changes: 4 additions & 0 deletions backend-server/application/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ spring:
simple:
acknowledge-mode: manual
prefetch: 5
auto-startup: true
retry:
enabled: true

virtual-host: ${RABBITMQ_VHOST:/}
mail:
host: ${MAIL_HOST:smtp.apitable.com}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
<mapper namespace="com.apitable.workspace.mapper.NodeMapper">
<insert id="insertBatch">
INSERT INTO ${tablePrefix}node(id, space_id, parent_id, pre_node_id, node_id, node_name, icon, type, cover, is_template,
created_by, updated_by)
created_by, updated_by, extra)
VALUES
<foreach item="item" index="index" collection="entities" separator=",">
<trim prefix="(" suffix=")">
#{item.id},#{item.spaceId},#{item.parentId},#{item.preNodeId},#{item.nodeId},#{item.nodeName},
#{item.icon},#{item.type},#{item.cover},#{item.isTemplate},#{item.createdBy},#{item.updatedBy}
#{item.icon},#{item.type},#{item.cover},#{item.isTemplate},#{item.createdBy},#{item.updatedBy},
#{item.extra}
</trim>
</foreach>
</insert>
Expand Down
1,108 changes: 563 additions & 545 deletions backend-server/application/src/main/resources/sysconfig/strings.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.apitable.template.service.impl;


import static org.assertj.core.api.Assertions.assertThat;

import com.apitable.AbstractIntegrationTest;
import com.apitable.mock.bean.MockUserSpace;
import com.apitable.shared.context.LoginContext;
import com.apitable.template.ro.CreateTemplateRo;
import com.apitable.template.vo.TemplateDirectoryVo;
import com.apitable.workspace.enums.NodeType;
import com.apitable.workspace.ro.NodeEmbedPageRo;
import com.apitable.workspace.ro.NodeOpRo;
import com.apitable.workspace.ro.NodeRelRo;
import com.apitable.workspace.vo.NodeShareTree;
import org.junit.jupiter.api.Test;

public class TemplateServiceImplTest extends AbstractIntegrationTest {

@Test
void testCreateTplWithCustomPageInFolder() {
MockUserSpace userSpace = createSingleUserAndSpace();
String rootNodeId = iNodeService.getRootNodeIdBySpaceId(userSpace.getSpaceId());
String folderId = iNodeService.createNode(userSpace.getUserId(), userSpace.getSpaceId(),
NodeOpRo.builder().parentId(rootNodeId).type(
NodeType.FOLDER.getNodeType()).build());
// create custom page
NodeRelRo nodeRelRo = new NodeRelRo();
nodeRelRo.setEmbedPage(new NodeEmbedPageRo("https://www.baidu.con", "any"));
iNodeService.createNode(userSpace.getUserId(), userSpace.getSpaceId(),
NodeOpRo.builder().parentId(folderId).type(NodeType.CUSTOM_PAGE.getNodeType())
.extra(nodeRelRo).build());
CreateTemplateRo createTemplateRo = new CreateTemplateRo();
createTemplateRo.setNodeId(folderId);
createTemplateRo.setData(true);
createTemplateRo.setName("new folder");
String templateId = iTemplateService.create(userSpace.getUserId(), userSpace.getSpaceId(),
createTemplateRo);
String lang = LoginContext.me().getLocaleStrWithUnderLine();
TemplateDirectoryVo vo =
iTemplateService.getDirectoryVo("tpcprivate", templateId, true, lang);
NodeShareTree nodeShareTree = vo.getNodeTree();
assertThat(nodeShareTree.getChildrenNodes()).isNotEmpty();
assertThat(nodeShareTree.getChildrenNodes().get(0).getExtra()).isNotEmpty();
}

@Test
void testCreateTplWithCustomPageInFolderWithoutExtra() {
MockUserSpace userSpace = createSingleUserAndSpace();
String rootNodeId = iNodeService.getRootNodeIdBySpaceId(userSpace.getSpaceId());
String folderId = iNodeService.createNode(userSpace.getUserId(), userSpace.getSpaceId(),
NodeOpRo.builder().parentId(rootNodeId).type(
NodeType.FOLDER.getNodeType()).build());

iNodeService.createNode(userSpace.getUserId(), userSpace.getSpaceId(),
NodeOpRo.builder().parentId(folderId).type(NodeType.CUSTOM_PAGE.getNodeType()).build());
CreateTemplateRo createTemplateRo = new CreateTemplateRo();
createTemplateRo.setNodeId(folderId);
createTemplateRo.setData(true);
createTemplateRo.setName("new folder");
String templateId = iTemplateService.create(userSpace.getUserId(), userSpace.getSpaceId(),
createTemplateRo);
String lang = LoginContext.me().getLocaleStrWithUnderLine();
TemplateDirectoryVo vo =
iTemplateService.getDirectoryVo("tpcprivate", templateId, true, lang);
NodeShareTree nodeShareTree = vo.getNodeTree();
assertThat(nodeShareTree.getChildrenNodes()).isNotEmpty();
assertThat(nodeShareTree.getChildrenNodes().get(0).getExtra()).isNull();
}
}
2 changes: 1 addition & 1 deletion init-db/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.0
1.9.0
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "1.8.0",
"version": "1.9.0",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand All @@ -23,7 +23,6 @@
"build:room-server": "nx run @apitable/room-server:build",
"build:datasheet": "nx run @apitable/datasheet:build",
"build:api-client": "nx run @apitable/api-client:build",
"build:ai-components": "node build.js",
"build:dst:pre": "nx run-many -t build -p @apitable/i18n-lang @apitable/core @apitable/icons @apitable/components @apitable/ai @apitable/widget-sdk --parallel=5 && pnpm build:api-client",
"build:dst": "nx run --verbose @apitable/datasheet:build",
"build:air-agent:pre": "nx run-many -t build -p @apitable/i18n-lang @apitable/icons @apitable/core @apitable/components @apitable/ai --parallel=5",
Expand Down
122 changes: 122 additions & 0 deletions packages/ai-components/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"extends": [
"../../.eslintrc"
],
"plugins": ["import"],
// "parserOptions": {
// "project": "./tsconfig.json"
// },
"rules": {
"import/no-duplicates": [
"warn",
{
"considerQueryString": true
}
],
"import/order": [
"warn",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"pathGroups": [
{
"pattern": "@apitable/**",
"group": "external",
"position": "after"
},
{
"pattern": "pc/**",
"group": "internal",
"position": "after"
},
{
"pattern": "static/**",
"group": "internal",
"position": "after"
},
{
"pattern": "enterprise/**",
"group": "sibling",
"position": "after"
},
{
"pattern": "./*.less",
"group": "index",
"position": "after"
},
{
"pattern": "./*.module.less",
"group": "index",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": [
"builtin"
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"comma-spacing": [
"warn",
{
"before": false,
"after": true
}
],
"react/display-name": 0,
"react/no-find-dom-node": 0,
"react/no-unknown-property": 1,
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "@apitable/components",
"importNames": [
"Select"
],
"message": "Please use tooltip DropdownSelect from '@apitable/components instead ."
},
{
"name": "pc/components/common/tooltip",
"importNames": [
"Tooltip"
],
"message": "Please use tooltip FloatUiTooltip from '@apitable/components instead ."
},
{
"name": "pc/components/common",
"importNames": [
"Tooltip"
],
"message": "Please use tooltip FloatUiTooltip from '@apitable/components instead ."
},
{
"name": "react-custom-scrollbars",
"importNames": [
"Scrollbars"
],
"message": "Please use ScrollBar from pc/components/scroll_bar instead."
}
]
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
]
// "@typescript-eslint/no-misused-promises": 1,
// "@typescript-eslint/no-floating-promises": 1
}
}
6 changes: 6 additions & 0 deletions packages/ai-components/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
.DS_Store
npm-debug.log*
yarn-debug.log*
yarn-error.log*
20 changes: 20 additions & 0 deletions packages/ai-components/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# The current package will be released to npm,
# and only d.ts will be kept in npm without source code,
# and all unnecessary sensitive information will be discharged in
.yarn
src
dist/**/*.d.ts.map
tsconfig*.json
docs/
READ.dev.md
setup.ts
styleguide/
styleguide.config.js
typings.json
typings/
.storybook
.env
.gitignore
jest.config.js
sonar-project.properties
README.md
17 changes: 17 additions & 0 deletions packages/ai-components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# APITable Components

A Design System with React、styled-components and Typescript.

## Install

```bash
yarn add @apitable/components
```

## Usage

```javascript
import { Select } from '@apitable/components';
```


6 changes: 3 additions & 3 deletions packages/ai-components/build.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { exec } = require('child_process');
const fs = require('fs');

const configFile = 'rollup.config.js';
const dir = 'src';

// Check if the file exists
fs.access(configFile, fs.constants.F_OK, (err) => {
fs.access(dir, fs.constants.F_OK, (err) => {
if (err) {
console.error(`${configFile} does not exist, no compilation will be performed.`);
console.error(`${dir} does not exist, no compilation will be performed.`);
} else {
// File exists, execute the rollup -c command
exec('rm -rf ./dist && rollup -c --bundleConfigAsCjs && tsc-alias', (error, stdout, stderr) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apitable/ai",
"version": "1.8.0",
"version": "1.9.0",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"author": "APITable Ltd. <[email protected]>",
Expand Down
10 changes: 10 additions & 0 deletions packages/ai-components/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import("prettier").Config} */
module.exports = {
bracketSpacing: true,
printWidth: 150,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
};
Loading

0 comments on commit 6579041

Please sign in to comment.