Skip to content

Commit

Permalink
[FEAT] Add inspect store button to data pane in Ember Inspector (embe…
Browse files Browse the repository at this point in the history
  • Loading branch information
SYU15 authored and patricklx committed Sep 19, 2022
1 parent 4a7d7eb commit 295f507
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/controllers/model-types.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Controller from '@ember/controller';
import { get, computed } from '@ember/object';
import { action, get, computed } from '@ember/object';
import { sort } from '@ember/object/computed';
import { inject as service } from '@ember/service';

Expand Down Expand Up @@ -48,9 +48,14 @@ export default Controller.extend({
return true;
}
});
})
});
}),

getStore: action(function() {
this.port.send('objectInspector:inspectByContainerLookup', {
name: 'service:store'
});
}),
});
/**
* Returns whether or not a given key has been set in storage.
* @param {*} storage
Expand Down
3 changes: 3 additions & 0 deletions app/templates/model-types-toolbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@
Order Models By Record Count
</label>
</div>
<button class="toolbar__radio js-filter" {{on "click" this.getStore}} data-test-inspect-store>
Inspect Store
</button>
</div>
16 changes: 16 additions & 0 deletions tests/acceptance/data-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ module('Data Tab', function(outer) {

assert.dom('.js-model-type').exists({ count: 2 });
});

test('Can inspect store in data pane', async function(assert) {
respondWith('data:getModelTypes', {
type: 'data:modelTypesAdded',
modelTypes: getModelTypes()
});

await visit('/data/model-types');

respondWith('objectInspector:inspectByContainerLookup', ({ name }) => {
assert.equal(name, 'service:store');
return false;
});

await click('[data-test-inspect-store]');
});
});

module('Records', function(inner) {
Expand Down

0 comments on commit 295f507

Please sign in to comment.