mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add a user preference to enable/disable alternating row background colors in the data output of query tool. #8134
Fixed some theme related issues.
This commit is contained in:
parent
da530824d6
commit
9ef5a53790
@ -505,6 +505,8 @@ preferences for copied data.
|
|||||||
character for copied data.
|
character for copied data.
|
||||||
* Use the *Result copy quoting* drop-down listbox to select which type of fields
|
* Use the *Result copy quoting* drop-down listbox to select which type of fields
|
||||||
require quoting; select *All*, *None*, or *Strings*.
|
require quoting; select *All*, *None*, or *Strings*.
|
||||||
|
* When the *Striped rows?* switch is set to true, the result grid will display
|
||||||
|
rows with alternating background colors.
|
||||||
|
|
||||||
.. image:: images/preferences_sql_keyboard_shortcuts.png
|
.. image:: images/preferences_sql_keyboard_shortcuts.png
|
||||||
:alt: Preferences dialog sql keyboard shortcuts section
|
:alt: Preferences dialog sql keyboard shortcuts section
|
||||||
|
@ -17,10 +17,10 @@ export default function(basicSettings) {
|
|||||||
default: {
|
default: {
|
||||||
main: '#6b6b6b',
|
main: '#6b6b6b',
|
||||||
contrastText: '#fff',
|
contrastText: '#fff',
|
||||||
borderColor: '#2e2e2e',
|
borderColor: '#282828',
|
||||||
disabledBorderColor: '#2e2e2e',
|
disabledBorderColor: '#282828',
|
||||||
disabledContrastText: '#fff',
|
disabledContrastText: '#fff',
|
||||||
hoverMain: '#303030',
|
hoverMain: '#333333',
|
||||||
hoverContrastText: '#fff',
|
hoverContrastText: '#fff',
|
||||||
hoverBorderColor: '#151515',
|
hoverBorderColor: '#151515',
|
||||||
},
|
},
|
||||||
@ -41,9 +41,9 @@ export default function(basicSettings) {
|
|||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
main: '#da6758',
|
main: '#da6758',
|
||||||
light: '#212121',
|
light: '#1e1e1e',
|
||||||
contrastText: '#fff',
|
contrastText: '#fff',
|
||||||
lighter: '#212121',
|
lighter: '#1e1e1e',
|
||||||
},
|
},
|
||||||
warning: {
|
warning: {
|
||||||
main: '#eea236',
|
main: '#eea236',
|
||||||
@ -55,9 +55,9 @@ export default function(basicSettings) {
|
|||||||
},
|
},
|
||||||
grey: {
|
grey: {
|
||||||
'200': '#424242',
|
'200': '#424242',
|
||||||
'400': '#303030',
|
'400': '#333333',
|
||||||
'600': '#2e2e2e',
|
'600': '#282828',
|
||||||
'800': '#212121',
|
'800': '#1e1e1e',
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
primary: '#d4d4d4',
|
primary: '#d4d4d4',
|
||||||
@ -67,19 +67,19 @@ export default function(basicSettings) {
|
|||||||
disabled: '#6b6b6b'
|
disabled: '#6b6b6b'
|
||||||
},
|
},
|
||||||
background: {
|
background: {
|
||||||
paper: '#212121',
|
paper: '#1e1e1e',
|
||||||
default: '#212121',
|
default: '#1e1e1e',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
custom: {
|
custom: {
|
||||||
icon: {
|
icon: {
|
||||||
main: '#6b6b6b',
|
main: '#6b6b6b',
|
||||||
contrastText: '#fff',
|
contrastText: '#fff',
|
||||||
borderColor: darken('#2e2e2e', 0.6),
|
borderColor: darken('#282828', 0.6),
|
||||||
disabledMain: '#6b6b6b',
|
disabledMain: '#6b6b6b',
|
||||||
disabledContrastText: '#fff',
|
disabledContrastText: '#fff',
|
||||||
disabledBorderColor: '#2e2e2e',
|
disabledBorderColor: '#282828',
|
||||||
hoverMain: '#303030',
|
hoverMain: '#333333',
|
||||||
hoverContrastText: '#fff',
|
hoverContrastText: '#fff',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -98,15 +98,16 @@ export default function(basicSettings) {
|
|||||||
stepBg: '#FFFFFF',
|
stepBg: '#FFFFFF',
|
||||||
stepFg: '#000',
|
stepFg: '#000',
|
||||||
toggleBtnBg: '#000',
|
toggleBtnBg: '#000',
|
||||||
editorToolbarBg: '#303030',
|
editorToolbarBg: '#333333',
|
||||||
qtDatagridBg: '#2e2e2e',
|
qtDatagridBg: '#282828',
|
||||||
qtDatagridSelectFg: '#d4d4d4',
|
qtDatagridSelectFg: '#d4d4d4',
|
||||||
cardHeaderBg: '#424242',
|
cardHeaderBg: '#424242',
|
||||||
colorFg: '#FFFFFF',
|
colorFg: '#FFFFFF',
|
||||||
emptySpaceBg: '#212121',
|
emptySpaceBg: '#1e1e1e',
|
||||||
textMuted: '#8A8A8A',
|
textMuted: '#8A8A8A',
|
||||||
erdCanvasBg: '#303030',
|
erdCanvasBg: '#333333',
|
||||||
erdGridColor: '#444952',
|
erdGridColor: '#444952',
|
||||||
|
noteBg: '#4a4a4a',
|
||||||
scroll: {
|
scroll: {
|
||||||
baseColor: '#616161',
|
baseColor: '#616161',
|
||||||
barBackgroundColor: '#61616133',
|
barBackgroundColor: '#61616133',
|
||||||
@ -122,7 +123,7 @@ export default function(basicSettings) {
|
|||||||
},
|
},
|
||||||
editor: {
|
editor: {
|
||||||
fg: '#fff',
|
fg: '#fff',
|
||||||
bg: '#212121',
|
bg: '#1e1e1e',
|
||||||
selectionBg: '#536270',
|
selectionBg: '#536270',
|
||||||
keyword: '#db7c74',
|
keyword: '#db7c74',
|
||||||
number: '#7fcc5c',
|
number: '#7fcc5c',
|
||||||
@ -138,14 +139,14 @@ export default function(basicSettings) {
|
|||||||
activeline: '#323e43',
|
activeline: '#323e43',
|
||||||
activelineLight: '#323e43',
|
activelineLight: '#323e43',
|
||||||
currentQueryBorderColor: '#A5CBE2',
|
currentQueryBorderColor: '#A5CBE2',
|
||||||
guttersBg: '#303030',
|
guttersBg: '#333333',
|
||||||
guttersFg: '#8A8A8A',
|
guttersFg: '#8A8A8A',
|
||||||
},
|
},
|
||||||
tree: {
|
tree: {
|
||||||
textFg: '#d4d4d4',
|
textFg: '#d4d4d4',
|
||||||
inputBg: '#212121',
|
inputBg: '#1e1e1e',
|
||||||
fgHover: '#d4d4d4',
|
fgHover: '#d4d4d4',
|
||||||
bgHover: '#303030',
|
bgHover: '#333333',
|
||||||
textHoverFg: '#d4d4d4',
|
textHoverFg: '#d4d4d4',
|
||||||
bgSelected: '#323E43',
|
bgSelected: '#323E43',
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ export default function(basicSettings) {
|
|||||||
main: '#84D6FF',
|
main: '#84D6FF',
|
||||||
light: '#84D6FF',
|
light: '#84D6FF',
|
||||||
contrastText: '#010B15',
|
contrastText: '#010B15',
|
||||||
|
contrastTextLight: '#010B15',
|
||||||
hoverMain: '#fff',
|
hoverMain: '#fff',
|
||||||
hoverBorderColor: '#fff',
|
hoverBorderColor: '#fff',
|
||||||
disabledMain: '#8B9CAD',
|
disabledMain: '#8B9CAD',
|
||||||
@ -39,12 +40,12 @@ export default function(basicSettings) {
|
|||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
main: '#EE7A55',
|
main: '#EE7A55',
|
||||||
light: '#EE7A55',
|
light: '#010B15',
|
||||||
contrastText: '#010B15',
|
contrastText: '#010B15',
|
||||||
},
|
},
|
||||||
warning: {
|
warning: {
|
||||||
main: '#F4D35E',
|
main: '#F4D35E',
|
||||||
light: '#F4D35E',
|
light: '#010B15',
|
||||||
contrastText: '#010B15',
|
contrastText: '#010B15',
|
||||||
},
|
},
|
||||||
info: {
|
info: {
|
||||||
@ -83,7 +84,7 @@ export default function(basicSettings) {
|
|||||||
otherVars: {
|
otherVars: {
|
||||||
colorBrand: '#84D6FF',
|
colorBrand: '#84D6FF',
|
||||||
borderColor: '#A6B7C8',
|
borderColor: '#A6B7C8',
|
||||||
inputBorderColor: '#6b6b6b',
|
inputBorderColor: '#8B9CAD',
|
||||||
inputDisabledBg: '#1F2932',
|
inputDisabledBg: '#1F2932',
|
||||||
errorColor: '#DA6758',
|
errorColor: '#DA6758',
|
||||||
headerBg: '#010B15',
|
headerBg: '#010B15',
|
||||||
@ -104,6 +105,7 @@ export default function(basicSettings) {
|
|||||||
textMuted: '#8b9cad',
|
textMuted: '#8b9cad',
|
||||||
erdCanvasBg: '#010B15',
|
erdCanvasBg: '#010B15',
|
||||||
erdGridColor: '#1F2932',
|
erdGridColor: '#1F2932',
|
||||||
|
noteBg: '#010B15',
|
||||||
scroll: {
|
scroll: {
|
||||||
baseColor: '#C9D0D7',
|
baseColor: '#C9D0D7',
|
||||||
barBackgroundColor: '#C9D0D733',
|
barBackgroundColor: '#C9D0D733',
|
||||||
|
@ -646,6 +646,20 @@ function getFinalTheme(baseTheme) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
MuiRadio: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: {
|
||||||
|
padding: '0px',
|
||||||
|
color: baseTheme.otherVars.inputBorderColor,
|
||||||
|
},
|
||||||
|
|
||||||
|
colorPrimary: {
|
||||||
|
'&.Mui-disabled': {
|
||||||
|
color: baseTheme.palette.checkbox.disabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
MuiToggleButton: {
|
MuiToggleButton: {
|
||||||
styleOverrides: {
|
styleOverrides: {
|
||||||
root: {
|
root: {
|
||||||
|
@ -114,6 +114,7 @@ export default function(basicSettings) {
|
|||||||
textMuted: '#646B82',
|
textMuted: '#646B82',
|
||||||
erdCanvasBg: '#fff',
|
erdCanvasBg: '#fff',
|
||||||
erdGridColor: '#bac1cd',
|
erdGridColor: '#bac1cd',
|
||||||
|
noteBg: '#dde0e6',
|
||||||
explain: {
|
explain: {
|
||||||
sev2: {
|
sev2: {
|
||||||
color: '#222222',
|
color: '#222222',
|
||||||
|
@ -77,8 +77,9 @@ const Root = styled('div')(({theme}) => ({
|
|||||||
},
|
},
|
||||||
'& .Form-noteRoot': {
|
'& .Form-noteRoot': {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
backgroundColor: theme.otherVars.borderColor,
|
backgroundColor: theme.otherVars.noteBg,
|
||||||
padding: theme.spacing(1),
|
padding: theme.spacing(1),
|
||||||
|
border: `1px solid ${theme.otherVars.borderColor}`
|
||||||
},
|
},
|
||||||
'& .Form-plainstring': {
|
'& .Form-plainstring': {
|
||||||
padding: theme.spacing(0.5),
|
padding: theme.spacing(0.5),
|
||||||
@ -623,14 +624,14 @@ FormInputCheckbox.propTypes = {
|
|||||||
labelTooltip: PropTypes.string
|
labelTooltip: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export function InputRadio({ helpid, value, onChange, controlProps, readonly, labelPlacement, ...props }) {
|
export function InputRadio({ helpid, value, onChange, controlProps, readonly, labelPlacement, disabled }) {
|
||||||
controlProps = controlProps || {};
|
controlProps = controlProps || {};
|
||||||
return (
|
return (
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Radio
|
<Radio
|
||||||
color="primary"
|
color="primary"
|
||||||
checked={props?.disabled ? false : value }
|
checked={value}
|
||||||
onChange={
|
onChange={
|
||||||
readonly ? () => {
|
readonly ? () => {
|
||||||
/*This is intentional (SonarQube)*/ } : onChange
|
/*This is intentional (SonarQube)*/ } : onChange
|
||||||
@ -638,13 +639,12 @@ export function InputRadio({ helpid, value, onChange, controlProps, readonly, la
|
|||||||
value={value}
|
value={value}
|
||||||
name="radio-button-demo"
|
name="radio-button-demo"
|
||||||
inputProps={{ 'aria-label': value, 'aria-describedby': helpid }}
|
inputProps={{ 'aria-label': value, 'aria-describedby': helpid }}
|
||||||
style={{ padding: 0 }}
|
|
||||||
disableRipple
|
disableRipple
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
disabled={disabled}
|
||||||
label={controlProps.label}
|
label={controlProps.label}
|
||||||
labelPlacement={labelPlacement}
|
labelPlacement={labelPlacement}
|
||||||
className={(readonly || props.disabled) ? 'Form-readOnlySwitch' : null}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import { isMac } from '../../../../../../static/js/keyboard_shortcuts';
|
|||||||
export const ROWNUM_KEY = '$_pgadmin_rownum_key_$';
|
export const ROWNUM_KEY = '$_pgadmin_rownum_key_$';
|
||||||
export const GRID_ROW_SELECT_KEY = '$_pgadmin_gridrowselect_key_$';
|
export const GRID_ROW_SELECT_KEY = '$_pgadmin_gridrowselect_key_$';
|
||||||
|
|
||||||
const StyledPgReactDataGrid = styled(PgReactDataGrid)(({theme})=>({
|
const StyledPgReactDataGrid = styled(PgReactDataGrid)(({stripedRows, theme})=>({
|
||||||
'& .QueryTool-columnHeader': {
|
'& .QueryTool-columnHeader': {
|
||||||
padding: '3px 6px',
|
padding: '3px 6px',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
@ -67,9 +67,9 @@ const StyledPgReactDataGrid = styled(PgReactDataGrid)(({theme})=>({
|
|||||||
backgroundColor: theme.palette.primary.light,
|
backgroundColor: theme.palette.primary.light,
|
||||||
color: theme.otherVars.qtDatagridSelectFg,
|
color: theme.otherVars.qtDatagridSelectFg,
|
||||||
},
|
},
|
||||||
'& .rdg-row.rdg-row-even': {
|
... stripedRows && {'& .rdg-row.rdg-row-even': {
|
||||||
backgroundColor: theme.palette.grey[200],
|
backgroundColor: theme.palette.grey[400],
|
||||||
},
|
}},
|
||||||
'& .rdg-row': {
|
'& .rdg-row': {
|
||||||
'& .rdg-cell:nth-of-type(1)': {
|
'& .rdg-cell:nth-of-type(1)': {
|
||||||
backgroundColor: theme.palette.grey[600],
|
backgroundColor: theme.palette.grey[600],
|
||||||
|
@ -1536,6 +1536,7 @@ export function ResultSet() {
|
|||||||
onSelectedColumnsChange={setSelectedColumns}
|
onSelectedColumnsChange={setSelectedColumns}
|
||||||
onSelectedCellChange={setSelectedCell}
|
onSelectedCellChange={setSelectedCell}
|
||||||
onSelectedRangeChange={setSelectedRange}
|
onSelectedRangeChange={setSelectedRange}
|
||||||
|
stripedRows={queryToolCtx.preferences?.sqleditor?.striped_rows}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</>}
|
</>}
|
||||||
|
@ -357,6 +357,14 @@ def register_query_tool_preferences(self):
|
|||||||
' file.')
|
' file.')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.stripped_rows = self.preference.register(
|
||||||
|
'Results_grid', 'striped_rows',
|
||||||
|
gettext("Striped rows?"), 'boolean',
|
||||||
|
True, category_label=PREF_LABEL_RESULTS_GRID,
|
||||||
|
help_str=gettext('If set to true, the result grid will display'
|
||||||
|
' rows with alternating background colors.')
|
||||||
|
)
|
||||||
|
|
||||||
self.sql_font_size = self.preference.register(
|
self.sql_font_size = self.preference.register(
|
||||||
'Editor', 'sql_font_size',
|
'Editor', 'sql_font_size',
|
||||||
gettext("Font size"), 'numeric', '1',
|
gettext("Font size"), 'numeric', '1',
|
||||||
|
Loading…
Reference in New Issue
Block a user