2019-10-02 17:24:42 +00:00
|
|
|
import ngModule from '../../module';
|
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
export default class DataViewer {
|
2019-10-03 17:34:24 +00:00
|
|
|
get isReady() {
|
|
|
|
return this.status == 'ready';
|
2019-10-02 17:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get status() {
|
2019-10-03 17:34:24 +00:00
|
|
|
if (this.model)
|
|
|
|
return this.model.status;
|
|
|
|
|
|
|
|
if (this.isLoading)
|
2019-10-02 17:24:42 +00:00
|
|
|
return 'loading';
|
2019-10-03 17:34:24 +00:00
|
|
|
if (!this.data)
|
2019-10-02 17:24:42 +00:00
|
|
|
return 'clear';
|
2019-10-03 17:34:24 +00:00
|
|
|
if (this.data.length)
|
|
|
|
return 'ready';
|
|
|
|
else
|
|
|
|
return 'empty';
|
2019-10-02 17:24:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnDataViewer', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
transclude: true,
|
|
|
|
controller: DataViewer,
|
|
|
|
bindings: {
|
|
|
|
model: '<?',
|
|
|
|
data: '<?',
|
|
|
|
isLoading: '<?'
|
|
|
|
}
|
|
|
|
});
|