Skip to content

Commit d4274a1

Browse files
[frontend] fixes
1 parent 2e2631e commit d4274a1

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

openbas-front/src/admin/components/common/injects/form/articles/InjectArticlesList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ const InjectArticlesList = ({ allArticles = [], readOnly = false }: Props) => {
4141
const injectArticlesIds: string[] = (useWatch({
4242
control,
4343
name: 'inject_content.articles',
44-
})) ?? [];
44+
defaultValue: [],
45+
}));
4546

4647
const [sortedArticles, setSortedArticles] = useState<(Article & {
4748
article_channel_type: string;

openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,22 +1168,22 @@ class QuickInject extends Component {
11681168
f => !builtInFields.includes(f.key) && !f.expectation,
11691169
)
11701170
.filter((f) => {
1171-
// Filter display if linked fields
1171+
// Filter display if visible
11721172
for (
11731173
let index = 0;
1174-
index < f.linkedFields.length;
1174+
index < f.visibleConditionFields.length;
11751175
index += 1
11761176
) {
1177-
const linkedField = f.linkedFields[index];
1177+
const visibleConditionField = injectorContract.fields.find(g => g.key === f.visibleConditionFields[index]);
11781178
if (
1179-
linkedField.type === 'checkbox'
1180-
&& values[linkedField.key] === false
1179+
visibleConditionField.type === 'checkbox'
1180+
&& values[visibleConditionField.key] === false
11811181
) {
11821182
return false;
11831183
}
11841184
if (
1185-
linkedField.type === 'select'
1186-
&& !f.linkedValues.includes(values[linkedField.key])
1185+
visibleConditionField.type === 'select'
1186+
&& !f.linkedValues.includes(values[visibleConditionField.key])
11871187
) {
11881188
return false;
11891189
}

0 commit comments

Comments
 (0)