Skip to content

Commit 92cb119

Browse files
authored
Merge pull request #143 from PRO-Robotech/feature/dev
statustext: multiplevalues
2 parents 0d70329 + cfc18a3 commit 92cb119

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@prorobotech/openapi-k8s-toolkit",
3-
"version": "0.0.1-alpha.99",
3+
"version": "0.0.1-alpha.100",
44
"description": "ProRobotech OpenAPI k8s tools",
55
"main": "dist/openapi-k8s-toolkit.cjs.js",
66
"module": "dist/openapi-k8s-toolkit.es.js",

src/components/organisms/DynamicComponents/molecules/StatusText/StatusText.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const StatusText: FC<{ data: TDynamicComponentsAppTypeMap['StatusText'];
1414
const {
1515
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1616
id,
17-
value,
17+
values,
1818
criteriaSuccess,
1919
criteriaError,
2020
valueToCompareSuccess,
@@ -37,7 +37,7 @@ export const StatusText: FC<{ data: TDynamicComponentsAppTypeMap['StatusText'];
3737
const errorTextPrepared = parseAll({ text: errorText, replaceValues, multiQueryData })
3838
const fallbackTextPrepared = parseAll({ text: fallbackText, replaceValues, multiQueryData })
3939

40-
const valuePrepared = parseAll({ text: value, replaceValues, multiQueryData })
40+
const valuesPrepared = values.map(el => parseAll({ text: el, replaceValues, multiQueryData }))
4141

4242
if (isMultiqueryLoading) {
4343
return <div>Loading multiquery</div>
@@ -54,7 +54,7 @@ export const StatusText: FC<{ data: TDynamicComponentsAppTypeMap['StatusText'];
5454
}
5555

5656
const { type, text } = getResult({
57-
valuePrepared,
57+
valuesPrepared,
5858
criteriaSuccess,
5959
criteriaError,
6060
valueToCompareSuccess,

src/components/organisms/DynamicComponents/molecules/StatusText/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const getResult = ({
2-
valuePrepared,
2+
valuesPrepared,
33
criteriaSuccess,
44
criteriaError,
55
valueToCompareSuccess,
@@ -8,7 +8,7 @@ export const getResult = ({
88
errorText,
99
fallbackText,
1010
}: {
11-
valuePrepared: string
11+
valuesPrepared: string[]
1212
criteriaSuccess: 'equals' | 'notEquals'
1313
criteriaError: 'equals' | 'notEquals'
1414
valueToCompareSuccess: unknown[]
@@ -19,17 +19,17 @@ export const getResult = ({
1919
}): { type: 'success' | 'danger' | 'warning'; text: string } => {
2020
const success =
2121
criteriaSuccess === 'equals'
22-
? valueToCompareSuccess.includes(valuePrepared)
23-
: !valueToCompareSuccess.includes(valuePrepared)
22+
? valuesPrepared.some(v => valueToCompareSuccess.includes(v))
23+
: valuesPrepared.some(v => !valueToCompareSuccess.includes(v))
2424

2525
if (success) {
2626
return { type: 'success', text: successText }
2727
}
2828

2929
const error =
3030
criteriaError === 'equals'
31-
? valueToCompareError.includes(valuePrepared)
32-
: !valueToCompareError.includes(valuePrepared)
31+
? valuesPrepared.some(v => valueToCompareError.includes(v))
32+
: valuesPrepared.some(v => !valueToCompareError.includes(v))
3333

3434
if (error) {
3535
return { type: 'danger', text: errorText }

src/components/organisms/DynamicComponents/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export type TDynamicComponentsAppTypeMap = {
5151
Spacer: { id: number | string } & TSpacerProps
5252
StatusText: {
5353
id: number | string
54-
value: string
54+
values: string[]
5555
criteriaSuccess: 'equals' | 'notEquals'
5656
criteriaError: 'equals' | 'notEquals'
5757
valueToCompareSuccess: unknown[]

0 commit comments

Comments
 (0)