Skip to content

Commit

Permalink
Merge pull request #4190 from kubeshop/devcatalin/feat/disable-cluste…
Browse files Browse the repository at this point in the history
…r-validation

Setting to disable cluster validation & added table pagination
  • Loading branch information
devcatalin authored Oct 30, 2023
2 parents ccc1f32 + 12e5ff6 commit 122e2b3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/components/organisms/Dashboard/TableView/TableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ const TableView = ({
columns={columns}
rowKey="id"
scroll={{
y: tableScrollHeight || height - 212 - (bottomSelection === 'terminal' ? terminalHeight : 0),
y: tableScrollHeight || height - 270 - (bottomSelection === 'terminal' ? terminalHeight : 0),
}}
rowClassName={(record: ResourceMeta | any) => (record.id === selectedResourceId ? 'selected' : '')}
pagination={false}
sticky
onRow={(record: ResourceMeta | any) => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ export const GlobalSettings = () => {
[_setShouldAppendServerPath]
);

const [disableClusterValidation, _setDisableClusterValidation] = useState<boolean>(
electronStore.get('appConfig.settings.disableClusterValidation') ?? false
);

const setDisableClusterValidation = useCallback(
(value: boolean) => {
_setDisableClusterValidation(value);
electronStore.set('appConfig.settings.disableClusterValidation', value);
},
[_setDisableClusterValidation]
);

const [isOverridingBinaryPaths, _setIsOverridingBinaryPaths] = useState<boolean>(
Boolean(electronStore.get('appConfig.binaryPaths')) ?? false
);
Expand Down Expand Up @@ -192,6 +204,9 @@ export const GlobalSettings = () => {
<Checkbox checked={shouldAppendServerPath} onChange={e => setShouldAppendServerPath(e.target.checked)}>
Append Server Path to Kubectl Proxy
</Checkbox>
<Checkbox checked={disableClusterValidation} onChange={e => setDisableClusterValidation(e.target.checked)}>
Disable validation of cluster resources
</Checkbox>
</S.Div>

<S.Div>
Expand Down
19 changes: 19 additions & 0 deletions src/redux/validation/validation.listeners.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {startExecutionTimer} from '@utils/executionTime';
import {doesSchemaExist} from '@utils/index';

import {ResourceIdentifier, ResourceStorage} from '@shared/models/k8sResource';
import {electronStore} from '@shared/utils';
import {isDefined} from '@shared/utils/filter';
import {isEqual} from '@shared/utils/isEqual';
import {trackEvent} from '@shared/utils/telemetry';
Expand Down Expand Up @@ -88,6 +89,10 @@ const loadListener: AppListenerFn = listen => {
async effect(_action, {dispatch, delay, signal, cancelActiveListeners}) {
trackEvent('validation/load_config', {actionType: _action.type});
if (isAnyOf(setIsInQuickClusterMode)(_action)) {
const disableClusterValidation = electronStore.get('appConfig.settings.disableClusterValidation') ?? false;
if (disableClusterValidation) {
return;
}
if (!_action.payload) {
return;
}
Expand Down Expand Up @@ -127,6 +132,20 @@ const validateListener: AppListenerFn = listen => {
restartPreview.rejected
),
async effect(_action, {dispatch, getState, cancelActiveListeners, signal, delay}) {
const disableClusterValidation = electronStore.get('appConfig.settings.disableClusterValidation') ?? false;

if (disableClusterValidation) {
if (
isAnyOf(
loadClusterResources.fulfilled,
reloadClusterResources.fulfilled,
deleteMultipleClusterResources
)(_action)
) {
return;
}
}

const stopExecutionTimer = startExecutionTimer();
cancelActiveListeners();

Expand Down
4 changes: 4 additions & 0 deletions src/shared/constants/electronStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export const electronStoreSchema = {
allowEditInClusterMode: {
type: 'boolean',
},
disableClusterValidation: {
type: 'boolean',
},
},
},
recentFolders: {
Expand Down Expand Up @@ -325,6 +328,7 @@ export const electronStoreDefaults = {
createDefaultObjects: false,
setDefaultPrimitiveValues: true,
allowEditInClusterMode: true,
disableClusterValidation: false,
enableHelmWithKustomize: true,
},
recentFolders: [],
Expand Down

0 comments on commit 122e2b3

Please sign in to comment.