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
3 changes: 0 additions & 3 deletions frontend/common/dispatcher/action-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const Actions = Object.assign({}, BaseActions, {
'CREATE_PROJECT': 'CREATE_PROJECT',
'DELETE_CHANGE_REQUEST': 'DELETE_CHANGE_REQUEST',
'DELETE_ENVIRONMENT': 'DELETE_ENVIRONMENT',
'DELETE_INVITE': 'DELETE_INVITE',
'DELETE_ORGANISATION': 'DELETE_ORGANISATION',
'DELETE_PROJECT': 'DELETE_PROJECT',
'DELETE_USER': 'DELETE_USER',
Expand All @@ -31,11 +30,9 @@ const Actions = Object.assign({}, BaseActions, {
'GET_ORGANISATION': 'GET_ORGANISATION',
'GET_PROJECT': 'GET_PROJECT',
'INVALIDATE_INVITE_LINK': 'INVALIDATE_INVITE_LINK',
'MIGRATE_PROJECT': 'MIGRATE_PROJECT',
'OAUTH': 'OAUTH',
'REFRESH_FEATURES': 'REFRESH_FEATURES',
'REMOVE_USER_FLAG': 'REMOVE_USER_FLAG',
'RESEND_INVITE': 'RESEND_INVITE',
'SELECT_ENVIRONMENT': 'SELECT_ENVIRONMENT',
'SELECT_ORGANISATION': 'SELECT_ORGANISATION',
'TOGGLE_USER_FLAG': 'TOGGLE_USER_FLAG',
Expand Down
34 changes: 0 additions & 34 deletions frontend/common/dispatcher/app-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ const AppActions = Object.assign({}, BaseAppActions, {
env,
})
},
deleteInvite(id) {
Dispatcher.handleViewAction({
actionType: Actions.DELETE_INVITE,
id,
})
},
deleteOrganisation() {
Dispatcher.handleViewAction({
actionType: Actions.DELETE_ORGANISATION,
Expand Down Expand Up @@ -225,12 +219,6 @@ const AppActions = Object.assign({}, BaseAppActions, {
link,
})
},
migrateProject(projectId) {
Dispatcher.handleViewAction({
actionType: Actions.MIGRATE_PROJECT,
projectId,
})
},
oauthLogin(oauthType, data) {
Dispatcher.handleViewAction({
actionType: Actions.OAUTH,
Expand Down Expand Up @@ -260,40 +248,18 @@ const AppActions = Object.assign({}, BaseAppActions, {
identityFlag,
})
},
resendInvite(id) {
Dispatcher.handleViewAction({
actionType: Actions.RESEND_INVITE,
id,
})
},
resetPassword(data) {
Dispatcher.handleViewAction({
actionType: Actions.RESET_PASSWORD,
...data,
})
},
saveEnv(name) {
Dispatcher.handleViewAction({
actionType: Actions.EDIT_ENVIRONMENT,
name,
})
},
selectOrganisation(id) {
Dispatcher.handleViewAction({
actionType: Actions.SELECT_ORGANISATION,
id,
})
},
toggleFlag(index, environments, comment, environmentFlags, projectFlags) {
Dispatcher.handleViewAction({
actionType: Actions.TOGGLE_FLAG,
comment,
environmentFlags,
environments,
index,
projectFlags,
})
},
toggleUserFlag(params) {
Dispatcher.handleViewAction({
actionType: Actions.TOGGLE_USER_FLAG,
Expand Down
2 changes: 0 additions & 2 deletions frontend/common/dispatcher/base/_action-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
export default {
'LOGIN': 'LOGIN',
'LOGOUT': 'LOGOUT',
'REFRESH': 'REFRESH',
'REGISTER': 'REGISTER',
'REGISTER_NOTIFICATIONS': 'REGISTER_NOTIFICATIONS',
'RESET_PASSWORD': 'RESET_PASSWORD',
'SET_TOKEN': 'SET_TOKEN',
'SET_USER': 'SET_USER',
Expand Down
12 changes: 0 additions & 12 deletions frontend/common/dispatcher/base/_app-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ export default {
actionType: Actions.LOGOUT,
})
},
refresh() {
// refresh the entire app
Dispatcher.handleViewAction({
actionType: Actions.REFRESH,
})
},
register(details, isInvite) {
// refresh the entire app
Dispatcher.handleViewAction({
Expand All @@ -26,12 +20,6 @@ export default {
isInvite,
})
},
registerNotifications(data) {
Dispatcher.handleViewAction({
actionType: Actions.REGISTER_NOTIFICATIONS,
data,
})
},
setToken(token) {
Dispatcher.handleViewAction({
actionType: Actions.SET_TOKEN,
Expand Down
39 changes: 0 additions & 39 deletions frontend/common/stores/organisation-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,6 @@ const controller = {
})
})
},
deleteInvite: (id) => {
store.saving()
data
.delete(`${Project.api}organisations/${store.id}/invites/${id}/`)
.then(() => {
API.trackEvent(Constants.events.DELETE_INVITE)
if (store.model) {
store.model.invites = filter(
store.model.invites,
(i) => i.id !== id,
)
}
store.saved()
})
.catch((e) => API.ajaxHandler(store, e))
},

deleteProject: (id) => {
const idInt = parseInt(id)
store.saving()
Expand Down Expand Up @@ -257,22 +240,6 @@ const controller = {
}),
)
},
resendInvite: (id) => {
data
.post(`${Project.api}organisations/${store.id}/invites/${id}/resend/`)
.then(() => {
API.trackEvent(Constants.events.RESEND_INVITE)
toast('Invite resent successfully')
})
.catch((e) => {
toast(
`Failed to resend invite. ${
e && e.error ? e.error : 'Please try again later'
}`,
'danger',
)
})
},
updateUserRole: (id, role) => {
data
.post(
Expand Down Expand Up @@ -332,15 +299,9 @@ store.dispatcherIndex = Dispatcher.register(store, (payload) => {
case Actions.DELETE_PROJECT:
controller.deleteProject(action.id)
break
case Actions.DELETE_INVITE:
controller.deleteInvite(action.id)
break
case Actions.DELETE_USER:
controller.deleteUser(action.id)
break
case Actions.RESEND_INVITE:
controller.resendInvite(action.id)
break
case Actions.UPDATE_USER_ROLE:
controller.updateUserRole(action.id, action.role)
break
Expand Down
9 changes: 0 additions & 9 deletions frontend/common/stores/project-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ const controller = {
document.location.href = '/404?entity=project'
})
},
migrateProject: (id) => {
store.loading()
data.post(`${Project.api}projects/${id}/migrate-to-edge/`).then(() => {
controller.getProject(id, () => store.saved(), true)
})
},
}

const store = Object.assign({}, BaseStore, {
Expand Down Expand Up @@ -227,9 +221,6 @@ store.dispatcherIndex = Dispatcher.register(store, (payload) => {
const action = payload.action // this is our action from handleViewAction

switch (action.actionType) {
case Actions.MIGRATE_PROJECT:
controller.migrateProject(parseInt(action.projectId))
break
case Actions.GET_PROJECT:
controller.getProject(parseInt(action.projectId))
break
Expand Down
14 changes: 0 additions & 14 deletions frontend/common/utils/__tests__/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ describe('Format', () => {
})
})

describe('nearestTen', () => {
it.each`
input | expected
${0} | ${'00'}
${5} | ${'05'}
${9} | ${'09'}
${10} | ${10}
${15} | ${15}
${99} | ${99}
`('nearestTen($input) returns $expected', ({ expected, input }) => {
expect(Format.nearestTen(input)).toBe(expected)
})
})

describe('camelCase', () => {
it.each`
input | expected
Expand Down
19 changes: 0 additions & 19 deletions frontend/common/utils/format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import moment from 'moment'

type Person = {
firstName?: string
lastName?: string
Expand Down Expand Up @@ -39,23 +37,6 @@ const Format = {
: Format.camelCase(sn)
},

moment(
value: string | null | undefined,
format: string,
): string | null | undefined {
// DATE, hh:mm > 23:00
if (value) {
const m = moment(value)
return m.format(format)
}
return value
},

nearestTen(value: number): string | number {
// 11 > 10
return value >= 10 ? value : `0${value}`
},

newLineDelimiter: '↵',

shortenNumber(number: number): string {
Expand Down
Loading