semantics

This commit is contained in:
2026-05-13 14:15:33 +03:00
parent 83b8f4d999
commit 39ab647851
514 changed files with 4270 additions and 6768 deletions

View File

@@ -1,4 +1,4 @@
# #region GitPluginModule [TYPE Module] [SEMANTICS git, plugin, dashboard, version_control, sync, deploy]
# #region GitPluginModule [TYPE Module] [SEMANTICS git, versioning, deploy, sync, superset]
#
# @BRIEF Предоставляет плагин для версионирования и развертывания дашбордов Superset.
# @LAYER: Plugin
@@ -30,7 +30,7 @@ from src.core.mapping_service import IdMappingService
# @BRIEF Реализация плагина Git Integration для управления версиями дашбордов.
class GitPlugin(PluginBase):
# [DEF:__init__:Function]
# region __init__ [TYPE Function]
# @PURPOSE: Инициализирует плагин и его зависимости.
# @PRE: config.json exists or shared config_manager is available.
# @POST: Инициализированы git_service и config_manager.
@@ -58,58 +58,58 @@ class GitPlugin(PluginBase):
self.config_manager = ConfigManager(config_path)
app_logger.info(f"GitPlugin initialized with {config_path}")
# [/DEF:__init__:Function]
# endregion __init__
@property
# [DEF:id:Function]
# region id [TYPE Function]
# @PURPOSE: 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]
# region name [TYPE Function]
# @PURPOSE: 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]
# region description [TYPE Function]
# @PURPOSE: 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]
# region version [TYPE Function]
# @PURPOSE: 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]
# region ui_route [TYPE Function]
# @PURPOSE: 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]
# region get_schema [TYPE Function]
# @PURPOSE: Возвращает JSON-схему параметров для выполнения задач плагина.
# @PRE: GitPlugin is initialized.
# @POST: Returns a JSON schema dictionary.
@@ -126,9 +126,9 @@ class GitPlugin(PluginBase):
},
"required": ["operation", "dashboard_id"]
}
# [/DEF:get_schema:Function]
# endregion get_schema
# [DEF:initialize:Function]
# region initialize [TYPE Function]
# @PURPOSE: Выполняет начальную настройку плагина.
# @PRE: GitPlugin is initialized.
# @POST: Плагин готов к выполнению задач.
@@ -136,7 +136,7 @@ class GitPlugin(PluginBase):
with belief_scope("GitPlugin.initialize"):
app_logger.reason("Initializing Git Integration Plugin logic.", extra={"src": "GitPlugin.initialize"})
# [DEF:execute:Function]
# region execute [TYPE Function]
# @PURPOSE: Основной метод выполнения задач плагина с поддержкой TaskContext.
# @PRE: task_data содержит 'operation' и 'dashboard_id'.
# @POST: Возвращает результат выполнения операции.
@@ -173,9 +173,9 @@ class GitPlugin(PluginBase):
log.info(f"Operation {operation} completed.")
return result
# [/DEF:execute:Function]
# endregion execute
# [DEF:_handle_sync:Function]
# region _handle_sync [TYPE Function]
# @PURPOSE: Экспортирует дашборд из Superset и распаковывает в Git-репозиторий.
# @PRE: Репозиторий для дашборда должен существовать.
# @POST: Файлы в репозитории обновлены до текущего состояния в Superset.
@@ -255,9 +255,9 @@ class GitPlugin(PluginBase):
except Exception as e:
app_logger.error(f"[_handle_sync][Coherence:Failed] Sync failed: {e}")
raise
# [/DEF:_handle_sync:Function]
# endregion _handle_sync
# [DEF:_handle_deploy:Function]
# region _handle_deploy [TYPE Function]
# @PURPOSE: Упаковывает репозиторий в ZIP и импортирует в целевое окружение Superset.
# @PRE: environment_id должен соответствовать настроенному окружению.
# @POST: Дашборд импортирован в целевой Superset.
@@ -326,9 +326,9 @@ class GitPlugin(PluginBase):
except Exception as e:
app_logger.error(f"[_handle_deploy][Coherence:Failed] Deployment failed: {e}")
raise
# [/DEF:_handle_deploy:Function]
# endregion _handle_deploy
# [DEF:_get_env:Function]
# region _get_env [TYPE Function]
# @PURPOSE: Вспомогательный метод для получения конфигурации окружения.
# @PARAM: env_id (Optional[str]) - ID окружения.
# @PRE: env_id is a string or None.
@@ -391,8 +391,8 @@ class GitPlugin(PluginBase):
app_logger.error(f"[_get_env][Coherence:Failed] No environments configured (searched config.json and DB). env_id={env_id}")
raise ValueError("No environments configured. Please add a Superset Environment in Settings.")
# [/DEF:_get_env:Function]
# endregion _get_env
# [/DEF:initialize:Function]
# endregion initialize
# #endregion GitPlugin
# #endregion GitPluginModule