Example -
Users are using EC2s that have hourly costs. I would like to display the costs of a Desktop based on the hours that they choose to have it up and the EC2 they choose. Hours (their input) X Hourly EC2 cost = (what I want to display)
You can add additional information to the panel for the desktop using an info.md.erb
or info.html.erb
file as described here. We have an app that utilizes this functionality here if you would like to look at an example.
Thanks!
Is there a way to have something display on the page where the user is choosing their instance type and hours ? What you have provided appears to provide this information after the session is launched. I would like provide that information before the job is launched.
Currently I use the manifest.yml to provide information but I don’t see a way to provide the information I would like using that file.
If I understand correctly, you want this information to show up in the form before the user launches the instance? So it sounds like you could use a dynamic form widget: Dynamic Form Widgets — Open OnDemand 3.0.3 documentation. This would allow you to write your calculator in JavaScript.
You could also (more simply, but without computations) use the data-set
directives to provide a list of pre-calculated values, something like:
options:
- [ 'small', 'small', data-set-dollar: 3 ]
- [ 'large', 'large', data-set-dollar: 10 ]
- [ 'xlarge', 'xlarge', data-set-dollar: 15 ]
Although that would only show $/hr and not total spent.
That is correct. I would like the information available to the user before they launch the instance.
Do I only need to add form.js to the bc_desktop folder ?
I have done that but I’m not seeing anything on the page for the Desktop.
I’m using the below code as a test -
const num1 = 5;
const num2 = 3;
// add two numbers
const sum = num1 + num2;
// display the sum
console.log('The sum of ’ + num1 + ’ and ’ + num2 + ’ is: ’ + sum);
Should I expect some output somewhere ?
Thanks
We found the solution.
It was only that we had to better understand form.js and javascript in the context of OoD.
FYI - You only need the form.js file in the root of the application and it will be picked up.