Skip to content

Commit

Permalink
provide the ability to disable features (#4839)
Browse files Browse the repository at this point in the history
* provide the ability to disable features

part of: kiali/kiali#4737

* changing feature name to logs-tab

* if things are disabled, add message at login

* UI notification of disabled features

* fix the INFO notification color and icon.
fixes: kiali/kiali#4871

* hide the popup notification

* fail fast if the feature name is invalid.
  • Loading branch information
jmazzitelli authored Mar 31, 2022
1 parent 3540825 commit 1aca4d4
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 20 deletions.
6 changes: 5 additions & 1 deletion frontend/src/app/AuthenticationController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { config } from 'config';
import { store } from 'store/ConfigStore';
import { toGrpcRate, toHttpRate, toTcpRate, TrafficRate } from 'types/Graph';
import { GraphToolbarActions } from 'actions/GraphToolbarActions';
import { StatusState } from 'types/StatusState';
import { StatusState, StatusKey } from 'types/StatusState';
import { PromisesRegistry } from '../utils/CancelablePromises';

interface AuthenticationControllerReduxProps {
Expand Down Expand Up @@ -342,6 +342,10 @@ export class AuthenticationController extends React.Component<
status.warningMessages.forEach(wMsg => {
this.props.addMessage(wMsg, '', 'systemErrors', MessageType.WARNING);
});

if (status.status[StatusKey.DISABLED_FEATURES]) {
this.props.addMessage("The following features are disabled: " + status.status[StatusKey.DISABLED_FEATURES], '', 'default', MessageType.INFO, false)
}
};
}

Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/MessageCenter/NotificationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export default class NotificationList extends React.PureComponent<NotificationLi
case MessageType.WARNING:
variant = AlertVariant.warning;
break;
case MessageType.INFO:
variant = AlertVariant.info;
break;
default:
variant = AlertVariant.danger;
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/config/ServerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const defaultServerConfig: ComputedServerConfig = {
certificatesInformationIndicators: {
enabled: true
},
disabledFeatures: [],
istioInjectionAction: true,
istioUpgradeAction: false,
uiDefaults: {
Expand Down
40 changes: 21 additions & 19 deletions frontend/src/pages/WorkloadDetails/WorkloadDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,27 @@ class WorkloadDetails extends React.Component<WorkloadDetailsPageProps, Workload
);
tabsArray.push(trafficTab);

const logTab = (
<Tab title="Logs" eventKey={2} key={'Logs'}>
{hasPods ? (
<WorkloadPodLogs
namespace={this.props.match.params.namespace}
workload={this.props.match.params.workload}
pods={this.state.workload!.pods}
/>
) : (
<EmptyState variant={EmptyStateVariant.full}>
<Title headingLevel="h5" size="lg">
No logs for Workload {this.props.match.params.workload}
</Title>
<EmptyStateBody>There are no logs to display because the workload has no pods.</EmptyStateBody>
</EmptyState>
)}
</Tab>
);
tabsArray.push(logTab);
if (!serverConfig.kialiFeatureFlags.disabledFeatures || !serverConfig.kialiFeatureFlags.disabledFeatures.includes('logs-tab')) {
const logTab = (
<Tab title="Logs" eventKey={2} key={'Logs'}>
{hasPods ? (
<WorkloadPodLogs
namespace={this.props.match.params.namespace}
workload={this.props.match.params.workload}
pods={this.state.workload!.pods}
/>
) : (
<EmptyState variant={EmptyStateVariant.full}>
<Title headingLevel="h5" size="lg">
No logs for Workload {this.props.match.params.workload}
</Title>
<EmptyStateBody>There are no logs to display because the workload has no pods.</EmptyStateBody>
</EmptyState>
)}
</Tab>
);
tabsArray.push(logTab);
}

const inTab = (
<Tab title="Inbound Metrics" eventKey={3} key={'Inbound Metrics'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const serverRateConfig = {
certificatesInformationIndicators: {
enabled: true
},
disabledFeatures: [],
istioInjectionAction: true,
istioUpgradeAction: false,
uiDefaults: {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/ServerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ interface CertificatesInformationIndicators {

interface KialiFeatureFlags {
certificatesInformationIndicators: CertificatesInformationIndicators;
disabledFeatures: string[];
istioInjectionAction: boolean;
istioUpgradeAction: boolean;
uiDefaults: UIDefaults;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/StatusState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum StatusKey {
DISABLED_FEATURES = 'Disabled features',
KIALI_CORE_COMMIT_HASH = 'Kiali core commit hash',
KIALI_CORE_VERSION = 'Kiali core version',
KIALI_CONSOLE_VERSION = 'Kiali console version',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/__testData__/HealthConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const healthConfig = {
certificatesInformationIndicators: {
enabled: true
},
disabledFeatures: [],
istioInjectionAction: true,
istioUpgradeAction: false,
uiDefaults: {
Expand Down

0 comments on commit 1aca4d4

Please sign in to comment.