コード例 #1
0
ファイル: views.py プロジェクト: mssumanth/Temp
 def get_context_data(self, **kwargs):
     context = super(DetailServiceView, self).get_context_data(**kwargs)
     context["service"] = self.get_data()
     context["service_name"] = getattr(self.service, 'name', '-')
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     return context
コード例 #2
0
ファイル: tabs.py プロジェクト: hybrid-murano/murano-mitaka
 def load_tab_data(self):
     if self._data is None:
         environment_id = tables.get_scheduler_id()
         env = api.environment_get(self.request, environment_id)
         self._data = {}
         self._data['env'] = env
         self._data['services'] = api.services_list(self.request, environment_id, env)
コード例 #3
0
ファイル: views.py プロジェクト: teazj/murano-dashboard
    def get_context_data(self, **kwargs):
        context = super(EnvironmentDetails, self).get_context_data(**kwargs)

        try:
            self.environment_id = self.kwargs['environment_id']
            env = api.environment_get(self.request, self.environment_id)
            context['environment_name'] = env.name
        except Exception:
            msg = _("Sorry, this environment doesn't exist anymore")
            redirect = self.get_redirect_url()
            exceptions.handle(self.request, msg, redirect=redirect)
            return context
        context['tenant_id'] = self.request.session['token'].tenant['id']
        context["url"] = self.get_redirect_url()
        table = env_tables.EnvironmentsTable(self.request)
        # record the origin row_action for EnvironmentsTable Meta
        ori_row_actions = table._meta.row_actions
        # remove the duplicate 'Manage Components' and 'DeployEnvironment'
        # actions that have already in Environment Details page
        # from table.render_row_actions, so the action render to the detail
        # page will exclude those two actions.
        table._meta.row_actions = filter(
            lambda x: x.name not in ('show', 'deploy'),
            table._meta.row_actions)
        context["actions"] = table.render_row_actions(env)
        # recover the origin row_action for EnvironmentsTable Meta
        table._meta.row_actions = ori_row_actions
        context['poll_interval'] = conf.HORIZON_CONFIG['ajax_poll_interval']
        return context
コード例 #4
0
 def get_context_data(self, **kwargs):
     context = super(DetailServiceView, self).get_context_data(**kwargs)
     context["service"] = self.get_data()
     context["service_name"] = getattr(self.service, 'name', '-')
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     return context
コード例 #5
0
ファイル: tabs.py プロジェクト: hybrid-murano/murano-mitaka
 def load_tab_data(self):
     if self._data is None:
         environment_id = self.kwargs['environment_id']
         env = api.environment_get(self.request, environment_id)
         self._data = {}
         self._data['env'] = env
         self._data['services'] = api.services_list(self.request, environment_id, env)
コード例 #6
0
ファイル: views.py プロジェクト: chenyujie/hybrid-dashboard
 def get_object(self):
     environment_id = self.kwargs['environment_id']
     try:
         return api.environment_get(self.request, environment_id)
     except Exception:
         redirect = reverse("horizon:murano:environments:index")
         msg = _('Unable to retrieve environment details.')
         exceptions.handle(self.request, msg, redirect=redirect)
コード例 #7
0
def creation_allowed(self, request, environment):
    environment_id = self.table.kwargs['environment_id']
    env = api.environment_get(request, environment_id)
    status = getattr(env, 'status', None)

    if status not in [STATUS_ID_DEPLOYING]:
        return True
    return False
コード例 #8
0
 def get_object(self):
     environment_id = self.kwargs['environment_id']
     try:
         return api.environment_get(self.request, environment_id)
     except Exception:
         redirect = reverse("horizon:murano:environments:index")
         msg = _('Unable to retrieve environment details.')
         exceptions.handle(self.request, msg, redirect=redirect)
コード例 #9
0
ファイル: views.py プロジェクト: mssumanth/murano-dashboard
 def get_context_data(self, **kwargs):
     context = super(DeploymentDetailsView, self).get_context_data(**kwargs)
     context["environment_id"] = self.environment_id
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     context["deployment_start_time"] = api.get_deployment_start(
         self.request, self.environment_id, self.deployment_id
     )
     return context
