Initial cut - untested.

This commit is contained in:
2025-09-25 09:31:02 -07:00
parent 7a0666cc6c
commit 3775522265
33 changed files with 351 additions and 346 deletions

View File

@@ -38,13 +38,13 @@ const AssetTypeEditor = ({value, close}) => {
const [name, setName] = useState(value.name || "")
const [description, setDescription] = useState(value.description || "")
const applyChanges = () => {
const applyChanges = async () => {
close()
//TODO Should invert this and only close if there was success on the server.
if(value._id)
Meteor.call("assetTypes.update", value._id, name, description, year);
await Meteor.callAsync("assetTypes.update", value._id, name, description, year);
else
Meteor.call("assetTypes.add", name, description, year);
await Meteor.callAsync("assetTypes.add", name, description, year);
}
const rejectChanges = () => {
close()
@@ -69,8 +69,8 @@ const AssetTypeEditor = ({value, close}) => {
export default () => {
Meteor.subscribe('assetTypes');
const {assetTypes} = useTracker(() => {
let assetTypes = AssetTypes.find().fetch();
const {assetTypes} = useTracker(async () => {
let assetTypes = await AssetTypes.find().fetchAsync();
return {assetTypes}
});

View File

@@ -30,13 +30,13 @@ const SiteEditor = ({value, close}) => {
const [name, setName] = useState(value.name || "")
const [externalId, setExternalId] = useState(value.externalId || "")
const applyChanges = () => {
const applyChanges = async () => {
close()
//TODO Should invert this and only close if there was success on the server.
if(value._id)
Meteor.call("sites.update", value._id, name, externalId);
await Meteor.callAsync("sites.update", value._id, name, externalId);
else
Meteor.call("sites.add", name, externalId);
await Meteor.callAsync("sites.add", name, externalId);
}
const rejectChanges = () => {
close()
@@ -58,8 +58,8 @@ const SiteEditor = ({value, close}) => {
export default () => {
Meteor.subscribe('sites');
const {sites} = useTracker(() => {
const sites = Sites.find({}).fetch();
const {sites} = useTracker(async () => {
const sites = await Sites.find({}).fetchAsync();
return {
sites
}

View File

@@ -42,8 +42,8 @@ const StaffEditor = ({value, close, defaultSiteId}) => {
const [lastName, setLastName] = useState(value.lastName || "")
const [siteId, setSiteId] = useState(value.siteId ? value.siteId : defaultSiteId)
const {sites} = useTracker(() => {
let sites = Sites.find({}).fetch();
const {sites} = useTracker(async () => {
let sites = await Sites.find({}).fetchAsync();
return {sites}
});
@@ -52,13 +52,13 @@ const StaffEditor = ({value, close, defaultSiteId}) => {
setSiteId(sites[0]._id)
}
const applyChanges = () => {
const applyChanges = async () => {
close()
//TODO Should invert this and only close if there was success on the server.
if(value._id)
Meteor.call("staff.update", value._id, id, firstName, lastName, email, siteId);
await Meteor.callAsync("staff.update", value._id, id, firstName, lastName, email, siteId);
else
Meteor.call("staff.add", id, firstName, lastName, email, siteId);
await Meteor.callAsync("staff.add", id, firstName, lastName, email, siteId);
}
const rejectChanges = () => {
close()
@@ -94,17 +94,17 @@ export default () => {
Meteor.subscribe('sites');
Meteor.subscribe('staff');
const {sites} = useTracker(() => {
const sites = Sites.find({}).fetch();
const {sites} = useTracker(async () => {
const sites = await Sites.find({}).fetchAsync();
sites.push(siteAll);
return {sites}
});
const {staff} = useTracker(() => {
const {staff} = useTracker(async () => {
const staffQuery = site === siteAll._id ? {} : {siteId: site}
let staff = Staff.find(staffQuery).fetch();
let staff = await Staff.find(staffQuery).fetchAsync();
return {staff}
});

View File

@@ -56,8 +56,8 @@ const StudentEditor = ({value, close, defaultSiteId}) => {
const [active, setActive] = useState(value.active)
const [siteId, setSiteId] = useState(value.siteId ? value.siteId : defaultSiteId)
const {sites} = useTracker(() => {
let sites = Sites.find({}).fetch();
const {sites} = useTracker(async () => {
let sites = await Sites.find({}).fetch();
return {sites}
});
@@ -66,13 +66,13 @@ const StudentEditor = ({value, close, defaultSiteId}) => {
setSiteId(sites[0]._id)
}
const applyChanges = () => {
const applyChanges = async () => {
close()
//TODO Should invert this and only close if there was success on the server.
if(value._id)
Meteor.call("students.update", value._id, id, firstName, firstNameAlias, lastName, email, siteId, grade, active);
await Meteor.callAsync("students.update", value._id, id, firstName, firstNameAlias, lastName, email, siteId, grade, active);
else
Meteor.call("students.add", id, firstName, firstNameAlias, lastName, email, siteId, grade, active);
await Meteor.callAsync("students.add", id, firstName, firstNameAlias, lastName, email, siteId, grade, active);
}
const rejectChanges = () => {
close()
@@ -110,8 +110,8 @@ export default () => {
Meteor.subscribe('sites');
Meteor.subscribe('students');
const {sites} = useTracker(() => {
const sites = Sites.find({}).fetch();
const {sites} = useTracker(async () => {
const sites = await Sites.find({}).fetchAsync();
sites.push(siteAll);
@@ -124,7 +124,7 @@ export default () => {
const [active, setActive] = useState(ACTIVE_BOTH)
const [nameSearch, setNameSearch] = useState("")
const {students} = useTracker(() => {
const {students} = useTracker(async () => {
const studentQuery = site === siteAll._id ? {} : {siteId: site}
if(active !== ACTIVE_BOTH) {
@@ -135,7 +135,7 @@ export default () => {
studentQuery["$or"] = [{firstName: {$regex: nameSearch, $options: 'i'}}, {firstNameAlias: {$regex: nameSearch, $options: 'i'}}, {lastName: {$regex: nameSearch, $options: 'i'}}]
}
let students = Students.find(studentQuery).fetch();
let students = await Students.find(studentQuery).fetchAsync();
return {students}
});

View File

@@ -53,9 +53,9 @@ const AddAssets = ({assetTypes}) => {
backgroundColor: selectedAssetType === assetType ? '#EECFA6' : 'white'
}
}
const addAsset = () => {
const addAsset = async () => {
//TODO: Check the inputs.
Meteor.call("assets.add", selectedAssetType._id, assetId, serial, condition, conditionDetails);
await Meteor.callAsync("assets.add", selectedAssetType._id, assetId, serial, condition, conditionDetails);
setAssetId("")
setSerial("")
}
@@ -122,8 +122,8 @@ const AddAssets = ({assetTypes}) => {
export default () => {
Meteor.subscribe('assetTypes');
const {assetTypes} = useTracker(() => {
const assetTypes = AssetTypes.find({}, {sort: {year: -1}}).fetch();
const {assetTypes} = useTracker(async () => {
const assetTypes = await AssetTypes.find({}, {sort: {year: -1}}).fetchAsync();
return {
assetTypes

View File

@@ -44,13 +44,13 @@ const AssetEditor = ({value, close}) => {
const [assetTypeId, setAssetTypeId] = useState(value.assetTypeId || "")
const assetTypes = AssetTypes.find({}, {sort: {year: -1}});
const applyChanges = () => {
const applyChanges = async () => {
close()
//TODO Should invert this and only close if there was success on the server.
if(value._id)
Meteor.call("assets.update", value._id, assetTypeId, assetId, serial, condition, conditionDetails);
await Meteor.callAsync("assets.update", value._id, assetTypeId, assetId, serial, condition, conditionDetails);
else
Meteor.call("assets.add", assetTypeId, assetId, serial, condition, conditionDetails);
await Meteor.callAsync("assets.add", assetTypeId, assetId, serial, condition, conditionDetails);
}
const rejectChanges = () => {
close()
@@ -93,15 +93,15 @@ export default () => {
const assetTypes = [{name: "All", _id: 0}, ...AssetTypes.find({}, {sort: {year: -1}}).fetch()]
const {assets} = useTracker(() => {
const {assets} = useTracker(async () => {
let query = {}
if(assetId) query.assetId = {$regex: assetId, $options: 'i'}
if(serial) query.serial = {$regex: serial, $options: 'i'}
if(assetTypeId) query.assetTypeId = assetTypeId
const assets = Assets.find(query).fetch();
const assetTypes = AssetTypes.find({}, {sort: {year: -1}}).fetch();
const assets = await Assets.find(query).fetchAsync();
const assetTypes = await AssetTypes.find({}, {sort: {year: -1}}).fetchAsync();
const assetTypeNameMap = assetTypes.reduce((map, obj) => {
map[obj._id] = obj;
return map;
@@ -170,8 +170,8 @@ export default () => {
maxHeight: '40rem'
}
const removeAsset = (asset) => {
Meteor.call("assets.remove", asset._id);
const removeAsset = async (asset) => {
await Meteor.callAsync("assets.remove", asset._id);
setRemoveRow(undefined)
}

View File

@@ -59,17 +59,17 @@ const AssignmentsByAsset = () => {
const [assetIdInput, setAssetIdInput] = useState(undefined)
const {foundAsset} = useTracker(() => {
const {foundAsset} = useTracker(async () => {
let foundAsset = null;
if(assetId) {
foundAsset = Assets.findOne({assetId: assetId});
foundAsset = await Assets.findOneAsync({assetId: assetId});
if(foundAsset) {
foundAsset.assetType = AssetTypes.findOne({_id: foundAsset.assetTypeId})
foundAsset.assetType = await AssetTypes.findOneAsync({_id: foundAsset.assetTypeId})
if(foundAsset.assigneeId)
foundAsset.assignee = foundAsset.assigneeType === "Student" ? Students.findOne({_id: foundAsset.assigneeId}) : Staff.findOne({_id: foundAsset.assigneeId})
foundAsset.assignee = foundAsset.assigneeType === "Student" ? await Students.findOneAsync({_id: foundAsset.assigneeId}) : await Staff.findOneAsync({_id: foundAsset.assigneeId})
}
}
@@ -99,7 +99,7 @@ const AssignmentsByAsset = () => {
const [assignmentData, setAssignmentData] = useState([])
// Collect the usage and assignment data when the selected person changes.
useEffect(() => {
useEffect(async () => {
try {
if(foundAsset) {
let query = {assetId: foundAsset.assetId}
@@ -107,11 +107,11 @@ const AssignmentsByAsset = () => {
console.log("Requesting asset historical data")
console.log(query)
Meteor.call('DataCollection.chromebookData', query, (err, result) => {
await Meteor.callAsync('DataCollection.chromebookData', query, (err, result) => {
if (err) console.error(err)
else setUsageData(result)
})
Meteor.call('AssetAssignmentHistory.get', query, (err, result) => {
await Meteor.callAsync('AssetAssignmentHistory.get', query, (err, result) => {
if (err) console.error(err)
else setAssignmentData(result)
})
@@ -149,19 +149,19 @@ const AssignmentsByAsset = () => {
setUnassignConditionDetails(foundAsset.conditionDetails || "")
setOpenUnassignDialog(true);
}
const unassignDialogClosed = (unassign) => {
const unassignDialogClosed = async (unassign) => {
setOpenUnassignDialog(false)
if(unassign === true) {
if(unassignDialogEditConditionOnly) {
Meteor.call('assets.updateCondition', foundAsset._id, unassignCondition, unassignConditionDetails, (err, result) => {
await Meteor.callAsync('assets.updateCondition', foundAsset._id, unassignCondition, unassignConditionDetails, (err, result) => {
if(err) console.error(err)
else if(assetIdInput) assetIdInput.focus()
})
}
else {
// Call assets.unassign(assetId, comment, condition, conditionDetails, date)
Meteor.call('assets.unassign', foundAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails, (err, result) => {
await Meteor.callAsync('assets.unassign', foundAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails, (err, result) => {
if (err) console.error(err)
else if (assetIdInput) assetIdInput.focus()
})

View File

@@ -62,7 +62,7 @@ const AssignmentsByPerson = () => {
const [searchInput, setSearchInput] = useState(undefined)
const {people} = useTracker(() => {
const {people} = useTracker(async () => {
let people = [];
if(search && search.length > 1) {
@@ -80,8 +80,8 @@ const AssignmentsByPerson = () => {
// Look for students/staff that are active or whose active flag is not set.
if(!includeInactive) query = {$and: [query, {$or: [{active: true}, {active: {$exists: false}}]}]}
const students = Students.find(query).fetch();
const staff = Staff.find(query).fetch();
const students = await Students.find(query).fetchAsync();
const staff = await Staff.find(query).fetchAsync();
for(let next of students) next.type = "Student"
for(let next of staff) next.type = "Staff"
@@ -92,11 +92,11 @@ const AssignmentsByPerson = () => {
return {people}
}, [search]);
const {assets} = useTracker(() => {
const {assets} = useTracker(async () => {
let assets = [];
if(selectedPerson) {
assets = Assets.find({assigneeId: selectedPerson._id}).fetch();
assets = await Assets.find({assigneeId: selectedPerson._id}).fetchAsync();
for(let next of assets) {
next.assetType = AssetTypes.findOne({_id: next.assetTypeId})
@@ -106,17 +106,17 @@ const AssignmentsByPerson = () => {
return {assets}
}, [selectedPerson]);
const {foundAsset} = useTracker(() => {
const {foundAsset} = useTracker(async () => {
let foundAsset = null;
if(assetId) {
foundAsset = Assets.findOne({assetId: assetId});
foundAsset = await Assets.findOneAsync({assetId: assetId});
if(foundAsset) {
foundAsset.assetType = AssetTypes.findOne({_id: foundAsset.assetTypeId})
foundAsset.assetType = await AssetTypes.findOneAsync({_id: foundAsset.assetTypeId})
if(foundAsset.assigneeId)
foundAsset.assignee = foundAsset.assigneeType === "Student" ? Students.findOne({_id: foundAsset.assigneeId}) : Staff.findOne({_id: foundAsset.assigneeId})
foundAsset.assignee = foundAsset.assigneeType === "Student" ? await Students.findOneAsync({_id: foundAsset.assigneeId}) : await Staff.findOneAsync({_id: foundAsset.assigneeId})
}
}
@@ -127,7 +127,7 @@ const AssignmentsByPerson = () => {
const [assignmentData, setAssignmentData] = useState([])
// Collect the usage and assignment data when the selected person changes.
useEffect(() => {
useEffect(async () => {
try {
if(selectedPerson) {
let query = selectedPerson.type === "Student" ? {studentId: selectedPerson._id} : {staffId: selectedPerson._id}
@@ -135,11 +135,11 @@ const AssignmentsByPerson = () => {
console.log("Collecting person history")
console.log(query)
Meteor.call('DataCollection.chromebookData', query, (err, result) => {
await Meteor.callAsync('DataCollection.chromebookData', query, (err, result) => {
if (err) console.error(err)
else setUsageData(result)
})
Meteor.call('AssetAssignmentHistory.get', query, (err, result) => {
await Meteor.callAsync('AssetAssignmentHistory.get', query, (err, result) => {
if (err) console.error(err)
else setAssignmentData(result)
})
@@ -161,12 +161,12 @@ const AssignmentsByPerson = () => {
setOpenAssignDialog(true)
}
}
const assignDialogClosed = (assign) => {
const assignDialogClosed = async (assign) => {
setOpenAssignDialog(false)
if(assign === true) {
// Call assets.assign
Meteor.call('assets.assign', foundAsset.assetId, selectedPerson.type, selectedPerson._id, assignCondition, assignConditionDetails, (err, result) => {
await Meteor.callAsync('assets.assign', foundAsset.assetId, selectedPerson.type, selectedPerson._id, assignCondition, assignConditionDetails, (err, result) => {
if(err) console.error(err)
else {
// Clear the asset id field and set focus to it.
@@ -193,19 +193,19 @@ const AssignmentsByPerson = () => {
setUnassignConditionDetails(asset.conditionDetails || "")
setOpenUnassignDialog(true);
}
const unassignDialogClosed = (unassign) => {
const unassignDialogClosed = async (unassign) => {
setOpenUnassignDialog(false)
if(unassign === true) {
if(unassignDialogEditConditionOnly) {
Meteor.call('assets.updateCondition', unassignAsset._id, unassignCondition, unassignConditionDetails, (err, result) => {
await Meteor.callAsync('assets.updateCondition', unassignAsset._id, unassignCondition, unassignConditionDetails, (err, result) => {
if(err) console.error(err)
else if(assetIdInput) assetIdInput.focus()
})
}
else {
// Call assets.unassign(assetId, comment, condition, conditionDetails, date)
Meteor.call('assets.unassign', unassignAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails, (err, result) => {
await Meteor.callAsync('assets.unassign', unassignAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails, (err, result) => {
if(err) console.error(err)
else if(assetIdInput) assetIdInput.focus()
})
@@ -322,7 +322,7 @@ const AssignmentsByPerson = () => {
})}
</TextField>
</div>
<TextField style={{marginTop: '1rem',minWidth: '30rem'}} multiline rows={4} variant="outlined" label="Condition Details" value={assignConditionDetails} onChange={(e) => {setAssignConditionDetails(e.target.value)}}/>
<TextField style={{marginTop: '1rem',minWidth: '30rem'}} multiline rows={4} variant="outlined" label="Condition Details" value={assignConditionDetails} onChange={(e,v) => {setAssignConditionDetails(v)}}/>
</DialogContent>
<DialogActions>
<Button onClick={() => assignDialogClosed(true)}>Assign</Button>

View File

@@ -16,10 +16,10 @@ import Button from "@mui/material/Button";
const AssignmentsReport = () => {
const theme = useTheme();
const {people} = useTracker(() => {
let assets = Assets.find({assigneeId: {$exists: true}, assigneeType: "Student"}).fetch()
let assetTypes = AssetTypes.find().fetch()
let students = Students.find().fetch()
const {people} = useTracker(async () => {
let assets = await Assets.find({assigneeId: {$exists: true}, assigneeType: "Student"}).fetchAsync()
let assetTypes = await AssetTypes.find().fetchAsync()
let students = await Students.find().fetchAsync()
let people = []
let assetTypesById = assetTypes.reduce((map, obj) => {map[obj._id] = obj; return map}, {})

View File

@@ -33,12 +33,12 @@ export default () => {
const [searchType, setSearchType] = useState("email")
const [value, setValue] = useState("")
const search = () => {
const search = async () => {
if(searchType === 'email' || searchType === 'firstName' || searchType === 'lastName') {
if (value && value.length > 1) {
let query = searchType === 'email' ? {email: {$regex: value, $options: 'i'}} : searchType === 'firstName' ? {firstName: {$regex: value, $options: 'i'}} : {lastName: {$regex: value, $options: 'i'}}
let students = Students.find(query).fetch()
let staff = Staff.find(query).fetch()
let students = await Students.find(query).fetchAsync()
let staff = await Staff.find(query).fetchAsync()
let all = [...staff, ...students]
if (all.length > 1) {
@@ -50,7 +50,7 @@ export default () => {
}
}
else if(searchType === 'assetId' || searchType === 'serial') {
let asset = Assets.findOne(searchType === 'assetId' ? {assetId: value.toUpperCase()} : {serial : value});
let asset = await Assets.findOneAsync(searchType === 'assetId' ? {assetId: value.toUpperCase()} : {serial : value});
console.log(asset)
if(asset) {
if(searchType === 'assetId')
@@ -102,7 +102,7 @@ export default () => {
</Dialog>
<div style={{display: "flex", flexDirection: "column", marginTop: "1rem"}} sx={{ p: '2px 4px', display: 'flex', alignItems: 'center', width: 400 }}>
{/*<Paper componet='form'>*/}
{/*<Paper component='form'>*/}
{/* <div style={{marginBottom: "1rem", marginTop: "2rem"}}>*/}
{/* <ToggleButtonGroup color="primary" value={resultType} exclusive onChange={(e, type)=>setResultType(type)} aria-label="Result Type">*/}
{/* <ToggleButton value="usage">Usage History</ToggleButton>*/}

View File

@@ -31,10 +31,10 @@ import {InputLabel, List, ListItem, ListItemButton, ListItemText} from "@mui/mat
export default () => {
const navigate = useNavigate()
const [value, setValue] = useState("")
const search = () => {
const search = async () => {
if(value && value.length > 1) {
let students = Students.find({email: {$regex: value, $options: 'i'}}).fetch()
let staff = Staff.find({email: {$regex: value, $options: 'i'}}).fetch()
let students = await Students.find({email: {$regex: value, $options: 'i'}}).fetchAsync()
let staff = await Staff.find({email: {$regex: value, $options: 'i'}}).fetchAsync()
let all = [...staff, ...students]
if(all.length > 1) {

View File

@@ -31,15 +31,15 @@ const cssEditorField = {
minWidth: '10rem'
}
const Statistics = () => {
const Statistics = async () => {
const [selectedMissingAsset, setSelectedMissingAsset] = useState("")
const {assetStatistics} = useTracker(() => {
const {assetStatistics} = useTracker(async () => {
let assetStatistics = []
const assetTypes = AssetTypes.find({}, {year: 1}).fetch()
const assetTypes = await AssetTypes.find({}, {year: 1}).fetchAsync()
for(let type of assetTypes) {
let count = Assets.find({assetTypeId: type._id, condition: {$in: functionalConditions}}).count()
let count = await Assets.find({assetTypeId: type._id, condition: {$in: functionalConditions}}).countAsync()
if(count > 0) {
assetStatistics.push({name: type.name, count})
@@ -49,13 +49,13 @@ const Statistics = () => {
return {assetStatistics}
})
const {missingAssets} = useTracker(() => {
const {missingAssets} = useTracker(async () => {
let missingAssets = [];
missingAssets = Assets.find({condition: 'Missing'}).fetch();
missingAssets = await Assets.find({condition: 'Missing'}).fetchAsync();
for(let next of missingAssets) {
next.assetType = AssetTypes.findOne({_id: next.assetTypeId})
next.assetType = await AssetTypes.findOneAsync({_id: next.assetTypeId})
}
return {missingAssets}

View File

@@ -84,7 +84,7 @@ export default () => {
const [assignmentData, setAssignmentData] = useState([])
const [search, setSearch] = useSearchParams()
useEffect(() => {
useEffect(async () => {
let args;
if(search.get('studentId')) {
@@ -106,7 +106,7 @@ export default () => {
args = {assetId: search.get('assetId')}
}
Meteor.call('DataCollection.chromebookData', args, (err, result) => {
await Meteor.callAsync('DataCollection.chromebookData', args, (err, result) => {
if (err) console.error(err)
else setUsageData(result)
})
@@ -124,7 +124,7 @@ export default () => {
// args = {assetId: search.get('assetId')}
// }
Meteor.call('AssetAssignmentHistory.get', args, (err, result) => {
await Meteor.callAsync('AssetAssignmentHistory.get', args, (err, result) => {
if (err) console.error(err)
else setAssignmentData(result)
})

View File

@@ -42,7 +42,7 @@ export const StudentPage = (props) => {
<div style={{width: '100%', height: '100%', background: 'url(/images/student.svg)', backgroundSize: 'cover', backgroundPosition: 'center bottom', position: 'fixed', right: 0, bottom: 0, top: 0, left: 0}}> </div>
<div style={{display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', height: '100%', width: '100%'}}>
<Button css={{height: "100%", width: '100px', margin: 'auto'}} variant="contained" className="button" onClick={performLogin}>Login</Button>*/}
<Button css={{height: "100%", width: '100px', margin: 'auto'}} variant="contained" className="button" onClick={performLogin}>Login</Button>
</div>
</>
)}

View File

@@ -50,15 +50,15 @@ export const WorkshopList = () => {
const isAdmin = user && Roles.userIsInRole(user._id, 'admin', 'global');
const [selectedWorkshop, setSelectedWorkshop] = useState("")
const {workshops} = useTracker(() => {
const {workshops} = useTracker(async () => {
let workshops = [];
workshops = Workshops.find({isComplete: false}).fetch();
workshops = await Workshops.find({isComplete: false}).fetchAsync();
for(let workshop of workshops) {
for(let user of workshop.signupSheet) {
user.data = Students.findOne({_id: user._id})
if(!user.data) user.data = Staff.findOne({_id: user._id})
user.data = await Students.findOneAsync({_id: user._id})
if(!user.data) user.data = await Staff.findOneAsync({_id: user._id})
}
}
@@ -96,7 +96,7 @@ export const WorkshopList = () => {
setOpenWorkshopEditor(true)
}
}
const workshopEditorClosed = (save) => {
const workshopEditorClosed = async (save) => {
const completeHandler = (err, result) => {
if(err) console.error(err)
else {
@@ -105,8 +105,8 @@ export const WorkshopList = () => {
}
if(save) {
if(editedWorkshop._id) Meteor.call('workshops.update', editedWorkshop._id, editedName, editedDescription, editedSignupLimit, completeHandler)
else Meteor.call('workshops.add', editedName, editedDescription, editedSignupLimit, completeHandler)
if(editedWorkshop._id) await Meteor.callAsync('workshops.update', editedWorkshop._id, editedName, editedDescription, editedSignupLimit, completeHandler)
else await Meteor.callAsync('workshops.add', editedName, editedDescription, editedSignupLimit, completeHandler)
}
else completeHandler()
}

View File

@@ -43,7 +43,7 @@ let UsersTable = ({rows}) => {
setPermissions({...permissions})
}
let applyChanges = (e) => {
let applyChanges = async (e) => {
let roles = [];
if(permissions.isAdmin) {
@@ -55,7 +55,7 @@ let UsersTable = ({rows}) => {
}
}
Meteor.call("users.setUserRoles", edited._id, roles);
await Meteor.callAsync("users.setUserRoles", edited._id, roles);
setEdited(undefined);
}