Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/course/commands.ts
1503 views
1
/*
2
* This file is part of CoCalc: Copyright © 2024 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { defineMessage } from "react-intl";
7
8
import { IconName } from "@cocalc/frontend/components";
9
import type { CourseEditorActions } from "@cocalc/frontend/frame-editors/course-editor/actions";
10
import { course, IntlMessage, labels } from "@cocalc/frontend/i18n";
11
import { ENV_VARS_ICON } from "@cocalc/frontend/project/settings/environment";
12
13
// ATTN: the COMMANDS configuration is not only used in the menu (using ManageCommands),
14
// but also directly in some dialogs. Hence this is a subset from the Command type.
15
type Command = {
16
title: string | IntlMessage;
17
label: string | IntlMessage;
18
onClick: (arg: { props: { actions: CourseEditorActions } }) => void;
19
icon: IconName;
20
button: string | IntlMessage;
21
};
22
23
export const COMMANDS: { [name: string]: Command } = {
24
"add-students": {
25
icon: "users",
26
label: course.add_students,
27
button: defineMessage({
28
id: "course.commands.add-students.button",
29
defaultMessage: "+Student",
30
description:
31
"Adding Students in a course. A short label on a button, starting with a + sign.",
32
}),
33
title: course.add_students_tooltip,
34
onClick: ({ props }) => {
35
const { actions } = props;
36
actions.setModal("add-students");
37
},
38
},
39
"add-assignments": {
40
icon: "share-square",
41
label: course.add_assignments,
42
button: defineMessage({
43
id: "course.commands.add-assignments.button",
44
defaultMessage: "+Assignment",
45
description:
46
"Adding an assignment in a course. A short label on a button, starting with a + sign.",
47
}),
48
title: defineMessage({
49
id: "course.commands.add-assignments.tooltip",
50
defaultMessage: "Add one or more assignments to this course.",
51
}),
52
onClick: ({ props }) => {
53
const { actions } = props;
54
actions.setModal("add-assignments");
55
},
56
},
57
"add-handouts": {
58
icon: "text1",
59
label: defineMessage({
60
id: "course.commands.add-handouts.label",
61
defaultMessage: "Add Handouts",
62
description: "Adding a handout in a course.",
63
}),
64
button: defineMessage({
65
id: "course.commands.add-handouts.button",
66
defaultMessage: "+Handouts",
67
description:
68
"Adding a handout in a course. A short label on a button, starting with a + sign.",
69
}),
70
title: defineMessage({
71
id: "course.commands.add-handouts.tooltip",
72
defaultMessage: "Add one or more handouts to this course.",
73
}),
74
onClick: ({ props }) => {
75
const { actions } = props;
76
actions.setModal("add-handouts");
77
},
78
},
79
"title-and-description": {
80
icon: "header",
81
label: course.title_and_description_label,
82
button: labels.title,
83
title: defineMessage({
84
id: "course.commands.title-and-description.tooltip",
85
defaultMessage: "Set the course title and description.",
86
description: "title and description of a course for students.",
87
}),
88
onClick: ({ props }) => {
89
const { actions } = props;
90
actions.setModal("title-and-description");
91
},
92
},
93
"email-invitation": {
94
icon: "mail",
95
label: course.email_invitation_label,
96
button: labels.invite,
97
title: defineMessage({
98
id: "course.commands.email-invitation.tooltip",
99
defaultMessage:
100
"If you add a student to this course using their email address, and they do not have a CoCalc account, then they will receive this email invitation.",
101
}),
102
onClick: ({ props }) => {
103
const { actions } = props;
104
actions.setModal("email-invitation");
105
},
106
},
107
"copy-limit": {
108
icon: "users",
109
label: defineMessage({
110
id: "course.commands.copy-limit.label",
111
defaultMessage: "Parallel Copy Limit",
112
}),
113
button: labels.limit,
114
title: defineMessage({
115
id: "course.commands.copy-limit.tooltip",
116
defaultMessage:
117
"Max number of students to copy and collect files from in parallel.",
118
}),
119
onClick: ({ props }) => {
120
const { actions } = props;
121
actions.setModal("copy-limit");
122
},
123
},
124
"collaborator-policy": {
125
icon: "mail",
126
label: course.collaborator_policy,
127
button: defineMessage({
128
id: "course.commands.collaborator-policy.button",
129
defaultMessage: "Collab",
130
description: "Short label on a button, abbrivation of 'Collaborators'",
131
}),
132
title: defineMessage({
133
id: "course.commands.collaborator-policy.tooltip",
134
defaultMessage:
135
"Control if the owner and any collaborator on this student project may add collaborators to this project.",
136
}),
137
onClick: ({ props }) => {
138
const { actions } = props;
139
actions.setModal("collaborator-policy");
140
},
141
},
142
"restrict-student-projects": {
143
icon: "lock",
144
label: course.restrict_student_projects,
145
button: labels.restrict,
146
title: defineMessage({
147
id: "course.commands.restrict-student-projects.toolteip",
148
defaultMessage: "Remove functionality from student projects",
149
}),
150
onClick: ({ props }) => {
151
const { actions } = props;
152
actions.setModal("restrict-student-projects");
153
},
154
},
155
nbgrader: {
156
icon: "graduation-cap",
157
label: defineMessage({
158
id: "course.commands.nbgrader.label",
159
defaultMessage: "Configure Nbgrader",
160
}),
161
button: labels.nbgrader,
162
title: defineMessage({
163
id: "course.commands.nbgrader.tooltip",
164
defaultMessage: "Configure how nbgrader works.",
165
}),
166
onClick: ({ props }) => {
167
const { actions } = props;
168
actions.setModal("nbgrader");
169
},
170
},
171
"software-environment": {
172
icon: "laptop",
173
label: labels.software_environment,
174
button: labels.software,
175
title: defineMessage({
176
id: "course.commands.software-environment.tooltip",
177
defaultMessage:
178
"Configure the software environment that all student projects will use.",
179
}),
180
onClick: ({ props }) => {
181
const { actions } = props;
182
actions.setModal("software-environment");
183
},
184
},
185
"network-file-systems": {
186
icon: "database",
187
label: labels.cloud_storage_remote_filesystems,
188
button: "Nbgrader",
189
title: defineMessage({
190
id: "course.commands.network-file-systems.tooltip",
191
defaultMessage:
192
"Give all student projects read-only access to the same cloud stores and remote file systems as this instructor project.",
193
}),
194
onClick: ({ props }) => {
195
const { actions } = props;
196
actions.setModal("network-file-systems");
197
},
198
},
199
"env-variables": {
200
icon: ENV_VARS_ICON,
201
label: defineMessage({
202
id: "course.commands.env-variables.label",
203
defaultMessage: "Configure Environment Variables",
204
}),
205
button: labels.environment,
206
title: defineMessage({
207
id: "course.commands.env-variables.tooltip",
208
defaultMessage:
209
"Configure whether or not student projects inherit the environment variables of this instructor project.",
210
}),
211
onClick: ({ props }) => {
212
const { actions } = props;
213
actions.setModal("env-variables");
214
},
215
},
216
"configuration-copying": {
217
icon: "copy",
218
label: defineMessage({
219
id: "course.commands.configuration-copying.label",
220
defaultMessage: "Copy Course Configuration",
221
}),
222
button: labels.config,
223
title: defineMessage({
224
id: "course.commands.configuration-copying.tooltip",
225
defaultMessage: "Copy configuration from this course to other courses.",
226
}),
227
onClick: ({ props }) => {
228
const { actions } = props;
229
actions.setModal("configuration-copying");
230
},
231
},
232
upgrades: {
233
icon: "gears",
234
label: defineMessage({
235
id: "course.commands.upgrades.label",
236
defaultMessage: "Configure Upgrades (Student or Instructor Pay)",
237
}),
238
button: labels.upgrades,
239
title: defineMessage({
240
id: "course.commands.upgrades.tooltip",
241
defaultMessage:
242
"Use a license to upgrade all projects, or require your students to purchase a specific license.",
243
}),
244
onClick: ({ props }) => {
245
const { actions } = props;
246
actions.setModal("upgrades");
247
},
248
},
249
"start-all-projects": {
250
icon: "bolt",
251
label: defineMessage({
252
id: "course.commands.start-all-projects.label",
253
defaultMessage: "Start or Stop all Student Projects",
254
}),
255
button: labels.start_all,
256
title: defineMessage({
257
id: "course.commands.start-all-projects.tooltip",
258
defaultMessage:
259
"You can start all projects associated with this course so they are immediately ready for your students to use.",
260
}),
261
onClick: ({ props }) => {
262
const { actions } = props;
263
actions.setModal("start-all-projects");
264
},
265
},
266
"terminal-command": {
267
icon: "terminal",
268
label: defineMessage(course.run_terminal_command_title),
269
button: labels.terminal,
270
title: defineMessage({
271
id: "course.commands.terminal-command.tooltip",
272
defaultMessage:
273
"Run a bash terminal command in the home directory of all student projects. Up to 30 commands run in parallel, with a timeout of 1 minutes.",
274
}),
275
onClick: ({ props }) => {
276
const { actions } = props;
277
actions.setModal("terminal-command");
278
},
279
},
280
"reconfigure-all-projects": {
281
icon: "mail",
282
label: course.reconfigure_all_projects,
283
button: labels.reconfigure,
284
title: defineMessage({
285
id: "course.commands.reconfigure-all-projects.tooltip",
286
defaultMessage:
287
"Update all projects with correct students, descriptions, etc.",
288
}),
289
onClick: ({ props }) => {
290
const { actions } = props;
291
actions.setModal("reconfigure-all-projects");
292
},
293
},
294
"export-grades": {
295
icon: "table",
296
label: course.export_grades,
297
button: course.grades,
298
title: defineMessage({
299
id: "course.commands.export-grades.tooltip",
300
defaultMessage:
301
"Export all the grades you have recorded for students in your course to a csv or Python file.",
302
}),
303
onClick: ({ props }) => {
304
const { actions } = props;
305
actions.setModal("export-grades");
306
},
307
},
308
"resend-invites": {
309
icon: "mail",
310
label: course.resend_invites,
311
button: labels.invites,
312
title: defineMessage({
313
id: "course.commands.resend-invites.tooltip",
314
defaultMessage:
315
"Send another email to every student who didn't sign up yet. This sends a maximum of one email every 1 day.",
316
}),
317
onClick: ({ props }) => {
318
const { actions } = props;
319
actions.setModal("resend-invites");
320
},
321
},
322
"copy-missing-handouts-and-assignments": {
323
icon: "graph",
324
label: course.copy_missing_handouts_assignments,
325
button: defineMessage({
326
id: "course.commands.copy-missing-handouts-and-assignments.button",
327
defaultMessage: "Copy Missing",
328
}),
329
title: defineMessage({
330
id: "course.commands.copy-missing-handouts-and-assignments.tooltip",
331
defaultMessage:
332
"If you add new students to your course, you can ensure they have all the assignments and handouts that you have already assigned to other students in the course.",
333
}),
334
onClick: ({ props }) => {
335
const { actions } = props;
336
actions.setModal("copy-missing-handouts-and-assignments");
337
},
338
},
339
"empty-trash": {
340
icon: "trash",
341
label: labels.empty_trash,
342
button: labels.trash,
343
title: defineMessage({
344
id: "course.commands.empty-trash.tooltip",
345
defaultMessage:
346
"Empty trash by purging deleted students, assignments, and handouts.",
347
}),
348
onClick: ({ props }) => {
349
const { actions } = props;
350
actions.setModal("empty-trash");
351
},
352
},
353
"delete-student-projects": {
354
icon: "trash",
355
label: defineMessage(course.delete_student_projects),
356
button: labels.delete,
357
title: defineMessage({
358
id: "course.commands.delete-student-projects.tooltip",
359
defaultMessage:
360
"If for some reason you would like to delete all the student projects created for this course, you may do so by clicking above.",
361
}),
362
onClick: ({ props }) => {
363
const { actions } = props;
364
actions.setModal("delete-student-projects");
365
},
366
},
367
"delete-students": {
368
icon: "trash",
369
label: defineMessage({
370
id: "course.commands.delete-students.label",
371
defaultMessage: "Delete Students",
372
}),
373
button: labels.delete,
374
title: defineMessage({
375
id: "course.commands.delete-students.tooltip",
376
defaultMessage:
377
"Student projects will not be deleted. If you make a mistake, students can still be undeleted from the Student tab or using TimeTravel.",
378
}),
379
onClick: ({ props }) => {
380
const { actions } = props;
381
actions.setModal("delete-students");
382
},
383
},
384
"delete-shared-project": {
385
icon: "trash",
386
label: course.delete_shared_project,
387
button: labels.delete,
388
title: defineMessage({
389
id: "course.commands.delete-shared-project.tooltip",
390
defaultMessage:
391
"If it exists, delete the common shared project, which everybody has access to.",
392
}),
393
onClick: ({ props }) => {
394
const { actions } = props;
395
actions.setModal("delete-shared-project");
396
},
397
},
398
"create-shared-project": {
399
icon: "users",
400
label: course.create_shared_project,
401
button: defineMessage({
402
id: "course.commands.create-shared-project.button",
403
defaultMessage: "Shared",
404
}),
405
title: defineMessage({
406
id: "course.commands.create-shared-project.tooltip",
407
defaultMessage:
408
"Create a single common shared project, which everybody – students and all collaborators on this project (your TAs and other instructors) – have write access to.",
409
}),
410
onClick: ({ props }) => {
411
const { actions } = props;
412
actions.setModal("create-shared-project");
413
},
414
},
415
} as const;
416
417