-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Justin Campbell
committed
Jul 27, 2020
1 parent
4cb5952
commit f30c117
Showing
3 changed files
with
197 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,137 @@ | ||
# Summary of State | ||
**Date:** Sunday, July 7, 2020 | ||
|
||
## Overview | ||
webqueue2 consists of three parts: | ||
|
||
- The Backend (`api/ECNQueue.py`) | ||
- The API (`api/api.py`) | ||
- The Frontend (Source: `src/ + public/`; Build: `build/`) | ||
|
||
## The Backend | ||
The backend is responsible for interacting with the queue-cli. Because webqueue2 is read-only at this point, that means the backend if responsible for reading and parsing files. | ||
|
||
### What Has Been Done | ||
|
||
### What Needs Doing | ||
- Implement section parsing for the front-end to better display information to ECN staff. | ||
|
||
_Example:_ | ||
``` | ||
Testtest | ||
*** Status updated by: campb303 at: 6/23/2020 13:26:55 *** | ||
Dont Delete | ||
*** Edited by: campb303 at: 06/23/20 13:27:56 *** | ||
This be an edit my boy | ||
*** Replied by: campb303 at: 06/23/20 13:28:18 *** | ||
This be a reply my son | ||
Justin | ||
ECN | ||
=== Additional information supplied by user === | ||
Subject: Re: Beepboop | ||
From: Justin Campbell <campb303@purdue.edu> | ||
Date: Tue, 23 Jun 2020 13:30:45 -0400 | ||
X-ECN-Queue-Original-Path: /home/pier/e/queue/Attachments/inbox/2020-06-23/212-original.txt | ||
X-ECN-Queue-Original-URL: https://engineering.purdue.edu/webqueue/Attachments/inbox/2020-06-23/212-original.txt | ||
Huzzah! | ||
=============================================== | ||
``` | ||
would become a list of dictionaries with meta data about each section: | ||
```python | ||
[ | ||
{ | ||
"type": "initialMessage", | ||
"content": [ | ||
"Testtest\n" | ||
] | ||
}, | ||
{ | ||
"type": "status", | ||
"updatedBy": "campb303", | ||
"updatedTime": "6/23/2020 01:26 PM", | ||
"content": [ | ||
"Don't Delete" | ||
] | ||
}, | ||
{ | ||
"type": "edit", | ||
"updatedBy": "campb303", | ||
"updatedTime": "06/23/20 01:27 PM", | ||
"content": [ | ||
"This be an edit my boy.\n" | ||
] | ||
}, | ||
{ | ||
"type": "replyToUser", | ||
"sentBy": "campb303", | ||
"sentTime": "06/23/20 01:28 PM", | ||
"content": [ | ||
"This be a reply my son\n", | ||
"\n", | ||
"Justin\n", | ||
"ECN\n" | ||
} | ||
] | ||
``` | ||
- Finish documentation at the Module, Class, and Method levels. | ||
- Implement attachment parsing. | ||
- This might be possible using the `EmailMessage.walk()` function from the `email` module in Python's standard library. | ||
- Implement a metadata only loading function to populate only data needed for the frontend's ItemTable for faster loader when the entire item isn't needed. | ||
- Implement custom JSON parsing for Item and Queue objects for more perfoemant API calls. | ||
- Currently the [`jsonpickle`](https://jsonpickle.github.io/) module is being used. However, this introduces unnecessary bloat to JSON packages by including things that don't need to be sent to the frontend. | ||
- Implement tracking for refiles. | ||
- Refile headers do not track the from/to of when an item is refiled. | ||
- Deal with UnicodeDecodeError in coral104 and others. See ECNQueue configuration section. | ||
- [Similar StackOverflow case](https://stackoverflow.com/questions/35028683/python3-unicodedecodeerror-with-readlines-method) | ||
- [Official docs on error param in builtin open() fucntion](https://docs.python.org/3.7/library/functions.html#open) | ||
- Deal with blank subject on some items. See me 67, uds 14, and ece 47 | ||
- Deal with non-uniform timezones. See getDateReceived.py and the [time standard library](https://docs.python.org/3.7/library/time.html#time.struct_time) | ||
|
||
## The API | ||
|
||
### What Has Been Done | ||
|
||
### What Needs Doing | ||
- Implement a mechanism for controlling the start/stop/restart of gunicorn. Some options include: | ||
1. **Using the Apache control script** that is interacted with via the captive shell for a web server user on Templeton. This would allow for a seamless start/stop/restart workflow because it is tied into the same actions for Apache. However, this would also require that Apache be restarted for any API change which could disrupt active connections unnecessarily. | ||
2. **Using user level cron jobs** @reboot to start the service. This doesn't not allow for easy stopping and restarting. | ||
3. **Using a system wide init system hook** (Templeton using SysV aka init.d.) This could allow for easy start/stop/restart functions and the user could be allowed to interact with webqueue-api init script but no other init script. This option provides the most flexibility. | ||
|
||
## The Frontend | ||
|
||
### What Has Been Done | ||
|
||
### What Needs Doing | ||
- Implement [`react-table`](https://github.com/tannerlinsley/react-table) based ItemTable for responsive item views. | ||
- Implement queue selection displays | ||
- Implement webpage level authentication accessible to password managers | ||
- Implement queue highlighting | ||
- Implement jump to ticket | ||
- Implement [`react-router`](https://reactrouter.com/) for URL based navigation | ||
- Implement stored user preferences | ||
- Integrate with Purdue Directory for contact details lookup | ||
|
||
## The Project Overall | ||
|
||
### What Has Been Done | ||
|
||
### What Needs Doing | ||
- Implement testing | ||
- Implement automated testing/deployment mechanisms | ||
- Implement update mechanisms | ||
- Automate documentation creating using [Sphinx](https://www.sphinx-doc.org/en/master/) | ||
- For the ItemTable from column: | ||
```javascript | ||
let ItemTable.from = userAlias ? userAlias : userName | ||
``` |
This file contains 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,16 @@ | ||
self.dateReceived = self.__getDateReceived() | ||
... | ||
def __getDateReceived(self) -> str: | ||
"""Returns time item was received in mm-dd-yy hh:mm am/pm format. | ||
Example: | ||
07-23-20 10:34 AM | ||
Returns: | ||
str: time item was received in mm-dd-yy hh:mm am/pm format. | ||
""" | ||
timeFromHeader = self.__getMostRecentHeaderByType("Date") | ||
parsedTimeFromHeader = time.strptime(timeFromHeader, "%a, %d %b %Y %H:%M:%S %z") | ||
formattedTime = time.strftime("%m-%d-%y %I:%M %p ", parsedTimeFromHeader) | ||
|
||
return formattedTime |
This file contains 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,44 @@ | ||
def __parseSections(self) -> list: | ||
contentStart = self.__getHeaderBoundary() + 1 | ||
contentEnd = len(self.__rawItem) - 1 | ||
|
||
# Find line numbers where sections start | ||
sectionBoundaries = [ {"start": contentStart} ] | ||
|
||
for lineNumber in range(contentStart, contentEnd + 1): | ||
line = self.__rawItem[lineNumber] | ||
if line.startswith("***") or line.startswith("===") and not line.startswith("===="): | ||
sectionBoundaries.append({"start": lineNumber}) | ||
sectionBoundaries.append({"start": contentEnd + 1}) | ||
|
||
# Set line number where section end | ||
for boundaryIndex in range(0, len(sectionBoundaries) - 1): | ||
sectionBoundaries[boundaryIndex]["end"] = sectionBoundaries[boundaryIndex + 1]["start"] | ||
|
||
# Remove End of File boundary | ||
del sectionBoundaries[-1] | ||
|
||
# Make list of sections and parse content | ||
sections = [] | ||
delimiters = [ | ||
{"name": "edit", "pattern": "*** Edited"}, | ||
{"name": "status", "pattern": "*** Status"}, | ||
{"name": "replyToUser", "pattern": "*** Replied"}, | ||
{"name": "replyFromUser", "pattern": "=== "} | ||
] | ||
|
||
for boundary in sectionBoundaries: | ||
line = self.__rawItem[boundary["start"]] | ||
sectionType = None | ||
|
||
for delimiter in delimiters: | ||
if line.startswith(delimiter["pattern"]): | ||
sectionType = delimiter["name"] | ||
|
||
if sectionType is None: | ||
sectionType = "initialMessage" | ||
|
||
sectionContent = self.__rawItem[boundary["start"] : boundary["end"]] | ||
sections.append({"type": sectionType, "content": sectionContent}) | ||
|
||
return sections |