Skip to content

Commit 445ce77

Browse files
committed
Update read-only property.
1 parent 224f766 commit 445ce77

File tree

12 files changed

+51
-20
lines changed

12 files changed

+51
-20
lines changed

dev-support/Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pipeline {
7171
checkout([
7272
$class: 'GitSCM',
7373
branches: [[name: "${env.YETUS_VERSION}"]],
74-
userRemoteConfigs: [[ url: 'https://github.com/apache/yetus.git']]]
74+
userRemoteConfigs: [[ url: 'https://github.com/ayushtkn/yetus.git']]]
7575
)
7676
}
7777
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ VITE_API_MOCK_MODE=static
2323
# -----------------------------------------------------------------------------
2424

2525
# Simulate read-only mode in development (only affects static mock mode)
26-
# In production, read-only mode is controlled by yarn.scheduler.capacity.ui.readonly in YARN
26+
# In production, read-only mode is controlled by the READ_ONLY_PROPERTY in YARN
2727
VITE_READONLY_MODE=false
2828

2929
# Username for simple-authenticated clusters (injected as user.name query parameter)

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/docs/design_doc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The **YARN Capacity Scheduler UI** is a modern web interface for managing Apache
7171
- Legacy mode toggle and capacity configuration modes
7272

7373
7. **Read-Only Mode Support**
74-
- Configurable read-only mode via YARN property (`yarn.scheduler.capacity.ui.readonly`)
74+
- Configurable read-only mode via YARN property (`yarn.webapp.scheduler-ui.read-only.enable`)
7575
- Users can stage and validate changes but cannot apply them
7676
- Visual indicators (lock icon, disabled buttons) in UI
7777
- Useful for production environments with restricted access

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/src/app/routes/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { SPECIAL_VALUES } from '~/types';
3535
import { SearchBar } from '~/components/search/SearchBar';
3636
import { useKeyboardShortcuts } from '~/hooks/useKeyboardShortcuts';
3737
import { toast } from 'sonner';
38+
import { READ_ONLY_PROPERTY } from '~/config';
3839

3940
export default function Layout() {
4041
const [stagedChangesPanelOpen, setStagedChangesPanelOpen] = useState(false);
@@ -210,7 +211,7 @@ export default function Layout() {
210211
</Badge>
211212
</TooltipTrigger>
212213
<TooltipContent>
213-
<p>Set yarn.scheduler.capacity.ui.readonly=false in YARN to enable editing</p>
214+
<p>Set {READ_ONLY_PROPERTY}=false in YARN to enable editing</p>
214215
</TooltipContent>
215216
</Tooltip>
216217
</TooltipProvider>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/**
20+
* Configuration constants for YARN Scheduler UI
21+
*/
22+
23+
/**
24+
* YARN configuration property that controls read-only mode for the UI.
25+
* When set to 'true', the UI will allow viewing and staging changes but prevent mutations.
26+
*/
27+
export const READ_ONLY_PROPERTY = 'yarn.webapp.scheduler-ui.read-only.enable';

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/src/config/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
// Re-export all configuration-related modules
2121
export * from './schemas';
2222
export * from './properties';
23+
export * from './constants';

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/src/features/staged-changes/components/StagedChangesPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { QueueChangeGroup } from './QueueChangeGroup';
3535
import { toast } from 'sonner';
3636
import { Kbd } from '~/components/ui/kbd';
3737
import { getModifierKey } from '~/hooks/useKeyboardShortcuts';
38+
import { READ_ONLY_PROPERTY } from '~/config';
3839

3940
interface StagedChangesPanelProps {
4041
open: boolean;
@@ -188,7 +189,7 @@ export function StagedChangesPanel({ open, onClose, onOpen }: StagedChangesPanel
188189
<div className="break-words">
189190
Changes are staged but cannot be applied. Set{' '}
190191
<code className="text-xs bg-muted px-1 py-0.5 rounded break-all">
191-
yarn.scheduler.capacity.ui.readonly=false
192+
{READ_ONLY_PROPERTY}=false
192193
</code>{' '}
193194
in YARN to enable editing.
194195
</div>

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/src/lib/api/YarnApiClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717
YarnConfigResponse,
1818
ValidationResponse,
1919
} from '../../types';
20+
import { READ_ONLY_PROPERTY } from '../../config';
2021

2122
export class YarnApiClient {
2223
private readonly baseUrl: string;
@@ -245,11 +246,11 @@ export class YarnApiClient {
245246
}
246247

247248
/**
248-
* Detect read-only mode by checking yarn.scheduler.capacity.ui.readonly
249+
* Detect read-only mode by checking the READ_ONLY_PROPERTY configuration
249250
*/
250251
private async detectReadOnlyMode(): Promise<void> {
251252
try {
252-
const readOnlyValue = await this.getConfiguration('yarn.scheduler.capacity.ui.readonly');
253+
const readOnlyValue = await this.getConfiguration(READ_ONLY_PROPERTY);
253254
// Convert string to boolean - treat 'true' (case-insensitive) as true, everything else as false
254255
this.isReadOnly = readOnlyValue.toLowerCase() === 'true';
255256
} catch (error) {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/src/lib/api/mocks/handlers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import { http, HttpResponse, type HttpHandler } from 'msw';
2121
import { API_CONFIG } from '~/lib/api/config';
22+
import { READ_ONLY_PROPERTY } from '~/config';
2223

2324
// Base URL pattern that matches the API configuration
2425
// Use the same base URL as the API client for consistency
@@ -118,14 +119,13 @@ const staticHandlers: HttpHandler[] = [
118119
}
119120

120121
// Handle read-only mode query
121-
// TODO: change this to the actual config value
122-
if (configName === 'yarn.scheduler.capacity.ui.readonly') {
122+
if (configName === READ_ONLY_PROPERTY) {
123123
// Default to false (writable mode) for development
124124
// Set VITE_READONLY_MODE=true to test read-only mode
125125
const readOnlyValue = import.meta.env.VITE_READONLY_MODE === 'true' ? 'true' : 'false';
126126
return HttpResponse.json({
127127
property: {
128-
name: 'yarn.scheduler.capacity.ui.readonly',
128+
name: READ_ONLY_PROPERTY,
129129
value: readOnlyValue,
130130
},
131131
});

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/src/lib/errors/__tests__/scheduler-store-error.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import { describe, it, expect } from 'vitest';
2121
import { SchedulerStoreError } from '../scheduler-store-error';
2222
import { ERROR_CODES } from '../error-codes';
23+
import { READ_ONLY_PROPERTY } from '~/config';
2324

2425
describe('SchedulerStoreError', () => {
2526
describe('constructor', () => {
@@ -340,13 +341,13 @@ describe('SchedulerStoreError', () => {
340341
'Configuration is in read-only mode',
341342
ERROR_CODES.MUTATION_BLOCKED,
342343
{
343-
readOnlyProperty: 'yarn.scheduler.capacity.ui.readonly',
344-
instruction: 'Set yarn.scheduler.capacity.ui.readonly=false to enable editing',
344+
readOnlyProperty: READ_ONLY_PROPERTY,
345+
instruction: `Set ${READ_ONLY_PROPERTY}=false to enable editing`,
345346
},
346347
);
347348

348349
expect(error.code).toBe(ERROR_CODES.MUTATION_BLOCKED);
349-
expect((error.details as any).instruction).toContain('readonly=false');
350+
expect((error.details as any).instruction).toContain('read-only.enable=false');
350351
});
351352
});
352353
});

0 commit comments

Comments
 (0)