Skip to content

Commit a8a41ef

Browse files
committed
Fix comments
1 parent be1c9d6 commit a8a41ef

5 files changed

Lines changed: 14 additions & 15 deletions

File tree

src/legacy/core_plugins/vis_type_vega/public/components/vega_actions_menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface VegaActionsMenuProps {
3030
function VegaActionsMenu({ formatHJson, formatJson }: VegaActionsMenuProps) {
3131
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
3232

33-
const onButtonClick = useCallback(() => setIsPopoverOpen(!isPopoverOpen), [isPopoverOpen]);
33+
const onButtonClick = useCallback(() => setIsPopoverOpen(isOpen => !isOpen), []);
3434
const onHJsonCLick = useCallback(() => {
3535
formatHJson();
3636
setIsPopoverOpen(false);

src/legacy/core_plugins/vis_type_vega/public/components/vega_help_menu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function VegaHelpMenu() {
4747
>
4848
<FormattedMessage
4949
id="visTypeVega.editor.vegaHelpLinkText"
50-
defaultMessage="Kibana Vega Help"
50+
defaultMessage="Kibana Vega help"
5151
/>
5252
</EuiContextMenuItem>,
5353
<EuiContextMenuItem
@@ -58,7 +58,7 @@ function VegaHelpMenu() {
5858
>
5959
<FormattedMessage
6060
id="visTypeVega.editor.vegaLiteDocumentationLinkText"
61-
defaultMessage="Vega-Lite Documentation"
61+
defaultMessage="Vega-Lite documentation"
6262
/>
6363
</EuiContextMenuItem>,
6464
<EuiContextMenuItem
@@ -69,7 +69,7 @@ function VegaHelpMenu() {
6969
>
7070
<FormattedMessage
7171
id="visTypeVega.editor.vegaDocumentationLinkText"
72-
defaultMessage="Vega Documentation"
72+
defaultMessage="Vega documentation"
7373
/>
7474
</EuiContextMenuItem>,
7575
];

src/legacy/core_plugins/vis_type_vega/public/components/vega_vis_editor.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,15 @@ const aceOptions = {
3939
wrap: true,
4040
};
4141

42-
function format(value: string, stringify: typeof compactStringify) {
42+
const hjsonStringifyOptions = {
43+
bracesSameLine: true,
44+
keepWsc: true,
45+
};
46+
47+
function format(value: string, stringify: typeof compactStringify, options?: any) {
4348
try {
4449
const spec = hjson.parse(value, { legacyRoot: false, keepWsc: true });
45-
return stringify(spec);
50+
return stringify(spec, options);
4651
} catch (err) {
4752
// This is a common case - user tries to format an invalid HJSON text
4853
toastNotifications.addError(err, {
@@ -69,7 +74,7 @@ function VegaVisEditor({ stateParams, setValue }: VisOptionsProps<VisParams>) {
6974
);
7075

7176
const formatHJson = useCallback(
72-
() => setValue('spec', format(stateParams.spec, hjson.stringify)),
77+
() => setValue('spec', format(stateParams.spec, hjson.stringify, hjsonStringifyOptions)),
7378
[setValue, stateParams.spec]
7479
);
7580

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,11 +3161,8 @@
31613161
"visTypeVega.editor.formatError": "仕様のフォーマット中にエラーが発生",
31623162
"visTypeVega.editor.reformatAsHJSONButtonLabel": "HJSON に変換",
31633163
"visTypeVega.editor.reformatAsJSONButtonLabel": "JSON に変換しコメントを削除",
3164-
"visTypeVega.editor.vegaDocumentationLinkText": "Vega ドキュメント",
31653164
"visTypeVega.editor.vegaEditorOptionsButtonAriaLabel": "Vega エディターオプション",
31663165
"visTypeVega.editor.vegaHelpButtonAriaLabel": "Vega ヘルプ",
3167-
"visTypeVega.editor.vegaHelpLinkText": "Kibana Vega ヘルプ",
3168-
"visTypeVega.editor.vegaLiteDocumentationLinkText": "Vega-Lite ドキュメンテーション",
31693166
"visTypeVega.emsFileParser.emsFileNameDoesNotExistErrorMessage": "{emsfile} {emsfileName} が存在しません",
31703167
"visTypeVega.emsFileParser.missingNameOfFileErrorMessage": "{dataUrlParamValue} の {dataUrlParam} には {nameParam} パラメーター (ファイル名) が必要です",
31713168
"visTypeVega.esQueryParser.autointervalValueTypeErrorMessage": "{autointerval} は文字 {trueValue} または数字である必要があります",
@@ -10514,4 +10511,4 @@
1051410511
"xpack.fileUpload.fileParser.errorReadingFile": "ファイルの読み込み中にエラーが発生しました",
1051510512
"xpack.fileUpload.fileParser.noFileProvided": "エラー、ファイルが提供されていません"
1051610513
}
10517-
}
10514+
}

x-pack/plugins/translations/translations/zh-CN.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,11 +3162,8 @@
31623162
"visTypeVega.editor.formatError": "格式化规范时出错",
31633163
"visTypeVega.editor.reformatAsHJSONButtonLabel": "重新格式化为 HJSON",
31643164
"visTypeVega.editor.reformatAsJSONButtonLabel": "重新格式化为 JSON,删除注释",
3165-
"visTypeVega.editor.vegaDocumentationLinkText": "Vega 文档",
31663165
"visTypeVega.editor.vegaEditorOptionsButtonAriaLabel": "Vega 编辑器选项",
31673166
"visTypeVega.editor.vegaHelpButtonAriaLabel": "Vega 帮助",
3168-
"visTypeVega.editor.vegaHelpLinkText": "Kibana Vega 帮助",
3169-
"visTypeVega.editor.vegaLiteDocumentationLinkText": "Vega-Lite 文档",
31703167
"visTypeVega.emsFileParser.emsFileNameDoesNotExistErrorMessage": "{emsfile} {emsfileName} 不存在",
31713168
"visTypeVega.emsFileParser.missingNameOfFileErrorMessage": "具有 {dataUrlParamValue} 的 {dataUrlParam} 需要 {nameParam} 参数(文件名)",
31723169
"visTypeVega.esQueryParser.autointervalValueTypeErrorMessage": "{autointerval} 必须为 {trueValue} 或数字",
@@ -10670,4 +10667,4 @@
1067010667
"xpack.fileUpload.fileParser.errorReadingFile": "读取文件时出错",
1067110668
"xpack.fileUpload.fileParser.noFileProvided": "错误,未提供任何文件"
1067210669
}
10673-
}
10670+
}

0 commit comments

Comments
 (0)