-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[Components] d2l_brightspace - new components #19493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jcortes
wants to merge
1
commit into
master
Choose a base branch
from
d2l-brightspace-new-components
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+549
−14
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
components/d2l_brightspace/actions/create-enrollment/create-enrollment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import app from "../../d2l_brightspace.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "d2l_brightspace-create-enrollment", | ||
| name: "Create Enrollment", | ||
| description: "Enrolls a user in a course on D2L Brightspace. [See the documentation](https://docs.valence.desire2learn.com/res/enroll.html)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orgUnitId: { | ||
| propDefinition: [ | ||
| app, | ||
| "orgUnitId", | ||
| ], | ||
| }, | ||
| userId: { | ||
| propDefinition: [ | ||
| app, | ||
| "userId", | ||
| ], | ||
| }, | ||
| roleId: { | ||
| propDefinition: [ | ||
| app, | ||
| "roleId", | ||
| ], | ||
| }, | ||
| }, | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| idempotentHint: false, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.createEnrollment({ | ||
| data: { | ||
| OrgUnitId: this.orgUnitId, | ||
| UserId: this.userId, | ||
| RoleId: this.roleId, | ||
| }, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully enrolled user ${this.userId} in course ${this.orgUnitId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
50 changes: 50 additions & 0 deletions
50
components/d2l_brightspace/actions/get-grade-values/get-grade-values.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import app from "../../d2l_brightspace.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "d2l_brightspace-get-grade-values", | ||
| name: "Get Grade Values", | ||
| description: "Retrieves the grade value for a specific user and grade object from D2L Brightspace. [See the documentation](https://docs.valence.desire2learn.com/res/grade.html)", | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orgUnitId: { | ||
| propDefinition: [ | ||
| app, | ||
| "orgUnitId", | ||
| ], | ||
| }, | ||
| gradeObjectId: { | ||
| propDefinition: [ | ||
| app, | ||
| "gradeObjectId", | ||
| (c) => ({ | ||
| orgUnitId: c.orgUnitId, | ||
| }), | ||
| ], | ||
| }, | ||
| userId: { | ||
| propDefinition: [ | ||
| app, | ||
| "userId", | ||
| ], | ||
| }, | ||
| }, | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getGradeValue({ | ||
| orgUnitId: this.orgUnitId, | ||
| gradeObjectId: this.gradeObjectId, | ||
| userId: this.userId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved grade value for user ${this.userId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import app from "../../d2l_brightspace.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "d2l_brightspace-get-user", | ||
| name: "Get User", | ||
| description: "Retrieves information about a specific user from D2L Brightspace. [See the documentation](https://docs.valence.desire2learn.com/res/user.html)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| userId: { | ||
| propDefinition: [ | ||
| app, | ||
| "userId", | ||
| ], | ||
| }, | ||
| }, | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getUser({ | ||
| userId: this.userId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved user ${response.FirstName} ${response.LastName}`); | ||
| return response; | ||
| }, | ||
| }; |
38 changes: 38 additions & 0 deletions
38
components/d2l_brightspace/actions/list-dropbox-folders/list-dropbox-folders.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import app from "../../d2l_brightspace.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "d2l_brightspace-list-dropbox-folders", | ||
| name: "List Dropbox Folders", | ||
| description: "Retrieves all dropbox folders (assignments) for a specific course from D2L Brightspace. [See the documentation](https://docs.valence.desire2learn.com/res/dropbox.html)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orgUnitId: { | ||
| propDefinition: [ | ||
| app, | ||
| "orgUnitId", | ||
| ], | ||
| }, | ||
| }, | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.listDropboxFolders({ | ||
| orgUnitId: this.orgUnitId, | ||
| $, | ||
| }); | ||
|
|
||
| const folders = Array.isArray(response) | ||
| ? response | ||
| : []; | ||
| $.export("$summary", `Successfully retrieved ${folders.length} dropbox folder${folders.length === 1 | ||
| ? "" | ||
| : "s"}`); | ||
| return folders; | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
65 changes: 65 additions & 0 deletions
65
components/d2l_brightspace/actions/list-enrollments/list-enrollments.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import app from "../../d2l_brightspace.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "d2l_brightspace-list-enrollments", | ||
| name: "List Enrollments", | ||
| description: "Retrieves a list of enrollments for a specific course from D2L Brightspace. [See the documentation](https://docs.valence.desire2learn.com/res/enroll.html)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orgUnitId: { | ||
| propDefinition: [ | ||
| app, | ||
| "orgUnitId", | ||
| ], | ||
| }, | ||
| roleId: { | ||
| propDefinition: [ | ||
| app, | ||
| "roleId", | ||
| ], | ||
| optional: true, | ||
| description: "Filter enrollments by role (optional)", | ||
| }, | ||
| max: { | ||
| type: "integer", | ||
| label: "Maximum Results", | ||
| description: "The maximum number of enrollments to return", | ||
| optional: true, | ||
| default: 100, | ||
| }, | ||
| }, | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| async run({ $ }) { | ||
| const enrollments = []; | ||
|
|
||
| const params = {}; | ||
| if (this.roleId) { | ||
| params.roleId = this.roleId; | ||
| } | ||
|
|
||
| const iterator = this.app.paginate({ | ||
| fn: this.app.listEnrollmentsByOrgUnit, | ||
| params: { | ||
| orgUnitId: this.orgUnitId, | ||
| ...params, | ||
| }, | ||
| maxResults: this.max, | ||
| }); | ||
|
|
||
| for await (const enrollment of iterator) { | ||
| enrollments.push(enrollment); | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${enrollments.length} enrollment${enrollments.length === 1 | ||
| ? "" | ||
| : "s"}`); | ||
| return enrollments; | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
72 changes: 72 additions & 0 deletions
72
components/d2l_brightspace/actions/list-org-units/list-org-units.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import app from "../../d2l_brightspace.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "d2l_brightspace-list-org-units", | ||
| name: "List Organizational Units", | ||
| description: "Retrieves a list of organizational units (courses, departments, etc.) from D2L Brightspace. [See the documentation](https://docs.valence.desire2learn.com/res/orgunit.html)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orgUnitType: { | ||
| type: "string", | ||
| label: "Org Unit Type", | ||
| description: "Filter by organizational unit type ID (e.g., type ID for course offerings). Leave empty to retrieve all types.", | ||
| optional: true, | ||
| }, | ||
| orgUnitName: { | ||
| type: "string", | ||
| label: "Org Unit Name Filter", | ||
| description: "Filter by names containing this substring", | ||
| optional: true, | ||
| }, | ||
| orgUnitCode: { | ||
| type: "string", | ||
| label: "Org Unit Code Filter", | ||
| description: "Filter by codes containing this substring", | ||
| optional: true, | ||
| }, | ||
| max: { | ||
| type: "integer", | ||
| label: "Maximum Results", | ||
| description: "The maximum number of organizational units to return", | ||
| optional: true, | ||
| default: 100, | ||
| }, | ||
| }, | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| orgUnitType, | ||
| orgUnitName, | ||
| orgUnitCode, | ||
| max, | ||
| } = this; | ||
|
|
||
| const orgUnits = []; | ||
|
|
||
| const iterator = app.paginate({ | ||
| fn: app.listOrgUnits, | ||
| params: { | ||
| orgUnitType, | ||
| orgUnitName, | ||
| orgUnitCode, | ||
| }, | ||
| maxResults: max, | ||
| }); | ||
|
|
||
| for await (const orgUnit of iterator) { | ||
| orgUnits.push(orgUnit); | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${orgUnits.length} organizational unit${orgUnits.length === 1 | ||
| ? "" | ||
| : "s"}`); | ||
| return orgUnits; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| const DOMAIN_PLACEHOLDER = "{domain}"; | ||
| const BASE_URL_TEMPLATE = `https://${DOMAIN_PLACEHOLDER}/d2l/api`; | ||
| const DEFAULT_LIMIT = 100; | ||
| const DEFAULT_MAX = 600; | ||
| const LP_VERSION = "1.0"; | ||
| const LE_VERSION = "1.0"; | ||
| const API_CONTEXTS = { | ||
| LP: "lp", | ||
| LE: "le", | ||
| }; | ||
|
|
||
| export default { | ||
| BASE_URL_TEMPLATE, | ||
| DOMAIN_PLACEHOLDER, | ||
| DEFAULT_LIMIT, | ||
| DEFAULT_MAX, | ||
| LP_VERSION, | ||
| LE_VERSION, | ||
| API_CONTEXTS, | ||
| }; | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.