diff --git a/frontend/common/dispatcher/action-constants.js b/frontend/common/dispatcher/action-constants.js index 51c33dc0db6e..6b44608b7d8c 100644 --- a/frontend/common/dispatcher/action-constants.js +++ b/frontend/common/dispatcher/action-constants.js @@ -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', @@ -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', diff --git a/frontend/common/dispatcher/app-actions.js b/frontend/common/dispatcher/app-actions.js index 48145836d81b..b5cb62951124 100644 --- a/frontend/common/dispatcher/app-actions.js +++ b/frontend/common/dispatcher/app-actions.js @@ -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, @@ -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, @@ -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, diff --git a/frontend/common/dispatcher/base/_action-constants.js b/frontend/common/dispatcher/base/_action-constants.js index 84b54217c2c3..b06c22eb7436 100644 --- a/frontend/common/dispatcher/base/_action-constants.js +++ b/frontend/common/dispatcher/base/_action-constants.js @@ -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', diff --git a/frontend/common/dispatcher/base/_app-actions.js b/frontend/common/dispatcher/base/_app-actions.js index 98baa054655f..785369322677 100644 --- a/frontend/common/dispatcher/base/_app-actions.js +++ b/frontend/common/dispatcher/base/_app-actions.js @@ -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({ @@ -26,12 +20,6 @@ export default { isInvite, }) }, - registerNotifications(data) { - Dispatcher.handleViewAction({ - actionType: Actions.REGISTER_NOTIFICATIONS, - data, - }) - }, setToken(token) { Dispatcher.handleViewAction({ actionType: Actions.SET_TOKEN, diff --git a/frontend/common/stores/organisation-store.js b/frontend/common/stores/organisation-store.js index 53ccd705248d..ff50e0ba316a 100644 --- a/frontend/common/stores/organisation-store.js +++ b/frontend/common/stores/organisation-store.js @@ -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() @@ -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( @@ -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 diff --git a/frontend/common/stores/project-store.js b/frontend/common/stores/project-store.js index eed66684ed1b..8d74d0532461 100644 --- a/frontend/common/stores/project-store.js +++ b/frontend/common/stores/project-store.js @@ -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, { @@ -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 diff --git a/frontend/common/utils/__tests__/format.test.ts b/frontend/common/utils/__tests__/format.test.ts index d578c6479cf6..5c0eb7f8fab9 100644 --- a/frontend/common/utils/__tests__/format.test.ts +++ b/frontend/common/utils/__tests__/format.test.ts @@ -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 diff --git a/frontend/common/utils/format.ts b/frontend/common/utils/format.ts index 40882a09b24b..c2b235d7165a 100644 --- a/frontend/common/utils/format.ts +++ b/frontend/common/utils/format.ts @@ -1,5 +1,3 @@ -import moment from 'moment' - type Person = { firstName?: string lastName?: string @@ -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 {