コード例 #1
0
ファイル: views.py プロジェクト: guilhermeoki/tsuru-dashboard
    def get_context_data(self, *args, **kwargs):
        context = super(AppMixin, self).get_context_data(*args, **kwargs)

        app_name = kwargs['app_name']
        context['app'] = self.get_app(app_name)
        context['tabs'] = engine.get('app').tabs
        return context
コード例 #2
0
ファイル: views.py プロジェクト: guilhermeoki/tsuru-dashboard
    def get(self, request, *args, **kwargs):
        app_name = kwargs['app_name']

        page = int(request.GET.get('page', '1'))

        skip = (page * 20) - 20
        limit = page * 20

        url = '{}/deploys?app={}&skip={}&limit={}'.format(
            settings.TSURU_HOST, app_name, skip, limit)
        response = requests.get(url, headers=self.authorization)

        deploys = []
        if response.status_code != 204:
            deploys = response.json() or []

        context = {}
        context['deploys'] = deploys
        context['app'] = self.get_app(app_name)
        context['tabs'] = engine.get('app').tabs

        if len(deploys) >= 20:
            context['next'] = page + 1

        if page > 0:
            context['previous'] = page - 1

        return TemplateResponse(request, self.template, context=context)
コード例 #3
0
ファイル: views.py プロジェクト: raphamorim/tsuru-dashboard
    def get_context_data(self, *args, **kwargs):
        context = super(AppMixin, self).get_context_data(*args, **kwargs)

        app_name = kwargs['app_name']
        context['app'] = self.get_app(app_name)
        context['tabs'] = engine.get('app').tabs
        return context
コード例 #4
0
ファイル: views.py プロジェクト: raphamorim/tsuru-dashboard
    def get(self, request, *args, **kwargs):
        app_name = kwargs['app_name']

        page = int(request.GET.get('page', '1'))

        skip = (page * 20) - 20
        limit = page * 20

        url = '{}/deploys?app={}&skip={}&limit={}'.format(
            settings.TSURU_HOST, app_name, skip, limit)
        response = requests.get(url, headers=self.authorization)

        deploys = []
        if response.status_code != 204:
            deploys = response.json() or []

        context = {}
        context['deploys'] = deploys
        context['app'] = self.get_app(app_name)
        context['tabs'] = engine.get('app').tabs

        if len(deploys) >= 20:
            context['next'] = page + 1

        if page > 0:
            context['previous'] = page - 1

        return TemplateResponse(request, self.template, context=context)
コード例 #5
0
from tsuru_dashboard import engine


class AutoScaleTab(engine.Tab):
    name = 'autoscale'
    url_name = 'autoscale-app-info'

try:
    engine.get('app').register_tab(AutoScaleTab)
except engine.AppNotFound:
    pass
コード例 #6
0
from tsuru_dashboard import engine


class AutoScaleTab(engine.Tab):
    name = 'autoscale'
    url_name = 'autoscale-app-info'


try:
    engine.get('app').register_tab(AutoScaleTab)
except engine.AppNotFound:
    pass