forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New chart settings to change title of serieses (metabase#5951)
- Loading branch information
Showing
6 changed files
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
frontend/src/metabase/visualizations/components/settings/ChartSettingInputs.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from "react"; | ||
|
||
import Input from "metabase/components/Input.jsx"; | ||
|
||
// value is an array of strings. This component provides one input box per string | ||
export default function ChartSettingInputs({ value, onChange }) { | ||
const inputs = value.map((str, i) => ( | ||
<Input | ||
key={i} | ||
className="input block full" | ||
value={str} | ||
onBlurChange={(e) => { | ||
const newStr = e.target.value.trim(); | ||
if (!newStr || !newStr.length) return; | ||
|
||
const newValue = value.slice(); // clone the original `value` array | ||
newValue[i] = newStr; | ||
onChange(newValue); | ||
}} | ||
/> | ||
)); | ||
|
||
return ( | ||
<div> | ||
{inputs} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters