Skip to content

Commit

Permalink
fix(raw-data-preview): add demo
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed Jul 11, 2024
1 parent 5e31c31 commit fde8332
Show file tree
Hide file tree
Showing 7 changed files with 7,760 additions and 6 deletions.
17 changes: 16 additions & 1 deletion bricks/visual-builder/build.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// @ts-check
import CopyPlugin from "copy-webpack-plugin";

/** @type {import("@next-core/build-next-bricks").BuildNextBricksConfig} */
export default {};
export default {
plugins: [
new CopyPlugin({
patterns: [
{
from: "src/raw-data-preview/fixtures",
to: "fixtures",
// Terser skip this file for minimization
info: { minimized: true },
},
],
}),
],
};
56 changes: 56 additions & 0 deletions bricks/visual-builder/docs/raw-data-preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
构件 `visual-builder.raw-data-preview`

## Examples

### Basic

```yaml preview
brick: visual-builder.raw-data-preview
properties:
previewUrl: /preview/
theme: <% THEME.getTheme() %>
uiVersion: "8.2"
generations: <% CTX.generations ?? [] %>
style:
height: 100vh
context:
- name: hostList
resolve:
useProvider: basic.http-request
args:
- /preview/bricks/visual-builder/dist/fixtures/host-list.json
- name: appList
resolve:
useProvider: basic.http-request
args:
- /preview/bricks/visual-builder/dist/fixtures/app-list.json
- name: serviceList
resolve:
useProvider: basic.http-request
args:
- /preview/bricks/visual-builder/dist/fixtures/service-list.json
- name: rawGenerations
resolve:
useProvider: basic.http-request
args:
- /preview/bricks/visual-builder/dist/fixtures/raw-generations.json
- name: generations
value: |
<%
CTX.rawGenerations.map((g) => ({
..._.pick(g, [
"objectId",
"objectName",
"propertyId",
"propertyName",
]),
candidates: g.json,
mockData:
g.objectId === "HOST"
? CTX.hostList
: g.objectId === "APP"
? CTX.appList
: CTX.serviceList
})).filter((g) => g.candidates)
%>
```
193 changes: 193 additions & 0 deletions bricks/visual-builder/src/raw-data-preview/fixtures/app-list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
[
{
"name": "App1",
"appId": "APP12345",
"memo": "This is a test application",
"releaseAbbreviation": "v1.0",
"releaseDate": "2023-01-01 12:00:00",
"releaseNum": "R1001",
"releaseTimes": "1",
"_hierarchy": "接入上层",
"_updatable": 1,
"appStatus": "运营中",
"runningState": "运行中",
"status": "上线",
"__pipeline": [
{
"name": "Pipeline1",
"category": "Category1",
"flowId": "F12345",
"flowVersion": 1,
"templateId": "T12345",
"templateVersion": 1,
"rules": "rule1,rule2",
"subscribers": ["user1", "user2"],
"subscribedChannel": "channel1",
"noticeMethods": ["email", "sms"],
"metadata": "metadata1"
},
{
"name": "Pipeline2",
"category": "Category2",
"flowId": "F23456",
"flowVersion": 2,
"templateId": "T23456",
"templateVersion": 2,
"rules": "rule3,rule4",
"subscribers": ["user3", "user4"],
"subscribedChannel": "channel2",
"noticeMethods": ["email"],
"metadata": "metadata2"
}
],
"_defaultDeployStrategy": [
{ "clusterType": "Type1", "strategyId": "S12345" },
{ "clusterType": "Type2", "strategyId": "S23456" }
],
"_packageList": [
{
"name": "Package1",
"packageId": "P12345",
"installPath": "/opt/package1",
"isMaster": "true",
"platform": "Linux",
"preStop": 1,
"forceUpdate": 1,
"postRestart": 1,
"autoStart": 1,
"targetVersion": "1.0.0",
"userCheck": 1,
"fullUpdate": 1,
"fileCheckType": "full"
},
{
"name": "Package2",
"packageId": "P23456",
"installPath": "/opt/package2",
"isMaster": "false",
"platform": "Windows",
"preStop": 0,
"forceUpdate": 0,
"postRestart": 0,
"autoStart": 0,
"targetVersion": "2.0.0",
"userCheck": 0,
"fullUpdate": 0,
"fileCheckType": "diff"
}
]
},
{
"name": "App2",
"appId": "APP67890",
"memo": "Another test application",
"releaseAbbreviation": "v2.0",
"releaseDate": "2023-02-01 12:00:00",
"releaseNum": "R2001",
"releaseTimes": "2",
"_hierarchy": "接入中层",
"_updatable": 1,
"appStatus": "已停用",
"runningState": "已下线",
"status": "下线",
"__pipeline": [
{
"name": "Pipeline3",
"category": "Category3",
"flowId": "F34567",
"flowVersion": 3,
"templateId": "T34567",
"templateVersion": 3,
"rules": "rule5,rule6",
"subscribers": ["user5", "user6"],
"subscribedChannel": "channel3",
"noticeMethods": ["sms"],
"metadata": "metadata3"
}
],
"_defaultDeployStrategy": [
{ "clusterType": "Type3", "strategyId": "S34567" }
],
"_packageList": [
{
"name": "Package3",
"packageId": "P34567",
"installPath": "/opt/package3",
"isMaster": "true",
"platform": "Linux",
"preStop": 1,
"forceUpdate": 1,
"postRestart": 1,
"autoStart": 1,
"targetVersion": "1.0.0",
"userCheck": 1,
"fullUpdate": 1,
"fileCheckType": "full"
}
]
},
{
"name": "App3",
"appId": "APP01234",
"memo": "Third test application",
"releaseAbbreviation": "v3.0",
"releaseDate": "2023-03-01 12:00:00",
"releaseNum": "R3001",
"releaseTimes": "3",
"_hierarchy": "接入下层",
"_updatable": 1,
"appStatus": "运营中",
"runningState": "运行中",
"status": "上线",
"__pipeline": [
{
"name": "Pipeline4",
"category": "Category4",
"flowId": "F45678",
"flowVersion": 4,
"templateId": "T45678",
"templateVersion": 4,
"rules": "rule7,rule8",
"subscribers": ["user7", "user8"],
"subscribedChannel": "channel4",
"noticeMethods": ["email", "sms"],
"metadata": "metadata4"
}
],
"_defaultDeployStrategy": [
{ "clusterType": "Type4", "strategyId": "S45678" }
],
"_packageList": [
{
"name": "Package4",
"packageId": "P45678",
"installPath": "/opt/package4",
"isMaster": "true",
"platform": "Linux",
"preStop": 1,
"forceUpdate": 1,
"postRestart": 1,
"autoStart": 1,
"targetVersion": "1.0.0",
"userCheck": 1,
"fullUpdate": 1,
"fileCheckType": "full"
},
{
"name": "Package5",
"packageId": "P56789",
"installPath": "/opt/package5",
"isMaster": "false",
"platform": "Windows",
"preStop": 0,
"forceUpdate": 0,
"postRestart": 0,
"autoStart": 0,
"targetVersion": "2.0.0",
"userCheck": 0,
"fullUpdate": 0,
"fileCheckType": "diff"
}
]
}
]
Loading

0 comments on commit fde8332

Please sign in to comment.