From 616946a3773a0af9a3d708ffc74c4f49c1700cd9 Mon Sep 17 00:00:00 2001 From: lbaker Date: Mon, 30 Aug 2021 15:34:43 -0700 Subject: [PATCH 1/2] chore: Add local url constant --- src/data/constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/data/constants.js b/src/data/constants.js index 70eb32bb7..88c6006cd 100644 --- a/src/data/constants.js +++ b/src/data/constants.js @@ -17,6 +17,8 @@ export const NR1_LOGIN_URL = 'https://staging-login.newrelic.com/login'; // FIXME: update this to production URL when deployed / launched export const NR1_BASE_URL = 'https://staging-one.newrelic.com'; +export const NR1_BASE_URL_LOCAL = 'https://dev-one.newrelic.com'; + export const NR1_PACK_DETAILS_NERDLET = 'catalog-pack-details.catalog-pack-contents'; From be23233cc557600df1065ff83edf123f93824640 Mon Sep 17 00:00:00 2001 From: lbaker Date: Mon, 30 Aug 2021 15:35:16 -0700 Subject: [PATCH 2/2] chore: Change packId to quickstartId, add dev url --- src/utils/get-pack-nr1-url.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/utils/get-pack-nr1-url.js b/src/utils/get-pack-nr1-url.js index 55194d5e8..fd53afb99 100644 --- a/src/utils/get-pack-nr1-url.js +++ b/src/utils/get-pack-nr1-url.js @@ -1,4 +1,8 @@ -import { NR1_BASE_URL, NR1_PACK_DETAILS_NERDLET } from '../data/constants'; +import { + NR1_BASE_URL, + NR1_BASE_URL_LOCAL, + NR1_PACK_DETAILS_NERDLET, +} from '../data/constants'; const NERDLET_PATH = `nerdlet/${NR1_PACK_DETAILS_NERDLET}`; @@ -7,10 +11,10 @@ const NERDLET_PATH = `nerdlet/${NR1_PACK_DETAILS_NERDLET}`; * @param {boolean} [debug] If set to true, this will add `packages=local`. * @returns {string} The URL for the pack details within the platform. */ -const getPackNr1Url = (packId, debug = false) => { +const getPackNr1Url = (quickstartId, debug = false) => { const pane = JSON.stringify({ nerdletId: NR1_PACK_DETAILS_NERDLET, - packId, + quickstartId, }); // Note: this works differently depending on whether or not we have access @@ -21,8 +25,9 @@ const getPackNr1Url = (packId, debug = false) => { : Buffer.from(pane, 'utf-8').toString('base64'); const local = debug ? 'packages=local&' : ''; + const NR1_URL = debug ? NR1_BASE_URL_LOCAL : NR1_BASE_URL; - const url = new URL(`${NERDLET_PATH}?${local}pane=${hash}`, NR1_BASE_URL); + const url = new URL(`${NERDLET_PATH}?${local}pane=${hash}`, NR1_URL); return url.href; };