Skip to content

Commit a238b90

Browse files
authored
Merge pull request #4 from WeDataSphere/fix-api-service
Fix api-service
2 parents 2df7a7e + 67cecf3 commit a238b90

File tree

8 files changed

+1419
-0
lines changed

8 files changed

+1419
-0
lines changed

web/config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@
5858
}
5959
},
6060
"exts": {
61+
"dss-plugin-open": {
62+
"module": "exts/open-source/index.js",
63+
"i18n": {
64+
"en": "exts/open-source/i18n/en.json",
65+
"zh-CN": "exts/open-source/i18n/zh.json"
66+
},
67+
"options": null
68+
}
6169
},
6270
"conf": {
6371
"app_name": "DataSphere Studio",
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"message": {
3+
"scripts": {
4+
"apiPublish": {
5+
"title": "PublishAPI",
6+
"button": {
7+
"addApi": "API Add",
8+
"updateApi": "API Update"
9+
},
10+
"addApiModal": {
11+
"modalTitle": "Add API",
12+
"contentTitle": "Base Info",
13+
"paramConfirmTitle": "Params Confirm",
14+
"apiName": "API Name",
15+
"apiPath": "API Path",
16+
"protocol": "Protocol",
17+
"requestType": "Request Type",
18+
"tag": "Tag",
19+
"visible": "Visible",
20+
"describe": "Describe",
21+
"nextStep": "Next",
22+
"back": "Back",
23+
"cancel": "Cancel",
24+
"approvalName": "Approval Name",
25+
"applyUser": "Apply User",
26+
"proxyUser": "Proxy User",
27+
"confirm": "Confirm",
28+
"comment": "Comment"
29+
},
30+
"updateApiModal": {
31+
"modalTitle": "Update API",
32+
"apiVersionUpgrade": "New Version",
33+
"paramConfirm": "Please confirm param"
34+
},
35+
"paramTable": {
36+
"paramName": "Param Name",
37+
"paramType": "Param Type",
38+
"require": {
39+
"title": "Require",
40+
"yes": "Yes",
41+
"no": "No",
42+
"hide": "Hide"
43+
},
44+
"defaultValue": "Default Value",
45+
"displayName": "Display Name",
46+
"describe": "Describe"
47+
},
48+
"rule": {
49+
"nameRule": "Please input api name!",
50+
"approvalName": "Please input name!",
51+
"pathRule": "Please input api path!",
52+
"pathRegRule": "Api path illegal!",
53+
"requestTypeRule": "Please select request type!",
54+
"protocolRule": "Please select protocol!",
55+
"valueRule": "Started with alphabetic characters, only alphanumeric and underscore are allowed!",
56+
"contentLengthLimit": "Length limit 155",
57+
"contentLengthLimit50": "Length limit 50",
58+
"contentLengthLimitTwo": "Length limit 200",
59+
"pathRepeat": "Api path exists",
60+
"nameRepeat": "Api name exists",
61+
"chineseCheck": "Chainese only",
62+
"chineseName": "Chinese name of API"
63+
},
64+
"visible": {
65+
"workspace": "Workspace",
66+
"personal": "Personal",
67+
"public": "Public",
68+
"grantView": "Grant View"
69+
},
70+
"notice": {
71+
"publishSuccess": "Publish Success"
72+
},
73+
"tagPlaceholder": "tag,click enter add"
74+
}
75+
}
76+
}
77+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"message": {
3+
"scripts": {
4+
"apiPublish": {
5+
"title": "发布为数据API",
6+
"button": {
7+
"addApi": "新建数据API",
8+
"updateApi": "更新数据API"
9+
},
10+
"addApiModal": {
11+
"modalTitle": "数据服务API新增",
12+
"contentTitle": "基本信息补充",
13+
"paramConfirmTitle": "参数确认",
14+
"apiName": "API 名称",
15+
"apiPath": "API Path",
16+
"protocol": "协议",
17+
"requestType": "请求方式",
18+
"tag": "标签",
19+
"visible": "可见范围",
20+
"describe": "描述",
21+
"cancel": "取消",
22+
"nextStep": "下一步",
23+
"approvalName": "审批单名称",
24+
"applyUser": "申请用户",
25+
"proxyUser": "代理执行用户",
26+
"back": "上一步",
27+
"confirm": "确认",
28+
"comment": "备注"
29+
},
30+
"updateApiModal": {
31+
"modalTitle": "数据服务API更新",
32+
"apiVersionUpgrade": "生成新版本",
33+
"paramConfirm": "请确认参数"
34+
},
35+
"paramTable": {
36+
"paramName": "参数名称",
37+
"paramType": "参数类型",
38+
"require": {
39+
"title": "是否必填",
40+
"yes": "",
41+
"no": "",
42+
"hide": "隐藏"
43+
},
44+
"defaultValue": "默认值",
45+
"displayName": "展示名",
46+
"describe": "描述"
47+
},
48+
"rule": {
49+
"nameRule": "请填写API名称",
50+
"approvalName": "请填写名称",
51+
"pathRule": "请填写API路径",
52+
"pathRegRule": "API路径不合法",
53+
"requestTypeRule": "请选择请求方式",
54+
"protocolRule": "请选择协议",
55+
"valueRule": "必须以字母开头,且只支持字母、数字、下划线!",
56+
"contentLengthLimit": "长度不能大于150",
57+
"contentLengthLimit50": "长度不能大于50",
58+
"contentLengthLimitTwo": "长度不能大于200",
59+
"pathRepeat": "API路径已存在",
60+
"nameRepeat": "API名称已存在",
61+
"chineseCheck": "只支持中文",
62+
"chineseName": "API中文名称"
63+
},
64+
"visible": {
65+
"workspace": "工作空间",
66+
"personal": "个人",
67+
"public": "公开",
68+
"grantView": "授权可见"
69+
},
70+
"notice": {
71+
"publishSuccess": "发布成功"
72+
},
73+
"tagPlaceholder": "标签,按 enter 创建"
74+
}
75+
}
76+
}
77+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import ApiPublish from './scriptis/apiPublish/index.vue'
2+
3+
/**
4+
* 插件绑定
5+
*/
6+
export default function () {
7+
// // 插件通过on方法绑定事件,响应应用通过plugin.emit触发的事件
8+
// this.on('event-app', function(arg) {
9+
// console.log('event from app', arg)
10+
// })
11+
// 插件钩子type: component, 提供组件
12+
13+
// 发布数据服务API
14+
this.bindHook('script_editor_top_tools', function () {
15+
return {
16+
name: 'ApiPublish',
17+
component: ApiPublish
18+
}
19+
})
20+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@import '@dataspherestudio/shared/common/style/variables.scss';
2+
.tags-wrap{
3+
width: 100%;
4+
height: 100%;
5+
outline: none;
6+
&::after{
7+
content: "";
8+
display: block;
9+
height: 0;
10+
clear: both;
11+
}
12+
}
13+
.tags, .tags-input{
14+
position: relative;
15+
float: left;
16+
color: #fff;
17+
line-height: 28px;
18+
margin: 0 4px 4px 0;
19+
padding: 0 22px 0 10px;
20+
border-radius: $border-radius-base;
21+
.content{
22+
line-height: 28px;
23+
}
24+
.del{
25+
width: 22px;
26+
height: 28px;
27+
text-align: center;
28+
cursor: pointer;
29+
position: absolute;
30+
top: -1px;
31+
right: 0;
32+
}
33+
}
34+
.tags-input{
35+
background-color: inherit;
36+
border: $border-width-base $border-style-base $border-color-base;
37+
color: inherit;
38+
width: auto !important;
39+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<template>
2+
<div class="input tags-wrap">
3+
<div class="tags" transition="tags" v-bind:style="{backgroundColor: bgc[item.bgc_no]}" :key="index" v-for="(item, index) in dis_source">
4+
<span class="content">{{item.text}}</span>
5+
<span class="del" @click="del(index, false)">&times;</span>
6+
</div>
7+
<input class="tags-input ivu-input ivu-input-default" type="text" :placeholder="placeholder" v-model="text" @keyup.enter="add(text)" @keydown.delete="del(source.length - 1, true)">
8+
</div>
9+
</template>
10+
11+
<script>
12+
export default {
13+
props: {
14+
source: {
15+
type: Array
16+
},
17+
placeholder: {
18+
type: String,
19+
default: '标签,按 enter 创建'
20+
}
21+
},
22+
watch: {
23+
'source'(val) {
24+
if (0 == val.length) {
25+
this.dis_source = []
26+
}
27+
}
28+
},
29+
data() {
30+
var dis_source = []
31+
this.source.forEach(function (item) {
32+
var obj = {
33+
text: item,
34+
bgc_no: Math.ceil(Math.random() * 10) - 1
35+
}
36+
dis_source.push(obj)
37+
})
38+
return {
39+
text: '',
40+
bgc: ['#e961b4', '#ed664b', '#7b6ac7', '#56abd1', '#f7af4c', '#fe5467', '#52c7bd', '#a479b7', '#cb81ce', '#5eabc5'],
41+
dis_source: dis_source
42+
}
43+
},
44+
methods: {
45+
add(text) {
46+
if(text != ''){
47+
if (this.judgeRepeat(text)) {
48+
this.text = ''
49+
return;
50+
}
51+
var count = this.source.length
52+
this.$set(this.source, count, text)
53+
this.$set(this.dis_source, count, {
54+
text: text,
55+
bgc_no: this.dis_source.length % this.bgc.length
56+
})
57+
this.text = ''
58+
}
59+
},
60+
del(index, way){
61+
if(way){
62+
if(index >=0 && this.text == ''){
63+
this.source.splice(index, 1)
64+
this.dis_source.splice(index, 1)
65+
}
66+
}else {
67+
this.source.splice(index, 1)
68+
this.dis_source.splice(index, 1)
69+
}
70+
},
71+
judgeRepeat(text) {
72+
var repeatFlag = false;
73+
this.dis_source.forEach((item) => {
74+
if (item.text === text) {
75+
repeatFlag = true;
76+
return true;
77+
}
78+
})
79+
return repeatFlag;
80+
}
81+
}
82+
}
83+
</script>
84+
85+
<style lang="scss" src="./index.scss" />
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@import "@dataspherestudio/shared/common/style/variables.scss";
2+
.api-module-title{
3+
font-size: $font-size-base;
4+
color: $title-color;
5+
}
6+
.verificationValue {
7+
.ivu-input {
8+
color: red!important;
9+
border-color: red;
10+
}
11+
}
12+
.api-module-content-title{
13+
font-size: $font-size-small;
14+
color: $title-color;
15+
text-align: center;
16+
}
17+
18+
.workbench-body-navbar-item {
19+
margin: 0 16px;
20+
cursor: pointer;
21+
color: rgba($text-color, 0.8);
22+
&.disabled {
23+
color: rgba($text-color, 0.5);
24+
}
25+
&:hover {
26+
color: $link-active-color;
27+
&.disabled {
28+
color: rgba($text-color, 0.5);
29+
}
30+
}
31+
.ivu-icon {
32+
font-size: 16px;
33+
}
34+
.navbar-item-name {
35+
margin-left: 1px;
36+
}
37+
}

0 commit comments

Comments
 (0)