Commit 8b5c47849c33fe9e4cffb1f4af261c6f07363f97
1 parent
aadae467
Exists in
master
and in
1 other branch
Remove colab/proxy to add new changes
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
15 changed files
with
0 additions
and
211 deletions
Show diff stats
colab/__init__.py
colab/proxy/__init__.py
colab/proxy/gitlab/__init__.py
colab/proxy/gitlab/admin.py
colab/proxy/gitlab/apps.py
colab/proxy/gitlab/data_api.py
@@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
1 | -from colab.proxy.gitlab.models import * | ||
2 | -from colab.proxy.proxybase.proxy_data_api import ProxyDataAPI | ||
3 | -from django.db.models.fields import DateTimeField | ||
4 | -from dateutil.parser import parse | ||
5 | -import urllib2 | ||
6 | -import json | ||
7 | -from django.conf import settings | ||
8 | - | ||
9 | -class GitlabDataAPI(ProxyDataAPI): | ||
10 | - | ||
11 | - | ||
12 | - def fetchProjects(self): | ||
13 | - page = 1 | ||
14 | - projects = [] | ||
15 | - | ||
16 | - proxy_config = settings.PROXIED_APPS.get(self.app_label, {}) | ||
17 | - admin_token = proxy_config.get('auth_token') | ||
18 | - | ||
19 | - # Iterates throughout all projects pages | ||
20 | - while(True): | ||
21 | - data = urllib2.urlopen('https://beta.softwarepublico.gov.br/gitlab/api/v3/projects/all?private_token={}&per_page=100&page={}'.format(admin_token, page)) | ||
22 | - json_data = json.load(data) | ||
23 | - | ||
24 | - if len(json_data) == 0: | ||
25 | - break | ||
26 | - | ||
27 | - page = page + 1 | ||
28 | - | ||
29 | - for element in json_data: | ||
30 | - project = GitlabProject() | ||
31 | - | ||
32 | - for field in GitlabProject._meta.fields: | ||
33 | - value = element[field.name] | ||
34 | - value = parse(element[field.name]) if isinstance(field, DateTimeField) else value | ||
35 | - setattr(project, field.name, value) | ||
36 | - | ||
37 | - projects.append(project) | ||
38 | - | ||
39 | - return projects | ||
40 | - | ||
41 | - | ||
42 | - def fetchData(self): | ||
43 | - data = self.fetchProjects() | ||
44 | - | ||
45 | - for datum in data: | ||
46 | - datum.save() | ||
47 | - | ||
48 | - @property | ||
49 | - def app_label(self): | ||
50 | - return 'gitlab' | ||
51 | - |
colab/proxy/gitlab/diazo.xml
@@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
1 | -<rules | ||
2 | - xmlns="http://namespaces.plone.org/diazo" | ||
3 | - xmlns:css="http://namespaces.plone.org/diazo/css" | ||
4 | - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
5 | - | ||
6 | - <before theme-children="/html/head" content-children="/html/head" /> | ||
7 | - <before css:theme-children="#main-content" css:content-children="body" /> | ||
8 | - | ||
9 | - <merge attributes="class" css:theme="body" css:content="body" /> | ||
10 | - | ||
11 | - <!-- Add gitlab properties --> | ||
12 | - <merge attributes="data-page" css:theme="body" css:content="body" /> | ||
13 | - <merge attributes="data-project-id" css:theme="body" css:content="body" /> | ||
14 | - | ||
15 | - <drop css:content="#top-panel" /> | ||
16 | - <drop css:content=".navbar-gitlab" /> | ||
17 | - <drop css:content=".git-clone-holder .btn:contains('HTTPS')" /> | ||
18 | -</rules> |
colab/proxy/gitlab/migrations/0001_initial.py
@@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -from __future__ import unicode_literals | ||
3 | - | ||
4 | -from django.db import models, migrations | ||
5 | - | ||
6 | - | ||
7 | -class Migration(migrations.Migration): | ||
8 | - | ||
9 | - dependencies = [ | ||
10 | - ] | ||
11 | - | ||
12 | - operations = [ | ||
13 | - migrations.CreateModel( | ||
14 | - name='GitlabProject', | ||
15 | - fields=[ | ||
16 | - ('id', models.IntegerField(serialize=False, primary_key=True)), | ||
17 | - ('description', models.TextField()), | ||
18 | - ('public', models.BooleanField(default=True)), | ||
19 | - ('name', models.TextField()), | ||
20 | - ('name_with_namespace', models.TextField()), | ||
21 | - ('created_at', models.DateTimeField(blank=True)), | ||
22 | - ('last_activity_at', models.DateTimeField(blank=True)), | ||
23 | - ], | ||
24 | - options={ | ||
25 | - }, | ||
26 | - bases=(models.Model,), | ||
27 | - ), | ||
28 | - ] |
colab/proxy/gitlab/migrations/__init__.py
colab/proxy/gitlab/models.py
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -from django.db import models | ||
2 | -from django.conf import settings | ||
3 | -from colab.accounts.models import User | ||
4 | - | ||
5 | -class GitlabProject(models.Model): | ||
6 | - | ||
7 | - id = models.IntegerField(primary_key=True) | ||
8 | - description = models.TextField() | ||
9 | - public = models.BooleanField(default=True) | ||
10 | - name = models.TextField() | ||
11 | - name_with_namespace = models.TextField() | ||
12 | - created_at = models.DateTimeField(blank=True) | ||
13 | - last_activity_at = models.DateTimeField(blank=True) |
colab/proxy/gitlab/templates/gitlab/menu.html
@@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
1 | -{% load i18n %} | ||
2 | -<li class="dropdown"> | ||
3 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans "Repository" %} <b class="caret"></b></a> | ||
4 | - <ul class="dropdown-menu"> | ||
5 | - <li><a href="/gitlab/public/projects">{% trans "Public Projects" %}</a></li> | ||
6 | - {% if user.is_active %} | ||
7 | - <li><a href="/gitlab/profile">{% trans "Profile" %}</a></li> | ||
8 | - <li><a href="/gitlab/projects/new">{% trans "New Project" %}</a></li> | ||
9 | - <li><a href="/gitlab/dashboard/projects">{% trans "Projects" %}</a></li> | ||
10 | - <li><a href="/gitlab/profile/groups">{% trans "Groups" %}</a></li> | ||
11 | - <li><a href="/gitlab/dashboard/issues">{% trans "Issues" %}</a></li> | ||
12 | - <li><a href="/gitlab/dashboard/merge_requests">{% trans "Merge Requests" %}</a></li> | ||
13 | - {% endif %} | ||
14 | - </ul> | ||
15 | -</li> | ||
16 | \ No newline at end of file | 0 | \ No newline at end of file |
colab/proxy/gitlab/templates/proxy/gitlab.html
@@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
1 | -{% extends 'base.html' %} | ||
2 | -{% load static from staticfiles %} | ||
3 | - | ||
4 | -{% block head_css %} | ||
5 | -<style> | ||
6 | - /* Reset left and with for .modal-dialog style (like gitlab does), | ||
7 | - the bootstrap.css one makes it small */ | ||
8 | - @media screen and (min-width: 768px) { | ||
9 | - .modal-dialog { | ||
10 | - left: auto; | ||
11 | - width: auto; | ||
12 | - } | ||
13 | - } | ||
14 | - div#main-content { | ||
15 | - margin-top: 65px; | ||
16 | - } | ||
17 | - | ||
18 | - div#main-content div.container { | ||
19 | - width: 1110px; | ||
20 | - } | ||
21 | - div#main-content div.flash-container{ | ||
22 | - width: 85%; | ||
23 | - } | ||
24 | - #breadcrumbs { | ||
25 | - border: 0 !important; | ||
26 | - } | ||
27 | - | ||
28 | - #right-top-nav { | ||
29 | - margin-right: 5em !important; | ||
30 | - } | ||
31 | -</style> | ||
32 | -{% endblock %} | ||
33 | - | ||
34 | -{% block head_js %} | ||
35 | -<script type="text/javascript"> | ||
36 | - $(function(){ | ||
37 | - // bootstrap.css forces .hide {display:none!important}, and this makes | ||
38 | - // gitlab .hide elements NEVER have a display:block, so | ||
39 | - // instead of editing bootstrap.css, we just removed '.hide' css class and | ||
40 | - // toggled | ||
41 | - $('.hide').removeClass('hide').css('display', 'none'); | ||
42 | - | ||
43 | - // Hit the SSH clone button to select it by default | ||
44 | - jQuery(".git-clone-holder .btn:contains('SSH')").click() | ||
45 | - | ||
46 | - }); | ||
47 | -</script> | ||
48 | -<script type="text/javascript" src="{% static 'third-party/bootstrap/js/bootstrap.min.js' %}"></script> | ||
49 | -<script type="text/javascript" src="{% static 'third-party/jquery.cookie.js' %}"></script> | ||
50 | -<script>jQuery.noConflict();</script> | ||
51 | -{% endblock %} |
colab/proxy/gitlab/tests.py
colab/proxy/gitlab/urls.py