Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
manager-app-sz
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
ReactNative
manager-app-sz
Commits
4f7fdfd6
提交
4f7fdfd6
authored
12月 01, 2017
作者:
vipcxj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加resource相关api
上级
ed458e80
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
106 行增加
和
0 行删除
+106
-0
resource.js
src/services/resource.js
+106
-0
没有找到文件。
src/services/resource.js
0 → 100644
浏览文件 @
4f7fdfd6
import
{
castArray
}
from
'lodash'
;
import
post
from
'../utils/post'
;
import
config
from
'../utils/config'
;
import
request
from
'../utils/request'
;
export
class
Operations
{
constructor
()
{
this
.
operations
=
[];
}
addCmd
=
(
cmd
,
...
args
)
=>
{
this
.
operations
.
push
({
cmd
,
args
});
return
this
;
};
setName
=
(
name
)
=>
{
return
this
.
addCmd
(
'setName'
,
name
);
};
setRight
=
(
right
)
=>
{
return
this
.
addCmd
(
'setRight'
,
right
);
};
addTags
=
(...
tags
)
=>
{
return
this
.
addCmd
(
'addTags'
,
...
tags
);
};
removeTags
=
(...
tags
)
=>
{
return
this
.
addCmd
(
'removeTags'
,
...
tags
);
};
clearTags
=
()
=>
{
return
this
.
addCmd
(
'clearTags'
);
};
setTags
=
(...
tags
)
=>
{
return
this
.
addCmd
(
'setTags'
,
...
tags
);
};
addOwners
=
(...
owners
)
=>
{
return
this
.
addCmd
(
'addOwners'
,
...
owners
);
};
removeOwners
=
(...
owners
)
=>
{
return
this
.
addCmd
(
'removeOwners'
,
...
owners
);
};
clearOwners
=
()
=>
{
return
this
.
addCmd
(
'clearOwners'
);
};
setOwners
=
(...
owners
)
=>
{
return
this
.
addCmd
(
'setOwners'
,
...
owners
);
};
addOwnerGroups
=
(...
groups
)
=>
{
return
this
.
addCmd
(
'addOwnerGroups'
,
...
groups
);
};
removeOwnerGroups
=
(...
groups
)
=>
{
return
this
.
addCmd
(
'removeOwnerGroups'
,
...
groups
);
};
clearOwnerGroups
=
()
=>
{
return
this
.
addCmd
(
'clearOwnerGroups'
);
};
setOwnerGroups
=
(...
groups
)
=>
{
return
this
.
addCmd
(
'setOwnerGroups'
,
...
groups
);
};
use
=
(
usage
)
=>
{
return
this
.
addCmd
(
'use'
,
usage
);
};
unuse
=
(
usage
)
=>
{
return
this
.
addCmd
(
'unuse'
,
usage
);
};
}
export
const
createOperations
=
()
=>
{
return
new
Operations
();
};
export
async
function
editResource
(
uri
,
operations
)
{
return
post
(
`
${
config
.
apiContextPath
}
/api/resource/user/
${
encodeURIComponent
(
uri
)}
/meta`
,
{
operations
:
operations
.
operations
});
}
export
async
function
getResourceInfo
(
uri
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/
${
encodeURIComponent
(
uri
)}
/meta`
);
}
export
async
function
queryResourceByUsage
(
usage
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
usage
,
pst
,
psz
});
}
export
async
function
queryResourceByUsageStartWith
(
usage
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
usage
,
startWith
:
true
,
pst
,
psz
});
}
export
async
function
queryResourceByAllTags
(
tags
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
tags
:
castArray
(
tags
),
pst
,
psz
});
}
export
async
function
queryResourceByAnyTags
(
tags
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
tags
:
castArray
(
tags
),
andOr
:
'or'
,
pst
,
psz
});
}
export
async
function
queryResourceByUsageAndAllTags
(
usage
,
tags
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
usage
,
tags
:
castArray
(
tags
),
pst
,
psz
});
}
export
async
function
queryResourceByUsageAndAnyTags
(
usage
,
tags
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
usage
,
tags
:
castArray
(
tags
),
andOr
:
'or'
,
pst
,
psz
});
}
export
async
function
queryResourceByUsageStartWithAndAllTags
(
usage
,
tags
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
usage
,
startWith
:
true
,
tags
:
castArray
(
tags
),
pst
,
psz
});
}
export
async
function
queryResourceByUsageStartWithAndAnyTags
(
usage
,
tags
,
pst
=
-
1
,
psz
=
-
1
)
{
return
request
(
`
${
config
.
apiContextPath
}
/api/resource/user/query`
,
{
usage
,
startWith
:
true
,
tags
:
castArray
(
tags
),
andOr
:
'or'
,
pst
,
psz
});
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论