@alauda-fe/workload-util-shared 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/esm2022/alauda-fe-workload-util-shared.mjs +5 -0
  2. package/esm2022/index.mjs +6 -0
  3. package/esm2022/lib/directives/index.mjs +3 -0
  4. package/esm2022/lib/directives/oam-resource-disabled-container.directive.mjs +53 -0
  5. package/esm2022/lib/directives/sync-control.directive.mjs +52 -0
  6. package/esm2022/lib/pipes/index.mjs +4 -0
  7. package/esm2022/lib/pipes/is-oam-resource.pipe.mjs +17 -0
  8. package/esm2022/lib/pipes/range.pipe.mjs +17 -0
  9. package/esm2022/lib/pipes/short-num.pipe.mjs +15 -0
  10. package/esm2022/lib/services/cluster-api.service.mjs +93 -0
  11. package/esm2022/lib/services/feature-gate.service.mjs +50 -0
  12. package/esm2022/lib/services/index.mjs +6 -0
  13. package/esm2022/lib/services/pod-util.service.mjs +70 -0
  14. package/esm2022/lib/services/resource-quota.service.mjs +116 -0
  15. package/esm2022/lib/services/terminal.service.mjs +46 -0
  16. package/esm2022/lib/typings/account.mjs +2 -0
  17. package/esm2022/lib/typings/backend-api.mjs +7 -0
  18. package/esm2022/lib/typings/batch-action.type.mjs +2 -0
  19. package/esm2022/lib/typings/form.mjs +2 -0
  20. package/esm2022/lib/typings/helpers.mjs +14 -0
  21. package/esm2022/lib/typings/index.mjs +10 -0
  22. package/esm2022/lib/typings/k8s-form-model.mjs +12 -0
  23. package/esm2022/lib/typings/k8s-resource-definitions/acp-resource-definition.mjs +258 -0
  24. package/esm2022/lib/typings/k8s-resource-definitions/alu-resource-definition.mjs +281 -0
  25. package/esm2022/lib/typings/k8s-resource-definitions/index.mjs +142 -0
  26. package/esm2022/lib/typings/k8s.mjs +143 -0
  27. package/esm2022/lib/typings/status.mjs +269 -0
  28. package/esm2022/lib/utils/code-editor-config.mjs +2 -0
  29. package/esm2022/lib/utils/constants.mjs +61 -0
  30. package/esm2022/lib/utils/crd.mjs +36 -0
  31. package/esm2022/lib/utils/format-number.mjs +227 -0
  32. package/esm2022/lib/utils/helpers.mjs +27 -0
  33. package/esm2022/lib/utils/index.mjs +14 -0
  34. package/esm2022/lib/utils/k8s-util.service.mjs +28 -0
  35. package/esm2022/lib/utils/patterns.mjs +140 -0
  36. package/esm2022/lib/utils/pod-util.mjs +75 -0
  37. package/esm2022/lib/utils/resource-status.mjs +86 -0
  38. package/esm2022/lib/utils/resources-config-util.mjs +28 -0
  39. package/esm2022/lib/utils/status.mjs +84 -0
  40. package/esm2022/lib/utils/validator.mjs +11 -0
  41. package/esm2022/lib/utils/workspace.mjs +25 -0
  42. package/index.d.ts +5 -0
  43. package/lib/directives/index.d.ts +2 -0
  44. package/lib/directives/oam-resource-disabled-container.directive.d.ts +17 -0
  45. package/lib/directives/sync-control.directive.d.ts +14 -0
  46. package/lib/pipes/index.d.ts +3 -0
  47. package/lib/pipes/is-oam-resource.pipe.d.ts +9 -0
  48. package/lib/pipes/range.pipe.d.ts +7 -0
  49. package/lib/pipes/short-num.pipe.d.ts +7 -0
  50. package/lib/services/cluster-api.service.d.ts +38 -0
  51. package/lib/services/feature-gate.service.d.ts +38 -0
  52. package/lib/services/index.d.ts +5 -0
  53. package/lib/services/pod-util.service.d.ts +18 -0
  54. package/lib/services/resource-quota.service.d.ts +25 -0
  55. package/lib/services/terminal.service.d.ts +15 -0
  56. package/lib/typings/account.d.ts +17 -0
  57. package/lib/typings/backend-api.d.ts +220 -0
  58. package/lib/typings/batch-action.type.d.ts +35 -0
  59. package/lib/typings/form.d.ts +10 -0
  60. package/lib/typings/helpers.d.ts +45 -0
  61. package/lib/typings/index.d.ts +9 -0
  62. package/lib/typings/k8s-form-model.d.ts +128 -0
  63. package/lib/typings/k8s-resource-definitions/acp-resource-definition.d.ts +242 -0
  64. package/lib/typings/k8s-resource-definitions/alu-resource-definition.d.ts +269 -0
  65. package/lib/typings/k8s-resource-definitions/index.d.ts +1911 -0
  66. package/lib/typings/k8s.d.ts +1147 -0
  67. package/lib/typings/status.d.ts +252 -0
  68. package/lib/utils/code-editor-config.d.ts +1 -0
  69. package/lib/utils/constants.d.ts +57 -0
  70. package/lib/utils/crd.d.ts +21 -0
  71. package/lib/utils/format-number.d.ts +11 -0
  72. package/lib/utils/helpers.d.ts +13 -0
  73. package/lib/utils/index.d.ts +13 -0
  74. package/lib/utils/k8s-util.service.d.ts +8 -0
  75. package/lib/utils/patterns.d.ts +132 -0
  76. package/lib/utils/pod-util.d.ts +19 -0
  77. package/lib/utils/resource-status.d.ts +8 -0
  78. package/lib/utils/resources-config-util.d.ts +22 -0
  79. package/lib/utils/status.d.ts +3 -0
  80. package/lib/utils/validator.d.ts +4 -0
  81. package/lib/utils/workspace.d.ts +14 -0
  82. package/package.json +36 -0
