-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from FDA/origin/Sep2022
Origin/sep2022
- Loading branch information
Showing
394 changed files
with
9,301 additions
and
4,762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
{} | ||
//= link_tree ../images | ||
//= link_directory ../javascripts .js | ||
//= link_directory ../stylesheets .css |
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DataTable = $.fn.dataTable | ||
dom = "<'row'<'col-sm-4'l><'col-sm-12'f>><'row'<'col-sm-24'tr>><'row'<'col-sm-10'i><'col-sm-14'p>>" | ||
|
||
$.extend( true, DataTable.defaults, { | ||
dom: dom, | ||
renderer: 'bootstrap' | ||
}) |
84 changes: 84 additions & 0 deletions
84
app/assets/javascripts/_precision/precision.nav.dropdown.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
TABLE_CONFIG = [ | ||
{ | ||
resource: 'Compute', | ||
usage: (stats) -> stats.computeCharges, | ||
bold: false, | ||
}, | ||
{ | ||
resource: 'Storage', | ||
usage: (stats) -> stats.storageCharges, | ||
bold: false, | ||
}, | ||
{ | ||
resource: 'Data Egress', | ||
usage: (stats) -> stats.dataEgressCharges, | ||
bold: false, | ||
}, | ||
{ | ||
resource: 'Total', | ||
usage: (stats) -> stats.totalCharges, | ||
bold: true, | ||
}, | ||
{ | ||
resource: 'Usage Limit', | ||
usage: (stats) -> stats.usageLimit, | ||
bold: false, | ||
}, | ||
{ | ||
resource: 'Usage Available', | ||
usage: (stats) -> stats.usageAvailable, | ||
bold: true, | ||
}, | ||
{ | ||
resource: 'Job Limit', | ||
usage: (stats) -> stats.jobLimit, | ||
bold: true, | ||
}, | ||
] | ||
|
||
createCloudResourceSpendingsTable = (data) -> | ||
TABLE_CONFIG.map((row) -> { | ||
resource: row.resource, | ||
usage: "$#{row.usage(data).toFixed(2)}", | ||
bold: row.bold | ||
}) | ||
class NavBarDropdownModel | ||
getCloudResourcesModalElement: () -> | ||
$('#cloud_resources_modal') | ||
# First and foremost apologies my sincerest apologies to knockoutJS gods, this is not creation as it was originally intended | ||
# these params are passed, because this fn is invoked with "afterRender" template workaround | ||
# No idea what is happening | ||
loadStats: (isLoadingObservable, resourceTableObservable) -> | ||
error = false | ||
isLoadingObservable(true) | ||
$.ajax('/api/user/cloud_resources', { | ||
method: 'GET', | ||
contentType: 'application/json', | ||
dataType: 'json', | ||
jsonp: false, | ||
success: (data) -> | ||
data | ||
error: (xhr, status, err) -> | ||
Precision.alert.showAboveAll('Something went wrong while loading cloud user spendings') | ||
error = true | ||
}).done((data) => | ||
table = createCloudResourceSpendingsTable(data) | ||
resourceTableObservable(table) | ||
).always(=> | ||
isLoadingObservable(false) | ||
) | ||
showCloudResourcesModal: () -> | ||
# Need to reinitialize element, because template rendering most likely occurs between constructor and "loadStats" call, that invalidates the ref | ||
@cloudResourcesModal = @getCloudResourcesModalElement() if @cloudResourcesModal.length == 0 | ||
@cloudResourcesModal.modal('show') | ||
constructor: (tableConfig) -> | ||
@cloudResourcesModal = @getCloudResourcesModalElement() | ||
@resourceTable = ko.observable() | ||
@isLoading = ko.observable(false) | ||
|
||
|
||
$(document).ready(() => | ||
$headerContainer = $("body header") | ||
viewModel = new NavBarDropdownModel() | ||
ko.applyBindings(viewModel, $headerContainer[0]) | ||
) |
Oops, something went wrong.