Rename template control bar variable names for consistency
parent
4d4b8274fe
commit
6e77bba6bd
ui
spec/shared/reducers
src
dashboards
components
containers
|
@ -4,7 +4,7 @@ import {
|
|||
disablePresentationMode,
|
||||
// delayEnablePresentationMode,
|
||||
setAutoRefresh,
|
||||
tempVarControlsToggled,
|
||||
templateControlBarVisibilityToggled,
|
||||
} from 'src/shared/actions/app'
|
||||
|
||||
describe('Shared.Reducers.appReducer', () => {
|
||||
|
@ -14,7 +14,7 @@ describe('Shared.Reducers.appReducer', () => {
|
|||
},
|
||||
persisted: {
|
||||
autoRefresh: 0,
|
||||
showTempVarControls: false,
|
||||
showTemplateControlBar: false,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,15 @@ describe('Shared.Reducers.appReducer', () => {
|
|||
expect(reducedState.persisted.autoRefresh).to.equal(expectedMs)
|
||||
})
|
||||
|
||||
it('should handle TEMP_VAR_CONTROLS_TOGGLED', () => {
|
||||
const reducedState = appReducer(initialState, tempVarControlsToggled())
|
||||
it('should handle TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED', () => {
|
||||
const reducedState = appReducer(
|
||||
initialState,
|
||||
templateControlBarVisibilityToggled()
|
||||
)
|
||||
|
||||
const expectedTestState = !reducedState.persisted.showTempVarControls
|
||||
const expectedTestState = !reducedState.persisted.showTemplateControlBar
|
||||
|
||||
expect(initialState.persisted.showTempVarControls).to.equal(
|
||||
expect(initialState.persisted.showTemplateControlBar).to.equal(
|
||||
expectedTestState
|
||||
)
|
||||
})
|
||||
|
|
|
@ -20,7 +20,7 @@ const Dashboard = ({
|
|||
templatesIncludingDashTime,
|
||||
onSummonOverlayTechnologies,
|
||||
onSelectTemplate,
|
||||
showTempVarControls,
|
||||
showTemplateControlBar,
|
||||
}) => {
|
||||
if (dashboard.id === 0) {
|
||||
return null
|
||||
|
@ -54,7 +54,7 @@ const Dashboard = ({
|
|||
templates={dashboard.templates}
|
||||
onSelectTemplate={onSelectTemplate}
|
||||
onOpenTemplateManager={onOpenTemplateManager}
|
||||
isOpen={showTempVarControls}
|
||||
isOpen={showTemplateControlBar}
|
||||
/>}
|
||||
{cells.length
|
||||
? <LayoutRenderer
|
||||
|
@ -121,7 +121,7 @@ Dashboard.propTypes = {
|
|||
timeRange: shape({}).isRequired,
|
||||
onOpenTemplateManager: func.isRequired,
|
||||
onSelectTemplate: func.isRequired,
|
||||
showTempVarControls: bool,
|
||||
showTemplateControlBar: bool,
|
||||
}
|
||||
|
||||
export default Dashboard
|
||||
|
|
|
@ -21,7 +21,7 @@ const DashboardHeader = ({
|
|||
onAddCell,
|
||||
onEditDashboard,
|
||||
onToggleTempVarControls,
|
||||
showTempVarControls,
|
||||
showTemplateControlBar,
|
||||
}) =>
|
||||
isHidden
|
||||
? null
|
||||
|
@ -65,7 +65,7 @@ const DashboardHeader = ({
|
|||
{dashboard
|
||||
? <div
|
||||
className={classnames('btn btn-info btn-sm', {
|
||||
active: showTempVarControls,
|
||||
active: showTemplateControlBar,
|
||||
})}
|
||||
onClick={onToggleTempVarControls}
|
||||
>
|
||||
|
@ -109,7 +109,7 @@ DashboardHeader.propTypes = {
|
|||
onAddCell: func,
|
||||
onEditDashboard: func,
|
||||
onToggleTempVarControls: func,
|
||||
showTempVarControls: bool,
|
||||
showTemplateControlBar: bool,
|
||||
}
|
||||
|
||||
export default DashboardHeader
|
||||
|
|
|
@ -17,7 +17,7 @@ import * as dashboardActionCreators from 'src/dashboards/actions'
|
|||
|
||||
import {
|
||||
setAutoRefresh,
|
||||
tempVarControlsToggled as tempVarControlsToggledAction,
|
||||
templateControlBarVisibilityToggled as templateControlBarVisibilityToggledAction,
|
||||
} from 'shared/actions/app'
|
||||
import {presentationButtonDispatcher} from 'shared/dispatchers'
|
||||
|
||||
|
@ -211,7 +211,7 @@ class DashboardPage extends Component {
|
|||
}
|
||||
|
||||
handleToggleTempVarControls() {
|
||||
this.props.tempVarControlsToggled()
|
||||
this.props.templateControlBarVisibilityToggled()
|
||||
}
|
||||
|
||||
getActiveDashboard() {
|
||||
|
@ -223,7 +223,7 @@ class DashboardPage extends Component {
|
|||
const {
|
||||
source,
|
||||
timeRange,
|
||||
showTempVarControls,
|
||||
showTemplateControlBar,
|
||||
dashboards,
|
||||
autoRefresh,
|
||||
cellQueryStatus,
|
||||
|
@ -299,7 +299,7 @@ class DashboardPage extends Component {
|
|||
onAddCell={this.handleAddCell}
|
||||
onEditDashboard={this.handleEditDashboard}
|
||||
onToggleTempVarControls={this.handleToggleTempVarControls}
|
||||
showTempVarControls={showTempVarControls}
|
||||
showTemplateControlBar={showTemplateControlBar}
|
||||
>
|
||||
{dashboards
|
||||
? dashboards.map((d, i) => (
|
||||
|
@ -331,7 +331,7 @@ class DashboardPage extends Component {
|
|||
templatesIncludingDashTime={templatesIncludingDashTime}
|
||||
onSummonOverlayTechnologies={this.handleSummonOverlayTechnologies}
|
||||
onSelectTemplate={this.handleSelectTemplate}
|
||||
showTempVarControls={showTempVarControls}
|
||||
showTemplateControlBar={showTemplateControlBar}
|
||||
/>
|
||||
: null}
|
||||
</div>
|
||||
|
@ -389,9 +389,9 @@ DashboardPage.propTypes = {
|
|||
),
|
||||
handleChooseAutoRefresh: func.isRequired,
|
||||
autoRefresh: number.isRequired,
|
||||
tempVarControlsToggled: func.isRequired,
|
||||
templateControlBarVisibilityToggled: func.isRequired,
|
||||
timeRange: shape({}).isRequired,
|
||||
showTempVarControls: bool.isRequired,
|
||||
showTemplateControlBar: bool.isRequired,
|
||||
inPresentationMode: bool.isRequired,
|
||||
handleClickPresentationButton: func,
|
||||
cellQueryStatus: shape({
|
||||
|
@ -405,7 +405,7 @@ const mapStateToProps = state => {
|
|||
const {
|
||||
app: {
|
||||
ephemeral: {inPresentationMode},
|
||||
persisted: {autoRefresh, showTempVarControls},
|
||||
persisted: {autoRefresh, showTemplateControlBar},
|
||||
},
|
||||
dashboardUI: {dashboards, timeRange, cellQueryStatus},
|
||||
} = state
|
||||
|
@ -414,7 +414,7 @@ const mapStateToProps = state => {
|
|||
dashboards,
|
||||
autoRefresh,
|
||||
timeRange,
|
||||
showTempVarControls,
|
||||
showTemplateControlBar,
|
||||
inPresentationMode,
|
||||
cellQueryStatus,
|
||||
}
|
||||
|
@ -422,8 +422,8 @@ const mapStateToProps = state => {
|
|||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
handleChooseAutoRefresh: bindActionCreators(setAutoRefresh, dispatch),
|
||||
tempVarControlsToggled: bindActionCreators(
|
||||
tempVarControlsToggledAction,
|
||||
templateControlBarVisibilityToggled: bindActionCreators(
|
||||
templateControlBarVisibilityToggledAction,
|
||||
dispatch
|
||||
),
|
||||
handleClickPresentationButton: presentationButtonDispatcher(dispatch),
|
||||
|
|
|
@ -24,8 +24,8 @@ export const setAutoRefresh = milliseconds => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const tempVarControlsToggled = () => ({
|
||||
type: 'TEMP_VAR_CONTROLS_TOGGLED',
|
||||
export const templateControlBarVisibilityToggled = () => ({
|
||||
type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED',
|
||||
})
|
||||
|
||||
export const noop = () => ({
|
||||
|
|
|
@ -8,7 +8,7 @@ const initialState = {
|
|||
},
|
||||
persisted: {
|
||||
autoRefresh: AUTOREFRESH_DEFAULT,
|
||||
showTempVarControls: false,
|
||||
showTemplateControlBar: false,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -47,10 +47,10 @@ const appPersistedReducer = (state = initialAppPersistedState, action) => {
|
|||
}
|
||||
}
|
||||
|
||||
case 'TEMP_VAR_CONTROLS_TOGGLED': {
|
||||
const {showTempVarControls} = state
|
||||
case 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED': {
|
||||
const {showTemplateControlBar} = state
|
||||
|
||||
return {...state, showTempVarControls: !showTempVarControls}
|
||||
return {...state, showTemplateControlBar: !showTemplateControlBar}
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue