Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Add inspect store button to data pane in Ember Inspector #1163

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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