-
-
-
-
-
-
-
-
-
-
-
-
-
- mdi-delete
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mdi-delete
+
+
+
@@ -306,6 +327,7 @@ import ResourceUsageDisplay from "@/components/ui/ResourceUsageDisplay";
import TypeSelect from "./TypeSelect";
import CodeEditor from "@/components/ui/CodeEditor";
import AvailableResourcesRepository from "@/repositories/AvailableResourcesRepository";
+import DomainsRepository from "@/repositories/DomainsRepository";
import ProjectRepository from "@/repositories/ProjectRepository";
import UserRepository from "@/repositories/UserRepository";
@@ -357,28 +379,32 @@ export default {
nowDate: new Date().toISOString().slice(0, 10),
tomorrowDate: new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString().slice(0, 10),
promise: null,
+ promise_dns: null,
quotas: null,
possibleResources: null,
+ domains: null,
resourceDetails: null,
projects: [],
+ regions: [],
};
},
watch: {
promise() {
this.$emit("loading", this.loading);
},
- possibleResources(possibleResources) {
+ domains(domains) {
// We set default values for select boxes based on possible resources fetched from the API
// Domain
if (this.localSpecs.domain === null) {
try {
- this.localSpecs.domain = possibleResources.domain[0];
- this.initialSpecs.domain = possibleResources.domain[0];
+ this.localSpecs.domain = domains[0];
+ this.initialSpecs.domain = domains[0];
} catch (err) {
console.log("No domain available");
}
}
-
+ },
+ possibleResources(possibleResources) {
// Image
if (this.localSpecs.image === null) {
try {
@@ -404,6 +430,15 @@ export default {
}
}
}
+ for (let tag in this.localSpecs.volumes) {
+ for (let key in this.localSpecs.volumes[tag]) {
+ if (this.localSpecs.volumes[tag][key].type === null) {
+ const type = this.possibleResources.volumes[0];
+ this.localSpecs.volumes[tag][key].type = type;
+ }
+ }
+ }
+ this.VOLUME_STUB.type = this.possibleResources.volumes[0];
},
dirtyForm(dirty) {
if (dirty && this.stateful) {
@@ -450,7 +485,7 @@ export default {
},
computed: {
loading() {
- return this.promise !== null;
+ return this.promise !== null && this.promise_dns !== null;
},
localSpecs: {
get() {
@@ -497,25 +532,22 @@ export default {
return true;
},
domainRule() {
- return (
- (this.possibleResources && this.possibleResources.domain.includes(this.localSpecs.domain)) ||
- "Invalid domain provided"
- );
+ return (this.domains && this.domains.includes(this.localSpecs.domain)) || "Invalid domain provided";
},
volumeCountRule() {
- return this.volumeCountUsed <= this.volumeCountMax || "Volume number quota exceeded";
+ return this.volumeCountUsed <= this.volumeCountMax || "quota exceeded";
},
volumeSizeRule() {
- return this.volumeSizeUsed <= this.volumeSizeMax || "Volume size quota exceeded";
+ return this.volumeSizeUsed <= this.volumeSizeMax || "quota exceeded";
},
instanceCountUsed() {
return this.usedResourcesLoaded ? this.instances.reduce((acc, instance) => acc + instance.count, 0) : 0;
},
instanceCountMax() {
- return this.quotas ? this.quotas.instance_count.max : 0;
+ return this.quotas ? Math.min(this.quotas.instance_count, this.quotas.ports) : 0;
},
ipsCountMax() {
- return this.quotas ? this.quotas.ips.max : 0;
+ return this.quotas ? this.quotas.ips : 0;
},
ramRule() {
return this.ramGbUsed <= this.ramGbMax || "Ram quota exceeded";
@@ -532,7 +564,7 @@ export default {
: 0;
},
ramGbMax() {
- return this.quotas ? this.quotas.ram.max / MB_PER_GB : 0;
+ return this.quotas ? this.quotas.ram / MB_PER_GB : 0;
},
vcpuUsed() {
return this.usedResourcesLoaded
@@ -543,7 +575,7 @@ export default {
: 0;
},
vcpuMax() {
- return this.quotas ? this.quotas.vcpus.max : 0;
+ return this.quotas ? this.quotas.vcpus : 0;
},
volumeCountUsed() {
return this.usedResourcesLoaded
@@ -554,7 +586,7 @@ export default {
: 0;
},
volumeCountMax() {
- return this.quotas ? this.quotas.volume_count.max : 0;
+ return this.quotas ? this.quotas.volume_count : 0;
},
volumeSizeUsed() {
return this.usedResourcesLoaded
@@ -563,7 +595,7 @@ export default {
: 0;
},
volumeSizeMax() {
- return this.quotas ? this.quotas.volume_size.max : 0;
+ return this.quotas ? this.quotas.volume_size : 0;
},
instancesVolumeSizeUsed() {
return this.instances.reduce(
@@ -620,13 +652,6 @@ export default {
newPublicIP += self.localSpecs.instances[key].count;
}
}
- if (self.initialSpecs) {
- for (let key in self.initialSpecs.instances) {
- if (self.initialSpecs.instances[key].tags.includes("public")) {
- newPublicIP -= self.initialSpecs.instances[key].count;
- }
- }
- }
return newPublicIP <= self.ipsCountMax || "Public IP quota exceeded";
}
return true;
@@ -638,9 +663,9 @@ export default {
}
// Retrieve all available types
// Then filter based on the selected tags
- let inst_types = this.possibleResources["types"];
+ let inst_types = this.possibleResources.types;
for (const tag of tags) {
- if (tag in this.possibleResources["tag_types"]) {
+ if (tag in this.possibleResources.tag_types) {
const tag_types = new Set(this.possibleResources["tag_types"][tag]);
inst_types = inst_types.filter((x) => tag_types.has(x));
}
@@ -654,6 +679,13 @@ export default {
return fieldPath.split(".").reduce((acc, x) => acc[x], this.possibleResources);
}
},
+ getPossibleDomains() {
+ if (this.domains === null) {
+ return [];
+ } else {
+ return this.domains;
+ }
+ },
getInstanceDetail(instanceType, detailName, defaultValue = 0) {
const matchingInstances = this.resourceDetails.instance_types.filter(
(instanceTypeDetails) => instanceTypeDetails.name === instanceType
@@ -790,6 +822,12 @@ export default {
for (let key in this.localSpecs.instances) {
this.localSpecs.instances[key].type = null;
}
+ for (let tag in this.localSpecs.volumes) {
+ for (let key in this.localSpecs.volumes[tag]) {
+ this.localSpecs.volumes[tag][key].type = null;
+ }
+ }
+ this.VOLUME_STUB.type = null;
this.localSpecs.image = null;
this.loadCloudResources();
},
@@ -808,7 +846,13 @@ export default {
this.resourceDetails = data.resource_details;
this.promise = null;
});
- return this.promise;
+ this.promise_dns = DomainsRepository.getDomains();
+ this.promise_dns.then((response) => {
+ const data = response.data;
+ this.domains = data.domains;
+ this.promise_dns = null;
+ });
+ return [this.promise, this.promise_dns];
},
},
};
diff --git a/frontend/src/components/cluster/ClustersList.vue b/frontend/src/components/cluster/ClustersList.vue
index 8a073da4..369ea993 100644
--- a/frontend/src/components/cluster/ClustersList.vue
+++ b/frontend/src/components/cluster/ClustersList.vue
@@ -42,23 +42,6 @@