提交 5c34c6f7 authored 作者: vipcxj's avatar vipcxj

add: 新增数据源删除接口

上级 8e784feb
......@@ -4,7 +4,7 @@ class Detail extends React.Component {
render() {
const { state } = this.props.location;
console.log(state);
console.log(state); // eslint-disable-line no-console
return (
<div>List</div>
);
......
......@@ -20,7 +20,8 @@ export const datasourceApi = (coordinate) => {
count: partial(countGlobalDatasource, datasourceName),
meta: partial(getGlobalDatasourceMeta, datasourceName),
update: partial(updateGlobalDatasource, datasourceName),
create: partial(createGlobalDatasource(), datasourceName),
create: partial(createGlobalDatasource, datasourceName),
remove: partial(removeGlobalDatasource, datasourceName),
};
} else if (containerType === 'module') {
return {
......@@ -29,6 +30,7 @@ export const datasourceApi = (coordinate) => {
meta: partial(getModuleDatasourceMeta, containerName, datasourceName),
update: partial(updateModuleDatasource, containerName, datasourceName),
create: partial(createModuleDatasource, containerName, datasourceName),
remove: partial(removeModuleDatasource, containerName, datasourceName),
};
} else {
throw new Error(`Unsupported containerType: ${containerType}`);
......@@ -70,6 +72,13 @@ export async function createGlobalDatasource(name, params = {}) {
});
}
export async function removeGlobalDatasource(name, key, params = {}) {
return post(`/api/datasource/${name}/remove`, {
key,
params,
});
}
export async function getGlobalDatasourceMeta(name) {
return request(`/api/datasource/${name}/meta`);
}
......@@ -95,6 +104,13 @@ export async function createModuleDatasource(mdName, dsName, params = {}) {
});
}
export async function removeModuleDatasource(mdName, dsName, key, params = {}) {
return post(`/api/module/user/${mdName}/datasource/${dsName}/remove`, {
key,
params,
});
}
export async function getModuleDatasourceMeta(mdName, dsName) {
return request(`/api/module/user/${mdName}/datasource/${dsName}/meta`);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论