refactor(工作台): 页面样式问题以及一键同步发消息加控制条件

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-07-26 20:04:41 +08:00 committed by xiaomeinvG
parent 7bf1e37056
commit dc66555da5
7 changed files with 151 additions and 30 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.notice.controller;
import io.metersphere.base.domain.MessageTask;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.commons.utils.SessionUtils;
@ -39,5 +40,10 @@ public class NoticeController {
public int deleteMessage(@PathVariable String identification) {
return noticeService.delMessage(identification);
}
@PostMapping("/search/message/tasks/{projectId}")
public List<MessageTask> getMessageByProjectId(@PathVariable String projectId, @RequestBody MessageDetail messageDetail) {
return noticeService.getMessageByProjectId(projectId, messageDetail);
}
}

View File

@ -192,4 +192,25 @@ public class NoticeService {
StatusReference.statusMap.containsKey(task.getTaskType()) ? StatusReference.statusMap.get(task.getTaskType()) : task.getTaskType(), null, columns);
return JSON.toJSONString(details);
}
public List<MessageTask> getMessageByProjectId(String projectId, MessageDetail messageDetail) {
MessageTaskExample example = new MessageTaskExample();
MessageTaskExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(projectId)) {
criteria.andProjectIdEqualTo(projectId);
}
if (StringUtils.isNotBlank(messageDetail.getTaskType())) {
criteria.andTaskTypeEqualTo(messageDetail.getTaskType());
}
if (StringUtils.isNotBlank(messageDetail.getEvent())) {
criteria.andEventEqualTo(messageDetail.getEvent());
}
if (StringUtils.isNotBlank(messageDetail.getIdentification())) {
criteria.andIdentificationEqualTo(messageDetail.getIdentification());
}
if (StringUtils.isNotBlank(messageDetail.getType())) {
criteria.andTypeEqualTo(messageDetail.getType());
}
return messageTaskMapper.selectByExample(example);
}
}

View File

