fix(cluster): make angular refresh env [EE-5524] (#10315)

Co-authored-by: testa113 <testa113>
pull/10345/head
Ali 2023-09-20 09:33:43 +02:00 committed by GitHub
parent 25d5e62f5c
commit c18504d6f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View File

@ -7,7 +7,7 @@ import { getMetricsForAllNodes } from '@/react/kubernetes/services/service.ts';
class KubernetesClusterController {
/* @ngInject */
constructor($async, $state, Notifications, LocalStorage, Authentication, KubernetesNodeService, KubernetesApplicationService, KubernetesEndpointService) {
constructor($async, $state, Notifications, LocalStorage, Authentication, KubernetesNodeService, KubernetesApplicationService, KubernetesEndpointService, EndpointService) {
this.$async = $async;
this.$state = $state;
this.Authentication = Authentication;
@ -16,6 +16,7 @@ class KubernetesClusterController {
this.KubernetesNodeService = KubernetesNodeService;
this.KubernetesApplicationService = KubernetesApplicationService;
this.KubernetesEndpointService = KubernetesEndpointService;
this.EndpointService = EndpointService;
this.onInit = this.onInit.bind(this);
this.getNodes = this.getNodes.bind(this);
@ -120,6 +121,7 @@ class KubernetesClusterController {
}
async onInit() {
this.endpoint = await this.EndpointService.endpoint(this.endpoint.Id);
this.isAdmin = this.Authentication.isAdmin();
const useServerMetrics = this.endpoint.Kubernetes.Configuration.UseServerMetrics;

View File

@ -26,6 +26,7 @@ class KubernetesCreateResourcePoolController {
});
this.IngressClassTypes = KubernetesIngressClassTypes;
this.EndpointService = EndpointService;
this.LBQuotaFeatureId = FeatureId.K8S_RESOURCE_POOL_LB_QUOTA;
this.onToggleStorageQuota = this.onToggleStorageQuota.bind(this);
@ -175,7 +176,7 @@ class KubernetesCreateResourcePoolController {
$onInit() {
return this.$async(async () => {
try {
const endpoint = this.endpoint;
const endpoint = await this.EndpointService.endpoint(this.endpoint.Id);
this.defaults = KubernetesResourceQuotaDefaults;
this.formValues = new KubernetesResourcePoolFormValues(this.defaults);
this.formValues.EndpointId = this.endpoint.Id;

View File

@ -60,9 +60,11 @@ class KubernetesResourcePoolController {
this.IngressClassTypes = KubernetesIngressClassTypes;
this.ResourceQuotaDefaults = KubernetesResourceQuotaDefaults;
this.EndpointService = EndpointService;
this.LBQuotaFeatureId = FeatureId.K8S_RESOURCE_POOL_LB_QUOTA;
this.StorageQuotaFeatureId = FeatureId.K8S_RESOURCE_POOL_STORAGE_QUOTA;
this.StorageQuotaFeatureId = FeatureId.K8S_RESOURCE_POOL_STORAGE_QUOTA;
this.updateResourcePoolAsync = this.updateResourcePoolAsync.bind(this);
this.getEvents = this.getEvents.bind(this);
@ -339,6 +341,7 @@ class KubernetesResourcePoolController {
$onInit() {
return this.$async(async () => {
try {
this.endpoint = await this.EndpointService.endpoint(this.endpoint.Id);
this.isAdmin = this.Authentication.isAdmin();
this.state = {

View File

@ -1,14 +1,15 @@
import { useEffect, useState } from 'react';
import { Database, AlertTriangle } from 'lucide-react';
import Route from '@/assets/ico/route.svg?c';
import { confirm } from '@@/modals/confirm';
import { ModalType } from '@@/modals';
import { Datatable } from '@@/datatables';
import { Button, ButtonGroup } from '@@/buttons';
import { Icon } from '@@/Icon';
import { createPersistedStore } from '@@/datatables/types';
import { buildConfirmButton } from '@@/modals/utils';
import { useTableState } from '@@/datatables/useTableState';
import { TextTip } from '@@/Tip/TextTip';
import { IngressControllerClassMapRowData } from '../types';
@ -98,7 +99,7 @@ export function IngressClassDatatable({
isLoading={isLoading}
emptyContentLabel={noIngressControllerLabel}
title="Ingress Controllers"
titleIcon={Database}
titleIcon={Route}
getRowId={(row) => `${row.Name}-${row.ClassName}-${row.Type}`}
renderTableActions={(selectedRows) => renderTableActions(selectedRows)}
description={renderIngressClassDescription()}
@ -160,12 +161,7 @@ export function IngressClassDatatable({
isUnsavedChanges(
initialIngressControllers,
ingControllerFormValues
) && (
<span className="text-warning mt-1 flex items-center">
<Icon icon={AlertTriangle} className="!mr-1" />
<span className="text-warning">Unsaved changes.</span>
</span>
)}
) && <TextTip>Unsaved changes.</TextTip>}
</div>
);
}