-
Notifications
You must be signed in to change notification settings - Fork 71
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
Overhaul dashboard, add Todos, and improve typography #422
Conversation
</div> | ||
</div> | ||
</section> | ||
<!--/section-panel tasks-section --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -64,14 +64,14 @@ export function orchestraService () { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only thing that changed in style.css
above is the font stack moving over to the system fonts. the diff is large because of whitespace cleanup.
""" | ||
This function is used by both the project management interface | ||
(project admins only) and for providing project information to | ||
experts (only to experts associated with a project). We enfoce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enforce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
project_id = load_encoded_json(request.body)['project_id'] | ||
worker = Worker.objects.get(user=request.user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_object_or_404
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -0,0 +1,21 @@ | |||
# -*- coding: utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe put in 1 migration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -64,14 +64,14 @@ export function orchestraService () { | |||
|
|||
export function orchestraTasks ($http) { | |||
'ngAnnotate' | |||
const activeState = (task) => task.state === 'in_progress' || task.state === 'returned' || task.state === 'just_added' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['just_added', 'in_progress', 'returned'].indexOf(task.state) !== -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
return tasks | ||
}, | ||
allTasks: function () { return this.tasks }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this function ()
be replaced with () =>
below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i initially did just this to "modernize" this part of the code, but ran into an issue---the object syntax we're using to create these functions on orchestraTasks
requires this be bound in a way that function
definitions do, and modern () =>
definitions do not.
i propose we modernize the whole module in a separate PR :)
worker = get_object_or_404(Worker, user=request.user) | ||
if not (is_project_admin(request.user) or | ||
worker.assignments.filter(task__project=project_id).exists()): | ||
raise BadRequest('Permission denied') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a 403 or 404 on Permission denied, not a 400?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also looks like you created nice permission classes for this in your PR, can they be reused here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's only one exception type for jsonviews: https://github.com/jsocol/django-jsonview/blob/master/jsonview/exceptions.py#L1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
permission_classes
by default can only be ANDed, not ORed. This project addresses that, and we can consider depending on it in a followon PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to win an argument, just return Django's PermissionDenied
.
That project looks useful, but I don't really think our security needs are complex enough to merit adding dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
orchestra/models/__init__.py
Outdated
@@ -14,4 +14,5 @@ | |||
from orchestra.models.core.models import Iteration # noqa | |||
from orchestra.models.core.models import TimeEntry # noqa | |||
from orchestra.models.core.models import TaskTimer # noqa | |||
from orchestra.models.core.models import Todo # noqa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like you complained about this to me :-)
If you leave this here, the way to get rid of the noqas is to define __all__
, which makes some sense if the point of this code is to gather a bunch of symbols in one module. (Though python people fight about it a lot).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did __all__
overall i dislike this model of doing things, but refactors/cleanups on this PR are out of the question :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: but now you should be able to remove all the # noqa
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
orchestra/models/core/mixins.py
Outdated
@@ -61,6 +61,9 @@ def __str__(self): | |||
self.phone | |||
) | |||
|
|||
def formatted_slack_username(self): | |||
return '<@{}|{}>'.format(self.slack_user_id, self.slack_username) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated (see https://api.slack.com/changelog/2017-09-the-one-about-usernames), they want you to just pass the user_id and let them figure out the display name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Thanks! I didn't know that.
return False | ||
|
||
|
||
class TodoList(generics.ListCreateAPIView): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No good viewsets to let you combine the list and detail views?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I could find :P
orchestra/utils/task_lifecycle.py
Outdated
if next_todo: | ||
next_todo_description = next_todo.description | ||
num_todos = task_assignment.task.todos.count() | ||
should_be_active = ((num_todos == 0) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why active if there are no todos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comment explaining why :)
<td>{{task.detail}}</td> | ||
<td>{{task.next_todo_description}}</td> | ||
<td>{{task.detail|limitTo:50}}{{task.detail.length > 50 ? '...' : ''}}</td> | ||
<td>{{task.next_todo_description|limitTo:50}}{{task.next_todo_description.length > 50 ? '...' : ''}}</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there pagination? Or does this make it impossible to see > 50 tasks? (i.e., what if Kirstin needs to work on task 51?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this truncates text to 50 characters so the table doesn't wrap
This PR does three things:
Great example of a terrible PR in that it does three things at once. This was the result of a B12 hackathon, and I'm getting it out there rather than keeping it under wraps. If reviewing it is too much of a headache, I can break it into smaller PRs.
TODO