@@ -0,0 +1,252 @@
1
+ import { GenericStatusColor, GenericStatusIcon } from '@alauda-fe/common';
2
+ export declare enum ResourceStatus {
3
+ Failed = "Failed",
4
+ Succeeded = "Succeeded",
5
+ Running = "Running",
6
+ Pending = "Pending",
7
+ Unknown = "Unknown"
8
+ }
9
+ export declare enum JobStatusEnum {
10
+ EXECUTING = "executing",
11
+ EXECUTE_SUCCEEDED = "execute_succeeded",
12
+ EXECUTE_FAILED = "execute_failed",
13
+ UNKNOWN = "unknown"
14
+ }
15
+ export declare const JobStatusColorMapper: {
16
+ executing: GenericStatusColor;
17
+ execute_succeeded: GenericStatusColor;
18
+ execute_failed: GenericStatusColor;
19
+ unknown: GenericStatusColor;
20
+ };
21
+ export declare const JobStatusIconMapper: {
22
+ executing: GenericStatusIcon;
23
+ execute_succeeded: GenericStatusIcon;
24
+ execute_failed: GenericStatusIcon;
25
+ unknown: GenericStatusIcon;
26
+ };
27
+ export declare enum WorkloadStatusEnum {
28
+ running = "running",
29
+ stopped = "stopped",
30
+ pending = "pending",
31
+ killed = "killed"
32
+ }
33
+ export declare const WorkloadStatusColorMapper: {
34
+ running: GenericStatusColor;
35
+ pending: GenericStatusColor;
36
+ stopped: GenericStatusColor;
37
+ killed: GenericStatusColor;
38
+ };
39
+ export declare const WorkloadStatusIconMapper: {
40
+ running: GenericStatusIcon;
41
+ pending: GenericStatusIcon;
42
+ stopped: GenericStatusIcon;
43
+ killed: GenericStatusIcon;
44
+ };
45
+ export declare enum ApplicationStatusEnum {
46
+ RUNNING = "running",
47
+ PARTIAL_RUNNING = "partial_running",
48
+ STOPPED = "stopped",
49
+ PENDING = "pending",
50
+ FAILED = "failed",
51
+ NO_WORKLOAD = "no_workload",
52
+ UNKNOWN = "unknown"
53
+ }
54
+ export declare enum OamAppOriginalStatusEnum {
55
+ Pending = "Pending",
56
+ PartialRunning = "PartialRunning",
57
+ Running = "Running",
58
+ Stopped = "Stopped",
59
+ Empty = "Empty",
60
+ Failed = "Failed",
61
+ Unknown = "Unknown",
62
+ Abnormal = "abnormal"
63
+ }
64
+ export declare const ApplicationStatusColorMapper: {
65
+ running: GenericStatusColor;
66
+ partial_running: GenericStatusColor;
67
+ stopped: GenericStatusColor;
68
+ pending: GenericStatusColor;
69
+ failed: GenericStatusColor;
70
+ no_workload: GenericStatusColor;
71
+ unknown: GenericStatusColor;
72
+ };
73
+ export declare const ApplicationStatusIconMapper: {
74
+ running: GenericStatusIcon;
75
+ partial_running: GenericStatusIcon;
76
+ stopped: GenericStatusIcon;
77
+ pending: GenericStatusIcon;
78
+ failed: GenericStatusIcon;
79
+ no_workload: GenericStatusIcon;
80
+ unknown: GenericStatusIcon;
81
+ };
82
+ export declare const OamAppStatusColorMapper: {
83
+ Running: GenericStatusColor;
84
+ PartialRunning: GenericStatusColor;
85
+ Stopped: GenericStatusColor;
86
+ Pending: GenericStatusColor;
87
+ abnormal: GenericStatusColor;
88
+ Empty: GenericStatusColor;
89
+ Unknown: GenericStatusColor;
90
+ };
91
+ export declare const OamAppStatusIconMapper: {
92
+ Running: GenericStatusIcon;
93
+ PartialRunning: GenericStatusIcon;
94
+ Stopped: GenericStatusIcon;
95
+ Pending: GenericStatusIcon;
96
+ abnormal: GenericStatusIcon;
97
+ Empty: GenericStatusIcon;
98
+ Unknown: GenericStatusIcon;
99
+ };
100
+ export declare enum HelmRequestStatusEnum {
101
+ DEPLOY_SUCCEEDED = "deploy_succeeded",
102
+ DEPLOY_FAILED = "deploy_failed",
103
+ DEPLOYING = "deploying"
104
+ }
105
+ export declare const HelmRequestStatusColorMapper: {
106
+ deploy_succeeded: GenericStatusColor;
107
+ deploy_failed: GenericStatusColor;
108
+ deploying: GenericStatusColor;
109
+ };
110
+ export declare const HelmRequestStatusIconMapper: {
111
+ deploy_succeeded: GenericStatusIcon;
112
+ deploy_failed: GenericStatusIcon;
113
+ deploying: GenericStatusIcon;
114
+ };
115
+ export declare enum TraceJobStatusEnum {
116
+ SUCCESS = "Success",
117
+ FAILED = "Failed",
118
+ RUNNING = "Running"
119
+ }
120
+ export declare const TraceJobStatusColorMapper: {
121
+ Success: GenericStatusColor;
122
+ Failed: GenericStatusColor;
123
+ Running: GenericStatusColor;
124
+ };
125
+ export declare const TraceJobStatusIconMapper: {
126
+ Success: GenericStatusIcon;
127
+ Failed: GenericStatusIcon;
128
+ Running: GenericStatusIcon;
129
+ };
130
+ export declare enum CephFileSystemStatusEnum {
131
+ RUNNING = "Running",
132
+ DEPLOYING = "Deploying"
133
+ }
134
+ export declare const CephFileSystemStatusColorMapper: {
135
+ Running: GenericStatusColor;
136
+ Deploying: GenericStatusColor;
137
+ };
138
+ export declare const CephFileSystemIconMapper: {
139
+ Running: GenericStatusIcon;
140
+ Deploying: GenericStatusIcon;
141
+ };
142
+ export declare enum CanaryReleaseStatusEnum {
143
+ ENABLED = "enabled",
144
+ NOT_ENABLED = "not_enabled",
145
+ INITIALIZING = "canary_initializing",
146
+ INITIALIZING_FAILED = "canary_initializing_failed",
147
+ STOPPING = "canary_stopping",
148
+ PENDING = "canary_pending",
149
+ RELEASING = "releasing"
150
+ }
151
+ export declare const CanaryReleaseStatusColorMapper: {
152
+ enabled: GenericStatusColor;
153
+ not_enabled: GenericStatusColor;
154
+ canary_initializing: GenericStatusColor;
155
+ canary_initializing_failed: GenericStatusColor;
156
+ canary_stopping: GenericStatusColor;
157
+ canary_pending: GenericStatusColor;
158
+ releasing: GenericStatusColor;
159
+ };
160
+ export declare const CanaryReleaseIconMapper: {
161
+ enabled: GenericStatusIcon;
162
+ not_enabled: GenericStatusIcon;
163
+ canary_initializing: GenericStatusIcon;
164
+ canary_initializing_failed: GenericStatusIcon;
165
+ canary_stopping: GenericStatusIcon;
166
+ canary_pending: GenericStatusIcon;
167
+ releasing: GenericStatusIcon;
168
+ };
169
+ export declare enum ReleaseStatusEnum {
170
+ RELEASE_SUCCEEDED = "release_succeeded",
171
+ RELEASE_FAILED = "release_failed",
172
+ READY_RELEASE = "ready_release",
173
+ PENDING = "canary_pending",
174
+ RELEASING = "releasing"
175
+ }
176
+ export declare const ReleaseStatusColorMapper: {
177
+ release_succeeded: GenericStatusColor;
178
+ release_failed: GenericStatusColor;
179
+ ready_release: GenericStatusColor;
180
+ canary_pending: GenericStatusColor;
181
+ releasing: GenericStatusColor;
182
+ };
183
+ export declare const ReleaseIconMapper: {
184
+ release_succeeded: GenericStatusIcon;
185
+ release_failed: GenericStatusIcon;
186
+ ready_release: GenericStatusIcon;
187
+ canary_pending: GenericStatusIcon;
188
+ releasing: GenericStatusIcon;
189
+ };
190
+ export declare enum ChartUploadStatusEnum {
191
+ UPLOAD_SUCCEEDED = "upload_succeeded",
192
+ UPLOAD_FAILED = "upload_failed",
193
+ UPLOADING = "uploading"
194
+ }
195
+ export declare const ChartUploadStatusColorMapper: {
196
+ upload_succeeded: GenericStatusColor;
197
+ upload_failed: GenericStatusColor;
198
+ uploading: GenericStatusColor;
199
+ };
200
+ export declare const ChartUploadStatusIconMapper: {
201
+ upload_succeeded: GenericStatusIcon;
202
+ upload_failed: GenericStatusIcon;
203
+ uploading: GenericStatusIcon;
204
+ };
205
+ export declare enum ProvisionerStatus {
206
+ DEPLOY_SUCCEEDED = "deploy_succeeded",
207
+ DEPLOY_FAILED = "deploy_failed",
208
+ DEPLOYING = "deploying",
209
+ UN_DEPLOYED = "undeployed"
210
+ }
211
+ export declare enum BridgeNetworkStatusEnum {
212
+ AVAILABLE = "available",
213
+ ERROR = "error"
214
+ }
215
+ export declare const BridgeNetworkStatusColorMapper: {
216
+ available: GenericStatusColor;
217
+ error: GenericStatusColor;
218
+ };
219
+ export declare const BridgeNetworkStatusIconMapper: {
220
+ available: GenericStatusIcon;
221
+ error: GenericStatusIcon;
222
+ };
223
+ export declare enum TopolvmClusterNodeStatusEnum {
224
+ READY = "ready",
225
+ FAILURE = "malfunction",
226
+ UNKNOWN = "unknown",
227
+ LOADING = "loading"
228
+ }
229
+ export declare const TopolvmClusterNodeStatusColorMapper: {
230
+ ready: GenericStatusColor;
231
+ malfunction: GenericStatusColor;
232
+ unknown: GenericStatusColor;
233
+ loading: GenericStatusColor;
234
+ };
235
+ export declare const TopolvmClusterNodeStatusIconMapper: {
236
+ ready: GenericStatusIcon;
237
+ malfunction: GenericStatusIcon;
238
+ unknown: GenericStatusIcon;
239
+ loading: GenericStatusIcon;
240
+ };
241
+ export declare enum TopolvmClusterStorageDeviceClassStatusEnum {
242
+ AVAILABLE = "available",
243
+ NOT_AVAILABLE = "not_available"
244
+ }
245
+ export declare const TopolvmClusterDeviceClassStatusColorMapper: {
246
+ available: GenericStatusColor;
247
+ not_available: GenericStatusColor;
248
+ };
249
+ export declare const TopolvmClusterDeviceClassStatusIconMapper: {
250
+ available: GenericStatusIcon;
251
+ not_available: GenericStatusIcon;
252
+ };
@@ -0,0 +1 @@
1
+ export { commonOptions, createActions, IEditorConstructionOptions, readonlyOptions, updateActions, viewActions, yamlReadOptions, yamlWriteOptions, } from '@alauda-fe/common';
@@ -0,0 +1,57 @@
1
+ import { StringMap } from '@alauda-fe/common';
2
+ export declare const RESOURCE_ROUTE_MAPPER: StringMap;
3
+ export declare const STANDALONE_NG_MODEL: {
4
+ standalone: boolean;
5
+ };
6
+ export declare const PROMQL_EXPORT_EXTRA: {
7
+ icon: string;
8
+ title: {
9
+ zh: string;
10
+ en: string;
11
+ };
12
+ type: string;
13
+ }[];
14
+ export declare const ASSIGN_ALL = "ALL_ALL";
15
+ export declare const DEFAULT = "default";
16
+ export declare const TRUE = "true";
17
+ export declare const FALSE = "false";
18
+ export declare const TYPE = "type";
19
+ export declare const ACTION = "action";
20
+ export declare const KIND = "kind";
21
+ export declare const STATUS = "status";
22
+ export declare const ADDED_TIME = "added_time";
23
+ export declare const CREATED_AT = "created_at";
24
+ export declare const APP_MARKET = "app-market";
25
+ export declare const ALL = "ALL";
26
+ export declare const DOMAIN = "domain";
27
+ export declare const PORT = "port";
28
+ export declare const WEIGHT = "weight";
29
+ export declare const OPERATORS_NAMESPACE = "operators";
30
+ export declare const OCP_OPERATORS_NAMESPACE = "openshift-operators";
31
+ export declare const CRON_RULE_DOC_PATH = "cp-faq/11crontab/";
32
+ export declare const ACP_SAFEMODE = "acp-safemode";
33
+ export declare const S2I_GIT = "s2i-git";
34
+ export declare const WORKLOAD_TYPES: readonly ["Deployment", "DaemonSet", "StatefulSet"];
35
+ export declare const BASE_CLUSTER_ARCH = "amd64";
36
+ export declare const HARDWARE_ARCHITECTURE_MAPPER: {
37
+ amd64: string;
38
+ arm64: string;
39
+ };
40
+ export type HardwareArchitecture = keyof typeof HARDWARE_ARCHITECTURE_MAPPER;
41
+ export declare const SPECIAL_SYMBOL: unique symbol;
42
+ export type SpecialSymbol = typeof SPECIAL_SYMBOL;
43
+ /**
44
+ * system 不对外暴露
45
+ *
46
+ * reference: http://confluence.alauda.cn/pages/viewpage.action?pageId=81426797
47
+ */
48
+ export declare const OPERATOR_CATALOG_MAPPER: {
49
+ PLATFORM: string;
50
+ SYSTEM: string;
51
+ };
52
+ export declare const V1BETA1 = "v1beta1";
53
+ export declare const MAX_PORT = 65535;
54
+ export declare enum CRD_SCOPE {
55
+ NAMESPACED = "Namespaced",
56
+ CLUSTER = "Cluster"
57
+ }
@@ -0,0 +1,21 @@
1
+ import { CustomResourceDefinition, CustomResourceDefinitionVersion, KubernetesResource, TranslateService } from '@alauda-fe/common';
2
+ export declare const getCRDVersionList: (crd: CustomResourceDefinition) => CustomResourceDefinitionVersion[];
3
+ export declare const getCRDScopeDisplay: (crd: CustomResourceDefinition) => "namespace" | "cluster";
4
+ export declare const getStorageCRDVersion: (crd: CustomResourceDefinition) => CustomResourceDefinitionVersion;
5
+ export declare const getStorageCrdOpenApiSchema: (crd: CustomResourceDefinition) => import("@alauda-fe/common").OpenAPIV3SchemaObject;
6
+ export declare const isCrdNamespaceScoped: (crd: CustomResourceDefinition) => boolean;
7
+ export declare const isNotCrdNamespaceScoped: (crd: CustomResourceDefinition) => boolean;
8
+ export declare const getCRDVersionDesc: (crd: CustomResourceDefinition, translate: TranslateService, _locale?: string) => string;
9
+ export declare const getCRDefinitionType: (crd: CustomResourceDefinition) => {
10
+ apiGroup: string;
11
+ type: string;
12
+ apiVersion: string;
13
+ };
14
+ export declare const encodeCRPathSuffix: (cr: KubernetesResource) => string;
15
+ export declare const decodeCRPathSuffix: (crPath?: string) => {
16
+ name: string;
17
+ namespace: string;
18
+ };
19
+ export declare const getCrTypeByCrd: (crdName: string) => string;
20
+ export declare const getVersionSchemaFromCrd: (version: CustomResourceDefinitionVersion) => import("@alauda-fe/common").OpenAPIV3SchemaObject;
21
+ export declare const getCrdSpecKind: (crd: CustomResourceDefinition) => string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @ngModule CommonModule
3
+ *
4
+ * Formats a number as text. Group sizing and separator and other locale-specific
5
+ * configurations are based on the locale.
6
+ *
7
+ * Where:
8
+ * - `value` is a number.
9
+ * - `digitInfo` See {@link DecimalPipe} for more details.
10
+ */
11
+ export declare function formatNumber(value: number, digitsInfo?: number[]): string;
@@ -0,0 +1,13 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ /**
3
+ *
4
+ * @param source 源复制对象
5
+ * @param other 待合并对象
6
+ * @returns 将待合并对象中 value 为真值的 key-value 合并到 source 中返回新对象
7
+ */
8
+ export declare function mergeIfValueTruthy<T, K>(source: T, other: K): T | (T & K);
9
+ export declare function getRootCloudAnnotationAppLink(annotationKey: string): string;
10
+ export declare function keyValueFormTableRequiredValidatorFn(control: AbstractControl): {
11
+ required: boolean;
12
+ };
13
+ export declare const placeObjectValues: (condition: boolean, value: Record<string, unknown>) => Record<string, unknown>;
@@ -0,0 +1,13 @@
1
+ export * from './code-editor-config';
2
+ export * from './constants';
3
+ export * from './crd';
4
+ export * from './format-number';
5
+ export * from './helpers';
6
+ export * from './k8s-util.service';
7
+ export * from './patterns';
8
+ export * from './pod-util';
9
+ export * from './resource-status';
10
+ export * from './resources-config-util';
11
+ export * from './status';
12
+ export * from './validator';
13
+ export * from './workspace';
@@ -0,0 +1,8 @@
1
+ import { KubernetesResource, K8sSharedUtilService, ResourceType } from '@alauda-fe/common';
2
+ import * as i0 from "@angular/core";
3
+ export declare class K8sUtilService<R extends string = ResourceType> extends K8sSharedUtilService<R> {
4
+ isGrayRelease<T extends KubernetesResource>(resource: T): boolean;
5
+ getReadonlyPodAnnotationKeys(): string[];
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<K8sUtilService<any>, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<K8sUtilService<any>>;
8
+ }
@@ -0,0 +1,132 @@
1
+ export declare const K8S_RESOURCE_NAME_BASE: {
2
+ pattern: RegExp;
3
+ tip: string;
4
+ };
5
+ export declare const LOOSE_K8S_RESOURCE_NAME_BASE: {
6
+ pattern: RegExp;
7
+ tip: string;
8
+ };
9
+ export declare const K8S_CONFIGMAP_KEY: {
10
+ pattern: RegExp;
11
+ tip: string;
12
+ };
13
+ export declare const K8S_ENV_VARIABLE_NAME: {
14
+ pattern: RegExp;
15
+ tip: string;
16
+ };
17
+ export declare const INT_PATTERN: {
18
+ pattern: RegExp;
19
+ tip: string;
20
+ };
21
+ export declare const POSITIVE_INT_PATTERN: {
22
+ pattern: RegExp;
23
+ tip: string;
24
+ };
25
+ export declare const POSITIVE_INT_32_PATTERN: {
26
+ pattern: RegExp;
27
+ tip: string;
28
+ };
29
+ export declare const POSITIVE_NUMBER_PATTERN: {
30
+ pattern: RegExp;
31
+ tip: string;
32
+ };
33
+ export declare const NATURAL_NUMBER_PATTERN: {
34
+ pattern: RegExp;
35
+ tip: string;
36
+ };
37
+ export declare const AUTO_SCALER_COOL_TIME_PATTERN: {
38
+ pattern: RegExp;
39
+ tip: string;
40
+ error: string;
41
+ };
42
+ export declare const REGISTRY_PATH: {
43
+ pattern: RegExp;
44
+ tip: string;
45
+ };
46
+ export declare const INGRESS_PATH_PATTERN: {
47
+ pattern: RegExp;
48
+ tip: string;
49
+ };
50
+ export declare const IP_ADDRESS_PATTERN: {
51
+ pattern: RegExp;
52
+ tip: string;
53
+ };
54
+ export declare const IP_V6_ADDRESS_PATTERN: {
55
+ pattern: RegExp;
56
+ };
57
+ export declare const IP_V4_OR_V6_PATTERN: {
58
+ pattern: RegExp;
59
+ };
60
+ export declare const IP_ADDRESS_PORT_PATTERN: {
61
+ pattern: RegExp;
62
+ tip: string;
63
+ };
64
+ export declare const TCP_ADDRESS_PATTERN: {
65
+ pattern: RegExp;
66
+ tip: string;
67
+ };
68
+ export declare const CIDR_IP_PATTERN: {
69
+ pattern: RegExp;
70
+ };
71
+ export declare const CIDR_FULL_PATTEN: {
72
+ pattern: RegExp;
73
+ tip: string;
74
+ };
75
+ export declare const CIDR_PATTERN: {
76
+ pattern: RegExp;
77
+ tip: string;
78
+ };
79
+ export declare const RESERVED_IP_PATTERN: {
80
+ pattern: RegExp;
81
+ };
82
+ export declare const RESERVED_IP_SEGMENT_PATTERN: {
83
+ pattern: RegExp;
84
+ };
85
+ export declare const CUSTOM_ALARM_NAME_BASE: {
86
+ pattern: RegExp;
87
+ tip: string;
88
+ };
89
+ export declare const ALARM_LABEL_KEY_NAME_PATTERN: {
90
+ pattern: RegExp;
91
+ tip: string;
92
+ };
93
+ export declare const ALARM_THRESHOLD_PATTERN: {
94
+ pattern: RegExp;
95
+ tip: string;
96
+ };
97
+ export declare const ALARM_METRIC_PATTERN: {
98
+ pattern: RegExp;
99
+ tip: string;
100
+ };
101
+ export declare const EMAIL_PATTERN: {
102
+ pattern: RegExp;
103
+ tip: string;
104
+ };
105
+ export declare const PHONE_PATTERN: {
106
+ pattern: RegExp;
107
+ tip: string;
108
+ };
109
+ export declare const PUBLIC_KEY_PATTERN: {
110
+ pattern: RegExp;
111
+ placeholder: string;
112
+ };
113
+ export declare const PRIVATE_KEY_PATTERN: {
114
+ pattern: RegExp;
115
+ placeholder: string;
116
+ };
117
+ export declare const STRONG_PASSWORD_PATTERN: {
118
+ pattern: RegExp;
119
+ tip: string;
120
+ };
121
+ export declare const POSITIVE_PERCENTAGE_PATTERN: {
122
+ pattern: RegExp;
123
+ tip: string;
124
+ };
125
+ export declare const CUSTOM_INDICATOR_PATTERN: {
126
+ pattern: RegExp;
127
+ tip: string;
128
+ };
129
+ export declare const PATCH_PATH_PATTERN: {
130
+ pattern: RegExp;
131
+ tip: string;
132
+ };
@@ -0,0 +1,19 @@
1
+ import { Container, Pod, ResourceRequirements } from '@alauda-fe/common';
2
+ /**
3
+ * @see https://stupefied-goodall-e282f7.netlify.app/contributors/design-proposals/node/container-init/
4
+ * @param pod pod resource
5
+ * @returns {cpu: number | string, memory: number| string} 如果 cpu 或 memory 是 '', 则认为无限制,
6
+ * 如果存在扩展资源配额,比如 {nvidia.com/gpu: string, tencent.com/vcuda-memory: string} 也会进行返回,
7
+ * 扩展资源默认不带单位,因此可以直接进行想加
8
+ */
9
+ export declare function getPodResourceRequirements(pod: Pod, type?: keyof ResourceRequirements): {
10
+ cpu: number | string;
11
+ memory: number | string;
12
+ [key: string]: number | string;
13
+ };
14
+ export declare function getContainerResourceLimit(container: Container): {
15
+ [key: string]: number;
16
+ };
17
+ export declare function getContainerResourceRequest(container: Container): {
18
+ [key: string]: number;
19
+ };
@@ -0,0 +1,8 @@
1
+ import { PrometheusRuleItem, AlarmStatus } from '@alauda-fe/alarm';
2
+ import { Job, HelmRequest, GenericWorkloadStatus } from '@alauda-fe/common';
3
+ import { Application, ApplicationStatusEnum, HelmRequestStatusEnum, JobStatusEnum, WorkloadStatusEnum } from '../typings';
4
+ export declare function getAlarmStatus(rule: PrometheusRuleItem): AlarmStatus;
5
+ export declare function getJobStatus(data: Job): JobStatusEnum;
6
+ export declare function getWorkloadStatus(status: GenericWorkloadStatus): WorkloadStatusEnum;
7
+ export declare function getApplicationStatus(application: Application): ApplicationStatusEnum;
8
+ export declare function getHelmRequestStatus(hr: HelmRequest): HelmRequestStatusEnum;
@@ -0,0 +1,22 @@
1
+ import { ResourceRequirements, StringMap } from '@alauda-fe/common';
2
+ export declare function getCustomResourceLimitsDisplay(configs: StringMap[], resources: ResourceRequirements): {
3
+ label: string | {
4
+ en: string;
5
+ zh: string;
6
+ };
7
+ value: string;
8
+ }[];
9
+ export declare function getCustomResourceRequestsDisplay(configs: StringMap[], resources: ResourceRequirements): {
10
+ label: string | {
11
+ en: string;
12
+ zh: string;
13
+ };
14
+ value: string;
15
+ }[];
16
+ export declare function getCustomResourceDisplay(configs: StringMap[], resources: ResourceRequirements, type: keyof ResourceRequirements): {
17
+ label: string | {
18
+ en: string;
19
+ zh: string;
20
+ };
21
+ value: string;
22
+ }[];
@@ -0,0 +1,3 @@
1
+ import { Pod, PodStatusEnum } from '@alauda-fe/common';
2
+ export declare function getPodStatus(pod: Pod): string;
3
+ export declare function getPodAggregatedStatus(status: string): PodStatusEnum;
@@ -0,0 +1,4 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ export declare function envVarNameValidator(control: AbstractControl<string>): {
3
+ envVarNamePattern: boolean;
4
+ };
@@ -0,0 +1,14 @@
1
+ import { ActivatedRoute, ActivatedRouteSnapshot, ParamMap, Params } from '@angular/router';
2
+ export interface Workspace {
3
+ project: string;
4
+ cluster: string;
5
+ namespace: string;
6
+ }
7
+ export interface ResourceIdentifier extends Workspace {
8
+ name: string;
9
+ }
10
+ export declare function parseWorkspace(workspace: string): Workspace;
11
+ export declare function stringifyWorkspace({ project, cluster, namespace, }: Workspace): string;
12
+ export declare function extractWorkspace(params: Params | ParamMap): Workspace;
13
+ export declare function extractWorkspaceFromRoute(route: ActivatedRoute | ActivatedRouteSnapshot): Workspace;
14
+ export declare function getHomeRedirectRoutePrefix(snapshot: ActivatedRouteSnapshot): string;
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@alauda-fe/workload-util-shared",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@alauda/ui": "^8.0.0",
6
+ "@alauda-fe/common": "1.4.4",
7
+ "@angular/common": "18.1.1",
8
+ "@angular/core": "18.1.1",
9
+ "@angular/forms": "18.1.1",
10
+ "@angular/router": "18.1.1",
11
+ "@alauda-fe/crd-form": "0.0.4",
12
+ "rxjs": "^7.8.1",
13
+ "lodash-es": "^4.17.21"
14
+ },
15
+ "dependencies": {
16
+ "tslib": "^2.3.0"
17
+ },
18
+ "sideEffects": false,
19
+ "private": false,
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "module": "esm2022/alauda-fe-workload-util-shared.mjs",
24
+ "typings": "index.d.ts",
25
+ "exports": {
26
+ "./package.json": {
27
+ "default": "./package.json"
28
+ },
29
+ ".": {
30
+ "types": "./index.d.ts",
31
+ "esm2022": "./esm2022/alauda-fe-workload-util-shared.mjs",
32
+ "esm": "./esm2022/alauda-fe-workload-util-shared.mjs",
33
+ "default": "./esm2022/alauda-fe-workload-util-shared.mjs"
34
+ }
35
+ }
36
+ }