Skip to content

Commit

Permalink
Merge pull request #1566 from newrelic/liz/edit-nr1url
Browse files Browse the repository at this point in the history
Rename packId to quickstartId in install url
  • Loading branch information
LizBaker authored Aug 30, 2021
2 parents 8f3c78b + be23233 commit 0e0ba33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
13 changes: 9 additions & 4 deletions src/utils/get-pack-nr1-url.js
Original file line number Diff line number Diff line change
@@ -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}`;

Expand All @@ -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
Expand All @@ -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;
};
Expand Down

0 comments on commit 0e0ba33

Please sign in to comment.