| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 WebInspector.IDBDatabaseView = class extends WebInspector.VBox { | 34 Resources.IDBDatabaseView = class extends UI.VBox { |
| 35 /** | 35 /** |
| 36 * @param {!WebInspector.IndexedDBModel.Database} database | 36 * @param {!Resources.IndexedDBModel.Database} database |
| 37 */ | 37 */ |
| 38 constructor(database) { | 38 constructor(database) { |
| 39 super(); | 39 super(); |
| 40 this.registerRequiredCSS('resources/indexedDBViews.css'); | 40 this.registerRequiredCSS('resources/indexedDBViews.css'); |
| 41 | 41 |
| 42 this.element.classList.add('indexed-db-database-view'); | 42 this.element.classList.add('indexed-db-database-view'); |
| 43 this.element.classList.add('storage-view'); | 43 this.element.classList.add('storage-view'); |
| 44 | 44 |
| 45 this._securityOriginElement = this.element.createChild('div', 'header-row'); | 45 this._securityOriginElement = this.element.createChild('div', 'header-row'); |
| 46 this._nameElement = this.element.createChild('div', 'header-row'); | 46 this._nameElement = this.element.createChild('div', 'header-row'); |
| 47 this._versionElement = this.element.createChild('div', 'header-row'); | 47 this._versionElement = this.element.createChild('div', 'header-row'); |
| 48 | 48 |
| 49 this.update(database); | 49 this.update(database); |
| 50 } | 50 } |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * @param {!Element} element | 53 * @param {!Element} element |
| 54 * @param {string} name | 54 * @param {string} name |
| 55 * @param {string} value | 55 * @param {string} value |
| 56 */ | 56 */ |
| 57 _formatHeader(element, name, value) { | 57 _formatHeader(element, name, value) { |
| 58 element.removeChildren(); | 58 element.removeChildren(); |
| 59 element.createChild('div', 'attribute-name').textContent = name + ':'; | 59 element.createChild('div', 'attribute-name').textContent = name + ':'; |
| 60 element.createChild('div', 'attribute-value source-code').textContent = valu
e; | 60 element.createChild('div', 'attribute-value source-code').textContent = valu
e; |
| 61 } | 61 } |
| 62 | 62 |
| 63 _refreshDatabase() { | 63 _refreshDatabase() { |
| 64 this._formatHeader( | 64 this._formatHeader( |
| 65 this._securityOriginElement, WebInspector.UIString('Security origin'), | 65 this._securityOriginElement, Common.UIString('Security origin'), |
| 66 this._database.databaseId.securityOrigin); | 66 this._database.databaseId.securityOrigin); |
| 67 this._formatHeader(this._nameElement, WebInspector.UIString('Name'), this._d
atabase.databaseId.name); | 67 this._formatHeader(this._nameElement, Common.UIString('Name'), this._databas
e.databaseId.name); |
| 68 this._formatHeader(this._versionElement, WebInspector.UIString('Version'), t
his._database.version); | 68 this._formatHeader(this._versionElement, Common.UIString('Version'), this._d
atabase.version); |
| 69 } | 69 } |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * @param {!WebInspector.IndexedDBModel.Database} database | 72 * @param {!Resources.IndexedDBModel.Database} database |
| 73 */ | 73 */ |
| 74 update(database) { | 74 update(database) { |
| 75 this._database = database; | 75 this._database = database; |
| 76 this._refreshDatabase(); | 76 this._refreshDatabase(); |
| 77 } | 77 } |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * @unrestricted | 81 * @unrestricted |
| 82 */ | 82 */ |
| 83 WebInspector.IDBDataView = class extends WebInspector.SimpleView { | 83 Resources.IDBDataView = class extends UI.SimpleView { |
| 84 /** | 84 /** |
| 85 * @param {!WebInspector.IndexedDBModel} model | 85 * @param {!Resources.IndexedDBModel} model |
| 86 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId | 86 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId |
| 87 * @param {!WebInspector.IndexedDBModel.ObjectStore} objectStore | 87 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore |
| 88 * @param {?WebInspector.IndexedDBModel.Index} index | 88 * @param {?Resources.IndexedDBModel.Index} index |
| 89 */ | 89 */ |
| 90 constructor(model, databaseId, objectStore, index) { | 90 constructor(model, databaseId, objectStore, index) { |
| 91 super(WebInspector.UIString('IDB')); | 91 super(Common.UIString('IDB')); |
| 92 this.registerRequiredCSS('resources/indexedDBViews.css'); | 92 this.registerRequiredCSS('resources/indexedDBViews.css'); |
| 93 | 93 |
| 94 this._model = model; | 94 this._model = model; |
| 95 this._databaseId = databaseId; | 95 this._databaseId = databaseId; |
| 96 this._isIndex = !!index; | 96 this._isIndex = !!index; |
| 97 | 97 |
| 98 this.element.classList.add('indexed-db-data-view'); | 98 this.element.classList.add('indexed-db-data-view'); |
| 99 | 99 |
| 100 this._createEditorToolbar(); | 100 this._createEditorToolbar(); |
| 101 | 101 |
| 102 this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString('
Refresh'), 'largeicon-refresh'); | 102 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg
eicon-refresh'); |
| 103 this._refreshButton.addEventListener('click', this._refreshButtonClicked, th
is); | 103 this._refreshButton.addEventListener('click', this._refreshButtonClicked, th
is); |
| 104 | 104 |
| 105 this._clearButton = | 105 this._clearButton = |
| 106 new WebInspector.ToolbarButton(WebInspector.UIString('Clear object store
'), 'largeicon-clear'); | 106 new UI.ToolbarButton(Common.UIString('Clear object store'), 'largeicon-c
lear'); |
| 107 this._clearButton.addEventListener('click', this._clearButtonClicked, this); | 107 this._clearButton.addEventListener('click', this._clearButtonClicked, this); |
| 108 | 108 |
| 109 this._pageSize = 50; | 109 this._pageSize = 50; |
| 110 this._skipCount = 0; | 110 this._skipCount = 0; |
| 111 | 111 |
| 112 this.update(objectStore, index); | 112 this.update(objectStore, index); |
| 113 this._entries = []; | 113 this._entries = []; |
| 114 } | 114 } |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * @return {!WebInspector.DataGrid} | 117 * @return {!UI.DataGrid} |
| 118 */ | 118 */ |
| 119 _createDataGrid() { | 119 _createDataGrid() { |
| 120 var keyPath = this._isIndex ? this._index.keyPath : this._objectStore.keyPat
h; | 120 var keyPath = this._isIndex ? this._index.keyPath : this._objectStore.keyPat
h; |
| 121 | 121 |
| 122 var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */
([]); | 122 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([]); |
| 123 columns.push({id: 'number', title: WebInspector.UIString('#'), sortable: fal
se, width: '50px'}); | 123 columns.push({id: 'number', title: Common.UIString('#'), sortable: false, wi
dth: '50px'}); |
| 124 columns.push({ | 124 columns.push({ |
| 125 id: 'key', | 125 id: 'key', |
| 126 titleDOMFragment: this._keyColumnHeaderFragment(WebInspector.UIString('Key
'), keyPath), | 126 titleDOMFragment: this._keyColumnHeaderFragment(Common.UIString('Key'), ke
yPath), |
| 127 sortable: false | 127 sortable: false |
| 128 }); | 128 }); |
| 129 if (this._isIndex) | 129 if (this._isIndex) |
| 130 columns.push({ | 130 columns.push({ |
| 131 id: 'primaryKey', | 131 id: 'primaryKey', |
| 132 titleDOMFragment: | 132 titleDOMFragment: |
| 133 this._keyColumnHeaderFragment(WebInspector.UIString('Primary key'),
this._objectStore.keyPath), | 133 this._keyColumnHeaderFragment(Common.UIString('Primary key'), this._
objectStore.keyPath), |
| 134 sortable: false | 134 sortable: false |
| 135 }); | 135 }); |
| 136 columns.push({id: 'value', title: WebInspector.UIString('Value'), sortable:
false}); | 136 columns.push({id: 'value', title: Common.UIString('Value'), sortable: false}
); |
| 137 | 137 |
| 138 var dataGrid = new WebInspector.DataGrid(columns); | 138 var dataGrid = new UI.DataGrid(columns); |
| 139 return dataGrid; | 139 return dataGrid; |
| 140 } | 140 } |
| 141 | 141 |
| 142 /** | 142 /** |
| 143 * @param {string} prefix | 143 * @param {string} prefix |
| 144 * @param {*} keyPath | 144 * @param {*} keyPath |
| 145 * @return {!DocumentFragment} | 145 * @return {!DocumentFragment} |
| 146 */ | 146 */ |
| 147 _keyColumnHeaderFragment(prefix, keyPath) { | 147 _keyColumnHeaderFragment(prefix, keyPath) { |
| 148 var keyColumnHeaderFragment = createDocumentFragment(); | 148 var keyColumnHeaderFragment = createDocumentFragment(); |
| 149 keyColumnHeaderFragment.createTextChild(prefix); | 149 keyColumnHeaderFragment.createTextChild(prefix); |
| 150 if (keyPath === null) | 150 if (keyPath === null) |
| 151 return keyColumnHeaderFragment; | 151 return keyColumnHeaderFragment; |
| 152 | 152 |
| 153 keyColumnHeaderFragment.createTextChild(' (' + WebInspector.UIString('Key pa
th: ')); | 153 keyColumnHeaderFragment.createTextChild(' (' + Common.UIString('Key path: ')
); |
| 154 if (Array.isArray(keyPath)) { | 154 if (Array.isArray(keyPath)) { |
| 155 keyColumnHeaderFragment.createTextChild('['); | 155 keyColumnHeaderFragment.createTextChild('['); |
| 156 for (var i = 0; i < keyPath.length; ++i) { | 156 for (var i = 0; i < keyPath.length; ++i) { |
| 157 if (i !== 0) | 157 if (i !== 0) |
| 158 keyColumnHeaderFragment.createTextChild(', '); | 158 keyColumnHeaderFragment.createTextChild(', '); |
| 159 keyColumnHeaderFragment.appendChild(this._keyPathStringFragment(keyPath[
i])); | 159 keyColumnHeaderFragment.appendChild(this._keyPathStringFragment(keyPath[
i])); |
| 160 } | 160 } |
| 161 keyColumnHeaderFragment.createTextChild(']'); | 161 keyColumnHeaderFragment.createTextChild(']'); |
| 162 } else { | 162 } else { |
| 163 var keyPathString = /** @type {string} */ (keyPath); | 163 var keyPathString = /** @type {string} */ (keyPath); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 174 _keyPathStringFragment(keyPathString) { | 174 _keyPathStringFragment(keyPathString) { |
| 175 var keyPathStringFragment = createDocumentFragment(); | 175 var keyPathStringFragment = createDocumentFragment(); |
| 176 keyPathStringFragment.createTextChild('"'); | 176 keyPathStringFragment.createTextChild('"'); |
| 177 var keyPathSpan = keyPathStringFragment.createChild('span', 'source-code ind
exed-db-key-path'); | 177 var keyPathSpan = keyPathStringFragment.createChild('span', 'source-code ind
exed-db-key-path'); |
| 178 keyPathSpan.textContent = keyPathString; | 178 keyPathSpan.textContent = keyPathString; |
| 179 keyPathStringFragment.createTextChild('"'); | 179 keyPathStringFragment.createTextChild('"'); |
| 180 return keyPathStringFragment; | 180 return keyPathStringFragment; |
| 181 } | 181 } |
| 182 | 182 |
| 183 _createEditorToolbar() { | 183 _createEditorToolbar() { |
| 184 var editorToolbar = new WebInspector.Toolbar('data-view-toolbar', this.eleme
nt); | 184 var editorToolbar = new UI.Toolbar('data-view-toolbar', this.element); |
| 185 | 185 |
| 186 this._pageBackButton = | 186 this._pageBackButton = |
| 187 new WebInspector.ToolbarButton(WebInspector.UIString('Show previous page
'), 'largeicon-play-back'); | 187 new UI.ToolbarButton(Common.UIString('Show previous page'), 'largeicon-p
lay-back'); |
| 188 this._pageBackButton.addEventListener('click', this._pageBackButtonClicked,
this); | 188 this._pageBackButton.addEventListener('click', this._pageBackButtonClicked,
this); |
| 189 editorToolbar.appendToolbarItem(this._pageBackButton); | 189 editorToolbar.appendToolbarItem(this._pageBackButton); |
| 190 | 190 |
| 191 this._pageForwardButton = | 191 this._pageForwardButton = |
| 192 new WebInspector.ToolbarButton(WebInspector.UIString('Show next page'),
'largeicon-play'); | 192 new UI.ToolbarButton(Common.UIString('Show next page'), 'largeicon-play'
); |
| 193 this._pageForwardButton.setEnabled(false); | 193 this._pageForwardButton.setEnabled(false); |
| 194 this._pageForwardButton.addEventListener('click', this._pageForwardButtonCli
cked, this); | 194 this._pageForwardButton.addEventListener('click', this._pageForwardButtonCli
cked, this); |
| 195 editorToolbar.appendToolbarItem(this._pageForwardButton); | 195 editorToolbar.appendToolbarItem(this._pageForwardButton); |
| 196 | 196 |
| 197 this._keyInputElement = editorToolbar.element.createChild('input', 'key-inpu
t'); | 197 this._keyInputElement = editorToolbar.element.createChild('input', 'key-inpu
t'); |
| 198 this._keyInputElement.placeholder = WebInspector.UIString('Start from key'); | 198 this._keyInputElement.placeholder = Common.UIString('Start from key'); |
| 199 this._keyInputElement.addEventListener('paste', this._keyInputChanged.bind(t
his), false); | 199 this._keyInputElement.addEventListener('paste', this._keyInputChanged.bind(t
his), false); |
| 200 this._keyInputElement.addEventListener('cut', this._keyInputChanged.bind(thi
s), false); | 200 this._keyInputElement.addEventListener('cut', this._keyInputChanged.bind(thi
s), false); |
| 201 this._keyInputElement.addEventListener('keypress', this._keyInputChanged.bin
d(this), false); | 201 this._keyInputElement.addEventListener('keypress', this._keyInputChanged.bin
d(this), false); |
| 202 this._keyInputElement.addEventListener('keydown', this._keyInputChanged.bind
(this), false); | 202 this._keyInputElement.addEventListener('keydown', this._keyInputChanged.bind
(this), false); |
| 203 } | 203 } |
| 204 | 204 |
| 205 _pageBackButtonClicked() { | 205 _pageBackButtonClicked() { |
| 206 this._skipCount = Math.max(0, this._skipCount - this._pageSize); | 206 this._skipCount = Math.max(0, this._skipCount - this._pageSize); |
| 207 this._updateData(false); | 207 this._updateData(false); |
| 208 } | 208 } |
| 209 | 209 |
| 210 _pageForwardButtonClicked() { | 210 _pageForwardButtonClicked() { |
| 211 this._skipCount = this._skipCount + this._pageSize; | 211 this._skipCount = this._skipCount + this._pageSize; |
| 212 this._updateData(false); | 212 this._updateData(false); |
| 213 } | 213 } |
| 214 | 214 |
| 215 _keyInputChanged() { | 215 _keyInputChanged() { |
| 216 window.setTimeout(this._updateData.bind(this, false), 0); | 216 window.setTimeout(this._updateData.bind(this, false), 0); |
| 217 } | 217 } |
| 218 | 218 |
| 219 /** | 219 /** |
| 220 * @param {!WebInspector.IndexedDBModel.ObjectStore} objectStore | 220 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore |
| 221 * @param {?WebInspector.IndexedDBModel.Index} index | 221 * @param {?Resources.IndexedDBModel.Index} index |
| 222 */ | 222 */ |
| 223 update(objectStore, index) { | 223 update(objectStore, index) { |
| 224 this._objectStore = objectStore; | 224 this._objectStore = objectStore; |
| 225 this._index = index; | 225 this._index = index; |
| 226 | 226 |
| 227 if (this._dataGrid) | 227 if (this._dataGrid) |
| 228 this._dataGrid.asWidget().detach(); | 228 this._dataGrid.asWidget().detach(); |
| 229 this._dataGrid = this._createDataGrid(); | 229 this._dataGrid = this._createDataGrid(); |
| 230 this._dataGrid.asWidget().show(this.element); | 230 this._dataGrid.asWidget().show(this.element); |
| 231 | 231 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 261 | 261 |
| 262 if (this._lastKey !== key || this._lastPageSize !== pageSize) { | 262 if (this._lastKey !== key || this._lastPageSize !== pageSize) { |
| 263 skipCount = 0; | 263 skipCount = 0; |
| 264 this._skipCount = 0; | 264 this._skipCount = 0; |
| 265 } | 265 } |
| 266 this._lastKey = key; | 266 this._lastKey = key; |
| 267 this._lastPageSize = pageSize; | 267 this._lastPageSize = pageSize; |
| 268 this._lastSkipCount = skipCount; | 268 this._lastSkipCount = skipCount; |
| 269 | 269 |
| 270 /** | 270 /** |
| 271 * @param {!Array.<!WebInspector.IndexedDBModel.Entry>} entries | 271 * @param {!Array.<!Resources.IndexedDBModel.Entry>} entries |
| 272 * @param {boolean} hasMore | 272 * @param {boolean} hasMore |
| 273 * @this {WebInspector.IDBDataView} | 273 * @this {Resources.IDBDataView} |
| 274 */ | 274 */ |
| 275 function callback(entries, hasMore) { | 275 function callback(entries, hasMore) { |
| 276 this._refreshButton.setEnabled(true); | 276 this._refreshButton.setEnabled(true); |
| 277 this.clear(); | 277 this.clear(); |
| 278 this._entries = entries; | 278 this._entries = entries; |
| 279 for (var i = 0; i < entries.length; ++i) { | 279 for (var i = 0; i < entries.length; ++i) { |
| 280 var data = {}; | 280 var data = {}; |
| 281 data['number'] = i + skipCount; | 281 data['number'] = i + skipCount; |
| 282 data['key'] = entries[i].key; | 282 data['key'] = entries[i].key; |
| 283 data['primaryKey'] = entries[i].primaryKey; | 283 data['primaryKey'] = entries[i].primaryKey; |
| 284 data['value'] = entries[i].value; | 284 data['value'] = entries[i].value; |
| 285 | 285 |
| 286 var node = new WebInspector.IDBDataGridNode(data); | 286 var node = new Resources.IDBDataGridNode(data); |
| 287 this._dataGrid.rootNode().appendChild(node); | 287 this._dataGrid.rootNode().appendChild(node); |
| 288 } | 288 } |
| 289 | 289 |
| 290 this._pageBackButton.setEnabled(!!skipCount); | 290 this._pageBackButton.setEnabled(!!skipCount); |
| 291 this._pageForwardButton.setEnabled(hasMore); | 291 this._pageForwardButton.setEnabled(hasMore); |
| 292 } | 292 } |
| 293 | 293 |
| 294 var idbKeyRange = key ? window.IDBKeyRange.lowerBound(key) : null; | 294 var idbKeyRange = key ? window.IDBKeyRange.lowerBound(key) : null; |
| 295 if (this._isIndex) | 295 if (this._isIndex) |
| 296 this._model.loadIndexData( | 296 this._model.loadIndexData( |
| 297 this._databaseId, this._objectStore.name, this._index.name, idbKeyRang
e, skipCount, pageSize, | 297 this._databaseId, this._objectStore.name, this._index.name, idbKeyRang
e, skipCount, pageSize, |
| 298 callback.bind(this)); | 298 callback.bind(this)); |
| 299 else | 299 else |
| 300 this._model.loadObjectStoreData( | 300 this._model.loadObjectStoreData( |
| 301 this._databaseId, this._objectStore.name, idbKeyRange, skipCount, page
Size, callback.bind(this)); | 301 this._databaseId, this._objectStore.name, idbKeyRange, skipCount, page
Size, callback.bind(this)); |
| 302 } | 302 } |
| 303 | 303 |
| 304 _refreshButtonClicked(event) { | 304 _refreshButtonClicked(event) { |
| 305 this._updateData(true); | 305 this._updateData(true); |
| 306 } | 306 } |
| 307 | 307 |
| 308 _clearButtonClicked(event) { | 308 _clearButtonClicked(event) { |
| 309 /** | 309 /** |
| 310 * @this {WebInspector.IDBDataView} | 310 * @this {Resources.IDBDataView} |
| 311 */ | 311 */ |
| 312 function cleared() { | 312 function cleared() { |
| 313 this._clearButton.setEnabled(true); | 313 this._clearButton.setEnabled(true); |
| 314 this._updateData(true); | 314 this._updateData(true); |
| 315 } | 315 } |
| 316 this._clearButton.setEnabled(false); | 316 this._clearButton.setEnabled(false); |
| 317 this._model.clearObjectStore(this._databaseId, this._objectStore.name, clear
ed.bind(this)); | 317 this._model.clearObjectStore(this._databaseId, this._objectStore.name, clear
ed.bind(this)); |
| 318 } | 318 } |
| 319 | 319 |
| 320 /** | 320 /** |
| 321 * @override | 321 * @override |
| 322 * @return {!Array.<!WebInspector.ToolbarItem>} | 322 * @return {!Array.<!UI.ToolbarItem>} |
| 323 */ | 323 */ |
| 324 syncToolbarItems() { | 324 syncToolbarItems() { |
| 325 return [this._refreshButton, this._clearButton]; | 325 return [this._refreshButton, this._clearButton]; |
| 326 } | 326 } |
| 327 | 327 |
| 328 clear() { | 328 clear() { |
| 329 this._dataGrid.rootNode().removeChildren(); | 329 this._dataGrid.rootNode().removeChildren(); |
| 330 this._entries = []; | 330 this._entries = []; |
| 331 } | 331 } |
| 332 }; | 332 }; |
| 333 | 333 |
| 334 /** | 334 /** |
| 335 * @unrestricted | 335 * @unrestricted |
| 336 */ | 336 */ |
| 337 WebInspector.IDBDataGridNode = class extends WebInspector.DataGridNode { | 337 Resources.IDBDataGridNode = class extends UI.DataGridNode { |
| 338 /** | 338 /** |
| 339 * @param {!Object.<string, *>} data | 339 * @param {!Object.<string, *>} data |
| 340 */ | 340 */ |
| 341 constructor(data) { | 341 constructor(data) { |
| 342 super(data, false); | 342 super(data, false); |
| 343 this.selectable = false; | 343 this.selectable = false; |
| 344 } | 344 } |
| 345 | 345 |
| 346 /** | 346 /** |
| 347 * @override | 347 * @override |
| 348 * @return {!Element} | 348 * @return {!Element} |
| 349 */ | 349 */ |
| 350 createCell(columnIdentifier) { | 350 createCell(columnIdentifier) { |
| 351 var cell = super.createCell(columnIdentifier); | 351 var cell = super.createCell(columnIdentifier); |
| 352 var value = /** @type {!WebInspector.RemoteObject} */ (this.data[columnIdent
ifier]); | 352 var value = /** @type {!SDK.RemoteObject} */ (this.data[columnIdentifier]); |
| 353 | 353 |
| 354 switch (columnIdentifier) { | 354 switch (columnIdentifier) { |
| 355 case 'value': | 355 case 'value': |
| 356 case 'key': | 356 case 'key': |
| 357 case 'primaryKey': | 357 case 'primaryKey': |
| 358 cell.removeChildren(); | 358 cell.removeChildren(); |
| 359 var objectElement = WebInspector.ObjectPropertiesSection.defaultObjectPr
esentation(value, undefined, true); | 359 var objectElement = Components.ObjectPropertiesSection.defaultObjectPres
entation(value, undefined, true); |
| 360 cell.appendChild(objectElement); | 360 cell.appendChild(objectElement); |
| 361 break; | 361 break; |
| 362 default: | 362 default: |
| 363 } | 363 } |
| 364 | 364 |
| 365 return cell; | 365 return cell; |
| 366 } | 366 } |
| 367 }; | 367 }; |
| OLD | NEW |