generated from RealDevSquad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 164
Extension requests #284
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
Merged
ankushdharkar
merged 16 commits into
RealDevSquad:develop
from
ivinayakg:extension-requests
Apr 27, 2023
Merged
Extension requests #284
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b2bfb82
refactor private options handler
ivinayakg d4691d0
basic setup
ivinayakg 2047c82
draft feature
ivinayakg 896ccda
added feature
ivinayakg 3bb1d85
.
ivinayakg 6b3f295
Merge branch 'develop' into extension-requests
ivinayakg ca2ca3c
made suggested changes
ivinayakg 2a8ae93
Merge branch 'extension-requests' of https://github.com/ivinayakg/web…
ivinayakg 3cf44ef
Merge branch 'develop' into extension-requests
ivinayakg 304dfb9
requested changes done
ivinayakg e1a48c5
Merge branch 'extension-requests' of https://github.com/ivinayakg/web…
ivinayakg ad9ac65
Merge branch 'develop' into extension-requests
ivinayakg 0a88fea
fix formatting
ivinayakg ff196ee
Merge branch 'develop' into extension-requests
ivinayakg 8b5173b
added responsiveness
ivinayakg d012203
Merge branch 'extension-requests' of https://github.com/ivinayakg/web…
ivinayakg 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
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 |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| const API_BASE_URL = 'https://api.realdevsquad.com'; | ||
| const USER_MANAGEMENT_LINK = 'user-management-link'; | ||
| const EXTENSION_REQUESTS_LINK = 'extension-requests-link'; |
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,19 @@ | ||
| const taskInfoModelHeadings = [ | ||
| { title: 'Title' }, | ||
| { title: 'Ends On', key: 'endsOn', time: true }, | ||
| { title: 'Purpose' }, | ||
| { title: 'Assignee' }, | ||
| { title: 'Created By', key: 'createdBy' }, | ||
| { title: 'Is Noteworthy', key: 'isNoteworthy' }, | ||
| ]; | ||
|
|
||
| const extensionRequestCardHeadings = [ | ||
| { title: 'Title' }, | ||
| { title: 'Reason' }, | ||
| { title: 'Old Ends On', key: 'oldEndsOn', time: true }, | ||
| { title: 'New Ends On', key: 'newEndsOn', time: true }, | ||
| { title: 'Status', bold: true }, | ||
| { title: 'Assignee' }, | ||
| { title: 'Created At', key: 'timestamp', time: true }, | ||
| { title: 'Task', key: 'taskId' }, | ||
| ]; |
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,110 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <link rel="stylesheet" href="style.css" /> | ||
| <title>Extension Requests</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div class="extension-requests-modal-parent"> | ||
| <div class="extension-requests-info"></div> | ||
| <form class="extension-requests-form"> | ||
| <h3>Update Extension Request</h3> | ||
| <label for="title">Title</label> | ||
| <input | ||
| required | ||
| type="text" | ||
| id="title" | ||
| name="title" | ||
| class="extensionTitle" | ||
| /> | ||
| <label for="reason">Reason</label> | ||
| <input | ||
| required | ||
| type="text" | ||
| id="reason" | ||
| name="reason" | ||
| class="extensionReason" | ||
| /> | ||
| <label for="newEndsOn">New Ends On</label> | ||
| <input | ||
| required | ||
| type="datetime-local" | ||
| id="newEndsOn" | ||
| name="newEndsOn" | ||
| class="extensionNewEndsOn" | ||
| /> | ||
| <label for="oldEndsOn">Old Ends On</label> | ||
| <input | ||
| required | ||
| type="datetime-local" | ||
| id="oldEndsOn" | ||
| class="extensionOldEndsOn" | ||
| readonly | ||
| /> | ||
| <label for="status">Status</label> | ||
| <input | ||
| required | ||
| type="text" | ||
| id="status" | ||
| class="extensionStatus" | ||
| readonly | ||
| /> | ||
| <label for="Task Id">Task Id</label> | ||
| <input required type="text" id="Task Id" class="extensionId" readonly /> | ||
| <label for="assignee">Assignee</label> | ||
| <input | ||
| required | ||
| type="text" | ||
| id="assignee" | ||
| class="extensionAssignee" | ||
| readonly | ||
| /> | ||
| <button type="submit">Submit</button> | ||
| <button id="close-modal" type="button">Cancel</button> | ||
| </form> | ||
| <form class="extension-requests-status-form"> | ||
| <h3>Update Extension Request Status</h3> | ||
| <label for="status">Status</label> | ||
| <select name="status" id="status"> | ||
| <option value="APPROVED">APPROVED</option> | ||
| <option value="DENIED">DENIED</option> | ||
| </select> | ||
| <label for="title">Title</label> | ||
| <input | ||
| required | ||
| type="text" | ||
| id="title" | ||
| class="extensionTitle" | ||
| readonly | ||
| /> | ||
| <label for="Task Id">Task Id</label> | ||
| <input required type="text" id="Task Id" class="extensionId" readonly /> | ||
| <label for="assignee">Assignee</label> | ||
| <input | ||
| required | ||
| type="text" | ||
| id="assignee" | ||
| class="extensionAssignee" | ||
| readonly | ||
| /> | ||
| <button type="submit">Submit</button> | ||
| <button id="close-modal" type="button">Cancel</button> | ||
| </form> | ||
| </div> | ||
| <header class="header"> | ||
| <h1>Extension Requests</h1> | ||
| </header> | ||
| <div class="container"> | ||
| <div class="extension-requests"></div> | ||
| </div> | ||
| <h2 id="error"></h2> | ||
| <script src="/constants.js"></script> | ||
| <script src="constants.js"></script> | ||
| <script src="/utils.js"></script> | ||
| <script src="local-utils.js"></script> | ||
| <script src="script.js"></script> | ||
| </body> | ||
| </html> |
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,101 @@ | ||
| async function getExtensionRequests(query = {}) { | ||
| const url = new URL(`${API_BASE_URL}/extension-requests`); | ||
|
|
||
| queryParams = ['assignee', 'status', 'taskId']; | ||
| queryParams.forEach( | ||
| (key) => query[key] && url.searchParams.set(key, query[key]), | ||
| ); | ||
|
|
||
| const res = await fetch(url, { | ||
| credentials: 'include', | ||
| method: 'GET', | ||
| headers: { | ||
| 'Content-type': 'application/json', | ||
| }, | ||
| }); | ||
| return await res.json(); | ||
| } | ||
|
|
||
| async function updateExtensionRequest({ id, body }) { | ||
| const url = `${API_BASE_URL}/extension-requests/${id}`; | ||
| const res = await fetch(url, { | ||
| credentials: 'include', | ||
| method: 'PATCH', | ||
| body: JSON.stringify(body), | ||
| headers: { | ||
| 'Content-type': 'application/json', | ||
| }, | ||
| }); | ||
| return await res.json(); | ||
ivinayakg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| async function updateExtensionRequestStatus({ id, body }) { | ||
| const url = `${API_BASE_URL}/extension-requests/${id}/status`; | ||
| const res = await fetch(url, { | ||
| credentials: 'include', | ||
| method: 'PATCH', | ||
| body: JSON.stringify(body), | ||
| headers: { | ||
| 'Content-type': 'application/json', | ||
| }, | ||
| }); | ||
| return await res.json(); | ||
ivinayakg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| async function getTaskDetails(taskId) { | ||
| if (!taskId) return; | ||
| const url = `${API_BASE_URL}/tasks/${taskId}/details`; | ||
| const res = await fetch(url, { | ||
| credentials: 'include', | ||
| method: 'GET', | ||
| headers: { | ||
| 'Content-type': 'application/json', | ||
| }, | ||
| }); | ||
| return await res.json(); | ||
ivinayakg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| function getTimeFromTimestamp(timestamp) { | ||
| return new Date(timestamp * 1000).toLocaleString(); | ||
| } | ||
|
|
||
| function createTable(headings, data, className = '') { | ||
| const table = createElement({ | ||
| type: 'table', | ||
| attributes: { | ||
| class: className, | ||
| }, | ||
| }); | ||
| const tableBody = createElement({ type: 'tbody' }); | ||
| headings.forEach(({ title, key, time, bold }) => { | ||
| let row = createElement({ type: 'tr' }); | ||
| let rowHeading = createElement({ type: 'th', innerText: title }); | ||
|
|
||
| let contentText = ''; | ||
| if (time) contentText = getTimeFromTimestamp(data[key]); | ||
| else contentText = key ? data[key] : data[title.toLowerCase()]; | ||
|
|
||
| let tableData = createElement({ | ||
| type: 'td', | ||
| innerText: contentText, | ||
| attributes: { | ||
| class: bold ? 'bold' : '', | ||
| }, | ||
| }); | ||
| row.appendChild(rowHeading); | ||
| row.appendChild(tableData); | ||
| tableBody.appendChild(row); | ||
| }); | ||
|
|
||
| table.appendChild(tableBody); | ||
| return table; | ||
| } | ||
|
|
||
| function formDataToObject(formData) { | ||
| if (!formData) return; | ||
| const result = {}; | ||
| for (const [key, value] of formData.entries()) { | ||
| result[key] = value; | ||
| } | ||
| return result; | ||
| } | ||
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.