Merge pull request #6892 from metersphere/pr@dev@fix_关系图国际化与权限

fix: 关系图国际化与权限
This commit is contained in:
jianxing 2021-10-21 13:10:41 +08:00 committed by GitHub
commit 82d620925c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 123 additions and 80 deletions

View File

@ -324,8 +324,7 @@
</choose>
</if>
<if test="key=='status' and (values == null || values.size() == 0)">
and test_case.status is null or test_case.status != 'Trash'
and (test_case.status is null or test_case.status != 'Trash')
</if>
</foreach>
</if>

View File

@ -1,15 +1,15 @@
<template>
<div>
<ms-form-divider :title="'其他信息'"/>
<ms-form-divider :title="$t('test_track.case.other_info')"/>
<api-info-container>
<el-form :model="api" ref="api-form" label-width="100px">
<el-collapse-transition>
<el-tabs v-model="activeName" style="margin: 20px">
<el-tab-pane :label="'备注'" name="remark" class="pane">
<form-rich-text-item class="remark-item" :disabled="readOnly" :data="api" prop="remark" label-width="0"/>
<el-tab-pane :label="$t('commons.remark')" name="remark" class="pane">
<form-rich-text-item class="remark-item" :disabled="readOnly && !hasPermissions" :data="api" prop="remark" label-width="0"/>
</el-tab-pane>
<el-tab-pane :label="'依赖关系'" name="dependencies" class="pane">
<dependencies-list :resource-id="api.id" resource-type="API" ref="dependencies"/>
<el-tab-pane :label="$t('commons.relationship.name')" name="dependencies" class="pane">
<dependencies-list :read-only="readOnly" :resource-id="api.id" resource-type="API" ref="dependencies"/>
</el-tab-pane>
</el-tabs>
</el-collapse-transition>
@ -23,6 +23,7 @@ import MsFormDivider from "@/business/components/common/components/MsFormDivider
import ApiInfoContainer from "@/business/components/api/definition/components/complete/ApiInfoContainer";
import DependenciesList from "@/business/components/common/components/graph/DependenciesList";
import FormRichTextItem from "@/business/components/track/case/components/FormRichTextItem";
import {hasPermissions} from "@/common/js/utils";
export default {
name: "ApiOtherInfo",
components: {FormRichTextItem, DependenciesList, ApiInfoContainer, MsFormDivider},
@ -32,6 +33,11 @@ export default {
activeName: 'remark'
}
},
computed: {
hasPermissions() {
return hasPermissions('PROJECT_API_DEFINITION:READ+EDIT_API');
}
},
watch: {
activeName() {
if (this.activeName === 'dependencies') {

View File

@ -57,7 +57,7 @@ export default {
{
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
exec: this.handleDelete,
// permissions: ['PROJECT_TRACK_CASE:READ+DELETE']
permissions: ['PROJECT_API_DEFINITION:READ+EDIT_API']
}
],
condition: {},

View File

@ -33,7 +33,11 @@ export default {
},
isDisable(btn) {
if (btn.isDisable) {
if (btn.isDisable instanceof Function) {
return btn.isDisable(this.row);
} else {
return btn.isDisable;
}
}
return false;
}

View File

@ -4,10 +4,10 @@
<i class="el-icon-view" @click="openGraph"></i>
</el-main>
<relationship-list :title="'前置对象'" relationship-type="PRE" :resource-id="resourceId" :resource-type="resourceType" ref="preRelationshipList"/>
<relationship-list :title="'后置对象'" relationship-type="POST" :resource-id="resourceId" :resource-type="resourceType" ref="postRelationshipList"/>
<relationship-list :read-only="readOnly" :title="$t('commons.relationship.pre')" relationship-type="PRE" :resource-id="resourceId" :resource-type="resourceType" ref="preRelationshipList"/>
<relationship-list :read-only="readOnly" :title="$t('commons.relationship.post')" relationship-type="POST" :resource-id="resourceId" :resource-type="resourceType" ref="postRelationshipList"/>
<relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph"/>
<relationship-graph-drawer v-permission :graph-data="graphData" ref="relationshipGraph"/>
</div>
</template>
@ -21,7 +21,8 @@ export default {
components: {RelationshipList, RelationshipGraphDrawer},
props: [
'resourceId',
'resourceType'
'resourceType',
'readOnly'
],
data() {
return {

View File

@ -1,18 +1,20 @@
<template>
<el-main>
<span>{{ title }}</span>
<el-button class="add-btn"
:disabled="readOnly" type="primary" size="mini" @click="openRelevance">{{ $t('添加') }}</el-button>
<el-button class="add-btn" v-permission="relationshipType == 'TEST_CASE' ? ['PROJECT_TRACK_CASE:READ+EDIT'] : ['PROJECT_API_DEFINITION:READ+EDIT_API']"
:disabled="readOnly" type="primary" size="mini" @click="openRelevance">{{ $t($t('commons.add')) }}</el-button>
<test-case-relationship-list
v-if="resourceType === 'TEST_CASE'"
:case-id="resourceId"
:read-only="readOnly"
:relationship-type="relationshipType"
@deleteRelationship="handleDelete"
ref="testCaseRelationshipList"/>
<api-relationship-list
v-if="resourceType === 'API'"
:read-only="readOnly"
:api-definition-id="resourceId"
:relationship-type="relationshipType"
@deleteRelationship="handleDelete"

View File

@ -39,8 +39,8 @@
:case-id="caseId" ref="issue"/>
</el-tab-pane>
<el-tab-pane :label="$t('依赖关系')" name="relationship">
<dependencies-list :resource-id="caseId" resource-type="TEST_CASE" ref="relationship"/>
<el-tab-pane :label="$t('commons.relationship.name')" name="relationship">
<dependencies-list :read-only="readOnly" :resource-id="caseId" resource-type="TEST_CASE" ref="relationship"/>
</el-tab-pane>
<el-tab-pane :label="$t('test_track.case.attachment')" name="attachment">

View File

@ -62,7 +62,8 @@ export default {
{
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
exec: this.handleDelete,
// permissions: ['PROJECT_TRACK_CASE:READ+DELETE']
isDisable: this.readOnly,
permissions: ['PROJECT_TRACK_CASE:READ+DELETE']
}
],
condition: {},

View File

@ -186,6 +186,16 @@ export default {
run_completed: "Run Completed",
run_fail: "Run Fail",
generate_test_data: "Generate test data",
relationship: {
name: 'Dependencies',
pre: 'Prepositional Object',
post: 'Postposition Object',
graph: 'Dependencies Graph',
selected: 'Selected Node',
direct: 'Direct Link',
indirect: 'Indirect Link',
},
project_setting: "Project Setting",
table: {
select_tip: "Item {0} data is selected"

View File

@ -186,6 +186,16 @@ export default {
run_success: "执行成功",
run_completed: "执行完成",
run_fail: "执行失败",
relationship: {
name: '依赖关系',
pre: '前置对象',
post: '后置置对象',
graph: '依赖图',
selected: '选中节点',
direct: '直接关联',
indirect: '间接关联',
},
generate_test_data: "生成测试数据",
project_setting: '项目设置',
table: {
@ -245,7 +255,7 @@ export default {
not_equals: "不等于",
between: "之间",
current_user: "是当前用户"
}
},
},
monitor: "监控",
all_label: {

View File

@ -1,6 +1,6 @@
export default {
commons: {
project_permission: '請先添加該項目許可權',
project_permission: '請先添加該項目',
failure_continues: "失敗繼續",
full_screen_editing: "全屏編輯",
trash: "回收站",
@ -47,7 +47,7 @@ export default {
update: '更新',
save_success: '保存成功',
delete_success: '刪除成功',
copy_success: '復成功',
copy_success: '復成功',
modify_success: '修改成功',
delete_cancel: '已取消刪除',
option_cannot_spread_pages: '這個操作不支持跨頁,是否繼續?',
@ -66,7 +66,7 @@ export default {
create_time: '創建時間',
update_time: '更新時間',
delete_time: '刪除時間',
delete_user: '除人',
delete_user: '除人',
add: '添加',
preview: '預覽',
member: '成員',
@ -92,7 +92,7 @@ export default {
input_content: '請輸入內容',
create: '新建',
edit: '編輯',
copy: '復',
copy: '復',
refresh: '刷新',
remark: '備註',
delete: '刪除',
@ -169,14 +169,14 @@ export default {
mock: "Mock 設置",
api_case: "接口用例",
scenario_case: "場景用例",
task_center: "任中心",
task_center: "任中心",
notice_center: "消息中心",
notice_count: '條消息',
notice_tips: '僅顯示最近3個月的站內消息',
system_notice: '系統通知',
mentioned_me_notice: '@提到我的',
all_module_title: "全部模塊",
create_user: "創建人",
create_user: '創建人',
run_message: "任務執行中,請到任務中心查看詳情",
executor: "執行人",
execute_history: "執行歷史",
@ -186,21 +186,31 @@ export default {
run_success: "執行成功",
run_completed: "執行完成",
run_fail: "執行失敗",
relationship: {
name: '依賴關系',
pre: '前置對象',
post: '後置置對象',
graph: '依賴圖',
selected: '選中節點',
direct: '直接關聯',
indirect: '間接關聯',
},
generate_test_data: "生成測試數據",
table: {
select_tip: "已選中 {0} 條數據"
},
project_setting: '項目設置',
selector: {
required: "必填",
not_required: "非必填",
},
table: {
select_tip: "已選中 {0} 條數據"
},
ssl: {
config: "證書配置",
files: "證書文件",
entry: "證書條目",
original_as_name: "原有別名",
new_as_name: "新名",
new_as_name: "新名",
source: "來源",
default: "是否默認"
},
@ -245,7 +255,7 @@ export default {
not_equals: "不等於",
between: "之間",
current_user: "是當前用戶"
}
},
},
monitor: "監控",
all_label: {
@ -260,7 +270,7 @@ export default {
},
report_statistics: {
title: "報表統計",
test_case_analysis: "測試用例分析",
test_case_analysis: "測試用例趨勢",
test_case_activity: "測試用例活動情況",
test_case_count: "測試用例統計",
test_case_count_activity: "測試用例統計情況",
@ -360,7 +370,7 @@ export default {
scene: '使用場景',
attribute_type: '屬性類型',
field_name: '字段名',
field: '字段',
field: '字段',
field_remark: '字段備註',
field_type: '字段類型',
field_option: '選項值',
@ -397,8 +407,8 @@ export default {
special_characters_are_not_supported: '格式錯誤(不支持特殊字符,且不能以\'-\'開頭結尾)',
delete_warning: '刪除該工作空間將同步刪除該工作空間下所有項目,以及項目中的所有用例、接口測試、性能測試等,確定要刪除嗎?',
template_manage: "模版管理",
case_template_manage: "用例模",
issue_template_manage: "缺陷模",
case_template_manage: "用例模",
issue_template_manage: "缺陷模",
},
organization: {
create: '創建組織',
@ -426,16 +436,17 @@ export default {
defect_task_notification: '缺陷任務通知',
select_receiving_method: '選擇接收方式',
mail: '郵件',
in_site: '站內通知',
nail_robot: '釘釘機器人',
enterprise_wechat_robot: '企業微信機器人',
lark: '飛書機器人',
notes: '1.釘釘和企業群裏新建一個自定義機器人,然後復 webhook 地址在我們平臺上;<br/>' +
' 2.機器人選擇為群機器人,安全驗證選擇“自定義關鍵詞” "任務通知";<br/>' +
notes: '1.釘釘和企業群裏新建一個自定義機器人,然後復 webhook 地址在我們平臺上;<br/>' +
' 2.機器人選擇為群機器人,安全驗證選擇「自定義關鍵詞」 "任務通知";<br/>' +
' 3.選擇接收人時必須是你所建的群裏包含的人,接收人手機號為必填項且為釘釘企業所使用的手機號',
message: '事件,接收人,接收方式為必填項',
message_webhook: '接收方式為釘釘和企業機器人,飛書時webhook為必填項',
template: "模版",
track: '測試跟任務通知',
track: '測試跟任務通知',
api: '接口測試任務通知',
performance: '性能測試任務通知',
notice_count: '通知數',
@ -454,7 +465,6 @@ export default {
jira_storytype: '需求類型',
input_api_account: '請輸入賬號',
input_api_password: '請輸入密碼',
input_api_pat: '請输入 Personal Access Token',
input_jira_url: '請輸入Jira地址https://metersphere.atlassian.net/',
input_jira_issuetype: '請輸入問題類型',
input_jira_storytype: '請輸入需求類型',
@ -486,7 +496,7 @@ export default {
azure_organization_id: 'Azure 組織ID',
input_azure_pat: '請輸入 Personal Access Token',
input_azure_url: '請輸入 Azure Devops 地址',
input_azure_id: '請輸入 Azure 組織ID',
input_azure_organization_id: '請輸入 Azure 組織ID',
use_tip_azure: 'Azure Devops 地址+令牌(賬戶設置-個人訪問令牌-創建令牌)',
}
},
@ -516,7 +526,7 @@ export default {
upload_file_again: '重新上傳',
code_segment: {
code_segment: "自定義代碼片段",
search: "根據 名稱/標 搜索",
search: "根據 名稱/標 搜索",
create: "創建代碼片段",
update: "更新代碼片段",
delete: "刪除自定義代碼片段",
@ -529,9 +539,9 @@ export default {
test: "測試",
no_result: "無執行結果",
api_test: "API測試",
import_api_test: "从API定义导入",
import_api_test: "從API定義導入",
new_api_test: "新API測試[JSON]",
custom_value: "新API測試",
custom_value: "自定義變量",
project_env: "項目環境",
insert_segment: "插入自定義代碼片段",
exception_handle: "異常處理",
@ -680,9 +690,9 @@ export default {
run_status: '測試處於運行狀態,請稍後查看報告!',
user_name: '創建人',
project_name: '所屬項目',
force_stop_tips: '<strong>強停止</strong>測試會立刻結束當前測試並刪除報告數據',
force_stop_tips: '<strong>強停止</strong>測試會立刻結束當前測試並刪除報告數據',
stop_tips: '<strong>停止</strong>測試會結束當前測試並保留報告數據',
force_stop_btn: '強停止',
force_stop_btn: '強停止',
stop_btn: '停止',
stop_btn_all: '全部停止',
not_exist: "測試報告不存在",
@ -724,7 +734,7 @@ export default {
upload_type: '只能上傳JMX/CSV/JAR文件',
related_file_not_found: "未找到關聯的測試文件!",
delete_file_confirm: '確認刪除文件: ',
file_size_limit: "文件個數超出限",
file_size_limit: "文件個數超出限",
delete_file: "文件已存在,請先刪除同名文件!",
thread_num: '並發用戶數',
input_thread_num: '請輸入線程數',
@ -732,7 +742,7 @@ export default {
granularity: '聚合時間(秒)',
input_duration: '請輸入時長',
rps_limit: 'RPS上限',
input_rps_limit: '請輸入限',
input_rps_limit: '請輸入限',
ramp_up_time_within: '在',
ramp_up_time_minutes: '秒內,分',
ramp_up_time_seconds: '秒內增加並發用戶',
@ -784,7 +794,7 @@ export default {
threadgroup_at_least_one: '至少啟用一個線程組',
load_api_automation_jmx: '引用接口自動化場景',
project_file_exist: "項目中已存在該文件,請直接引用",
csv_has_header: '包含表',
csv_has_header: '包含表',
csv_split: 'CSV分割',
on_sample_error: '取樣器錯誤後',
continue: '繼續',
@ -810,8 +820,8 @@ export default {
project_file_update_type_error: '更新的文件類型必須一致',
},
api_test: {
creator: "創建人",
is_continue: "是否繼續",
creator: "創建人",
save_and_run: "保存並執行",
run: "執行",
running: "正在執行",
@ -828,10 +838,10 @@ export default {
value: "值",
create_performance_test: "創建性能測試",
create_performance_test_batch: "批量創建性能測試",
batch_copy: "批量製",
batch_copy: "批量製",
export_config: "導出",
enable_validate_tip: "沒有可用請求",
copy: "復測試",
copy: "復測試",
batch_add_parameter: "格式:參數名:參數值 <br/> 如Accept-Encoding:utf-8",
jar_config: {
title: "上傳jar包",
@ -928,15 +938,15 @@ export default {
batch_delete: "批量刪除",
delete_confirm: "確認刪除接口",
batch_to_performance_confirm: "確認批量創建性能測試",
batch_copy_confirm: "確認要進行批量複製嗎",
batch_copy_end: "批量製完成",
batch_copy_confirm: "確定要進行批量復製嗎",
batch_copy_end: "批量製完成",
delete_case_confirm: "確認刪除用例",
delete_confirm_step: "確認刪除步驟",
assertions_rule: "斷言規則",
response_header: "響應頭",
response_body: "響應體",
response_template: "響應報文模版",
console: "控臺",
console: "控臺",
status_code: "狀態碼",
query_info: "地址欄中跟在?後面的參數,如updateapi?id=112",
rest_info: "地址欄中被斜杠/分隔的參數如updateapi/{id}",
@ -957,7 +967,6 @@ export default {
batch_move: "批量移動",
path_valid_info: "請求路徑無效",
other_config: "其他設置",
cert_alias: "證書別名",
message_template: "報文模版",
tcp_parameter_tip: "請求參數可以在請求模版通過${xxx}引用",
step_message: "步驟過多,是否展開前 30 個步驟?",
@ -970,7 +979,7 @@ export default {
value: "數據",
not_required: "非必填",
},
esb_copy_confirm: "確認復當前節點的數據結構",
esb_copy_confirm: "確認復當前節點的數據結構",
esb_title: "可以在報文模板中使用${參數名} 或 ${父節點參數名.子節點參數名}來生成xml數據結構",
},
document: {
@ -1022,10 +1031,10 @@ export default {
scenario_total: "場景變量",
api_list_import: "接口列表導入",
external_import: "外部導入",
wait_controller: "等待控器",
if_controller: "條件控器",
loop_controller: "循環控器",
transcation_controller: "事務控器",
wait_controller: "等待控器",
if_controller: "條件控器",
loop_controller: "循環控器",
transcation_controller: "事務控器",
scenario_import: "場景導入",
customize_script: "自定義腳本",
customize_req: "自定義請求",
@ -1047,7 +1056,7 @@ export default {
trash: "回收",
edit: "編輯",
execute: "執行",
copy: "復",
copy: "復",
remove: "刪除",
view_ref: "查看引用",
case_ref: "用例引用",
@ -1087,7 +1096,7 @@ export default {
environment_list: "環境列表",
environment_config: "環境配置",
config_environment: "配置環境",
copy_environment: "復環境",
copy_environment: "復環境",
environment: "環境",
select_environment: "請選擇環境",
please_save_test: "請先保存測試",
@ -1096,8 +1105,8 @@ export default {
database_config: "數據庫配置",
tcp_config: "TCP配置",
import: "導入環境",
request_timeout: "接超時",
response_timeout: "響應超",
request_timeout: "接超時",
response_timeout: "響應超",
},
scenario: {
scenario: "場景",
@ -1110,7 +1119,7 @@ export default {
variables: "自定義變量",
headers: "請求頭",
kv_description: "所有請求可以使用自定義變量",
copy: "復場景",
copy: "復場景",
delete: "刪除場景",
disable: "禁用",
enable: "啟用",
@ -1120,12 +1129,12 @@ export default {
enable_disable: "啟用/禁用",
test_name: "測試名稱",
reference: "引用",
clone: "復",
clone: "復",
cant_reference: '歷史測試文件,重新保存後才可被引用'
},
request: {
debug: "調試",
copy: "復請求",
copy: "復請求",
delete: "刪除請求",
input_name: "請輸入請求名稱",
input_url: "請輸入請求URL",
@ -1165,6 +1174,7 @@ export default {
connect_timeout: "連接超時",
response_timeout: "響應超時",
follow_redirects: "跟隨重定向",
cert_alias: "證書別名",
do_multipart_post: "對 POST 使用 multipart/form-data",
body_upload_limit_size: "上傳文件大小不能超過 500 MB!",
condition: "條件",
@ -1251,6 +1261,7 @@ export default {
timeout: "超時時間(ms)",
database_driver: "數據庫驅動",
database_url: "數據庫連接URL",
tips: "Tips: 執行多條SQL語句需配置allowMultiQueries=true",
username: "用戶名",
password: "密碼",
pool_max: "最大連接數",
@ -1302,12 +1313,11 @@ export default {
timing_synchronization: "定時同步",
next_synchronization_time: "下次同步時間",
ms_env_import_file_limit: "僅支持通過MeterSphere導出的json格式文件",
file_exceed_limit: "文件數量超出限",
import_cover_tip: "导入模式: 覆盖模式说明",
file_exceed_limit: "文件數量超出限",
import_cover_tip: "導入模式: 覆蓋模式說明",
cover_tip_1: "1. 接口路徑不存在則新增",
cover_tip_2: "2. 接口路徑與原接口一致,內容不一致則覆蓋原接口",
cover_tip_3: "3. 接口路徑、內容與原接口一致則不做變更",
},
home_page: {
unit_of_measurement: "個",
@ -1602,7 +1612,7 @@ export default {
continue_upload: "繼續上傳",
import_create: "導入新建",
import_update: "導入更新",
import_tip1: "項目設置中“測試用例自定義ID” 開關開啟時ID為必填項",
import_tip1: "項目設置中「測試用例自定義ID」 開關開啟時ID為必填項",
import_tip2: "導入更新時ID為必填項",
},
export: {
@ -1731,7 +1741,7 @@ export default {
review_progress: "評審進度",
case_count: "用例數量統計",
relevance_case: "關聯用例數量統計",
case_maintenance: "用例維護人分",
case_maintenance: "用例維護人分",
bug_count: "遺留缺陷統計",
case_review: "用例評審",
review_rate: "評審率",
@ -1743,7 +1753,7 @@ export default {
case_size: "用例數",
bug_size: "缺陷數",
passing_rate: "通過率",
percentage: "比"
percentage: "比"
},
plan_view: {
plan: "計劃",
@ -1827,7 +1837,7 @@ export default {
tapd_current_owner: "Tapd 處理人",
zentao_bug_build: "禪道 影響版本",
zentao_bug_assigned: "禪道 處理人",
update_third_party_bugs: "更新第三方平的缺陷",
update_third_party_bugs: "更新第三方平的缺陷",
sync_bugs: "同步缺陷"
},
report: {
@ -1996,7 +2006,7 @@ export default {
modify: "修改配額",
edit_quota_title: "{0}的配額",
workspace_quota_list: "{0}的工作空間配額列表",
unlimited: "無限",
unlimited: "無限",
clean: "清空"
},
schema: {
@ -2017,9 +2027,9 @@ export default {
cancel: "取消",
minLength: "最小長度",
maxLength: "最大長度",
pattern: "正則表達式約束字符串",
exclusiveMinimum: "開啟後,數據必須大於最小值",
exclusiveMaximum: "開啟後,數據必須小於最大值",
pattern: "正則表達式",
exclusiveMinimum: "數據必須大於最小值",
exclusiveMaximum: "數據必須小於最大值",
minimum: "最小值",
maximum: "最大值",
uniqueItems: "開啟後,每個元素都不相同",
@ -2060,7 +2070,7 @@ export default {
add_file: "添加文件",
delimiter: "分隔符",
format: "輸出格式",
quoted_data: "是否允许带引号",
quoted_data: "是否允許帶引號",
},
auth_source: {
delete_prompt: '此操作會刪除認證源,是否繼續?',
@ -2098,11 +2108,11 @@ export default {
after_change: "變更後",
share: "分享",
change_history: "變更歷史",
change_content: "變更容"
change_content: "變更容"
},
plugin: {
title: "插件管理",
script_entry: "脚本执行入口",
script_entry: "腳本執行入口",
plugin_id: "插件ID",
script_view: "查看腳本",
}