예제 #1
0
    def _refresh_nodes_on_main_thread(self):
        status = model_status()
        for name, service in sorted(status['applications'].items()):
            service_w = ServiceWidget(name, service)
            for unit in service_w.Units:
                try:
                    unit_w = self.deployed[unit._name]
                except:
                    self.deployed[unit._name] = unit
                    unit_w = self.deployed[unit._name]
                    self.table.addColumns(
                        unit._name,
                        [
                            ('fixed', 3, getattr(unit_w, 'Icon')),
                            ('fixed', 50, getattr(unit_w, 'Name')),
                            ('fixed', 20, getattr(unit_w, 'AgentStatus'))
                        ]
                    )

                    if not hasattr(unit_w, 'WorkloadInfo'):
                        continue
                    self.table.addColumns(
                        unit._name,
                        [
                            ('fixed', 5, Text("")),
                            Color.info_context(
                                unit_w.WorkloadInfo)
                        ],
                        force=True)
                self.update_ui_state(unit_w, unit._unit)
예제 #2
0
    def refresh_nodes(self):
        """ Adds services to the view if they don't already exist
        """
        status = model_status()
        for name, service in sorted(status['applications'].items()):
            service_w = ServiceWidget(name, service)
            for unit in service_w.Units:
                services_list = []
                try:
                    unit_w = self.deployed[unit._name]
                except:
                    self.deployed[unit._name] = unit
                    unit_w = self.deployed[unit._name]
                    for k, label, width in self.view_columns:
                        if width == 0:
                            services_list.append(getattr(unit_w, k))
                        else:
                            if not hasattr(unit_w, k):
                                continue
                            services_list.append(
                                ('fixed', width, getattr(unit_w, k)))

                    self.table.addColumns(unit._name, services_list)
                    if not hasattr(unit_w, 'WorkloadInfo'):
                        continue
                    self.table.addColumns(
                        unit._name, [('fixed', 5, Text("")),
                                     Color.info_context(unit_w.WorkloadInfo)],
                        force=True)
                self.update_ui_state(unit_w, unit._unit)
예제 #3
0
    def refresh_nodes(self):
        """ Adds services to the view if they don't already exist
        """
        status = model_status()
        for name, service in sorted(status['applications'].items()):
            service_w = ServiceWidget(name, service)
            for unit in service_w.Units:
                services_list = []
                try:
                    unit_w = self.deployed[unit._name]
                except:
                    self.deployed[unit._name] = unit
                    unit_w = self.deployed[unit._name]
                    for k, label, width in self.view_columns:
                        if width == 0:
                            services_list.append(getattr(unit_w, k))
                        else:
                            if not hasattr(unit_w, k):
                                continue
                            services_list.append(('fixed', width,
                                                  getattr(unit_w, k)))

                    self.table.addColumns(unit._name, services_list)
                    if not hasattr(unit_w, 'WorkloadInfo'):
                        continue
                    self.table.addColumns(
                        unit._name,
                        [
                            ('fixed', 5, Text("")),
                            Color.info_context(
                                unit_w.WorkloadInfo)
                        ],
                        force=True)
                self.update_ui_state(unit_w, unit._unit)
예제 #4
0
 def _build_widget(self):
     applications = model_status()['applications']
     total_items = []
     total_items.append(Instruction("Deployment Information:"))
     total_items.append(HR())
     tbl = Pile([
         Columns([('fixed', 15, Text("Name")),
                  Text(self.model['name'])]),
         Columns([('fixed', 15, Text("Cloud")),
                  Text(self.model['cloud'])]),
         Columns([('fixed', 15, Text("Status")),
                  Text(self.model['status']['current'])]),
         Columns([('fixed', 15, Text("Online")),
                  Text(self._sanitize_date(self.model['status']['since']))
                  ]),
         Columns([('fixed', 15, Text("Applications")),
                  Text(", ".join(applications.keys()))]),
         Columns([('fixed', 15, Text("Machines")),
                  Text(str(self._total_machines(self.model)))])
     ])
     total_items.append(tbl)
     total_items.append(HR())
     return Padding.center_80(Filler(Pile(total_items), valign='top'))
예제 #5
0
    def _refresh_nodes_on_main_thread(self):
        status = model_status()
        for name, service in sorted(status['applications'].items()):
            service_w = ServiceWidget(name, service)
            for unit in service_w.Units:
                try:
                    unit_w = self.deployed[unit._name]
                except:
                    self.deployed[unit._name] = unit
                    unit_w = self.deployed[unit._name]
                    self.table.addColumns(
                        unit._name,
                        [('fixed', 3, getattr(unit_w, 'Icon')),
                         ('fixed', 50, getattr(unit_w, 'Name')),
                         ('fixed', 20, getattr(unit_w, 'AgentStatus'))])

                    if not hasattr(unit_w, 'WorkloadInfo'):
                        continue
                    self.table.addColumns(
                        unit._name, [('fixed', 5, Text("")),
                                     Color.info_context(unit_w.WorkloadInfo)],
                        force=True)
                self.update_ui_state(unit_w, unit._unit)