project map script | semantic parcer
This commit is contained in:
@@ -8,11 +8,10 @@ import { PUBLIC_WS_URL } from '$env/static/public';
|
||||
|
||||
const API_BASE_URL = '/api';
|
||||
|
||||
/**
|
||||
* Returns the WebSocket URL for a specific task, with fallback logic.
|
||||
* @param {string} taskId
|
||||
* @returns {string}
|
||||
*/
|
||||
// [DEF:getWsUrl:Function]
|
||||
// @PURPOSE: Returns the WebSocket URL for a specific task, with fallback logic.
|
||||
// @PARAM: taskId (string) - The ID of the task.
|
||||
// @RETURN: string - The WebSocket URL.
|
||||
export const getWsUrl = (taskId) => {
|
||||
let baseUrl = PUBLIC_WS_URL;
|
||||
if (!baseUrl) {
|
||||
@@ -22,6 +21,7 @@ export const getWsUrl = (taskId) => {
|
||||
}
|
||||
return `${baseUrl}/ws/logs/${taskId}`;
|
||||
};
|
||||
// [/DEF:getWsUrl:Function]
|
||||
|
||||
// [DEF:fetchApi:Function]
|
||||
// @PURPOSE: Generic GET request wrapper.
|
||||
@@ -41,7 +41,7 @@ async function fetchApi(endpoint) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// [/DEF:fetchApi]
|
||||
// [/DEF:fetchApi:Function]
|
||||
|
||||
// [DEF:postApi:Function]
|
||||
// @PURPOSE: Generic POST request wrapper.
|
||||
@@ -68,7 +68,7 @@ async function postApi(endpoint, body) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// [/DEF:postApi]
|
||||
// [/DEF:postApi:Function]
|
||||
|
||||
// [DEF:requestApi:Function]
|
||||
// @PURPOSE: Generic request wrapper.
|
||||
@@ -96,6 +96,7 @@ async function requestApi(endpoint, method = 'GET', body = null) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// [/DEF:requestApi:Function]
|
||||
|
||||
// [DEF:api:Data]
|
||||
// @PURPOSE: API client object with specific methods.
|
||||
@@ -116,7 +117,9 @@ export const api = {
|
||||
updateEnvironmentSchedule: (id, schedule) => requestApi(`/environments/${id}/schedule`, 'PUT', schedule),
|
||||
getEnvironmentsList: () => fetchApi('/environments'),
|
||||
};
|
||||
// [/DEF:api_module]
|
||||
// [/DEF:api:Data]
|
||||
|
||||
// [/DEF:api_module:Module]
|
||||
|
||||
// Export individual functions for easier use in components
|
||||
export const getPlugins = api.getPlugins;
|
||||
|
||||
@@ -9,26 +9,32 @@ import { api } from './api.js';
|
||||
// [DEF:plugins:Data]
|
||||
// @PURPOSE: Store for the list of available plugins.
|
||||
export const plugins = writable([]);
|
||||
// [/DEF:plugins:Data]
|
||||
|
||||
// [DEF:tasks:Data]
|
||||
// @PURPOSE: Store for the list of tasks.
|
||||
export const tasks = writable([]);
|
||||
// [/DEF:tasks:Data]
|
||||
|
||||
// [DEF:selectedPlugin:Data]
|
||||
// @PURPOSE: Store for the currently selected plugin.
|
||||
export const selectedPlugin = writable(null);
|
||||
// [/DEF:selectedPlugin:Data]
|
||||
|
||||
// [DEF:selectedTask:Data]
|
||||
// @PURPOSE: Store for the currently selected task.
|
||||
export const selectedTask = writable(null);
|
||||
// [/DEF:selectedTask:Data]
|
||||
|
||||
// [DEF:currentPage:Data]
|
||||
// @PURPOSE: Store for the current page.
|
||||
export const currentPage = writable('dashboard');
|
||||
// [/DEF:currentPage:Data]
|
||||
|
||||
// [DEF:taskLogs:Data]
|
||||
// @PURPOSE: Store for the logs of the currently selected task.
|
||||
export const taskLogs = writable([]);
|
||||
// [/DEF:taskLogs:Data]
|
||||
|
||||
// [DEF:fetchPlugins:Function]
|
||||
// @PURPOSE: Fetches plugins from the API and updates the plugins store.
|
||||
@@ -42,7 +48,7 @@ export async function fetchPlugins() {
|
||||
console.error(`[stores.fetchPlugins][Coherence:Failed] Error fetching plugins context={{'error': '${error}'}}`);
|
||||
}
|
||||
}
|
||||
// [/DEF:fetchPlugins]
|
||||
// [/DEF:fetchPlugins:Function]
|
||||
|
||||
// [DEF:fetchTasks:Function]
|
||||
// @PURPOSE: Fetches tasks from the API and updates the tasks store.
|
||||
@@ -56,5 +62,5 @@ export async function fetchTasks() {
|
||||
console.error(`[stores.fetchTasks][Coherence:Failed] Error fetching tasks context={{'error': '${error}'}}`);
|
||||
}
|
||||
}
|
||||
// [/DEF:fetchTasks]
|
||||
// [/DEF:stores_module]
|
||||
// [/DEF:fetchTasks:Function]
|
||||
// [/DEF:stores_module:Module]
|
||||
@@ -8,6 +8,7 @@ import { writable } from 'svelte/store';
|
||||
// [DEF:toasts:Data]
|
||||
// @PURPOSE: Writable store containing the list of active toasts.
|
||||
export const toasts = writable([]);
|
||||
// [/DEF:toasts:Data]
|
||||
|
||||
// [DEF:addToast:Function]
|
||||
// @PURPOSE: Adds a new toast message.
|
||||
@@ -20,7 +21,7 @@ export function addToast(message, type = 'info', duration = 3000) {
|
||||
toasts.update(all => [...all, { id, message, type }]);
|
||||
setTimeout(() => removeToast(id), duration);
|
||||
}
|
||||
// [/DEF:addToast]
|
||||
// [/DEF:addToast:Function]
|
||||
|
||||
// [DEF:removeToast:Function]
|
||||
// @PURPOSE: Removes a toast message by ID.
|
||||
@@ -29,5 +30,5 @@ function removeToast(id) {
|
||||
console.log(`[toasts.removeToast][Action] Removing toast context={{'id': '${id}'}}`);
|
||||
toasts.update(all => all.filter(t => t.id !== id));
|
||||
}
|
||||
// [/DEF:removeToast]
|
||||
// [/DEF:toasts_module]
|
||||
// [/DEF:removeToast:Function]
|
||||
// [/DEF:toasts_module:Module]
|
||||
Reference in New Issue
Block a user