Replce "synch" with "sync" in blueprint courses

fixes MC-202

test plan:
  - create a master course with some content
  - associate a minion course
  - change a couple things in the maser course
  - open the sidebar
  > expect "Unsynced Changes"
  - click on Unsyncd Changes button
  > expect modal to open titled Unsynced Changes

Change-Id: Ia02646a661887f3f9beafe21f7c2cfe1c9452094
Reviewed-on: https://gerrit.instructure.com/111498
Tested-by: Jenkins
Reviewed-by: Felix Milea-Ciobanu <fmileaciobanu@instructure.com>
QA-Review: David Mirabile <dmirabile-c@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
This commit is contained in:
Ed Schiebel 2017-05-11 13:02:53 -04:00
parent a7ac0edf12
commit e2ebcf2c4e
13 changed files with 113 additions and 113 deletions

View File

@ -38,7 +38,7 @@ const types = [
'ADD_COURSE_ASSOCIATIONS', 'UNDO_ADD_COURSE_ASSOCIATIONS',
'REMOVE_COURSE_ASSOCIATIONS', 'UNDO_REMOVE_COURSE_ASSOCIATIONS',
'CLEAR_ASSOCIATIONS',
'LOAD_UNSYNCHED_CHANGES_START', 'LOAD_UNSYNCHED_CHANGES_SUCCESS', 'LOAD_UNSYNCHED_CHANGES_FAIL',
'LOAD_UNSYNCED_CHANGES_START', 'LOAD_UNSYNCED_CHANGES_SUCCESS', 'LOAD_UNSYNCED_CHANGES_FAIL',
'ENABLE_SEND_NOTIFICATION', 'INCLUDE_CUSTOM_NOTIFICATION_MESSAGE', 'SET_NOTIFICATION_MESSAGE'
]
const actions = createActions(...types)
@ -145,11 +145,11 @@ actions.saveAssociations = () => (dispatch, getState) => {
.catch(handleError(I18n.t('An error occurred while saving associations'), dispatch, actions.saveAssociationsFail))
}
actions.loadUnsynchedChanges = () => (dispatch, getState) => {
dispatch(actions.loadUnsynchedChangesStart())
api.loadUnsynchedChanges(getState())
.then(res => dispatch(actions.loadUnsynchedChangesSuccess(res.data)))
.catch(err => dispatch(actions.loadUnsynchedChangesFail(err)))
actions.loadUnsyncedChanges = () => (dispatch, getState) => {
dispatch(actions.loadUnsyncedChangesStart())
api.loadUnsyncedChanges(getState())
.then(res => dispatch(actions.loadUnsyncedChangesSuccess(res.data)))
.catch(err => dispatch(actions.loadUnsyncedChangesFail(err)))
}
const actionTypes = types.reduce((typesMap, actionType) =>

View File

@ -125,7 +125,7 @@ const ApiClient = {
})
},
loadUnsynchedChanges ({ course }) {
loadUnsyncedChanges ({ course }) {
return axios.get(`/api/v1/courses/${course.id}/blueprint_templates/default/unsynced_changes`)
},
}

View File

