orc-shared 5.10.1-dev.4 → 5.10.1-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -165,7 +165,7 @@ var sanitizeEnvironmentCode = exports.sanitizeEnvironmentCode = function sanitiz
|
|
|
165
165
|
}
|
|
166
166
|
return envCode; // other names will be used as-is
|
|
167
167
|
};
|
|
168
|
-
var getAppEnvironmentInfo = exports.getAppEnvironmentInfo = function getAppEnvironmentInfo(currentLocation, uiContainerName) {
|
|
168
|
+
var getAppEnvironmentInfo = exports.getAppEnvironmentInfo = function getAppEnvironmentInfo(currentLocation, uiContainerName, enableHeaderColors) {
|
|
169
169
|
var environmentCode = null;
|
|
170
170
|
var sanitizedEnvironmentCode = null;
|
|
171
171
|
var isDeployedLocalDevEnv = false;
|
|
@@ -187,8 +187,8 @@ var getAppEnvironmentInfo = exports.getAppEnvironmentInfo = function getAppEnvir
|
|
|
187
187
|
// environmentCode = "prd";
|
|
188
188
|
|
|
189
189
|
sanitizedEnvironmentCode = sanitizeEnvironmentCode(environmentCode);
|
|
190
|
-
if (!sanitizedEnvironmentCode ||
|
|
191
|
-
// we never want a different color / text for
|
|
190
|
+
if (!sanitizedEnvironmentCode || !enableHeaderColors) {
|
|
191
|
+
// we never want a different color / text for unknown environment
|
|
192
192
|
return {
|
|
193
193
|
name: "",
|
|
194
194
|
cssClassCategory: null
|
|
@@ -237,8 +237,8 @@ var CurrentApp = exports.CurrentApp = function CurrentApp(_ref) {
|
|
|
237
237
|
iconUri = _ref.iconUri;
|
|
238
238
|
var classes = useStyles();
|
|
239
239
|
var containerInfo = (0, _react.useMemo)(function () {
|
|
240
|
-
var _document$querySelect;
|
|
241
|
-
return getAppEnvironmentInfo(window.location.hostname, (_document$querySelect = document.querySelector('meta[name="cdn-container-name"]')) == null ? void 0 : _document$querySelect.getAttribute("content"));
|
|
240
|
+
var _document$querySelect, _document$querySelect2, _document$querySelect3;
|
|
241
|
+
return getAppEnvironmentInfo(window.location.hostname, (_document$querySelect = document.querySelector('meta[name="cdn-container-name"]')) == null ? void 0 : _document$querySelect.getAttribute("content"), ((_document$querySelect2 = (_document$querySelect3 = document.querySelector('meta[name="header-colors"]')) == null ? void 0 : _document$querySelect3.getAttribute("content")) != null ? _document$querySelect2 : "true") === "true");
|
|
242
242
|
}, []);
|
|
243
243
|
var name;
|
|
244
244
|
if (containerInfo.name) {
|
package/package.json
CHANGED
|
@@ -123,7 +123,7 @@ export const sanitizeEnvironmentCode = envCode => {
|
|
|
123
123
|
return envCode; // other names will be used as-is
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
export const getAppEnvironmentInfo = (currentLocation, uiContainerName) => {
|
|
126
|
+
export const getAppEnvironmentInfo = (currentLocation, uiContainerName, enableHeaderColors) => {
|
|
127
127
|
let environmentCode = null;
|
|
128
128
|
let sanitizedEnvironmentCode = null;
|
|
129
129
|
let isDeployedLocalDevEnv = false;
|
|
@@ -149,8 +149,8 @@ export const getAppEnvironmentInfo = (currentLocation, uiContainerName) => {
|
|
|
149
149
|
|
|
150
150
|
sanitizedEnvironmentCode = sanitizeEnvironmentCode(environmentCode);
|
|
151
151
|
|
|
152
|
-
if (!sanitizedEnvironmentCode ||
|
|
153
|
-
// we never want a different color / text for
|
|
152
|
+
if (!sanitizedEnvironmentCode || !enableHeaderColors) {
|
|
153
|
+
// we never want a different color / text for unknown environment
|
|
154
154
|
return {
|
|
155
155
|
name: "",
|
|
156
156
|
cssClassCategory: null,
|
|
@@ -212,6 +212,7 @@ export const CurrentApp = ({ displayName, iconUri }) => {
|
|
|
212
212
|
return getAppEnvironmentInfo(
|
|
213
213
|
window.location.hostname,
|
|
214
214
|
document.querySelector('meta[name="cdn-container-name"]')?.getAttribute("content"),
|
|
215
|
+
(document.querySelector('meta[name="header-colors"]')?.getAttribute("content") ?? "true") === "true",
|
|
215
216
|
);
|
|
216
217
|
}, []);
|
|
217
218
|
|
|
@@ -314,36 +314,62 @@ describe("getAppEnvironmentInfo", () => {
|
|
|
314
314
|
});
|
|
315
315
|
|
|
316
316
|
it.each([
|
|
317
|
-
[null, "prd", "", null],
|
|
318
|
-
["", "prd", "", null],
|
|
319
|
-
["prd", null, "", null],
|
|
320
|
-
["prd", "", "", null],
|
|
321
|
-
["prd", "prd", "", null],
|
|
322
|
-
["prd", "qa", "1.2-alpha888/qa", "qa"],
|
|
323
|
-
["prd", "int", "1.2-alpha888/int", "qa"],
|
|
324
|
-
["qa", "prd", "qa", "qa"],
|
|
325
|
-
["qa", "qa", "qa — 1.2-alpha888/qa", "qa"],
|
|
326
|
-
["qa", "int", "qa — 1.2-alpha888/int", "qa"],
|
|
327
|
-
["int", "prd", "int", "int"],
|
|
328
|
-
["int", "qa", "int — 1.2-alpha888/qa", "int"],
|
|
329
|
-
["int", "int", "int — 1.2-alpha888/int", "int"],
|
|
330
|
-
["stg", "prd", "stg", "stg"],
|
|
331
|
-
["stg", "stg", "stg — 1.2-alpha888/stg", "stg"],
|
|
332
|
-
["stg", "int", "stg — 1.2-alpha888/int", "stg"],
|
|
333
|
-
["demo1", "prd", "demo1", "int"],
|
|
334
|
-
["demo1", "stg", "demo1 — 1.2-alpha888/stg", "int"],
|
|
335
|
-
["demo1", "int", "demo1 — 1.2-alpha888/int", "int"],
|
|
336
|
-
["rel", "prd", "",
|
|
337
|
-
["rel", "stg", "",
|
|
338
|
-
["rel", "int", "",
|
|
339
|
-
["localdev", "prd", "localdev", "localdev"],
|
|
340
|
-
["localdev", "qa", "localdev", "localdev"],
|
|
317
|
+
[null, "prd", true, "", null],
|
|
318
|
+
["", "prd", true, "", null],
|
|
319
|
+
["prd", null, true, "", null],
|
|
320
|
+
["prd", "", true, "", null],
|
|
321
|
+
["prd", "prd", true, "", null],
|
|
322
|
+
["prd", "qa", true, "1.2-alpha888/qa", "qa"],
|
|
323
|
+
["prd", "int", true, "1.2-alpha888/int", "qa"],
|
|
324
|
+
["qa", "prd", true, "qa", "qa"],
|
|
325
|
+
["qa", "qa", true, "qa — 1.2-alpha888/qa", "qa"],
|
|
326
|
+
["qa", "int", true, "qa — 1.2-alpha888/int", "qa"],
|
|
327
|
+
["int", "prd", true, "int", "int"],
|
|
328
|
+
["int", "qa", true, "int — 1.2-alpha888/qa", "int"],
|
|
329
|
+
["int", "int", true, "int — 1.2-alpha888/int", "int"],
|
|
330
|
+
["stg", "prd", true, "stg", "stg"],
|
|
331
|
+
["stg", "stg", true, "stg — 1.2-alpha888/stg", "stg"],
|
|
332
|
+
["stg", "int", true, "stg — 1.2-alpha888/int", "stg"],
|
|
333
|
+
["demo1", "prd", true, "demo1", "int"],
|
|
334
|
+
["demo1", "stg", true, "demo1 — 1.2-alpha888/stg", "int"],
|
|
335
|
+
["demo1", "int", true, "demo1 — 1.2-alpha888/int", "int"],
|
|
336
|
+
["rel", "prd", true, "rel", "int"],
|
|
337
|
+
["rel", "stg", true, "rel — 1.2-alpha888/stg", "int"],
|
|
338
|
+
["rel", "int", true, "rel — 1.2-alpha888/int", "int"],
|
|
339
|
+
["localdev", "prd", true, "localdev", "localdev"],
|
|
340
|
+
["localdev", "qa", true, "localdev", "localdev"],
|
|
341
|
+
|
|
342
|
+
[null, "prd", false, "", null],
|
|
343
|
+
["", "prd", false, "", null],
|
|
344
|
+
["prd", null, false, "", null],
|
|
345
|
+
["prd", "", false, "", null],
|
|
346
|
+
["prd", "prd", false, "", null],
|
|
347
|
+
["prd", "qa", false, "", null],
|
|
348
|
+
["prd", "int", false, "", null],
|
|
349
|
+
["qa", "prd", false, "", null],
|
|
350
|
+
["qa", "qa", false, "", null],
|
|
351
|
+
["qa", "int", false, "", null],
|
|
352
|
+
["int", "prd", false, "", null],
|
|
353
|
+
["int", "qa", false, "", null],
|
|
354
|
+
["int", "int", false, "", null],
|
|
355
|
+
["stg", "prd", false, "", null],
|
|
356
|
+
["stg", "stg", false, "", null],
|
|
357
|
+
["stg", "int", false, "", null],
|
|
358
|
+
["demo1", "prd", false, "", null],
|
|
359
|
+
["demo1", "stg", false, "", null],
|
|
360
|
+
["demo1", "int", false, "", null],
|
|
361
|
+
["rel", "prd", false, "", null],
|
|
362
|
+
["rel", "stg", false, "", null],
|
|
363
|
+
["rel", "int", false, "", null],
|
|
364
|
+
["localdev", "prd", false, "", null],
|
|
365
|
+
["localdev", "qa", false, "", null],
|
|
341
366
|
])(
|
|
342
|
-
"getAppEnvironmentInfo for %s url
|
|
343
|
-
(envCode, uiContainerName, expectedName, expectedCssClassCategory) => {
|
|
367
|
+
"getAppEnvironmentInfo for %s url, %s UI container and %s header-colors",
|
|
368
|
+
(envCode, uiContainerName, headerColors, expectedName, expectedCssClassCategory) => {
|
|
344
369
|
const info = getAppEnvironmentInfo(
|
|
345
370
|
envCode ? `oco.${envCode}.platform.orckestra.cloud` : envCode,
|
|
346
371
|
uiContainerName,
|
|
372
|
+
headerColors,
|
|
347
373
|
);
|
|
348
374
|
|
|
349
375
|
const expected = {
|
|
@@ -355,8 +381,8 @@ describe("getAppEnvironmentInfo", () => {
|
|
|
355
381
|
},
|
|
356
382
|
);
|
|
357
383
|
|
|
358
|
-
it("getAppEnvironmentInfo for localdev (occ-dev-oco.develop.orckestra.cloud) and prd UI container", () => {
|
|
359
|
-
const info = getAppEnvironmentInfo("occ-dev-oco.develop.orckestra.cloud", "prd");
|
|
384
|
+
it("getAppEnvironmentInfo for localdev (occ-dev-oco.develop.orckestra.cloud) and prd UI container and with header colors", () => {
|
|
385
|
+
const info = getAppEnvironmentInfo("occ-dev-oco.develop.orckestra.cloud", "prd", true);
|
|
360
386
|
|
|
361
387
|
const expected = {
|
|
362
388
|
name: "localdev",
|
|
@@ -366,8 +392,8 @@ describe("getAppEnvironmentInfo", () => {
|
|
|
366
392
|
expect(info, "to equal", expected);
|
|
367
393
|
});
|
|
368
394
|
|
|
369
|
-
it("getAppEnvironmentInfo for localdev (occ-dev-oco.develop.orckestra.cloud) and qa UI container", () => {
|
|
370
|
-
const info = getAppEnvironmentInfo("occ-dev-oco.develop.orckestra.cloud", "qa");
|
|
395
|
+
it("getAppEnvironmentInfo for localdev (occ-dev-oco.develop.orckestra.cloud) and qa UI container and with header colors", () => {
|
|
396
|
+
const info = getAppEnvironmentInfo("occ-dev-oco.develop.orckestra.cloud", "qa", true);
|
|
371
397
|
|
|
372
398
|
const expected = {
|
|
373
399
|
name: "localdev — 1.2-alpha888/qa",
|
|
@@ -377,8 +403,8 @@ describe("getAppEnvironmentInfo", () => {
|
|
|
377
403
|
expect(info, "to equal", expected);
|
|
378
404
|
});
|
|
379
405
|
|
|
380
|
-
it("getAppEnvironmentInfo for localdev (local.develop.orckestra.cloud) and prd UI container", () => {
|
|
381
|
-
const info = getAppEnvironmentInfo("local.develop.orckestra.cloud", "prd");
|
|
406
|
+
it("getAppEnvironmentInfo for localdev (local.develop.orckestra.cloud) and prd UI container and with header colors", () => {
|
|
407
|
+
const info = getAppEnvironmentInfo("local.develop.orckestra.cloud", "prd", true);
|
|
382
408
|
|
|
383
409
|
const expected = {
|
|
384
410
|
name: "localdev",
|
|
@@ -388,8 +414,8 @@ describe("getAppEnvironmentInfo", () => {
|
|
|
388
414
|
expect(info, "to equal", expected);
|
|
389
415
|
});
|
|
390
416
|
|
|
391
|
-
it("getAppEnvironmentInfo for localdev (localhost) and prd UI container", () => {
|
|
392
|
-
const info = getAppEnvironmentInfo("localhost", "prd");
|
|
417
|
+
it("getAppEnvironmentInfo for localdev (localhost) and prd UI container and with header colors", () => {
|
|
418
|
+
const info = getAppEnvironmentInfo("localhost", "prd", true);
|
|
393
419
|
|
|
394
420
|
const expected = {
|
|
395
421
|
name: "localdev",
|
|
@@ -398,4 +424,48 @@ describe("getAppEnvironmentInfo", () => {
|
|
|
398
424
|
|
|
399
425
|
expect(info, "to equal", expected);
|
|
400
426
|
});
|
|
427
|
+
|
|
428
|
+
it("getAppEnvironmentInfo for localdev (occ-dev-oco.develop.orckestra.cloud) and prd UI container and without header colors", () => {
|
|
429
|
+
const info = getAppEnvironmentInfo("occ-dev-oco.develop.orckestra.cloud", "prd", false);
|
|
430
|
+
|
|
431
|
+
const expected = {
|
|
432
|
+
name: "",
|
|
433
|
+
cssClassCategory: null,
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
expect(info, "to equal", expected);
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it("getAppEnvironmentInfo for localdev (occ-dev-oco.develop.orckestra.cloud) and qa UI container and without header colors", () => {
|
|
440
|
+
const info = getAppEnvironmentInfo("occ-dev-oco.develop.orckestra.cloud", "qa", false);
|
|
441
|
+
|
|
442
|
+
const expected = {
|
|
443
|
+
name: "",
|
|
444
|
+
cssClassCategory: null,
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
expect(info, "to equal", expected);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
it("getAppEnvironmentInfo for localdev (local.develop.orckestra.cloud) and prd UI container and without header colors", () => {
|
|
451
|
+
const info = getAppEnvironmentInfo("local.develop.orckestra.cloud", "prd", false);
|
|
452
|
+
|
|
453
|
+
const expected = {
|
|
454
|
+
name: "",
|
|
455
|
+
cssClassCategory: null,
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
expect(info, "to equal", expected);
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
it("getAppEnvironmentInfo for localdev (localhost) and prd UI container and without header colors", () => {
|
|
462
|
+
const info = getAppEnvironmentInfo("localhost", "prd", false);
|
|
463
|
+
|
|
464
|
+
const expected = {
|
|
465
|
+
name: "",
|
|
466
|
+
cssClassCategory: null,
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
expect(info, "to equal", expected);
|
|
470
|
+
});
|
|
401
471
|
});
|