semantics
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
# [DEF:GitPluginModule:Module]
|
||||
# #region GitPluginModule [TYPE Module] [SEMANTICS git, plugin, dashboard, version_control, sync, deploy]
|
||||
# @BRIEF Предоставляет плагин для версионирования и развертывания дашбордов Superset.
|
||||
# @LAYER Plugin
|
||||
# @INVARIANT Все операции с Git должны выполняться через GitService.
|
||||
# @RELATION INHERITS_FROM -> [src.core.plugin_base.PluginBase]
|
||||
# @RELATION USES -> [src.services.git_service.GitService]
|
||||
# @RELATION USES -> [src.core.superset_client.SupersetClient]
|
||||
# @RELATION USES -> [src.core.config_manager.ConfigManager]
|
||||
# @RELATION USES -> [TaskContext]
|
||||
#
|
||||
# @SEMANTICS: git, plugin, dashboard, version_control, sync, deploy
|
||||
# @PURPOSE: Предоставляет плагин для версионирования и развертывания дашбордов Superset.
|
||||
# @LAYER: Plugin
|
||||
# @RELATION: INHERITS_FROM -> src.core.plugin_base.PluginBase
|
||||
# @RELATION: USES -> src.services.git_service.GitService
|
||||
# @RELATION: USES -> src.core.superset_client.SupersetClient
|
||||
# @RELATION: USES -> src.core.config_manager.ConfigManager
|
||||
# @RELATION: USES -> TaskContext
|
||||
#
|
||||
# @INVARIANT: Все операции с Git должны выполняться через GitService.
|
||||
# @CONSTRAINT: Плагин работает только с распакованными YAML-экспортами Superset.
|
||||
|
||||
# [SECTION: IMPORTS]
|
||||
@@ -32,14 +31,14 @@ from src.core.database import SessionLocal
|
||||
from src.core.mapping_service import IdMappingService
|
||||
# [/SECTION]
|
||||
|
||||
# [DEF:GitPlugin:Class]
|
||||
# @PURPOSE: Реализация плагина Git Integration для управления версиями дашбордов.
|
||||
# #region GitPlugin [TYPE Class]
|
||||
# @BRIEF Реализация плагина Git Integration для управления версиями дашбордов.
|
||||
class GitPlugin(PluginBase):
|
||||
|
||||
# [DEF:__init__:Function]
|
||||
# @PURPOSE: Инициализирует плагин и его зависимости.
|
||||
# @PRE: config.json exists or shared config_manager is available.
|
||||
# @POST: Инициализированы git_service и config_manager.
|
||||
# #region __init__ [TYPE Function]
|
||||
# @BRIEF Инициализирует плагин и его зависимости.
|
||||
# @PRE config.json exists or shared config_manager is available.
|
||||
# @POST Инициализированы git_service и config_manager.
|
||||
def __init__(self):
|
||||
with belief_scope("GitPlugin.__init__"):
|
||||
log.reason("Initializing GitPlugin.")
|
||||
@@ -64,62 +63,62 @@ class GitPlugin(PluginBase):
|
||||
|
||||
self.config_manager = ConfigManager(config_path)
|
||||
log.reflect(f"GitPlugin initialized with {config_path}")
|
||||
# [/DEF:__init__:Function]
|
||||
# #endregion __init__
|
||||
|
||||
@property
|
||||
# [DEF:id:Function]
|
||||
# @PURPOSE: Returns the plugin identifier.
|
||||
# @PRE: GitPlugin is initialized.
|
||||
# @POST: Returns 'git-integration'.
|
||||
# #region id [TYPE Function]
|
||||
# @BRIEF Returns the plugin identifier.
|
||||
# @PRE GitPlugin is initialized.
|
||||
# @POST Returns 'git-integration'.
|
||||
def id(self) -> str:
|
||||
with belief_scope("GitPlugin.id"):
|
||||
return "git-integration"
|
||||
# [/DEF:id:Function]
|
||||
# #endregion id
|
||||
|
||||
@property
|
||||
# [DEF:name:Function]
|
||||
# @PURPOSE: Returns the plugin name.
|
||||
# @PRE: GitPlugin is initialized.
|
||||
# @POST: Returns the human-readable name.
|
||||
# #region name [TYPE Function]
|
||||
# @BRIEF Returns the plugin name.
|
||||
# @PRE GitPlugin is initialized.
|
||||
# @POST Returns the human-readable name.
|
||||
def name(self) -> str:
|
||||
with belief_scope("GitPlugin.name"):
|
||||
return "Git Integration"
|
||||
# [/DEF:name:Function]
|
||||
# #endregion name
|
||||
|
||||
@property
|
||||
# [DEF:description:Function]
|
||||
# @PURPOSE: Returns the plugin description.
|
||||
# @PRE: GitPlugin is initialized.
|
||||
# @POST: Returns the plugin's purpose description.
|
||||
# #region description [TYPE Function]
|
||||
# @BRIEF Returns the plugin description.
|
||||
# @PRE GitPlugin is initialized.
|
||||
# @POST Returns the plugin's purpose description.
|
||||
def description(self) -> str:
|
||||
with belief_scope("GitPlugin.description"):
|
||||
return "Version control for Superset dashboards"
|
||||
# [/DEF:description:Function]
|
||||
# #endregion description
|
||||
|
||||
@property
|
||||
# [DEF:version:Function]
|
||||
# @PURPOSE: Returns the plugin version.
|
||||
# @PRE: GitPlugin is initialized.
|
||||
# @POST: Returns the version string.
|
||||
# #region version [TYPE Function]
|
||||
# @BRIEF Returns the plugin version.
|
||||
# @PRE GitPlugin is initialized.
|
||||
# @POST Returns the version string.
|
||||
def version(self) -> str:
|
||||
with belief_scope("GitPlugin.version"):
|
||||
return "0.1.0"
|
||||
# [/DEF:version:Function]
|
||||
# #endregion version
|
||||
|
||||
@property
|
||||
# [DEF:ui_route:Function]
|
||||
# @PURPOSE: Returns the frontend route for the git plugin.
|
||||
# @RETURN: str - "/git"
|
||||
# #region ui_route [TYPE Function]
|
||||
# @BRIEF Returns the frontend route for the git plugin.
|
||||
# @RETURN str - "/git"
|
||||
def ui_route(self) -> str:
|
||||
with belief_scope("GitPlugin.ui_route"):
|
||||
return "/git"
|
||||
# [/DEF:ui_route:Function]
|
||||
# #endregion ui_route
|
||||
|
||||
# [DEF:get_schema:Function]
|
||||
# @PURPOSE: Возвращает JSON-схему параметров для выполнения задач плагина.
|
||||
# @PRE: GitPlugin is initialized.
|
||||
# @POST: Returns a JSON schema dictionary.
|
||||
# @RETURN: Dict[str, Any] - Схема параметров.
|
||||
# #region get_schema [TYPE Function]
|
||||
# @BRIEF Возвращает JSON-схему параметров для выполнения задач плагина.
|
||||
# @PRE GitPlugin is initialized.
|
||||
# @POST Returns a JSON schema dictionary.
|
||||
# @RETURN Dict[str, Any] - Схема параметров.
|
||||
def get_schema(self) -> Dict[str, Any]:
|
||||
with belief_scope("GitPlugin.get_schema"):
|
||||
return {
|
||||
@@ -132,12 +131,12 @@ class GitPlugin(PluginBase):
|
||||
},
|
||||
"required": ["operation", "dashboard_id"]
|
||||
}
|
||||
# [/DEF:get_schema:Function]
|
||||
# #endregion get_schema
|
||||
|
||||
# [DEF:initialize:Function]
|
||||
# @PURPOSE: Выполняет начальную настройку плагина.
|
||||
# @PRE: GitPlugin is initialized.
|
||||
# @POST: Плагин готов к выполнению задач.
|
||||
# #region initialize [TYPE Function]
|
||||
# @BRIEF Выполняет начальную настройку плагина.
|
||||
# @PRE GitPlugin is initialized.
|
||||
# @POST Плагин готов к выполнению задач.
|
||||
async def initialize(self):
|
||||
with belief_scope("GitPlugin.initialize"):
|
||||
log.reason("Initializing Git Integration Plugin logic")
|
||||
@@ -399,6 +398,6 @@ class GitPlugin(PluginBase):
|
||||
raise ValueError("No environments configured. Please add a Superset Environment in Settings.")
|
||||
# [/DEF:_get_env:Function]
|
||||
|
||||
# [/DEF:initialize:Function]
|
||||
# [/DEF:GitPlugin:Class]
|
||||
# [/DEF:GitPluginModule:Module]
|
||||
# #endregion initialize
|
||||
# #endregion GitPlugin
|
||||
# #endregion GitPluginModule
|
||||
|
||||
Reference in New Issue
Block a user