John Cowen f3d9565277
ui: Refactor KV and Lock Sessions following partitions update (#11666)
This commit uses all our new ways of doing things to Lock Sessions and their interactions with KV and Nodes. This is mostly around are new under-the-hood things, but also I took the opportunity to upgrade some of the CSS to reuse some of our CSS utils that have been made over the past few months (%csv-list and %horizontal-kv-list).

Also added (and worked on existing) documentation for Lock Session related components.
2021-12-01 11:33:33 +00:00

39 lines
988 B
JavaScript

import Component from '@ember/component';
import { set } from '@ember/object';
import { schedule } from '@ember/runloop';
import Slotted from 'block-slots';
import chart from './chart.xstate';
export default Component.extend(Slotted, {
tagName: '',
onchange: data => data,
init: function() {
this._super(...arguments);
this.chart = chart;
},
didReceiveAttrs: function() {
this._super(...arguments);
if (typeof this.items !== 'undefined') {
this.actions.change.apply(this, [this.items]);
}
},
didInsertElement: function() {
this._super(...arguments);
this.dispatch('LOAD');
},
actions: {
invalidate() {
this.dispatch('INVALIDATE');
schedule('afterRender', () => {
this.dispatch('LOAD');
});
},
isLoaded: function() {
return typeof this.items !== 'undefined' || typeof this.src === 'undefined';
},
change: function(data) {
set(this, 'data', this.onchange(data));
},
},
});