コード例 #10
0
 def allowed(self, request, environment):
     if environment:
         environment = api.environment_get(request, environment.id)
         if environment.status == STATUS_ID_DEPLOYING:
             deployment = api.deployments_list(request, environment.id)[0]
             last_action = timeutils.parse_strtime(
                 deployment.started.replace(' ', 'T'),
                 timeutils._ISO8601_TIME_FORMAT)
             return timeutils.is_older_than(last_action, 15 * 60)
     return True
コード例 #11
0
ファイル: views.py プロジェクト: mssumanth/Temp
 def get_context_data(self, **kwargs):
     context = super(DeploymentDetailsView, self).get_context_data(**kwargs)
     context["environment_id"] = self.environment_id
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     context["deployment_start_time"] = \
         api.get_deployment_start(self.request,
                                  self.environment_id,
                                  self.deployment_id)
     return context
コード例 #12
0
ファイル: views.py プロジェクト: alexvassel/sbrf
 def get_object(self, *args, **kwargs):
     if not hasattr(self, "_object"):
         environment_id = self.kwargs['environment_id']
         try:
             self._object = \
                 api.environment_get(self.request, environment_id)
         except Exception:
             redirect = reverse("horizon:murano:environments:index")
             msg = _('Unable to retrieve environment details.')
             exceptions.handle(self.request, msg, redirect=redirect)
     return self._object
コード例 #13
0
ファイル: tables.py プロジェクト: hybrid-murano/murano-mitaka
 def get_data(self, request, environment_id):
     try:
         return api.environment_get(request, environment_id)
     except exc.HTTPNotFound:
         # returning 404 to the ajax call removes the
         # row from the table on the ui
         raise django_http.Http404
     except Exception:
         # let our unified handler take care of errors here
         with api_utils.handled_exceptions(request):
             raise
コード例 #14
0
 def get_data(self, request, environment_id):
     try:
         return api.environment_get(request, environment_id)
     except exc.HTTPNotFound:
         # returning 404 to the ajax call removes the
         # row from the table on the ui
         raise django_http.Http404
     except Exception:
         # let our unified handler take care of errors here
         with api_utils.handled_exceptions(request):
             raise
コード例 #15
0
    def allowed(self, request, service):
        environment_id = self.table.kwargs['environment_id']
        env = api.environment_get(request, environment_id)
        status = getattr(env, 'status', None)
        version = getattr(env, 'version', None)

        if status == STATUS_ID_DEPLOYING:
            return False
        services = self.table.data
        if version == 0 and not services:
            return False
        return True
コード例 #16
0
 def get_context_data(self, **kwargs):
     context = super(DetailServiceView, self).get_context_data(**kwargs)
     service = self.get_data()
     context["service"] = service
     context["service_name"] = getattr(self.service, 'name', '-')
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     breadcrumb = [(context["environment_name"],
                    reverse("horizon:app-catalog:environments:services",
                            args=[self.environment_id])),
                   (_('Applications'), None)]
     context["custom_breadcrumb"] = breadcrumb
     return context
コード例 #17
0
ファイル: views.py プロジェクト: alexvassel/sbrf
    def get_context_data(self, **kwargs):
        context = super(EnvironmentDetails, self).get_context_data(**kwargs)

        try:
            self.environment_id = self.kwargs['environment_id']
            env = api.environment_get(self.request, self.environment_id)
            context['environment_name'] = env.name

        except Exception:
            msg = _("Sorry, this environment doesn't exist anymore")
            redirect = reverse("horizon:murano:environments:index")
            exceptions.handle(self.request, msg, redirect=redirect)
        return context
コード例 #18
0
ファイル: views.py プロジェクト: openstack/murano-dashboard
 def get_context_data(self, **kwargs):
     context = super(DetailServiceView, self).get_context_data(**kwargs)
     service = self.get_data()
     context["service"] = service
     context["service_name"] = getattr(self.service, 'name', '-')
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     breadcrumb = [
         (context["environment_name"],
          reverse("horizon:app-catalog:environments:services",
                  args=[self.environment_id])),
         (_('Applications'), None)]
     context["custom_breadcrumb"] = breadcrumb
     return context
コード例 #19
0
ファイル: views.py プロジェクト: mssumanth/Temp
    def get_context_data(self, **kwargs):
        context = super(EnvironmentDetails, self).get_context_data(**kwargs)

        try:
            self.environment_id = self.kwargs['environment_id']
            env = api.environment_get(self.request, self.environment_id)
            context['environment_name'] = env.name

        except Exception:
            msg = _("Sorry, this environment doesn't exist anymore")
            redirect = reverse("horizon:murano:environments:index")
            exceptions.handle(self.request, msg, redirect=redirect)
        context['tenant_id'] = self.request.session['token'].tenant['id']
        return context