@ -35,7 +35,7 @@ import BlueprintModal from './BlueprintModal'
import { ConnectedMigrationSync as MigrationSync } from './MigrationSync'
import { ConnectedEnableNotification as EnableNotification } from './EnableNotification'
let UnsynchedChanges = null
let UnsyncedChanges = null
let SyncHistory = null
let BlueprintAssociations = null
@ -50,16 +50,16 @@ export default class CourseSidebar extends Component {
isSavingAssociations: PropTypes.bool.isRequired,
willSendNotification: PropTypes.bool.isRequired,
enableSendNotification: PropTypes.func.isRequired,
loadUnsynchedChanges: PropTypes.func.isRequired,
isLoadingUnsynchedChanges: PropTypes.bool.isRequired,
hasLoadedUnsynchedChanges: PropTypes.bool.isRequired,
unsynchedChanges: propTypes.unsynchedChanges,
loadUnsyncedChanges: PropTypes.func.isRequired,
isLoadingUnsyncedChanges: PropTypes.bool.isRequired,
hasLoadedUnsyncedChanges: PropTypes.bool.isRequired,
unsyncedChanges: propTypes.unsyncedChanges,
isLoadingBeginMigration: PropTypes.bool.isRequired,
migrationStatus: propTypes.migrationState,
}
static defaultProps = {
unsynchedChanges: [],
unsyncedChanges: [],
migrationStatus: MigrationStates.unknown,
}
@ -74,10 +74,10 @@ export default class CourseSidebar extends Component {
componentWillReceiveProps (nextProps) {
// if migration is going from a loading state to a non-loading state
// aka a migration probably just ended and we should refresh the list
// of unsynched changes
// of unsynced changes
if (MigrationStates.isLoadingState(this.props.migrationStatus) &&
!MigrationStates.isLoadingState(nextProps.migrationStatus)) {
this.props.loadUnsynchedChanges()
this.props.loadUnsyncedChanges()
}
}
@ -85,8 +85,8 @@ export default class CourseSidebar extends Component {
if (!this.props.hasLoadedAssociations) {
this.props.loadAssociations()
}
if (!this.props.hasLoadedUnsynchedChanges) {
this.props.loadUnsynchedChanges()
if (!this.props.hasLoadedUnsyncedChanges) {
this.props.loadUnsyncedChanges()
}
}
@ -117,27 +117,27 @@ export default class CourseSidebar extends Component {
},
children: () => <SyncHistory />,
}),
unsynchedChanges: () => ({
unsyncedChanges: () => ({
props: {
title: I18n.t('Unsynched Changes'),
hasChanges: this.props.unsynchedChanges.length > 0,
title: I18n.t('Unsynced Changes'),
hasChanges: this.props.unsyncedChanges.length > 0,
willSendNotification: this.props.willSendNotification,
enableSendNotification: this.props.enableSendNotification,
onCancel: () => this.closeModal(() => {
this.unsynchedChangesBtn.focus()
this.unsyncedChangesBtn.focus()
}),
doneButton: <MigrationSync
showProgress={false}
onClick={() => this.closeModal(() => {
if (this.unsynchedChangesBtn) {
this.unsynchedChangesBtn.focus()
if (this.unsyncedChangesBtn) {
this.unsyncedChangesBtn.focus()
} else {
this.syncHistoryBtn.focus()
}
})}
/>
},
children: () => <UnsynchedChanges />,
children: () => <UnsyncedChanges />,
})
}
@ -175,17 +175,17 @@ export default class CourseSidebar extends Component {
})
}
handleUnsynchedChangesClick = () => {
handleUnsyncedChangesClick = () => {
require.ensure([], (require) => {
// lazy load UnsynchedChanges component
const UnsynchedChangesModule = require('./UnsynchedChanges')
if (UnsynchedChanges === null) {
UnsynchedChanges = UnsynchedChangesModule.ConnectedUnsynchedChanges
// lazy load UnsyncedChanges component
const UnsyncedChangesModule = require('./UnsyncedChanges')
if (UnsyncedChanges === null) {
UnsyncedChanges = UnsyncedChangesModule.ConnectedUnsyncedChanges
}
this.setState({
isModalOpen: true,
modalId: 'unsynchedChanges',
modalId: 'unsyncedChanges',
})
})
}
@ -195,9 +195,9 @@ export default class CourseSidebar extends Component {
this.props.enableSendNotification(enabled)
}
// if we have unsynched changes, show the sync button
// if we have unsynced changes, show the sync button
maybeRenderSyncButton () {
if (this.props.hasLoadedUnsynchedChanges && this.props.unsynchedChanges.length > 0) {
if (this.props.hasLoadedUnsyncedChanges && this.props.unsyncedChanges.length > 0) {
return (
<div className="bcs__row bcs__row-sync-holder">
<MigrationSync />
@ -207,11 +207,11 @@ export default class CourseSidebar extends Component {
return null
}
// if we have unsynched changes, show the button
maybeRenderUnsynchedChanges () {
// if we have unsynced changes, show the button
maybeRenderUnsyncedChanges () {
// if loading changes, show spinner
if (!this.props.hasLoadedUnsynchedChanges || this.props.isLoadingUnsynchedChanges) {
return this.renderSpinner(I18n.t('Loading Unsynched Changes'))
if (!this.props.hasLoadedUnsyncedChanges || this.props.isLoadingUnsyncedChanges) {
return this.renderSpinner(I18n.t('Loading Unsynced Changes'))
}
// if syncing, hide
const isSyncing = MigrationStates.isLoadingState(this.props.migrationStatus) || this.props.isLoadingBeginMigration
@ -219,18 +219,18 @@ export default class CourseSidebar extends Component {
return null
}
// if changes are loaded, show me
if (this.props.hasLoadedUnsynchedChanges && this.props.unsynchedChanges.length > 0) {
if (this.props.hasLoadedUnsyncedChanges && this.props.unsyncedChanges.length > 0) {
return (
<div className="bcs__row">
<Button
id="mcUnsynchedChangesBtn"
ref={(c) => { this.unsynchedChangesBtn = c }}
id="mcUnsyncedChangesBtn"
ref={(c) => { this.unsyncedChangesBtn = c }}
variant="link"
onClick={this.handleUnsynchedChangesClick}
onClick={this.handleUnsyncedChangesClick}
>
<Typography>{I18n.t('Unsynched Changes')}</Typography>
<Typography>{I18n.t('Unsynced Changes')}</Typography>
</Button>
<Typography><span className="bcs__row-right-content">{this.props.unsynchedChanges.length}</span></Typography>
<Typography><span className="bcs__row-right-content">{this.props.unsyncedChanges.length}</span></Typography>
<EnableNotification />
</div>
)
@ -270,7 +270,7 @@ export default class CourseSidebar extends Component {
<Typography>{I18n.t('Sync History')}</Typography>
</Button>
</div>
{this.maybeRenderUnsynchedChanges()}
{this.maybeRenderUnsyncedChanges()}
{this.maybeRenderSyncButton()}
{this.renderModal()}
</BlueprintSidebar>
@ -286,9 +286,9 @@ const connectState = state =>
'isSavingAssociations',
['existingAssociations', 'associations'],
'willSendNotification',
'unsynchedChanges',
'isLoadingUnsynchedChanges',
'hasLoadedUnsynchedChanges',
'unsyncedChanges',
'isLoadingUnsyncedChanges',
'hasLoadedUnsyncedChanges',
'migrationStatus'
]), {
hasAssociationChanges: (state.addedAssociations.length + state.removedAssociations.length) > 0,

View File

@ -27,13 +27,13 @@ import IconUnlockSolid from 'instructure-icons/lib/Solid/IconUnlockSolid'
import propTypes from '../propTypes'
import {itemTypeLabels, changeTypeLabels} from '../labels'
const UnsynchedChange = (props) => {
const UnsyncedChange = (props) => {
const {asset_type, asset_name, change_type, locked} = props.change
/* eslint-disable camelcase */
return (
<div className="bcs__history-item__change">
<div className="bcs__history-item__content bcs__unsynched-change__content">
<div className="bcs__history-item__content bcs__unsynced-change__content">
<div className="bcs__history-item__lock-icon">
<Typography size="large" color="secondary">{locked ? <IconLockSolid /> : <IconUnlockSolid />}</Typography>
</div>
@ -61,8 +61,8 @@ const UnsynchedChange = (props) => {
}
UnsynchedChange.propTypes = {
change: propTypes.unsynchedChange.isRequired
UnsyncedChange.propTypes = {
change: propTypes.unsyncedChange.isRequired
}
export default UnsynchedChange
export default UnsyncedChange

View File

@ -25,26 +25,26 @@ import select from 'jsx/shared/select'
import Alert from 'instructure-ui/lib/components/Alert'
import Heading from 'instructure-ui/lib/components/Heading'
import UnsynchedChange from './UnsynchedChange'
import UnsyncedChange from './UnsyncedChange'
import { ConnectedEnableNotification as EnableNotification } from './EnableNotification'
import actions from '../actions'
import propTypes from '../propTypes'
export default class UnsynchedChanges extends Component {
export default class UnsyncedChanges extends Component {
static propTypes = {
unsynchedChanges: propTypes.unsynchedChanges,
unsyncedChanges: propTypes.unsyncedChanges,
}
static defaultProps = {
unsynchedChanges: [],
unsyncedChanges: [],
}
maybeRenderChanges () {
return (
this.props.unsynchedChanges.length === 0
this.props.unsyncedChanges.length === 0
?
<Alert variant="info">{I18n.t('There are no unsynched changes')}</Alert>
<Alert variant="info">{I18n.t('There are no unsynced changes')}</Alert>
:
this.renderChanges()
)
@ -52,14 +52,14 @@ export default class UnsynchedChanges extends Component {
renderChanges () {
return (
<div className="bcs__history-item bcs__unsynched-changes">
<div className="bcs__history-item bcs__unsynced-changes">
<header className="bcs__history-item__title">
<Heading level="h3">
{I18n.t('%{count} Unsynched Changes', {count: this.props.unsynchedChanges.length})}
{I18n.t('%{count} Unsynced Changes', {count: this.props.unsyncedChanges.length})}
</Heading>
</header>
{this.props.unsynchedChanges.map(change =>
(<UnsynchedChange key={change.asset_id} change={change} />)
{this.props.unsyncedChanges.map(change =>
(<UnsyncedChange key={change.asset_id} change={change} />)
)}
<EnableNotification />
</div>
@ -77,7 +77,7 @@ export default class UnsynchedChanges extends Component {
const connectState = state =>
select(state, [
'unsynchedChanges',
'unsyncedChanges',
])
const connectActions = dispatch => bindActionCreators(actions, dispatch)
export const ConnectedUnsynchedChanges = connect(connectState, connectActions)(UnsynchedChanges)
export const ConnectedUnsyncedChanges = connect(connectState, connectActions)(UnsyncedChanges)

View File

@ -76,7 +76,7 @@ propTypes.migration = shape({
})
propTypes.migrationList = arrayOf(propTypes.migration)
propTypes.unsynchedChange = shape({
propTypes.unsyncedChange = shape({
asset_id: string.isRequired,
asset_type: string.isRequired,
asset_name: string.isRequired,
@ -84,6 +84,6 @@ propTypes.unsynchedChange = shape({
html_url: string.isRequired,
locked: bool.isRequired
})
propTypes.unsynchedChanges = arrayOf(propTypes.unsynchedChange)
propTypes.unsyncedChanges = arrayOf(propTypes.unsyncedChange)
export default propTypes

View File

@ -105,17 +105,17 @@ export default combineReducers({
[actionTypes.SAVE_ASSOCIATIONS_SUCCESS]: () => false,
[actionTypes.SAVE_ASSOCIATIONS_FAIL]: () => false,
}, false),
isLoadingUnsynchedChanges: handleActions({
[actionTypes.LOAD_UNSYNCHED_CHANGES_START]: () => true,
[actionTypes.LOAD_UNSYNCHED_CHANGES_SUCCESS]: () => false,
[actionTypes.LOAD_UNSYNCHED_CHANGES_FAIL]: () => false,
isLoadingUnsyncedChanges: handleActions({
[actionTypes.LOAD_UNSYNCED_CHANGES_START]: () => true,
[actionTypes.LOAD_UNSYNCED_CHANGES_SUCCESS]: () => false,
[actionTypes.LOAD_UNSYNCED_CHANGES_FAIL]: () => false,
}, false),
hasLoadedUnsynchedChanges: handleActions({
[actionTypes.LOAD_UNSYNCHED_CHANGES_START]: () => false,
[actionTypes.LOAD_UNSYNCHED_CHANGES_SUCCESS]: () => true,
hasLoadedUnsyncedChanges: handleActions({
[actionTypes.LOAD_UNSYNCED_CHANGES_START]: () => false,
[actionTypes.LOAD_UNSYNCED_CHANGES_SUCCESS]: () => true,
}, false),
unsynchedChanges: handleActions({
[actionTypes.LOAD_UNSYNCHED_CHANGES_SUCCESS]: (state, action) => action.payload
unsyncedChanges: handleActions({
[actionTypes.LOAD_UNSYNCED_CHANGES_SUCCESS]: (state, action) => action.payload
}, []),
willSendNotification: handleActions({
[actionTypes.ENABLE_SEND_NOTIFICATION]: (state, action) => action.payload

View File

@ -355,8 +355,8 @@
}
}
/* unsynched changes are a little different than sync history */
.bcs__history-item__content.bcs__unsynched-change__content {
/* unsynced changes are a little different than sync history */
.bcs__history-item__content.bcs__unsynced-change__content {
.bcs__history-item__uncynched-changes-grid {
left: 25px;
}
@ -365,6 +365,6 @@
}
}
.bcs__unsynched-changes .bcs__history-notification {
.bcs__unsynced-changes .bcs__history-notification {
padding-top: 1em;
}

View File

@ -34,10 +34,10 @@ const defaultProps = () => ({
isSavingAssociations: false,
willSendNotification: false,
enableSendNotification: noop,
loadUnsynchedChanges: noop,
isLoadingUnsynchedChanges: false,
hasLoadedUnsynchedChanges: true,
unsynchedChanges: sampleData.unsynchedChanges,
loadUnsyncedChanges: noop,
isLoadingUnsyncedChanges: false,
hasLoadedUnsyncedChanges: true,
unsyncedChanges: sampleData.unsyncedChanges,
migrationStatus: MigrationStates.states.unknown,
isLoadingBeginMigration: false,
})

View File

@ -20,11 +20,11 @@ import React from 'react'
import { Provider } from 'react-redux'
import * as enzyme from 'enzyme'
import createStore from 'jsx/blueprint_courses/store'
import {ConnectedUnsynchedChanges} from 'jsx/blueprint_courses/components/UnsynchedChanges'
import {ConnectedUnsyncedChanges} from 'jsx/blueprint_courses/components/UnsyncedChanges'
import MigrationStates from 'jsx/blueprint_courses/migrationStates'
const noop = () => {}
const unsynchedChanges = [
const unsyncedChanges = [
{
asset_id: '22',
asset_type: 'assignment',
@ -52,9 +52,9 @@ const unsynchedChanges = [
]
const defaultProps = {
unsynchedChanges,
isLoadingUnsynchedChanges: false,
hasLoadedUnsynchedChanges: true,
unsyncedChanges,
isLoadingUnsyncedChanges: false,
hasLoadedUnsyncedChanges: true,
migrationStatus: MigrationStates.unknown,
willSendNotification: false,
@ -62,7 +62,7 @@ const defaultProps = {
notificationMessage: '',
}
const actionProps = {
loadUnsynchedChanges: noop,
loadUnsyncedChanges: noop,
enableSendNotification: noop,
includeCustomNotificationMessage: noop,
setNotificationMessage: noop,
@ -76,16 +76,16 @@ function connect (props = {...defaultProps}) {
const store = mockStore()
return (
<Provider store={store}>
<ConnectedUnsynchedChanges {...props} {...actionProps} />
<ConnectedUnsyncedChanges {...props} {...actionProps} />
</Provider>
)
}
QUnit.module('UnsynchedChanges component')
QUnit.module('UnsyncedChanges component')
test('renders the UnsynchedChanges component', () => {
test('renders the UnsyncedChanges component', () => {
const tree = enzyme.mount(connect())
let node = tree.find('UnsynchedChanges')
let node = tree.find('UnsyncedChanges')
ok(node.exists())
node = tree.find('.bcs__history')
ok(node.exists())

View File

@ -219,31 +219,31 @@ test('sets isLoadingHistory to false on LOAD_HISTORY_FAIL', () => {
equal(newState.isLoadingHistory, false)
})
test('sets isLoadingUnynchedChanges to true on LOAD_UNSYNCHED_CHANGES_START', () => {
const newState = reduce(actions.loadUnsynchedChangesStart())
equal(newState.isLoadingUnsynchedChanges, true)
test('sets isLoadingUnynchedChanges to true on LOAD_UNSYNCED_CHANGES_START', () => {
const newState = reduce(actions.loadUnsyncedChangesStart())
equal(newState.isLoadingUnsyncedChanges, true)
})
test('sets isLoadingUnynchedChanges to false on LOAD_UNSYNCHED_CHANGES_SUCCESS', () => {
const newState = reduce(actions.loadUnsynchedChangesSuccess({}))
equal(newState.isLoadingUnsynchedChanges, false)
test('sets isLoadingUnynchedChanges to false on LOAD_UNSYNCED_CHANGES_SUCCESS', () => {
const newState = reduce(actions.loadUnsyncedChangesSuccess({}))
equal(newState.isLoadingUnsyncedChanges, false)
})
test('sets isLoadingUnynchedChanges to alse on LOAD_UNSYNCHED_CHANGES_FAIL', () => {
const newState = reduce(actions.loadUnsynchedChangesFail())
equal(newState.isLoadingUnsynchedChanges, false)
test('sets isLoadingUnynchedChanges to alse on LOAD_UNSYNCED_CHANGES_FAIL', () => {
const newState = reduce(actions.loadUnsyncedChangesFail())
equal(newState.isLoadingUnsyncedChanges, false)
})
test('sets hasLoadedUnsynchedChanges to false on LOAD_UNSYNCHED_CHANGES_START', () => {
const newState = reduce(actions.loadUnsynchedChangesStart())
equal(newState.hasLoadedUnsynchedChanges, false)
test('sets hasLoadedUnsyncedChanges to false on LOAD_UNSYNCED_CHANGES_START', () => {
const newState = reduce(actions.loadUnsyncedChangesStart())
equal(newState.hasLoadedUnsyncedChanges, false)
})
test('sets hasLoadedUnsynchedChanges to true on LOAD_UNSYNCHED_CHANGES_SUCCESS', () => {
const newState = reduce(actions.loadUnsynchedChangesSuccess({}))
equal(newState.hasLoadedUnsynchedChanges, true)
test('sets hasLoadedUnsyncedChanges to true on LOAD_UNSYNCED_CHANGES_SUCCESS', () => {
const newState = reduce(actions.loadUnsyncedChangesSuccess({}))
equal(newState.hasLoadedUnsyncedChanges, true)
})
test('sets unsynchedChanges on LOAD_UNSYNCHED_CHANGES_SUCCESS', () => {
const newState = reduce(actions.loadUnsynchedChangesSuccess(sampleData.unsynchedChanges))
deepEqual(newState.unsynchedChanges, sampleData.unsynchedChanges)
test('sets unsyncedChanges on LOAD_UNSYNCED_CHANGES_SUCCESS', () => {
const newState = reduce(actions.loadUnsyncedChangesSuccess(sampleData.unsyncedChanges))
deepEqual(newState.unsyncedChanges, sampleData.unsyncedChanges)
})
test('sets willSendNotification on ENABLE_SEND_NOTIFICATION', () => {

View File

@ -89,7 +89,7 @@ export default {
],
},
],
unsynchedChanges: [
unsyncedChanges: [
{
asset_id: '22',
asset_type: 'assignment',

View File

@ -76,13 +76,13 @@ describe "master courses sidebar" do
expect(f('div[aria-label="Sync History"]')).to be_displayed
end
it "should show Unsynched Changes modal when button is clicked" do
it "should show Unsynced Changes modal when button is clicked" do
get "/courses/#{@master.id}"
f('.bcs__root .bcs__wrapper .bcs__trigger').click
wait_for_ajaximations
f('button#mcUnsynchedChangesBtn').click
f('button#mcUnsyncedChangesBtn').click
wait_for_ajaximations
expect(f('div[aria-label="Unsynched Changes"]')).to be_displayed
expect(f('div[aria-label="Unsynced Changes"]')).to be_displayed
end
end