Skip to content

Commit 4b7831a

Browse files
New route for Lock Config
1 parent 5835f4a commit 4b7831a

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

src/components/CodeEditor/CodeEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface CodeEditorInterface {
4848
onFocus?: () => void;
4949
children?: any;
5050
defaultValue?: string;
51-
mode?: 'json' | 'yaml' | 'shell' | 'dockerfile';
51+
mode?: 'json' | 'yaml' | 'shell' | 'dockerfile' | 'plaintext';
5252
tabSize?: number;
5353
readOnly?: boolean;
5454
noParsing?: boolean;
@@ -110,7 +110,7 @@ interface Action {
110110
}
111111

112112
interface CodeEditorState {
113-
mode: 'json' | 'yaml' | 'shell' | 'dockerfile';
113+
mode: 'json' | 'yaml' | 'shell' | 'dockerfile' | 'plaintext';
114114
diffMode: boolean;
115115
theme: 'vs' | 'vs-dark';
116116
code: string;

src/components/globalConfigurations/GlobalConfiguration.tsx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { ReactComponent as Dropdown } from '../../assets/icons/ic-chevron-down.s
2424
import { ModuleStatus } from '../v2/devtronStackManager/DevtronStackManager.type'
2525
import { getModuleInfo } from '../v2/devtronStackManager/DevtronStackManager.service'
2626
import { BodyType } from './globalConfiguration.type'
27+
import CodeEditor from '../CodeEditor/CodeEditor'
2728

2829
const HostURLConfiguration = lazy(() => import('../hostURL/HostURL'))
2930
const GitOpsConfiguration = lazy(() => import('../gitOps/GitOpsConfiguration'))
@@ -40,6 +41,7 @@ const ScopedVariables = lazy(() => import('../scopedVariables/ScopedVariables'))
4041
const TagListContainer = importComponentFromFELibrary('TagListContainer')
4142
const PluginsPolicy = importComponentFromFELibrary('PluginsPolicy')
4243
const FilterConditions = importComponentFromFELibrary('FilterConditions')
44+
const LockConfiguration = importComponentFromFELibrary('LockConfiguration')
4345

4446
export default function GlobalConfiguration(props) {
4547
const location = useLocation()
@@ -421,6 +423,15 @@ function NavItem({ serverMode }) {
421423
<div className="flexbox flex-justify">Filter condition</div>
422424
</NavLink>
423425
)}
426+
{LockConfiguration && (
427+
<NavLink
428+
to={URLS.GLOBAL_CONFIG_LOCK_CONFIG}
429+
key={URLS.GLOBAL_CONFIG_LOCK_CONFIG}
430+
activeClassName="active-route"
431+
>
432+
<div className="flexbox flex-justify">Lock Deployment config</div>
433+
</NavLink>
434+
)}
424435
</>
425436
)}
426437
</div>
@@ -583,6 +594,14 @@ function Body({ getHostURLConfig, checkList, serverMode, handleChecklistUpdate,
583594
<FilterConditions isSuperAdmin={isSuperAdmin} />
584595
</Route>
585596
)}
597+
{LockConfiguration && (
598+
<Route path={URLS.GLOBAL_CONFIG_LOCK_CONFIG}>
599+
<LockConfiguration
600+
isSuperAdmin={isSuperAdmin}
601+
CodeEditor={CodeEditor}
602+
/>
603+
</Route>
604+
)}
586605
<Redirect to={defaultRoute()} />
587606
</Switch>
588607
)
@@ -611,10 +630,18 @@ function Title({ title = '', subtitle = '', style = {}, className = '', tag = ''
611630
function ListToggle({ onSelect, enabled = false, isButtonDisabled = false, ...props }) {
612631
const handleToggle = () => {
613632
if (!isButtonDisabled) {
614-
onSelect(!enabled);
633+
onSelect(!enabled)
615634
}
616-
};
617-
return <Toggle dataTestId="toggle-button" {...props} onSelect={handleToggle} selected={enabled} disabled={isButtonDisabled} />
635+
}
636+
return (
637+
<Toggle
638+
dataTestId="toggle-button"
639+
{...props}
640+
onSelect={handleToggle}
641+
selected={enabled}
642+
disabled={isButtonDisabled}
643+
/>
644+
)
618645
}
619646

620647
function DropDown({ className = '', dataTestid = '', style = {}, src = null, ...props }) {

src/config/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const URLS = {
7272
GLOBAL_CONFIG_TAGS: '/global-config/tags',
7373
GLOBAL_CONFIG_PLUGINS: '/global-config/plugins',
7474
GLOBAL_CONFIG_FILTER_CONDITION: '/global-config/filter-condition',
75+
GLOBAL_CONFIG_LOCK_CONFIG: '/global-config/lock-config',
7576
GUIDE: 'guide',
7677
GETTING_STARTED: 'getting-started',
7778
SECURITY: '/security',

0 commit comments

Comments
 (0)