Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.BACKPORT_ACTION_PAT }}
- name: Create backport pull requests
uses: korthout/backport-action@v3
id: create_backport_pr
uses: korthout/backport-action@v4
with:
# Token for git actions, see https://github.com/korthout/backport-action/issues/379
github_token: ${{ secrets.BACKPORT_ACTION_PAT }}
auto_merge_method: squash
auto_merge_enabled: true
copy_assignees: true
copy_milestone: true
copy_requested_reviewers: true
Expand All @@ -49,3 +51,45 @@ jobs:
{
"conflict_resolution": "draft_commit_conflicts"
}
- name: Link all backport PRs to original issue
if: ${{ steps.get-issues.outputs.issues != '' && steps.create_backport_pr.outputs.created_pull_numbers != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.BACKPORT_ACTION_PAT }}
script: |
const issueNumbers = "${{ steps.get-issues.outputs.issues }}".split(',').map(s => s.trim()).filter(Boolean);
const prNumbers = "${{ steps.create_backport_pr.outputs.created_pull_numbers }}".split(' ').map(s => s.trim()).filter(Boolean);

for (const prNumber of prNumbers) {
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: Number(prNumber)
});

for (const issueNumber of issueNumbers) {
const { data: issue } = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number(issueNumber)
});

console.log(`Linking PR #${prNumber} to issue #${issueNumber}`);

await github.graphql(`
mutation AddLinkedIssue($pullRequestId: ID!, $issueId: ID!) {
addLinkedIssue(input: {
pullRequestId: $pullRequestId,
issueId: $issueId
}) {
pullRequest {
number
}
}
}
`, {
pullRequestId: pr.node_id,
issueId: issue.node_id
});
}
}
24 changes: 24 additions & 0 deletions web/client/components/charts/WidgetChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ const applyPercentageToLabel = (label, value, total) => {
}
return label;
};

const parseAxisTickValues = (tickValues) => {
const values = tickValues
? tickValues
.split(',')
.map(value => value.trim())
.filter(Boolean)
: undefined;
return values?.length > 0 ? values : undefined;
};

