Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js

Issue 2902673003: Added a refresh database button on the IndexedDB view. (Closed)
Patch Set: Removed model and test line Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 var bodySection = this._reportView.appendSection(''); 47 var bodySection = this._reportView.appendSection('');
48 this._securityOriginElement = bodySection.appendField(Common.UIString('Secur ity origin')); 48 this._securityOriginElement = bodySection.appendField(Common.UIString('Secur ity origin'));
49 this._versionElement = bodySection.appendField(Common.UIString('Version')); 49 this._versionElement = bodySection.appendField(Common.UIString('Version'));
50 50
51 var footer = this._reportView.appendSection('').appendRow(); 51 var footer = this._reportView.appendSection('').appendRow();
52 this._clearButton = UI.createTextButton( 52 this._clearButton = UI.createTextButton(
53 Common.UIString('Delete database'), () => this._deleteDatabase(), Common .UIString('Delete database')); 53 Common.UIString('Delete database'), () => this._deleteDatabase(), Common .UIString('Delete database'));
54 footer.appendChild(this._clearButton); 54 footer.appendChild(this._clearButton);
55 55
56 this._refreshButton = UI.createTextButton(
57 Common.UIString('Refresh database'), () => this._refreshDatabase(), Comm on.UIString('Refresh database'));
58 footer.appendChild(this._refreshButton);
59
56 this.update(database); 60 this.update(database);
57 } 61 }
58 62
59 _refreshDatabase() { 63 _refreshDatabase() {
60 this._securityOriginElement.textContent = this._database.databaseId.security Origin; 64 this._securityOriginElement.textContent = this._database.databaseId.security Origin;
61 this._versionElement.textContent = this._database.version; 65 this._versionElement.textContent = this._database.version;
66 this._model.refreshDatabaseView(this._database.databaseId);
62 } 67 }
63 68
64 /** 69 /**
65 * @param {!Resources.IndexedDBModel.Database} database 70 * @param {!Resources.IndexedDBModel.Database} database
66 */ 71 */
67 update(database) { 72 update(database) {
68 this._database = database; 73 this._database = database;
69 this._refreshDatabase(); 74 this._refreshDatabase();
70 } 75 }
71 76
(...skipping 25 matching lines...) Expand all
97 this.element.classList.add('indexed-db-data-view'); 102 this.element.classList.add('indexed-db-data-view');
98 103
99 this._createEditorToolbar(); 104 this._createEditorToolbar();
100 105
101 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg eicon-refresh'); 106 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg eicon-refresh');
102 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._re freshButtonClicked, this); 107 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._re freshButtonClicked, this);
103 108
104 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear object store '), 'largeicon-clear'); 109 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear object store '), 'largeicon-clear');
105 this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clea rButtonClicked, this); 110 this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clea rButtonClicked, this);
106 111
112 this._model.addEventListener(Resources.IndexedDBModel.Events.DatabaseRefresh ed, this._databaseRefreshed, this);
113
107 this._pageSize = 50; 114 this._pageSize = 50;
108 this._skipCount = 0; 115 this._skipCount = 0;
109 116
110 this.update(objectStore, index); 117 this.update(objectStore, index);
111 this._entries = []; 118 this._entries = [];
112 } 119 }
113 120
114 /** 121 /**
115 * @return {!DataGrid.DataGrid} 122 * @return {!DataGrid.DataGrid}
116 */ 123 */
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 editorToolbar.appendToolbarItem(this._pageForwardButton); 195 editorToolbar.appendToolbarItem(this._pageForwardButton);
189 196
190 this._keyInputElement = editorToolbar.element.createChild('input', 'key-inpu t'); 197 this._keyInputElement = editorToolbar.element.createChild('input', 'key-inpu t');
191 this._keyInputElement.placeholder = Common.UIString('Start from key'); 198 this._keyInputElement.placeholder = Common.UIString('Start from key');
192 this._keyInputElement.addEventListener('paste', this._keyInputChanged.bind(t his), false); 199 this._keyInputElement.addEventListener('paste', this._keyInputChanged.bind(t his), false);
193 this._keyInputElement.addEventListener('cut', this._keyInputChanged.bind(thi s), false); 200 this._keyInputElement.addEventListener('cut', this._keyInputChanged.bind(thi s), false);
194 this._keyInputElement.addEventListener('keypress', this._keyInputChanged.bin d(this), false); 201 this._keyInputElement.addEventListener('keypress', this._keyInputChanged.bin d(this), false);
195 this._keyInputElement.addEventListener('keydown', this._keyInputChanged.bind (this), false); 202 this._keyInputElement.addEventListener('keydown', this._keyInputChanged.bind (this), false);
196 } 203 }
197 204
205 _databaseRefreshed(event) {
206 if (this._databaseId === event.data.databaseId)
207 this._updateData(true);
208 }
209
198 /** 210 /**
199 * @param {!Common.Event} event 211 * @param {!Common.Event} event
200 */ 212 */
201 _pageBackButtonClicked(event) { 213 _pageBackButtonClicked(event) {
202 this._skipCount = Math.max(0, this._skipCount - this._pageSize); 214 this._skipCount = Math.max(0, this._skipCount - this._pageSize);
203 this._updateData(false); 215 this._updateData(false);
204 } 216 }
205 217
206 /** 218 /**
207 * @param {!Common.Event} event 219 * @param {!Common.Event} event
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 cell.removeChildren(); 376 cell.removeChildren();
365 var objectElement = ObjectUI.ObjectPropertiesSection.defaultObjectPresen tation(value, undefined, true); 377 var objectElement = ObjectUI.ObjectPropertiesSection.defaultObjectPresen tation(value, undefined, true);
366 cell.appendChild(objectElement); 378 cell.appendChild(objectElement);
367 break; 379 break;
368 default: 380 default:
369 } 381 }
370 382
371 return cell; 383 return cell;
372 } 384 }
373 }; 385 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698