Skip to content

Commit 288a71f

Browse files
committed
Fix style for automation types
1 parent 25f082e commit 288a71f

File tree

5 files changed

+94
-7
lines changed

5 files changed

+94
-7
lines changed

src/dialog-editor/components/modal-field/field.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h4 class="modal-title" id="myModalLabel" translate>Edit Field Details</h4>
66
</div>
77

88
<div class="modal-body">
9-
<div class="dialog-editor-tab-notification" ng-if="vm.modalNotification().error">
9+
<div class="dialog-editor-tab-notification error" ng-if="vm.modalNotification().error">
1010
<i class="pficon pficon-error-circle-o"></i>
1111
{{vm.modalNotification().message}}
1212
</div>

src/dialog-editor/components/modal-field/modalFieldComponent.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class ModalFieldController extends ModalController {
1919
public treeOptions: any;
2020
public modalData: any;
2121
public validation: any;
22+
public searchQuery: string = '';
2223

2324
public $onInit() {
2425

@@ -41,6 +42,8 @@ class ModalFieldController extends ModalController {
4142
workflow: 'embedded_workflow',
4243
},
4344
emsWorkflowsEnabled: emsWorkflowsEnabled,
45+
searchQuery: '',
46+
filteredWorkflows: [],
4447

4548
/** Function to reset the modalData while changin the Automation Type. */
4649
onAutomationTypeChange: () => {
@@ -86,13 +89,37 @@ class ModalFieldController extends ModalController {
8689
this.treeOptions.data = data.resources.filter((item: any) => item.payload);
8790
const workflow = this.treeOptions.data.find((item) => item.id === this.modalData.resource_action.configuration_script_id);
8891
this.treeOptions.selected = workflow ? workflow.name : null;
92+
this.treeOptions.filteredWorkflows = this.treeOptions.data;
8993
});
9094
}
9195
},
9296

9397
/** Function to handle the onclick event of an item in tree. */
9498
onSelect: (node) => {
9599
this.treeSelectorSelect(node, this.modalData);
100+
},
101+
102+
/** Function to filter the API results with Repository or Workflow Name. */
103+
filterResults: () => {
104+
if ( this.treeOptions.searchQuery.length === 0) {
105+
this.treeOptions.filteredWorkflows = this.treeOptions.data;
106+
} else {
107+
const query = this.treeOptions.searchQuery.toLowerCase().trim();
108+
this.treeOptions.filteredWorkflows = this.treeOptions.data.filter((workflow) =>
109+
(workflow.configuration_script_source && workflow.configuration_script_source.name
110+
? workflow.configuration_script_source.name.toLowerCase().includes(query)
111+
: false) ||
112+
(workflow.name
113+
? workflow.name.toLowerCase().includes(query)
114+
: false)
115+
);
116+
}
117+
},
118+
119+
/** Function to clear the search text and reset the list. */
120+
clearSearchQuery: () => {
121+
this.treeOptions.searchQuery = '';
122+
this.treeOptions.filteredWorkflows = this.treeOptions.data;
96123
}
97124
};
98125
}

src/dialog-editor/components/tree-selector/tree-selector.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,36 @@
4242
</div>
4343
<div ng-if="$ctrl.treeOptions.automationType==$ctrl.treeOptions.automationTypes.workflow">
4444
<div ng-if="$ctrl.treeOptions.data">
45-
<input type="text" ng-model="$ctrl.searchQuery" placeholder="Search by Repository or Workflow Name" class="form-control"/>
4645
<div class="nav nav-list workflows_list_wrapper">
46+
<div class="list_search_wrapper">
47+
<span class="pficon pficon-search"></span>
48+
<input type="text" class="form-control"
49+
ng-model="$ctrl.treeOptions.searchQuery"
50+
placeholder="Search by Repository or Workflow Name"
51+
ng-change="$ctrl.treeOptions.filterResults()"/>
52+
<span class="pficon pficon-close"
53+
ng-if="$ctrl.treeOptions.searchQuery"
54+
title="Clear"
55+
ng-click="$ctrl.treeOptions.clearSearchQuery()"></span>
56+
</div>
4757
<div class="workflows_list_header">
4858
<div class="col-md-6">Repository</div>
4959
<div class="col-md-6">Workflow Name</div>
5060
</div>
5161
<div class="workflow_list_content">
52-
<div class="workflow_item" ng-repeat="workflow in $ctrl.treeOptions.data">
62+
<div class="workflow_list_content_notification" ng-if="$ctrl.treeOptions.filteredWorkflows.length === 0">
63+
<div class="dialog-editor-tab-notification info">
64+
<i class="pficon pficon-info"></i>
65+
No records found
66+
</div>
67+
</div>
68+
<div class="workflow_item" ng-repeat="workflow in $ctrl.treeOptions.filteredWorkflows">
5369
<div class="workflow_item_row" ng-click="$ctrl.treeOptions.onSelect(workflow)">
5470
<div class="col-md-6">{{workflow.configuration_script_source.name}}</div>
5571
<div class="col-md-6">{{workflow.name}}</div>
5672
</div>
5773
</div>
58-
</div>
74+
5975
</div>
6076
</div>
6177
</div>

src/styles/dialog-editor-boxes.scss

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,35 @@ l.nav.nav-list.workflows {
195195
flex-direction: column;
196196
border: 1px solid lightgray;
197197

198+
.list_search_wrapper {
199+
display: flex;
200+
flex-direction: row;
201+
202+
span {
203+
border: 0;
204+
width: 30px;
205+
height: 30px;
206+
display: flex;
207+
align-items: center;
208+
justify-content: center;
209+
210+
&.pficon-search {
211+
color: gray;
212+
}
213+
&.pficon-close {
214+
color: #000;
215+
cursor: pointer;
216+
}
217+
}
218+
219+
input {
220+
border: 0;
221+
flex-grow: 1;
222+
box-shadow: none;
223+
height: 30px;
224+
}
225+
}
226+
198227
.workflows_list_header {
199228
background: lightgray;
200229
padding: 10px 0;
@@ -207,7 +236,13 @@ l.nav.nav-list.workflows {
207236
overflow-y: auto;
208237
max-height: 400px;
209238
flex-direction: column;
210-
239+
240+
.workflow_list_content_notification {
241+
padding: 20px;
242+
display: flex;
243+
justify-content: center;
244+
}
245+
211246
.workflow_item {
212247
display: flex;
213248
flex-grow: 1;

src/styles/ui-components.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,26 @@
88
.dialog-editor-tab-notification {
99
color: #363636;
1010
font-weight: bold;
11-
background: #ffe6e7;
12-
border: 1px solid #cd0000;
1311
padding: 10px;
1412
margin-bottom: 10px;
1513
display: flex;
1614
align-items: center;
1715
gap: 10px;
16+
flex-grow: 1;
1817

1918
i {
2019
font-size: 16px;
2120
}
21+
22+
&.error {
23+
background: #ffe6e7;
24+
border: 1px solid #cd0000;
25+
}
26+
27+
&.info {
28+
background: lightgray;
29+
border: 1px solid gray;
30+
}
2231
}
2332

2433
.dialog-editor-tab-list {

0 commit comments

Comments
 (0)