Mark pillar table rows as corrupt if init fails

This commit is contained in:
Tobias Johansson 2019-03-20 15:14:50 +01:00
parent 66e6ba1467
commit 6bae6a39df
2 changed files with 11 additions and 5 deletions

View File

@ -5,6 +5,7 @@ class RowBase {
constructor(underlyingObject) {
this.underlyingObject = underlyingObject;
this.isInitialized = false;
this.isCorrupt = false;
this.isSelected = false;
}
@ -14,7 +15,12 @@ class RowBase {
thenInit() {
return this._thenInitImpl()
.then(() => {
this.isInitialized = true
this.isInitialized = true;
})
.catch((err) => {
console.warn(err);
this.isCorrupt = true;
throw err;
})
}
@ -42,7 +48,9 @@ class RowBase {
*/
getRowClasses() {
return {
"is-busy": !this.isInitialized
"active": this.isSelected,
"is-busy": !this.isInitialized,
"is-corrupt": this.isCorrupt
}
}

View File

@ -26,9 +26,7 @@ Vue.component('pillar-table-row', {
},
computed: {
rowClasses() {
let classes = this.rowObject.getRowClasses()
classes['active'] = this.rowObject.isSelected;
return classes;
return this.rowObject.getRowClasses();
}
},
});