open-nomad/ui/app/components/list-table.js
2023-04-10 15:36:59 +00:00

26 lines
681 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@ember/component';
import { computed } from '@ember/object';
import { computed as overridable } from 'ember-overridable-computed';
import { classNames, tagName } from '@ember-decorators/component';
import classic from 'ember-classic-decorator';
@classic
@tagName('table')
@classNames('table')
export default class ListTable extends Component {
@overridable(() => []) source;
// Plan for a future with metadata (e.g., isSelected)
@computed('source.{[],isFulfilled}')
get decoratedSource() {
return (this.source || []).map((row) => ({
model: row,
}));
}
}