apim-developer-portal2
Version:
API management developer portal
23 lines (19 loc) • 807 B
text/typescript
import { ViewModelBinder } from "@paperbits/common/widgets";
import { ReportsViewModel } from "./reportsViewModel";
import { ReportsModel } from "../reportsModel";
import { Bag } from "@paperbits/common";
export class ReportsViewModelBinder implements ViewModelBinder<ReportsModel, ReportsViewModel> {
public async modelToViewModel(model: ReportsModel, viewModel?: ReportsViewModel, bindingContext?: Bag<any>): Promise<ReportsViewModel> {
if (!viewModel) {
viewModel = new ReportsViewModel();
}
viewModel["widgetBinding"] = {
displayName: "Reports",
model: model
};
return viewModel;
}
public canHandleModel(model: ReportsModel): boolean {
return model instanceof ReportsModel;
}
}