|
|
@ -13,13 +13,17 @@ class AppCategory(models.TextChoices):
|
|
|
|
def get_label(cls, category):
|
|
|
|
def get_label(cls, category):
|
|
|
|
return dict(cls.choices).get(category, '')
|
|
|
|
return dict(cls.choices).get(category, '')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def is_xpack(cls, category):
|
|
|
|
|
|
|
|
return category in ['remote_app']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AppType(models.TextChoices):
|
|
|
|
class AppType(models.TextChoices):
|
|
|
|
# db category
|
|
|
|
# db category
|
|
|
|
mysql = 'mysql', 'MySQL'
|
|
|
|
mysql = 'mysql', 'MySQL'
|
|
|
|
|
|
|
|
mariadb = 'mariadb', 'MariaDB'
|
|
|
|
oracle = 'oracle', 'Oracle'
|
|
|
|
oracle = 'oracle', 'Oracle'
|
|
|
|
pgsql = 'postgresql', 'PostgreSQL'
|
|
|
|
pgsql = 'postgresql', 'PostgreSQL'
|
|
|
|
mariadb = 'mariadb', 'MariaDB'
|
|
|
|
|
|
|
|
sqlserver = 'sqlserver', 'SQLServer'
|
|
|
|
sqlserver = 'sqlserver', 'SQLServer'
|
|
|
|
redis = 'redis', 'Redis'
|
|
|
|
redis = 'redis', 'Redis'
|
|
|
|
mongodb = 'mongodb', 'MongoDB'
|
|
|
|
mongodb = 'mongodb', 'MongoDB'
|
|
|
@ -37,9 +41,13 @@ class AppType(models.TextChoices):
|
|
|
|
def category_types_mapper(cls):
|
|
|
|
def category_types_mapper(cls):
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
AppCategory.db: [
|
|
|
|
AppCategory.db: [
|
|
|
|
cls.mysql, cls.oracle, cls.pgsql, cls.mariadb, cls.sqlserver, cls.redis, cls.mongodb
|
|
|
|
cls.mysql, cls.oracle, cls.pgsql, cls.mariadb,
|
|
|
|
|
|
|
|
cls.sqlserver, cls.redis, cls.mongodb
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
AppCategory.remote_app: [
|
|
|
|
|
|
|
|
cls.chrome, cls.mysql_workbench,
|
|
|
|
|
|
|
|
cls.vmware_client, cls.custom
|
|
|
|
],
|
|
|
|
],
|
|
|
|
AppCategory.remote_app: [cls.chrome, cls.mysql_workbench, cls.vmware_client, cls.custom],
|
|
|
|
|
|
|
|
AppCategory.cloud: [cls.k8s]
|
|
|
|
AppCategory.cloud: [cls.k8s]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -66,3 +74,12 @@ class AppType(models.TextChoices):
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def cloud_types(cls):
|
|
|
|
def cloud_types(cls):
|
|
|
|
return [tp.value for tp in cls.category_types_mapper()[AppCategory.cloud]]
|
|
|
|
return [tp.value for tp in cls.category_types_mapper()[AppCategory.cloud]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def is_xpack(cls, tp):
|
|
|
|
|
|
|
|
tp_category_mapper = cls.type_category_mapper()
|
|
|
|
|
|
|
|
category = tp_category_mapper[tp]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if AppCategory.is_xpack(category):
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
return tp in ['oracle', 'postgresql', 'sqlserver']
|
|
|
|