If we are indexing or foldering then its going to be folder-like

...therefore add a trailing slash to the API call
This commit is contained in:
John Cowen 2018-07-09 15:52:22 +01:00
parent faf813fee2
commit 887d4e9dde
1 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import Route from '@ember/routing/route';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import { hash } from 'rsvp'; import { hash } from 'rsvp';
import { get } from '@ember/object'; import { get } from '@ember/object';
import isFolder from 'consul-ui/utils/isFolder';
import WithKvActions from 'consul-ui/mixins/kv/with-actions'; import WithKvActions from 'consul-ui/mixins/kv/with-actions';
export default Route.extend(WithKvActions, { export default Route.extend(WithKvActions, {
@ -13,7 +14,12 @@ export default Route.extend(WithKvActions, {
}, },
repo: service('kv'), repo: service('kv'),
model: function(params) { model: function(params) {
const key = params.key || '/'; let key = params.key || '/';
// we are index or folder, so if the key doesn't have a trailing slash
// add one to force a fake findBySlug
if (!isFolder(key)) {
key = key + '/';
}
const dc = this.modelFor('dc').dc.Name; const dc = this.modelFor('dc').dc.Name;
const repo = get(this, 'repo'); const repo = get(this, 'repo');
return hash({ return hash({