コード例 #20
0
 def get_context_data(self, **kwargs):
     context = super(DetailServiceView, self).get_context_data(**kwargs)
     service = self.get_data()
     context["service"] = service
     context["service_name"] = getattr(self.service, "name", "-")
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     breadcrumb = [
         (_("Environments"), EnvironmentDetails.get_redirect_url()),
         (context["environment_name"], reverse("horizon:murano:environments:services", args=[self.environment_id])),
         (_("Applications"),),
     ]
     context["custom_breadcrumb"] = breadcrumb
     return context
コード例 #21
0
 def get_context_data(self, **kwargs):
     context = super(DeploymentDetailsView, self).get_context_data(**kwargs)
     context["environment_id"] = self.environment_id
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     context["deployment_start_time"] = api.get_deployment_start(
         self.request, self.environment_id, self.deployment_id
     )
     breadcrumb = [
         (_("Environments"), EnvironmentDetails.get_redirect_url()),
         (context["environment_name"], reverse("horizon:murano:environments:services", args=[self.environment_id])),
         (_("Deployments"),),
     ]
     context["custom_breadcrumb"] = breadcrumb
     return context
コード例 #22
0
    def get_context_data(self, **kwargs):
        context = super(EnvironmentDetails, self).get_context_data(**kwargs)

        try:
            self.environment_id = self.kwargs["environment_id"]
            env = api.environment_get(self.request, self.environment_id)
            context["environment_name"] = env.name

        except Exception:
            msg = _("Sorry, this environment doesn't exist anymore")
            redirect = self.get_redirect_url()
            exceptions.handle(self.request, msg, redirect=redirect)
        context["tenant_id"] = self.request.session["token"].tenant["id"]
        context["url"] = self.get_redirect_url()
        return context
コード例 #23
0
ファイル: views.py プロジェクト: teazj/murano-dashboard
 def get_context_data(self, **kwargs):
     context = super(DeploymentDetailsView, self).get_context_data(**kwargs)
     context["environment_id"] = self.environment_id
     env = api.environment_get(self.request, self.environment_id)
     context["environment_name"] = env.name
     context["deployment_start_time"] = \
         api.get_deployment_start(self.request,
                                  self.environment_id,
                                  self.deployment_id)
     breadcrumb = [
         (context["environment_name"],
          reverse("horizon:app-catalog:environments:services",
                  args=[self.environment_id])),
         (_('Deployments'), None)]
     context["custom_breadcrumb"] = breadcrumb
     return context
コード例 #24
0
ファイル: fields.py プロジェクト: hybrid-murano/murano-mitaka
 def update_network_params(self, request, environment_id):
     env = env_api.environment_get(request, environment_id)
     self.existing_subnet = env.networking.get('cidr')
     self.network_topology = env.networking.get('topology')
コード例 #25
0
ファイル: tables.py プロジェクト: mssumanth/murano-dashboard
def _get_environment_status_and_version(request, table):
    environment_id = table.kwargs.get('environment_id')
    env = api.environment_get(request, environment_id)
    status = getattr(env, 'status', None)
    version = getattr(env, 'version', None)
    return status, version
コード例 #26
0
ファイル: tables.py プロジェクト: mssumanth/murano-dashboard
 def get_data(self, request, environment_id):
     return api.environment_get(request, environment_id)
コード例 #27
0
 def get_data(self, request, environment_id):
     return api.environment_get(request, environment_id)
コード例 #28
0
def _get_environment_status_and_version(request, table):
    environment_id = table.kwargs.get('environment_id')
    env = api.environment_get(request, environment_id)
    status = getattr(env, 'status', None)
    version = getattr(env, 'version', None)
    return status, version
コード例 #29
0
    def allowed(self, request, service=None):
        environment_id = self.table.kwargs.get('environment_id')
        env = api.environment_get(request, environment_id)
        status = getattr(env, 'status', None)

        return False if status == STATUS_ID_DEPLOYING else True
コード例 #30
0
 def update_network_params(self, request, environment_id):
     env = env_api.environment_get(request, environment_id)
     self.existing_subnet = env.networking.get('cidr')
     self.network_topology = env.networking.get('topology')