Bug 946601 - Show an "Other" button in the requests footer, r=me

This commit is contained in:
Victor Porof 2014-02-04 15:51:41 +02:00
parent a80a62db7e
commit fb573a5c9b
2 changed files with 31 additions and 27 deletions

View File

@ -471,27 +471,6 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
} }
}, },
/**
* Create a new custom request form populated with the data from
* the currently selected request.
*/
cloneSelectedRequest: function() {
let selected = this.selectedItem.attachment;
// Create the element node for the network request item.
let menuView = this._createMenuView(selected.method, selected.url);
// Append a network request item to this container.
let newItem = this.push([menuView], {
attachment: Object.create(selected, {
isCustom: { value: true }
})
});
// Immediately switch to new request pane.
this.selectedItem = newItem;
},
/** /**
* Opens selected item in a new tab. * Opens selected item in a new tab.
*/ */
@ -521,16 +500,37 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
}); });
}, },
/**
* Create a new custom request form populated with the data from
* the currently selected request.
*/
cloneSelectedRequest: function() {
let selected = this.selectedItem.attachment;
// Create the element node for the network request item.
let menuView = this._createMenuView(selected.method, selected.url);
// Append a network request item to this container.
let newItem = this.push([menuView], {
attachment: Object.create(selected, {
isCustom: { value: true }
})
});
// Immediately switch to new request pane.
this.selectedItem = newItem;
},
/** /**
* Send a new HTTP request using the data in the custom request form. * Send a new HTTP request using the data in the custom request form.
*/ */
sendCustomRequest: function() { sendCustomRequest: function() {
let selected = this.selectedItem.attachment; let selected = this.selectedItem.attachment;
let data = Object.create(selected);
let data = Object.create(selected, { if (selected.requestHeaders) {
headers: { value: selected.requestHeaders.headers } data.headers = selected.requestHeaders.headers;
}); }
if (selected.requestPostData) { if (selected.requestPostData) {
data.body = selected.requestPostData.postData.text; data.body = selected.requestPostData.postData.text;
} }
@ -548,9 +548,8 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
*/ */
closeCustomRequest: function() { closeCustomRequest: function() {
this.remove(this.selectedItem); this.remove(this.selectedItem);
NetMonitorView.Sidebar.toggle(false); NetMonitorView.Sidebar.toggle(false);
}, },
/** /**
* Filters all network requests in this container by a specified type. * Filters all network requests in this container by a specified type.

View File

@ -215,6 +215,11 @@
data-key="flash" data-key="flash"
label="&netmonitorUI.footer.filterFlash;"> label="&netmonitorUI.footer.filterFlash;">
</button> </button>
<button id="requests-menu-filter-other-button"
class="requests-menu-filter-button requests-menu-footer-button"
data-key="other"
label="&netmonitorUI.footer.filterOther;">
</button>
<spacer id="requests-menu-spacer" <spacer id="requests-menu-spacer"
class="requests-menu-footer-spacer" class="requests-menu-footer-spacer"
flex="100"/> flex="100"/>