*/
var Bugzilla = Bugzilla || {}; // eslint-disable-line no-var
+/**
+ * Reference or define the BMO extension namespace.
+ * @namespace
+ */
+Bugzilla.BMO = Bugzilla.BMO || {};
+
/**
* Implement Advanced Search page features.
*/
-Bugzilla.AdvancedSearch = class AdvancedSearch {
+Bugzilla.BMO.AdvancedSearch = class AdvancedSearch {
/**
* Initialize a new AdvancedSearch instance.
*/
}
};
-window.addEventListener('DOMContentLoaded', () => new Bugzilla.AdvancedSearch(), { once: true });
+window.addEventListener('DOMContentLoaded', () => new Bugzilla.BMO.AdvancedSearch(), { once: true });
*/
var Bugzilla = Bugzilla || {}; // eslint-disable-line no-var
+Bugzilla.AdvancedSearch = {};
+
+/**
+ * Implement features in the Search By Change History section.
+ */
+Bugzilla.AdvancedSearch.HistoryFilter = class HistoryFilter {
+ /**
+ * Initialize a new HistoryFilter instance.
+ */
+ constructor() {
+ this.$chfield = document.querySelector('#chfield');
+ this.$chfieldfrom = document.querySelector('#chfieldfrom');
+ this.$chfieldfrom_button = document.querySelector('#chfieldfrom + button');
+ this.$chfieldto = document.querySelector('#chfieldto');
+ this.$chfieldto_button = document.querySelector('#chfieldto + button');
+
+ this.$chfieldfrom.addEventListener('input', event => this.on_date_change(event));
+ this.$chfieldto.addEventListener('input', event => this.on_date_change(event));
+
+ // Use on-event handler because `field.js` will update it
+ this.$chfieldfrom_button.onclick = () => showCalendar('chfieldfrom');
+ this.$chfieldto_button.onclick = () => showCalendar('chfieldto');
+
+ createCalendar('chfieldfrom');
+ createCalendar('chfieldto');
+ }
+
+ /**
+ * Called whenever the date field value is updated.
+ * @param {InputEvent} event `input` event fired on date fields.
+ */
+ on_date_change(event) {
+ // Update the calendar when the user enters a date manually
+ if (event.isTrusted) {
+ updateCalendarFromField(event.target);
+ }
+
+ // Mark `<select>` required if the value is not empty
+ this.$chfield.required = !!this.$chfieldfrom.value.trim() || !!this.$chfieldto.value.trim();
+ }
+};
+
/**
* Implement Custom Search features.
*/
}
};
-window.addEventListener('DOMContentLoaded', () => new Bugzilla.CustomSearch(), { once: true });
+window.addEventListener('DOMContentLoaded', () => {
+ new Bugzilla.AdvancedSearch.HistoryFilter();
+ new Bugzilla.CustomSearch();
+}, { once: true });
}
date_field.value = dateStr;
+ date_field.dispatchEvent(new Event('input'));
hideCalendar(date_field.id);
}
screenshot_page($sel, '/app/artifacts/line271.png');
$sel->click_ok("Search");
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?emailreporter2=1&emailtype2=exact&order=Importance&list_id=__LIST_ID__&emailtype1=exact&emailcc2=1&query_format=advanced&emailassigned_to1=1&emailqa_contact2=1&email2=QA-Selenium-TEST%40mozilla.test&email1=admin%40mozilla.test&emailassigned_to2=1&product=TestProduct}
+ q{http://HOSTNAME/buglist.cgi?emailreporter2=1&order=Importance&emailtype2=exact&list_id=__LIST_ID__&emailtype1=exact&emailcc2=1&emailassigned_to1=1&query_format=advanced&emailqa_contact2=1&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to2=1&email1=admin%40mozilla.test&product=TestProduct}
);
$sel->title_is("Bug List");
screenshot_page($sel, '/app/artifacts/line275.png');
font-weight: normal;
}
+.bz_search_section .field_help {
+ white-space: nowrap;
+}
+
#bug_id_container .field_help {
- font-size: var(--font-size-x-small);
+ display: block;
}
.search_field_row {
<div id="bug_id_container">
<input type="text" name="bug_id" id="bug_id"
value="[% default.bug_id.0 FILTER html %]" size="20">
- <div class="field_help">(comma-separated list)</div>
+ <small class="field_help">(comma-separated list)</small>
</div>
should be
<select name="bug_id_type" id="bug_id_type">
</li>
<li>
<label for="chfieldfrom">between:</label>
- <input name="chfieldfrom" id="chfieldfrom" size="10"
- value="[% default.chfieldfrom.0 FILTER html %]" onchange="updateCalendarFromField(this)">
- <button type="button" class="calendar_button"
- id="button_calendar_chfieldfrom"
- onclick="showCalendar('chfieldfrom')"><span>Calendar</span></button>
- and
- <div id="con_calendar_chfieldfrom"></div>
- <input name="chfieldto" size="10" id="chfieldto"
- value="[% default.chfieldto.0 || "Now" FILTER html %]"
- onchange="updateCalendarFromField(this)">
- <button type="button" class="calendar_button"
- id="button_calendar_chfieldto"
- onclick="showCalendar('chfieldto')"><span>Calendar</span></button>
- <div id="con_calendar_chfieldto"></div>
- (YYYY-MM-DD or relative dates)
- <script [% script_nonce FILTER none %]>
- createCalendar('chfieldfrom');
- createCalendar('chfieldto');
- </script>
+ <input name="chfieldfrom" id="chfieldfrom" size="10" value="[% default.chfieldfrom.0 FILTER html %]">
+ <button type="button" class="calendar_button" id="button_calendar_chfieldfrom"><span>Calendar</span></button>
+ and
+ <div id="con_calendar_chfieldfrom"></div>
+ <input name="chfieldto" size="10" id="chfieldto" value="[% default.chfieldto.0 FILTER html %]" placeholder="Now">
+ <button type="button" class="calendar_button" id="button_calendar_chfieldto"><span>Calendar</span></button>
+ <div id="con_calendar_chfieldto"></div>
+ <small class="field_help">(YYYY-MM-DD or <a href="[% docs_urlbase FILTER html %]using/finding.html#relative-dates">relative dates</a>)</small>
</li>
</ul>