Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {
observable, action, computed, toJS,
} from 'mobx';
import { store } from '@choerodon/master';
import _ from 'lodash';
import { getParams } from '../common/utils';
import {
getCycle, getCycleDetails, getCycleHistiorys,
} from '../api/ExecuteDetailApi';
import { getStatusList } from '../api/TestStatusApi';
import { getUsers } from '../api/IamApi';
import { getIssueList, getIssuesForDefects } from '../api/agileApi';
@store('ExecuteDetailStore')
class ExecuteDetailStore {
@observable id = null;
@observable issueList = [];
@observable loading = false;
@observable selectLoading = false;
@observable ExecuteDetailSideVisible = true;
@observable userList = [];
// 用户列表
@observable statusList = [];
async function selectFile(e) {
const formdata = new FormData();
const img = e.target.files[0];
formdata.append('file', e.target.files[0]);
try {
const data = await axios.post(
`/file/v1/files?bucket_name=devops-service&file_name=${img.name.split('.')[0]}`,
formdata,
{
header: { 'Content-Type': 'multipart/form-data' },
},
);
if (data) {
record.set('imgUrl', data);
getBase64(formdata.get('file'), (imgUrl) => {
const ele = document.getElementById('img');
ele.style.backgroundImage = `url(${imgUrl})`;
setImgback(imgUrl);
});
}
} catch (err) {
// asfd
queryAppData = (projectId = AppState.currentMenuType.id, type, refersh, isReloadApp) => {
// 已经加载过app数据 只更新对应模块的数据, 除非主动刷新 否则不查询app数据,
if (!isReloadApp && this.appData.length !== 0 && type !== 'CodeManagerBranch') {
refersh && refersh();
return;
}
if (Number(this.preProId) !== Number(projectId)) {
DeploymentPipelineStore.setProRole('app', '');
}
this.setAppData([]);
this.setPreProId(projectId);
this.setLoading(true);
axios.get(`/devops/v1/projects/${projectId}/app_service/list_by_active`)
.then((data) => {
this.setLoading(false);
if (handlePromptError(data)) {
this.setAppData(data);
if (data && data.length) {
if (this.selectedApp) {
if (_.filter(data, ['id', this.selectedApp]).length === 0) {
this.setSelectApp(data[0].id);
}
} else {
this.setSelectApp(data[0].id);
}
refersh && refersh();
} else {
this.setSelectApp(null);
}
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import { asyncRouter, nomatch } from '@choerodon/master';
const CustomStatusHome = asyncRouter(() => import('./CustomStatusHome'));
const CustomStatusIndex = ({ match }) => (
);
export default CustomStatusIndex;
import React from 'react';
import {
Route,
Switch,
} from 'react-router-dom';
import { asyncRouter, nomatch } from '@choerodon/master';
const CreateAutoTest = asyncRouter(() => (import('./CreateAutoTest')));
const AutoTestList = asyncRouter(() => import('./AutoTestList'));
const TestReport = asyncRouter(() => import('./TestReport'));
const TestIndex = ({ match }) => (
);
export default TestIndex;
import React from 'react';
import {
Route,
Switch,
} from 'react-router-dom';
import { asyncRouter, nomatch } from '@choerodon/master';
const CreateAutoTest = asyncRouter(() => (import('./CreateAutoTest')));
const AutoTestList = asyncRouter(() => import('./AutoTestList'));
const TestReport = asyncRouter(() => import('./TestReport'));
const TestIndex = ({ match }) => (
);
export default TestIndex;
import React from 'react';
import {
Route,
Switch,
} from 'react-router-dom';
import { asyncRouter, nomatch } from '@choerodon/master';
const CreateAutoTest = asyncRouter(() => (import('./CreateAutoTest')));
const AutoTestList = asyncRouter(() => import('./AutoTestList'));
const TestReport = asyncRouter(() => import('./TestReport'));
const TestIndex = ({ match }) => (
);
export default TestIndex;
async function checkCode(value) {
const pa = /^[a-z]([-a-z0-9]*[a-z0-9])?$/;
if (value && pa.test(value)) {
try {
const res = await axios.get(`/devops/v1/projects/${projectId}/app_service/check_code?code=${value}`);
if (res && res.failed) {
return formatMessage({ id: 'checkCodeExist' });
} else {
return true;
}
} catch (err) {
return formatMessage({ id: 'checkCodeFailed' });
}
} else {
return formatMessage({ id: 'checkCodeReg' });
}
}
async loadSingleData(projectId, id) {
try {
const res = await axios.get(`/devops/v1/projects/${projectId}/customize_resource/${id}`);
if (handlePromptError(res)) {
this.setSingleData(res);
}
} catch (e) {
Choerodon.handleResponseError(e);
}
},
page: current,
size: pageSize,
instanceId,
version,
params,
service: serviceName,
};
if (columnKey) {
const sorter = [];
sorter.push(columnKey);
if (order === 'asc') {
sorter.push('asc');
}
queryObj.sort = sorter.join(',');
}
return axios.get(`/manager/v1/instances?${querystring.stringify(queryObj)}`);
}