Skip to content

Commit

Permalink
refactor: implement new saga designer (apache#6280)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptyin committed Jan 23, 2024
1 parent 36e6e41 commit e858228
Show file tree
Hide file tree
Showing 147 changed files with 12,050 additions and 12,190 deletions.
3 changes: 3 additions & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6157](https://github.com/apache/incubator-seata/pull/6157)] increase common module unit test coverage
- [[#6250](https://github.com/apache/incubator-seata/pull/6250)] increase seata-core module unit test coverage

### refactor:
- [[#6280](https://github.com/apache/incubator-seata/pull/6280)] refactor Saga designer using diagram-js

Thanks to these contributors for their code commits. Please report an unintended omission.

<!-- Please make sure your Github ID is in the list below -->
Expand Down
3 changes: 3 additions & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
- [[#6157](https://github.com/apache/incubator-seata/pull/6157)] 增加common模块单测覆盖率
- [[#6250](https://github.com/apache/incubator-seata/pull/6250)] 增加seata-core模块单测覆盖率

### refactor:
- [[#6280](https://github.com/apache/incubator-seata/pull/6280)] 使用diagram-js重构Saga设计器

非常感谢以下 contributors 的代码贡献。若有无意遗漏,请报告。

<!-- 请确保您的 GitHub ID 在以下列表中 -->
Expand Down
4 changes: 2 additions & 2 deletions console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
</goals>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v12.22.12</nodeVersion>
<nodeVersion>v14.21.3</nodeVersion>
</configuration>
</execution>
<execution>
Expand Down Expand Up @@ -208,4 +208,4 @@
</resource>
</resources>
</build>
</project>
</project>
28 changes: 7 additions & 21 deletions console/src/main/resources/static/console-fe/build/copyDesigner.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ const fs = require('fs');
const path = require('path');
const childProcess = require('child_process')

const mkdir = dir => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
};

// copy seata-saga-statemachine-designer to console
const designerDir = path.join(__dirname, '../../../../../../../saga/seata-saga-statemachine-designer');
if (!fs.existsSync(path.join(designerDir, "dist"))) {
Expand All @@ -34,18 +28,10 @@ if (!fs.existsSync(path.join(designerDir, "dist"))) {

// copy file
const designerDestDir = path.join(__dirname,'../public/saga-statemachine-designer');
const designerHtmlFileName = path.join(designerDestDir, 'designer.html');
const designerBundleFileName = path.join(designerDestDir, 'dist/bundle.js');

mkdir(path.dirname(designerHtmlFileName));
mkdir(path.dirname(designerBundleFileName));

fs.createReadStream(path.join(designerDir, 'index.html'))
.pipe(
fs.createWriteStream(designerHtmlFileName)
);

fs.createReadStream(path.join(designerDir, 'dist/bundle.js'))
.pipe(
fs.createWriteStream(designerBundleFileName)
);
if (!fs.existsSync(designerDestDir)) {
fs.mkdirSync(designerDestDir)
}
fs.readdirSync(path.join(designerDir, 'dist')).forEach(file => {
fs.copyFileSync(path.join(designerDir, 'dist', file), path.join(designerDestDir, file));
});
fs.renameSync(path.join(designerDestDir, 'index.html'), path.join(designerDestDir, 'designer.html'));
20 changes: 6 additions & 14 deletions console/src/main/resources/static/console-fe/build/copyFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,10 @@ copyList.forEach(_fileName => {
// copy seata-saga-statemachine-designer from console-fe/public to console resource folder
const designerDir = path.join(__dirname, '../public/saga-statemachine-designer');
const designerDestDir = path.join(destDir, 'saga-statemachine-designer');
const designerHtmlFileName = path.join(designerDestDir, 'designer.html');
const designerBundleFileName = path.join(designerDestDir, 'dist/bundle.js');

mkdir(path.dirname(designerHtmlFileName));
mkdir(path.dirname(designerBundleFileName));

fs.createReadStream(path.join(designerDir, 'designer.html'))
.pipe(
fs.createWriteStream(designerHtmlFileName)
);

fs.createReadStream(path.join(designerDir, 'dist/bundle.js'))
.pipe(
fs.createWriteStream(designerBundleFileName)
);
if (!fs.existsSync(designerDestDir)) {
fs.mkdirSync(designerDestDir)
}
fs.readdirSync(designerDir).forEach(file => {
fs.copyFileSync(path.join(designerDir, file), path.join(designerDestDir, file));
});
38 changes: 8 additions & 30 deletions saga/seata-saga-statemachine-designer/.babelrc
Original file line number Diff line number Diff line change
@@ -1,42 +1,20 @@
{
"presets": [
"@babel/preset-env",
[
"@babel/preset-env",
"@babel/preset-react",
{
"modules": false,
"useBuiltIns": "usage",
"corejs": "core-js@3",
"runtime": "automatic"
}
],
"@babel/preset-react"
]
],
"plugins": [
"@babel/plugin-transform-runtime",
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
[
"module-resolver",
{
"alias": {
"@common": "./ggeditor/common",
"@components": "./ggeditor/components",
"@helpers": "./ggeditor/helpers",
"@utils": "./ggeditor/utils",
"@gg-editor-core": "./ggeditor/gg-editor-core"
}
}
],
[
"transform-inline-environment-variables",
"@babel/plugin-transform-react-jsx",
{
"include": [
"GG_EDITOR_VERSION"
]
"importSource": "@bpmn-io/properties-panel/preact",
"runtime": "automatic"
}
]
]
}
}
8 changes: 6 additions & 2 deletions saga/seata-saga-statemachine-designer/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"env": {
"browser": true
},
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"extends": "airbnb",
"rules": {
"arrow-body-style": 0,
Expand All @@ -21,6 +21,10 @@
"react/no-multi-comp": 0,
"react/prefer-stateless-function": 0,
"react/prop-types": 0,
"react/sort-comp": 0
"react/sort-comp": 0,
"react/no-deprecated": 0,
"react/react-in-jsx-scope": 0,
"react/jsx-no-bind": 0,
"no-underscore-dangle": 0
}
}
9 changes: 5 additions & 4 deletions saga/seata-saga-statemachine-designer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
es
cjs
dist
node_modules
/.idea/
/.vscode/

/node_modules/
/dist/
Loading

0 comments on commit e858228

Please sign in to comment.