Visitar URL original
[ZEPPELIN-6593] Preserve false interpreter property values · apache/zeppelin@cf5a453 · GitHub
Skip to content

Commit cf5a453

Browse files
authored
[ZEPPELIN-6593] Preserve false interpreter property values
Fixes [ZEPPELIN-6593](https://issues.apache.org/jira/browse/ZEPPELIN-6593). The New UI's view-mode property cell used a truthy fallback, so a boolean `false` value rendered as blank. Route the cell through a nullish formatter instead, preserving `false` and `true` while keeping nullish values empty. Password masking and checkbox editing remain unchanged. Verification: - `npm run test:shell -- src/app/pages/workspace/interpreter/item/item.component.spec.ts` — 4 tests passed. Vite emitted a missing Monaco source-map warning. - Angular workspace lint completed with 0 errors (existing warnings remain). - The combined `npm run lint` did not complete: the separate React remote lint could not resolve its uninstalled `eslint-plugin-react` dependency. No React files are changed. Closes #5592 from dajiaohuang/ZEPPELIN-6593-preserve-false-interpreter-values. Signed-off-by: YONGJAE LEE <dev.yongjaelee@gmail.com>
1 parent 5fdc82c commit cf5a453

3 files changed

Lines changed: 47 additions & 1 deletion

File tree

‎zeppelin-web-angular/src/app/pages/workspace/interpreter/item/item.component.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ <h3 class="form-title">Properties</h3>
361361
</a>
362362
}
363363
@default {
364-
{{ control.get('value')?.value || '' }}
364+
{{ displayPropertyValue(control.get('value')?.value) }}
365365
}
366366
}
367367
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
* Unless required by applicable law or agreed to in writing, software
7+
* distributed under the License is distributed on an "AS IS" BASIS,
8+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
* See the License for the specific language governing permissions and
10+
* limitations under the License.
11+
*/
12+
13+
import type { ChangeDetectorRef } from '@angular/core';
14+
import { describe, expect, it } from 'vitest';
15+
16+
import type { SecurityService, TicketService, InterpreterService } from '@zeppelin/services';
17+
18+
import type { InterpreterComponent } from '../interpreter.component';
19+
import { InterpreterItemComponent } from './item.component';
20+
21+
const createComponent = () =>
22+
new InterpreterItemComponent(
23+
{} as InterpreterComponent,
24+
{} as TicketService,
25+
{} as SecurityService,
26+
{} as InterpreterService,
27+
{} as ChangeDetectorRef
28+
);
29+
30+
describe('InterpreterItemComponent.displayPropertyValue', () => {
31+
it.each([false, true])('preserves the boolean value %s', value => {
32+
const component = createComponent();
33+
34+
expect(component.displayPropertyValue(value)).toBe(value);
35+
});
36+
37+
it.each([null, undefined])('renders an absent value as empty', value => {
38+
const component = createComponent();
39+
40+
expect(component.displayPropertyValue(value)).toBe('');
41+
});
42+
});

‎zeppelin-web-angular/src/app/pages/workspace/interpreter/item/item.component.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ export class InterpreterItemComponent extends DestroyHookComponent implements On
9797

9898
interpreterRunningOption = 'Globally';
9999

100+
displayPropertyValue(value: PropertyValue | undefined): PropertyValue {
101+
return value ?? '';
102+
}
103+
100104
switchToEditMode(): void {
101105
this.setupEditableForm();
102106
this.formGroup.enable();

0 commit comments

Comments
 (0)