Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
app-manage-console
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
ReactNative
app-manage-console
Commits
6c62d63f
提交
6c62d63f
authored
9月 26, 2017
作者:
vipcxj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add: 新增数据源validate和cursor接口,所有接口添加dmPath参数
上级
c3554780
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
68 行增加
和
17 行删除
+68
-17
datasource.js
src/services/datasource.js
+68
-17
没有找到文件。
src/services/datasource.js
浏览文件 @
6c62d63f
...
...
@@ -18,19 +18,27 @@ export const datasourceApi = (coordinate) => {
return
{
query
:
partial
(
calcGlobalDatasource
,
datasourceName
),
count
:
partial
(
countGlobalDatasource
,
datasourceName
),
cursor
:
partial
(
cursorGlobalDatasource
,
datasourceName
),
meta
:
partial
(
getGlobalDatasourceMeta
,
datasourceName
),
update
:
partial
(
updateGlobalDatasource
,
datasourceName
),
create
:
partial
(
createGlobalDatasource
,
datasourceName
),
remove
:
partial
(
removeGlobalDatasource
,
datasourceName
),
validateUpdate
:
partial
(
validateUpdateGlobalDatasource
,
datasourceName
),
validateCreate
:
partial
(
validateCreateGlobalDatasource
,
datasourceName
),
validateRemove
:
partial
(
validateRemoveGlobalDatasource
,
datasourceName
),
};
}
else
if
(
containerType
===
'module'
)
{
return
{
query
:
partial
(
calcModuleDatasource
,
containerName
,
datasourceName
),
count
:
partial
(
countModuleDatasource
,
containerName
,
datasourceName
),
cursor
:
partial
(
cursorModuleDatasource
,
containerName
,
datasourceName
),
meta
:
partial
(
getModuleDatasourceMeta
,
containerName
,
datasourceName
),
update
:
partial
(
updateModuleDatasource
,
containerName
,
datasourceName
),
create
:
partial
(
createModuleDatasource
,
containerName
,
datasourceName
),
remove
:
partial
(
removeModuleDatasource
,
containerName
,
datasourceName
),
validateUpdate
:
partial
(
validateUpdateModuleDatasource
,
containerName
,
datasourceName
),
validateCreate
:
partial
(
validateCreateModuleDatasource
,
containerName
,
datasourceName
),
validateRemove
:
partial
(
validateRemoveModuleDatasource
,
containerName
,
datasourceName
),
};
}
else
{
throw
new
Error
(
`Unsupported containerType:
${
containerType
}
`
);
...
...
@@ -43,39 +51,63 @@ const makeQueryParams = ({ pst, psz, filters = [], sortBys = [], sortTypes = [],
let
stType
=
sortTypes
.
join
(
','
);
stType
=
stType
||
undefined
;
return
[
...
toPairs
({
pst
,
psz
}),
...
toPairs
({
pst
,
psz
,
stBy
,
stType
}),
...
parseFilters
(
filters
),
[
'stBy'
,
stBy
],
[
'stType'
,
stType
],
...
normParams
(
mapKeys
(
params
,
(
v
,
k
)
=>
`p-
${
k
}
`
)),
].
filter
(
v
=>
v
&&
!
isUndefined
((
v
[
1
])));
};
export
async
function
calcGlobalDatasource
(
name
,
{
pst
,
psz
,
filters
=
[],
sortBys
=
[],
sortTypes
=
[],
params
=
{}
})
{
return
request
(
`/api/datasource/
${
name
}
`
,
makeQueryParams
({
pst
,
psz
,
filters
,
sortBys
,
sortTypes
,
params
}));
const
makeParams
=
(
params
,
{
filters
=
[],
sortBys
=
[],
sortTypes
=
[],
qParams
=
{}
})
=>
{
return
[
...
toPairs
(
params
),
...
makeQueryParams
({
filters
,
sortBys
,
sortTypes
,
qParams
}),
];
};
export
async
function
calcGlobalDatasource
(
name
,
{
pst
,
psz
,
filters
=
[],
sortBys
=
[],
sortTypes
=
[],
params
=
{},
dmPath
})
{
return
request
(
`/api/datasource/
${
name
}
`
,
makeParams
({
pst
,
psz
,
dmPath
},
{
filters
,
sortBys
,
sortTypes
,
params
}));
}
export
async
function
countGlobalDatasource
(
name
,
{
filters
=
[],
params
=
{},
dmPath
})
{
return
request
(
`/api/datasource/
${
name
}
/count`
,
makeParams
({
dmPath
},
{
filters
,
params
}));
}
export
async
function
c
ountGlobalDatasource
(
name
,
{
filters
=
[],
params
=
{}
}
)
{
return
request
(
`/api/datasource/
${
name
}
/c
ount`
,
makeQueryParams
({
filters
,
params
}));
export
async
function
c
ursorGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`/api/datasource/
${
name
}
/c
ursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
updateGlobalDatasource
(
name
,
key
,
params
=
{})
{
export
async
function
validateUpdateGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`/api/datasource/
${
name
}
/update/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
updateGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`/api/datasource/
${
name
}
/update`
,
{
key
,
params
,
dmPath
,
});
}
export
async
function
createGlobalDatasource
(
name
,
params
=
{})
{
export
async
function
validateCreateGlobalDatasource
(
name
,
params
=
{},
dmPath
)
{
return
request
(
`/api/datasource/
${
name
}
/create/validate`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
createGlobalDatasource
(
name
,
params
=
{},
dmPath
)
{
return
post
(
`/api/datasource/
${
name
}
/create`
,
{
params
,
dmPath
,
});
}
export
async
function
removeGlobalDatasource
(
name
,
key
,
params
=
{})
{
export
async
function
validateRemoveGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`/api/datasource/
${
name
}
/remove/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
removeGlobalDatasource
(
name
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`/api/datasource/
${
name
}
/remove`
,
{
key
,
params
,
dmPath
,
});
}
...
...
@@ -83,31 +115,50 @@ export async function getGlobalDatasourceMeta(name) {
return
request
(
`/api/datasource/
${
name
}
/meta`
);
}
export
async
function
calcModuleDatasource
(
mdName
,
dsName
,
{
pst
,
psz
,
filters
=
[],
sortBys
=
[],
sortTypes
=
[],
params
=
{}
})
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
`
,
makeQueryParams
({
pst
,
psz
,
filters
,
sortBys
,
sortTypes
,
params
}));
export
async
function
calcModuleDatasource
(
mdName
,
dsName
,
{
pst
,
psz
,
filters
=
[],
sortBys
=
[],
sortTypes
=
[],
params
=
{},
dmPath
})
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
`
,
makeParams
({
pst
,
psz
,
dmPath
},
{
filters
,
sortBys
,
sortTypes
,
params
}));
}
export
async
function
countModuleDatasource
(
mdName
,
dsName
,
{
filters
=
[],
params
=
{},
dmPath
})
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/count`
,
makeParams
({
dmPath
},
{
filters
,
params
}));
}
export
async
function
cursorModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/cursor`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
countModuleDatasource
(
mdName
,
dsName
,
{
filters
=
[],
params
=
{}
}
)
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/
count`
,
makeQueryParams
({
filters
,
params
}));
export
async
function
validateUpdateModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/
update/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
updateModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{})
{
export
async
function
updateModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{}
,
dmPath
)
{
return
post
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/update`
,
{
key
,
params
,
dmPath
,
});
}
export
async
function
createModuleDatasource
(
mdName
,
dsName
,
params
=
{})
{
export
async
function
validateCreateModuleDatasource
(
mdName
,
dsName
,
params
=
{},
dmPath
)
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/create/validate`
,
makeParams
({
dmPath
},
{
params
}));
}
export
async
function
createModuleDatasource
(
mdName
,
dsName
,
params
=
{},
dmPath
)
{
return
post
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/create`
,
{
params
,
dmPath
,
});
}
export
async
function
removeModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{})
{
export
async
function
validateRemoveModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
request
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/remove/validate`
,
makeParams
({
key
,
dmPath
},
{
params
}));
}
export
async
function
removeModuleDatasource
(
mdName
,
dsName
,
key
,
params
=
{},
dmPath
)
{
return
post
(
`/api/module/user/
${
mdName
}
/datasource/
${
dsName
}
/remove`
,
{
key
,
params
,
dmPath
,
});
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论