Module: modules/servlet

API communication module for server interactions. Handles all HTTP requests to the backend servlets.

Source:

Methods

(async, static) deleteComponent(type, model) → {Promise.<Object>}

Deletes a component from the server.

Parameters:
Name Type Description
type string

The component type

model string

The component model name

Source:
Throws:

If the deletion fails

Type
Error
Returns:

The server response

Type
Promise.<Object>

(async, static) deleteConfiguration(configId) → {Promise.<Object>}

Deletes a configuration from the server.

Parameters:
Name Type Description
configId number

The ID of the configuration to delete

Source:
Throws:

If the deletion fails

Type
Error
Returns:

The server response

Type
Promise.<Object>

(async, static) fetchComponentDetails(idConfiguracion) → {Promise.<void>}

Fetches component details for all types for a specific configuration.

Parameters:
Name Type Description
idConfiguracion number

The configuration ID

Source:
Throws:

If fetching fails

Type
Error
Returns:
Type
Promise.<void>

(async, static) fetchComponents() → {Promise.<void>}

Fetches components of all types.

Source:
Throws:

If fetching any component type fails

Type
Error
Returns:
Type
Promise.<void>

(async, static) fetchComponentsByModel(type, model) → {Promise.<Array.<Object>>}

Fetches components by type and model name.

Parameters:
Name Type Description
type string

The component type

model string

The component model name

Source:
Throws:

If the fetch operation fails

Type
Error
Returns:

Array of matching components

Type
Promise.<Array.<Object>>

(async, static) fetchComponentsByType(type, idConfiguracionopt) → {Promise.<Array.<Object>>}

Fetches components of a specific type.

Parameters:
Name Type Attributes Default Description
type string

The component type (coaxial, derivador, distribuidor, toma)

idConfiguracion number | null <optional>
null

Optional configuration ID to filter components

Source:
Throws:

If the fetch operation fails

Type
Error
Returns:

Array of component objects

Type
Promise.<Array.<Object>>

(async, static) fetchConfigurations() → {Promise.<Array.<Object>>}

Fetches all configurations from the server.

Source:
Throws:

If the HTTP request fails or returns invalid data

Type
Error
Returns:

Array of configuration objects

Type
Promise.<Array.<Object>>

(async, static) fetchInitialData(configSelect) → {Promise.<Array.<Object>>}

Fetches initial configuration data and populates the config select dropdown.

Parameters:
Name Type Description
configSelect HTMLSelectElement

The select element to populate

Source:
Throws:

If fetching fails

Type
Error
Returns:

Array of configuration objects

Type
Promise.<Array.<Object>>

(async, static) fetchSignalTypes() → {Promise.<Array.<Object>>}

Fetches all available signal types from the server.

Source:
Throws:

If the fetch operation fails

Type
Error
Returns:

Array of signal type objects

Type
Promise.<Array.<Object>>

(async, static) runSimulation(simulationData) → {Promise.<Object>}

Runs a signal simulation with the provided data.

Parameters:
Name Type Description
simulationData Object

Simulation parameters including configuration, signal type, etc.

Source:
Throws:

If the simulation fails

Type
Error
Returns:

The simulation results

Type
Promise.<Object>

(async, static) submitComponent(formData) → {Promise.<Object>}

Submits a new component to the server.

Parameters:
Name Type Description
formData FormData

Form data containing component properties

Source:
Throws:

If the submission fails

Type
Error
Returns:

The created component object

Type
Promise.<Object>

(async, static) submitConfiguration(formData) → {Promise.<Object>}

Submits a new configuration to the server.

Parameters:
Name Type Description
formData FormData

Form data containing configuration fields

Source:
Throws:

If the submission fails

Type
Error
Returns:

The created configuration object

Type
Promise.<Object>

(async, static) updateComponent(type, model, formData) → {Promise.<Object>}

Updates an existing component on the server.

Parameters:
Name Type Description
type string

The component type

model string

The component model name

formData FormData

Form data containing updated component properties

Source:
Throws:

If the update fails

Type
Error
Returns:

The updated component object

Type
Promise.<Object>

(async, static) updateConfiguration(configId, formData) → {Promise.<Object>}

Updates an existing configuration.

Parameters:
Name Type Description
configId number

The ID of the configuration to update

formData FormData

Form data containing configuration fields

Source:
Throws:

If the update fails

Type
Error
Returns:

The updated configuration object

Type
Promise.<Object>