Closed Bug 644435 Opened 15 years ago Closed 15 years ago

Ability to filter results on machine's name

Categories

(Tree Management Graveyard :: TBPL, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: vingtetun, Assigned: vingtetun)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
Working on the Fennec mobile front-end side, I'm mostly interested by some particular tests (browser-chrome in this case) and by the related failures since those are the tests of the browser UI. Having all the machine/tests results make tbpl unuseful to track that and so the patch add a filter functionality on machine's name to handle that.
Attachment #521376 - Flags: review?(arpad.borsos)
Comment on attachment 521376 [details] [diff] [review] Patch >diff --git a/js/UserInterface.js b/js/UserInterface.js >--- a/js/UserInterface.js >+++ b/js/UserInterface.js >@@ -5,23 +5,25 @@ var UserInterface = { > > _controller: null, > _treeName: "", > _data: null, > _activeResult: "", > _storage: null, > _onlyUnstarred: false, > _pusher: "", >+ _machine: null, "" seems more appropriate. > if (!state) { > var params = self._controller.getParams(); > self._updatePusherFilter(params.pusher ? params.pusher : ""); > self._updateUnstarredFilter(params.onlyunstarred == '1'); > return; > } > > self._updatePusherFilter(state['pusher'] ? state['pusher'] : ""); >+ self._updateMachineFilter(state['machine'] ? state['machine'] : null); > self._updateUnstarredFilter(state['onlyUnstarred']); > } You need to add: self.updateMachineFilter(params.machine ? params.machine : ""); inside the !state block so we revert to no filter when going back to the first history item. In addition, I wonder if 'machine' is an appropriate name. Why not "jobs" or "job name"?
> > if (!state) { > > var params = self._controller.getParams(); > > self._updatePusherFilter(params.pusher ? params.pusher : ""); > > self._updateUnstarredFilter(params.onlyunstarred == '1'); > > return; > > } > > > > self._updatePusherFilter(state['pusher'] ? state['pusher'] : ""); > >+ self._updateMachineFilter(state['machine'] ? state['machine'] : null); > > self._updateUnstarredFilter(state['onlyUnstarred']); > > } > > You need to add: > self.updateMachineFilter(params.machine ? params.machine : ""); > inside the !state block so we revert to no filter when going back to the first > history item. Thanks, I've missed that. > > In addition, I wonder if 'machine' is an appropriate name. Why not "jobs" or > "job name"? I agree that machine does not seems appropriate here but this is to stay in sync with property name coming from the json data. But if it make things unclear for users I can rename the url parameter as well as the label in the filter menu?
Comment on attachment 521376 [details] [diff] [review] Patch > _filterDisplayedResults: function UserInterface__filterDisplayedResults(results) { >- if (!this._onlyUnstarred) >+ if (!this._onlyUnstarred && !this._machine) > return results; > > var self = this; >- return results.filter(function (result) { >- return self._isUnstarredFailure(result); >- }); >+ var filteredResults = results; >+ >+ if (this._onlyUnstarred) { >+ filteredResults = results.filter(function (result) { >+ return self._isUnstarredFailure(result); >+ }); >+ } >+ >+ if (this._machine) { >+ var machineFilter = new RegExp(this._machine, "i"); >+ filteredResults = results.filter(function (result) { >+ return result.machine.name.match(machineFilter) != null; >+ }); >+ } >+ >+ return filteredResults; Make sure both filters work together (The second overwrites the first result). You can maybe push both conditions into one .filter() call? + the things Mounir mentioned
Attachment #521376 - Flags: review?(arpad.borsos) → review-
(In reply to comment #2) > > In addition, I wonder if 'machine' is an appropriate name. Why not "jobs" or > > "job name"? > > I agree that machine does not seems appropriate here but this is to stay in > sync with property name coming from the json data. > But if it make things unclear for users I can rename the url parameter as well > as the label in the filter menu? Seems a good plan to me.
Attached patch Patch v0.2Splinter Review
Address both comments.
Attachment #521376 - Attachment is obsolete: true
Attachment #521458 - Flags: review?(arpad.borsos)
Comment on attachment 521458 [details] [diff] [review] Patch v0.2 >+ filteredResults = filteredResults.filter(function (result) { >+ return result.machine.name.match(machineFilter) != null; >+ }); Make that return machineFilter.test(result.machine.name);
Attachment #521458 - Flags: review?(arpad.borsos) → review+
Product: Webtools → Tree Management
Product: Tree Management → Tree Management Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: