mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-06 18:00:57 +00:00
Asset meta (#3539)
- 更改了资产表单,影响 - 资产创建和更新 - 增加了资产平台数据库,影响 - 平台创建更新和删除 - 更改了资产的platform字段,又一个字符字段,改为一个外键,影响 - 资产创建和更新 - 资产连接 [windows,linux] - 测试连接等ansible任务 - 自动化云导入 - 更改了资产的序列化器,影响 - 资产创建更新列表 - 统一了树列表基础模板,影响 - 资产列表页,权限列表页,vault页,资产收集页 - 统一了导入导出组件,影响 - 资产导入导出 - 用户导入导出 - 用户组导入导出 - 系统用户导入导出 - 管理用户导入导出 - vault导出导出 - 收集用户列表导入导出 - 修改用户更新密码信号,影响 - 修改用户密码产生的改密日志 - 新增Model instance序列化工具函数,影响 - 操作日志生成 - 修改api mixin,新增 serializer_classes字段,serializer_classes = {"default": "", "display": "", "list": .., "other_action": ""}, 根据用户请求的方式返回不同的serializer_class,影响 - 用户的viewset - 资产权限的viewset - 统一系统配置中的tab切换 - 统一没有nav的页面,影响 - 重置密码 - 忘记密码 - 重置中设置密码 - 独立的message页面 - 修改用户组列表页,不再返还用户组下的用户,仅有数量 - 组织的一些方法变为layzproperty,避免重复计算 - 修改用户组详情页,影响 - 用户组增加删除用户
This commit is contained in:
@@ -177,7 +177,7 @@ function formSubmit(props) {
|
||||
*/
|
||||
props = props || {};
|
||||
var data = props.data || props.form.serializeObject();
|
||||
var redirect_to = props.redirect_to;
|
||||
var redirectTo = props.redirect_to || props.redirectTo;
|
||||
$.ajax({
|
||||
url: props.url,
|
||||
type: props.method || 'POST',
|
||||
@@ -185,12 +185,8 @@ function formSubmit(props) {
|
||||
contentType: props.content_type || "application/json; charset=utf-8",
|
||||
dataType: props.data_type || "json"
|
||||
}).done(function (data, textState, jqXHR) {
|
||||
if (redirect_to) {
|
||||
if (props.message) {
|
||||
var messages = "ed65330a45559c87345a0eb6ac7812d18d0d8976$[[\"__json_message\"\0540\05425\054\"asdfasdf \\u521b\\u5efa\\u6210\\u529f\"]]"
|
||||
setCookie("messages", messages)
|
||||
}
|
||||
location.href = redirect_to;
|
||||
if (redirectTo) {
|
||||
location.href = redirectTo;
|
||||
} else if (typeof props.success === 'function') {
|
||||
return props.success(data, textState, jqXHR);
|
||||
}
|
||||
@@ -254,7 +250,6 @@ function formSubmit(props) {
|
||||
}
|
||||
$('.has-error').get(0).scrollIntoView();
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1032,6 +1027,62 @@ function rootNodeAddDom(ztree, callback) {
|
||||
})
|
||||
}
|
||||
|
||||
function APIExportCSV(props) {
|
||||
/*
|
||||
{
|
||||
listUrl:
|
||||
objectsId:
|
||||
template:
|
||||
table:
|
||||
params:
|
||||
}
|
||||
*/
|
||||
var _listUrl = props.listUrl;
|
||||
var _objectsId = props.objectsId;
|
||||
var _template = props.template;
|
||||
var _table = props.table;
|
||||
var _params = props.params || {};
|
||||
|
||||
var tableParams = _table.ajax.params();
|
||||
var exportUrl = setUrlParam(_listUrl, 'format', 'csv');
|
||||
if (_template) {
|
||||
exportUrl = setUrlParam(exportUrl, 'template', _template)
|
||||
}
|
||||
for (var k in tableParams) {
|
||||
if (datatableInternalParams.includes(k)) {
|
||||
continue
|
||||
}
|
||||
if (!tableParams[k]) {
|
||||
continue
|
||||
}
|
||||
exportUrl = setUrlParam(exportUrl, k, tableParams[k])
|
||||
}
|
||||
for (var k in _params) {
|
||||
exportUrl = setUrlParam(exportUrl, k, tableParams[k])
|
||||
}
|
||||
|
||||
if (!_objectsId) {
|
||||
console.log(exportUrl);
|
||||
window.open(exportUrl);
|
||||
return
|
||||
}
|
||||
|
||||
requestApi({
|
||||
url: '/api/v1/common/resources/cache/',
|
||||
data: JSON.stringify({resources: _objectsId}),
|
||||
method: "POST",
|
||||
flash_message: false,
|
||||
success: function (data) {
|
||||
exportUrl = setUrlParam(exportUrl, 'spm', data.spm);
|
||||
console.log(exportUrl);
|
||||
window.open(exportUrl);
|
||||
},
|
||||
failed: function () {
|
||||
toastr.error(gettext('Export failed'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function APIExportData(props) {
|
||||
props = props || {};
|
||||
$.ajax({
|
||||
@@ -1081,6 +1132,7 @@ function APIImportData(props) {
|
||||
},
|
||||
error: function (error) {
|
||||
var data = error.responseJSON;
|
||||
console.log(data);
|
||||
if (data instanceof Array) {
|
||||
var html = '';
|
||||
var li = '';
|
||||
@@ -1141,8 +1193,8 @@ function objectAttrsIsBool(obj, attrs) {
|
||||
attrs.forEach(function (attr) {
|
||||
if (!obj[attr]) {
|
||||
obj[attr] = false
|
||||
} else if (['on', '1'].includes(obj[attr])) {
|
||||
obj[attr] = true
|
||||
} else {
|
||||
obj[attr] = ['on', '1', 'true', 'True'].includes(obj[attr]);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user