mirror of
https://github.com/ansible/awx.git
synced 2026-05-22 08:17:39 -02:30
Merge pull request #2706 from mabashian/2692-empty-search-list
Disable search submit until a search string is present
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn at-ButtonHollow--default at-Input-button"
|
<button class="btn at-ButtonHollow--default at-Input-button"
|
||||||
ng-click="vm.submitSearch()"
|
ng-click="vm.submitSearch()"
|
||||||
ng-disabled="vm.disabled"
|
ng-disabled="vm.disabled || !vm.value || vm.value === ''"
|
||||||
type="button">
|
type="button">
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -76,10 +76,15 @@
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.SmartSearch-searchButton:hover {
|
.SmartSearch-searchButton:not(.SmartSearch-searchButton--disabled):hover {
|
||||||
background-color: @default-tertiary-bg;
|
background-color: @default-tertiary-bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.SmartSearch-searchButton--disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.65;
|
||||||
|
}
|
||||||
|
|
||||||
.SmartSearch-flexContainer {
|
.SmartSearch-flexContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ function SmartSearchController (
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.addTerms = terms => {
|
$scope.addTerms = terms => {
|
||||||
|
if (terms && terms !== "") {
|
||||||
const { singleSearchParam } = $scope;
|
const { singleSearchParam } = $scope;
|
||||||
const unmodifiedQueryset = _.clone(queryset);
|
const unmodifiedQueryset = _.clone(queryset);
|
||||||
|
|
||||||
@@ -211,6 +212,7 @@ function SmartSearchController (
|
|||||||
$scope.searchTerm = null;
|
$scope.searchTerm = null;
|
||||||
|
|
||||||
generateSearchTags();
|
generateSearchTags();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// remove tag, merge new queryset, $state.go
|
// remove tag, merge new queryset, $state.go
|
||||||
$scope.removeTerm = index => {
|
$scope.removeTerm = index => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<input class="SmartSearch-input" ng-model="searchTerm" placeholder="{{searchPlaceholder}}"
|
<input class="SmartSearch-input" ng-model="searchTerm" placeholder="{{searchPlaceholder}}"
|
||||||
ng-disabled="disableSearch">
|
ng-disabled="disableSearch">
|
||||||
</form>
|
</form>
|
||||||
<div type="submit" class="SmartSearch-searchButton" ng-disabled="!searchTerm" ng-click="addTerms(searchTerm)">
|
<div type="submit" class="SmartSearch-searchButton" ng-class="{'SmartSearch-searchButton--disabled': !searchTerm || searchTerm === ''}" ng-click="addTerms(searchTerm)">
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user