diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml new file mode 100644 index 0000000000..340c6fdbbd --- /dev/null +++ b/.github/workflows/deploy-gh-pages.yml @@ -0,0 +1,56 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: [develop] + +jobs: + deploy-gh-pages: + runs-on: ubuntu-latest + concurrency: + group: deploy-gh-pages + cancel-in-progress: true + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + run_install: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: pnpm install + + - name: add environment variable + run: | + cat <<'EOF' >> designer-demo/env/.env.alpha + // ---- appended by CI (gh-pages) ---- + VITE_ORIGIN=https://agent.opentiny.design/ + EOF + - name: change material url + run: | + sed -i "s#material: \['/mock/bundle.json'\]#material: \['https://opentiny.github.io/tiny-engine/mock/bundle.json'\]#g" designer-demo/engine.config.js + echo "Updated material url in designer-demo/engine.config.js" + - name: Run Build + run: | + set -eo pipefail + pnpm run build:plugin 2>&1 | tee /tmp/build-plugin.log + pnpm run build:alpha 2>&1 | tee /tmp/build-alpha.log + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./designer-demo/dist/ + keep_files: true + force_orphan: false + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/designer-demo/engine.config.js b/designer-demo/engine.config.js index fa308f9bc2..0ed7c1858a 100644 --- a/designer-demo/engine.config.js +++ b/designer-demo/engine.config.js @@ -3,5 +3,7 @@ export default { theme: 'light', material: ['/mock/bundle.json'], scripts: [], - styles: [] + styles: [], + // 是否开启 TailWindCSS 特性 + enableTailwindCSS: true } diff --git a/designer-demo/public/mock/bundle.json b/designer-demo/public/mock/bundle.json index 799f4ea833..3d03b34252 100644 --- a/designer-demo/public/mock/bundle.json +++ b/designer-demo/public/mock/bundle.json @@ -4433,18 +4433,19 @@ "bindState": true, "label": { "text": { - "zh_CN": "资源" + "zh_CN": "资源选择" } }, "cols": 12, "rules": [], "widget": { - "component": "InputConfigurator", + "component": "SourceSelectConfigurator", "props": {} }, "description": { "zh_CN": "src路径" - } + }, + "labelPosition": "top" }, { "property": "attributes3", diff --git a/designer-demo/registry.js b/designer-demo/registry.js index 23d7d0c824..bf89228632 100644 --- a/designer-demo/registry.js +++ b/designer-demo/registry.js @@ -13,6 +13,9 @@ import { META_SERVICE, META_APP } from '@opentiny/tiny-engine-meta-register' import engineConfig from './engine.config' import { HttpService } from './src/composable' +const baseURL = import.meta.env.BASE_URL || '.' +const baseURLWithoutSlash = baseURL.replace(/\/$/, '') + export default { [META_SERVICE.Http]: HttpService, 'engine.config': { @@ -43,5 +46,12 @@ export default { } } } + }, + [META_APP.Preview]: { + options: { + // 配置预览跳转的 url:根据实际业务需求进行配置 + // 文档:https://opentiny.design/tiny-engine#/help-center/course/dev/preview-api + previewUrl: ['prod', 'alpha'].includes(import.meta.env.MODE) ? `${baseURLWithoutSlash}/preview.html` : '' + } } } diff --git a/designer-demo/src/preview.js b/designer-demo/src/preview.js index 47c726cc88..c35f036f65 100644 --- a/designer-demo/src/preview.js +++ b/designer-demo/src/preview.js @@ -10,6 +10,7 @@ * */ import { defineEntry } from '@opentiny/tiny-engine-meta-register' +import engineConfig from '../engine.config' import 'virtual:svg-icons-register' async function startApp() { @@ -23,9 +24,7 @@ async function startApp() { const registry = { [META_SERVICE.Http]: HttpService, 'engine.config': { - id: 'engine.config', - theme: 'light', - material: ['/mock/bundle.json'] + ...engineConfig } } diff --git a/docs/README.md b/docs/README.md index 0a6c9a6fbd..ca958736c8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,6 +50,7 @@ - [更新日志](./changelog/changelog.md) - [v2.7升级指南](./changelog/v2.7-upgrade-guide.md) - 解决方案 + - [前端及Java服务端docker部署](./solutions/front-backend-docker-deployment.md) - [Java服务端部署](./solutions/server-deployment-solution-java.md) - [Node.js服务端部署](./solutions/server-deployment-solution.md) - [区块发布方案(Node.js服务端)](./solutions/block-release-solution.md) diff --git a/docs/catalog.json b/docs/catalog.json index d2ff885ed9..9682235a13 100644 --- a/docs/catalog.json +++ b/docs/catalog.json @@ -95,6 +95,7 @@ "title": "解决方案", "name": "solutions", "articles": [ + {"title": "前端及Java服务端docker部署", "name": "front-backend-docker-deployment.md"}, { "title": "Java服务端部署", "name": "server-deployment-solution-java.md" }, { "title": "Node.js服务端部署", "name": "server-deployment-solution.md" }, { "title": "区块发布方案(Node.js服务端)", "name": "block-release-solution.md" }, diff --git a/docs/changelog/v2.7-upgrade-guide.md b/docs/changelog/v2.7-upgrade-guide.md index 5e6865e9c7..87c7ea8cf9 100644 --- a/docs/changelog/v2.7-upgrade-guide.md +++ b/docs/changelog/v2.7-upgrade-guide.md @@ -361,6 +361,95 @@ const register = { } ``` +#### 3.3 仅支持在第一层声明(子层声明不会生效) + +自 v2.7 起,我们只读取注册表对象的“第一层”。只有第一层的键会被注册进 `metaHashMap`。 + +也就是说:把插件/配置项写在子层(无论是把唯一 ID 放到某个插件的子属性里,还是通过 `metas` 往里塞)都不会被注册,`getMergeMeta`/`getMergeMetaByType`/`getAllMergeMeta` 也就找不到它们。 + +简而言之:请把所有需要生效的插件/配置项,都放到注册表的第一层来声明。 + +错误示例(不会生效): +```javascript +import { META_APP } from '@opentiny/tiny-engine' +import testMeta from './testMeta' + +export default { + // 1) 在子层直接再次声明插件/配置项(无效,不会注册到 metaHashMap) + [META_APP.Materials]: { + 'engine.plugins.test': testMeta + }, + + // 2) 通过 metas 在子层注入(无效,不会注册到 metaHashMap) + [META_APP.Materials]: { + options: { + displayComponentIds: ['engine.plugins.test'], + metas: [testMeta] + } + } +} +``` + +正确示例(第一层声明 + 通过 ID 引用): +```javascript +import { META_APP } from '@opentiny/tiny-engine' +import testMeta from './testMeta' // testMeta.id = 'engine.plugins.test' + +export default { + // 作为第一层键单独注册 + [testMeta.id]: testMeta, + + // 在需要的插件或布局中通过 ID 引用 + [META_APP.Materials]: { + options: { + displayComponentIds: ['engine.plugins.test'] + } + } +} +``` + +适用范围:所有插件与配置项都遵循该规则。用户注册表只支持: +- 把已有的插件/配置项设为 `false`(删除默认); +- 在第一层新增插件/配置项; +- 在第一层用相同 ID 覆盖默认配置。 + +##### 物料插件(Materials 插件)迁移建议 + +如果你旧版本是在 `Materials` 插件内部(例如 `Materials.metas` 或把自定义 ID 放到 `Materials` 的子属性里)扩展物料插件,请按下面方式迁移: + +错误示例(不会生效): +```javascript +import { META_APP } from '@opentiny/tiny-engine' +import MyMaterial from './MyMaterial' // MyMaterial.id = 'engine.plugins.myMaterial' + +export default { + [META_APP.Materials]: { + // 通过 metas 向物料插件塞入物料项(无效) + options: { + metas: [MyMaterial] + } + } +} +``` + +正确示例(第一层声明 + 在物料插件中引用): +```javascript +import { META_APP } from '@opentiny/tiny-engine' +import MyMaterial from './MyMaterial' // MyMaterial.id = 'engine.plugins.myMaterial' + +export default { + // 1) 物料项作为第一层键单独注册 + [MyMaterial.id]: MyMaterial, + + // 2) 在 Materials 插件中通过 ID Tab 组件显示 + [META_APP.Materials]: { + options: { + displayComponentIds: ['engine.plugins.myMaterial'] + } + } +} +``` + ### 4. 注册表热修复功能 v2.7 版本新增了注册表热修复(hotfix)功能,可以通过覆盖官方插件的特定函数或模板,实现紧急 bug 修复,而不需要等待官方版本发布。 diff --git a/docs/extension-capabilities-overview/new-registry.md b/docs/extension-capabilities-overview/new-registry.md index e75ca723cd..6232f2b560 100644 --- a/docs/extension-capabilities-overview/new-registry.md +++ b/docs/extension-capabilities-overview/new-registry.md @@ -271,6 +271,47 @@ export default { 更多高级特性,请参考 [注册表高级配置](./new-registry-advanced.md)。 +## Tailwind CSS 支持 + +TinyEngine 自 v2.9 起支持在注册表中通过 `engine.config.enableTailwindCSS` 开关启用 Tailwind CSS(默认开启)。 + +### 开关配置 + +```javascript +// registry.js +export default { + 'engine.config': { + // ...其他配置 + enableTailwindCSS: true // 开启(默认即为 true);设为 false 可关闭 + } +} +``` + +### 启用后的行为 + +- 预览态:自动按需加载 `@tailwindcss/browser`,使画布/预览中可直接使用 Tailwind 原子类。 +- 出码生成:生成的应用将自动完成以下配置(基于 Tailwind CSS v4 零配置方案): + - 在依赖中添加 `tailwindcss`,并在开发依赖中添加 `@tailwindcss/vite`; + - 在 Vite 配置中注册 `tailwindcss()` 插件; + - 生成 `src/style.css`,内容包含 `@import "tailwindcss";`; + - 在 `src/main.js` 自动引入 `./style.css`。 + +以上步骤由引擎/出码器自动完成,无需手动干预。 + +### 关闭 Tailwind + +当配置为 `enableTailwindCSS: false` 时: + +- 预览态不会加载 `@tailwindcss/browser`; +- 出码时不会注入与 Tailwind 相关的依赖、Vite 插件及样式文件导入。 + +### 注意事项 + +- 预览依赖解析:内置 import-map 已包含 `@tailwindcss/browser` 映射;如使用自定义 CDN/离线环境,请确保该映射可用。 +- 自定义样式:可在生成的 `src/style.css` 中追加自定义样式,或在项目中新增样式文件后自行引入。 +- 运行时渲染:如果您自定义了运行时渲染引擎,请确保在运行时渲染中增加对 Tailwind CSS 的支持。 + + ## Vite 配置要求 **重要说明⚠️**:为了使注册表的 tree-shaking 功能正常工作,您需要在 `vite.config.js` 中配置 `registryPath` 参数,指向您的注册表文件路径。 diff --git a/docs/extension-capabilities-tutorial/mcpService.md b/docs/extension-capabilities-tutorial/mcpService.md index f108b83126..bb54fb0b5e 100644 --- a/docs/extension-capabilities-tutorial/mcpService.md +++ b/docs/extension-capabilities-tutorial/mcpService.md @@ -430,20 +430,22 @@ mcpService.setOptions(remoteConfig) ### 高级配置 -```typescript +
+
 import { getMetaApi } from '@opentiny/tiny-engine-meta-register'
 
 const mcpService = getMetaApi('engine.service.mcp')
 
 const advancedConfig = {
-  proxyUrl: process.env.MCP_PROXY_URL || 'http://localhost:3000/mcp',
-  connectToAgentServer: process.env.NODE_ENV === 'production',
+  proxyUrl: process.env.MCP_PROXY_URL || 'http://localhost:3000/mcp',
+  connectToAgentServer: process.env.NODE_ENV === 'production',
   reconnectAttempts: 5,
   reconnectInterval: 2000
 }
 
 mcpService.setOptions(advancedConfig)
