Example #1
0
 def getConfDelete(self, conf: Audit, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf).ui
     shortcut = shortcut_service.getShortcut(int(conf.record_id))
     conf_audit.name.setText("Deleted %s" % shortcut.label)
     conf_audit.type.setText("Deleted")
     conf_audit.type.setStyleSheet(
         "background-color: red; padding: 2px 5px; color: white")
     return conf_audit
Example #2
0
 def getConfDelete(self, conf: Audit, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf).ui
     mapping = environment_service.getEnvironment(int(conf.record_id))
     conf_audit.name.setText("Deleted env %s" % mapping.name)
     conf_audit.type.setText("Deleted")
     conf_audit.type.setStyleSheet(
         "background-color: red; padding: 2px 5px; color: white")
     return conf_audit
Example #3
0
 def getConfDelete(self, conf: Audit, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf).ui
     mapping = volume_mount_service.getVolumeMount(int(conf.record_id))
     conf_audit.name.setText("Deleted volume mapping %s:%s" %
                             (mapping.host_path, mapping.container_path))
     conf_audit.type.setText("Deleted")
     conf_audit.type.setStyleSheet(
         "background-color: red; padding: 2px 5px; color: white")
     return conf_audit
Example #4
0
 def getConfDelete(self, conf: Audit, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf).ui
     port_mapping = port_mapping_service.getPortMapping(int(conf.record_id))
     conf_audit.name.setText("Deleted port mapping %s:%s" %
                             (port_mapping.target_port, port_mapping.port))
     conf_audit.type.setText("Deleted")
     conf_audit.type.setStyleSheet(
         "background-color: red; padding: 2px 5px; color: white")
     return conf_audit
Example #5
0
 def getConfCreate(self, conf: Audit, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf).ui
     mapping = port_mapping_service.getPortMapping(int(conf.record_id))
     conf_audit.name.setText("Mapping host port %s to container port %s" %
                             (mapping.target_port, mapping.port))
     conf_audit.type.setText("Created")
     conf_audit.type.setStyleSheet(
         "background-color: green; padding: 2px 5px; color: white")
     return conf_audit
Example #6
0
 def getConfCreate(self, conf: Audit, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf).ui
     shortcut = shortcut_service.getShortcut(int(conf.record_id))
     conf_audit.name.setText("Set %s to %s" %
                             (shortcut.label, shortcut.default_value))
     conf_audit.type.setText("Created")
     conf_audit.type.setStyleSheet(
         "background-color: green; padding: 2px 5px; color: white")
     return conf_audit
Example #7
0
 def getConfUpdate(self, conf_obj: AuditUpdate, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf_obj).ui
     mapping = environment_service.getEnvironment(int(conf_obj.record_id))
     if conf_obj.field == "name":
         conf_audit.name.setText("Env name changed from %s to %s" %
                                 (conf_obj.value_from, conf_obj.value_to))
     elif conf_obj.field == "value":
         conf_audit.name.setText("Env %s set value to %s" %
                                 (mapping.name, conf_obj.value_to))
     conf_audit.type.setText("Updated")
     conf_audit.type.setStyleSheet(
         "background-color: yellow; padding: 2px 5px; color: black")
     return conf_audit
Example #8
0
 def getConfUpdate(self, conf_obj: AuditUpdate, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf_obj).ui
     if conf_obj.field == "port":
         conf_audit.name.setText("Container port changed from %s to %s" %
                                 (conf_obj.value_from, conf_obj.value_to))
     elif conf_obj.field == "target_port":
         conf_audit.name.setText("Host port changed from %s to %s" %
                                 (conf_obj.value_from, conf_obj.value_to))
     elif conf_obj.field == "protocol":
         conf_audit.name.setText("Protocol changed from from %s to %s" %
                                 (conf_obj.value_from, conf_obj.value_to))
     conf_audit.type.setText("Updated")
     conf_audit.type.setStyleSheet(
         "background-color: yellow; padding: 2px 5px; color: black")
     return conf_audit
Example #9
0
 def getConfUpdate(self, conf_obj: AuditUpdate, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf_obj).ui
     if conf_obj.field == "host_path":
         conf_audit.name.setText("Volume host path changed from %s to %s" %
                                 (conf_obj.value_from, conf_obj.value_to))
     elif conf_obj.field == "container_path":
         conf_audit.name.setText(
             "Volume container path changed from %s to %s" %
             (conf_obj.value_from, conf_obj.value_to))
     elif conf_obj.field == "mode":
         conf_audit.name.setText("Mount mode changed from from %s to %s" %
                                 (conf_obj.value_from, conf_obj.value_to))
     conf_audit.type.setText("Updated")
     conf_audit.type.setStyleSheet(
         "background-color: yellow; padding: 2px 5px; color: black")
     return conf_audit
Example #10
0
 def getConfUpdate(self, conf_obj: AuditUpdate, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf_obj).ui
     if conf_obj.field == "tag":
         conf_audit.name.setText("Image Tag changed from %s to %s" %
                                 (conf_obj.value_from, conf_obj.value_to))
     elif conf_obj.field == "memory_limit":
         conf_audit.name.setText(
             "Amount of Memory allowed is limited to %sMB" %
             conf_obj.value_to)
     elif conf_obj.field == "cpu_limit":
         conf_audit.name.setText(
             "Number of CPU allowed is limited to %s cpus" %
             conf_obj.value_to)
     elif conf_obj.field == "entrypoint":
         conf_audit.name.setText("Entrypoint changed to %s" %
                                 conf_obj.value_to)
     conf_audit.type.setText("Updated")
     conf_audit.type.setStyleSheet(
         "background-color: yellow; padding: 2px 5px; color: black")
     return conf_audit
Example #11
0
 def getConfUpdate(self, conf: AuditUpdate, parent=None) -> QWidget:
     conf_audit = ConfAuditHandler(parent, self.container, conf).ui
     shortcut = shortcut_service.getShortcut(int(conf.record_id))
     if conf.field == "enabled":
         if conf.value_to == "True":
             conf_audit.name.setText(
                 "Enabled %s %s" % (shortcut.label, shortcut.default_value))
         else:
             conf_audit.name.setText(
                 "Disabled %s %s" %
                 (shortcut.label, shortcut.default_value))
     else:
         if shortcut.shortcut == 'Volume Mount':
             conf_audit.name.setText("%s changed to %s" %
                                     (shortcut.label, conf.value_to))
         else:
             conf_audit.name.setText(
                 "%s changed from %s to %s" %
                 (shortcut.label, conf.value_from, conf.value_to))
     conf_audit.type.setText("Updated")
     conf_audit.type.setStyleSheet(
         "background-color: yellow; padding: 2px 5px; color: black")
     return conf_audit