Skip to content

Commit c319c0b

Browse files
SeifjeMike Tutkowski
authored andcommitted
Make using a hint (or no results) text more flexible
1 parent f2781a5 commit c319c0b

4 files changed

Lines changed: 22 additions & 42 deletions

File tree

ui/lib/jquery.tokeninput.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var DEFAULT_SETTINGS = {
2121
jsonContainer: null,
2222

2323
// Display settings
24-
hintText: "Type in part of a storage tag",
25-
noResultsText: "No storage tags found",
24+
hintText: "Type in a search term",
25+
noResultsText: "No results",
2626
searchingText: "Searching...",
2727
deleteText: "×",
2828
animateDropdown: true,

ui/scripts/system.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15197,7 +15197,9 @@
1519715197
}
1519815198

1519915199
args.response.success({
15200-
data: tags
15200+
data: tags,
15201+
hintText: "Type in part of a host tag",
15202+
noResultsText: "No host tags found"
1520115203
});
1520215204
},
1520315205
error: function(XMLHttpResponse) {
@@ -15790,7 +15792,9 @@
1579015792
}
1579115793

1579215794
args.response.success({
15793-
data: tags
15795+
data: tags,
15796+
hintText: "Type in part of a host tag",
15797+
noResultsText: "No host tags found"
1579415798
});
1579515799
},
1579615800
error: function(XMLHttpResponse) {
@@ -16970,7 +16974,9 @@
1697016974
}
1697116975

1697216976
args.response.success({
16973-
data: tags
16977+
data: tags,
16978+
hintText: "Type in part of a storage tag",
16979+
noResultsText: "No storage tags found"
1697416980
});
1697516981
},
1697616982
error: function(XMLHttpResponse) {
@@ -17329,7 +17335,9 @@
1732917335
}
1733017336

1733117337
args.response.success({
17332-
data: tags
17338+
data: tags,
17339+
hintText: "Type in part of a storage tag",
17340+
noResultsText: "No storage tags found"
1733317341
});
1733417342
},
1733517343
error: function(XMLHttpResponse) {

ui/scripts/ui/dialog.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -467,20 +467,6 @@
467467
} else if (field.isTokenInput) { // jquery.tokeninput.js
468468
isAsync = true;
469469

470-
var hint= "Type in a search term";
471-
var noResults= "No results";
472-
473-
if (field.label === 'label.storage.tags')
474-
{
475-
hint = "Type in part of a storage tag";
476-
noResults = "No storage tags found";
477-
}
478-
else if (field.label === 'label.host.tags')
479-
{
480-
hint = "Type in part of a host tag";
481-
noResults = "No host tags found";
482-
}
483-
484470
selectArgs = {
485471
context: args.context,
486472
response: {
@@ -489,8 +475,8 @@
489475
{
490476
theme: "facebook",
491477
preventDuplicates: true,
492-
hintText: hint,
493-
noResultsText: noResults
478+
hintText: args.hintText,
479+
noResultsText: args.noResultsText
494480
});
495481
}
496482
}

ui/scripts/ui/widgets/detailView.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@
672672
// Turn into form field
673673
var selectData = $value.data('detail-view-editable-select');
674674
var isBoolean = $value.data('detail-view-editable-boolean');
675-
var isTokenInput = $value.data('detail-view-is-TokenInput');
675+
var isTokenInput = $value.data('detail-view-is-token-input');
676676
var data = !isBoolean ? cloudStack.sanitizeReverse($value.html()) : $value.data('detail-view-boolean-value');
677677
var rules = $value.data('validation-rules') ? $value.data('validation-rules') : {};
678678
var isPassword = $value.data('detail-view-is-password');
@@ -734,20 +734,6 @@
734734

735735
isAsync = true;
736736

737-
var hint = "Type in a search term";
738-
var noResults = "No results";
739-
740-
if ($value.data('value_token').label === 'label.storage.tags')
741-
{
742-
hint = "Type in part of a storage tag";
743-
noResults= "No storage tags found";
744-
}
745-
else if ($value.data('value_token').label === 'label.host.tags')
746-
{
747-
hint = "Type in part of a host tag";
748-
noResults = "No host tags found";
749-
}
750-
751737
selectArgs = {
752738
context: $detailView.data('view-args').context,
753739
response: {
@@ -758,8 +744,8 @@
758744
preventDuplicates: true,
759745
prePopulate: existing_tags,
760746
processPrePopulate: true,
761-
hintText: hint,
762-
noResultsText: noResults
747+
hintText: args.hintText,
748+
noResultsText: args.noResultsText
763749
});
764750
}
765751
}
@@ -773,7 +759,7 @@
773759

774760
$value.append($input);
775761
token_value = data;
776-
$value.data('value_token').dataProvider(selectArgs);
762+
$value.data('value-token').dataProvider(selectArgs);
777763
} else {
778764
// Text input
779765
$value.append(
@@ -1129,8 +1115,8 @@
11291115

11301116
if (value.isTokenInput)
11311117
{
1132-
$value.data('detail-view-is-TokenInput', true);
1133-
$value.data('value_token', value);
1118+
$value.data('detail-view-is-token-input', true);
1119+
$value.data('value-token', value);
11341120
}
11351121
}
11361122

0 commit comments

Comments
 (0)