Skip to content

Commit db93197

Browse files
committed
move remove button + remove sugestions
1 parent f2c2e66 commit db93197

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Added
1616

1717
Contributed by @Jappzy and @cded from @Bitovi
1818

19+
* Added the search rule criteria in the UI with the possibility of multiple patterns. #992
20+
21+
Contributed by @Jappzy and @cded from @Bitovi
22+
1923
Changed
2024
~~~~~~~
2125
* Updated nodejs from `14.16.1` to `14.20.1`, fixing the local build under ARM processor architecture. #880

modules/st2-criteria/criteria.component.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,19 @@ export default class Criteria extends React.Component {
274274
<div>
275275
{ _.map(data, ({ type, pattern, condition }, key) => (
276276
<div className={style.line} key={key}>
277-
<AutoFormCombobox
278-
name='Key'
279-
className={style.entity}
280-
disabled={disabled}
281-
data={key}
282-
spec={spec}
283-
onChange={(value) => this.handleChangeKey(key, value)}
284-
/>
277+
<div className={style.criteriaLabel}>
278+
<AutoFormCombobox
279+
name='Key'
280+
className={style.entity}
281+
disabled={disabled}
282+
data={key}
283+
spec={spec}
284+
onChange={(value) => this.handleChangeKey(key, value)}
285+
/>
286+
{ disabled ? null :
287+
<i className={cx('icon-cross', style.remove)} onClick={() => this.handleRemove(key)} />
288+
}
289+
</div>
285290
<AutoFormSelect
286291
name='Type'
287292
className={style.entity}
@@ -316,7 +321,10 @@ export default class Criteria extends React.Component {
316321
className={style.entity}
317322
disabled={disabled}
318323
data={itemKey}
319-
spec={spec}
324+
spec={{
325+
required: true,
326+
enum: [],
327+
}}
320328
onChange={(value) => this.handleChangeSearchItemKey(key, itemKey, value)}
321329
/>
322330
<AutoFormSelect
@@ -340,7 +348,9 @@ export default class Criteria extends React.Component {
340348
}}
341349
onChange={(value) => this.handleChangeSearchPattern(key, itemKey, value)}
342350
/>
343-
<i className={cx('icon-cross', style.remove)} onClick={() => this.handleRemoveSearchPatternItem(key, itemKey)} />
351+
<i
352+
className={cx('icon-cross', style.remove, style.subPatternRemove)} onClick={() => this.handleRemoveSearchPatternItem(key, itemKey)}
353+
/>
344354
</div>
345355
))}
346356
</>
@@ -355,11 +365,7 @@ export default class Criteria extends React.Component {
355365
}}
356366
onChange={(value) => this.handleChangePattern(key, value)}
357367
/>
358-
)}
359-
<div className={style.break} />
360-
{ disabled ? null :
361-
<i className={cx('icon-cross', style.remove)} onClick={() => this.handleRemove(key)} />
362-
}
368+
)}
363369
</div>
364370
)) }
365371
</div>

modules/st2-criteria/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,18 @@
6868
flex-basis: 100%;
6969
height: 0;
7070
}
71+
72+
.criteriaLabel {
73+
position: relative;
74+
75+
i {
76+
position: absolute;
77+
top: 2px;
78+
left: -25px;
79+
}
80+
}
81+
82+
.subPatternRemove {
83+
margin-top: 20px;
84+
margin-left: 5px;
85+
}

0 commit comments

Comments
 (0)