How to use getProjectId method in Cypress

Best JavaScript code snippet using cypress

IssueManageApi.js

Source:IssueManageApi.js Github

copy

Full Screen

...20 const issue = {21 ...issueObj,22 };23 const versionId = issue.versionIssueRelDTOList[0].versionId;24 return request.post(`/test/v1/projects/${getProjectId()}/issueFolderRel/testAndRelationship?versionId=${versionId}${folderId ? `&folderId=${folderId}` : ''}&applyType=test`, issue);25}26/**27 *创建评论28 *29 * @export30 * @param {*} commitObj31 * @returns32 */33export function createCommit(commitObj) {34 return request.post(`/agile/v1/projects/${getProjectId()}/issue_comment`, commitObj);35}36/**37 *更新评论38 *39 * @export40 * @param {*} commitObj41 * @returns42 */43export function updateCommit(commitObj) {44 return request.post(`/agile/v1/projects/${getProjectId()}/issue_comment/update`, commitObj);45}46/**47 *删除评论48 *49 * @export50 * @param {*} commitId51 * @returns52 */53export function deleteCommit(commitId) {54 return request.delete(`/agile/v1/projects/${getProjectId()}/issue_comment/${commitId}`);55}56/**57 *获取用例状态列表58 *59 * @export60 * @param {*} statusId61 * @param {*} issueId62 * @param {*} typeId63 * @returns64 */65export function loadStatus(statusId, issueId, typeId) {66 return request.get(67 `/issue/v1/projects/${getProjectId()}/schemes/query_transforms?current_status_id=${statusId}&issue_id=${issueId}&issue_type_id=${typeId}&apply_type=test`,68 );69}70/**71 *获取单个用例详细信息72 *73 * @export74 * @param {*} issueId75 * @returns76 */77export function loadIssue(issueId) {78 return request.get(`/agile/v1/projects/${getProjectId()}/issues/${issueId}`);79}80/**81 *更新用例状态82 *83 * @export84 * @param {*} transformId85 * @param {*} issueId86 * @param {*} objVerNum87 * @returns88 */89export function updateStatus(transformId, issueId, objVerNum) {90 return request.put(`/agile/v1/projects/${getProjectId()}/issues/update_status?transformId=${transformId}&issueId=${issueId}&objectVersionNumber=${objVerNum}&applyType=test`);91}92/**93 *更新用例信息94 *95 * @export96 * @param {*} data97 * @returns98 */99export function updateIssue(data) {100 return request.put(`/agile/v1/projects/${getProjectId()}/issues?applyType=test`, data);101}102/**103 *用例删除104 *105 * @export106 * @param {*} issueId107 * @returns108 */109export function deleteIssue(issueId) {110 return request.delete(`/agile/v1/projects/${getProjectId()}/issues/${issueId}`);111}112/**113 *删除用例关联114 *115 * @export116 * @param {*} issueLinkId117 * @returns118 */119export function deleteLink(issueLinkId) {120 return request.delete(`/agile/v1/projects/${getProjectId()}/issue_links/${issueLinkId}`);121}122/**123 *加载操作日志124 *125 * @export126 * @param {*} issueId127 * @returns128 */129export function loadDatalogs(issueId) {130 return request.get(`agile/v1/projects/${getProjectId()}/data_log?issueId=${issueId}`);131}132/**133 *加载用例以建立关联134 *135 * @export136 * @param {number} [page=0]137 * @param {number} [size=10]138 * @param {*} issueId139 * @param {*} content140 * @returns141 */142export function loadIssuesInLink(page = 0, size = 10, issueId, content) {143 if (issueId && content) {144 return request.get(`/agile/v1/projects/${getProjectId()}/issues/agile/summary?issueId=${issueId}&self=false&content=${content}&page=${page}&size=${size}`);145 } else if (issueId && !content) {146 return request.get(`/agile/v1/projects/${getProjectId()}/issues/agile/summary?issueId=${issueId}&self=false&page=${page}&size=${size}`);147 } else if (!issueId && content) {148 return request.get(`/agile/v1/projects/${getProjectId()}/issues/agile/summary?self=false&content=${content}&page=${page}&size=${size}`);149 } else {150 return request.get(`/agile/v1/projects/${getProjectId()}/issues/agile/summary?self=false&page=${page}&size=${size}`);151 }152}153/**154 *创建用例间的关联155 *156 * @export157 * @param {*} issueId158 * @param {*} issueLinkCreateDTOList159 * @returns160 */161export function createLink(issueId, issueLinkCreateDTOList) {162 return request.post(`/agile/v1/projects/${getProjectId()}/issue_links/${issueId}`, issueLinkCreateDTOList);163}164// 需要更新165/**166 *加载单个用例的关联用例167 *168 * @export169 * @param {*} issueId170 * @returns171 */172export function loadLinkIssues(issueId) {173 return request.get(`/agile/v1/projects/${getProjectId()}/issue_links/${issueId}?no_issue_test=false`);174}175/**176 *获取用例树177 *178 * @export179 * @returns180 */181export function getIssueTree() {182 return request.get(`/test/v1/projects/${getProjectId()}/issueFolder/query`);183}184/**185 *增加文件夹186 *187 * @export188 * @param {*} data189 * @returns190 */191export function addFolder(data) {192 return request.post(`/test/v1/projects/${getProjectId()}/issueFolder`, data);193}194/**195 *修改文件夹196 *197 * @export198 * @param {*} data199 * @returns200 */201export function editFolder(data) {202 return request.put(`/test/v1/projects/${getProjectId()}/issueFolder/update`, data);203}204/**205 *删除文件夹206 *207 * @export208 * @param {*} folderId209 * @returns210 */211export function deleteFolder(folderId) {212 return request.delete(`/test/v1/projects/${getProjectId()}/issueFolder/${folderId}`);213}214/**215 *获取用例的步骤216 *217 * @export218 * @param {*} issueId219 * @returns220 */221export function getIssueSteps(issueId) {222 return request.get(`/test/v1/projects/${getProjectId()}/case/step/query/${issueId}`);223}224/**225 *获取用例的步骤226 *227 * @export228 * @param {*} issueId229 * @returns230 */231export function createIssueStep(testCaseStepDTO) {232 return request.put(`/test/v1/projects/${getProjectId()}/case/step/change`, testCaseStepDTO);233}234/**235 *获取用例关联的执行236 *237 * @export238 * @param {*} issueId239 * @returns240 */241export function getIssueExecutes(issueId) {242 return request.get(`/test/v1/projects/${getProjectId()}/cycle/case/query/issue/${issueId}`);243}244/**245 *获取单个issue,地址栏跳转情况246 *247 * @export248 * @param {number} [page=0]249 * @param {number} [size=10]250 * @param {*} search251 * @param {*} orderField252 * @param {*} orderType253 * @returns254 */255export function getSingleIssues(page = 0, size = 10, search, orderField, orderType) {256 // console.log(search);257 const searchDTO = { ...search };258 // searchDTO.advancedSearchArgs.typeCode = ['issue_test'];259 return request.post(`/test/v1/projects/${getProjectId()}/issueFolderRel/query?page=${page}&size=${size}`, { versionIds: [], searchDTO }, {260 params: {261 sort: `${orderField && orderType ? `${orderField},${orderType}` : ''}`,262 },263 });264}265/**266 *获取所有用例,分页267 *268 * @export269 * @param {number} [page=0]270 * @param {number} [size=10]271 * @param {*} search272 * @param {*} orderField273 * @param {*} orderType274 * @returns275 */276export function getAllIssues(page = 0, size = 10, search, orderField, orderType) {277 // console.log(search);278 const searchDTO = { ...search, otherArgs: search.searchArgs };279 // searchDTO.advancedSearchArgs.typeCode = ['issue_test'];280 return request.post(`/test/v1/projects/${getProjectId()}/issueFolderRel/query?page=${page}&size=${size}`, { versionIds: [], searchDTO: search }, {281 params: {282 sort: `${orderField && orderType ? `${orderField},${orderType}` : ''}`,283 },284 });285}286/**287 *获取一个/多个版本内的用例288 *289 * @export290 * @param {*} versionIds291 * @param {number} [page=0]292 * @param {number} [size=10]293 * @param {*} search294 * @param {*} orderField295 * @param {*} orderType296 * @returns297 */298export function getIssuesByVersion(versionIds, page = 0, size = 10, search, orderField, orderType) {299 const searchDTO = { ...search, otherArgs: search.searchArgs };300 // searchDTO.advancedSearchArgs.typeCode = ['issue_test'];301 return request.post(`/test/v1/projects/${getProjectId()}/issueFolderRel/query?page=${page}&size=${size}`, { versionIds, searchDTO: search }, {302 params: {303 sort: `${orderField && orderType ? `${orderField},${orderType}` : ''}`,304 },305 });306}307/**308 *获取文件夹中的用例309 *310 * @export311 * @param {*} folderId312 * @param {number} [page=0]313 * @param {number} [size=10]314 * @param {*} search315 * @param {*} orderField316 * @param {*} orderType317 * @returns318 */319export function getIssuesByFolder(folderId, page = 0, size = 10, search, orderField, orderType) {320 const searchDTO = { ...search, otherArgs: search.searchArgs };321 // searchDTO.advancedSearchArgs.typeCode = ['issue_test'];322 return request.post(`/test/v1/projects/${getProjectId()}/issueFolderRel/query?folderId=${folderId}&page=${page}&size=${size}`, { versionIds: [], searchDTO: search }, {323 params: {324 sort: `${orderField && orderType ? `${orderField},${orderType}` : ''}`,325 },326 });327}328/**329 *通过issueid换取issue信息330 *331 * @export332 * @param {*} versionId333 * @param {*} folderId334 * @param {*} ids335 * @returns336 */337export function getIssuesByIds(versionId, folderId, ids) {338 return request.post(`/test/v1/projects/${getProjectId()}/issueFolderRel/query/by/issueId${versionId ? `?versionId=${versionId}` : ''}${folderId ? `&folderId=${folderId}` : ''}`, ids);339}340/**341 *用例移动342 *343 * @export344 * @param {*} versionId345 * @param {*} folderId346 * @param {*} issueLinks347 * @returns348 */349export function moveIssues(versionId, folderId, issueLinks) {350 return request.put(`/test/v1/projects/${getProjectId()}/issueFolderRel/move?versionId=${versionId}&folderId=${folderId}`, issueLinks);351}352/**353 *用例克隆354 *355 * @export356 * @param {*} versionId357 * @param {*} folderId358 * @param {*} issueLinks359 * @returns360 */361export function copyIssues(versionId, folderId, issueLinks) {362 return request.put(`/test/v1/projects/${getProjectId()}/issueFolderRel/copy?versionId=${versionId}&folderId=${folderId}`, issueLinks);363}364/**365 *文件夹移动366 *367 * @export368 * @param {*} data369 * @returns370 */371export function moveFolders(data) {372 return request.put(`/test/v1/projects/${getProjectId()}/issueFolder/move`, data);373}374/**375 *文件夹克隆376 *377 * @export378 * @param {*} data379 * @param {*} versionId380 * @returns381 */382export function copyFolders(data, versionId) {383 const folderIds = data.map(item => item.folderId);384 return request.put(`/test/v1/projects/${getProjectId()}/issueFolder/copy?versionId=${versionId}`, folderIds);385}386/**387 *获取版本内的所有文件夹388 *389 * @export390 * @param {*} versionId391 * @returns392 */393export function getFoldersByVersion(versionId) {394 return request.get(`/test/v1/projects/${getProjectId()}/issueFolder/query/all${versionId ? `?versionId=${versionId}` : ''}`);395}396/**397 *版本上的同步398 *399 * @export400 * @param {*} versionId401 * @returns402 */403export function syncFoldersInVersion(versionId) {404 // cycleId || versionId405 return request.post(`/test/v1/projects/${getProjectId()}/cycle/synchro/folder/all/in/version/${versionId}`);406}407/**408 *循环上的同步409 *410 * @export411 * @param {*} cycleId412 * @returns413 */414export function syncFoldersInCycle(cycleId) {415 // cycleId || versionId416 return request.post(`/test/v1/projects/${getProjectId()}/cycle/synchro/folder/all/in/cycle/${cycleId}`);417}418/**419 *文件夹同步420 *421 * @export422 * @param {*} folderId423 * @param {*} cycleId424 * @returns425 */426export function syncFolder(folderId, cycleId) {427 return request.post(`/test/v1/projects/${getProjectId()}/cycle/synchro/folder/${folderId}/in/${cycleId}`);428}429/**430 *单个用例克隆自身431 *432 * @export433 * @param {*} issueId434 * @param {*} copyConditionDTO435 * @returns436 */437export function cloneIssue(issueId, copyConditionDTO) {438 return request.put(`/test/v1/projects/${getProjectId()}/issueFolderRel/copy/issue/${issueId}`, copyConditionDTO);439}440/**441 *所有用例导出442 *443 * @export444 * @returns445 */446export function exportIssues() {447 return request.get(`/test/v1/projects/${getProjectId()}/case/download/excel`);448}449/**450 *版本下的用例导出451 *452 * @export453 * @param {*} versionId454 * @returns455 */456export function exportIssuesFromVersion(versionId) {457 return request.get(`/test/v1/projects/${getProjectId()}/case/download/excel/version?versionId=${versionId}`);458}459/**460 *文件夹下的用例导出461 *462 * @export463 * @param {*} folderId464 * @returns465 */466export function exportIssuesFromFolder(folderId) {467 return request.get(`/test/v1/projects/${getProjectId()}/case/download/excel/folder?folderId=${folderId}&userId=${AppState.userInfo.id}`);468}469/**470 *下载导入模板471 *472 * @export473 * @returns474 */475export function downloadTemplate() {476 return request.get(`/test/v1/projects/${getProjectId()}/case/download/excel/import_template`, { responseType: 'arraybuffer' });477}478/**479 *获取导出历史480 *481 * @export482 * @returns483 */484export function getExportList() {485 return request.get(`/test/v1/projects/${getProjectId()}/test/fileload/history/issue`);486}487/**488 *导出失败重试489 *490 * @export491 * @param {*} historyId492 * @returns493 */494export function exportRetry(historyId) {495 return request.get(`/test/v1/projects/${getProjectId()}/case/download/excel/fail?historyId=${historyId}`);496}497/**498 *获取导入历史499 *500 * @export501 * @returns502 */503export function getImportHistory() {504 return request.get(`/test/v1/projects/${getProjectId()}/test/fileload/history/latest`);505}506/**507 * 取消本次导入508 *509 * @export510 * @param {*} historyId511 * @returns512 */513export function cancelImport(historyId) {514 return request.put(`/test/v1/projects/${getProjectId()}/test/fileload/history/cancel?historyId=${historyId}`);515}516/**517 * 克隆一个步骤518 *519 * @export520 * @param {*} data521 * @returns522 */523export function cloneStep(data) {524 return request.post(`/test/v1/projects/${getProjectId()}/case/step/clone`, data);525}526/**527 * 更新一个步骤528 *529 * @export530 * @param {*} data531 * @returns532 */533export function updateStep(data) {534 return request.put(`/test/v1/projects/${getProjectId()}/case/step/change`, data);535}536/**537 * 删除一个步骤538 *539 * @export540 * @param {*} data541 * @returns542 */543export function deleteStep(data) {544 return request.delete(`/test/v1/projects/${getProjectId()}/case/step`, data);...

