diff --git a/preload/1459bd10-456c-11ee-be56-0242ac120002.json b/preload/1459bd10-456c-11ee-be56-0242ac120002.json
index ba9a0eb..d18f450 100644
--- a/preload/1459bd10-456c-11ee-be56-0242ac120002.json
+++ b/preload/1459bd10-456c-11ee-be56-0242ac120002.json
@@ -1,9 +1,4 @@
{
- "extras": {
- "firewall": true,
- "quota": 1500,
- "rdscals": 0
- },
"servers": [
{
"cost": 914,
@@ -11,26 +6,19 @@
"vcpus": 8,
"ram": 32,
"disk": 200,
- "windows": true
- },
- {
- "cost": 914,
- "name": "GPG-RDS-02",
- "vcpus": 8,
- "ram": 32,
- "disk": 200,
- "windows": true
+ "windows": true,
+ "ip": false
},
{
- "cost": 236,
+ "cost": 233,
"name": "GPG-BRK-02",
"vcpus": 2,
"ram": 8,
- "disk": 100,
+ "disk": 80,
"windows": true
},
{
- "cost": 1837,
+ "cost": 1176,
"name": "GPG-SQL-02",
"vcpus": 4,
"ram": 16,
@@ -39,11 +27,11 @@
"sql": true
},
{
- "cost": 236,
+ "cost": 292,
"name": "GPG-DC-03",
- "vcpus": 2,
+ "vcpus": 4,
"ram": 8,
- "disk": 100,
+ "disk": 200,
"windows": true
},
{
@@ -56,12 +44,17 @@
"ip": true
},
{
- "cost": 75.75,
+ "cost": 141.75,
"name": "GPG-L2T-01",
- "vcpus": 2,
- "ram": 2,
+ "vcpus": 4,
+ "ram": 4,
"disk": 10,
"ip": true
}
- ]
+ ],
+ "extras": {
+ "firewall": true,
+ "quota": 1000,
+ "rdscals": 20
+ }
}
\ No newline at end of file
diff --git a/servers.html b/servers.html
index 739b3ef..d710229 100644
--- a/servers.html
+++ b/servers.html
@@ -200,8 +200,8 @@
{{serverTotals('vcpus')}} |
{{serverTotals('ram')}} GB |
{{serverTotals('disk')}} GB |
- {{serverTotals('windows')}} |
- {{serverTotals('sql')}} |
+ {{serverTotals('windows')}} |
+ {{serverTotals('sql')}} |
{{serverTotals('ip')}} |
{{serverTotals('cost') | currency}} |
@@ -357,7 +357,7 @@
- With an advanced firewall, we can protect your internal services frome xternal threats.
+ With an advanced firewall, we can protect your internal services from external threats.
diff --git a/servers.js b/servers.js
index 08f77d7..2adf98d 100644
--- a/servers.js
+++ b/servers.js
@@ -1,11 +1,11 @@
var app = angular.module('instantQuote', []);
app.controller('Servers', function ($scope, $window, $http) {
$scope.servers = JSON.parse(localStorage.getItem("servers")) ?? [{ cost: 0 }]
- $scope.extras = JSON.parse(localStorage.getItem("extras")) ?? {firewall: true, quota: 100}
-
+ $scope.extras = JSON.parse(localStorage.getItem("extras")) ?? { firewall: true, quota: 100 }
+
params = new URLSearchParams(window.location.search)
$scope.preload = params.get('preload')
-
+
if ($scope.preload && $scope.preload.match(/[0-9A-Z\-]+/g)) {
$http({
url: `preload/${$scope.preload}.json`
@@ -38,8 +38,8 @@ app.controller('Servers', function ($scope, $window, $http) {
((server.vcpus || 0) * $scope.serverPricing.vcpu) +
((server.ram || 0) * $scope.serverPricing.ram) +
((server.disk || 0) * $scope.serverPricing.disk) +
- (Math.ceil((server.windows ? 1 : 0) * $scope.serverPricing.windows * (server.vcpus || 0) / 2) * 2) +
- (Math.ceil((server.sql ? 1 : 0) * $scope.serverPricing.sql * (server.vcpus || 0) / 2) * 2) +
+ (Math.floor((server.windows ? 1 : 0) * $scope.serverPricing.windows * (server.vcpus || 0) / 2) * 2) +
+ (Math.floor((server.sql ? 1 : 0) * $scope.serverPricing.sql * (server.vcpus || 0) / 2)) +
((server.ip ? 1 : 0) * $scope.serverPricing.ip)
);
// console.log(server.cost)
@@ -48,18 +48,24 @@ app.controller('Servers', function ($scope, $window, $http) {
$scope.serverTotals = (type) => {
localStorage.setItem("servers", angular.toJson($scope.servers));
return $scope.servers?.reduce(function (a, b) {
- return a + (b?.[type] ?? 0);
+ if (type == "windows") {
+ return a + ((b?.windows ?? 0) * (b.vcpus ?? 0) / 2 ?? 0);
+ } else if (type == "sql") {
+ return a + ((b?.sql ?? 0) * (b.vcpus ?? 0) / 2 ?? 0);
+ } else {
+ return a + (b?.[type] ?? 0);
+ }
}, 0);
}
$scope.servicesTotals = () => {
localStorage.setItem("extras", angular.toJson($scope.extras));
return (
- ($scope.extras.firewall * $scope.serverPricing.firewall) +
- ($scope.extras.rdscals * $scope.serverPricing.rdscals) +
+ ($scope.extras.firewall * $scope.serverPricing.firewall) +
+ ($scope.extras.rdscals * $scope.serverPricing.rdscals) +
($scope.extras.quota * $scope.serverPricing.quota)
)
}
$scope.deleteServer = (server) => {
- $scope.servers.splice(server,1);
+ $scope.servers.splice(server, 1);
}
});
\ No newline at end of file
|