Skip to content

Commit

Permalink
Bug fixes (#165)
Browse files Browse the repository at this point in the history
* Hotfixing web app to be compatible with cpu/wall time modifications of the API.

* Fixing ambiguity of private/public values (parentGroupId and Ids) in group entity.

* Fixing bug in pipeline variables processing.
Fixing bug in notifications (nested <a> element).
  • Loading branch information
Martin Kruliš committed Jan 15, 2018
1 parent 5c934a0 commit 9c59570
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const ReferenceSolutionsEvaluationsResults = ({ results, testId, taskId }) =>
<FormattedDate value={result.evaluation.evaluatedAt * 1000} />
</td>
<td>
{prettyPrintBytes(taskStats.usedMemory)}
{prettyPrintBytes(taskStats.memory)}
</td>
<td>
{prettyMs(taskStats.usedTime * 1000)}
{prettyMs(taskStats.wallTime * 1000)}
</td>
</tr>
);
Expand Down
12 changes: 6 additions & 6 deletions src/components/Submissions/TestResultsTable/TestResultsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ const TestResultsTable = ({ results, runtimeEnvironmentId }) =>
score,
status,
memoryExceeded,
timeExceeded,
wallTimeExceeded,
message,
timeRatio,
wallTimeRatio,
memoryRatio,
time,
wallTime,
memory,
exitCode
}) =>
Expand Down Expand Up @@ -189,9 +189,9 @@ const TestResultsTable = ({ results, runtimeEnvironmentId }) =>
1024
)}
{tickOrCrossAndRatioOrValue(
timeExceeded === false,
timeRatio,
time,
wallTimeExceeded === false,
wallTimeRatio,
wallTime,
prettyMs,
1000
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ class HeaderNotification extends Component {
onMouseOut={() => this.setState({ hovering: false })}
>
{deleteOnClick
? <a
className="fa"
? <span
className={styles.delete}
href={hide ? '#' : undefined}
onClick={e => {
e.preventDefault();
hide && hide(id);
}}
>
<DeleteIcon className="text-red" />
</a>
<DeleteIcon className="fa text-red" />
</span>
: successful ? <SuccessIcon /> : <WarningIcon />}
</span>
<span className="fa">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
color: orange;
cursor: pointer;
}

.delete {
cursor: pointer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HierarchyLineContainer extends Component {
{group =>
<HierarchyLine
groupId={group.id}
parentGroupsIds={group.privateData.parentGroupsIds}
parentGroupsIds={group.parentGroupsIds}
/>}
</ResourceRenderer>
);
Expand Down
39 changes: 33 additions & 6 deletions src/helpers/exerciseSimpleForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ const simpleConfigVariablesTypes = {
'actual-inputs': 'file[]'
};

const EMPTY_COMPILATION_PIPELINE_VARS = [
{
name: 'extra-files',
type: 'remote-file[]',
value: []
},
{
name: 'extra-file-names',
type: 'file[]',
value: []
}
];

// Fetch one simple variable (string or array) and fill it into the testObj under selected property.
const getSimpleConfigSimpleVariable = (
variables,
Expand Down Expand Up @@ -295,15 +308,29 @@ export const transformAndSendConfigValues = (
? executionPipelineFiles
: executionPipelineStdout;

const testVars = transformConfigTestExecutionVariables(test);

// Get original values so they wont get lost ...
const originalPipelines = originalConfig
.find(config => config.name === envId) // config for the right environment
.tests.find(test => test.name === testName).pipelines; // and the right test
const origCompilationVars = originalPipelines[0].variables; // the first pipeline is for compilation
const origExecutionVars = originalPipelines[1].variables; // the second pipeline is for execution
mergeOriginalVariables(testVars, origExecutionVars);

// Get original values of compilation pipeline ...
const originalCompilationPipeline = originalPipelines.find(
p => p.name === compilationPipeline.id
);
const origCompilationVars =
(originalCompilationPipeline &&
originalCompilationPipeline.variables) ||
EMPTY_COMPILATION_PIPELINE_VARS; // if pipeline variables are not present, prepare an empty set

// Prepare variables for execution pipeline ...
const testVars = transformConfigTestExecutionVariables(test);

const originalExecutionPipeline = originalPipelines.find(
p => p.name === executionPipeline.id
);
if (originalExecutionPipeline && originalExecutionPipeline.variables) {
const origExecutionVars = originalExecutionPipeline.variables; // the second pipeline is for execution
mergeOriginalVariables(testVars, origExecutionVars);
}

testsCfg.push({
name: testName,
Expand Down
4 changes: 1 addition & 3 deletions src/pages/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ class Dashboard extends Component {
Promise.all([
dispatch(fetchAssignmentsForGroup(group.id)),
dispatch(fetchGroupsStatsIfNeeded(group.id)),
dispatch(
fetchGroupsIfNeeded(...group.privateData.parentGroupsIds)
)
dispatch(fetchGroupsIfNeeded(...group.parentGroupsIds))
])
)
)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/EditGroup/EditGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ class EditGroup extends Component {
<DeleteGroupButtonContainer
id={group.id}
disabled={
group.privateData.parentGroupId === null ||
group.parentGroupId === null ||
(group.childGroups && group.childGroups.length > 0)
}
onDeleted={() =>
push(GROUP_URI_FACTORY(group.privateData.parentGroupId))}
push(GROUP_URI_FACTORY(group.parentGroupId))}
/>

{group.privateData.parentGroupId === null &&
{group.parentGroupId === null &&
<HelpBlock>
<FormattedMessage
id="app.editGroup.cannotDeleteRootGroup"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Group/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Group extends Component {
<div>
<HierarchyLine
groupId={data.id}
parentGroupsIds={data.privateData.parentGroupsIds}
parentGroupsIds={data.parentGroupsIds}
/>
<p />
{(isAdmin || isSuperAdmin) &&
Expand Down
13 changes: 3 additions & 10 deletions src/redux/modules/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,14 @@ const reducer = handleActions(
// update the new hierarchy inside the local state
const { payload: group } = action;
if (
!group.privateData ||
group.privateData.parentGroupId === null ||
!state.getIn(['resources', group.privateData.parentGroupId])
group.parentGroupId === null ||
!state.getIn(['resources', group.parentGroupId])
) {
return state;
}

return state.updateIn(
[
'resources',
group.privateData.parentGroupId,
'data',
'childGroups',
'all'
],
['resources', group.parentGroupId, 'data', 'childGroups', 'all'],
children => children.push(group.id)
);
},
Expand Down

0 comments on commit 9c59570

Please sign in to comment.