Skip to content

Commit

Permalink
[FEAT] Add inspect store button to data pane in Ember Inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
SYU15 committed Mar 31, 2020
1 parent 651046b commit db06951
Show file tree
Hide file tree
Showing 3 changed files with 22 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>
11 changes: 11 additions & 0 deletions tests/acceptance/data-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,5 +462,16 @@ module('Data Tab', function(outer) {
columns = findAll('[data-test-table-header-column]');
assert.dom(columns[columns.length - 1]).includesText('Content');
});

test('Can inspect store in data pane', async function(assert) {
await visit('/data/model-types');

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

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

0 comments on commit db06951

Please sign in to comment.