diff --git a/web/config.json b/web/config.json index ac5707fbec..f5974b96f6 100644 --- a/web/config.json +++ b/web/config.json @@ -58,6 +58,14 @@ } }, "exts": { + "dss-plugin-open": { + "module": "exts/open-source/index.js", + "i18n": { + "en": "exts/open-source/i18n/en.json", + "zh-CN": "exts/open-source/i18n/zh.json" + }, + "options": null + } }, "conf": { "app_name": "DataSphere Studio", diff --git a/web/packages/exts/open-source/i18n/en.json b/web/packages/exts/open-source/i18n/en.json new file mode 100644 index 0000000000..c304e8793e --- /dev/null +++ b/web/packages/exts/open-source/i18n/en.json @@ -0,0 +1,77 @@ +{ + "message": { + "scripts": { + "apiPublish": { + "title": "PublishAPI", + "button": { + "addApi": "API Add", + "updateApi": "API Update" + }, + "addApiModal": { + "modalTitle": "Add API", + "contentTitle": "Base Info", + "paramConfirmTitle": "Params Confirm", + "apiName": "API Name", + "apiPath": "API Path", + "protocol": "Protocol", + "requestType": "Request Type", + "tag": "Tag", + "visible": "Visible", + "describe": "Describe", + "nextStep": "Next", + "back": "Back", + "cancel": "Cancel", + "approvalName": "Approval Name", + "applyUser": "Apply User", + "proxyUser": "Proxy User", + "confirm": "Confirm", + "comment": "Comment" + }, + "updateApiModal": { + "modalTitle": "Update API", + "apiVersionUpgrade": "New Version", + "paramConfirm": "Please confirm param" + }, + "paramTable": { + "paramName": "Param Name", + "paramType": "Param Type", + "require": { + "title": "Require", + "yes": "Yes", + "no": "No", + "hide": "Hide" + }, + "defaultValue": "Default Value", + "displayName": "Display Name", + "describe": "Describe" + }, + "rule": { + "nameRule": "Please input api name!", + "approvalName": "Please input name!", + "pathRule": "Please input api path!", + "pathRegRule": "Api path illegal!", + "requestTypeRule": "Please select request type!", + "protocolRule": "Please select protocol!", + "valueRule": "Started with alphabetic characters, only alphanumeric and underscore are allowed!", + "contentLengthLimit": "Length limit 155", + "contentLengthLimit50": "Length limit 50", + "contentLengthLimitTwo": "Length limit 200", + "pathRepeat": "Api path exists", + "nameRepeat": "Api name exists", + "chineseCheck": "Chainese only", + "chineseName": "Chinese name of API" + }, + "visible": { + "workspace": "Workspace", + "personal": "Personal", + "public": "Public", + "grantView": "Grant View" + }, + "notice": { + "publishSuccess": "Publish Success" + }, + "tagPlaceholder": "tag,click enter add" + } + } + } +} diff --git a/web/packages/exts/open-source/i18n/zh.json b/web/packages/exts/open-source/i18n/zh.json new file mode 100644 index 0000000000..8d2fc7f259 --- /dev/null +++ b/web/packages/exts/open-source/i18n/zh.json @@ -0,0 +1,77 @@ +{ + "message": { + "scripts": { + "apiPublish": { + "title": "发布为数据API", + "button": { + "addApi": "新建数据API", + "updateApi": "更新数据API" + }, + "addApiModal": { + "modalTitle": "数据服务API新增", + "contentTitle": "基本信息补充", + "paramConfirmTitle": "参数确认", + "apiName": "API 名称", + "apiPath": "API Path", + "protocol": "协议", + "requestType": "请求方式", + "tag": "标签", + "visible": "可见范围", + "describe": "描述", + "cancel": "取消", + "nextStep": "下一步", + "approvalName": "审批单名称", + "applyUser": "申请用户", + "proxyUser": "代理执行用户", + "back": "上一步", + "confirm": "确认", + "comment": "备注" + }, + "updateApiModal": { + "modalTitle": "数据服务API更新", + "apiVersionUpgrade": "生成新版本", + "paramConfirm": "请确认参数" + }, + "paramTable": { + "paramName": "参数名称", + "paramType": "参数类型", + "require": { + "title": "是否必填", + "yes": "是", + "no": "否", + "hide": "隐藏" + }, + "defaultValue": "默认值", + "displayName": "展示名", + "describe": "描述" + }, + "rule": { + "nameRule": "请填写API名称", + "approvalName": "请填写名称", + "pathRule": "请填写API路径", + "pathRegRule": "API路径不合法", + "requestTypeRule": "请选择请求方式", + "protocolRule": "请选择协议", + "valueRule": "必须以字母开头,且只支持字母、数字、下划线!", + "contentLengthLimit": "长度不能大于150", + "contentLengthLimit50": "长度不能大于50", + "contentLengthLimitTwo": "长度不能大于200", + "pathRepeat": "API路径已存在", + "nameRepeat": "API名称已存在", + "chineseCheck": "只支持中文", + "chineseName": "API中文名称" + }, + "visible": { + "workspace": "工作空间", + "personal": "个人", + "public": "公开", + "grantView": "授权可见" + }, + "notice": { + "publishSuccess": "发布成功" + }, + "tagPlaceholder": "标签,按 enter 创建" + } + } + } +} diff --git a/web/packages/exts/open-source/index.js b/web/packages/exts/open-source/index.js new file mode 100644 index 0000000000..5576ee7ff7 --- /dev/null +++ b/web/packages/exts/open-source/index.js @@ -0,0 +1,20 @@ +import ApiPublish from './scriptis/apiPublish/index.vue' + +/** + * 插件绑定 + */ +export default function () { + // // 插件通过on方法绑定事件,响应应用通过plugin.emit触发的事件 + // this.on('event-app', function(arg) { + // console.log('event from app', arg) + // }) + // 插件钩子type: component, 提供组件 + + // 发布数据服务API + this.bindHook('script_editor_top_tools', function () { + return { + name: 'ApiPublish', + component: ApiPublish + } + }) +} diff --git a/web/packages/exts/open-source/scriptis/apiPublish/TagsInput/index.scss b/web/packages/exts/open-source/scriptis/apiPublish/TagsInput/index.scss new file mode 100644 index 0000000000..b237163177 --- /dev/null +++ b/web/packages/exts/open-source/scriptis/apiPublish/TagsInput/index.scss @@ -0,0 +1,39 @@ +@import '@dataspherestudio/shared/common/style/variables.scss'; +.tags-wrap{ + width: 100%; + height: 100%; + outline: none; + &::after{ + content: ""; + display: block; + height: 0; + clear: both; + } +} +.tags, .tags-input{ + position: relative; + float: left; + color: #fff; + line-height: 28px; + margin: 0 4px 4px 0; + padding: 0 22px 0 10px; + border-radius: $border-radius-base; + .content{ + line-height: 28px; + } + .del{ + width: 22px; + height: 28px; + text-align: center; + cursor: pointer; + position: absolute; + top: -1px; + right: 0; + } +} +.tags-input{ + background-color: inherit; + border: $border-width-base $border-style-base $border-color-base; + color: inherit; + width: auto !important; +} diff --git a/web/packages/exts/open-source/scriptis/apiPublish/TagsInput/index.vue b/web/packages/exts/open-source/scriptis/apiPublish/TagsInput/index.vue new file mode 100644 index 0000000000..9d28fb2390 --- /dev/null +++ b/web/packages/exts/open-source/scriptis/apiPublish/TagsInput/index.vue @@ -0,0 +1,85 @@ + + + + +