CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

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