2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2019-07-01 20:35:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2022-06-04 00:34:42 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { action } from '@ember/object';
|
2019-07-01 20:35:18 +00:00
|
|
|
import { getOwner } from '@ember/application';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @module GeneratedItemList
|
|
|
|
* The `GeneratedItemList` component lists generated items related to mounts (e.g. groups, roles, users)
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
2022-06-04 00:34:42 +00:00
|
|
|
* <GeneratedItemList @model={{model}} @itemType={{itemType}} @paths={{this.paths}} @methodModel={{this.methodModel}}/>
|
2019-07-01 20:35:18 +00:00
|
|
|
* ```
|
|
|
|
*
|
2022-06-04 00:34:42 +00:00
|
|
|
* @param {class} model=null - The corresponding item model that is being configured.
|
|
|
|
* @param {string} itemType - The type of item displayed.
|
|
|
|
* @param {array} paths - Relevant to the link for the LinkTo element.
|
|
|
|
* @param {class} methodModel - Model for the particular method selected.
|
2019-07-01 20:35:18 +00:00
|
|
|
*/
|
|
|
|
|
2022-06-04 00:34:42 +00:00
|
|
|
export default class GeneratedItemList extends Component {
|
|
|
|
@service router;
|
|
|
|
@service store;
|
|
|
|
|
|
|
|
get model() {
|
|
|
|
return this.args.model || null;
|
|
|
|
}
|
|
|
|
get itemType() {
|
|
|
|
return this.args.itemType || null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
refreshItemList() {
|
2022-11-09 23:15:31 +00:00
|
|
|
const route = getOwner(this).lookup(`route:${this.router.currentRouteName}`);
|
2022-06-04 00:34:42 +00:00
|
|
|
this.store.clearAllDatasets();
|
|
|
|
route.refresh();
|
|
|
|
}
|
|
|
|
}
|