Mark pillar table rows as corrupt if init fails

This commit is contained in:
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) { constructor(underlyingObject) {
this.underlyingObject = underlyingObject; this.underlyingObject = underlyingObject;
this.isInitialized = false; this.isInitialized = false;
this.isCorrupt = false;
this.isSelected = false; this.isSelected = false;
} }
@@ -14,7 +15,12 @@ class RowBase {
thenInit() { thenInit() {
return this._thenInitImpl() return this._thenInitImpl()
.then(() => { .then(() => {
this.isInitialized = true this.isInitialized = true;
})
.catch((err) => {
console.warn(err);
this.isCorrupt = true;
throw err;
}) })
} }
@@ -42,7 +48,9 @@ class RowBase {
*/ */
getRowClasses() { getRowClasses() {
return { 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: { computed: {
rowClasses() { rowClasses() {
let classes = this.rowObject.getRowClasses() return this.rowObject.getRowClasses();
classes['active'] = this.rowObject.isSelected;
return classes;
} }
}, },
}); });