Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 3.8.x #2378

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,27 @@
/* eslint-disable no-param-reassign */
import CrontabModel from '@model/crontab/crontab';

import CronJobSource from '../source/cron-job';
import TaskPlanSource from '../source/task-plan';
import TimeTaskSource from '../source/time-task';

export default {
timeTaskUpdate(params = {}) {
return TimeTaskSource.update(params);
create(params) {
return CronJobSource.create(params)
.then(({ data }) => data);
},
update(params = {}) {
return CronJobSource.update(params)
.then(({ data }) => data);
},
getDetail(params = {}, payload) {
return TimeTaskSource.getDataById(params, payload)
return CronJobSource.getDataById(params, payload)
.then(({ data }) => new CrontabModel(data));
},
timeTaskDelete(params = {}) {
return TimeTaskSource.deleteDataById(params);
remove(params = {}) {
return CronJobSource.deleteDataById(params);
},
timeTaskList(params, payload) {
return TimeTaskSource.getAll(params, payload)
fetchList(params, payload) {
return CronJobSource.getAll(params, payload)
.then(({ data }) => {
data.data = data.data.map(item => new CrontabModel(item));

Expand All @@ -63,7 +68,7 @@ export default {
return data;
});
// 获取定时任务的执行成功率信息
TimeTaskSource.getStatictis({
CronJobSource.getStatictis({
cronJobIds: cronJobList.map(item => item.id).join(','),
}).then((data) => {
const statictisMap = data.data.reduce((result, item) => {
Expand All @@ -89,27 +94,27 @@ export default {
return data;
});
},
timeTaskStatusUpdate(params = {}) {
return TimeTaskSource.updateStatus(params);
updateStatus(params = {}) {
return CronJobSource.updateStatus(params);
},
timeTaskCheckName(params = {}) {
return TimeTaskSource.getCheckResult(params)
checkName(params = {}) {
return CronJobSource.getCheckResult(params)
.then(({ data }) => data);
},
updatePlanTask(params = {}) {
return TimeTaskSource.updateVariableAndEnable(params)
return CronJobSource.updateVariableAndEnable(params)
.then(({ data }) => data);
},
fetchTaskOfPlan(params = {}) {
return TimeTaskSource.getDataByPlanId(params)
return CronJobSource.getDataByPlanId(params)
.then(({ data }) => data.map(item => new CrontabModel(item)));
},
fetchTaskOfPlanBatch(params = {}) {
return TimeTaskSource.getDataByPlanIds(params)
return CronJobSource.getDataByPlanIds(params)
.then(({ data }) => data);
},
fetchUnlaunchHistory(params) {
return TimeTaskSource.getUnlaunchHistory(params)
return CronJobSource.getUnlaunchHistory(params)
.then(({ data }) => data);
},
};
4 changes: 4 additions & 0 deletions src/frontend/src/domain/service/dangerous-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default {
return DangerousRuleSource.getData(params, payload)
.then(({ data }) => data.map(item => new DangerousRuleModel(item)));
},
create(params) {
return DangerousRuleSource.create(params)
.then(({ data }) => data);
},
update(params) {
return DangerousRuleSource.update(params)
.then(({ data }) => data);
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/domain/service/file-source-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default {
return data;
});
},
addSource(params) {
return FileSourceManageSource.addFileSource(params)
create(params) {
return FileSourceManageSource.create(params)
.then(({ data }) => data);
},
updateSource(params) {
return FileSourceManageSource.updateFileSource(params)
update(params) {
return FileSourceManageSource.update(params)
.then(({ data }) => data);
},
getSourceInfo(params) {
Expand Down
12 changes: 10 additions & 2 deletions src/frontend/src/domain/service/public-script-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import ScriptSyncModel from '@model/script/script-sync';
import PublicScriptManageSource from '../source/public-script-manage';

export default {
scriptCreate(params) {
return PublicScriptManageSource.create(params)
.then(({ data }) => data);
},
scriptList(params) {
return PublicScriptManageSource.getAll(params)
.then(({ data }) => {
Expand All @@ -54,8 +58,8 @@ export default {
return PublicScriptManageSource.getAllVersion(params)
.then(({ data }) => data.map(script => Object.freeze(new ScriptModel(script))));
},
scriptUpdate(params) {
return PublicScriptManageSource.update(params)
scriptVersionUpdate(params) {
return PublicScriptManageSource.versionUpdate(params)
.then(({ data }) => data);
},
scriptUpdateMeta(params) {
Expand All @@ -66,6 +70,10 @@ export default {
return PublicScriptManageSource.deleteById(params)
.then(({ data }) => data);
},
createVersion(params) {
return PublicScriptManageSource.createVersion(params)
.then(({ data }) => data);
},
versionDetail(params) {
return PublicScriptManageSource.getDataByVersionId(params)
.then(({ data }) => new ScriptModel(data));
Expand Down
12 changes: 10 additions & 2 deletions src/frontend/src/domain/service/script-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import ScriptSyncModel from '@model/script/script-sync';
import ScriptManageSource from '../source/script-manage';

export default {
scriptCreate(params) {
return ScriptManageSource.create(params)
.then(({ data }) => data);
},
scriptList(params, payload) {
return ScriptManageSource.getAll(params, payload)
.then(({ data }) => {
Expand All @@ -54,8 +58,8 @@ export default {
return ScriptManageSource.getAllVersion(params, config)
.then(({ data }) => data.map(script => Object.freeze(new ScriptModel(script))));
},
scriptUpdate(params) {
return ScriptManageSource.update(params)
scriptVersionUpdate(params) {
return ScriptManageSource.versionUpdate(params)
.then(({ data }) => data);
},
scriptUpdateMeta(params) {
Expand All @@ -64,6 +68,10 @@ export default {
scriptDelete(params) {
return ScriptManageSource.deleteById(params);
},
createVersion(params) {
return ScriptManageSource.createVersion(params)
.then(({ data }) => data);
},
versionDetail(params, config) {
return ScriptManageSource.getDataByVersionId(params, config)
.then(({ data }) => new ScriptModel(data));
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/src/domain/service/task-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export default {
return Object.freeze(new TaskModel(data, true));
});
},
create(params) {
return TaskManageSource.create(params)
.then(({ data }) => data);
},
taskUpdate(params) {
return TaskManageSource.update(params)
.then(({ data }) => data);
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/src/domain/service/task-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export default {
planSyncInfo(params) {
return TaskPlanSource.updateSyncInfo(params);
},
create(params) {
return TaskPlanSource.create(params).then(({ data }) => data);
},
planUpdate(params) {
return TaskPlanSource.update(params).then(({ data }) => data);
},
Expand Down
6 changes: 6 additions & 0 deletions src/frontend/src/domain/service/ticket-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ export default {
return data;
});
},

create(params = {}) {
return TicketSource.create(params);
},

update(params) {
return TicketSource.update(params);
},

remove(params) {
return TicketSource.delete(params);
},
Expand Down
7 changes: 6 additions & 1 deletion src/frontend/src/domain/service/white-ip.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ import WhiteIpModel from '@model/white-ip';
import WhiteIpSource from '../source/white-ip';

export default {
create(params) {
return WhiteIpSource.create(params)
.then(({ data }) => data);
},
whiteIpUpdate(params = {}) {
return WhiteIpSource.update(params);
return WhiteIpSource.update(params)
.then(({ data }) => data);
},
getAllCloudArea() {
return WhiteIpSource.getAllCloudArea()
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/src/domain/source/account-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ class AccountManage extends ModuleBase {

// 更新账号
update(params) {
return Request.put(`${this.path}/account`, {
const realParams = { ...params };
delete realParams.id;

return Request.put(`${this.path}/account/${params.id}`, {
params,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ class TimeTask extends ModuleBase {
this.module = '/job-crontab/web';
}

create(params = {}) {
return Request.post(`${this.path}/cron/job`, { params });
}

// 新增/更新定时任务
update(params) {
const { id } = params;
return Request.put(`${this.path}/cron/job/${id}`, { params });
const realParams = { ...params };
delete realParams.id;

return Request.put(`${this.path}/cron/job/${params.id}`, {
params: realParams,
});
}

// 获取定时任务信息
Expand Down
12 changes: 11 additions & 1 deletion src/frontend/src/domain/source/dangerous-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ class DangerousRule {
});
}

// 新增
create(params = {}) {
return Request.post(`${this.module}`, {
params,
});
}

// 添加/修改高危语句规则
update(params = {}) {
return Request.post(`${this.module}`, {
const realParams = { ...params };
delete realParams.id;

return Request.put(`${this.module}/${params.id}`, {
params,
});
}
Expand Down
11 changes: 7 additions & 4 deletions src/frontend/src/domain/source/file-source-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ class FileSourceManage extends ModuleBase {
}

// 新增文件源
addFileSource(params) {
create(params = {}) {
return Request.post(`${this.path}`, {
params,
});
}

// 更新文件源
updateFileSource(params) {
return Request.put(`${this.path}`, {
update(params = {}) {
const realParams = { ...params };
delete realParams.id;

return Request.put(`${this.path}/${params.id}`, {
params,
});
}
Expand All @@ -74,7 +77,7 @@ class FileSourceManage extends ModuleBase {
}

// 删除文件源
removeFileSource(params) {
removeFileSource(params = {}) {
return Request.delete(`${this.path}/ids/${params.id}`);
}

Expand Down
10 changes: 5 additions & 5 deletions src/frontend/src/domain/source/permission-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,35 @@ import Request from '@utils/request';

class Permission {
jobManage(params = {}) {
return Request.get('/job-manage/web/permission/check', {
return Request.get('/job-manage/web/permission/manage/check', {
params,
cache: 2000,
});
}

jobCrontab(params = {}) {
return Request.get('/job-crontab/web/permission/check', {
return Request.get('/job-crontab/web/permission/crontab/check', {
params,
cache: 2000,
});
}

jobExecute(params = {}) {
return Request.get('/job-execute/web/permission/check', {
return Request.get('/job-execute/web/permission/execute/check', {
params,
cache: 2000,
});
}

jobFileSource(params = {}) {
return Request.get('/job-file-gateway/web/permission/check', {
return Request.get('/job-file-gateway/web/permission/fileGateway/check', {
params,
cache: 2000,
});
}

jobTicket(params = {}) {
return Request.get('/job-ticket/web/permission/check', {
return Request.get('/job-ticket/web/permission/manage/check', {
params,
cache: 2000,
});
Expand Down
Loading
Loading