@rh-support/utils 2.1.39 → 2.1.41
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.
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/translation-helper.d.ts +5 -1
- package/lib/esm/translation-helper.d.ts.map +1 -1
- package/lib/esm/translation-helper.js +1 -1
- package/package.json +5 -24
- package/lib/esm/insightRuleInfoUtils.d.ts +0 -4
- package/lib/esm/insightRuleInfoUtils.d.ts.map +0 -1
- package/lib/esm/insightRuleInfoUtils.js +0 -23
package/lib/esm/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export * from './dropdownUtils';
|
|
|
9
9
|
export * from './eventUtils';
|
|
10
10
|
export * from './hostNameUtils';
|
|
11
11
|
export * from './hydraConfigUtils';
|
|
12
|
-
export * from './insightRuleInfoUtils';
|
|
13
12
|
export * from './lruCacheUtils';
|
|
14
13
|
export * from './productsUtils';
|
|
15
14
|
export * from './promiseUtils';
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,WAAW,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -9,7 +9,6 @@ export * from './dropdownUtils';
|
|
|
9
9
|
export * from './eventUtils';
|
|
10
10
|
export * from './hostNameUtils';
|
|
11
11
|
export * from './hydraConfigUtils';
|
|
12
|
-
export * from './insightRuleInfoUtils';
|
|
13
12
|
export * from './lruCacheUtils';
|
|
14
13
|
export * from './productsUtils';
|
|
15
14
|
export * from './promiseUtils';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
type InterpolationArgs = {
|
|
2
|
+
[key: string]: string | number;
|
|
3
|
+
};
|
|
1
4
|
/**
|
|
2
5
|
* Translate the string using i18n.t
|
|
3
6
|
* @param {string} key the string to be translated
|
|
@@ -6,5 +9,6 @@
|
|
|
6
9
|
*
|
|
7
10
|
* use getText only in the case when neither <Trans /> nor useTranslation() is available
|
|
8
11
|
*/
|
|
9
|
-
export declare function getText(key: string, args?:
|
|
12
|
+
export declare function getText(key: string, args?: InterpolationArgs): string;
|
|
13
|
+
export {};
|
|
10
14
|
//# sourceMappingURL=translation-helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-helper.d.ts","sourceRoot":"","sources":["../../src/translation-helper.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"translation-helper.d.ts","sourceRoot":"","sources":["../../src/translation-helper.ts"],"names":[],"mappings":"AAEA,KAAK,iBAAiB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAMrE"}
|
|
@@ -8,7 +8,7 @@ import i18next from 'i18next';
|
|
|
8
8
|
* use getText only in the case when neither <Trans /> nor useTranslation() is available
|
|
9
9
|
*/
|
|
10
10
|
export function getText(key, args) {
|
|
11
|
-
const translatedString = i18next.t(key, args);
|
|
11
|
+
const translatedString = args ? i18next.t(key, args) : i18next.t(key);
|
|
12
12
|
if (!translatedString) {
|
|
13
13
|
return key;
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.41",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -41,35 +41,22 @@
|
|
|
41
41
|
"prepublishOnly": "npm run build"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@cee-eng/hydrajs": "4.17.
|
|
45
|
-
"@cee-eng/ui-toolkit": "1.1.8",
|
|
46
|
-
"dompurify": "^2.2.6",
|
|
47
|
-
"i18next": "^22.5.1",
|
|
48
|
-
"js-markdown-extra": "^1.2.4",
|
|
49
|
-
"lazysizes": "^5.3.2",
|
|
44
|
+
"@cee-eng/hydrajs": "4.17.26",
|
|
50
45
|
"localforage": "^1.10.0",
|
|
51
46
|
"lodash": "^4.17.21",
|
|
52
|
-
"marked": "^1.2.4",
|
|
53
|
-
"moment-timezone": "^0.5.32",
|
|
54
47
|
"qs": "^6.7.0",
|
|
55
48
|
"solr-query-builder": "1.0.1"
|
|
56
49
|
},
|
|
57
50
|
"dependencies": {
|
|
58
|
-
"@cee-eng/hydrajs": "4.17.
|
|
59
|
-
"@cee-eng/ui-toolkit": "1.1.8",
|
|
51
|
+
"@cee-eng/hydrajs": "4.17.26",
|
|
60
52
|
"@rh-support/types": "2.0.4",
|
|
61
53
|
"date-fns": "3.6.0",
|
|
62
54
|
"dompurify": "^2.2.6",
|
|
63
|
-
"dot": "^1.1.3",
|
|
64
|
-
"i18next": "^22.5.1",
|
|
65
|
-
"js-markdown-extra": "^1.2.4",
|
|
66
|
-
"lazysizes": "^5.3.2",
|
|
67
55
|
"localforage": "^1.10.0",
|
|
68
56
|
"lodash": "^4.17.21",
|
|
69
57
|
"lucene": "^2.1.1",
|
|
70
58
|
"marked": "^1.2.4",
|
|
71
59
|
"qs": "^6.7.0",
|
|
72
|
-
"react": "18.2.0",
|
|
73
60
|
"solr-query-builder": "1.0.1"
|
|
74
61
|
},
|
|
75
62
|
"devDependencies": {
|
|
@@ -77,22 +64,16 @@
|
|
|
77
64
|
"@types/jest": "^29.5.11",
|
|
78
65
|
"@types/lodash": "^4.14.140",
|
|
79
66
|
"@types/lucene": "^2.1.0",
|
|
80
|
-
"@types/marked": "^1.1.0",
|
|
81
67
|
"@types/node": "^20.11.3",
|
|
82
68
|
"@types/qs": "^6.9.1",
|
|
83
|
-
"
|
|
84
|
-
"@types/react-dom": "^18.2.18",
|
|
69
|
+
"i18next": "^23.15.0",
|
|
85
70
|
"jest": "^29.7.0",
|
|
86
71
|
"jest-environment-jsdom": "^29.7.0",
|
|
87
72
|
"moment-timezone": "^0.5.45"
|
|
88
73
|
},
|
|
89
|
-
"overrides": {
|
|
90
|
-
"@types/react": "^18.2.20",
|
|
91
|
-
"@types/react-dom": "^18.2.18"
|
|
92
|
-
},
|
|
93
74
|
"browserslist": [
|
|
94
75
|
"defaults and supports es6-module",
|
|
95
76
|
"maintained node versions"
|
|
96
77
|
],
|
|
97
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "ad90558bba194b3dbb01ce3d6bd3cbb797621c8c"
|
|
98
79
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Details } from '@cee-eng/hydrajs/@types/models/insights';
|
|
2
|
-
export declare function getRuleReasonHtml(ruleReason: string, reportDetails: Details): string;
|
|
3
|
-
export declare function parseDotTemplate(dotString: string, reportDetails: Details): string;
|
|
4
|
-
//# sourceMappingURL=insightRuleInfoUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insightRuleInfoUtils.d.ts","sourceRoot":"","sources":["../../src/insightRuleInfoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AASlE,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,UAI3E;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,UASzE"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { markdownToHTML } from '@cee-eng/ui-toolkit';
|
|
2
|
-
import doT from 'dot/doT';
|
|
3
|
-
import assign from 'lodash/assign';
|
|
4
|
-
doT.templateSettings = assign({}, doT.templateSettings, {
|
|
5
|
-
varname: 'pydata',
|
|
6
|
-
strip: false,
|
|
7
|
-
});
|
|
8
|
-
export function getRuleReasonHtml(ruleReason, reportDetails) {
|
|
9
|
-
const resultText = parseDotTemplate(ruleReason, reportDetails);
|
|
10
|
-
const html = markdownToHTML(resultText);
|
|
11
|
-
return html;
|
|
12
|
-
}
|
|
13
|
-
export function parseDotTemplate(dotString, reportDetails) {
|
|
14
|
-
let parsedDotString = '';
|
|
15
|
-
try {
|
|
16
|
-
const tempFn = doT.template(dotString);
|
|
17
|
-
parsedDotString = tempFn(reportDetails);
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
parsedDotString = '';
|
|
21
|
-
}
|
|
22
|
-
return parsedDotString;
|
|
23
|
-
}
|