import { DataHierarchy, DataHierarchyProvider } from '../../../libappsop/datahierarchy';
|
import { ListSOP } from '../../../libappsop/listsop';
|
import { PanelSOP } from '../../../libappsop/panelsop';
|
import { DialogDummy } from '../dialog.dummy';
|
|
export class PanelManageContents extends PanelSOP {
|
public static readonly title = 'Manage Contents';
|
|
public listManageContents = new ListManageContents();
|
public listManageContentsProduct = new ListManageContentsProduct();
|
|
public constructor() {
|
super('pnlManageContents');
|
}
|
}
|
|
export interface ListManageContentsColumn {
|
Name?: string;
|
}
|
|
export class ListManageContents extends ListSOP<DialogDummy, ListManageContentsColumn> {
|
public static readonly title = 'Manage Contents';
|
|
public constructor() {
|
super('lstManageContents', new DialogDummy());
|
|
// Set primary key column name(s), to display in error message when assert fails
|
this.rowPrimaryColumnNames = { Name: '' };
|
}
|
}
|
|
export interface ListManageContentsProductColumn {
|
Name?: string;
|
}
|
|
export class ListManageContentsProduct extends ListSOP<DialogDummy, ListManageContentsProductColumn> {
|
public static readonly title = 'Manage contents overview';
|
|
public constructor() {
|
super('lstListProducts', new DialogDummy());
|
|
// Set primary key column name(s), to display in error message when assert fails
|
this.rowPrimaryColumnNames = { Name: '' };
|
}
|
|
// Overrides ListSOP
|
public getHierarchy(hierarchyProvider: DataHierarchyProvider, name: DataHierarchy): [ListManageContentsProductColumn, ListManageContentsProductColumn[] | undefined] {
|
const [targetRowName, parentRowNames] = hierarchyProvider.getHierarchy(name);
|
|
const thisProduct: ListManageContentsProductColumn = { Name: targetRowName.Name };
|
const parents: ListManageContentsProductColumn[] = [];
|
for (const p of parentRowNames) {
|
parents.push({ Name: p.Name });
|
}
|
|
return [thisProduct, parents.length > 0 ? parents : undefined];
|
}
|
}
|
|
const listManageContentsProductContextMenuItems = {
|
Exclude: { ContextMenu: 'cmListProducts', Name: 'MenuExcludeProducts', Label: 'Exclude' },
|
};
|
|
export { listManageContentsProductContextMenuItems as ListManageContentsProductContextMenuItems };
|