@ -182,26 +182,37 @@
</template>
</el-dialog>
<el-dialog :visible.sync="batchSyncApiVisible" :title="$t('commons.save')+$t('commons.setting')">
<el-dialog :visible.sync="batchSyncApiVisible"
:title="$t('commons.save')+'&'+$t('workstation.sync')+$t('commons.setting')" v-if="isXpack">
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
<div class="timeClass">
<span>{{ $t('api_test.definition.one_click_sync') + "case" }}</span>
<span style="font-size: 16px;font-weight: bold">{{ $t('api_test.definition.one_click_sync') + "case" }}</span>
<el-switch v-model="syncCases"></el-switch>
</div>
<span>{{ $t('workstation.batch_sync_api_tips') }}</span>
<br/>
<span style="font-size: 12px">{{ $t('workstation.batch_sync_api_tips') }}</span><br/><br/>
<span v-if="syncCases" style="font-size: 16px; font-weight: bold">
{{ $t('workstation.sync') + $t('commons.setting') }}
<i class="el-icon-arrow-down" v-if="showApiSyncConfig" @click="showApiSyncConfig=false"/>
<i class="el-icon-arrow-right" v-if="!showApiSyncConfig" @click="showApiSyncConfig=true"/>
</span><br/><br/>
<div v-if="showApiSyncConfig">
<sync-setting style="padding-left: 10px" v-if="syncCases" ref="synSetting"></sync-setting>
</div>
</el-row>
<span v-if="syncCases">{{ $t('workstation.sync') + $t('commons.setting') }}</span><br/>
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
<sync-setting v-if="syncCases" ref="synSetting"></sync-setting>
</el-row>
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)" v-if="showNotice">
<div class="timeClass">
<span>{{ $t('api_test.definition.change_notification') }}</span>
<span style="font-size: 16px;font-weight: bold">{{ $t('api_test.definition.change_notification') }}</span>
<el-switch v-model="specialReceivers"></el-switch>
</div>
<span>{{ $t('api_test.definition.recipient_tips') }}</span>
<el-row v-if="specialReceivers">
<el-col :span="4">{{ $t('api_test.definition.recipient') + ":" }}</el-col>
<span style="font-size: 12px;">
{{ $t('api_test.definition.recipient_tips') }}
</span>
<el-row v-if="specialReceivers" style="margin-bottom: 5px;margin-top: 5px">
<el-col :span="4"><span
style="font-weight: bold">{{ $t('api_test.definition.recipient') + ":" }}</span>
</el-col>
<el-col :span="20" style="color: #783887">
<el-checkbox v-model="caseCreator">{{ 'CASE' + $t('api_test.creator') }}</el-checkbox>
<el-checkbox v-model="scenarioCreator">{{ $t('commons.scenario') + $t('api_test.creator') }}</el-checkbox>
@ -309,11 +320,13 @@ export default {
createNewVersionVisible: false,
batchSyncApiVisible: false,
syncCases: true,
specialReceivers: false,
caseCreator: false,
scenarioCreator: false,
specialReceivers: true,
caseCreator: true,
scenarioCreator: true,
apiSyncCaseRequest: {},
isXpack: false,
showNotice: false,
showApiSyncConfig: true
};
},
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}, syncTabs: Array, projectId: String},
@ -870,12 +883,32 @@ export default {
this.apiSyncCaseRequest = JSON.parse(res.data.triggerUpdate);
}
});
},
getMessageList() {
let messageConfig = {
userIds: [],
taskType: 'API_DEFINITION_TASK',
event: 'UPDATE',
webhook: null,
type: 'IN_SITE',
identification: null,
isSet: null,
testId: null,
createTime: null,
template: null
}
this.$post('/notice/search/message/tasks/' + this.projectId, messageConfig, response => {
if (response.data && response.data.length > 0) {
this.showNotice = true;
}
});
}
},
created() {
this.getMaintainerOptions();
this.getApplication();
this.isXpack = !!hasLicense();
if (!this.basisData.environmentId) {
this.basisData.environmentId = "";
}
@ -901,6 +934,7 @@ export default {
if (hasLicense()) {
this.getVersionHistory();
this.getMessageList();
}
}
};
@ -911,6 +945,7 @@ export default {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 5px;
}
.base-info .el-form-item {

View File

@ -165,7 +165,15 @@
<div style="margin-top: -25px; margin-left: -20px; width:720px; height:1px; background:#DCDFE6;"></div>
<el-row style="margin-top: 15px">
<div class="timeClass">
<span>{{ $t('api_test.request.time') + $t('commons.setting') }}</span>
<span>
<span style="font-size: 16px">{{ $t('api_test.request.time') + $t('commons.setting') }}</span>
<i class="el-icon-arrow-down" v-if="showSyncTimeSetting" @click="showSyncTimeSetting=false"/>
<i class="el-icon-arrow-right" v-if="!showSyncTimeSetting" @click="showSyncTimeSetting=true"/>
<el-tooltip class="ms-num" effect="dark"
:content="$t('project_application.workstation.time_tip')"
placement="top">
<i class="el-icon-warning"/>
</el-tooltip></span>
<el-switch v-model="config.openUpdateTime"
@change="setSyncTime"></el-switch>
</div>
@ -196,12 +204,28 @@
</div>
</el-row>
<el-row style="margin-top: 15px">
<span>{{
$t('commons.pending_upgrade') + $t('api_test.request.condition') + $t('commons.setting')
}}</span>
<span>
<span style="font-size: 16px">{{
$t('commons.pending_upgrade') + $t('api_test.request.condition') + $t('commons.setting')
}}</span>
<i class="el-icon-arrow-down" v-if="showApiConfig" @click="showApiConfig=false"/>
<i class="el-icon-arrow-right" v-if="!showApiConfig" @click="showApiConfig=true"/>
<el-tooltip class="ms-num" effect="dark"
:content="$t('project_application.workstation.rule_tip')"
placement="top">
<i class="el-icon-warning"/>
</el-tooltip>
</span>
</el-row>
<div style="margin-top: 15px" class="setApiClass">
<span>{{ $t('workstation.api_change') + $t('commons.setting') }}</span>
<div style="margin-top: 15px" class="setApiClass" v-if="showApiConfig">
<span>
<span style="font-weight: bold">{{ $t('workstation.api_change') + $t('commons.setting') }}</span>
<el-tooltip class="ms-num" effect="dark"
:content="$t('project_application.workstation.api_tip')"
placement="top">
<i class="el-icon-warning"/>
</el-tooltip>
</span>
<el-row>
<el-col :span="4">{{ $t('api_test.mock.base_info') + ":" }}</el-col>
<el-col :span="20" style="color: #783887">
@ -230,7 +254,12 @@
<el-checkbox v-model="apiSyncCaseRequest.body">{{ $t('api_test.request.body') }}</el-checkbox>
</el-col>
</el-row>
<!-- <span>{{ $t('commons.track') + $t('commons.setting') }}</span>
<!-- <span>{{ $t('commons.track') + $t('commons.setting') }}<el-tooltip class="ms-num" effect="dark"
:content="$t('project_application.workstation.case_tip')"
placement="top">
<i class="el-icon-warning"/>
</el-tooltip>
</span>
<el-row>
<el-col :span="4">{{ $t('project.code_segment.result') + ":" }}</el-col>
<el-col :span="20" style="color: #783887">
@ -321,10 +350,11 @@ export default {
triggerUpdate: "",
},
showRuleSetting: false,
showSyncTimeSetting: false,
showSyncTimeSetting: true,
apiSyncCaseRequest: {},
pastQuantity: '',
pastUnit: ''
pastUnit: '',
showApiConfig: true
};
},
created() {
@ -419,11 +449,8 @@ export default {
this.apiSyncCaseRequest.path = true;
},
setSyncTime() {
this.showSyncTimeSetting = !this.showSyncTimeSetting;
},
saveSync() {
let configs = [];
if (this.showSyncTimeSetting) {
if (this.config.openUpdateTime) {
if (!this.pastQuantity) {
this.$message.error("请选择时间")
}
@ -438,6 +465,11 @@ export default {
});
}
configs.push({projectId: this.projectId, typeValue: this.config.openUpdateTime, type: 'OPEN_UPDATE_TIME'});
let params = {configs};
this.startSaveData(params)
},
saveSync() {
let configs = [];
configs.push({
projectId: this.projectId,
typeValue: JSON.stringify(this.apiSyncCaseRequest),

View File

@ -3351,5 +3351,14 @@ export default {
check_subitem: 'check subitem',
pause: 'Pause',
browser: "Browser",
},
project_application: {
workstation: {
time_tip: 'Off, no time range is set; On, according to the set time range, enter the list to be updated, if the time range is exceeded, it will be automatically cleared from the list;',
rule_tip: 'Set the to-be-updated rule, if it meets the selected conditions, it will enter the to-be-updated list',
api_tip: 'Both the interface definition and the affected interface use cases will enter the to-be-updated list',
case_tip: 'If the interface use case meets the conditions, it will enter the to-be-updated list',
update_rule_title: 'Enter the to-be-updated list rule settings'
}
}
};

View File

@ -1254,7 +1254,7 @@ export default {
api_project: "所属项目",
one_click_sync: "一键同步",
change_notification: "变更通知",
recipient: "接人",
recipient: "接人",
recipient_tips: "当API发生变化时关联的CASE创建人、自动化场景创建人会收到站内消息",
select_comp: {
no_data: "无数据",
@ -3360,5 +3360,14 @@ export default {
check_subitem: '请选择子分类',
pause: '等待时间',
browser: "浏览器",
},
project_application: {
workstation: {
time_tip: '关闭,不设置时间范围;开启,根据设置的时间范围,进入待更新列表,超出时间范围,将自动从列表清除;',
rule_tip: '设置待更新规则,符合选择的条件,会进入待更新列表中',
api_tip: '接口定义和受影响的接口用例都会进入待更新列表',
case_tip: '接口用例符合条件就会进入待更新列表',
update_rule_title: '进入待更新列表规则设置'
}
}
};

View File

@ -3337,5 +3337,14 @@ export default {
valiate_fail: "校驗失敗,請檢查必填項",
pause: '等待時間',
browser: "瀏覽器",
},
project_application: {
workstation: {
time_tip: '關閉,不設置時間範圍;開啟,根據設置的時間範圍,進入待更新列表,超出時間範圍,將自動從列表清除;',
rule_tip: '設置待更新規則,符合選擇的條件,會進入待更新列表中',
api_tip: '接口定義和受影響的接口用例都會進入待更新列表',
case_tip: '接口用例符合條件就會進入待更新列表',
update_rule_title: '進入待更新列表規則設置'
}
}
};