Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Frontend/src/resources/LicenseDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ApiEndpoint {
client_id: string;
name: string;
classification: EndpointClassification;
amended: boolean;
endpoint_size: string;
queues: ApiQueue[];
}
Expand Down Expand Up @@ -51,15 +52,14 @@ export class Endpoint {

amended: boolean;

constructor(clientId: string, name: string, queues: Queue[], classification: EndpointClassification, licensedSize: EndpointSize | null, availableSizes: EndpointSize[]) {
constructor(clientId: string, name: string, queues: Queue[], classification: EndpointClassification, amended: boolean, licensedSize: EndpointSize | null, availableSizes: EndpointSize[]) {
this.clientId = clientId;
this.name = name;
this.queues = queues;
this.classification = classification;
this.amended = amended;
this.licensedSize = licensedSize;
this.availableSizes = availableSizes;

this.amended = false;
}

get totalAverageMonthlyThroughput() {
Expand Down
1 change: 1 addition & 0 deletions src/Frontend/src/stores/LicenseDetailsStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ describe("LicenseDetailsStore", () => {
client_id: "endpoint-1",
name: "Sales",
classification: EndpointClassification.Full,
amended: false,
endpoint_size: "large",
queues: [{ name_hash: "sales-hash", scope_hash: "", original_location: "endpoint-1" }],
},
Expand Down
7 changes: 5 additions & 2 deletions src/Frontend/src/stores/LicenseDetailsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const useLicenseDetailsStore = defineStore("LicenseDetailsStore", () => {
// but the likelihood of this happening is infinitesimal so we're not handling it
name = `${name}_1`.substring(name.length + 2 - 80);
}
const endpoint = new Endpoint(crypto.randomUUID(), name, [], EndpointClassification.Full, null, endpointSizes.value);
const endpoint = new Endpoint(crypto.randomUUID(), name, [], EndpointClassification.Full, false, null, endpointSizes.value);
addQueueToEndpoint(queue, endpoint);
endpoints.value.push(endpoint);
}
Expand All @@ -103,6 +103,7 @@ export const useLicenseDetailsStore = defineStore("LicenseDetailsStore", () => {

endpoint.queues.push(queue);
unassignedQueues.value = unassignedQueues.value.filter((unassigned) => unassigned !== queue);
endpoint.amended = true;
hasChanges.value = true;
}

Expand Down Expand Up @@ -167,7 +168,9 @@ export const useLicenseDetailsStore = defineStore("LicenseDetailsStore", () => {
const sortedProducts = data.products.toSorted((p1, p2) => (p1.monthly_throughput ?? Number.MAX_VALUE) - (p2.monthly_throughput ?? Number.MAX_VALUE));
const sortedEndpointSizes = sortedProducts.map((product, i) => new EndpointSize(product.product_code, i > 0 ? (sortedProducts[i - 1].monthly_throughput ?? 0) + 1 : 0, product.monthly_throughput));
endpointSizes.value = sortedEndpointSizes;
endpoints.value = data.endpoints.map((metaEp) => new Endpoint(metaEp.client_id, metaEp.name, metaEp.queues.map(toQueue), metaEp.classification, sortedEndpointSizes.find((es) => es.name === metaEp.endpoint_size)!, sortedEndpointSizes));
endpoints.value = data.endpoints.map(
(metaEp) => new Endpoint(metaEp.client_id, metaEp.name, metaEp.queues.map(toQueue), metaEp.classification, metaEp.amended, sortedEndpointSizes.find((es) => es.name === metaEp.endpoint_size)!, sortedEndpointSizes)
);
infrastructureQueues.value = data.infrastructure_queues.map(toQueue);
excludedQueues.value = data.excluded_queues.map(toQueue);
/* only used for save, not load */
Expand Down
Loading