Set up routes, controllers, and template basics for the plugins page
This commit is contained in:
parent
dba9a25a13
commit
7d524ac341
|
@ -0,0 +1,5 @@
|
|||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend({
|
||||
isForbidden: false,
|
||||
});
|
|
@ -0,0 +1,40 @@
|
|||
import { inject as service } from '@ember/service';
|
||||
import { computed } from '@ember/object';
|
||||
import { alias, readOnly } from '@ember/object/computed';
|
||||
import Controller, { inject as controller } from '@ember/controller';
|
||||
import SortableFactory from 'nomad-ui/mixins/sortable-factory';
|
||||
|
||||
export default Controller.extend(SortableFactory([]), {
|
||||
userSettings: service(),
|
||||
pluginsController: controller('csi/plugins'),
|
||||
|
||||
isForbidden: alias('pluginsController.isForbidden'),
|
||||
|
||||
queryParams: {
|
||||
currentPage: 'page',
|
||||
sortProperty: 'sort',
|
||||
sortDescending: 'desc',
|
||||
},
|
||||
|
||||
currentPage: 1,
|
||||
pageSize: readOnly('userSettings.pageSize'),
|
||||
|
||||
sortProperty: 'id',
|
||||
sortDescending: false,
|
||||
|
||||
listToSort: alias('model'),
|
||||
sortedPlugins: alias('listSorted'),
|
||||
|
||||
// TODO: Remove once this page gets search capability
|
||||
resetPagination() {
|
||||
if (this.currentPage != null) {
|
||||
this.set('currentPage', 1);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
gotoPlugin(plugin) {
|
||||
this.transitionToRoute('csi.plugins.plugin', plugin.id);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
import { inject as service } from '@ember/service';
|
||||
import Route from '@ember/routing/route';
|
||||
import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
|
||||
import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
|
||||
|
||||
export default Route.extend(WithForbiddenState, {
|
||||
store: service(),
|
||||
|
||||
breadcrumbs: [
|
||||
{
|
||||
label: 'Storage',
|
||||
args: ['csi.index'],
|
||||
},
|
||||
],
|
||||
|
||||
model() {
|
||||
return this.store.query('plugin', { type: 'csi' }).catch(notifyForbidden(this));
|
||||
},
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
import Route from '@ember/routing/route';
|
||||
import { collect } from '@ember/object/computed';
|
||||
import { watchQuery } from 'nomad-ui/utils/properties/watch';
|
||||
import WithWatchers from 'nomad-ui/mixins/with-watchers';
|
||||
|
||||
export default Route.extend(WithWatchers, {
|
||||
startWatchers(controller) {
|
||||
controller.set('modelWatch', this.watch.perform({ type: 'csi' }));
|
||||
},
|
||||
|
||||
watch: watchQuery('plugin'),
|
||||
watchers: collect('watch'),
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
{{outlet}}
|
|
@ -0,0 +1,13 @@
|
|||
{{title "CSI Plugins"}}
|
||||
<div class="tabs is-subnav">
|
||||
<ul>
|
||||
<li data-test-tab="volumes">{{#link-to "csi.volumes.index" activeClass="is-active"}}Volumes{{/link-to}}</li>
|
||||
<li data-test-tab="plugins">{{#link-to "csi.plugins.index" activeClass="is-active"}}Plugins{{/link-to}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section class="section">
|
||||
{{#if isForbidden}}
|
||||
{{partial "partials/forbidden-message"}}
|
||||
{{else}}
|
||||
{{/if}}
|
||||
</section>
|
Loading…
Reference in New Issue