AzureBillingDashboardWeb.VirtualMachineLive.Show (azure_billing_dashboard v0.2.0)
This is the module responsible for sending data to the "show.html.heex" file. This file is the details page for an indiviudal virtual machine.
Link to this section Summary
Functions
Converts a string representation of a date and converts it into a NaiveDateTime Object
Function responsible for creating the map that will be used to store the data used by the graph
Creates a LinePlot from the dataset given.
Converts a list of data into a map of key-value pairs
Function responsible for filtering the data retrieved from the API call to Microsoft Azure. Creates 3 seperate maps, each containing cost metrics associated with IP, Data and the VM.
Function responsible for sending data to the webpage. The keyword "assign" sends the specified data to the html page which can then be retrieved via the key given (eg, key = "graph", value = "test_plot()") When the page is rendered, it replaces the key found in the html with the data contained in the value.
Function responsible for merging multiple maps together
The LiveView entry point for this class.
Function responsible for creating the graph that is displayed on the VM details page
Callback implementation for Phoenix.LiveView.render/1.
Function responsible for updating the cost_accrued for the selected vm with the data given
Link to this section Functions
convert_int_to_date(arg)
Converts a string representation of a date and converts it into a NaiveDateTime Object
Eg. "20221001" -> [2022-10-01 00:00:00]
create_general_map(disk_data, ip_data, vm_data)
Function responsible for creating the map that will be used to store the data used by the graph
create_graph(dataset)
Creates a LinePlot from the dataset given.
create_map_from_data(data, idx_of_key, idx_of_value)
Converts a list of data into a map of key-value pairs
Used to generate the map that is used to display the cost data on the VM details page key = date value = cost
filter_data(data, vm)
Function responsible for filtering the data retrieved from the API call to Microsoft Azure. Creates 3 seperate maps, each containing cost metrics associated with IP, Data and the VM.
handle_params(map, _, socket)
Function responsible for sending data to the webpage. The keyword "assign" sends the specified data to the html page which can then be retrieved via the key given (eg, key = "graph", value = "test_plot()") When the page is rendered, it replaces the key found in the html with the data contained in the value.
merge_into_single_map(disk_data_map, ip_data_map, vm_data_map)
Function responsible for merging multiple maps together
Used to combine the three seperate data maps into one Final map is used to store the data used by the graph
mount(params, session, socket)
The LiveView entry point for this class.
plot_cost_data_graph(id, email)
Function responsible for creating the graph that is displayed on the VM details page
Also updates the cost_accrued data for the selected vm with vm.id = id
render(arg)
Callback implementation for Phoenix.LiveView.render/1.
update_cost_accrued(vm, data_map)
Function responsible for updating the cost_accrued for the selected vm with the data given
Does this by summing up the values of the data map, rounding to 4 points of precision, and then updating the DB/Repo