You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2018/07/06 18:26:23 UTC

[1/3] allura git commit: [#8215] Personal Dashboard - Sort based on 'mod_date' descending order

Repository: allura
Updated Branches:
  refs/heads/master 1d155ce85 -> a1181f25f


[#8215] Personal Dashboard - Sort based on 'mod_date' descending order


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/a1181f25
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/a1181f25
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/a1181f25

Branch: refs/heads/master
Commit: a1181f25f0f982af095393dacd6ba4ca8852225b
Parents: 762f993
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Fri Jul 6 21:56:15 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri Jul 6 14:18:59 2018 -0400

----------------------------------------------------------------------
 Allura/allura/model/auth.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a1181f25/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index cd48331..8ebef71 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -742,7 +742,7 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable):
 
         from .repository import MergeRequest
 
-        return MergeRequest.query.find({'creator_id': self._id}).sort('mod_date', pymongo.ASCENDING)
+        return MergeRequest.query.find({'creator_id': self._id}).sort('mod_date', pymongo.DESCENDING)
 
     def set_password(self, new_password):
         return plugin.AuthenticationProvider.get(request).set_password(


[2/3] allura git commit: [#8215] Personal Dashboard - Fix the link of merge request, add 'creator_id' to index list and sort search results according to 'mod_date'

Posted by br...@apache.org.
[#8215] Personal Dashboard - Fix the link of merge request, add 'creator_id' to index list and sort search results according to 'mod_date'


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/762f9938
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/762f9938
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/762f9938

Branch: refs/heads/master
Commit: 762f9938dbfbb07c483b46c5ca7bbf3866adbd0e
Parents: 1e8a47e
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Fri Jul 6 10:47:32 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri Jul 6 14:18:59 2018 -0400

----------------------------------------------------------------------
 .../personal_dashboard/templates/sections/merge_requests.html  | 6 +++---
 Allura/allura/model/auth.py                                    | 3 ++-
 Allura/allura/model/repository.py                              | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/762f9938/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
index ba9740d..368e1df 100644
--- a/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
@@ -43,9 +43,9 @@
         <tbody>
         {% for req in requests %}
             <tr>
-                <td><a href="{{ req.request_number }}/">{{ req.request_number }}</a></td>
-                <td><a href="{{ req.request_number }}/">{{ req.status }}</a></td>
-                <td><a href="{{ req.request_number }}/">{{ req.summary }}</a></td>
+                <td><a href="{{ req.url() }}">{{ req.request_number }}</a></td>
+                <td><a href="{{ req.url() }}">{{ req.status }}</a></td>
+                <td><a href="{{ req.url() }}">{{ req.summary }}</a></td>
                 <td>{% if req.downstream_repo %}
                     <a href="{{ req.downstream_url }}">{{ req.downstream_url }}</a>
                 {% else %}

http://git-wip-us.apache.org/repos/asf/allura/blob/762f9938/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 0abdaa5..cd48331 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -735,13 +735,14 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable):
         from .project import Project
 
         return Project.query.find({'_id': {'$in': projects}, 'deleted': False}).all()
+
     def my_merge_requests(self):
         if self.is_anonymous():
             return
 
         from .repository import MergeRequest
 
-        return MergeRequest.query.find({'creator_id': self._id}).sort('request_number', pymongo.ASCENDING)
+        return MergeRequest.query.find({'creator_id': self._id}).sort('mod_date', pymongo.ASCENDING)
 
     def set_password(self, new_password):
         return plugin.AuthenticationProvider.get(request).set_password(

http://git-wip-us.apache.org/repos/asf/allura/blob/762f9938/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 4724165..8ec5959 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -794,7 +794,7 @@ class MergeRequest(VersionedArtifact, ActivityObject):
 
     class __mongometa__:
         name = 'merge-request'
-        indexes = ['commit_id']
+        indexes = ['commit_id', 'creator_id']
         unique_indexes = [('app_config_id', 'request_number')]
     type_s = 'MergeRequest'
 


[3/3] allura git commit: [#8215] Personal Dashboard - Create Merge Requests Section

Posted by br...@apache.org.
[#8215] Personal Dashboard - Create Merge Requests Section


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/1e8a47e0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1e8a47e0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1e8a47e0

Branch: refs/heads/master
Commit: 1e8a47e0ca2cf300bd2849504a00d0027adbd789
Parents: 1d155ce
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Thu Jul 5 00:13:38 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri Jul 6 14:18:59 2018 -0400

----------------------------------------------------------------------
 .../ext/personal_dashboard/dashboard_main.py    | 20 ++++++++++++
 .../templates/sections/merge_requests.html      | 33 +++++++++++++++++++-
 Allura/allura/model/auth.py                     |  7 +++++
 3 files changed, 59 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/1e8a47e0/Allura/allura/ext/personal_dashboard/dashboard_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/dashboard_main.py b/Allura/allura/ext/personal_dashboard/dashboard_main.py
index dd751cf..d5676b7 100644
--- a/Allura/allura/ext/personal_dashboard/dashboard_main.py
+++ b/Allura/allura/ext/personal_dashboard/dashboard_main.py
@@ -110,6 +110,26 @@ class TicketsSection(DashboardSectionBase):
 class MergeRequestsSection(DashboardSectionBase):
     template = 'allura.ext.personal_dashboard:templates/sections/merge_requests.html'
 
+    def get_merge_requests(self):
+        return [
+            merge_request
+            for merge_request in self.user.my_merge_requests()]
+
+    def prepare_context(self, context):
+        context['requests'] = self.get_merge_requests()
+        return context
+
+    def __json__(self):
+        merge_requests = [
+            dict(
+                status=merge_request['status'],
+                summary=merge_request['summary'],
+                repository=merge_request['repository'],
+                created=merge_request['created'],
+                updated=merge_request['updated'])
+            for merge_request in self.get_merge_requests()]
+        return dict(merge_requests=merge_requests)
+
 
 class FollowersSection(DashboardSectionBase):
     template = 'allura.ext.personal_dashboard:templates/sections/followers.html'

http://git-wip-us.apache.org/repos/asf/allura/blob/1e8a47e0/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
index 10c2dcb..ba9740d 100644
--- a/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
@@ -17,6 +17,8 @@
        under the License.
 -#}
 {% extends "allura.ext.personal_dashboard:templates/dashboard_section_base.html" %}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
+{% import g.theme.jinja_macros as theme_macros with context %}
 
 {% block title %}
     Merge Requests
@@ -26,4 +28,33 @@
 
 {% block section_class %}merge_requests{% endblock %}
 
-{% block content %}{% endblock %}
+{% block content %}
+    <table>
+        <thead>
+        <tr>
+            <th>#</th>
+            <th>Status</th>
+            <th>Summary</th>
+            <th>Repository</th>
+            <th>Created</th>
+            <th>Updated</th>
+        </tr>
+        </thead>
+        <tbody>
+        {% for req in requests %}
+            <tr>
+                <td><a href="{{ req.request_number }}/">{{ req.request_number }}</a></td>
+                <td><a href="{{ req.request_number }}/">{{ req.status }}</a></td>
+                <td><a href="{{ req.request_number }}/">{{ req.summary }}</a></td>
+                <td>{% if req.downstream_repo %}
+                    <a href="{{ req.downstream_url }}">{{ req.downstream_url }}</a>
+                {% else %}
+                    <i>(deleted)</i>
+                {% endif %}</td>
+                <td>{{ lib.abbr_date(req.created) }}</td>
+                <td>{{ lib.abbr_date(req.mod_date) }}</td>
+            </tr>
+        {% endfor %}
+        </tbody>
+    </table>
+{% endblock %}

http://git-wip-us.apache.org/repos/asf/allura/blob/1e8a47e0/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 65e83b4..0abdaa5 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -735,6 +735,13 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable):
         from .project import Project
 
         return Project.query.find({'_id': {'$in': projects}, 'deleted': False}).all()
+    def my_merge_requests(self):
+        if self.is_anonymous():
+            return
+
+        from .repository import MergeRequest
+
+        return MergeRequest.query.find({'creator_id': self._id}).sort('request_number', pymongo.ASCENDING)
 
     def set_password(self, new_password):
         return plugin.AuthenticationProvider.get(request).set_password(