@allurereport/web-allure2
Version:
The static files for Allure Classic Report
46 lines (39 loc) • 1.27 kB
JavaScript
import { Model } from "backbone";
import TestResultTreeView from "@/components/testresult-tree/TestResultTreeView.js";
import TreeCollection from "@/data/tree/TreeCollection.js";
import AppLayout from "@/layouts/application/AppLayout.js";
import router from "@/router.js";
export default class TreeLayout extends AppLayout {
initialize({ url }) {
super.initialize();
this.tree = new TreeCollection([], { url });
this.routeState = new Model();
}
loadData() {
return this.tree.fetch();
}
getContentView() {
const { baseUrl, tabName, csvUrl } = this.options;
return new TestResultTreeView({
tree: this.tree,
routeState: this.routeState,
tabName,
baseUrl,
csvUrl,
});
}
onViewReady() {
const { testGroup, testResult, testResultTab } = this.options;
this.onRouteUpdate(testGroup, testResult, testResultTab);
}
onRouteUpdate(testGroup, testResult, testResultTab) {
this.routeState.set("treeNode", { testGroup, testResult });
this.routeState.set("testResultTab", testResultTab);
const attachment = router.getUrlParams().attachment;
if (attachment) {
this.routeState.set("attachment", attachment);
} else {
this.routeState.unset("attachment");
}
}
}