import {Tile} from "./tile"; export class ProductPreRequisites { archiveIds: object; id: number; name: string; ready: boolean; requiredProduct: Product; } export class ProductConfiguration { id: number; name: string; } export class ProductVersionJobSpec { name: string; queue: string; } export class ProductVersion { archiveIds: any; configurations: Array<ProductConfiguration>; id: number; jobSpecifications: any; // named Array<ProductVersionJobSpec>; notes: string; productEpoch: number; productId: number; productName: string; productType: number; status: string; versionNumber: number; } export class ProductType { label: string; id: number; name: string; image: boolean; constructor(name: string, id: number, label: string, image: boolean) { this.label = label; this.id = id; this.name = name; this.image = image; } } export class Product { category: string; completed: boolean; configurations: Array<ProductConfiguration>; epoch: number; extraInfoForJobName: string; fileNames: Array<string>; futureProductId: number; futureProductName: string; id: number; latestProductVersion: object; minitiles: Array<Tile>; name: string; notes: string; preRequisites: Array<ProductPreRequisites>; status: string; tags: Array<string>; typeId: number; typeName: string; phaseCenterRA: string; phaseCenterDec: string; imageSizeX: string; imageSizeY: string; versions: Array<ProductVersion>; fluxCalibrators: Array<any>; fluxPosition: string; lstEnd: number; lstStart: number; optId: number; phaseCalibrators: Array<any>; polCalibrators: Array<any>; submitted: string; static TYPES = [ new ProductType('schedblock', 11, 'Schedblocks', false), new ProductType('calibration', 1, 'Calibration', false), new ProductType('quicklook', 4, 'Quick Look Images', true), // new ProductType('image', 1, '', false), // new ProductType('cube', 2, '', false), new ProductType('se_calibration', 14, 'SE Calibration', false), new ProductType('se_cont', 17, 'SE Continuum', true), new ProductType('se_coarse_cube_image', 18, 'SE Coarse Cube', true), new ProductType('se_coarse_plane_image', 19, 'SE Coarse Plane', true), new ProductType('se_coarse_plane_I_image', 22, 'SE Coarse Plane I', true), new ProductType('se_coarse_plane_Q_image', 23, 'SE Coarse Plane Q', true), new ProductType('se_coarse_plane_U_image', 24, 'SE Coarse Plane U', true) ]; static getTypeFromName(typeName: string): ProductType { typeName = typeName === 'rawdata' ? 'schedblock' : typeName; for (const type of this.TYPES) { if (type.name === typeName) { return type; } } } static getTypeNameFromId(typeId: number): string { for (const type of this.TYPES) { if (type.id === typeId) { return type.name; } } } static getIdFromTypeName(typeName: string): number { for (const type of this.TYPES) { if (type.name === typeName) { return type.id; } } } static SORT_COLUMNS = ['id', 'name', 'status']; }