1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 00:09:40 +02:00

refactor(kube/apps): migrate integrated apps table to react [EE-4690] (#11025)

This commit is contained in:
Chaim Lev-Ari 2024-04-02 22:37:47 +03:00 committed by GitHub
parent 26bb028ace
commit 946166319f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 291 additions and 260 deletions

View file

@ -0,0 +1,123 @@
import { ServiceType } from '@/react/kubernetes/applications/CreateView/application-services/types';
import { AppType, DeploymentType } from '@/react/kubernetes/applications/types';
import { ConfigurationVolume } from './ConfigurationVolume';
import { PersistedFolder } from './PersistedFolder';
export class Application {
Id: string;
Name: string;
StackName: string;
StackId: string;
ApplicationKind: string;
ApplicationOwner: string;
ApplicationName: string;
Annotations: Record<string, string> = {};
ResourcePool: string;
Image: string;
CreationDate: 0;
Pods: [];
Containers: [];
Metadata: {
labels?: Record<string, string>;
annotations?: Record<string, string>;
};
Limits: {
Cpu?: number;
Memory?: number;
};
ServiceType?: ServiceType;
ServiceId: string;
ServiceName: string;
HeadlessServiceName: undefined; // only used for StatefulSet
LoadBalancerIPAddress: undefined; // only filled when bound service is LoadBalancer and state is available
PublishedPorts: [];
Volumes: [];
Env: [];
PersistedFolders: Array<PersistedFolder>;
ConfigurationVolumes: Array<ConfigurationVolume>;
DeploymentType?: DeploymentType;
DataAccessPolicy: 'Unknown';
ApplicationType?: AppType;
RunningPodsCount: 0;
TotalPodsCount: 0;
Yaml: string;
Note: string;
Raw: undefined; // only filled when inspecting app details / create / edit view (never filled in multiple-apps views)
AutoScaler: undefined; // only filled if the application has an HorizontalPodAutoScaler bound to it
Conditions: Array<{
lastTransitionTime: string;
lastUpdateTime: string;
message: string;
reason: string;
status: string;
type: string;
}> = [];
constructor() {
this.Id = '';
this.Name = '';
this.StackName = '';
this.StackId = '';
this.ApplicationKind = '';
this.ApplicationOwner = '';
this.ApplicationName = '';
this.ResourcePool = '';
this.Image = '';
this.CreationDate = 0;
this.Pods = [];
this.Containers = [];
this.Metadata = {};
this.Limits = {};
this.ServiceId = '';
this.ServiceName = '';
this.HeadlessServiceName = undefined;
this.LoadBalancerIPAddress = undefined;
this.PublishedPorts = [];
this.Volumes = [];
this.Env = [];
this.PersistedFolders = [];
this.ConfigurationVolumes = [];
this.DataAccessPolicy = 'Unknown';
this.RunningPodsCount = 0;
this.TotalPodsCount = 0;
this.Yaml = '';
this.Note = '';
this.Raw = undefined;
this.AutoScaler = undefined;
}
}

View file

@ -0,0 +1,9 @@
export class ConfigurationVolume {
fileMountPath: string = '';
rootMountPath: string = '';
configurationKey: string = '';
configurationName: string = '';
}

View file

@ -0,0 +1,7 @@
export class PersistedFolder {
MountPath: string = '';
persistentVolumeClaimName: string = '';
HostPath: string = '';
}

View file

@ -1,49 +1,8 @@
export * from './constants';
/**
* KubernetesApplication Model (Composite)
*/
const _KubernetesApplication = Object.freeze({
Id: '',
Name: '',
StackName: '',
StackId: '',
ApplicationKind: '',
ApplicationOwner: '',
ApplicationName: '',
ResourcePool: '',
Image: '',
CreationDate: 0,
Pods: [],
Containers: [],
Metadata: {},
Limits: {},
ServiceType: '',
ServiceId: '',
ServiceName: '',
HeadlessServiceName: undefined, // only used for StatefulSet
LoadBalancerIPAddress: undefined, // only filled when bound service is LoadBalancer and state is available
PublishedPorts: [],
Volumes: [],
Env: [],
PersistedFolders: [], // KubernetesApplicationPersistedFolder list
ConfigurationVolumes: [], // KubernetesApplicationConfigurationVolume list
DeploymentType: 'Unknown',
DataAccessPolicy: 'Unknown',
ApplicationType: 'Unknown',
RunningPodsCount: 0,
TotalPodsCount: 0,
Yaml: '',
Note: '',
Raw: undefined, // only filled when inspecting app details / create / edit view (never filled in multiple-apps views)
AutoScaler: undefined, // only filled if the application has an HorizontalPodAutoScaler bound to it
});
export class KubernetesApplication {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplication)));
}
}
export { Application as KubernetesApplication } from './Application';
export { ConfigurationVolume as KubernetesApplicationConfigurationVolume } from './ConfigurationVolume';
export { PersistedFolder as KubernetesApplicationPersistedFolder } from './PersistedFolder';
/**
* HelmApplication Model (Composite)
@ -64,37 +23,6 @@ export class HelmApplication {
}
}
/**
* KubernetesApplicationPersistedFolder Model
*/
const _KubernetesApplicationPersistedFolder = Object.freeze({
MountPath: '',
persistentVolumeClaimName: '',
HostPath: '',
});
export class KubernetesApplicationPersistedFolder {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationPersistedFolder)));
}
}
/**
* KubernetesApplicationConfigurationVolume Model
*/
const _KubernetesApplicationConfigurationVolume = Object.freeze({
fileMountPath: '',
rootMountPath: '',
configurationKey: '',
configurationName: '',
});
export class KubernetesApplicationConfigurationVolume {
constructor() {
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationConfigurationVolume)));
}
}
/**
* KubernetesApplicationPort Model
*/