diff --git a/test-result-summary-client/cypress/integration/testInfo.js b/test-result-summary-client/cypress/integration/testInfo.js
index 1dbbbe90..75d73170 100644
--- a/test-result-summary-client/cypress/integration/testInfo.js
+++ b/test-result-summary-client/cypress/integration/testInfo.js
@@ -2,7 +2,7 @@
describe('Integration test for allTestsInfo', () => {
const buildId = '60e60bf5631d857f69d62014';
- const limit = 5;
+ const limit = 1;
const hasChildren = false;
beforeEach(() => {
diff --git a/test-result-summary-client/src/Build/BuildTable.jsx b/test-result-summary-client/src/Build/BuildTable.jsx
index 184921b2..b9c7a95a 100644
--- a/test-result-summary-client/src/Build/BuildTable.jsx
+++ b/test-result-summary-client/src/Build/BuildTable.jsx
@@ -9,369 +9,349 @@ import { fetchData } from '../utils/Utils';
const EditableContext = React.createContext();
const EditableRow = ({ form, index, ...props }) => (
-
-
-
+
+
+
);
const EditableFormRow = Form.create()(EditableRow);
const EditableCell = ({
- editable,
- dataIndex,
- title,
- record,
- index,
- handleSave,
- inputRef,
- children,
- ...restProps
+ editable,
+ dataIndex,
+ title,
+ record,
+ index,
+ handleSave,
+ inputRef,
+ children,
+ ...restProps
}) => {
- const [editing, setEditing] = useState(false);
- const form = useContext(EditableContext);
+ const [editing, setEditing] = useState(false);
+ const form = useContext(EditableContext);
- useEffect(() => {
- if (editing) {
- inputRef.current.focus();
- }
- }, [editing]);
+ useEffect(() => {
+ if (editing) {
+ inputRef.current.focus();
+ }
+ }, [editing]);
- const toggleEdit = () => {
- setEditing(!editing);
- };
+ const toggleEdit = () => {
+ setEditing(!editing);
+ };
- const save = (e) => {
- if (e.key === 'Enter' && e.shiftKey) {
- return;
- }
- form.validateFields((error, values) => {
- if (error && error[e.currentTarget.id]) {
- return;
- }
- toggleEdit();
- handleSave({ ...record, ...values });
- });
- };
+ const save = (e) => {
+ if (e.key === 'Enter' && e.shiftKey) {
+ return;
+ }
+ form.validateFields((error, values) => {
+ if (error && error[e.currentTarget.id]) {
+ return;
+ }
+ toggleEdit();
+ handleSave({ ...record, ...values });
+ });
+ };
- const renderCell = () => {
- return editing ? (
-
- {form.getFieldDecorator(dataIndex, {
- rules: [
- {
- message: `${title} is required.`,
- },
- ],
- initialValue: record[dataIndex],
- })(
-
- )}
-
-
- ) : (
-
- {children}
-
- );
- };
+ const renderCell = () => {
+ return editing ? (
+
+ {form.getFieldDecorator(dataIndex, {
+ rules: [
+ {
+ message: `${title} is required.`,
+ },
+ ],
+ initialValue: record[dataIndex],
+ })(
+
+ )}
+
+
+ ) : (
+
+ {children}
+
+ );
+ };
- return (
-
- {editable ? renderCell() : children}
- |
- );
+ return {editable ? renderCell() : children} | ;
};
const BuildTable = ({ title, buildData }) => {
- const [data, setData] = useState(buildData);
- const inputRef = useRef(null);
+ const [data, setData] = useState(buildData);
+ const inputRef = useRef(null);
- useEffect(() => {
- setData(buildData);
- }, [buildData]);
+ useEffect(() => {
+ setData(buildData);
+ }, [buildData]);
- const handleSave = async (row) => {
- const newData = [...data];
- const index = newData.findIndex((item) => row.key === item.key);
- const item = newData[index];
- newData.splice(index, 1, {
- ...item,
- ...row,
- });
+ const handleSave = async (row) => {
+ const newData = [...data];
+ const index = newData.findIndex((item) => row.key === item.key);
+ const item = newData[index];
+ newData.splice(index, 1, {
+ ...item,
+ ...row,
+ });
- // update comments in database
- await fetchData(
- `/api/updateComments${params({
- _id: row.buildData._id,
- comments: row.comments,
- })}`,
- {
- method: 'get',
- }
- );
- setData(newData);
- };
+ // update comments in database
+ await fetchData(
+ `/api/updateComments${params({
+ _id: row.buildData._id,
+ comments: row.comments,
+ })}`,
+ {
+ method: 'get',
+ }
+ );
+ setData(newData);
+ };
- if (!data) return null;
+ if (!data) return null;
- const components = {
- body: {
- row: EditableFormRow,
- // pass in the ref to the input
- cell: (props) => (
-
- ),
- },
- };
+ const components = {
+ body: {
+ row: EditableFormRow,
+ // pass in the ref to the input
+ cell: (props) => ,
+ },
+ };
- const renderJenkinsBuild = ({
- buildName,
- buildNum,
- buildUrl,
- url,
- } = {}) => {
- // Temporarily support BlueOcean link under folders
- let blueOcean;
- if (
- `${url}`.includes('/jobs') ||
- `${url}`.includes('/build-scripts')
- ) {
- let urls = url.split('/job/');
- let basicUrl = urls.shift();
- urls.push(buildName);
- let newUrl = urls.join('%2F');
- blueOcean = `${basicUrl}/blue/organizations/jenkins/${newUrl}/detail/${buildName}/${buildNum}`;
- } else {
- blueOcean = `${url}/blue/organizations/jenkins/${buildName}/detail/${buildName}/${buildNum}`;
- }
- return (
-
- );
- };
+ const renderJenkinsBuild = ({
+ buildName,
+ buildNum,
+ buildUrl,
+ url,
+ } = {}) => {
+ // Temporarily support BlueOcean link under folders
+ let blueOcean;
+ if (`${url}`.includes('/jobs') || `${url}`.includes('/build-scripts')) {
+ let urls = url.split('/job/');
+ let basicUrl = urls.shift();
+ urls.push(buildName);
+ let newUrl = urls.join('%2F');
+ blueOcean = `${basicUrl}/blue/organizations/jenkins/${newUrl}/detail/${buildName}/${buildNum}`;
+ } else {
+ blueOcean = `${url}/blue/organizations/jenkins/${buildName}/detail/${buildName}/${buildNum}`;
+ }
+ return (
+
+ );
+ };
- const renderBuildName = (value, row, index) => {
- const resultColor =
- value.buildResult === 'SUCCESS'
- ? '#2cbe4e'
- : value.buildResult === 'FAILURE'
- ? '#f50'
- : '#DAA520';
- if (value.type === 'Build') {
- if (value.hasChildren) {
- return (
-
- {' '}
- {value.buildName}{' '}
-
- );
- } else {
- return (
-
- {' '}
- {value.buildName}{' '}
-
- );
- }
- }
- let limit = 5;
- if (value.type === 'Perf') {
- limit = 1;
- }
- return (
-
- {' '}
- {value.buildName}{' '}
-
- );
- };
+ const renderBuildName = (value, row, index) => {
+ const resultColor =
+ value.buildResult === 'SUCCESS'
+ ? '#2cbe4e'
+ : value.buildResult === 'FAILURE'
+ ? '#f50'
+ : '#DAA520';
+ if (value.type === 'Build') {
+ if (value.hasChildren) {
+ return (
+
+ {' '}
+ {value.buildName}{' '}
+
+ );
+ } else {
+ return (
+
+ {' '}
+ {value.buildName}{' '}
+
+ );
+ }
+ }
+ let limit = 1;
+ if (value.type === 'Perf') {
+ limit = 1;
+ }
+ return (
+
+ {' '}
+ {value.buildName}{' '}
+
+ );
+ };
- const renderResult = ({ _id, buildResult }) => {
- return (
-
- {buildResult}
-
- );
- };
+ const renderResult = ({ _id, buildResult }) => {
+ return (
+
+ {buildResult}
+
+ );
+ };
- const renderResultDetail = (testSummary) => {
- let resultDetail = 'n/a';
- if (testSummary) {
- resultDetail = `Failed: ${testSummary.failed} / Passed: ${testSummary.passed} / Executed: ${testSummary.executed} / Disabled: ${testSummary.disabled} / Skipped: ${testSummary.skipped} / Total: ${testSummary.total}`;
- }
- return resultDetail;
- };
+ const renderResultDetail = (testSummary) => {
+ let resultDetail = 'n/a';
+ if (testSummary) {
+ resultDetail = `Failed: ${testSummary.failed} / Passed: ${testSummary.passed} / Executed: ${testSummary.executed} / Disabled: ${testSummary.disabled} / Skipped: ${testSummary.skipped} / Total: ${testSummary.total}`;
+ }
+ return resultDetail;
+ };
- const childBuildsColumns = [
- {
- title: 'Build Name',
- dataIndex: 'buildData',
- key: 'buildData',
- render: renderBuildName,
- sorter: (a, b) => {
- return a.buildData.buildName.localeCompare(
- b.buildData.buildName
- );
- },
- },
- {
- title: 'Result',
- dataIndex: 'result',
- key: 'result',
- render: renderResult,
- width: 100,
- filters: [
- {
- text: 'FAILURE',
- value: 'FAILURE',
- },
- {
- text: 'SUCCESS',
- value: 'SUCCESS',
- },
- {
- text: 'UNSTABLE',
- value: 'UNSTABLE',
- },
- {
- text: 'ABORTED',
- value: 'ABORTED',
- },
- ],
- onFilter: (value, record) => {
- const res = record.result;
- return res.buildResult
- ? res.buildResult.indexOf(value) === 0
- : false;
- },
- },
- {
- title: 'Result Detail',
- dataIndex: 'resultDetail',
- key: 'resultDetail',
- render: renderResultDetail,
- },
- {
- title: 'Jenkins',
- dataIndex: 'jenkinsBuild',
- key: 'jenkinsBuild',
- render: renderJenkinsBuild,
- sorter: (a, b) => {
- const nameA =
- a.jenkinsBuild.buildName + a.jenkinsBuild.buildNum;
- const nameB =
- b.jenkinsBuild.buildName + b.jenkinsBuild.buildNum;
- return nameA.localeCompare(nameB);
- },
- },
- {
- title: 'Date',
- dataIndex: 'date',
- key: 'date',
- sorter: (a, b) => {
- return a.date.localeCompare(b.date);
- },
- },
- {
- title: 'Comments',
- dataIndex: 'comments',
- key: 'comments',
- editable: true,
- render: (comments) => (
-
- {comments}
-
-
- ),
- },
- ];
+ const childBuildsColumns = [
+ {
+ title: 'Build Name',
+ dataIndex: 'buildData',
+ key: 'buildData',
+ render: renderBuildName,
+ sorter: (a, b) => {
+ return a.buildData.buildName.localeCompare(
+ b.buildData.buildName
+ );
+ },
+ },
+ {
+ title: 'Result',
+ dataIndex: 'result',
+ key: 'result',
+ render: renderResult,
+ width: 100,
+ filters: [
+ {
+ text: 'FAILURE',
+ value: 'FAILURE',
+ },
+ {
+ text: 'SUCCESS',
+ value: 'SUCCESS',
+ },
+ {
+ text: 'UNSTABLE',
+ value: 'UNSTABLE',
+ },
+ {
+ text: 'ABORTED',
+ value: 'ABORTED',
+ },
+ ],
+ onFilter: (value, record) => {
+ const res = record.result;
+ return res.buildResult
+ ? res.buildResult.indexOf(value) === 0
+ : false;
+ },
+ },
+ {
+ title: 'Result Detail',
+ dataIndex: 'resultDetail',
+ key: 'resultDetail',
+ render: renderResultDetail,
+ },
+ {
+ title: 'Jenkins',
+ dataIndex: 'jenkinsBuild',
+ key: 'jenkinsBuild',
+ render: renderJenkinsBuild,
+ sorter: (a, b) => {
+ const nameA =
+ a.jenkinsBuild.buildName + a.jenkinsBuild.buildNum;
+ const nameB =
+ b.jenkinsBuild.buildName + b.jenkinsBuild.buildNum;
+ return nameA.localeCompare(nameB);
+ },
+ },
+ {
+ title: 'Date',
+ dataIndex: 'date',
+ key: 'date',
+ sorter: (a, b) => {
+ return a.date.localeCompare(b.date);
+ },
+ },
+ {
+ title: 'Comments',
+ dataIndex: 'comments',
+ key: 'comments',
+ editable: true,
+ render: (comments) => (
+
+ {comments}
+
+
+ ),
+ },
+ ];
- const columns = childBuildsColumns.map((col) => {
- if (!col.editable) {
- return col;
- }
- return {
- ...col,
- onCell: (record) => ({
- record,
- editable: col.editable,
- dataIndex: col.dataIndex,
- title: col.title,
- inputRef: inputRef,
- handleSave: handleSave,
- }),
- };
- });
+ const columns = childBuildsColumns.map((col) => {
+ if (!col.editable) {
+ return col;
+ }
+ return {
+ ...col,
+ onCell: (record) => ({
+ record,
+ editable: col.editable,
+ dataIndex: col.dataIndex,
+ title: col.title,
+ inputRef: inputRef,
+ handleSave: handleSave,
+ }),
+ };
+ });
- return (
- title}
- dataSource={data}
- pagination={{ pageSize: 20 }}
- bordered
- />
- );
+ return (
+ title}
+ dataSource={data}
+ pagination={{ pageSize: 20 }}
+ bordered
+ />
+ );
};
export default BuildTable;
diff --git a/test-result-summary-client/src/Build/Summary/ResultGrid.jsx b/test-result-summary-client/src/Build/Summary/ResultGrid.jsx
index b40e4149..9830417d 100644
--- a/test-result-summary-client/src/Build/Summary/ResultGrid.jsx
+++ b/test-result-summary-client/src/Build/Summary/ResultGrid.jsx
@@ -152,7 +152,7 @@ class Cell extends Component {
pathname: '/allTestsInfo',
search: params({
buildId: groups[group].buildId,
- limit: 5,
+ limit: 1,
hasChildren:
groups[group].hasChildren,
}),