Full Screen

Full Screen

nav.js

Source:nav.js Github

copy

Full Screen

1import { getProjectId, getClusterId, bulkAdd } from 'ui/utils/navigation-tree';2import { get } from '@ember/object';3const rootNav = [4 // Project5 {6 scope: 'project',7 id: 'infra',8 localizedLabel: 'nav.infra.tab',9 ctx: [getProjectId],10 submenu: [11 {12 id: 'containers',13 localizedLabel: 'nav.containers.tab',14 route: 'authenticated.project.index',15 ctx: [getProjectId],16 resource: ['workload', 'ingress', 'service'],17 resourceScope: 'project',18 currentWhen: [19 'containers',20 'workload',21 'ingresses',22 'authenticated.project.dns',23 'volumes',24 ],25 },26 {27 id: 'hpa',28 localizedLabel: 'nav.infra.hpa',29 route: 'authenticated.project.hpa',30 ctx: [getProjectId],31 resource: ['horizontalpodautoscaler'],32 resourceScope: 'project',33 },34 {35 id: 'pipelines',36 localizedLabel: 'nav.infra.pipelines',37 route: 'authenticated.project.pipeline.pipelines',38 ctx: [getProjectId],39 resource: [],40 resourceScope: 'project',41 },42 {43 id: 'istio',44 localizedLabel: 'nav.tools.istio',45 route: 'authenticated.project.istio.index',46 ctx: [getProjectId],47 resource: [],48 resourceScope: 'project',49 currentWhen: [50 'authenticated.project.istio.project-istio',51 ],52 },53 {54 id: 'infra-secrets',55 localizedLabel: 'nav.infra.secrets',56 route: 'authenticated.project.secrets',57 ctx: [getProjectId],58 resource: ['namespacedsecret', 'secret', 'dockercredential', 'certificate'],59 resourceScope: 'project',60 currentWhen: [61 'authenticated.project.certificates',62 'authenticated.project.registries',63 'authenticated.project.secrets',64 ],65 },66 {67 id: 'infra-config-maps',68 localizedLabel: 'nav.infra.configMaps',69 route: 'authenticated.project.config-maps',70 ctx: [getProjectId],71 resource: ['configmap'],72 resourceScope: 'project',73 },74 ],75 },76 {77 scope: 'project',78 id: 'project-apps',79 localizedLabel: 'nav.apps.tab',80 route: 'apps-tab',81 ctx: [getProjectId],82 resource: ['app'],83 resourceScope: 'project',84 },85 {86 scope: 'project',87 id: 'namespaces',88 localizedLabel: 'nav.project.namespaces',89 route: 'authenticated.project.ns.index',90 ctx: [getProjectId],91 resource: ['namespace'],92 resourceScope: 'cluster',93 },94 {95 scope: 'project',96 id: 'project-security-roles',97 localizedLabel: 'nav.infra.members',98 route: 'authenticated.project.security.members',99 resource: ['projectroletemplatebinding'],100 resourceScope: 'global',101 ctx: [getProjectId],102 },103 {104 scope: 'project',105 id: 'project-tools',106 localizedLabel: 'nav.tools.tab',107 ctx: [getProjectId],108 resource: [],109 resourceScope: 'global',110 submenu: [111 {112 id: 'tools-alerts',113 localizedLabel: 'nav.tools.alerts',114 route: 'authenticated.project.alert',115 resource: [],116 ctx: [getProjectId],117 resourceScope: 'global',118 },119 {120 id: 'manage-catalogs',121 localizedLabel: 'nav.tools.catalogs',122 route: 'authenticated.project.project-catalogs',123 ctx: [getProjectId],124 resource: ['catalog', 'project-catalog'],125 resourceScope: 'global',126 },127 {128 id: 'tools-logging',129 localizedLabel: 'nav.tools.logging',130 route: 'authenticated.project.logging',131 resourceScope: 'global',132 resource: [],133 ctx: [getProjectId],134 },135 {136 id: 'tools-monitoring',137 localizedLabel: 'nav.tools.monitoring',138 route: 'authenticated.project.monitoring.project-setting',139 resourceScope: 'global',140 resource: [],141 ctx: [getProjectId],142 },143 {144 id: 'tools-pipeline',145 localizedLabel: 'nav.tools.pipeline',146 route: 'authenticated.project.pipeline.settings',147 resource: ['sourcecodeproviderconfig'],148 resourceScope: 'project',149 ctx: [getProjectId],150 },151 ]152 },153 // Cluster154 {155 scope: 'cluster',156 id: 'cluster-k8s',157 localizedLabel: 'nav.cluster.dashboard',158 route: 'authenticated.cluster.monitoring.index',159 ctx: [getClusterId],160 resource: ['node'],161 resourceScope: 'global',162 },163 {164 scope: 'cluster',165 id: 'cluster-nodes',166 localizedLabel: 'nav.cluster.nodes',167 route: 'authenticated.cluster.nodes',168 ctx: [getClusterId],169 resource: ['node'],170 resourceScope: 'global',171 },172 {173 scope: 'cluster',174 id: 'cluster-storage',175 localizedLabel: 'nav.cluster.storage.tab',176 ctx: [getClusterId],177 resource: ['clusterroletemplatebinding'],178 resourceScope: 'global',179 submenu: [180 {181 scope: 'cluster',182 id: 'cluster-storage-volumes',183 localizedLabel: 'nav.cluster.storage.volumes',184 route: 'authenticated.cluster.storage.persistent-volumes.index',185 ctx: [getClusterId],186 resource: ['project'],187 resourceScope: 'global',188 },189 {190 scope: 'cluster',191 id: 'cluster-storage-classes',192 localizedLabel: 'nav.cluster.storage.classes',193 route: 'authenticated.cluster.storage.classes.index',194 ctx: [getClusterId],195 resource: ['project'],196 resourceScope: 'global',197 },198 ]199 },200 {201 scope: 'cluster',202 id: 'cluster-projects',203 localizedLabel: 'nav.cluster.projects',204 route: 'authenticated.cluster.projects.index',205 ctx: [getClusterId],206 resource: ['project'],207 resourceScope: 'global',208 },209 {210 scope: 'cluster',211 id: 'cluster-security-roles',212 localizedLabel: 'nav.cluster.members',213 route: 'authenticated.cluster.security.members.index',214 resource: ['clusterroletemplatebinding'],215 resourceScope: 'global',216 ctx: [getClusterId],217 },218 {219 scope: 'cluster',220 id: 'cluster-tools',221 localizedLabel: 'nav.tools.tab',222 ctx: [getClusterId],223 resource: [],224 resourceScope: 'global',225 submenu: [226 {227 id: 'cluster-tools-alert',228 localizedLabel: 'nav.tools.alerts',229 route: 'authenticated.cluster.alert',230 resourceScope: 'global',231 resource: [],232 ctx: [getClusterId],233 },234 {235 id: 'cluster-tools-backups',236 localizedLabel: 'nav.tools.backups',237 route: 'authenticated.cluster.backups',238 resourceScope: 'global',239 resource: ['etcdbackup'],240 ctx: [getClusterId],241 condition() {242 return get(this, 'cluster.rancherKubernetesEngineConfig')243 }244 },245 {246 scope: 'cluster',247 id: 'cluster-catalogs',248 localizedLabel: 'nav.admin.catalogs',249 route: 'authenticated.cluster.cluster-catalogs',250 ctx: [getClusterId],251 resource: ['catalog', 'cluster-catalog'],252 resourceScope: 'global',253 },254 {255 id: 'cluster-tools-notifiers',256 localizedLabel: 'nav.tools.notifiers',257 route: 'authenticated.cluster.notifier',258 resourceScope: 'global',259 resource: [],260 ctx: [getClusterId],261 },262 {263 id: 'cluster-tools-logging',264 localizedLabel: 'nav.tools.logging',265 route: 'authenticated.cluster.logging',266 resourceScope: 'global',267 resource: [],268 ctx: [getClusterId],269 },270 {271 id: 'cluster-tools-monitoring',272 localizedLabel: 'nav.tools.monitoring',273 route: 'authenticated.cluster.monitoring.cluster-setting',274 resourceScope: 'global',275 resource: [],276 ctx: [getClusterId],277 },278 {279 id: 'cluster-tools-istio',280 localizedLabel: 'nav.tools.istio',281 route: 'authenticated.cluster.istio.cluster-setting',282 resourceScope: 'global',283 resource: [],284 ctx: [getClusterId],285 },286 {287 id: 'cluster-tools-cis-scan',288 localizedLabel: 'nav.tools.cisScans',289 route: 'authenticated.cluster.cis/scan',290 resourceScope: 'global',291 resource: [],292 ctx: [getClusterId],293 },294 ],295 },296 // Global297 {298 scope: 'global',299 id: 'global-clusters',300 localizedLabel: 'nav.admin.clusters.tab',301 route: 'global-admin.clusters',302 resource: ['cluster'],303 resourceScope: 'global',304 },305 {306 scope: 'global',307 id: 'multi-cluster-apps',308 localizedLabel: 'nav.admin.multiClusterApps',309 route: 'global-admin.multi-cluster-apps',310 resource: ['multiclusterapp'],311 resourceScope: 'global',312 },313 {314 scope: 'global',315 id: 'global-settings',316 localizedLabel: 'nav.settings.tab',317 route: 'global-admin.settings.advanced',318 resourceScope: 'global',319 },320 {321 scope: 'global',322 id: 'global-security',323 localizedLabel: 'nav.admin.security.tab',324 submenu: [325 {326 scope: 'global',327 id: 'global-accounts',328 localizedLabel: 'nav.admin.security.accounts',329 route: 'global-admin.security.accounts.users',330 resource: ['user'],331 resourceScope: 'global',332 },333 {334 scope: 'global',335 id: 'global-group-accounts',336 localizedLabel: 'nav.admin.security.groupAccounts',337 route: 'global-admin.security.accounts.groups',338 resource: ['globalrolebinding'],339 resourceScope: 'global',340 },341 {342 id: 'global-security-roles',343 localizedLabel: 'nav.admin.security.roles',344 route: 'global-admin.security.roles.index',345 resource: ['roletemplate'],346 resourceScope: 'global',347 },348 {349 id: 'global-security-roles',350 localizedLabel: 'nav.admin.security.podSecurityPolicies',351 route: 'global-admin.security.policies',352 resource: ['podsecuritypolicytemplate'],353 resourceScope: 'global',354 },355 {356 id: 'global-security-authentication',357 localizedLabel: 'nav.admin.security.authentication',358 route: 'global-admin.security.authentication',359 condition() {360 const authConfigs = this.get('globalStore').all('authConfig');361 return authConfigs.get('length') > 0;362 }363 },364 ],365 },366 {367 scope: 'global',368 id: 'global-tools',369 localizedLabel: 'nav.tools.tab',370 submenu: [371 {372 scope: 'global',373 id: 'global-catalogs',374 localizedLabel: 'nav.admin.catalogs',375 route: 'global-admin.catalog',376 resource: ['catalog'],377 resourceScope: 'global',378 },379 {380 scope: 'global',381 id: 'nodes-node-drivers',382 localizedLabel: 'nav.admin.drivers',383 route: 'nodes.custom-drivers',384 resource: ['nodedriver', 'kontainerdriver'],385 resourceScope: 'global',386 },387 {388 id: 'global-dns-entries',389 localizedLabel: 'nav.admin.globalDnsEntries',390 route: 'global-admin.global-dns.entries',391 resource: ['globaldns'],392 resourceScope: 'global',393 },394 {395 id: 'global-dns-providers',396 localizedLabel: 'nav.admin.globalDnsProviders',397 route: 'global-admin.global-dns.providers',398 resource: ['globaldnsprovider'],399 resourceScope: 'global',400 },401 {402 id: 'global-monitoring',403 localizedLabel: 'nav.admin.globalMonitoring',404 route: 'global-admin.global-monitoring',405 resourceScope: 'global',406 condition() {407 return !!get(this, 'access.admin');408 }409 },410 // {411 // id: 'global-registry',412 // localizedLabel: 'nav.admin.globalRegistry',413 // route: 'global-admin.global-registry',414 // // There is no schema for global registry. But we can use global dns to check if it is a HA env.415 // resource: ['globaldns'],416 // resourceScope: 'global',417 // },418 {419 id: 'rke-template',420 localizedLabel: 'nav.admin.clusters.rkeTemplate',421 route: 'global-admin.cluster-templates',422 resource: ['clustertemplate'],423 resourceScope: 'global',424 },425 ],426 },427// {428// scope: 'global',429// id: 'global-advanced',430// localizedLabel: 'nav.admin.settings.advanced',431// route: 'global-admin.settings.advanced',432// disabled: true,433// },434]435export function initialize(/* appInstance*/) {436 bulkAdd(rootNav);437}438export default {439 name: 'nav',440 initialize,441 after: 'store',...

Full Screen

Full Screen

navigation-tree.js

Source:navigation-tree.js Github

copy

Full Screen

1import Ember from 'ember';2import C from 'ui/utils/constants';3import { getCatalogNames } from 'ui/utils/parse-catalog-setting';4import { tagChoices } from 'ui/models/stack';5import { uniqKeys } from 'ui/utils/util';6// Useful context/condition shortcuts7export const getProjectId = function() { return this.get('projectId'); };8export const getNamespaceId = function() { return this.get('namespaceId'); };9export const k8sReady = function() { return this.get('kubernetesReady'); };10export const k8sNotReady = function() { return !this.get('kubernetesReady'); };11export const swarmReady = function() { return this.get('swarmReady'); };12export const swarmNotReady = function() { return !this.get('swarmReady'); };13export const mesosReady = function() { return this.get('mesosReady'); };14export const mesosNotReady = function() { return !this.get('mesosReady'); };15export const isOwner = function() { return this.get('isOwner'); };16/* Tree item options17 {18 id: 'str' (identifier to allow removal... should be unique)19 localizedLabel: 'i18n key', (or function that returns one)20 label: 'Displayed unlocalized label', (or function that returns string)21 icon: 'icon icon-something',22 condition: function() {23 // return true if this item should be displayed24 // condition can depend on anything page-header/component.js shouldUpdateNavTree() depends on25 }26 alertRoute: 'target.route.path', // as in link-to27 alertCondition: function() {28 // return true if the alert (!) icon should be displayed29 // can depend on anything page-header/component.js shouldUpdateNavTree() depends on30 }31 target: '_blank', (for url only)32 route: 'target.route.path', // as in link-to33 ctx: ['values', 'asContextToRoute', orFunctionThatReturnsValue, anotherFunction]34 queryParams: {a: 'hello', b: 'world'],35 moreCurrentWhen: ['additional.routes','for.current-when'],36 submenu: [37 // Another tree item (only one level of submenu supported, no arbitrary depth nesting)38 {...},39 {...}40 ]41 },42*/43const navTree = [44 // Kubernetes45 {46 id: 'k8s',47 localizedLabel: 'nav.k8s.tab',48 route: 'k8s-tab',49 ctx: [getProjectId],50 condition: function() { return this.get('hasKubernetes'); },51 submenu: [52 {53 id: 'k8s-notready',54 icon: 'icon icon-spinner icon-spin',55 localizedLabel: 'nav.notReady',56 condition: k8sNotReady,57 },58 {59 id: 'k8s-dashboard',60 localizedLabel: 'nav.k8s.dashboard',61 icon: 'icon icon-kubernetes',62 route: 'k8s-tab.dashboard',63 ctx: [getProjectId],64 condition: k8sReady,65 },66 {67 id: 'k8s-cli',68 localizedLabel: 'nav.k8s.cli',69 icon: 'icon icon-terminal',70 route: 'k8s-tab.kubectl',71 ctx: [getProjectId],72 condition: k8sReady,73 },74 {75 id: 'k8s-system',76 localizedLabel: 'nav.k8s.system',77 icon: 'icon icon-network',78 route: 'stacks',79 condition: isOwner,80 ctx: [getProjectId],81 queryParams: {which: C.EXTERNAL_ID.KIND_NOT_ORCHESTRATION},82 },83 ],84 },85 // Swarm86 {87 id: 'swarm',88 localizedLabel: 'nav.swarm.tab',89 condition: function() { return this.get('hasProject') && this.get('hasSwarm'); },90 route: 'swarm-tab',91 ctx: [getProjectId],92 moreCurrentWhen: ['stacks'],93 submenu: [94 {95 id: 'swarm-cli',96 localizedLabel: 'nav.swarm.cli',97 icon: 'icon icon-terminal',98 route: 'swarm-tab.console',99 ctx: [getProjectId],100 condition: swarmReady,101 },102 {103 id: 'swarm-notready',104 icon: 'icon icon-spinner icon-spin',105 localizedLabel: 'nav.notReady',106 condition: swarmNotReady,107 },108 {109 id: 'swarm-system',110 localizedLabel: 'nav.swarm.system',111 icon: 'icon icon-network',112 route: 'stacks',113 condition: isOwner,114 ctx: [getProjectId],115 queryParams: {which: C.EXTERNAL_ID.KIND_NOT_ORCHESTRATION},116 },117 ]118 },119 // Mesos120 {121 id: 'mesos',122 localizedLabel: 'nav.mesos.tab',123 condition: function() { return this.get('hasProject') && this.get('hasMesos'); },124 route: 'mesos-tab',125 ctx: [getProjectId],126 submenu: [127 {128 id: 'mesos-web',129 localizedLabel: 'nav.mesos.web',130 icon: 'icon icon-link',131 route: 'mesos-tab.index',132 ctx: [getProjectId],133 condition: mesosReady,134 },135 {136 id: 'mesos-notready',137 icon: 'icon icon-spinner icon-spin',138 localizedLabel: 'nav.notReady',139 condition: mesosNotReady,140 },141 {142 id: 'mesos-system',143 localizedLabel: 'nav.mesos.system',144 icon: 'icon icon-network',145 route: 'stacks',146 condition: isOwner,147 ctx: [getProjectId],148 queryParams: {which: C.EXTERNAL_ID.KIND_NOT_ORCHESTRATION},149 },150 ],151 },152 // Cattle153 {154 id: 'cattle',155 localizedLabel: 'nav.cattle.tab',156 route: 'stacks',157 queryParams: {which: C.EXTERNAL_ID.KIND_USER, tags: ''},158 ctx: [getProjectId],159 condition: function() { return this.get('hasProject') && !this.get('hasKubernetes') && !this.get('hasSwarm') && !this.get('hasMesos'); },160 submenu: getStacksSubtree,161 },162 // Catalog163 {164 id: 'catalog',165 localizedLabel: 'nav.catalog.tab',166 route: 'catalog-tab',167 queryParams: {catalogId: 'all'},168 ctx: [getProjectId],169 condition: function() {170 return this.get('hasProject') &&171 this.get(`settings.${C.SETTING.CATALOG_URL}`) &&172 !this.get('hasKubernetes') &&173 !this.get('hasSwarm');174 },175 submenu: getCatalogSubtree,176 },177 // Infrastructure178 {179 id: 'infra',180 localizedLabel: 'nav.infra.tab',181 route: 'infrastructure-tab',182 ctx: [getProjectId],183 condition: function() { return this.get('hasProject'); },184 submenu: [185 {186 id: 'infra-hosts',187 localizedLabel: 'nav.infra.hosts',188 icon: 'icon icon-host',189 route: 'hosts',190 ctx: [getProjectId],191 },192 {193 id: 'infra-containers',194 localizedLabel: 'nav.infra.containers',195 icon: 'icon icon-box',196 route: 'containers',197 ctx: [getProjectId],198 },199 {200 id: 'infra-storagepools',201 localizedLabel: 'nav.infra.storagePage',202 icon: 'icon icon-hdd',203 route: 'storagepools',204 ctx: [getProjectId],205 },206 {207 id: 'infra-secrets',208 localizedLabel: 'nav.infra.secrets',209 icon: 'icon icon-secrets',210 route: 'secrets',211 ctx: [getProjectId],212 },213 /*214 {215 id: 'infra-backuptargets',216 localizedLabel: 'nav.infra.backupTarget',217 icon: 'icon icon-target',218 route: 'backuptargets',219 ctx: [getProjectId],220 condition: function() { return this.get('hasVm'); },221 },222 */223 {224 id: 'infra-certificates',225 localizedLabel: 'nav.infra.certificates',226 icon: 'icon icon-certificate',227 route: 'certificates',228 ctx: [getProjectId],229 },230 {231 id: 'infra-registries',232 localizedLabel: 'nav.infra.registries',233 icon: 'icon icon-database',234 route: 'registries',235 ctx: [getProjectId],236 },237 ],238 },239 // Admin240 {241 id: 'admin',242 localizedLabel: 'nav.admin.tab',243 route: 'admin-tab',244 condition: function() { return this.get('isAdmin'); },245 alertRoute: 'admin-tab.auth',246 alertCondition: function() {247 return !this.get('access.enabled') && this.get('prefs.'+C.PREFS.ACCESS_WARNING) !== false;248 },249 submenu: [250 {251 id: 'admin-audit',252 localizedLabel: 'nav.admin.audit',253 icon: 'icon icon-folder-open',254 route: 'admin-tab.audit-logs',255 },256 {257 id: 'admin-accounts',258 localizedLabel: 'nav.admin.accounts',259 icon: 'icon icon-users',260 route: 'admin-tab.accounts',261 },262 {263 id: 'admin-processes',264 localizedLabel: 'nav.admin.processes',265 icon: 'icon icon-processes',266 route: 'admin-tab.processes',267 },268 {269 divider: true270 },271 {272 id: 'admin-ha',273 localizedLabel: 'nav.admin.ha',274 icon: 'icon icon-umbrella',275 route: 'admin-tab.ha',276 },277 {278 id: 'admin-access',279 localizedLabel: 'nav.admin.access',280 icon: 'icon icon-key',281 route: 'admin-tab.auth',282 },283 {284 id: 'admin-machine',285 localizedLabel: 'nav.admin.machine',286 icon: 'icon icon-host',287 route: 'admin-tab.machine',288 },289 {290 id: 'admin-settings',291 localizedLabel: 'nav.admin.settings',292 icon: 'icon icon-network',293 route: 'admin-tab.settings',294 },295 ],296 },297 // API298 {299 id: 'api',300 localizedLabel: 'nav.api.tab',301 icon: 'icon icon-terminal',302 route: 'authenticated.project.api.keys',303 ctx: [getProjectId],304 condition: function() { return this.get('hasProject'); },305 submenu: [306 {307 id: 'api-keys',308 localizedLabel: 'nav.api.keys',309 icon: 'icon icon-key',310 route: 'authenticated.project.api.keys',311 ctx: [getProjectId],312 },313 {314 id: 'api-hooks',315 localizedLabel: 'nav.api.hooks',316 icon: 'icon icon-link',317 route: 'authenticated.project.api.hooks',318 ctx: [getProjectId],319 },320 ],321 },322];323export function addItem(opt) {324 navTree.pushObject(opt);325}326export function removeId(id) {327 for ( let i = navTree.length-1 ; i >= 0 ; i-- )328 {329 if ( navTree[i].id === id ) {330 navTree.removeAt(i);331 } else if ( navTree[i].submenu && Ember.isArray(navTree[i].submenu) ) {332 let sub = navTree[i].submenu;333 for ( var j = sub.length-1 ; j >= 0 ; j-- )334 {335 if ( sub[j].id === id ) {336 sub.removeAt(j);337 }338 }339 }340 }341}342export function get() {343 return Ember.copy(navTree,true);344}345function getStacksSubtree() {346 let out = [347 {348 id: 'cattle-all',349 localizedLabel: 'nav.cattle.all',350 icon: 'icon icon-globe',351 route: 'stacks',352 ctx: [getProjectId],353 queryParams: {which: C.EXTERNAL_ID.KIND_ALL, tags: ''},354 },355 { divider: true },356 {357 id: 'cattle-user',358 localizedLabel: 'nav.cattle.user',359 icon: 'icon icon-layers',360 route: 'stacks',361 ctx: [getProjectId],362 queryParams: {which: C.EXTERNAL_ID.KIND_USER, tags: ''},363 condition: isOwner,364 },365 {366 id: 'cattle-infra',367 localizedLabel: 'nav.cattle.system',368 icon: 'icon icon-gear',369 route: 'stacks',370 ctx: [getProjectId],371 condition: isOwner,372 queryParams: {which: C.EXTERNAL_ID.KIND_INFRA, tags: ''},373 }374 ];375 let stacks = this.get('store').all('stack');376 let choices = uniqKeys(tagChoices(stacks)).sort();377 if ( choices.length ) {378 out.push({divider: true});379 choices.forEach((choice) => {380 out.push({381 id: 'cattle-tag-'+choice,382 label: choice,383 icon: 'icon icon-tag',384 route: 'stacks',385 ctx: [getProjectId],386 condition: isOwner,387 queryParams: {which: C.EXTERNAL_ID.KIND_ALL, tags: choice},388 });389 });390 }391 return out;392}393function getCatalogSubtree() {394 let repos = getCatalogNames(this.get(`settings.${C.SETTING.CATALOG_URL}`));395 let showAll = repos.length > 1;396 let out = [];397 if ( showAll ) {398 out.push({399 id: 'catalog-all',400 localizedLabel: 'nav.catalog.all',401 icon: 'icon icon-globe',402 route: 'catalog-tab',403 ctx: [getProjectId],404 queryParams: {catalogId: 'all'}405 });406 out.push({divider: true});407 }408 if (repos.indexOf(C.CATALOG.LIBRARY_KEY) >= 0 ) {409 repos.removeObject(C.CATALOG.LIBRARY_KEY);410 out.push({411 id: 'catalog-library',412 localizedLabel: 'nav.catalog.library',413 icon: 'icon icon-catalog',414 route: 'catalog-tab',415 ctx: [getProjectId],416 queryParams: {catalogId: 'library'}417 });418 }419 if (repos.indexOf(C.CATALOG.COMMUNITY_KEY) >= 0 ) {420 repos.removeObject(C.CATALOG.COMMUNITY_KEY);421 out.push({422 id: 'catalog-community',423 localizedLabel: 'nav.catalog.community',424 icon: 'icon icon-users',425 route: 'catalog-tab',426 ctx: [getProjectId],427 queryParams: {catalogId: 'community'}428 });429 }430 if ( out.length > 2 ) {431 out.push({divider: true});432 }433 repos.forEach((repo) => {434 out.push({435 id: 'catalog-'+repo,436 label: repo,437 icon: 'icon icon-user',438 route: 'catalog-tab',439 ctx: [getProjectId],440 queryParams: {catalogId: repo}441 });442 });443 if ( out.length === 1 ) {444 return [];445 } else {446 return out;447 }...

Full Screen

Full Screen

TestPlanApi.js

Source:TestPlanApi.js Github

copy

Full Screen

...7 * @param {*} testPlanStatus8 * @returns9 */10export function getPlanTree(testPlanStatus) {11 return request.get(`/test/v1/projects/${getProjectId()}/plan/tree?status_code=${testPlanStatus}`);12}13export function getPlanTreeById(planId) {14 return request.get(`/test/v1/projects/${getProjectId()}/cycle/tree?plan_id=${planId}`);15}16export function createPlan(data) {17 return request.post(`/test/v1/projects/${getProjectId()}/plan`, data);18}19export function clonePlan(planId) {20 return request.post(`/test/v1/projects/${getProjectId()}/plan/${planId}/clone`);21}22export function getPlan(planId) {23 return request.get(`/test/v1/projects/${getProjectId()}/plan/${planId}/query`);24}25export function editPlan(data) {26 return request.put(`/test/v1/projects/${getProjectId()}/plan`, data);27}28export function deletePlan(planId) {29 return request.delete(`/test/v1/projects/${getProjectId()}/plan/${planId}/delete`);30}31export function addFolder(data) {32 return request.post(`/test/v1/projects/${getProjectId()}/cycle`, data);33}34export function editFolder(data) {35 return request.put(`/test/v1/projects/${getProjectId()}/cycle`, data);36}37export function moveFolder(folderIds = [], targetFolderId, lastRank, nextRank) {38 const urlParamStr = queryString.stringify({39 target_cycle_id: targetFolderId && Number(targetFolderId) !== 0 ? targetFolderId : undefined,40 last_moved_cycle_id: folderIds[folderIds.length - 1],41 });42 const requestParam = urlParamStr && urlParamStr !== '' ? `?${urlParamStr}` : '';43 return request.put(`/test/v1/projects/${getProjectId()}/cycle/move${requestParam}`,44 {45 cycleIds: folderIds,46 lastRank,47 nextRank,48 });49}50export function deleteFolder(folderId) {51 return request.delete(`/test/v1/projects/${getProjectId()}/cycle/delete/${folderId}`);52}53export function importIssueToFolder(planId, folderId, data) {54 return request.post(`/test/v1/projects/${getProjectId()}/cycle/case/import?plan_id=${planId}&cycle_id=${folderId}`, { caseSelected: data });55}56/**57 * 根据目录id和计划id获取执行58 */59export function getExecutesByFolder({60 planId, folderId, search, orderField, orderType, current, pageSize,61}) {62 return request.post(`/test/v1/projects/${getProjectId()}/cycle/case/query/caseList?cycle_id=${planId !== folderId ? folderId : ''}&plan_id=${planId}&page=${current}&size=${pageSize}`, search, {63 params: {64 sort: `${orderField && orderType ? `${orderField},${orderType}` : ''}`,65 },66 });67}68/**69 * 通过测试计划获取统计状态70 *71 * @export72 * @param {*} planId73 * @returns74 */75export function getStatusByFolder({ planId, folderId }) {76 return request.get(`/test/v1/projects/${getProjectId()}/cycle/case/query/status?cycle_id=${planId !== folderId ? folderId : ''}&plan_id=${planId}`);77}78/**79 * 获取计划详情80 *81 * @export82 * @param {*} planId83 * @returns84 */85export function getPlanDetail(planId) {86 return request.get(`/test/v1/projects/${getProjectId()}/plan/${planId}/info`);87}88/**89 * 批量给执行指定执行人90 *91 * @export92 * @param {*} executeIds93 * @param {*} assignUserId94 * @returns95 */96export function executesAssignTo(executeIds, assignUserId) {97 return request.post(`/test/v1/projects/${getProjectId()}/cycle/case/batchAssign/cycleCase?assign_user_id=${assignUserId}`, executeIds);98}99/**100 * 删除状态101 *102 * @export103 * @param {*} executeId104 * @returns105 */106export function deleteExecute(executeId) {107 return request.delete(`/test/v1/projects/${getProjectId()}/cycle/case?cycleCaseId=${executeId}`);108}109export function updatePlanStatus(updateData) {110 return request.post(`/test/v1/projects/${getProjectId()}/plan/update_status`, updateData);111}112/**113 * 快速通过或快速失败或者给执行排序114 *115 * @export116 * @param {*} data117 * @returns118 */119export function updateExecute(data) {120 return request.put(`/test/v1/projects/${getProjectId()}/cycle/case/cycle_case`, data);121}122/**123 *124 *125 * @export126 * @param {*} executeId127 * @returns128 */129export function getUpdateCompared(executeId) {130 return request.get(`/test/v1/projects/${getProjectId()}/cycle/case/${executeId}/compared`);131}132/**133 * 确认更新,在变更提醒弹框点击确认更新134 *135 * @export136 * @param {*} data137 * @returns138 */139export function comfirmUpdate(data) {140 return request.post(`/test/v1/projects/${getProjectId()}/cycle/case/compared`, data);141}142export function ignoreUpdate(executed) {143 return request.post(`/test/v1/projects/${getProjectId()}/cycle/case/${executed}/ignore/update`, {});144}145export function getPlanList() {146 return request.get(`/test/v1/projects/${getProjectId()}/plan/project_plan`);147}148export function updateFoldRangeDate(isCycle, data) {149 return request.post(`/test/v1/projects/${getProjectId()}/cycle/operate_calendar?isCycle=${isCycle}`, data);150}151/**152 * 按时间排序153 * @param {*} planId154 */155export function getRankByDate(planId) {156 return request.post(`/test//v1/projects/${getProjectId()}/plan/${planId}/order_by_from_date`);157}158export function checkPlanName(name) {159 return request.get(`/test/v1/projects/${getProjectId()}/plan/check_name`, { params: { name } });160}161export function batchRemove(executeIds) {162 return request.delete(`/test/v1/projects/${getProjectId()}/cycle/case/async_batch_delete`, {163 data: executeIds,164 });165}166export function batchAssignFolder(data) {167 return request.put(`/test/v1/projects/${getProjectId()}/cycle/case/assign`, {}, { params: data });168}169export function batchCancelAssignFolder(data) {170 return request.delete(`/test/v1/projects/${getProjectId()}/cycle/case/assign`, { params: data });...

Full Screen

Full Screen

ProjectOverview.js

Source:ProjectOverview.js Github

copy

Full Screen

...39 componentDidMount() {40 if (Object.keys(this.props.projectList).length === 0) {41 this.props.dispatch(getProjects())42 }43 if (this.getProjectId() != null) {44 this.props.dispatch(getImages(this.getProjectId()))45 }46 }47 componentDidUpdate(prevProps, prevState, snapshot) {48 if (this.props.imageList[this.getProjectId()] != null && prevProps.imageList[this.getProjectId()] == null) {49 // incoming images50 this.getProjectImages().forEach(image => {51 this.props.dispatch(getAnnotationForImage(this.getProjectId(), image._id))52 })53 }54 }55 getProjectId() {56 return this.props.match.params.projectId57 }58 getProjectImages() {59 const projectId = this.getProjectId()60 if (this.props.imageList[projectId] == null) {61 return []62 }63 return util.idMapToList(this.props.imageList[projectId])64 }65 toggleShowFileNames() {66 this.setState(oldState => ({67 ...oldState,68 showFileNames: !oldState.showFileNames,69 }))70 }71 render() {72 if (this.getProjectId() == null || this.props.projectList[this.getProjectId()] == null) {73 return null74 }75 return (76 <div>77 <Breadcrumb project={this.props.projectList[this.getProjectId()]} />78 <h5 style={mixins.heading}>Upload Image</h5>79 <ImageUploadForm projectId={this.getProjectId()} />80 <h5 style={mixins.heading}>81 <div style={mixins.relative}>82 Images83 <div style={style.fileNameToggle}>84 <input85 type="checkbox"86 id="show-file-names"87 defaultChecked={this.state.showFileNames}88 onChange={this.toggleShowFileNames}89 style={mixins.checkbox}90 />91 <label style={mixins.label} htmlFor="show-file-names">92 Show File Names93 </label>94 </div>95 </div>96 </h5>97 <ImageList98 project={this.props.projectList[this.getProjectId()]}99 images={this.getProjectImages()}100 annotations={this.props.annotationList}101 showFilenames={this.state.showFileNames}102 />103 <h5 style={mixins.heading}>Annotation Types</h5>104 <div style={style.projectSettings}>105 <div>106 <AnnotationTypeList107 projectId={this.getProjectId()}108 annotationTypes={109 this.props.projectList[this.getProjectId()]110 ? this.props.projectList[this.getProjectId()].annotationTypes111 : {}112 }113 />114 </div>115 <div>116 <ProjectSettingsImpex project={this.props.projectList[this.getProjectId()]} />117 </div>118 </div>119 </div>120 )121 }122}...

Full Screen

Full Screen

cycleApi.js

Source:cycleApi.js Github

copy

Full Screen

1import { getProjectId, request } from '../common/utils';2export function getCycleTree(assignedTo) {3 return request.get(`/test/v1/projects/${getProjectId()}/cycle/query${assignedTo ? `?assignedTo=${assignedTo}` : ''}`);4}5export function getCycleTreeByVersionId(versionId) {6 return request.get(`/test/v1/projects/${getProjectId()}/cycle/batch/clone/query/${versionId}`);7}8export function getExecutesByCycleId(pagination, cycleId, filters, type) {9 const { size, page } = pagination;10 const Filters = {11 ...filters || {},12 searchDTO: {13 advancedSearchArgs: {14 statusId: [],15 priorityId: [],16 },17 searchArgs: {18 issueNum: '',19 summary: '',20 },21 },22 };23 if (Filters) {24 Object.keys(filters || {}).forEach((filter) => {25 // console.log(filter, Filters);26 if (['priorityId'].includes(filter)) {27 Filters.searchDTO.advancedSearchArgs[filter] = Filters[filter];28 } else if (['summary'].includes(filter)) {29 Filters.searchDTO.searchArgs[filter] = Filters[filter][0];30 } else {31 Filters[filter] = Filters[filter][0];32 }33 });34 }35 return request.post(`/test/v1/projects/${getProjectId()}/cycle/case/query/cycleId?size=${size}&page=${page}`, {36 cycleId,37 ...Filters,38 });39}40export function addCycle(data) {41 return request.post(`/test/v1/projects/${getProjectId()}/cycle`, data);42}43export function editExecuteDetail(data) {44 return request.post(`/test/v1/projects/${getProjectId()}/cycle/case/update`, data);45}46export function deleteExecute(executeId) {47 return request.delete(`/test/v1/projects/${getProjectId()}/cycle/case?cycleCaseId=${executeId}`);48}49export function deleteCycleOrFolder(cycleId) {50 return request.delete(`/test/v1/projects/${getProjectId()}/cycle/delete/${cycleId}`);51}52export function clone(cycleId, data, type) {53 if (type === 'CLONE_FOLDER') {54 return request.post(`/test/v1/projects/${getProjectId()}/cycle/clone/folder/${cycleId}`, data);55 } else if (type === 'CLONE_CYCLE') {56 return request.post(`/test/v1/projects/${getProjectId()}/cycle/clone/cycle/${cycleId}`, data);57 }58 return request.post(`/test/v1/projects/${getProjectId()}/cycle/clone/folder/${cycleId}`, data);59}60export function batchClone(targetVersionId, data) { 61 return request.post(`/test/v1/projects/${getProjectId()}/cycle/batch/clone/${targetVersionId}`, data);62}63export function getLastCloneData() { 64 return request.get(`/test/v1/projects/${getProjectId()}/cycle/batch/clone/latest`);65}66export function addFolder(data) {67 return request.post(`/test/v1/projects/${getProjectId()}/cycle`, data);68}69/**70 * 修改循环或阶段信息71 * @param {*} data 72 */73export function editFolder(data) {74 return request.put(`/test/v1/projects/${getProjectId()}/cycle`, data);75}76/**77 * 拖动改变日期78 * @param {*} data 79 */80export function editCycleTime(data) {81 // return request.put(`/test/v1/projects/${getProjectId()}/cycle`, data);82 return new Promise((resolve) => {83 setTimeout(() => {84 resolve();85 }, 300);86 });87}88export function exportCycle(cycleId) {89 return request.get(`/test/v1/projects/${getProjectId()}/cycle/case/download/excel/${cycleId}`);90}91export function getCyclesByVersionId(versionId) {92 return request.get(`/test/v1/projects/${getProjectId()}/cycle/get/cycles/all/in/version/${versionId}`);93}94export function getFoldersByCycleId(cycleId) {95 return request.get(`/test/v1/projects/${getProjectId()}/cycle/query/folder/cycleId/${cycleId}`);96}97/**98 *获取导出历史99 *100 * @export101 * @returns102 */103export function getExportList() {104 return request.get(`/test/v1/projects/${getProjectId()}/test/fileload/history/cycle`);105}106export function assignBatch(userId, cycleId) {107 return request.put(`test/v1/projects/${getProjectId()}/cycle/batch/change/cycleCase/assignedTo/${userId}/in/cycle/${cycleId}`);...

Full Screen

Full Screen

knowledgebaseApi.js

Source:knowledgebaseApi.js Github

copy

Full Screen

1import { getProjectId, request, getOrganizationId } from '../common/utils';2// 获取项目知识库3export const getProjectBaseList = () => request.get(`/knowledge/v1/projects/${getProjectId()}/knowledge_base/query/list`);4// 获取组织知识库5export const getOrgBaseList = () => request.get(`/knowledge/v1/organizations/${getOrganizationId()}/knowledge_base/query/list`);6/**7 * 项目层创建知识库8 */9export const createBase = (data) => request.post(`/knowledge/v1/projects/${getProjectId()}/knowledge_base/create`, data);10/**11 * 组织层创建知识库12 * @param {*} data13 */14export const createOrgBase = (data) => request.post(`/knowledge/v1/organizations/${getOrganizationId()}/knowledge_base/create`, data);15/**16 * 组织层设置知识库17 * @param {*} data18 */19export const editBase = (data) => request.put(`/knowledge/v1/projects/${getProjectId()}/knowledge_base/update`, data);20/**21 * 组织层设置知识库22 * @param {*} data23 */24export const editOrgBase = (data) => request.put(`/knowledge/v1/organizations/${getOrganizationId()}/knowledge_base/update`, data);25// 将项目下的知识库或文档移动到回收站26export const moveToBin = (id) => request.put(`/knowledge/v1/projects/${getProjectId()}/knowledge_base/remove_my/${id}`);27// 将组织下的知识库或文档移动到回收站28export const orgMoveToBin = (id) => request.put(`/knowledge/v1/organizations/${getOrganizationId()}/knowledge_base/remove_my/${id}`);29// 判断项目层文档所属知识库是否存在30export const judgeBelongBaseIsExist = (docId) => request.get(`/knowledge/v1/projects/${getProjectId()}/work_space/belong_base_exist/${docId}`);31// 判断组织层文档所属知识库是否存在32export const judgeOrgBelongBaseIsExist = (docId) => request.get(`/knowledge/v1/organizations/${getOrganizationId()}/work_space/belong_base_exist/${docId}`);33// 恢复回收站中的知识库或文档34export const recoverFromBin = (id, type, baseId) => request.put(`/knowledge/v1/projects/${getProjectId()}/recycle/restore/${id}?type=${type}&baseId=${baseId || ''}`);35// 恢复组织层回收站中的知识库或文档36export const recoverOrgFromBin = (id, type, baseId) => request.put(`/knowledge/v1/organizations/${getOrganizationId()}/recycle/restore/${id}?type=${type}&baseId=${baseId || ''}`);37// 删除回收站的知识库或文档38export const deleteDocOrBase = (id, type) => request.delete(`/knowledge/v1/projects/${getProjectId()}/recycle/delete/${id}?type=${type}`);39// 删除组织层回收站的知识库或文档40export const deleteOrgDocOrBase = (id, type) => request.delete(`/knowledge/v1/organizations/${getOrganizationId()}/recycle/delete/${id}?type=${type}`);41export const getOrgBinList = (data) => request.post(`/knowledge/v1/organizations/${getOrganizationId()}/recycle/page_by_options`, data);42// 获取文档内容43export const getPageInfo = (workSpaceId) => request.get(`/knowledge/v1/projects/${getProjectId()}/work_space/${workSpaceId}`);44// 获取组织层文档内容...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import axios from '@/libs/api.request'2import { getProjectId } from '@/libs/util'3export const getAlarmList = (params) => {4 return axios.request({5 url: `project/${getProjectId()}/api/alarm/config/list`,6 method: 'get',7 params: {8 ...params9 }10 })11}12export const add = (params) => {13 return axios.request({14 url: `project/${getProjectId()}/api/alarm/config/add`,15 method: 'post',16 headers: { 'Content-Type': 'application/json' },17 data: {18 ...params19 }20 })21}22export const remove = (params) => {23 return axios.request({24 url: `project/${getProjectId()}/api/alarm/config/delete`,25 method: 'get',26 params: {27 ...params28 }29 })30}31export const update = (params) => {32 return axios.request({33 url: `project/${getProjectId()}/api/alarm/config/update`,34 method: 'post',35 headers: { 'Content-Type': 'application/json' },36 data: {37 ...params38 }39 })40}41export const getAlarmErrorNameList = () => {42 return axios.request({43 url: `project/${getProjectId()}/api/error/distribution/summary`,44 method: 'get'45 })46}47export const getAlarmLog = (params) => {48 return axios.request({49 url: `project/${getProjectId()}/api/alarm/log`,50 method: 'get',51 params52 })53}54export const getLineAlarmLog = (params) => {55 return axios.request({56 url: `project/${getProjectId()}/api/alarm/log/line`,57 method: 'get',58 params59 })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1context('Actions', () => {2 beforeEach(() => {3 })4 it('.type() - type into a DOM element', () => {5 cy.get('.action-email')6 .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2 it('Gets, types and asserts', function() {3 cy.contains('type').click()4 cy.url().should('include', '/commands/actions')5 cy.get('.action-email')6 .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', () => {2 it('Gets, types and asserts', () => {3 cy.pause()4 cy.contains('type').click()5 cy.url().should('include', '/commands/actions')6 cy.get('.action-email')7 .type('fake@email')8 .should('have.value', 'fake@email')9 })10})11describe('My First Test', () => {12 it('Gets, types and asserts', () => {13 cy.pause()14 cy.contains('type').click()15 cy.url().should('include', '/commands/actions')16 cy.get('.action-email')17 .type('fake@email')18 .should('have.value', 'fake@email')19 cy.log(Cypress.config().projectId)20 })21})22describe('My First Test', () => {23 it('Gets, types and asserts', () => {24 cy.pause()25 cy.contains('type').click()26 cy.url().should('include', '/commands/actions')27 cy.get('.action-email')28 .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Cypress', () => {2 it('is working', () => {3 expect(true).to.equal(true)4 })5 it('getProjectId', () => {6 expect(Cypress.projectId).to.equal('h7v4xj')7 })8})9{10}11describe('Cypress', () => {12 it('is working', () => {13 expect(true).to.equal(true)14 })15 it('getProjectId', () => {16 expect(Cypress.projectId).to.equal('h7v4xj')17 })18})19### `Cypress.config()`20describe('Cypress', () => {21 it('is working', () => {22 expect(true).to.equal(true)23 })24 it('config', () => {25 cy.get('.home-list > :nth-child(1) > a').click()26 cy.contains('type').click()27 cy.url().should('include', '/commands/actions')28 cy.get('.action-email')29 .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test', () => {2 it('Test', () => {3 cy.get('#query-btn').click()4 cy.get('.query-table').should('be.visible')5 })6})7Cypress.Commands.add('getProjectId', () => {8 return Cypress.env('projectId')9})

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful