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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const RouterNames = {
export const RouteNames = {
CHANNELS: 'CHANNELS',
CHANNEL: 'CHANNEL',
USERS: 'USERS',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<script>

import { RouterNames } from '../constants';
import { RouteNames } from '../constants';
import PermissionsError from 'shared/views/errors/PermissionsError';
import ChannelNotFoundError from 'shared/views/errors/ChannelNotFoundError';
import PageNotFoundError from 'shared/views/errors/PageNotFoundError';
Expand Down Expand Up @@ -61,10 +61,10 @@
backFromCurrentPageUrl() {
const currentPage = this.$route.name;
let toName;
if (currentPage === RouterNames.USER) {
toName = RouterNames.USERS;
if (currentPage === RouteNames.USER) {
toName = RouteNames.USERS;
} else {
toName = RouterNames.CHANNELS;
toName = RouteNames.CHANNELS;
}
return {
to: { name: toName },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<script>

import { RouterNames } from '../constants';
import { RouteNames } from '../constants';
import AdministrationAppError from './AdministrationAppError';
import AppBar from 'shared/views/AppBar';
import GlobalSnackbar from 'shared/views/GlobalSnackbar';
Expand All @@ -52,12 +52,12 @@
},
channelsLink() {
return {
name: RouterNames.CHANNELS,
name: RouteNames.CHANNELS,
};
},
usersLink() {
return {
name: RouterNames.USERS,
name: RouteNames.USERS,
};
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@

import { mapActions, mapGetters } from 'vuex';
import ConfirmationDialog from '../../components/ConfirmationDialog';
import { RouterNames } from '../../constants';
import { RouteNames } from '../../constants';
import { channelExportMixin } from 'shared/views/channel/mixins';

export default {
Expand Down Expand Up @@ -151,7 +151,7 @@
},
searchChannelEditorsLink() {
return {
name: RouterNames.USERS,
name: RouteNames.USERS,
query: {
search: `${this.name} ${this.channel.id}`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<script>

import { mapActions, mapGetters } from 'vuex';
import { RouterNames } from '../../constants';
import { RouteNames } from '../../constants';
import ChannelActionsDropdown from './ChannelActionsDropdown';
import ChannelSharing from 'shared/views/channel/ChannelSharing';
import Details from 'shared/views/details/Details';
Expand Down Expand Up @@ -109,7 +109,7 @@
},
backLink() {
return {
name: RouterNames.CHANNELS,
name: RouteNames.CHANNELS,
query: this.$route.query,
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@

import { mapGetters, mapActions } from 'vuex';
import ClipboardChip from '../../components/ClipboardChip';
import { RouterNames } from '../../constants';
import { RouteNames } from '../../constants';
import ChannelActionsDropdown from './ChannelActionsDropdown';
import Checkbox from 'shared/views/form/Checkbox';
import { fileSizeMixin } from 'shared/mixins';
Expand Down Expand Up @@ -220,7 +220,7 @@
},
channelModalLink() {
return {
name: RouterNames.CHANNEL,
name: RouteNames.CHANNEL,
params: { channelId: this.channelId },
query: this.$route.query,
};
Expand All @@ -230,7 +230,7 @@
},
searchChannelEditorsLink() {
return {
name: RouterNames.USERS,
name: RouteNames.USERS,
query: {
keywords: `${this.channel.name} ${this.channelId}`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

import { mapGetters, mapActions } from 'vuex';
import { tableMixin, generateFilterMixin } from '../../mixins';
import { RouterNames, rowsPerPageItems } from '../../constants';
import { RouteNames, rowsPerPageItems } from '../../constants';
import ChannelItem from './ChannelItem';
import { channelExportMixin } from 'shared/views/channel/mixins';
import { routerMixin } from 'shared/mixins';
Expand Down Expand Up @@ -195,7 +195,7 @@
$route: {
deep: true,
handler(newRoute, oldRoute) {
if (newRoute.name === oldRoute.name && newRoute.name === RouterNames.CHANNELS)
if (newRoute.name === oldRoute.name && newRoute.name === RouteNames.CHANNELS)
this.selected = [];
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { mount } from '@vue/test-utils';
import router from '../../../router';
import { factory } from '../../../store';
import { RouterNames } from '../../../constants';
import { RouteNames } from '../../../constants';
import ChannelDetails from './../ChannelDetails';

const store = factory();

const channelId = '11111111111111111111111111111111';

function makeWrapper() {
router.replace({ name: RouterNames.CHANNEL, params: { channelId } });
router.replace({ name: RouteNames.CHANNEL, params: { channelId } });
return mount(ChannelDetails, {
router,
store,
Expand Down Expand Up @@ -37,7 +37,7 @@ describe('channelDetails', () => {
});
it('clicking close should close the modal', () => {
wrapper.vm.dialog = false;
expect(wrapper.vm.$route.name).toBe(RouterNames.CHANNELS);
expect(wrapper.vm.$route.name).toBe(RouteNames.CHANNELS);
});
describe('load', () => {
it('should automatically close if loadChannel does not find a channel', () => {
Expand All @@ -46,7 +46,7 @@ describe('channelDetails', () => {
loadChannelDetails: jest.fn().mockReturnValue(Promise.resolve()),
});
return wrapper.vm.load().then(() => {
expect(wrapper.vm.$route.name).toBe(RouterNames.CHANNELS);
expect(wrapper.vm.$route.name).toBe(RouteNames.CHANNELS);
});
});
it('load should call loadChannel and loadChannelDetails', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils';
import router from '../../../router';
import { factory } from '../../../store';
import { RouterNames } from '../../../constants';
import { RouteNames } from '../../../constants';
import ChannelItem from '../ChannelItem';

const store = factory();
Expand All @@ -21,7 +21,7 @@ const channel = {
};

function makeWrapper() {
router.replace({ name: RouterNames.CHANNELS });
router.replace({ name: RouteNames.CHANNELS });
return mount(ChannelItem, {
router,
store,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { mount } from '@vue/test-utils';
import router from '../../../router';
import { factory } from '../../../store';
import { RouterNames } from '../../../constants';
import { RouteNames } from '../../../constants';
import ChannelTable from '../ChannelTable';

const store = factory();

const loadChannels = jest.fn().mockReturnValue(Promise.resolve());
const channelList = ['test', 'channel', 'table'];
function makeWrapper() {
router.replace({ name: RouterNames.CHANNELS });
router.replace({ name: RouteNames.CHANNELS });
return mount(ChannelTable, {
router,
store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

import capitalize from 'lodash/capitalize';
import { mapActions, mapGetters } from 'vuex';
import { RouterNames } from '../../constants';
import { RouteNames } from '../../constants';
import UserStorage from './UserStorage';
import UserActionsDropdown from './UserActionsDropdown';
import { routerMixin, fileSizeMixin } from 'shared/mixins';
Expand Down Expand Up @@ -191,7 +191,7 @@
},
backLink() {
return {
name: RouterNames.USERS,
name: RouteNames.USERS,
query: this.$route.query,
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

import capitalize from 'lodash/capitalize';
import { mapGetters } from 'vuex';
import { RouterNames } from '../../constants';
import { RouteNames } from '../../constants';
import UserActionsDropdown from './UserActionsDropdown';
import UserStorage from './UserStorage';
import Checkbox from 'shared/views/form/Checkbox';
Expand Down Expand Up @@ -146,14 +146,14 @@
},
userModalLink() {
return {
name: RouterNames.USER,
name: RouteNames.USER,
params: { userId: this.userId },
query: this.$route.query,
};
},
searchUserChannelsLink() {
return {
name: RouterNames.CHANNELS,
name: RouteNames.CHANNELS,
query: {
keywords: `${this.user.name} ${this.user.email}`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<script>

import { mapGetters, mapActions } from 'vuex';
import { RouterNames, rowsPerPageItems } from '../../constants';
import { RouteNames, rowsPerPageItems } from '../../constants';
import { tableMixin, generateFilterMixin } from '../../mixins';
import EmailUsersDialog from './EmailUsersDialog';
import UserItem from './UserItem';
Expand Down Expand Up @@ -195,7 +195,7 @@
$route: {
deep: true,
handler(newRoute, oldRoute) {
if (newRoute.name === oldRoute.name && newRoute.name === RouterNames.USERS)
if (newRoute.name === oldRoute.name && newRoute.name === RouteNames.USERS)
this.selected = [];
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils';
import router from '../../../router';
import { factory } from '../../../store';
import { RouterNames } from '../../../constants';
import { RouteNames } from '../../../constants';
import UserDetails from '../UserDetails';

const store = factory();
Expand All @@ -22,7 +22,7 @@ const details = {
};

function makeWrapper(userProps = {}) {
router.replace({ name: RouterNames.USER, params: { userId } });
router.replace({ name: RouteNames.USER, params: { userId } });
return mount(UserDetails, {
router,
store,
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('userDetails', () => {
});
it('clicking close should close the modal', () => {
wrapper.vm.dialog = false;
expect(wrapper.vm.$route.name).toBe(RouterNames.USERS);
expect(wrapper.vm.$route.name).toBe(RouteNames.USERS);
});
describe('load', () => {
it('should automatically close if loadUser does not find a channel', () => {
Expand All @@ -62,7 +62,7 @@ describe('userDetails', () => {
loadUserDetails: jest.fn().mockReturnValue(Promise.resolve()),
});
return wrapper.vm.load().then(() => {
expect(wrapper.vm.$route.name).toBe(RouterNames.USERS);
expect(wrapper.vm.$route.name).toBe(RouteNames.USERS);
});
});
it('load should call loadUser and loadUserDetails', () => {
Expand All @@ -79,7 +79,7 @@ describe('userDetails', () => {
wrapper.setData({ loading: false });
wrapper.find('[data-test="dropdown"]').vm.$emit('deleted');
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.$route.name).toBe(RouterNames.USERS);
expect(wrapper.vm.$route.name).toBe(RouteNames.USERS);
});
});
it('progress bar should reflect storage used', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils';
import router from '../../../router';
import { factory } from '../../../store';
import { RouterNames } from '../../../constants';
import { RouteNames } from '../../../constants';
import UserItem from '../UserItem';

const store = factory();
Expand All @@ -16,7 +16,7 @@ const user = {
};

function makeWrapper() {
router.replace({ name: RouterNames.USERS });
router.replace({ name: RouteNames.USERS });
return mount(UserItem, {
router,
store,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { mount } from '@vue/test-utils';
import router from '../../../router';
import { factory } from '../../../store';
import { RouterNames } from '../../../constants';
import { RouteNames } from '../../../constants';
import UserTable from '../UserTable';

const store = factory();

const loadUsers = jest.fn().mockReturnValue(Promise.resolve());
const userList = ['test', 'user', 'table'];
function makeWrapper() {
router.replace({ name: RouterNames.USERS });
router.replace({ name: RouteNames.USERS });
return mount(UserTable, {
router,
store,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import VueRouter from 'vue-router';
import { RouterNames } from './constants';
import { RouteNames } from './constants';
import ChannelTable from './pages/Channels/ChannelTable';
import ChannelDetails from './pages/Channels/ChannelDetails';
import UserTable from './pages/Users/UserTable';
Expand All @@ -8,31 +8,31 @@ import UserDetails from './pages/Users/UserDetails';
const router = new VueRouter({
routes: [
{
name: RouterNames.CHANNELS,
name: RouteNames.CHANNELS,
path: '/channels/',
component: ChannelTable,
},
{
name: RouterNames.CHANNEL,
name: RouteNames.CHANNEL,
path: '/channels/:channelId',
props: true,
component: ChannelDetails,
},
{
name: RouterNames.USERS,
name: RouteNames.USERS,
path: '/users/',
component: UserTable,
},
{
name: RouterNames.USER,
name: RouteNames.USER,
path: '/users/:userId',
props: true,
component: UserDetails,
},
// Catch-all redirect to channels tab
{
path: '*',
redirect: { name: RouterNames.CHANNELS },
redirect: { name: RouteNames.CHANNELS },
},
],
});
Expand Down
Loading