mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
+nginx.conf; update scratchpad
This commit is contained in:
1 parent
6ad41dc2ae
commit
2d5eef8d08
28 files changed
+206
-230
No files matched your search
@@ -1,41 +1,30 @@
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
const initialId = uuid();
|
||||
|
||||
export default function reducer(state = {
|
||||
counter: 1,
|
||||
current: initialId,
|
||||
tabs: [initialId],
|
||||
meta: {
|
||||
[initialId]: {
|
||||
id: initialId,
|
||||
title: '#1',
|
||||
},
|
||||
},
|
||||
data: {
|
||||
[initialId]: {
|
||||
id: initialId,
|
||||
title: '#1',
|
||||
input: '',
|
||||
output: '',
|
||||
},
|
||||
},
|
||||
input: '',
|
||||
output: '',
|
||||
rid: null,
|
||||
}, action) {
|
||||
switch (action.type) {
|
||||
case 'SCRATCHPAD_PRETEST_DATA_CHANGE': {
|
||||
const { id, type, value } = action.payload;
|
||||
if (action.type === 'SCRATCHPAD_PRETEST_DATA_CHANGE') {
|
||||
const { type, value } = action.payload;
|
||||
return {
|
||||
...state,
|
||||
data: {
|
||||
...state.data,
|
||||
[id]: {
|
||||
...state.data[id],
|
||||
[type]: value,
|
||||
},
|
||||
},
|
||||
[type]: value,
|
||||
};
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
if (action.type === 'SCRATCHPAD_RECORDS_PUSH') {
|
||||
const { rdoc } = action.payload;
|
||||
if (rdoc._id === state.rid) {
|
||||
return {
|
||||
...state,
|
||||
output: (rdoc.stdout || '') + (rdoc.stderr || ''),
|
||||
rid: null,
|
||||
};
|
||||
}
|
||||
}
|
||||
if (action.type === 'SCRATCHPAD_POST_PRETEST_FULFILLED') {
|
||||
return {
|
||||
...state,
|
||||
rid: action.payload.rid,
|
||||
};
|
||||
}
|
||||
return state;
|
||||
}
|
||||
@@ -15,11 +15,6 @@ export default function reducer(state = {
|
||||
}
|
||||
case 'SCRATCHPAD_RECORDS_PUSH': {
|
||||
const { rdoc } = action.payload;
|
||||
if (rdoc.uid !== UserContext._id
|
||||
|| rdoc.pid !== Context.problemId
|
||||
) {
|
||||
return state;
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
rows: [rdoc._id, ...state.rows],
|
||||
|
||||
Reference in new issue
Block a user