-```
+
+
## 最佳实践 diff --git a/docs/solutions/front-backend-docker-deployment.md b/docs/solutions/front-backend-docker-deployment.md new file mode 100644 index 0000000000..63001571c3 --- /dev/null +++ b/docs/solutions/front-backend-docker-deployment.md @@ -0,0 +1,57 @@ +# 前端及Java服务端docker部署 + +## 1、环境准备 +- **工具安装** + + 根据自己的linux操作系统安装docker,配置国内镜像加速,编辑/etc/docker/daemon.json文件镜像地址,如图 + + ```sh + { + "registry-mirrors": [ + "https://docker.m.daocloud.io", + "https://mirror.iscas.ac.cn", + "https://docker.rainbond.cc", + "https://dockerproxy.cn", + "https://docker.udayun.com" + ] + } + ``` + + ![](./imgs/daemon.png) + + 编辑完成后重载配置重启docker + ```sh + sudo systemctl daemon-reload + sudo systemctl restart docker + ``` + docker-compose安装 + ```sh + sudo curl -L "https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + ``` +- **拉取代码** + ```sh + git clone -b develop https://github.com/opentiny/tiny-engine.git + git clone -b develop https://github.com/opentiny/tiny-engine-backend-java.git + ``` +## 2、配置修改 +- **nginx配置修改** + + 修改 Java 项目 /tiny-engine-backend-java/docker-deploy-data/nginx.conf 文件,如图所示将ip改为自己服务器ip或域名 + ![](./imgs/nginxcof.png) + +## 3、服务启动与停止 + +- **服务启动** + + 在 Java 项目根目录 docker-compose.yml 文件同级执行命令 + ```sh + docker-compose up -d + ``` +- **服务停止** + + ```sh + docker-compose stop + ``` +## 4、视频讲解 +- [TinyEngine实操教程(4)——前后端部署](https://www.bilibili.com/video/BV1gGgcz8Eek/?spm_id_from=333.1387.homepage.video_card.click&vd_source=ea0e34d0a465d263673f7f36dcae0edf) \ No newline at end of file diff --git a/docs/solutions/imgs/daemon.PNG b/docs/solutions/imgs/daemon.PNG new file mode 100644 index 0000000000..d4a8523621 Binary files /dev/null and b/docs/solutions/imgs/daemon.PNG differ diff --git a/docs/solutions/imgs/nginxcof.PNG b/docs/solutions/imgs/nginxcof.PNG new file mode 100644 index 0000000000..0db211b8c8 Binary files /dev/null and b/docs/solutions/imgs/nginxcof.PNG differ diff --git a/packages/build/vite-config/src/vite-plugins/devAliasPlugin.js b/packages/build/vite-config/src/vite-plugins/devAliasPlugin.js index 67783ab22b..2a2de03d96 100644 --- a/packages/build/vite-config/src/vite-plugins/devAliasPlugin.js +++ b/packages/build/vite-config/src/vite-plugins/devAliasPlugin.js @@ -29,6 +29,7 @@ const getDevAlias = (useSourceAlias) => { '@opentiny/tiny-engine-plugin-bridge': path.resolve(basePath, 'packages/plugins/bridge/index.ts'), '@opentiny/tiny-engine-plugin-tutorial': path.resolve(basePath, 'packages/plugins/tutorial/index.ts'), '@opentiny/tiny-engine-plugin-robot': path.resolve(basePath, 'packages/plugins/robot/index.ts'), + '@opentiny/tiny-engine-plugin-resource': path.resolve(basePath, 'packages/plugins/resource/index.ts'), '@opentiny/tiny-engine-settings-panel': path.resolve(basePath, 'packages/settings/panel/index.ts'), '@opentiny/tiny-engine-setting-events': path.resolve(basePath, 'packages/settings/events/index.ts'), '@opentiny/tiny-engine-setting-props': path.resolve(basePath, 'packages/settings/props/index.ts'), diff --git a/packages/canvas/DesignCanvas/src/DesignCanvas.vue b/packages/canvas/DesignCanvas/src/DesignCanvas.vue index 99a0099fe0..9a112f672e 100644 --- a/packages/canvas/DesignCanvas/src/DesignCanvas.vue +++ b/packages/canvas/DesignCanvas/src/DesignCanvas.vue @@ -76,9 +76,9 @@ export default { return } - const { importMap, importStyles } = getImportMapData(deps) + const { importMap, importStyles, importScripts } = getImportMapData(deps) - canvasSrcDoc.value = initCanvas(importMap, importStyles).html + canvasSrcDoc.value = initCanvas(importMap, importStyles, importScripts).html } }) diff --git a/packages/canvas/DesignCanvas/src/importMap.ts b/packages/canvas/DesignCanvas/src/importMap.ts index 499154c47d..632c2f8370 100644 --- a/packages/canvas/DesignCanvas/src/importMap.ts +++ b/packages/canvas/DesignCanvas/src/importMap.ts @@ -94,9 +94,13 @@ export function getImportMapData(canvasDeps = { scripts: [], styles: [] }) { } const importStyles = [...blockRequire.importStyles, ...canvasDeps.styles] + const customEnableTailWindCSS = getMergeMeta('engine.config')?.enableTailwindCSS + const tailwindURL = getImportUrl('@tailwindcss/browser') + const importScripts = customEnableTailWindCSS && tailwindURL ? [tailwindURL] : [] return { importMap, - importStyles + importStyles, + importScripts } } diff --git a/packages/canvas/canvas.html b/packages/canvas/canvas.html index 42304ac0e3..e1e7a68832 100644 --- a/packages/canvas/canvas.html +++ b/packages/canvas/canvas.html @@ -78,75 +78,6 @@ animation-delay: 2s; } html, - body, - object, - iframe, - p, - blockquote, - pre, - abbr, - address, - cite, - code, - del, - dfn, - em, - img, - ins, - kbd, - q, - samp, - small, - strong, - sub, - sup, - var, - b, - i, - dl, - dt, - dd, - ol, - ul, - li, - fieldset, - form, - label, - legend, - table, - caption, - tbody, - tfoot, - thead, - tr, - th, - td, - article, - aside, - canvas, - details, - figcaption, - figure, - footer, - header, - hgroup, - menu, - nav, - section, - summary, - time, - mark, - audio, - video { - margin: 0; - padding: 0; - border: 0; - outline: 0; - font-size: 100%; - background: transparent; - user-select: none; - } - html, body { width: 100%; height: 100%; diff --git a/packages/canvas/init-canvas/canvas.html b/packages/canvas/init-canvas/canvas.html index e9d2b2efaa..1dcefc4015 100644 --- a/packages/canvas/init-canvas/canvas.html +++ b/packages/canvas/init-canvas/canvas.html @@ -6,6 +6,7 @@ + diff --git a/packages/configurator/src/button-group-configurator/ButtonGroupConfigurator.vue b/packages/configurator/src/button-group-configurator/ButtonGroupConfigurator.vue index 47bc705d1b..62185fa088 100644 --- a/packages/configurator/src/button-group-configurator/ButtonGroupConfigurator.vue +++ b/packages/configurator/src/button-group-configurator/ButtonGroupConfigurator.vue @@ -9,15 +9,16 @@ - diff --git a/packages/configurator/src/code-list-configurator/CodeListConfigurator.vue b/packages/configurator/src/code-list-configurator/CodeListConfigurator.vue index 66bfffa0fe..651d39252c 100644 --- a/packages/configurator/src/code-list-configurator/CodeListConfigurator.vue +++ b/packages/configurator/src/code-list-configurator/CodeListConfigurator.vue @@ -39,8 +39,9 @@ - + diff --git a/packages/configurator/src/source-select-configurator/http.ts b/packages/configurator/src/source-select-configurator/http.ts new file mode 100644 index 0000000000..7e622b5cd0 --- /dev/null +++ b/packages/configurator/src/source-select-configurator/http.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +/* metaService: engine.plugins.appmanage.http */ +import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register' + +const baseUrl = '/material-center/api'; + +// 资源管理 -- 根据分组ID获取资源列表 +export const fetchResourceListByGroupId = (resourceGroupId: number) => getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource/find/${resourceGroupId}`) + +// 资源管理 -- 根据appId查询资源分组列表 +export const fetchResourceGroupByAppId = (appId: number) => getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource-group/${appId || getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id}`) diff --git a/packages/configurator/src/variable-configurator/VariableConfigurator.vue b/packages/configurator/src/variable-configurator/VariableConfigurator.vue index efb5bc1b3a..9946a55940 100644 --- a/packages/configurator/src/variable-configurator/VariableConfigurator.vue +++ b/packages/configurator/src/variable-configurator/VariableConfigurator.vue @@ -119,7 +119,7 @@ - + diff --git a/packages/plugins/resource/src/ResourceList.vue b/packages/plugins/resource/src/ResourceList.vue new file mode 100644 index 0000000000..ffb3dfc67d --- /dev/null +++ b/packages/plugins/resource/src/ResourceList.vue @@ -0,0 +1,631 @@ + + + diff --git a/packages/plugins/resource/src/ResourceSetting.vue b/packages/plugins/resource/src/ResourceSetting.vue new file mode 100644 index 0000000000..f9d84fd83f --- /dev/null +++ b/packages/plugins/resource/src/ResourceSetting.vue @@ -0,0 +1,160 @@ + + + diff --git a/packages/plugins/resource/src/js/http.ts b/packages/plugins/resource/src/js/http.ts new file mode 100644 index 0000000000..456e050979 --- /dev/null +++ b/packages/plugins/resource/src/js/http.ts @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +/* metaService: engine.plugins.appmanage.http */ +import { getMetaApi, getMergeMeta, META_SERVICE } from '@opentiny/tiny-engine-meta-register' + +const baseUrl = '/material-center/api' + +// 资源管理 -- 根据分组ID获取资源列表 +export const fetchResourceListByGroupId = (resourceGroupId: number) => + getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource/find/${resourceGroupId}`) + +// 资源管理 -- 获取资源列表含模糊查询 +export const fetchResourceList = () => getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource/like`) + +// 资源管理 -- 创建资源 +export const createResource = (params: any) => + getMetaApi(META_SERVICE.Http).post(`${baseUrl}/resource/create`, { + appId: getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id, + platformId: getMergeMeta('engine.config')?.platformId, + ...params + }) + +// 资源管理 -- 批量创建资源 +export const batchCreateResource = (params: any) => + getMetaApi(META_SERVICE.Http).post( + `${baseUrl}/resource/create/batch`, + params.map((item: any) => ({ + appId: getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id, + platformId: getMergeMeta('engine.config')?.platformId, + ...item + })) + ) + +// 资源管理 -- 删除资源 +export const deleteResource = (id: number) => getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource/delete/${id}`) + +// 资源管理 -- 获取资源详情 +export const fetchResourceDetail = (id: number) => getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource/detail/${id}`) + +// 资源管理 -- 查询资源分组列表 +export const fetchResourceGroupList = () => getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource-group/list`) + +// 资源管理 -- 根据appId查询资源分组列表 +export const fetchResourceGroupByAppId = () => + getMetaApi(META_SERVICE.Http).get( + `${baseUrl}/resource-group/${getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id}` + ) + +// 资源管理 -- 创建资源分组 +export const createResourceGroup = (params: any) => + getMetaApi(META_SERVICE.Http).post(`${baseUrl}/resource-group/create`, { + appId: getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id, + platformId: getMergeMeta('engine.config')?.platformId, + ...params + }) + +// 资源管理 -- 修改资源分组信息-包括删除 +export const updateResourceGroup = (id: number, params: any) => + getMetaApi(META_SERVICE.Http).put(`${baseUrl}/resource-group/update/${id}`, params) + +// 资源管理 -- 查询资源分组详情 +export const fetchResourceGroupDetail = (id: number) => + getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource-group/detail/${id}`) + +// 资源管理 -- 删除资源分组 +export const deleteResourceGroup = (id: number) => + getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource-group/delete/${id}`) diff --git a/packages/plugins/resource/src/styles/vars.less b/packages/plugins/resource/src/styles/vars.less new file mode 100644 index 0000000000..728bf9fe61 --- /dev/null +++ b/packages/plugins/resource/src/styles/vars.less @@ -0,0 +1,20 @@ +.plugin-resource { + --te-resource-manage-title-text-color: var(--te-common-text-primary); + --te-resource-manage-input-bg-color: var(--te-common-bg-default); + --te-resource-manage-input-border-color: var(--te-common-border-default); + --te-resource-manage-tip-color: var(--te-common-text-primary); + --te-resource-manage-tip-text-color: var(--te-common-text-weaken); + --te-resource-manage-tip-dim-text-color: var(--te-common-text-primary); + --te-resource-manage-tree-text-bg-color: var(--te-common-bg-default); + --te-resource-manage-tree-node-bg-color: var(--te-common-bg-default); + --te-resource-manage-tree-node-bg-color-hover: var(--te-common-bg-container); + --te-resource-manage-text-color: var(--te-common-text-secondary); + --te-resource-manage-input-head-text-color: var(--te-common-text-primary); + --te-resource-manage-input-or-output-text-color: var(--te-common-text-secondary); + --te-resource-manage-life-cycle-alert-text-color: var(--te-common-text-weaken); + --te-resource-manage-icon-color: var(--te-common-icon-secondary); + --te-resource-manage-draggable-row-bg-color-hover: var(--te-common-bg-container); + --te-resource-manage-draggable-text-color: var(--te-common-text-primary); + --te-resource-manage-draggable-icon-color: var(--te-common-icon-secondary); + --te-resource-manage-draggable-border-color: var(--te-common-border-checked); +} diff --git a/packages/plugins/resource/vite.config.ts b/packages/plugins/resource/vite.config.ts new file mode 100644 index 0000000000..189223d9b0 --- /dev/null +++ b/packages/plugins/resource/vite.config.ts @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import { defineConfig } from 'vite' +import path from 'path' +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' +import generateComment from '@opentiny/tiny-engine-vite-plugin-meta-comments' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [generateComment(), vue(), vueJsx()], + publicDir: false, + resolve: {}, + build: { + sourcemap: true, + lib: { + entry: path.resolve(__dirname, './index.ts'), + name: 'plugin-resource', + fileName: (_format, entryName) => `${entryName}.js`, + formats: ['es'] + }, + rollupOptions: { + output: { + banner: 'import "./style.css"' + }, + external: ['vue', /@opentiny\/tiny-engine.*/, /@opentiny\/vue.*/] + } + } +}) diff --git a/packages/plugins/robot/src/RobotSettingPopover.vue b/packages/plugins/robot/src/RobotSettingPopover.vue index a5947ccc16..bcb3ec32cd 100644 --- a/packages/plugins/robot/src/RobotSettingPopover.vue +++ b/packages/plugins/robot/src/RobotSettingPopover.vue @@ -5,12 +5,20 @@ - + - + - + @@ -65,6 +85,7 @@