Skip to content

Commit

Permalink
ENG-0000 - Another Locator Context Fix
Browse files Browse the repository at this point in the history
I apologize to the Universe.
  • Loading branch information
mcnielsen committed Jul 28, 2023
1 parent 2b29896 commit 6297f4e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/nucleus/src/common/types/al-locator.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,11 +600,13 @@ export class AlLocatorMatrix implements AlLocationContext
if ( ! correctedLocationId ) {
correctedLocationId = alternatives[0];
}
this.residency = AlInsightLocations[correctedLocationId].residency;
this.residency = AlInsightLocations[correctedLocationId].residency || this.residency;
this.locationId = correctedLocationId;
if ( debug ) {
notes.push( `overrode location/residency by insight location ${this.locationId}` );
}
} else {
this.residency = AlInsightLocations[this.locationId].residency || this.residency;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@al/core",
"version": "2.0.14",
"version": "2.0.15",
"description": "Node Enterprise Packages for Alert Logic (NEPAL) Core Library",
"main": "./bundles/al-core-nucleus.es5.js",
"types": "./types/al-core-nucleus.d.ts",
Expand Down
10 changes: 10 additions & 0 deletions tests/common/al-locator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ describe( 'AlLocatorMatrix', () => {
expect( context.locator.resolveURL( AlLocation.InsightAPI, "/aims/v1/2/accounts" ) ).toEqual( "https://api.cloudinsight.alertlogic.co.uk/aims/v1/2/accounts" );
} );

it("should infer correct context/sibling nodes for production URLs given a residency-agnostic URL and bound location", () => {
context.target( `https://console.alertlogic.com/#/deployments-adr/2`, null, `defender-uk-newport`, [ 'defender-uk-newport', 'insight-eu-ireland' ] );
let matching = context.locator.getNode( AlLocation.IncidentsUI );
expect( typeof( matching ) ).toBe("object");
expect( matching.environment ).toEqual( 'production' );
expect( matching.residency ).toEqual( 'EMEA' );
expect( matching.uri ).toEqual( "https://console.incidents.alertlogic.co.uk" );
expect( context.locator.resolveURL( AlLocation.InsightAPI, "/aims/v1/2/accounts" ) ).toEqual( "https://api.cloudinsight.alertlogic.co.uk/aims/v1/2/accounts" );
} );

it("should infer correct context/sibling nodes for integration URLs", () => {

// Context inferred from integration URL
Expand Down

0 comments on commit 6297f4e

Please sign in to comment.