You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/docker/models/task.ts

39 lines
987 B

import { Task } from 'docker-types/generated/1.41';
import { DeepPick } from '@/types/deepPick';
export class TaskViewModel {
Id: NonNullable<Task['ID']>;
Created: NonNullable<Task['CreatedAt']>;
Updated: NonNullable<Task['UpdatedAt']>;
Slot: NonNullable<Task['Slot']>;
Spec?: Task['Spec'];
Status?: Task['Status'];
DesiredState: NonNullable<Task['DesiredState']>;
ServiceId: NonNullable<Task['ServiceID']>;
NodeId: NonNullable<Task['NodeID']>;
ContainerId: DeepPick<Task, 'Status.ContainerStatus.ContainerID'>;
constructor(data: Task) {
this.Id = data.ID || '';
this.Created = data.CreatedAt || '';
this.Updated = data.UpdatedAt || '';
this.Slot = data.Slot || 0;
this.Spec = data.Spec;
this.Status = data.Status;
this.DesiredState = data.DesiredState || 'pending';
this.ServiceId = data.ServiceID || '';
this.NodeId = data.NodeID || '';
this.ContainerId = data.Status?.ContainerStatus?.ContainerID || '';
}
}