mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-23 18:50:27 +00:00
Define TargetApplicationState in types and remove Application type
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
1d89174caf
commit
fea80c5205
@ -1,12 +0,0 @@
|
||||
import { ServiceComposeConfig } from '../compose/types/service';
|
||||
|
||||
export class Application {
|
||||
public appId: number;
|
||||
public commit: string;
|
||||
public name: string;
|
||||
public releaseId: number;
|
||||
public networks: Dictionary<any>;
|
||||
public volumes: Dictionary<any>;
|
||||
|
||||
public services: Dictionary<ServiceComposeConfig>;
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
import { ComposeNetworkConfig } from '../compose/types/network';
|
||||
import { ServiceComposeConfig } from '../compose/types/service';
|
||||
import { ComposeVolumeConfig } from '../compose/volume';
|
||||
|
||||
export interface DeviceApplicationState {
|
||||
local?: {
|
||||
config?: Dictionary<string>;
|
||||
@ -17,3 +21,41 @@ export interface DeviceApplicationState {
|
||||
dependent?: any;
|
||||
commit?: string;
|
||||
}
|
||||
|
||||
// TODO: Define this with io-ts so we can perform validation
|
||||
// on the target state from the api, local mode, and preload
|
||||
export interface TargetState {
|
||||
local: {
|
||||
name: string;
|
||||
config: Dictionary<string>;
|
||||
apps: {
|
||||
[appId: string]: {
|
||||
name: string;
|
||||
commit: string;
|
||||
releaseId: number;
|
||||
services: {
|
||||
[serviceId: string]: {
|
||||
labels: Dictionary<string>;
|
||||
imageId: number;
|
||||
serviceName: string;
|
||||
image: string;
|
||||
running: boolean;
|
||||
environment: Dictionary<string>;
|
||||
} & ServiceComposeConfig;
|
||||
};
|
||||
volumes: Dictionary<Partial<ComposeVolumeConfig>>;
|
||||
networks: Dictionary<Partial<ComposeNetworkConfig>>;
|
||||
};
|
||||
};
|
||||
};
|
||||
// TODO: Correctly type this once dependent devices are
|
||||
// actually properly supported
|
||||
dependent: Dictionary<any>;
|
||||
}
|
||||
|
||||
export type LocalTargetState = TargetState['local'];
|
||||
export type TargetApplications = LocalTargetState['apps'];
|
||||
export type TargetApplication = LocalTargetState['apps'][0];
|
||||
export type AppsJsonFormat = Omit<TargetState['local'], 'name'> & {
|
||||
pinDevice?: boolean;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user