Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
app-manage-console
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
ReactNative
app-manage-console
Commits
cb61ac5d
提交
cb61ac5d
authored
10月 17, 2018
作者:
vipcxj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add: 数据源批处理和特性支持查询api
上级
fd33936f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
71 行增加
和
37 行删除
+71
-37
datasource.js
src/services/datasource.js
+71
-37
没有找到文件。
src/services/datasource.js
浏览文件 @
cb61ac5d
...
...
@@ -25,9 +25,11 @@ export const datasourceApi = (coordinate) => {
remove
:
partial
(
removeGlobalDatasource
,
[
datasourceName
]),
removeMeta
:
partial
(
removeGlobalDatasourceMeta
,
[
datasourceName
]),
meta
:
partial
(
getGlobalDatasourceMeta
,
[
datasourceName
]),
validateUpdate
:
partial
(
validateUpdateGlobalDatasource
,
datasourceName
),
validateCreate
:
partial
(
validateCreateGlobalDatasource
,
datasourceName
),
validateRemove
:
partial
(
validateRemoveGlobalDatasource
,
datasourceName
),
validateUpdate
:
partial
(
validateUpdateGlobalDatasource
,
[
datasourceName
]),
validateCreate
:
partial
(
validateCreateGlobalDatasource
,
[
datasourceName
]),
validateRemove
:
partial
(
validateRemoveGlobalDatasource
,
[
datasourceName
]),
feature
:
partial
(
getGlobalDatasourceFeature
,
[
datasourceName
]),
invoke
:
partial
(
invokeGlobalDatasource
,
[
datasourceName
]),
};
}
else
if
(
containerType
===
'module'
)
{
return
{
...
...
@@ -47,6 +49,8 @@ export const datasourceApi = (coordinate) => {
validateUpdate
:
partial
(
validateUpdateModuleDatasource
,
[
containerName
,
datasourceName
]),
validateCreate
:
partial
(
validateCreateModuleDatasource
,
[
containerName
,
datasourceName
]),
validateRemove
:
partial
(
validateRemoveModuleDatasource
,
[
containerName
,
datasourceName
]),
feature
:
partial
(
getModuleDatasourceFeature
,
[
containerName
,
datasourceName
]),
invoke
:
partial
(
invokeModuleDatasource
,
[
containerName
,
datasourceName
]),
};
}
else
{
throw
new
Error
(
`Unsupported containerType:
${
containerType
}
`
);
...
...
@@ -54,35 +58,35 @@ export const datasourceApi = (coordinate) => {
};
export
async
function
calcGlobalDatasource
(
name
,
{
pst
,
psz
,
filters
=
[],
sortBys
=
[],
sortTypes
=
[],
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
`
,
makeParams
({
pst
,
psz
,
dmPath
},
{
filters
,
sortBys
,
sortTypes
,
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
`
,
makeParams
({
pst
,
psz
,
dmPath
},
{
filters
,
sortBys
,
sortTypes
,
params
}));
}
export
async
function
calcGlobalDatasourceMeta
(
name
,
{
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/meta/query`
,
makeParams
({
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/meta/query`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
countGlobalDatasource
(
name
,
{
filters
=
[],
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/count`
,
makeParams
({
dmPath
},
{
filters
,
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/count`
,
makeParams
({
dmPath
},
{
filters
,
params
}));
}
export
async
function
countGlobalDatasourceMeta
(
name
,
{
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/meta/count`
,
makeParams
({
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/meta/count`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
cursorGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
cursorGlobalDatasourceMeta
(
name
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/meta/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/meta/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
validateUpdateGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/update/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/update/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
updateGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/update`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/update`
,
{
key
,
params
,
dmPath
,
...
...
@@ -90,7 +94,7 @@ export async function updateGlobalDatasource(name, key, params = {}, dmPath) {
}
export
async
function
updateGlobalDatasourceMeta
(
name
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/meta/update`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/meta/update`
,
{
key
,
params
,
dmPath
,
...
...
@@ -98,29 +102,29 @@ export async function updateGlobalDatasourceMeta(name, key, params = {}, dmPath)
}
export
async
function
validateCreateGlobalDatasource
(
name
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/create/validate`
,
makeParams
({
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/create/validate`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
createGlobalDatasource
(
name
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/create`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/create`
,
{
params
,
dmPath
,
});
}
export
async
function
createGlobalDatasourceMeta
(
name
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/meta/create`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/meta/create`
,
{
params
,
dmPath
,
});
}
export
async
function
validateRemoveGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/remove/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/remove/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
removeGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/remove`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/remove`
,
{
key
,
params
,
dmPath
,
...
...
@@ -128,47 +132,58 @@ export async function removeGlobalDatasource(name, key, params = {}, dmPath) {
}
export
async
function
removeGlobalDatasourceMeta
(
name
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/meta/remove`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/
user/
${
encodeURIComponent
(
name
)
}
/meta/remove`
,
{
key
,
params
,
dmPath
,
});
}
export
async
function
getGlobalDatasourceMeta
(
name
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/
${
name
}
/meta`
);
export
async
function
getGlobalDatasourceMeta
(
name
,
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/user/
${
encodeURIComponent
(
name
)}
/meta`
,
makeParams
({
dmPath
},
{}));
}
export
async
function
getGlobalDatasourceFeature
(
name
,
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/datasource/user/
${
encodeURIComponent
(
name
)}
/feature`
,
makeParams
({
dmPath
},
{}));
}
export
async
function
invokeGlobalDatasource
(
dsName
,
opName
,
params
=
{},
dmPath
,
{
pst
,
psz
,
filters
=
[],
includeKeys
,
excludeKeys
,
termWhenFail
=
true
})
{
return
post
(
`
${
config
.
apiContextPath
}
/api/datasource/user/
${
encodeURIComponent
(
dsName
)}
/operation/
${
encodeURIComponent
(
opName
)}
/invoke`
,
{
includeKeys
,
excludeKeys
,
},
makeParams
({
twf
:
termWhenFail
?
1
:
0
,
pst
,
psz
},
{
filters
,
params
}));
}
export
async
function
calcModuleDatasource
(
mdName
,
dsName
,
{
pst
,
psz
,
filters
=
[],
sortBys
=
[],
sortTypes
=
[],
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
`
,
makeParams
({
pst
,
psz
,
dmPath
},
{
filters
,
sortBys
,
sortTypes
,
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
`
,
makeParams
({
pst
,
psz
,
dmPath
},
{
filters
,
sortBys
,
sortTypes
,
params
}));
}
export
async
function
calcModuleDatasourceMeta
(
mdName
,
dsName
,
{
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/meta/query`
,
makeParams
({
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/meta/query`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
countModuleDatasource
(
mdName
,
dsName
,
{
filters
=
[],
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/count`
,
makeParams
({
dmPath
},
{
filters
,
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/count`
,
makeParams
({
dmPath
},
{
filters
,
params
}));
}
export
async
function
countModuleDatasourceMeta
(
mdName
,
dsName
,
{
params
=
{},
dmPath
})
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/meta/count`
,
makeParams
({
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/meta/count`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
cursorModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
cursorModuleDatasourceMeta
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/meta/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/meta/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
validateUpdateModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/update/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/update/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
updateModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/update`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/update`
,
{
key
,
params
,
dmPath
,
...
...
@@ -176,7 +191,7 @@ export async function updateModuleDatasource(mdName, dsName, key, params = {}, d
}
export
async
function
updateModuleDatasourceMeta
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/meta/update`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/meta/update`
,
{
key
,
params
,
dmPath
,
...
...
@@ -184,29 +199,29 @@ export async function updateModuleDatasourceMeta(mdName, dsName, key, params = {
}
export
async
function
validateCreateModuleDatasource
(
mdName
,
dsName
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/create/validate`
,
makeParams
({
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/create/validate`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
createModuleDatasource
(
mdName
,
dsName
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/create`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/create`
,
{
params
,
dmPath
,
});
}
export
async
function
createModuleDatasourceMeta
(
mdName
,
dsName
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/meta/create`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/meta/create`
,
{
params
,
dmPath
,
});
}
export
async
function
validateRemoveModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/remove/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/remove/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
removeModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/remove`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/remove`
,
{
key
,
params
,
dmPath
,
...
...
@@ -214,15 +229,26 @@ export async function removeModuleDatasource(mdName, dsName, key, params = {}, d
}
export
async
function
removeModuleDatasourceMeta
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/meta/remove`
,
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)
}
/meta/remove`
,
{
key
,
params
,
dmPath
,
});
}
export
async
function
getModuleDatasourceMeta
(
mdName
,
dsName
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/meta`
);
export
async
function
getModuleDatasourceMeta
(
mdName
,
dsName
,
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)}
/meta`
,
makeParams
({
dmPath
},
{}));
}
export
async
function
getModuleDatasourceFeature
(
mdName
,
dsName
,
dmPath
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)}
/feature`
,
makeParams
({
dmPath
},
{}));
}
export
async
function
invokeModuleDatasource
(
mdName
,
dsName
,
opName
,
params
=
{},
dmPath
,
{
pst
,
psz
,
filters
=
[],
includeKeys
,
excludeKeys
,
termWhenFail
=
true
})
{
return
post
(
`
${
config
.
apiContextPath
}
/api/module/user/
${
encodeURIComponent
(
mdName
)}
/datasource/
${
encodeURIComponent
(
dsName
)}
/operation/
${
encodeURIComponent
(
opName
)}
/invoke`
,
{
includeKeys
,
excludeKeys
,
},
makeParams
({
twf
:
termWhenFail
?
1
:
0
,
pst
,
psz
},
{
filters
,
params
}));
}
export
class
Datasource
{
...
...
@@ -314,4 +340,12 @@ export class Datasource {
const
dmPath
=
await
this
.
dealWithPath
();
return
this
.
api
.
validateRemove
(
key
,
params
,
dmPath
);
}
async
feature
()
{
const
dmPath
=
await
this
.
dealWithPath
();
return
this
.
api
.
feature
(
dmPath
);
}
async
invoke
(
name
,
params
=
{},
{
pst
,
psz
,
filters
=
[],
includeKeys
,
excludeKeys
,
termWhenFail
=
true
})
{
const
dmPath
=
await
this
.
dealWithPath
();
return
this
.
api
.
invoke
(
name
,
params
,
dmPath
,
{
pst
,
psz
,
filters
,
includeKeys
,
excludeKeys
,
termWhenFail
});
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论