semantic cleanup
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
<!-- [DEF:GitDashboardPage:Component] -->
|
||||
<!--
|
||||
@PURPOSE: Dashboard management page for Git integration.
|
||||
@LAYER: Page
|
||||
@SEMANTICS: git, dashboard, management, ui
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import DashboardGrid from '../../components/DashboardGrid.svelte';
|
||||
@@ -13,6 +18,10 @@
|
||||
let loading = true;
|
||||
let fetchingDashboards = false;
|
||||
|
||||
// [DEF:fetchEnvironments:Function]
|
||||
// @PURPOSE: Fetches the list of deployment environments from the API.
|
||||
// @PRE: Component is mounted.
|
||||
// @POST: `environments` array is populated with data from /api/environments.
|
||||
async function fetchEnvironments() {
|
||||
try {
|
||||
const response = await fetch('/api/environments');
|
||||
@@ -27,7 +36,12 @@
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
// [/DEF:fetchEnvironments:Function]
|
||||
|
||||
// [DEF:fetchDashboards:Function]
|
||||
// @PURPOSE: Fetches dashboards for a specific environment.
|
||||
// @PRE: `envId` is a valid environment ID.
|
||||
// @POST: `dashboards` array is updated with results from the environment.
|
||||
async function fetchDashboards(envId: string) {
|
||||
if (!envId) return;
|
||||
fetchingDashboards = true;
|
||||
@@ -42,6 +56,7 @@
|
||||
fetchingDashboards = false;
|
||||
}
|
||||
}
|
||||
// [/DEF:fetchDashboards:Function]
|
||||
|
||||
onMount(fetchEnvironments);
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
// [DEF:loadConfigs:Function]
|
||||
/**
|
||||
* @purpose Fetches existing git configurations.
|
||||
* @pre Component is mounted.
|
||||
* @post configs state is populated.
|
||||
*/
|
||||
async function loadConfigs() {
|
||||
try {
|
||||
@@ -48,6 +50,8 @@
|
||||
// [DEF:handleTest:Function]
|
||||
/**
|
||||
* @purpose Tests connection to a git server with current form data.
|
||||
* @pre newConfig contains valid provider, url, and pat.
|
||||
* @post testing state is managed; toast shown with result.
|
||||
*/
|
||||
async function handleTest() {
|
||||
testing = true;
|
||||
@@ -69,6 +73,8 @@
|
||||
// [DEF:handleSave:Function]
|
||||
/**
|
||||
* @purpose Saves a new git configuration.
|
||||
* @pre newConfig is valid and tested.
|
||||
* @post New config is saved to DB and added to configs list.
|
||||
*/
|
||||
async function handleSave() {
|
||||
try {
|
||||
@@ -86,6 +92,8 @@
|
||||
/**
|
||||
* @purpose Deletes a git configuration by ID.
|
||||
* @param {string} id - Configuration ID.
|
||||
* @pre id is valid; user confirmed deletion.
|
||||
* @post Configuration is removed from DB and local state.
|
||||
*/
|
||||
async function handleDelete(id) {
|
||||
if (!confirm('Are you sure you want to delete this Git configuration?')) return;
|
||||
|
||||
Reference in New Issue
Block a user