Skip to content

Commit

Permalink
cosmos: Add JSDocs for the global Cockpit APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Dec 9, 2024
1 parent ce6935c commit 45a5977
Showing 1 changed file with 79 additions and 2 deletions.
81 changes: 79 additions & 2 deletions src/libs/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,104 @@ declare global {
sum(): number
}

/* eslint-disable jsdoc/require-jsdoc */
/**
* Extended Window interface with custom dedicated dedicated APIs.
*/
interface Window {
/**
* Exposed Cockpit APIs
* E.g. data-lake, cockpit actions, etc.
*/
cockpit: {
// Data lake:

/**
* The object that holds the data-lake variables data
*/
cockpitActionVariableData: typeof cockpitActionVariableData
/**
* Get data from an specific data lake variable
* @param id - The id of the data to retrieve
* @returns The data or undefined if not available
*/
getCockpitActionVariableData: typeof getCockpitActionVariableData
/**
* Listen to data changes on a specific data lake variable
* @param id - The id of the data to listen to
* @param listener - The listener callback
*/
listenCockpitActionVariable: typeof listenCockpitActionVariable
/**
* Stop listening to data changes on a specific data lake variable
* @param id - The id of the data to stop listening to
*/
unlistenCockpitActionVariable: typeof unlistenCockpitActionVariable
/**
* Get info about all variables in the data lake
* @returns Data lake data
*/
getAllCockpitActionVariablesInfo: typeof getAllCockpitActionVariablesInfo
/**
* Get info about a specific variable in the data lake
* @param id - The id of the data to retrieve
* @returns The data info or undefined if not available
*/
getCockpitActionVariableInfo: typeof getCockpitActionVariableInfo
/**
* Set the value of an specific data lake variable
* @param id - The id of the data to set
* @param value - The value to set
*/
setCockpitActionVariableData: typeof setCockpitActionVariableData
/**
* Create a new variable in the data lake
* @param variable - The variable to create
* @param initialValue - The initial value for the variable
*/
createCockpitActionVariable: typeof createCockpitActionVariable
/**
* Update information about an specific data lake variable
* @param variable - The variable to update
*/
updateCockpitActionVariableInfo: typeof updateCockpitActionVariableInfo
/**
* Delete a variable from the data lake
* @param id - The id of the variable to delete
*/
deleteCockpitActionVariable: typeof deleteCockpitActionVariable

// Cockpit actions:

/**
* Get all available cockpit actions
* @returns Available cockpit actions
*/
availableCockpitActions: typeof availableCockpitActions
/**
* Register a new cockpit action
* @param action - The action to register
*/
registerNewAction: typeof registerNewAction
/**
* Delete a cockpit action
* @param id - The id of the action to delete
*/
deleteAction: typeof deleteAction
/**
* Register a callback for a cockpit action
* @param action - The action to register the callback for
* @param callback - The callback to register
*/
registerActionCallback: typeof registerActionCallback
/**
* Unregister a callback for a cockpit action
* @param id - The id of the action to unregister the callback for
*/
unregisterActionCallback: typeof unregisterActionCallback
/**
* Execute the callback for a cockpit action
* @param id - The id of the action to execute the callback for
*/
executeActionCallback: typeof executeActionCallback
}
/**
Expand All @@ -115,7 +193,6 @@ declare global {
getInfoOnSubnets: () => Promise<NetworkInfo[]>
}
}
/* eslint-enable jsdoc/require-jsdoc */
}

// Use global as window when running for browsers
Expand Down

0 comments on commit 45a5977

Please sign in to comment.