const getAxisTickOptions = (options = {}) => {
const tickvals = parseAxisTickValues(options?.tickvals);
const ticktext = parseAxisTickValues(options?.ticktext);
if (tickvals && ticktext) {
return { tickvals, ticktext };
}
if (tickvals) {
return { tickvals };
}
return {};
};
/**
* Returns the labels for the pie chart, adds % to the labels, for legend, if the prop `includeLegendPercent` is true
* @param {string|number[]} labels the values of the chart ["California", "Ohio", ...]
Expand Down Expand Up @@ -462,6 +484,7 @@ function getLayoutOptions({
return {
...acc,
[`yaxis${idx === 0 ? '' : idx + 1}`]: {
...getAxisTickOptions(options),
automargin: true,
type: options?.type,
tickangle: options.angle ?? 'auto',
Expand Down Expand Up @@ -505,6 +528,7 @@ function getLayoutOptions({
// dtick used to force show all x axis labels.
// TODO: enable only when "category" with time dimension
// dtick: xAxisAngle ? 0.25 : undefined,
...getAxisTickOptions(options),
automargin: true,
type: options?.type,
tickangle: options.angle ?? 'auto',
Expand Down
26 changes: 26 additions & 0 deletions web/client/components/charts/__tests__/WidgetChart-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,32 @@ describe('WidgetChart', () => {
]}
/>, document.getElementById("container"));
});
it('renders custom tick values and labels for both axes', () => {
const { layout } = toPlotly({
data: [DATASET_1.data],
traces: [{
type: 'line',
options: {
groupByAttributes: 'name',
aggregationAttribute: 'value'
}
}],
xAxisOpts: [{
id: 0,
tickvals: ' 1, 2, 3 ',
ticktext: ' A, B, C '
}],
yAxisOpts: [{
id: 0,
tickvals: ' 4, 5 ',
ticktext: ' D, E '
}]
});
expect(layout.xaxis.tickvals).toEqual(['1', '2', '3']);
expect(layout.xaxis.ticktext).toEqual(['A', 'B', 'C']);
expect(layout.yaxis.tickvals).toEqual(['4', '5']);
expect(layout.yaxis.ticktext).toEqual(['D', 'E']);
});
});

const TYPES = ['pie', 'line', 'bar'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,40 @@ function AxisOptions({
hideFormula
onChange={handleChange}
/>}
<FormGroup className="form-group-flex">
<ControlLabel>
<Message msgId={`widgets.advanced.axisTickVals`} />&nbsp;
<InfoPopover bsStyle="info" text={<Message msgId="widgets.advanced.axisTickValsTooltip" />} />
</ControlLabel>
<InputGroup>
<DebouncedFormControl
type="text"
disabled={!!options.hide}
value={options?.tickvals || ''}
placeholder="e.g. 1,2,3,4"
onChange={(value) => {
handleChange('tickvals', value);
}}
/>
</InputGroup>
</FormGroup>
<FormGroup className="form-group-flex">
<ControlLabel>
<Message msgId={`widgets.advanced.axisTickText`} />&nbsp;
<InfoPopover bsStyle="info" text={<Message msgId="widgets.advanced.axisTickTextTooltip" />} />
</ControlLabel>
<InputGroup>
<DebouncedFormControl
type="text"
disabled={!!options.hide}
value={options?.ticktext || ''}
placeholder="e.g. A,B,C,D"
onChange={(value) => {
handleChange('ticktext', value);
}}
/>
</InputGroup>
</FormGroup>
<FormGroup className="form-group-flex">
<ControlLabel>
<Message msgId="widgets.advanced.side" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,30 @@ describe('ChartAxisOptions', () => {
document.body.innerHTML = '';
setTimeout(done);
});
const getControlLabels = () => [...document.querySelectorAll('.control-label')]
.map(node => node.innerText.trim());
it('should render with default', () => {
ReactDOM.render(<ChartAxisOptions />, document.getElementById('container'));
const controlLabelsNodes = document.querySelectorAll('.control-label');
expect([...controlLabelsNodes].map(node => node.innerText)).toEqual([
expect(getControlLabels()).toEqual([
// y
'widgets.advanced.yAxisType',
'styleeditor.color',
'styleeditor.fontSize',
'styleeditor.fontFamily',
'widgets.advanced.prefix',
'widgets.advanced.format ',
'widgets.advanced.format',
'widgets.advanced.suffix',
'widgets.advanced.axisTickVals',
'widgets.advanced.axisTickText',
'widgets.advanced.side',
'widgets.advanced.anchor',
// x
'widgets.advanced.xAxisType',
'styleeditor.color',
'styleeditor.fontSize',
'styleeditor.fontFamily',
'widgets.advanced.axisTickVals',
'widgets.advanced.axisTickText',
'widgets.advanced.side',
'widgets.advanced.anchor'
]);
Expand Down Expand Up @@ -75,23 +80,26 @@ describe('ChartAxisOptions', () => {
}
done();
}}/>, document.getElementById('container'));
const controlLabelsNodes = document.querySelectorAll('.control-label');
expect([...controlLabelsNodes].map(node => node.innerText)).toEqual([
expect(getControlLabels()).toEqual([
// y
'widgets.advanced.yAxisType',
'styleeditor.color',
'styleeditor.fontSize',
'styleeditor.fontFamily',
'widgets.advanced.prefix',
'widgets.advanced.format ',
'widgets.advanced.format',
'widgets.advanced.suffix',
'widgets.advanced.axisTickVals',
'widgets.advanced.axisTickText',
'widgets.advanced.side',
'widgets.advanced.anchor',
// x
'widgets.advanced.xAxisType',
'styleeditor.color',
'styleeditor.fontSize',
'styleeditor.fontFamily',
'widgets.advanced.axisTickVals',
'widgets.advanced.axisTickText',
'widgets.advanced.side',
'widgets.advanced.anchor'
]);
Expand Down
4 changes: 4 additions & 0 deletions web/client/translations/data.de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,10 @@
"prefix": "Präfix",
"suffix": "Suffix",
"examples": "Beispiele",
"axisTickVals": "Achsen-Markierungswerte",
"axisTickValsTooltip": "Optional. Erzwingt, dass die Achse nur die angegebenen Werte anzeigt (kommagetrennt). Wenn auch Tick-Text gesetzt ist, wird jeder Wert mit der entsprechenden Beschriftung angezeigt.",
"axisTickText": "Achsen-Markierungstext",
"axisTickTextTooltip": "Benutzerdefinierte Beschriftungen (kommagetrennt), die anstelle der in Tick-Werte definierten Werte angezeigt werden, in der entsprechenden Reihenfolge.",
"formatExamples": "<div> <ul> <li> <code> .0% </code>: gerundeter Prozentsatz, '12% '</li> <li> <code> .2s </code>: SI -Präfix mit zwei signifikanten Ziffern, '42M' </li> <li> <code>, .2r </code>: gruppierte Tausende mit zwei signifikanten Ziffern '4.200' </li> </ul> <em>Weitere Informationen zur Formatierungssyntax <a target=\"_blank\" href=\"https://d3-wiki.readthedocs.io/zh_CN/master/Formatting/\"> hier</a>. </em> </div> ",
"formula": "Formel",
"formulaExamples": "<div>Transformiert den Wert mithilfe einer Formel. Verwenden Sie die Variable <code> value </code> im Ausdruck: <h5> Beispiele </h5> <ul> <li> <code> value + 2 </code> </li> <li> <code> value / 100 </code> </li> </ul><em>Weitere Informationen zur Syntax <a target=\"_blank\" href=\"https://github.com/m93a/filtrex#expressions\">hier</a>.</em></div>",
Expand Down
4 changes: 4 additions & 0 deletions web/client/translations/data.en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,10 @@
"prefix": "Prefix",
"suffix": "Suffix",
"examples": "Examples",
"axisTickVals": "Axis Tick Values",
"axisTickValsTooltip": "Optional. If set, forces the axis to show only these comma-separated tick values. If Tick Text is also set, each value is replaced by the label at the same index.",
"axisTickText": "Axis Tick Text",
"axisTickTextTooltip": "Comma-separated custom labels shown at the tick positions defined in Tick Values, matched by index (one label per value).",
"formatExamples": "<div><ul><li><code>.0%</code>: rounded percentage, '12%'</li><li><code>.2s</code>:SI-prefix with two significant digits, '42M'</li><li><code>,.2r</code>: grouped thousands with two significant digits '4,200'</li></ul><em>More information about formatting syntax <a target=\"_blank\" href=\"https://d3-wiki.readthedocs.io/zh_CN/master/Formatting/\">here</a>.</em></div>",
"formula": "Formula",
"formulaExamples": "<div>Transform the value using a formula. Use the variable <code>value</code> in the expression:<h5>Examples</h5><ul><li><code>value + 2</code></li><li><code>value / 100</code></li></ul><em>More information about the syntax <a target=\"_blank\" href=\"https://github.com/m93a/filtrex#expressions\">here</a>.</em></div>",
Expand Down
4 changes: 4 additions & 0 deletions web/client/translations/data.es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,10 @@
"prefix": "Prefijo",
"suffix": "Sufijo",
"examples": "Ejemplos",
"axisTickVals": "Valores de marcas del eje",
"axisTickValsTooltip": "Opcional. Fuerza el eje a mostrar solo los valores indicados (separados por comas). Si también se indica el Texto de Marca, cada valor se muestra con la etiqueta correspondiente.",
"axisTickText": "Texto de marcas del eje",
"axisTickTextTooltip": "Etiquetas personalizadas (separadas por comas) que se muestran en lugar de los valores definidos en Valores de Marca, en el orden correspondiente.",
"formatExamples": "<div> <ul> <li> <code> .0% </code>: porcentaje redondeado, '12% '</li> <li> <code> .2s </code>: SI -prefijo con dos dígitos significativos, '42M' </li> <li> <code>, .2r </code>: miles agrupados con dos dígitos significativos '4200' </li> </ul> <em> Más información sobre la sintaxis de formato <a target=\"_blank\" href=\"https://d3-wiki.readthedocs.io/zh_CN/master/Formatting/\"> aquí</a>.</em></div> ",
"formula": "Fórmula",
"formulaExamples": "<div> Transforma el valor usando una fórmula. Usa la variable <code> valor </code> en la expresión: <h5> Ejemplos </h5> <ul> <li> <code> valor + 2 </code></li><li> <code> value / 100 </code> </li> </ul><em> Más información sobre la sintaxis <a target=\"_blank\" href=\"https://github.com/m93a/filtrex#expressions\">aquí</a>.</em></div> ",
Expand Down
4 changes: 4 additions & 0 deletions web/client/translations/data.fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,10 @@
"prefix": "Prefix",
"suffix": "Suffixe",
"examples": "Exemples",
"axisTickVals": "Valeurs des graduations de l'axe",
"axisTickValsTooltip": "Optionnel. Force l'axe à n'afficher que les valeurs indiquées (séparées par des virgules). Si le Texte de Graduation est aussi renseigné, chaque valeur est affichée avec l'étiquette correspondante.",
"axisTickText": "Texte des graduations de l'axe",
"axisTickTextTooltip": "Étiquettes personnalisées (séparées par des virgules) à afficher à la place des valeurs définies dans les Valeurs de Graduation, dans l'ordre correspondant.",
"formatExamples": "<div><ul><li><code>.0%</code>: pourcentage arrondi, '12%'</li><li><code>.2s</code>:SI -préfixe avec deux chiffres significatifs, '42M' </li> <li> <code>,.2r</code>: groupé des milliers avec deux chiffres significatifs '4 200'</li> </ul> <em>Plus d'informations sur la syntaxe de formatage <a target=\"_blank\" href=\"https://d3-wiki.readthedocs.io/zh_CN/master/Formatting/\"> ici</a>.</em> </div> ",
"formula": "Formule",
"formulaExamples": "<div> Transformez la valeur à l'aide d'une formule. Utilisez la variable <code> valeur </code> dans l'expression: <h5> Exemples </h5> <ul> <li> <code> valeur + 2 </code></li><li> <code> valeur / 100 </code> </li> </ul> <em>Plus d'informations sur la syntaxe <a target=\"_blank\" href=\"https://github.com/m93a/filtrex#expressions\">ici </a>.</em></div> ",
Expand Down
4 changes: 4 additions & 0 deletions web/client/translations/data.it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,10 @@
"prefix": "Prefisso",
"suffix": "Suffisso",
"examples": "Esempi",
"axisTickVals": "Valori tacche asse",
"axisTickValsTooltip": "Opzionale. Forza l'asse a mostrare solo i valori indicati (separati da virgola). Se è presente anche il Testo Tacca, ogni valore viene visualizzato con l'etichetta corrispondente.",
"axisTickText": "Testo tacche asse",
"axisTickTextTooltip": "Etichette personalizzate (separate da virgola) da mostrare al posto dei valori definiti nei Valori Tacca, nell'ordine corrispondente.",
"formatExamples": "<div><ul><li><code>.0%</code>: percentuale arrotondata, '12%'</li><li><code>.2s</code>:Sistema internazionale con due cifre siginificative, '42M'</li><li><code>,.2r</code>: Migliaia raggruppate con due cifre siginficative '4,200'</li></ul><em>Maggior informazioni sul formato <a target=\"_blank\" href=\"https://d3-wiki.readthedocs.io/zh_CN/master/Formatting/\">qui</a>.</em> </div>",
"formula": "Formula",
"formulaExamples": "<div>Trasforma il valore utilizzando una formula. Utilizza la variable <code>value</code> nell'espressione <h5>Esempi:</h5><ul><li><code>value + 2</code></li><li><code>value / 100</code></li></ul><em> Maggiori informazioni sulla sintassi <a target=\"_blank\" href=\"https://github.com/m93a/filtrex#expressions\">qui</a>.</em></div>",
Expand Down
4 changes: 4 additions & 0 deletions web/client/translations/data.nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -2337,6 +2337,10 @@
"prefix": "Prefix",
"suffix": "Suffix",
"examples": "Voorbeelden",
"axisTickVals": "Waarden van asmarkeringen",
"axisTickValsTooltip": "Optioneel. Dwingt de as om alleen de opgegeven waarden te tonen (komma-gescheiden). Als ook Tick-tekst is ingesteld, wordt elke waarde weergegeven met het bijbehorende label.",
"axisTickText": "Tekst van asmarkeringen",
"axisTickTextTooltip": "Aangepaste labels (komma-gescheiden) die in plaats van de waarden uit Tick-waarden worden weergegeven, in de bijbehorende volgorde.",
"formatExamples": "<div><ul><li><code>.0%</code>: afgeronde percentage, '12%'</li><li><code>.2s</code>:SI-prefix met twee significante cijfers, '42M'</li><li><code>,.2r</code>: gegroepeerde duidendtallen met twee significante cijfers '4,200'</li></ul><em>Meer informatie over formattering syntaxis <a target=\"_blank\" href=\"https://d3-wiki.readthedocs.io/zh_CN/master/Formatting/\">hier</a>.</em></div>",
"formula": "Formule",
"formulaExamples": "<div>Transformeer de waarde met een formule. Gebruik een variabele <code>waarde</code> in de expressie:<h5>Voorbeelden</h5><ul><li><code>waarde + 2</code></li><li><code>waarde / 100</code></li></ul><em>Meer informatie over de syntaxis <a target=\"_blank\" href=\"https://github.com/m93a/filtrex#expressions\">hier</a>.</em></div>",
Expand Down
Loading