linting satellite code (#1331)
* ignore coverage folder * add ident constraint to tslint.json * npm run lint * add missing empty line * fix hasInputError lint
This commit is contained in:
parent
d90d51d375
commit
b4e9d7eefe
1
web/satellite/.gitignore
vendored
1
web/satellite/.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
node_modules
|
||||
dist
|
||||
package-lock.json
|
||||
coverage
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
|
@ -36,7 +36,7 @@ import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
'addApiKeysPopupEmptyButton',
|
||||
'addTeamMemberPopupButtonSVG',
|
||||
'sortTeamMemberByDropdown',
|
||||
'sortTeamMemberByDropdownButton',
|
||||
'sortTeamMemberByDropdownButton',
|
||||
'createAccountButton',
|
||||
'successfulRegistrationPopup',
|
||||
]
|
||||
@ -64,7 +64,6 @@ import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
export default class App extends Vue {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -76,7 +76,7 @@ export async function createAPIKey(projectID: string, name: string) {
|
||||
result.data = {
|
||||
key: response.data.createAPIKey.key,
|
||||
keyInfo: response.data.createAPIKey.keyInfo
|
||||
}
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
@ -118,11 +118,11 @@ export async function deleteAPIKeys(ids: string[]) {
|
||||
}
|
||||
|
||||
function prepareIdList(ids: string[]): string {
|
||||
let idString: string = '';
|
||||
let idString: string = '';
|
||||
|
||||
ids.forEach(id => {
|
||||
idString += `"${id}", `;
|
||||
});
|
||||
ids.forEach(id => {
|
||||
idString += `"${id}", `;
|
||||
});
|
||||
|
||||
return idString;
|
||||
return idString;
|
||||
}
|
||||
|
@ -8,88 +8,88 @@ import { ProjectMemberSortByEnum } from '@/utils/constants/ProjectMemberSortEnum
|
||||
// Performs graqhQL request.
|
||||
// Throws an exception if error occurs
|
||||
export async function addProjectMembersRequest(projectID: string, emails: string[]): Promise<RequestResponse<null>> {
|
||||
let result: RequestResponse<null> = {
|
||||
let result: RequestResponse<null> = {
|
||||
errorMessage: '',
|
||||
isSuccess: false,
|
||||
data: null
|
||||
};
|
||||
};
|
||||
|
||||
try {
|
||||
let response: any = await apollo.mutate(
|
||||
{
|
||||
mutation: gql(`
|
||||
try {
|
||||
let response: any = await apollo.mutate(
|
||||
{
|
||||
mutation: gql(`
|
||||
mutation {
|
||||
addProjectMembers(
|
||||
projectID: "${projectID}",
|
||||
email: [${prepareEmailList(emails)}]
|
||||
) {id}
|
||||
}`,
|
||||
),
|
||||
fetchPolicy: 'no-cache',
|
||||
}
|
||||
);
|
||||
),
|
||||
fetchPolicy: 'no-cache',
|
||||
}
|
||||
);
|
||||
|
||||
if (response.errors) {
|
||||
if (response.errors) {
|
||||
result.errorMessage = response.errors[0].message;
|
||||
} else {
|
||||
result.isSuccess = true;
|
||||
result.isSuccess = true;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Performs graqhQL request.
|
||||
// Throws an exception if error occurs
|
||||
export async function deleteProjectMembersRequest(projectID: string, emails: string[]): Promise<RequestResponse<null>> {
|
||||
let result: RequestResponse<null> = {
|
||||
let result: RequestResponse<null> = {
|
||||
errorMessage: '',
|
||||
isSuccess: false,
|
||||
data: null
|
||||
};
|
||||
};
|
||||
|
||||
try {
|
||||
let response: any = await apollo.mutate(
|
||||
{
|
||||
mutation: gql(`
|
||||
try {
|
||||
let response: any = await apollo.mutate(
|
||||
{
|
||||
mutation: gql(`
|
||||
mutation {
|
||||
deleteProjectMembers(
|
||||
projectID: "${projectID}",
|
||||
email: [${prepareEmailList(emails)}]
|
||||
) {id}
|
||||
}`
|
||||
),
|
||||
fetchPolicy: 'no-cache',
|
||||
}
|
||||
);
|
||||
),
|
||||
fetchPolicy: 'no-cache',
|
||||
}
|
||||
);
|
||||
|
||||
if (response.errors) {
|
||||
if (response.errors) {
|
||||
result.errorMessage = response.errors[0].message;
|
||||
} else {
|
||||
result.isSuccess = true;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Performs graqhQL request.
|
||||
// Throws an exception if error occurs
|
||||
export async function fetchProjectMembersRequest(projectID: string, limit: string, offset: string, sortBy: ProjectMemberSortByEnum, searchQuery: string): Promise<RequestResponse<TeamMemberModel[]>> {
|
||||
let result: RequestResponse<TeamMemberModel[]> = {
|
||||
errorMessage: '',
|
||||
isSuccess: false,
|
||||
data: []
|
||||
};
|
||||
let result: RequestResponse<TeamMemberModel[]> = {
|
||||
errorMessage: '',
|
||||
isSuccess: false,
|
||||
data: []
|
||||
};
|
||||
|
||||
try {
|
||||
let response: any = await apollo.query(
|
||||
{
|
||||
query: gql(`
|
||||
try {
|
||||
let response: any = await apollo.query(
|
||||
{
|
||||
query: gql(`
|
||||
query {
|
||||
project(
|
||||
id: "${projectID}",
|
||||
@ -105,22 +105,22 @@ export async function fetchProjectMembersRequest(projectID: string, limit: strin
|
||||
}
|
||||
}
|
||||
}`
|
||||
),
|
||||
fetchPolicy: 'no-cache',
|
||||
}
|
||||
);
|
||||
),
|
||||
fetchPolicy: 'no-cache',
|
||||
}
|
||||
);
|
||||
|
||||
if (response.errors) {
|
||||
if (response.errors) {
|
||||
result.errorMessage = response.errors[0].message;
|
||||
} else {
|
||||
result.isSuccess = true;
|
||||
result.data = response.data.project.members;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
function prepareEmailList(emails: string[]): string {
|
||||
|
@ -75,7 +75,7 @@ export async function fetchProjectsRequest(): Promise<RequestResponse<Project[]>
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -252,35 +252,35 @@ export async function deleteAccountRequest(password: string): Promise<RequestRes
|
||||
// Returns Token string.
|
||||
// Throws an exception if error occurs
|
||||
export async function activateAccountRequest(token: string): Promise<RequestResponse<string>> {
|
||||
let result: RequestResponse<string> = {
|
||||
errorMessage: '',
|
||||
isSuccess: false,
|
||||
data: ''
|
||||
};
|
||||
let result: RequestResponse<string> = {
|
||||
errorMessage: '',
|
||||
isSuccess: false,
|
||||
data: ''
|
||||
};
|
||||
|
||||
try {
|
||||
let response = await apolloManager.mutate(
|
||||
{
|
||||
mutation: gql(`
|
||||
try {
|
||||
let response = await apolloManager.mutate(
|
||||
{
|
||||
mutation: gql(`
|
||||
mutation {
|
||||
activateAccount(input: "${token}") {
|
||||
token
|
||||
}
|
||||
}
|
||||
`),
|
||||
fetchPolicy: 'no-cache'
|
||||
fetchPolicy: 'no-cache'
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (response.errors) {
|
||||
result.errorMessage = response.errors[0].message;
|
||||
} else {
|
||||
result.isSuccess = true;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
if (response.errors) {
|
||||
result.errorMessage = response.errors[0].message;
|
||||
} else {
|
||||
result.isSuccess = true;
|
||||
}
|
||||
} catch (e) {
|
||||
result.errorMessage = e.message;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import HeaderedInput from '@/components/common/HeaderedInput.vue';
|
||||
import CopyApiKeyPopup from './CopyApiKeyPopup.vue';
|
||||
import Button from '@/components/common/Button.vue';
|
||||
import { EMPTY_STATE_IMAGES } from '@/utils/constants/emptyStatesImages';
|
||||
import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS, API_KEYS_ACTIONS } from "@/utils/constants/actionNames";
|
||||
import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS, API_KEYS_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
Vue.use(VueClipboards);
|
||||
|
||||
@ -65,10 +65,11 @@ Vue.use(VueClipboards);
|
||||
|
||||
if (!result.isSuccess) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, result.errorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, "Successfully created new api key");
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, 'Successfully created new api key');
|
||||
this.$data.key = result.data.key;
|
||||
},
|
||||
onChangeName: function (value: string): void {
|
||||
|
@ -36,7 +36,7 @@ import { EMPTY_STATE_IMAGES } from '@/utils/constants/emptyStatesImages';
|
||||
import ApiKeysItem from '@/components/apiKeys/ApiKeysItem.vue';
|
||||
import AddAPIKeyPopup from '@/components/apiKeys/AddApiKeyPopup.vue';
|
||||
import Footer from '@/components/apiKeys/footerArea/Footer.vue';
|
||||
import { API_KEYS_ACTIONS, APP_STATE_ACTIONS } from "@/utils/constants/actionNames";
|
||||
import { API_KEYS_ACTIONS, APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
@Component({
|
||||
data: function () {
|
||||
|
@ -37,7 +37,7 @@ import { Component, Vue } from 'vue-property-decorator';
|
||||
import Button from '@/components/common/Button.vue';
|
||||
import HeaderedInput from '@/components/common/HeaderedInput.vue';
|
||||
import { EMPTY_STATE_IMAGES } from '@/utils/constants/emptyStatesImages';
|
||||
import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS } from "@/utils/constants/actionNames";
|
||||
import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
@Component(
|
||||
{
|
||||
@ -57,7 +57,7 @@ import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS } from "@/utils/constants/actio
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_NEW_API_KEY);
|
||||
},
|
||||
onCopyClick: function (): void {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, "Key saved to clipboard");
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, 'Key saved to clipboard');
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -30,23 +30,23 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import Button from '@/components/common/Button.vue';
|
||||
import { API_KEYS_ACTIONS, NOTIFICATION_ACTIONS } from "@/utils/constants/actionNames";
|
||||
import { API_KEYS_ACTIONS, NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
@Component({
|
||||
methods: {
|
||||
onDelete: async function () {
|
||||
let selectedKeys: any[] = this.$store.getters.selectedAPIKeys.map((key)=>{return key.id});
|
||||
onDelete: async function () {
|
||||
let selectedKeys: any[] = this.$store.getters.selectedAPIKeys.map((key) => {return key.id; });
|
||||
|
||||
const dispatchResult = await this.$store.dispatch(API_KEYS_ACTIONS.DELETE, selectedKeys);
|
||||
const dispatchResult = await this.$store.dispatch(API_KEYS_ACTIONS.DELETE, selectedKeys);
|
||||
|
||||
let keySuffix = selectedKeys.length > 1 ? '\'s' : '';
|
||||
let keySuffix = selectedKeys.length > 1 ? '\'s' : '';
|
||||
|
||||
if(dispatchResult.isSuccess){
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, `API key${keySuffix} deleted successfully`);
|
||||
} else {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, `Error during deletion API key${keySuffix}`);
|
||||
}
|
||||
},
|
||||
if (dispatchResult.isSuccess) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, `API key${keySuffix} deleted successfully`);
|
||||
} else {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, `Error during deletion API key${keySuffix}`);
|
||||
}
|
||||
},
|
||||
onClearSelection: function (): void {
|
||||
this.$store.dispatch(API_KEYS_ACTIONS.CLEAR_SELECTION);
|
||||
},
|
||||
|
@ -20,7 +20,7 @@ import { Component, Vue } from 'vue-property-decorator';
|
||||
import SearchArea from './SearchArea.vue';
|
||||
import Button from '@/components/common/Button.vue';
|
||||
import SortApiKeysHeader from '@/components/apiKeys/headerArea/SortApiKeysHeader.vue';
|
||||
import { APP_STATE_ACTIONS } from "@/utils/constants/actionNames";
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
|
@ -36,23 +36,23 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import Button from '@/components/common/Button.vue';
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import ROUTES from '@/utils/constants/routerConstants';
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import Button from '@/components/common/Button.vue';
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import ROUTES from '@/utils/constants/routerConstants';
|
||||
|
||||
@Component(
|
||||
@Component(
|
||||
{
|
||||
computed:{
|
||||
isPopupShown: function () {
|
||||
isPopupShown: function () {
|
||||
return this.$store.state.appStateModule.appState.isSuccessfulRegistrationPopupShown;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCloseClick: function () {
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.CLOSE_POPUPS);
|
||||
this.$router.push(ROUTES.LOGIN.path);
|
||||
}
|
||||
onCloseClick: function () {
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.CLOSE_POPUPS);
|
||||
this.$router.push(ROUTES.LOGIN.path);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Button,
|
||||
|
@ -31,9 +31,9 @@ import { APP_STATE_ACTIONS, PROJETS_ACTIONS, NOTIFICATION_ACTIONS, PM_ACTIONS, A
|
||||
},
|
||||
methods: {
|
||||
onProjectSelected: async function (projectID: string): Promise<void> {
|
||||
this.$store.dispatch(PROJETS_ACTIONS.SELECT, projectID);
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_PROJECTS);
|
||||
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
|
||||
this.$store.dispatch(PROJETS_ACTIONS.SELECT, projectID);
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_PROJECTS);
|
||||
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
|
||||
|
||||
const pmResponse = await this.$store.dispatch(PM_ACTIONS.FETCH, {limit: 20, offset: 0});
|
||||
const keysResponse = await this.$store.dispatch(API_KEYS_ACTIONS.FETCH);
|
||||
|
@ -143,11 +143,11 @@ import { validateEmail } from '@/utils/validation';
|
||||
}
|
||||
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.SUCCESS, 'Members successfully added to project!');
|
||||
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
|
||||
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
|
||||
|
||||
const fetchMembersResponse = await this.$store.dispatch(PM_ACTIONS.FETCH);
|
||||
if (!fetchMembersResponse.isSuccess) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
|
||||
const fetchMembersResponse = await this.$store.dispatch(PM_ACTIONS.FETCH);
|
||||
if (!fetchMembersResponse.isSuccess) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
|
||||
}
|
||||
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_TEAM_MEMBERS);
|
||||
@ -168,23 +168,18 @@ import { validateEmail } from '@/utils/validation';
|
||||
},
|
||||
resetFormErrors: function(index): void {
|
||||
this.$data.inputs[index].setError(false);
|
||||
if(!(this as any).hasInputError()) {
|
||||
this.$data.formError = '';
|
||||
if (!(this as any).hasInputError()) {
|
||||
this.$data.formError = '';
|
||||
}
|
||||
},
|
||||
onClose: function(): void {
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_TEAM_MEMBERS);
|
||||
},
|
||||
hasInputError: function (): boolean {
|
||||
let hasError = false;
|
||||
this.$data.inputs.some((element: EmailInput)=>{
|
||||
if(element.error) {
|
||||
hasError = true;
|
||||
return true;
|
||||
}
|
||||
return this.$data.inputs.some((element: EmailInput) => {
|
||||
return element.error;
|
||||
});
|
||||
return hasError;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isMaxInputsCount: function(): boolean {
|
||||
|
@ -45,26 +45,26 @@ import { NOTIFICATION_ACTIONS, PM_ACTIONS } from '@/utils/constants/actionNames'
|
||||
methods: {
|
||||
onMemberClick: function (member: any) {
|
||||
this.$store.dispatch(PM_ACTIONS.TOGGLE_SELECTION, member.user.id);
|
||||
},
|
||||
handleScroll: async function () {
|
||||
const documentElement = document.getElementById('scrollable_team_container');
|
||||
if (!documentElement) {
|
||||
return;
|
||||
}
|
||||
},
|
||||
handleScroll: async function () {
|
||||
const documentElement = document.getElementById('scrollable_team_container');
|
||||
if (!documentElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isAtBottom = documentElement.scrollTop + documentElement.clientHeight === documentElement.scrollHeight;
|
||||
const isAtBottom = documentElement.scrollTop + documentElement.clientHeight === documentElement.scrollHeight;
|
||||
|
||||
if (!isAtBottom || this.$data.isFetchInProgress) return;
|
||||
if (!isAtBottom || this.$data.isFetchInProgress) return;
|
||||
|
||||
this.$data.isFetchInProgress = true;
|
||||
this.$data.isFetchInProgress = true;
|
||||
|
||||
const response = await this.$store.dispatch(PM_ACTIONS.FETCH);
|
||||
const response = await this.$store.dispatch(PM_ACTIONS.FETCH);
|
||||
|
||||
this.$data.isFetchInProgress = false;
|
||||
this.$data.isFetchInProgress = false;
|
||||
|
||||
if (response.isSuccess) return;
|
||||
if (response.isSuccess) return;
|
||||
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
@ -28,7 +28,7 @@ import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS, PM_ACTIONS } from '@/utils/con
|
||||
{
|
||||
data: function () {
|
||||
return {
|
||||
sortByEnum: ProjectMemberSortByEnum,
|
||||
sortByEnum: ProjectMemberSortByEnum,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@ -38,16 +38,16 @@ import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS, PM_ACTIONS } from '@/utils/con
|
||||
},
|
||||
methods: {
|
||||
onCloseClick: function (): void {
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
},
|
||||
onSortUsersClick: async function (sortBy: ProjectMemberSortByEnum) {
|
||||
this.$store.dispatch(PM_ACTIONS.SET_SORT_BY, sortBy);
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
this.$store.dispatch(PM_ACTIONS.SET_SORT_BY, sortBy);
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
|
||||
const response = await this.$store.dispatch(PM_ACTIONS.FETCH);
|
||||
if (response.isSuccess) return;
|
||||
const response = await this.$store.dispatch(PM_ACTIONS.FETCH);
|
||||
if (response.isSuccess) return;
|
||||
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
|
||||
|
||||
}
|
||||
},
|
||||
|
@ -16,13 +16,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import SortDropdown from './SortDropdown.vue';
|
||||
import { mapState } from 'vuex';
|
||||
import { ProjectMemberSortByEnum } from '@/utils/constants/ProjectMemberSortEnum';
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import SortDropdown from './SortDropdown.vue';
|
||||
import { mapState } from 'vuex';
|
||||
import { ProjectMemberSortByEnum } from '@/utils/constants/ProjectMemberSortEnum';
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
@Component(
|
||||
@Component(
|
||||
{
|
||||
data: function () {
|
||||
return {
|
||||
@ -31,23 +31,23 @@
|
||||
},
|
||||
methods: {
|
||||
toggleSelection: function (): void {
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
sortOption: (state: any) => {
|
||||
switch (state.projectMembersModule.searchParameters.sortBy) {
|
||||
case ProjectMemberSortByEnum.EMAIL:
|
||||
return 'email';
|
||||
computed: mapState({
|
||||
sortOption: (state: any) => {
|
||||
switch (state.projectMembersModule.searchParameters.sortBy) {
|
||||
case ProjectMemberSortByEnum.EMAIL:
|
||||
return 'email';
|
||||
|
||||
case ProjectMemberSortByEnum.CREATED_AT:
|
||||
return 'date';
|
||||
case ProjectMemberSortByEnum.CREATED_AT:
|
||||
return 'date';
|
||||
default: // ProjectMemberSortByEnum.NAME
|
||||
return 'name';
|
||||
}
|
||||
return 'name';
|
||||
}
|
||||
},
|
||||
isChoiceShown: (state: any) => state.appStateModule.appState.isSortProjectMembersByPopupShown
|
||||
}),
|
||||
isChoiceShown: (state: any) => state.appStateModule.appState.isSortProjectMembersByPopupShown
|
||||
}),
|
||||
components: {
|
||||
SortDropdown
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import store from './store';
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: (h) => h(App),
|
||||
router,
|
||||
store,
|
||||
render: (h) => h(App),
|
||||
}).$mount('#app');
|
||||
|
@ -18,72 +18,72 @@ import { getToken } from '@/utils/tokenManager';
|
||||
Vue.use(Router);
|
||||
|
||||
let router = new Router({
|
||||
mode: 'history',
|
||||
routes: [
|
||||
{
|
||||
path: ROUTES.LOGIN.path,
|
||||
name: ROUTES.LOGIN.name,
|
||||
component: Login
|
||||
},
|
||||
{
|
||||
path: ROUTES.REGISTER.path,
|
||||
name: ROUTES.REGISTER.name,
|
||||
component: Register
|
||||
},
|
||||
{
|
||||
path: ROUTES.DASHBOARD.path,
|
||||
name: ROUTES.DASHBOARD.name,
|
||||
meta: {
|
||||
requiresAuth: true
|
||||
},
|
||||
component: Dashboard,
|
||||
children: [
|
||||
{
|
||||
path: '/account-settings',
|
||||
name: 'AccountSettings',
|
||||
component: AccountArea
|
||||
},
|
||||
{
|
||||
path: '/project-details',
|
||||
name: 'ProjectDetails',
|
||||
component: ProjectDetails
|
||||
},
|
||||
{
|
||||
path: '/team',
|
||||
name: 'Team',
|
||||
component: TeamArea
|
||||
},
|
||||
{
|
||||
path: '/api-keys',
|
||||
name: 'ApiKeys',
|
||||
component: ApiKeysArea
|
||||
},
|
||||
mode: 'history',
|
||||
routes: [
|
||||
{
|
||||
path: ROUTES.LOGIN.path,
|
||||
name: ROUTES.LOGIN.name,
|
||||
component: Login
|
||||
},
|
||||
{
|
||||
path: ROUTES.REGISTER.path,
|
||||
name: ROUTES.REGISTER.name,
|
||||
component: Register
|
||||
},
|
||||
{
|
||||
path: ROUTES.DASHBOARD.path,
|
||||
name: ROUTES.DASHBOARD.name,
|
||||
meta: {
|
||||
requiresAuth: true
|
||||
},
|
||||
component: Dashboard,
|
||||
children: [
|
||||
{
|
||||
path: '/account-settings',
|
||||
name: 'AccountSettings',
|
||||
component: AccountArea
|
||||
},
|
||||
{
|
||||
path: '/project-details',
|
||||
name: 'ProjectDetails',
|
||||
component: ProjectDetails
|
||||
},
|
||||
{
|
||||
path: '/team',
|
||||
name: 'Team',
|
||||
component: TeamArea
|
||||
},
|
||||
{
|
||||
path: '/api-keys',
|
||||
name: 'ApiKeys',
|
||||
component: ApiKeysArea
|
||||
},
|
||||
// {
|
||||
// path: '/',
|
||||
// name: 'dashboardArea',
|
||||
// component: DashboardArea
|
||||
// },
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
name: '404',
|
||||
component: Page404
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
name: '404',
|
||||
component: Page404
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Makes check that Token exist at session storage before any route except Login and Register
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.matched.some(route => route.meta.requiresAuth)) {
|
||||
if (!getToken()) {
|
||||
next(ROUTES.LOGIN);
|
||||
if (to.matched.some(route => route.meta.requiresAuth)) {
|
||||
if (!getToken()) {
|
||||
next(ROUTES.LOGIN);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
next();
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
@ -16,14 +16,14 @@ Vue.use(Vuex);
|
||||
|
||||
// Satellite store (vuex)
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
usersModule,
|
||||
projectsModule,
|
||||
projectMembersModule,
|
||||
notificationsModule,
|
||||
appStateModule,
|
||||
modules: {
|
||||
usersModule,
|
||||
projectsModule,
|
||||
projectMembersModule,
|
||||
notificationsModule,
|
||||
appStateModule,
|
||||
apiKeysModule
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default store;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
import { API_KEYS_MUTATIONS } from '../mutationConstants';
|
||||
import { createAPIKey, deleteAPIKeys, fetchAPIKeys } from '@/api/apiKeys';
|
||||
import { API_KEYS_ACTIONS } from "@/utils/constants/actionNames";
|
||||
import { API_KEYS_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
export const apiKeysModule = {
|
||||
state: {
|
||||
@ -17,13 +17,13 @@ export const apiKeysModule = {
|
||||
state.apiKeys.push(apiKey);
|
||||
},
|
||||
[API_KEYS_MUTATIONS.DELETE](state: any, ids: string[]) {
|
||||
const keysCount = ids.length;
|
||||
const keysCount = ids.length;
|
||||
|
||||
for (let j = 0; j < keysCount; j++) {
|
||||
state.apiKeys = state.apiKeys.filter((element: any) => {
|
||||
return element.id !== ids[j];
|
||||
});
|
||||
}
|
||||
for (let j = 0; j < keysCount; j++) {
|
||||
state.apiKeys = state.apiKeys.filter((element: any) => {
|
||||
return element.id !== ids[j];
|
||||
});
|
||||
}
|
||||
},
|
||||
[API_KEYS_MUTATIONS.TOGGLE_SELECTION](state: any, apiKeyID: string) {
|
||||
state.apiKeys = state.apiKeys.map((apiKey: any) => {
|
||||
|
@ -5,11 +5,11 @@ import { APP_STATE_MUTATIONS } from '../mutationConstants';
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
export const appStateModule = {
|
||||
state: {
|
||||
// Object that contains all states of views
|
||||
appState: {
|
||||
state: {
|
||||
// Object that contains all states of views
|
||||
appState: {
|
||||
isAddTeamMembersPopupShown: false,
|
||||
isNewProjectPopupShown: false,
|
||||
isNewProjectPopupShown: false,
|
||||
isProjectsDropdownShown: false,
|
||||
isAccountDropdownShown: false,
|
||||
isDeleteProjectPopupShown: false,
|
||||
@ -18,9 +18,9 @@ export const appStateModule = {
|
||||
isSortProjectMembersByPopupShown: false,
|
||||
isSuccessfulRegistrationPopupShown: false,
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
// Mutation changing add team members popup visibility
|
||||
},
|
||||
mutations: {
|
||||
// Mutation changing add team members popup visibility
|
||||
[APP_STATE_MUTATIONS.TOGGLE_ADD_TEAMMEMBER_POPUP](state: any): void {
|
||||
state.appState.isAddTeamMembersPopupShown = !state.appState.isAddTeamMembersPopupShown;
|
||||
},
|
||||
@ -48,18 +48,18 @@ export const appStateModule = {
|
||||
[APP_STATE_MUTATIONS.TOGGLE_DELETE_ACCOUNT_DROPDOWN](state: any): void {
|
||||
state.appState.isDeleteAccountPopupShown = !state.appState.isDeleteAccountPopupShown;
|
||||
},
|
||||
// Mutation changing 'sort project members by' popup visibility
|
||||
[APP_STATE_MUTATIONS.TOGGLE_SORT_PM_BY_DROPDOWN](state: any): void {
|
||||
state.appState.isSortProjectMembersByPopupShown = !state.appState.isSortProjectMembersByPopupShown;
|
||||
},
|
||||
// Mutation changing 'sort project members by' popup visibility
|
||||
[APP_STATE_MUTATIONS.TOGGLE_SORT_PM_BY_DROPDOWN](state: any): void {
|
||||
state.appState.isSortProjectMembersByPopupShown = !state.appState.isSortProjectMembersByPopupShown;
|
||||
},
|
||||
// Mutation changing new api key popup visibility
|
||||
[APP_STATE_MUTATIONS.TOGGLE_NEW_API_KEY_POPUP](state: any): void {
|
||||
state.appState.isNewAPIKeyPopupShown = !state.appState.isNewAPIKeyPopupShown;
|
||||
},
|
||||
// Mutation changing 'successful registration' popup visibility
|
||||
[APP_STATE_MUTATIONS.TOGGLE_SUCCESSFUL_REGISTRATION_POPUP](state: any): void {
|
||||
state.appState.isSuccessfulRegistrationPopupShown = !state.appState.isSuccessfulRegistrationPopupShown;
|
||||
},
|
||||
// Mutation changing 'successful registration' popup visibility
|
||||
[APP_STATE_MUTATIONS.TOGGLE_SUCCESSFUL_REGISTRATION_POPUP](state: any): void {
|
||||
state.appState.isSuccessfulRegistrationPopupShown = !state.appState.isSuccessfulRegistrationPopupShown;
|
||||
},
|
||||
|
||||
// Mutation that closes each popup/dropdown
|
||||
[APP_STATE_MUTATIONS.CLOSE_ALL](state: any): void {
|
||||
@ -71,11 +71,11 @@ export const appStateModule = {
|
||||
state.appState.isDeleteAccountPopupShown = false;
|
||||
state.appState.isSortProjectMembersByPopupShown = false;
|
||||
state.appState.isNewAPIKeyPopupShown = false;
|
||||
state.appState.isSuccessfulRegistrationPopupShown = false;
|
||||
state.appState.isSuccessfulRegistrationPopupShown = false;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// Commits mutation for changing app popups and dropdowns visibility state
|
||||
},
|
||||
actions: {
|
||||
// Commits mutation for changing app popups and dropdowns visibility state
|
||||
toggleAddTeamMembersPopup: function ({commit, state}: any): void {
|
||||
if (!state.appState.isAddTeamMembersPopupShown) {
|
||||
commit(APP_STATE_MUTATIONS.CLOSE_ALL);
|
||||
@ -118,13 +118,13 @@ export const appStateModule = {
|
||||
|
||||
commit(APP_STATE_MUTATIONS.TOGGLE_DELETE_ACCOUNT_DROPDOWN);
|
||||
},
|
||||
toggleSortProjectMembersByPopup: function ({commit, state}: any): void {
|
||||
if (!state.appState.isSortProjectMembersByPopupShown) {
|
||||
commit(APP_STATE_MUTATIONS.CLOSE_ALL);
|
||||
}
|
||||
toggleSortProjectMembersByPopup: function ({commit, state}: any): void {
|
||||
if (!state.appState.isSortProjectMembersByPopupShown) {
|
||||
commit(APP_STATE_MUTATIONS.CLOSE_ALL);
|
||||
}
|
||||
|
||||
commit(APP_STATE_MUTATIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
},
|
||||
commit(APP_STATE_MUTATIONS.TOGGLE_SORT_PM_BY_DROPDOWN);
|
||||
},
|
||||
[APP_STATE_ACTIONS.TOGGLE_NEW_API_KEY]: function ({commit, state}: any): void {
|
||||
if (!state.appState.isNewAPIKeyPopupShown) {
|
||||
commit(APP_STATE_MUTATIONS.CLOSE_ALL);
|
||||
@ -132,15 +132,15 @@ export const appStateModule = {
|
||||
|
||||
commit(APP_STATE_MUTATIONS.TOGGLE_NEW_API_KEY_POPUP);
|
||||
},
|
||||
[APP_STATE_ACTIONS.TOGGLE_SUCCESSFUL_REGISTRATION_POPUP]: function ({commit, state}: any): void {
|
||||
if (!state.appState.isSuccessfullRegistrationPopupShown) {
|
||||
commit(APP_STATE_MUTATIONS.CLOSE_ALL);
|
||||
}
|
||||
[APP_STATE_ACTIONS.TOGGLE_SUCCESSFUL_REGISTRATION_POPUP]: function ({commit, state}: any): void {
|
||||
if (!state.appState.isSuccessfullRegistrationPopupShown) {
|
||||
commit(APP_STATE_MUTATIONS.CLOSE_ALL);
|
||||
}
|
||||
|
||||
commit(APP_STATE_MUTATIONS.TOGGLE_SUCCESSFUL_REGISTRATION_POPUP);
|
||||
},
|
||||
commit(APP_STATE_MUTATIONS.TOGGLE_SUCCESSFUL_REGISTRATION_POPUP);
|
||||
},
|
||||
closePopups: function ({commit}: any): void {
|
||||
commit(APP_STATE_MUTATIONS.CLOSE_ALL);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -6,82 +6,82 @@ import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
|
||||
import { DelayedNotification } from '@/types/DelayedNotification';
|
||||
|
||||
export const notificationsModule = {
|
||||
state: {
|
||||
// Dynamic queue for displaying notifications
|
||||
notificationQueue: [],
|
||||
},
|
||||
mutations: {
|
||||
// Mutaion for adding notification to queue
|
||||
[NOTIFICATION_MUTATIONS.ADD](state: any, notification: any): void {
|
||||
state.notificationQueue.push(notification);
|
||||
state: {
|
||||
// Dynamic queue for displaying notifications
|
||||
notificationQueue: [],
|
||||
},
|
||||
mutations: {
|
||||
// Mutaion for adding notification to queue
|
||||
[NOTIFICATION_MUTATIONS.ADD](state: any, notification: any): void {
|
||||
state.notificationQueue.push(notification);
|
||||
|
||||
// Pause current notification if it`s not first
|
||||
if (state.notificationQueue.length > 1) {
|
||||
notification.pause();
|
||||
}
|
||||
},
|
||||
// Mutaion for deleting notification to queue
|
||||
[NOTIFICATION_MUTATIONS.DELETE](state: any): void {
|
||||
state.notificationQueue[0].pause();
|
||||
state.notificationQueue.shift();
|
||||
// Pause current notification if it`s not first
|
||||
if (state.notificationQueue.length > 1) {
|
||||
notification.pause();
|
||||
}
|
||||
},
|
||||
// Mutaion for deleting notification to queue
|
||||
[NOTIFICATION_MUTATIONS.DELETE](state: any): void {
|
||||
state.notificationQueue[0].pause();
|
||||
state.notificationQueue.shift();
|
||||
|
||||
// Starts next notification in queue if it exist
|
||||
if (state.notificationQueue[0]) {
|
||||
state.notificationQueue[0].start();
|
||||
}
|
||||
},
|
||||
[NOTIFICATION_MUTATIONS.PAUSE](state: any): void {
|
||||
state.notificationQueue[0].pause();
|
||||
},
|
||||
[NOTIFICATION_MUTATIONS.RESUME](state: any): void {
|
||||
state.notificationQueue[0].start();
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// Commits muttation for adding success notification
|
||||
success: function ({commit}: any, message: string): void {
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE),
|
||||
NOTIFICATION_TYPES.SUCCESS,
|
||||
message,
|
||||
);
|
||||
// Starts next notification in queue if it exist
|
||||
if (state.notificationQueue[0]) {
|
||||
state.notificationQueue[0].start();
|
||||
}
|
||||
},
|
||||
[NOTIFICATION_MUTATIONS.PAUSE](state: any): void {
|
||||
state.notificationQueue[0].pause();
|
||||
},
|
||||
[NOTIFICATION_MUTATIONS.RESUME](state: any): void {
|
||||
state.notificationQueue[0].start();
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// Commits muttation for adding success notification
|
||||
success: function ({commit}: any, message: string): void {
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE),
|
||||
NOTIFICATION_TYPES.SUCCESS,
|
||||
message,
|
||||
);
|
||||
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
// Commits muttation for adding info notification
|
||||
notify: function ({commit}: any, message: string): void {
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
// Commits muttation for adding info notification
|
||||
notify: function ({commit}: any, message: string): void {
|
||||
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE),
|
||||
NOTIFICATION_TYPES.NOTIFICATION,
|
||||
message,
|
||||
);
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE),
|
||||
NOTIFICATION_TYPES.NOTIFICATION,
|
||||
message,
|
||||
);
|
||||
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
// Commits muttation for adding error notification
|
||||
error: function ({commit}: any, message: string): void {
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE),
|
||||
NOTIFICATION_TYPES.ERROR,
|
||||
message,
|
||||
);
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
// Commits muttation for adding error notification
|
||||
error: function ({commit}: any, message: string): void {
|
||||
const notification = new DelayedNotification(
|
||||
() => commit(NOTIFICATION_MUTATIONS.DELETE),
|
||||
NOTIFICATION_TYPES.ERROR,
|
||||
message,
|
||||
);
|
||||
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
deleteNotification: function ({commit}: any): void {
|
||||
commit(NOTIFICATION_MUTATIONS.DELETE);
|
||||
},
|
||||
pauseNotification: function ({commit}: any): void {
|
||||
commit(NOTIFICATION_MUTATIONS.PAUSE);
|
||||
},
|
||||
resumeNotification: function ({commit}: any): void {
|
||||
commit(NOTIFICATION_MUTATIONS.RESUME);
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
currentNotification: (state: any) => {
|
||||
return state.notificationQueue[0] ? state.notificationQueue[0] : null;
|
||||
},
|
||||
},
|
||||
commit(NOTIFICATION_MUTATIONS.ADD, notification);
|
||||
},
|
||||
deleteNotification: function ({commit}: any): void {
|
||||
commit(NOTIFICATION_MUTATIONS.DELETE);
|
||||
},
|
||||
pauseNotification: function ({commit}: any): void {
|
||||
commit(NOTIFICATION_MUTATIONS.PAUSE);
|
||||
},
|
||||
resumeNotification: function ({commit}: any): void {
|
||||
commit(NOTIFICATION_MUTATIONS.RESUME);
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
currentNotification: (state: any) => {
|
||||
return state.notificationQueue[0] ? state.notificationQueue[0] : null;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -3,129 +3,129 @@
|
||||
|
||||
import { PROJECT_MEMBER_MUTATIONS } from '../mutationConstants';
|
||||
import {
|
||||
addProjectMembersRequest,
|
||||
deleteProjectMembersRequest,
|
||||
fetchProjectMembersRequest
|
||||
addProjectMembersRequest,
|
||||
deleteProjectMembersRequest,
|
||||
fetchProjectMembersRequest
|
||||
} from '@/api/projectMembers';
|
||||
import { ProjectMemberSortByEnum } from '@/utils/constants/ProjectMemberSortEnum';
|
||||
|
||||
export const projectMembersModule = {
|
||||
state: {
|
||||
projectMembers: [],
|
||||
searchParameters: {
|
||||
sortBy: ProjectMemberSortByEnum.NAME,
|
||||
searchQuery: ''
|
||||
},
|
||||
pagination: {
|
||||
offset: 0,
|
||||
limit: 20,
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
[PROJECT_MEMBER_MUTATIONS.DELETE](state: any, projectMemberEmails: string[]) {
|
||||
const emailsCount = projectMemberEmails.length;
|
||||
state: {
|
||||
projectMembers: [],
|
||||
searchParameters: {
|
||||
sortBy: ProjectMemberSortByEnum.NAME,
|
||||
searchQuery: ''
|
||||
},
|
||||
pagination: {
|
||||
offset: 0,
|
||||
limit: 20,
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
[PROJECT_MEMBER_MUTATIONS.DELETE](state: any, projectMemberEmails: string[]) {
|
||||
const emailsCount = projectMemberEmails.length;
|
||||
|
||||
for (let j = 0; j < emailsCount; j++) {
|
||||
state.projectMembers = state.projectMembers.filter((element: any) => {
|
||||
return element.user.email !== projectMemberEmails[j];
|
||||
});
|
||||
}
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION](state: any, projectMemberId: string) {
|
||||
state.projectMembers = state.projectMembers.map((projectMember: any) => {
|
||||
if (projectMember.user.id === projectMemberId) {
|
||||
projectMember.isSelected = !projectMember.isSelected;
|
||||
}
|
||||
for (let j = 0; j < emailsCount; j++) {
|
||||
state.projectMembers = state.projectMembers.filter((element: any) => {
|
||||
return element.user.email !== projectMemberEmails[j];
|
||||
});
|
||||
}
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION](state: any, projectMemberId: string) {
|
||||
state.projectMembers = state.projectMembers.map((projectMember: any) => {
|
||||
if (projectMember.user.id === projectMemberId) {
|
||||
projectMember.isSelected = !projectMember.isSelected;
|
||||
}
|
||||
|
||||
return projectMember;
|
||||
});
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CLEAR_SELECTION](state: any) {
|
||||
state.projectMembers = state.projectMembers.map((projectMember: any) => {
|
||||
projectMember.isSelected = false;
|
||||
return projectMember;
|
||||
});
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CLEAR_SELECTION](state: any) {
|
||||
state.projectMembers = state.projectMembers.map((projectMember: any) => {
|
||||
projectMember.isSelected = false;
|
||||
|
||||
return projectMember;
|
||||
});
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.FETCH](state: any, teamMembers: any[]) {
|
||||
state.projectMembers = state.projectMembers.concat(teamMembers);
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CLEAR](state: any) {
|
||||
state.projectMembers = [];
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CHANGE_SORT_ORDER](state: any, sortBy: ProjectMemberSortByEnum) {
|
||||
state.searchParameters.sortBy = sortBy;
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.SET_SEARCH_QUERY](state: any, searchQuery: string) {
|
||||
state.searchParameters.searchQuery = searchQuery;
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.ADD_OFFSET](state: any) {
|
||||
state.pagination.offset += state.pagination.limit;
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET](state: any) {
|
||||
state.pagination.offset = 0;
|
||||
}
|
||||
return projectMember;
|
||||
});
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.FETCH](state: any, teamMembers: any[]) {
|
||||
state.projectMembers = state.projectMembers.concat(teamMembers);
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CLEAR](state: any) {
|
||||
state.projectMembers = [];
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CHANGE_SORT_ORDER](state: any, sortBy: ProjectMemberSortByEnum) {
|
||||
state.searchParameters.sortBy = sortBy;
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.SET_SEARCH_QUERY](state: any, searchQuery: string) {
|
||||
state.searchParameters.searchQuery = searchQuery;
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.ADD_OFFSET](state: any) {
|
||||
state.pagination.offset += state.pagination.limit;
|
||||
},
|
||||
[PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET](state: any) {
|
||||
state.pagination.offset = 0;
|
||||
}
|
||||
|
||||
},
|
||||
actions: {
|
||||
addProjectMembers: async function ({rootGetters}: any, emails: string[]): Promise<RequestResponse<null>> {
|
||||
const projectId = rootGetters.selectedProject.id;
|
||||
},
|
||||
actions: {
|
||||
addProjectMembers: async function ({rootGetters}: any, emails: string[]): Promise<RequestResponse<null>> {
|
||||
const projectId = rootGetters.selectedProject.id;
|
||||
|
||||
const response = await addProjectMembersRequest(projectId, emails);
|
||||
const response = await addProjectMembersRequest(projectId, emails);
|
||||
|
||||
return response;
|
||||
},
|
||||
deleteProjectMembers: async function ({commit, rootGetters}: any, projectMemberEmails: string[]): Promise<RequestResponse<null>> {
|
||||
const projectId = rootGetters.selectedProject.id;
|
||||
return response;
|
||||
},
|
||||
deleteProjectMembers: async function ({commit, rootGetters}: any, projectMemberEmails: string[]): Promise<RequestResponse<null>> {
|
||||
const projectId = rootGetters.selectedProject.id;
|
||||
|
||||
const response = await deleteProjectMembersRequest(projectId, projectMemberEmails);
|
||||
const response = await deleteProjectMembersRequest(projectId, projectMemberEmails);
|
||||
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.DELETE, projectMemberEmails);
|
||||
}
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.DELETE, projectMemberEmails);
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
toggleProjectMemberSelection: function ({commit}: any, projectMemberId: string) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION, projectMemberId);
|
||||
},
|
||||
clearProjectMemberSelection: function ({commit}: any) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_SELECTION);
|
||||
},
|
||||
fetchProjectMembers: async function ({commit, state, rootGetters}: any): Promise<RequestResponse<TeamMemberModel[]>> {
|
||||
const projectId = rootGetters.selectedProject.id;
|
||||
const response = await fetchProjectMembersRequest(projectId, state.pagination.limit, state.pagination.offset,
|
||||
state.searchParameters.sortBy, state.searchParameters.searchQuery);
|
||||
return response;
|
||||
},
|
||||
toggleProjectMemberSelection: function ({commit}: any, projectMemberId: string) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION, projectMemberId);
|
||||
},
|
||||
clearProjectMemberSelection: function ({commit}: any) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_SELECTION);
|
||||
},
|
||||
fetchProjectMembers: async function ({commit, state, rootGetters}: any): Promise<RequestResponse<TeamMemberModel[]>> {
|
||||
const projectId = rootGetters.selectedProject.id;
|
||||
const response = await fetchProjectMembersRequest(projectId, state.pagination.limit, state.pagination.offset,
|
||||
state.searchParameters.sortBy, state.searchParameters.searchQuery);
|
||||
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.FETCH, response.data);
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.FETCH, response.data);
|
||||
|
||||
if (response.data.length > 0) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.ADD_OFFSET);
|
||||
}
|
||||
}
|
||||
if (response.data.length > 0) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.ADD_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
setProjectMembersSortingBy: function ({commit, dispatch}, sortBy: ProjectMemberSortByEnum) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CHANGE_SORT_ORDER, sortBy);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET);
|
||||
},
|
||||
setProjectMembersSearchQuery: function ({commit, dispatch}, searchQuery: string) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.SET_SEARCH_QUERY, searchQuery);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET);
|
||||
},
|
||||
clearProjectMembers: function ({commit}: any) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR);
|
||||
},
|
||||
clearProjectMembersOffset: function ({commit}) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET);
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
projectMembers: (state: any) => state.projectMembers,
|
||||
selectedProjectMembers: (state: any) => state.projectMembers.filter((member: any) => member.isSelected),
|
||||
},
|
||||
return response;
|
||||
},
|
||||
setProjectMembersSortingBy: function ({commit, dispatch}, sortBy: ProjectMemberSortByEnum) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CHANGE_SORT_ORDER, sortBy);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET);
|
||||
},
|
||||
setProjectMembersSearchQuery: function ({commit, dispatch}, searchQuery: string) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.SET_SEARCH_QUERY, searchQuery);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR);
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET);
|
||||
},
|
||||
clearProjectMembers: function ({commit}: any) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR);
|
||||
},
|
||||
clearProjectMembersOffset: function ({commit}) {
|
||||
commit(PROJECT_MEMBER_MUTATIONS.CLEAR_OFFSET);
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
projectMembers: (state: any) => state.projectMembers,
|
||||
selectedProjectMembers: (state: any) => state.projectMembers.filter((member: any) => member.isSelected),
|
||||
},
|
||||
};
|
||||
|
@ -5,51 +5,51 @@ import { PROJECTS_MUTATIONS } from '../mutationConstants';
|
||||
import { createProjectRequest, deleteProjectRequest, fetchProjectsRequest, updateProjectRequest } from '@/api/projects';
|
||||
|
||||
export const projectsModule = {
|
||||
state: {
|
||||
projects: [],
|
||||
selectedProject: {
|
||||
name: 'Choose Project',
|
||||
id: '',
|
||||
companyName: '',
|
||||
description: '',
|
||||
isTermsAccepted: false,
|
||||
createdAt: '',
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
[PROJECTS_MUTATIONS.CREATE](state: any, createdProject: Project): void {
|
||||
state.projects.push(createdProject);
|
||||
},
|
||||
[PROJECTS_MUTATIONS.FETCH](state: any, projects: Project[]): void {
|
||||
state.projects = projects;
|
||||
},
|
||||
[PROJECTS_MUTATIONS.SELECT](state: any, projectID: string): void {
|
||||
const selected = state.projects.find((project: any) => project.id === projectID);
|
||||
state: {
|
||||
projects: [],
|
||||
selectedProject: {
|
||||
name: 'Choose Project',
|
||||
id: '',
|
||||
companyName: '',
|
||||
description: '',
|
||||
isTermsAccepted: false,
|
||||
createdAt: '',
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
[PROJECTS_MUTATIONS.CREATE](state: any, createdProject: Project): void {
|
||||
state.projects.push(createdProject);
|
||||
},
|
||||
[PROJECTS_MUTATIONS.FETCH](state: any, projects: Project[]): void {
|
||||
state.projects = projects;
|
||||
},
|
||||
[PROJECTS_MUTATIONS.SELECT](state: any, projectID: string): void {
|
||||
const selected = state.projects.find((project: any) => project.id === projectID);
|
||||
|
||||
if (!selected) {
|
||||
return;
|
||||
}
|
||||
if (!selected) {
|
||||
return;
|
||||
}
|
||||
|
||||
state.selectedProject = selected;
|
||||
},
|
||||
[PROJECTS_MUTATIONS.UPDATE](state: any, updateProjectModel: UpdateProjectModel): void {
|
||||
const selected = state.projects.find((project: any) => project.id === updateProjectModel.id);
|
||||
if (!selected) {
|
||||
return;
|
||||
}
|
||||
state.selectedProject = selected;
|
||||
},
|
||||
[PROJECTS_MUTATIONS.UPDATE](state: any, updateProjectModel: UpdateProjectModel): void {
|
||||
const selected = state.projects.find((project: any) => project.id === updateProjectModel.id);
|
||||
if (!selected) {
|
||||
return;
|
||||
}
|
||||
|
||||
selected.description = updateProjectModel.description;
|
||||
selected.description = updateProjectModel.description;
|
||||
|
||||
if (state.selectedProject.id === updateProjectModel.id) {
|
||||
state.selectedProject.description = updateProjectModel.description;
|
||||
}
|
||||
},
|
||||
if (state.selectedProject.id === updateProjectModel.id) {
|
||||
state.selectedProject.description = updateProjectModel.description;
|
||||
}
|
||||
},
|
||||
[PROJECTS_MUTATIONS.DELETE](state: any, projectID: string): void {
|
||||
if (state.selectedProject.id === projectID) {
|
||||
state.selectedProject.id = '';
|
||||
}
|
||||
},
|
||||
[PROJECTS_MUTATIONS.CLEAR](state: any): void {
|
||||
[PROJECTS_MUTATIONS.CLEAR](state: any): void {
|
||||
state.projects = [];
|
||||
state.selectedProject = {
|
||||
name: 'Choose Project',
|
||||
@ -60,61 +60,61 @@ export const projectsModule = {
|
||||
createdAt: '',
|
||||
};
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
fetchProjects: async function ({commit}: any): Promise<RequestResponse<Project[]>> {
|
||||
let response: RequestResponse<Project[]> = await fetchProjectsRequest();
|
||||
},
|
||||
actions: {
|
||||
fetchProjects: async function ({commit}: any): Promise<RequestResponse<Project[]>> {
|
||||
let response: RequestResponse<Project[]> = await fetchProjectsRequest();
|
||||
|
||||
if (response.isSuccess) {
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECTS_MUTATIONS.FETCH, response.data);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
createProject: async function ({commit}: any, project: Project): Promise<RequestResponse<Project>> {
|
||||
let response = await createProjectRequest(project);
|
||||
return response;
|
||||
},
|
||||
createProject: async function ({commit}: any, project: Project): Promise<RequestResponse<Project>> {
|
||||
let response = await createProjectRequest(project);
|
||||
|
||||
if (response.isSuccess) {
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECTS_MUTATIONS.CREATE, response.data);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
selectProject: function ({commit}: any, projectID: string) {
|
||||
commit(PROJECTS_MUTATIONS.SELECT, projectID);
|
||||
},
|
||||
updateProject: async function ({commit}: any, updateProjectModel: UpdateProjectModel): Promise<RequestResponse<null>> {
|
||||
let response = await updateProjectRequest(updateProjectModel.id, updateProjectModel.description);
|
||||
return response;
|
||||
},
|
||||
selectProject: function ({commit}: any, projectID: string) {
|
||||
commit(PROJECTS_MUTATIONS.SELECT, projectID);
|
||||
},
|
||||
updateProject: async function ({commit}: any, updateProjectModel: UpdateProjectModel): Promise<RequestResponse<null>> {
|
||||
let response = await updateProjectRequest(updateProjectModel.id, updateProjectModel.description);
|
||||
|
||||
if (response.isSuccess) {
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECTS_MUTATIONS.UPDATE, updateProjectModel);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
deleteProject: async function ({commit}: any, projectID: string): Promise<RequestResponse<null>> {
|
||||
let response = await deleteProjectRequest(projectID);
|
||||
return response;
|
||||
},
|
||||
deleteProject: async function ({commit}: any, projectID: string): Promise<RequestResponse<null>> {
|
||||
let response = await deleteProjectRequest(projectID);
|
||||
|
||||
if (response.isSuccess) {
|
||||
if (response.isSuccess) {
|
||||
commit(PROJECTS_MUTATIONS.DELETE, projectID);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
return response;
|
||||
},
|
||||
clearProjects: function({commit}: any) {
|
||||
commit(PROJECTS_MUTATIONS.CLEAR);
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
projects: (state: any) => {
|
||||
return state.projects.map((project: any) => {
|
||||
if (project.id === state.selectedProject.id) {
|
||||
project.isSelected = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
projects: (state: any) => {
|
||||
return state.projects.map((project: any) => {
|
||||
if (project.id === state.selectedProject.id) {
|
||||
project.isSelected = true;
|
||||
}
|
||||
|
||||
return project;
|
||||
});
|
||||
},
|
||||
selectedProject: (state: any) => state.selectedProject,
|
||||
},
|
||||
return project;
|
||||
});
|
||||
},
|
||||
selectedProject: (state: any) => state.selectedProject,
|
||||
},
|
||||
};
|
||||
|
@ -3,32 +3,32 @@
|
||||
|
||||
import { USER_MUTATIONS } from '../mutationConstants';
|
||||
import {
|
||||
deleteAccountRequest,
|
||||
updateAccountRequest,
|
||||
changePasswordRequest,
|
||||
getUserRequest,
|
||||
activateAccountRequest
|
||||
deleteAccountRequest,
|
||||
updateAccountRequest,
|
||||
changePasswordRequest,
|
||||
getUserRequest,
|
||||
activateAccountRequest
|
||||
} from '@/api/users';
|
||||
|
||||
export const usersModule = {
|
||||
state: {
|
||||
user: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
},
|
||||
state: {
|
||||
user: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
},
|
||||
|
||||
mutations: {
|
||||
[USER_MUTATIONS.SET_USER_INFO](state: any, user: User): void {
|
||||
state.user = user;
|
||||
},
|
||||
mutations: {
|
||||
[USER_MUTATIONS.SET_USER_INFO](state: any, user: User): void {
|
||||
state.user = user;
|
||||
},
|
||||
|
||||
[USER_MUTATIONS.REVERT_TO_DEFAULT_USER_INFO](state: any): void {
|
||||
state.user.firstName = '';
|
||||
state.user.lastName = '';
|
||||
state.user.email = '';
|
||||
},
|
||||
[USER_MUTATIONS.REVERT_TO_DEFAULT_USER_INFO](state: any): void {
|
||||
state.user.firstName = '';
|
||||
state.user.lastName = '';
|
||||
state.user.email = '';
|
||||
},
|
||||
|
||||
[USER_MUTATIONS.UPDATE_USER_INFO](state: any, user: User): void {
|
||||
state.user = user;
|
||||
@ -41,45 +41,45 @@ export const usersModule = {
|
||||
email: ''
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
actions: {
|
||||
updateAccount: async function ({commit}: any, userInfo: User): Promise<RequestResponse<User>> {
|
||||
let response = await updateAccountRequest(userInfo);
|
||||
let response = await updateAccountRequest(userInfo);
|
||||
|
||||
if (response.isSuccess) {
|
||||
if (response.isSuccess) {
|
||||
commit(USER_MUTATIONS.UPDATE_USER_INFO, response.data);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
return response;
|
||||
},
|
||||
changePassword: async function ({state}: any, updateModel: UpdatePasswordModel): Promise<RequestResponse<null>> {
|
||||
return await changePasswordRequest(updateModel.oldPassword, updateModel.newPassword);
|
||||
},
|
||||
deleteAccount: async function ({commit, state}: any, password: string): Promise<RequestResponse<null>> {
|
||||
return await changePasswordRequest(updateModel.oldPassword, updateModel.newPassword);
|
||||
},
|
||||
deleteAccount: async function ({commit, state}: any, password: string): Promise<RequestResponse<null>> {
|
||||
return await deleteAccountRequest(password);
|
||||
},
|
||||
getUser: async function ({commit}: any): Promise<RequestResponse<User>> {
|
||||
let response = await getUserRequest();
|
||||
},
|
||||
getUser: async function ({commit}: any): Promise<RequestResponse<User>> {
|
||||
let response = await getUserRequest();
|
||||
|
||||
if (response.isSuccess) {
|
||||
if (response.isSuccess) {
|
||||
commit(USER_MUTATIONS.SET_USER_INFO, response.data);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
return response;
|
||||
},
|
||||
clearUser: function({commit}: any) {
|
||||
commit(USER_MUTATIONS.CLEAR);
|
||||
},
|
||||
activateAccount: async function ({commit}, temporaryToken: string): Promise<RequestResponse<string>> {
|
||||
return await activateAccountRequest(temporaryToken);
|
||||
}
|
||||
},
|
||||
activateAccount: async function ({commit}, temporaryToken: string): Promise<RequestResponse<string>> {
|
||||
return await activateAccountRequest(temporaryToken);
|
||||
}
|
||||
},
|
||||
|
||||
getters: {
|
||||
user: (state: any) => {
|
||||
return state.user;
|
||||
},
|
||||
userName: (state: any) => `${state.user.firstName} ${state.user.lastName}`
|
||||
},
|
||||
getters: {
|
||||
user: (state: any) => {
|
||||
return state.user;
|
||||
},
|
||||
userName: (state: any) => `${state.user.firstName} ${state.user.lastName}`
|
||||
},
|
||||
};
|
||||
|
@ -2,59 +2,59 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export const USER_MUTATIONS = {
|
||||
SET_USER_INFO: 'SET_USER_INFO',
|
||||
REVERT_TO_DEFAULT_USER_INFO: 'REVERT_TO_DEFAULT_USER_INFO',
|
||||
UPDATE_USER_INFO: 'UPDATE_USER_INFO',
|
||||
SET_USER_INFO: 'SET_USER_INFO',
|
||||
REVERT_TO_DEFAULT_USER_INFO: 'REVERT_TO_DEFAULT_USER_INFO',
|
||||
UPDATE_USER_INFO: 'UPDATE_USER_INFO',
|
||||
CLEAR: 'CLEAR_USER',
|
||||
};
|
||||
|
||||
export const PROJECTS_MUTATIONS = {
|
||||
CREATE: 'CREATE_PROJECT',
|
||||
DELETE: 'DELETE_PROJECT',
|
||||
UPDATE: 'UPDATE_PROJECT',
|
||||
FETCH: 'FETCH_PROJECTS',
|
||||
SELECT: 'SELECT_PROJECT',
|
||||
CREATE: 'CREATE_PROJECT',
|
||||
DELETE: 'DELETE_PROJECT',
|
||||
UPDATE: 'UPDATE_PROJECT',
|
||||
FETCH: 'FETCH_PROJECTS',
|
||||
SELECT: 'SELECT_PROJECT',
|
||||
CLEAR: 'CLEAR_PROJECTS',
|
||||
};
|
||||
|
||||
export const PROJECT_MEMBER_MUTATIONS = {
|
||||
FETCH: 'FETCH_MEMBERS',
|
||||
TOGGLE_SELECTION: 'TOGGLE_SELECTION',
|
||||
CLEAR_SELECTION: 'CLEAR_SELECTION',
|
||||
ADD: 'ADD_MEMBERS',
|
||||
DELETE: 'DELETE_MEMBERS',
|
||||
CLEAR: 'CLEAR_MEMBERS',
|
||||
CHANGE_SORT_ORDER: 'CHANGE_SORT_ORDER',
|
||||
SET_SEARCH_QUERY: 'SET_SEARCH_QUERY',
|
||||
CLEAR_OFFSET: 'CLEAR_OFFSET',
|
||||
ADD_OFFSET:'ADD_OFFSET',
|
||||
FETCH: 'FETCH_MEMBERS',
|
||||
TOGGLE_SELECTION: 'TOGGLE_SELECTION',
|
||||
CLEAR_SELECTION: 'CLEAR_SELECTION',
|
||||
ADD: 'ADD_MEMBERS',
|
||||
DELETE: 'DELETE_MEMBERS',
|
||||
CLEAR: 'CLEAR_MEMBERS',
|
||||
CHANGE_SORT_ORDER: 'CHANGE_SORT_ORDER',
|
||||
SET_SEARCH_QUERY: 'SET_SEARCH_QUERY',
|
||||
CLEAR_OFFSET: 'CLEAR_OFFSET',
|
||||
ADD_OFFSET:'ADD_OFFSET',
|
||||
};
|
||||
|
||||
export const API_KEYS_MUTATIONS = {
|
||||
FETCH: 'FETCH_API_KEYS',
|
||||
ADD: 'ADD_API_KEY',
|
||||
DELETE: 'DELETE_API_KEY',
|
||||
TOGGLE_SELECTION: "TOGGLE_SELECTION",
|
||||
CLEAR_SELECTION: "CLEAR_SELECTION",
|
||||
CLEAR: 'CLEAR_API_KEYS',
|
||||
}
|
||||
FETCH: 'FETCH_API_KEYS',
|
||||
ADD: 'ADD_API_KEY',
|
||||
DELETE: 'DELETE_API_KEY',
|
||||
TOGGLE_SELECTION: 'TOGGLE_SELECTION',
|
||||
CLEAR_SELECTION: 'CLEAR_SELECTION',
|
||||
CLEAR: 'CLEAR_API_KEYS',
|
||||
};
|
||||
|
||||
export const NOTIFICATION_MUTATIONS = {
|
||||
ADD: 'ADD_NOTIFICATION',
|
||||
DELETE: 'DELETE_NOTIFICATION',
|
||||
PAUSE: 'PAUSE_NOTIFICATION',
|
||||
RESUME: 'RESUME_NOTIFICATION',
|
||||
ADD: 'ADD_NOTIFICATION',
|
||||
DELETE: 'DELETE_NOTIFICATION',
|
||||
PAUSE: 'PAUSE_NOTIFICATION',
|
||||
RESUME: 'RESUME_NOTIFICATION',
|
||||
};
|
||||
|
||||
export const APP_STATE_MUTATIONS = {
|
||||
TOGGLE_ADD_TEAMMEMBER_POPUP: 'TOGGLE_ADD_TEAMMEMBER_POPUP',
|
||||
TOGGLE_NEW_PROJECT_POPUP: 'TOGGLE_NEW_PROJECT_POPUP',
|
||||
TOGGLE_NEW_PROJECT_POPUP: 'TOGGLE_NEW_PROJECT_POPUP',
|
||||
TOGGLE_PROJECT_DROPDOWN: 'TOGGLE_PROJECT_DROPDOWN',
|
||||
TOGGLE_ACCOUNT_DROPDOWN: 'TOGGLE_ACCOUNT_DROPDOWN',
|
||||
TOGGLE_DELETE_PROJECT_DROPDOWN: 'TOGGLE_DELETE_PROJECT_DROPDOWN',
|
||||
TOGGLE_DELETE_ACCOUNT_DROPDOWN: 'TOGGLE_DELETE_ACCOUNT_DROPDOWN',
|
||||
TOGGLE_SORT_PM_BY_DROPDOWN: 'TOGGLE_SORT_PM_BY_DROPDOWN',
|
||||
TOGGLE_NEW_API_KEY_POPUP: "TOGGLE_NEW_API_KEY_POPUP",
|
||||
TOGGLE_SUCCESSFUL_REGISTRATION_POPUP: 'TOGGLE_SUCCESSFUL_REGISTRATION_POPUP',
|
||||
TOGGLE_SORT_PM_BY_DROPDOWN: 'TOGGLE_SORT_PM_BY_DROPDOWN',
|
||||
TOGGLE_NEW_API_KEY_POPUP: 'TOGGLE_NEW_API_KEY_POPUP',
|
||||
TOGGLE_SUCCESSFUL_REGISTRATION_POPUP: 'TOGGLE_SUCCESSFUL_REGISTRATION_POPUP',
|
||||
CLOSE_ALL: 'CLOSE_ALL',
|
||||
};
|
||||
|
@ -4,13 +4,13 @@
|
||||
import { getId } from '@/utils/idGenerator';
|
||||
|
||||
export class DelayedNotification {
|
||||
public type: string;
|
||||
public message: string;
|
||||
public id: string;
|
||||
private timerId: any = null;
|
||||
private startTime: any;
|
||||
private remainingTime: any;
|
||||
private callback: Function;
|
||||
public type: string;
|
||||
public message: string;
|
||||
public id: string;
|
||||
private timerId: any = null;
|
||||
private startTime: any;
|
||||
private remainingTime: any;
|
||||
private callback: Function;
|
||||
|
||||
constructor(callback: Function, type: string, message: string) {
|
||||
this.callback = callback;
|
||||
@ -21,13 +21,13 @@ export class DelayedNotification {
|
||||
this.start();
|
||||
}
|
||||
|
||||
public pause(): void {
|
||||
clearTimeout(this.timerId);
|
||||
this.remainingTime -= new Date().getMilliseconds() - this.startTime;
|
||||
}
|
||||
public pause(): void {
|
||||
clearTimeout(this.timerId);
|
||||
this.remainingTime -= new Date().getMilliseconds() - this.startTime;
|
||||
}
|
||||
|
||||
public start(): void {
|
||||
this.startTime = new Date().getMilliseconds();
|
||||
this.timerId = setTimeout(this.callback, this.remainingTime);
|
||||
}
|
||||
public start(): void {
|
||||
this.startTime = new Date().getMilliseconds();
|
||||
this.timerId = setTimeout(this.callback, this.remainingTime);
|
||||
}
|
||||
}
|
||||
|
12
web/satellite/src/types/fetch.d.ts
vendored
12
web/satellite/src/types/fetch.d.ts
vendored
@ -2,9 +2,9 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
declare type Answer = {
|
||||
isSuccess: boolean;
|
||||
error: {
|
||||
code: any;
|
||||
message: any;
|
||||
};
|
||||
}
|
||||
isSuccess: boolean;
|
||||
error: {
|
||||
code: any;
|
||||
message: any;
|
||||
};
|
||||
};
|
||||
|
34
web/satellite/src/types/projects.d.ts
vendored
34
web/satellite/src/types/projects.d.ts
vendored
@ -3,28 +3,28 @@
|
||||
|
||||
// Project is a type, used for creating new project in backend
|
||||
declare type Project = {
|
||||
id: string,
|
||||
id: string,
|
||||
|
||||
name: string,
|
||||
description: string,
|
||||
createdAt: string,
|
||||
name: string,
|
||||
description: string,
|
||||
createdAt: string,
|
||||
|
||||
isSelected: boolean,
|
||||
}
|
||||
isSelected: boolean,
|
||||
};
|
||||
|
||||
// UpdateProjectModel is a type, used for updating project description
|
||||
declare type UpdateProjectModel = {
|
||||
id: string,
|
||||
description: string,
|
||||
}
|
||||
id: string,
|
||||
description: string,
|
||||
};
|
||||
|
||||
// TeamMemberModel stores needed info about user info to show it on UI
|
||||
declare type TeamMemberModel = {
|
||||
user: {
|
||||
id: string,
|
||||
email: string,
|
||||
firstName: string,
|
||||
lastName: string,
|
||||
}
|
||||
joinedAt: string,
|
||||
}
|
||||
user: {
|
||||
id: string,
|
||||
email: string,
|
||||
firstName: string,
|
||||
lastName: string,
|
||||
}
|
||||
joinedAt: string,
|
||||
};
|
||||
|
24
web/satellite/src/types/register.d.ts
vendored
24
web/satellite/src/types/register.d.ts
vendored
@ -2,15 +2,15 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
declare type RegisterData = {
|
||||
firstName: string,
|
||||
firstNameError: string,
|
||||
lastName: string,
|
||||
email: string,
|
||||
emailError: string,
|
||||
password: string,
|
||||
passwordError: string,
|
||||
repeatedPassword: string,
|
||||
repeatedPasswordError: string,
|
||||
isTermsAccepted: boolean,
|
||||
isTermsAcceptedError: boolean,
|
||||
}
|
||||
firstName: string,
|
||||
firstNameError: string,
|
||||
lastName: string,
|
||||
email: string,
|
||||
emailError: string,
|
||||
password: string,
|
||||
passwordError: string,
|
||||
repeatedPassword: string,
|
||||
repeatedPasswordError: string,
|
||||
isTermsAccepted: boolean,
|
||||
isTermsAcceptedError: boolean,
|
||||
};
|
||||
|
2
web/satellite/src/types/response.d.ts
vendored
2
web/satellite/src/types/response.d.ts
vendored
@ -5,4 +5,4 @@ declare type RequestResponse<T> = {
|
||||
isSuccess: boolean,
|
||||
errorMessage: string,
|
||||
data: T
|
||||
}
|
||||
};
|
||||
|
22
web/satellite/src/types/tsx.d.ts
vendored
22
web/satellite/src/types/tsx.d.ts
vendored
@ -4,17 +4,17 @@
|
||||
import Vue, { VNode } from 'vue';
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
// tslint:disable no-empty-interface
|
||||
interface Element extends VNode {
|
||||
}
|
||||
namespace JSX {
|
||||
// tslint:disable no-empty-interface
|
||||
interface Element extends VNode {
|
||||
}
|
||||
|
||||
// tslint:disable no-empty-interface
|
||||
interface ElementClass extends Vue {
|
||||
}
|
||||
// tslint:disable no-empty-interface
|
||||
interface ElementClass extends Vue {
|
||||
}
|
||||
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
web/satellite/src/types/users.d.ts
vendored
12
web/satellite/src/types/users.d.ts
vendored
@ -2,13 +2,13 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
declare type User = {
|
||||
firstName: string,
|
||||
lastName: string,
|
||||
email: string
|
||||
}
|
||||
firstName: string,
|
||||
lastName: string,
|
||||
email: string
|
||||
};
|
||||
|
||||
// Used in users module to pass parameters to action
|
||||
declare type UpdatePasswordModel = {
|
||||
oldPassword: string,
|
||||
newPassword: string
|
||||
}
|
||||
newPassword: string
|
||||
};
|
||||
|
4
web/satellite/src/types/vue.d.ts
vendored
4
web/satellite/src/types/vue.d.ts
vendored
@ -2,6 +2,6 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
declare module '*.vue' {
|
||||
import Vue from 'vue';
|
||||
export default Vue;
|
||||
import Vue from 'vue';
|
||||
export default Vue;
|
||||
}
|
||||
|
@ -9,27 +9,27 @@ import { getToken } from '@/utils/tokenManager';
|
||||
|
||||
// Satellite url
|
||||
const satelliteUrl = new HttpLink({
|
||||
uri: 'http://localhost:10100/api/graphql/v0',
|
||||
uri: 'http://localhost:10100/api/graphql/v0',
|
||||
|
||||
});
|
||||
|
||||
// Adding auth headers
|
||||
const authLink = setContext((_, {headers}) => {
|
||||
// get the authentication token from local storage if it exists
|
||||
const token = getToken();
|
||||
// return the headers to the context so httpLink can read them
|
||||
// get the authentication token from local storage if it exists
|
||||
const token = getToken();
|
||||
// return the headers to the context so httpLink can read them
|
||||
|
||||
return {
|
||||
headers: {
|
||||
...headers,
|
||||
authorization: token ? `Bearer ${token}` : '',
|
||||
}
|
||||
};
|
||||
return {
|
||||
headers: {
|
||||
...headers,
|
||||
authorization: token ? `Bearer ${token}` : '',
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// Creating apollo client
|
||||
export default new ApolloClient({
|
||||
link: authLink.concat(satelliteUrl),
|
||||
cache: new InMemoryCache(),
|
||||
connectToDevTools: true,
|
||||
link: authLink.concat(satelliteUrl),
|
||||
cache: new InMemoryCache(),
|
||||
connectToDevTools: true,
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export enum ProjectMemberSortByEnum {
|
||||
NAME = 1,
|
||||
EMAIL,
|
||||
CREATED_AT,
|
||||
NAME = 1,
|
||||
EMAIL,
|
||||
CREATED_AT,
|
||||
}
|
||||
|
@ -8,49 +8,49 @@ export const APP_STATE_ACTIONS = {
|
||||
TOGGLE_ACCOUNT: 'toggleAccountDropdown',
|
||||
TOGGLE_DEL_PROJ: 'toggleDeleteProjectPopup',
|
||||
TOGGLE_DEL_ACCOUNT: 'toggleDeleteAccountPopup',
|
||||
TOGGLE_NEW_API_KEY: "toggleNewAPIKeyPopup",
|
||||
TOGGLE_SORT_PM_BY_DROPDOWN: 'toggleSortProjectMembersByPopup',
|
||||
TOGGLE_SUCCESSFUL_REGISTRATION_POPUP: 'toggleSuccessfulRegistrationPopup',
|
||||
CLOSE_POPUPS: 'closePopups',
|
||||
TOGGLE_NEW_API_KEY: 'toggleNewAPIKeyPopup',
|
||||
TOGGLE_SORT_PM_BY_DROPDOWN: 'toggleSortProjectMembersByPopup',
|
||||
TOGGLE_SUCCESSFUL_REGISTRATION_POPUP: 'toggleSuccessfulRegistrationPopup',
|
||||
CLOSE_POPUPS: 'closePopups',
|
||||
};
|
||||
|
||||
export const NOTIFICATION_ACTIONS = {
|
||||
SUCCESS: 'success',
|
||||
ERROR: 'error',
|
||||
NOTIFY: 'notify',
|
||||
DELETE: 'deleteNotification',
|
||||
PAUSE: 'pauseNotification',
|
||||
RESUME: 'resumeNotification',
|
||||
SUCCESS: 'success',
|
||||
ERROR: 'error',
|
||||
NOTIFY: 'notify',
|
||||
DELETE: 'deleteNotification',
|
||||
PAUSE: 'pauseNotification',
|
||||
RESUME: 'resumeNotification',
|
||||
};
|
||||
|
||||
export const PM_ACTIONS = {
|
||||
ADD: 'addProjectMembers',
|
||||
DELETE: 'deleteProjectMembers',
|
||||
TOGGLE_SELECTION: 'toggleProjectMemberSelection',
|
||||
CLEAR_SELECTION: 'clearProjectMemberSelection',
|
||||
FETCH: 'fetchProjectMembers',
|
||||
CLEAR: 'clearProjectMembers',
|
||||
SET_SEARCH_QUERY: 'setProjectMembersSearchQuery',
|
||||
SET_SORT_BY: 'setProjectMembersSortingBy',
|
||||
CLEAR_OFFSET: 'clearProjectMembersOffset'
|
||||
ADD: 'addProjectMembers',
|
||||
DELETE: 'deleteProjectMembers',
|
||||
TOGGLE_SELECTION: 'toggleProjectMemberSelection',
|
||||
CLEAR_SELECTION: 'clearProjectMemberSelection',
|
||||
FETCH: 'fetchProjectMembers',
|
||||
CLEAR: 'clearProjectMembers',
|
||||
SET_SEARCH_QUERY: 'setProjectMembersSearchQuery',
|
||||
SET_SORT_BY: 'setProjectMembersSortingBy',
|
||||
CLEAR_OFFSET: 'clearProjectMembersOffset'
|
||||
};
|
||||
|
||||
export const PROJETS_ACTIONS = {
|
||||
FETCH: 'fetchProjects',
|
||||
CREATE: 'createProject',
|
||||
SELECT: 'selectProject',
|
||||
UPDATE: 'updateProject',
|
||||
DELETE: 'deleteProject',
|
||||
CLEAR: 'clearProjects',
|
||||
FETCH: 'fetchProjects',
|
||||
CREATE: 'createProject',
|
||||
SELECT: 'selectProject',
|
||||
UPDATE: 'updateProject',
|
||||
DELETE: 'deleteProject',
|
||||
CLEAR: 'clearProjects',
|
||||
};
|
||||
|
||||
export const USER_ACTIONS = {
|
||||
UPDATE: 'updateAccount',
|
||||
CHANGE_PASSWORD: 'changePassword',
|
||||
DELETE: 'deleteAccount',
|
||||
GET: 'getUser',
|
||||
CLEAR: 'clearUser',
|
||||
ACTIVATE: 'activateAccount',
|
||||
UPDATE: 'updateAccount',
|
||||
CHANGE_PASSWORD: 'changePassword',
|
||||
DELETE: 'deleteAccount',
|
||||
GET: 'getUser',
|
||||
CLEAR: 'clearUser',
|
||||
ACTIVATE: 'activateAccount',
|
||||
};
|
||||
|
||||
export const API_KEYS_ACTIONS = {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export const EMPTY_STATE_IMAGES = {
|
||||
PROJECT: `<svg width="346" height="345" viewBox="0 0 346 345" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
PROJECT: `<svg width="346" height="345" viewBox="0 0 346 345" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M165.9 284.9C244.4 284.9 308 221.1 308 142.4C308 63.7 244.4 0 165.9 0C87.3998 0 23.7998 63.8 23.7998 142.5C23.7998 221.2 87.3998 284.9 165.9 284.9Z" fill="#E8EAF2"/>
|
||||
<path d="M110.6 64.4004C110.2 64.4004 109.9 64.4004 109.6 64.4004C109 64.4004 108.4 64.1004 108.1 63.6004C100.9 50.4004 86.7 41.4004 70.4 41.4004C55.7 41.4004 42.7 48.8004 35 60.0004C34.6 60.6004 33.9 60.8004 33.3 60.7004C31.4 60.3004 29.4 60.1004 27.3 60.1004C12.2 60.0004 0 72.1004 0 87.1004C0 88.0004 0.7 88.7004 1.6 88.7004H131.8C132.7 88.7004 133.4 88.0004 133.4 87.1004C133.4 74.6004 123.2 64.4004 110.6 64.4004Z" fill="#B0B6C9"/>
|
||||
<path d="M34.9002 281.8C43.2002 279.8 48.3002 271.2 46.3002 262.6C44.3002 254 35.8002 248.7 27.5002 250.6C19.2002 252.5 14.0002 261.3 16.1002 269.8C18.0002 278.5 26.5002 283.8 34.9002 281.8Z" fill="#8F96AD"/>
|
||||
@ -41,7 +41,7 @@ export const EMPTY_STATE_IMAGES = {
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M259.9 208.7C263.5 208.7 266.5 205.7 266.5 202.1C266.5 198.5 263.5 195.5 259.9 195.5C256.3 195.5 253.3 198.5 253.3 202.1C253.2 205.7 256.2 208.7 259.9 208.7Z" fill="#A5A9B5"/>
|
||||
</svg>
|
||||
`,
|
||||
TEAM: `<svg width="380" height="295" viewBox="0 0 380 295" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
TEAM: `<svg width="380" height="295" viewBox="0 0 380 295" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M168 295C246.997 295 311 231.2 311 152.5C311 73.8 246.997 10 168 10C89.0028 10 25 73.8 25 152.5C25 231.2 89.0028 295 168 295Z" fill="#E8EAF2"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.3168 98C21.4071 98 20 96.5077 20 94.6174C20.9046 68.9496 31.8599 45.769 49.0467 28.7566C66.2335 11.7442 89.6518 0.900089 115.583 0.00470057C117.492 -0.094787 119 1.39753 119 3.28779V32.4377C119 34.2284 117.593 35.6213 115.784 35.7208C99.7025 36.5167 85.2294 43.3813 74.4751 53.927C63.8213 64.5722 56.8863 78.8984 56.0822 94.8164C55.9817 96.6072 54.5746 98 52.7655 98H23.3168Z" fill="#B0B6C9"/>
|
||||
<path d="M117.5 30C124.404 30 130 25.0751 130 19C130 12.9249 124.404 8 117.5 8C110.596 8 105 12.9249 105 19C105 25.0751 110.596 30 117.5 30Z" fill="#8F96AD"/>
|
||||
@ -71,7 +71,7 @@ export const EMPTY_STATE_IMAGES = {
|
||||
<path d="M350.452 224.555C349.952 224.555 349.553 224.555 349.154 224.654C348.355 224.754 347.557 224.256 347.257 223.56C337.873 206.543 319.705 195 298.742 195C279.775 195 263.004 204.454 253.121 218.883C252.622 219.579 251.724 219.878 250.925 219.778C248.429 219.281 245.834 218.982 243.239 218.982C223.772 219.082 208 234.605 208 253.91C208 253.91 208 253.91 208 254.01C208 255.104 208.898 256 210.096 256H377.904C379.002 256 380 255.104 380 254.01V253.91C379.8 237.591 366.623 224.555 350.452 224.555Z" fill="#B0B6C9"/>
|
||||
<path d="M206 195C210.418 195 214 191.194 214 186.5C214 181.806 210.418 178 206 178C201.582 178 198 181.806 198 186.5C198 191.194 201.582 195 206 195Z" fill="white"/>
|
||||
</svg>`,
|
||||
DELETE_ACCOUNT: `<svg width="240" height="187" viewBox="0 0 380 295" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
DELETE_ACCOUNT: `<svg width="240" height="187" viewBox="0 0 380 295" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M168 295C246.997 295 311 231.2 311 152.5C311 73.8 246.997 10 168 10C89.0028 10 25 73.8 25 152.5C25 231.2 89.0028 295 168 295Z" fill="#E8EAF2"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.3168 98C21.4071 98 20 96.5077 20 94.6174C20.9046 68.9496 31.8599 45.769 49.0467 28.7566C66.2335 11.7442 89.6518 0.900089 115.583 0.00470057C117.492 -0.094787 119 1.39753 119 3.28779V32.4377C119 34.2284 117.593 35.6213 115.784 35.7208C99.7025 36.5167 85.2294 43.3813 74.4751 53.927C63.8213 64.5722 56.8863 78.8984 56.0822 94.8164C55.9817 96.6072 54.5746 98 52.7655 98H23.3168Z" fill="#B0B6C9"/>
|
||||
<path d="M117.5 30C124.404 30 130 25.0751 130 19C130 12.9249 124.404 8 117.5 8C110.596 8 105 12.9249 105 19C105 25.0751 110.596 30 117.5 30Z" fill="#8F96AD"/>
|
||||
|
@ -2,10 +2,10 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
const NAVIGATION_ITEMS = {
|
||||
// DASHBOARD: {
|
||||
// label: 'Dashboard',
|
||||
// path: '/',
|
||||
// svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
// DASHBOARD: {
|
||||
// label: 'Dashboard',
|
||||
// path: '/',
|
||||
// svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
// <g clip-path="url(#clip0)">
|
||||
// <path fill-rule="evenodd" clip-rule="evenodd" d="M22.9535 4.1849C23.1974 3.94097 23.604 3.94097 23.8479 4.1849C24.0918 4.42882 24.0918 4.83536 23.8479 4.99798L19.8638 9.22602V7.43723L22.9535 4.1849ZM3.52035 14.0232C3.60165 14.1045 3.76427 14.1858 3.92689 14.1858C4.08951 14.1858 4.25212 14.1045 4.25212 14.0232L8.8867 9.38865C9.04932 9.22603 9.29324 9.14472 9.45586 9.14472C9.69979 9.14472 9.8624 9.22603 10.025 9.38865L13.3587 12.8849C13.7652 13.2914 14.2531 13.5354 14.8222 13.5354C15.3914 13.5354 15.8792 13.2914 16.2858 12.8849L19.7822 9.23804V15.4056C19.8636 16.1374 19.2131 16.7879 18.4813 16.7879H2.38224C1.56916 16.7879 1 16.1374 1 15.4056V5.6486C1 4.83552 1.65047 4.26636 2.38224 4.26636H18.4C19.2131 4.26636 19.7822 4.91682 19.7822 5.6486V7.51567L15.4727 12.1531C15.3101 12.3157 15.1474 12.3971 14.9035 12.3971C14.6596 12.3971 14.497 12.3157 14.3344 12.1531L11.0007 8.65687C10.5942 8.25033 10.1063 8.0064 9.53717 8.0064C9.04932 8.0064 8.48016 8.16902 8.15493 8.49425L3.52035 13.1288C3.27642 13.3728 3.27642 13.7793 3.52035 14.0232ZM15.5543 21.341H5.2281C4.90287 21.341 4.57764 21.097 4.57764 20.6905C4.57764 20.284 4.82156 20.04 5.2281 20.04H15.5543C15.8795 20.04 16.2047 20.284 16.2047 20.6905C16.2047 21.097 15.8795 21.341 15.5543 21.341Z" fill="#354049"/>
|
||||
// </g>
|
||||
@ -15,18 +15,18 @@ const NAVIGATION_ITEMS = {
|
||||
// </clipPath>
|
||||
// </defs>
|
||||
// </svg>`
|
||||
// },
|
||||
PROJECT_DETAILS: {
|
||||
label: 'Project Details',
|
||||
path: '/project-details',
|
||||
svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
// },
|
||||
PROJECT_DETAILS: {
|
||||
label: 'Project Details',
|
||||
path: '/project-details',
|
||||
svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22.073 5.3913C21.8382 5.15652 21.5252 5 21.2121 5H6.89038C6.26429 5 5.71647 5.54783 5.79473 6.09565L2.19473 6.01739C1.80342 6.09565 1.49038 6.17391 1.2556 6.48696C1.09908 6.72174 0.942555 7.03478 1.02082 7.42609L3.13386 18.4609C3.21212 19.0087 3.68169 19.4 4.22951 19.4H19.0991C19.6469 19.4 20.1165 19.0087 20.1947 18.4609L22.3078 6.33043C22.386 6.01739 22.3078 5.62609 22.073 5.3913ZM19.6469 14.7826L18.7078 9.38261C18.6295 8.75652 18.0034 8.28696 17.3773 8.28696H8.4556C8.37734 8.28696 8.29908 8.2087 8.29908 8.13043L8.14256 7.34783C8.14256 6.8 7.75125 6.33043 7.28169 6.17391L21.2121 6.09565L19.6469 14.7826Z" fill="#363840"/>
|
||||
</svg>`
|
||||
},
|
||||
TEAM: {
|
||||
label: 'Team',
|
||||
path: '/team',
|
||||
svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
},
|
||||
TEAM: {
|
||||
label: 'Team',
|
||||
path: '/team',
|
||||
svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<path d="M19.6621 11.1388C19.8233 10.8971 19.9039 10.6553 19.9845 10.333C20.5485 10.0913 20.8709 9.52718 20.9515 8.72136C21.032 7.99612 20.7097 7.43204 20.3068 7.10971C20.2262 5.01456 19.5816 3 16.6 3C13.6184 3 12.9738 5.01456 12.8126 7.10971C12.4097 7.43204 12.0874 8.0767 12.168 8.72136C12.2485 9.4466 12.6515 10.0913 13.135 10.333C13.2155 10.5748 13.3767 10.8971 13.4573 11.1388C12.9738 11.3 12.4903 11.4612 12.0874 11.6223C11.6845 11.4612 11.201 11.2194 10.7175 11.1388C10.8786 10.8971 10.9592 10.6553 11.0398 10.333C11.6039 10.0913 11.9262 9.52718 12.0068 8.72136C12.0874 7.99612 11.765 7.43204 11.3621 7.10971C11.201 5.01456 10.6369 3 7.57476 3C4.5932 3 3.94854 5.01456 3.78738 7.10971C3.38447 7.43204 3.06214 8.0767 3.14272 8.72136C3.2233 9.4466 3.62621 10.0913 4.10971 10.333C4.19029 10.5748 4.35146 10.8971 4.43204 11.1388C1.53107 11.9447 0 13.6369 0 16.2155C0 16.4573 0.161165 16.6184 0.32233 16.699C2.09515 17.5049 4.75437 17.9883 7.49418 17.9883C9.10583 17.9883 10.6369 17.8272 12.0068 17.5049C13.3767 17.8272 14.9078 17.9883 16.5194 17.9883C19.2592 17.9883 21.9184 17.5049 23.6913 16.699C23.8524 16.6184 24.0136 16.3767 24.0136 16.2155C24.0942 13.6369 22.5631 11.9447 19.6621 11.1388Z" fill="#354049"/>
|
||||
<path d="M13.7532 12.8937C13.1891 13.1354 12.5445 13.2966 11.8192 13.4577C11.094 13.2966 10.4493 13.1354 9.88525 12.8937C9.96584 11.6043 10.6105 10.5568 11.8192 9.91211C13.1086 10.5568 13.6726 11.5238 13.7532 12.8937Z" fill="#2683FF"/>
|
||||
@ -41,11 +41,11 @@ const NAVIGATION_ITEMS = {
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>`
|
||||
},
|
||||
API_KEYS: {
|
||||
label: 'API Keys',
|
||||
path: '/api-keys',
|
||||
svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
},
|
||||
API_KEYS: {
|
||||
label: 'API Keys',
|
||||
path: '/api-keys',
|
||||
svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<path d="M18.6059 9.10806C18.6059 8.85201 18.6912 8.51062 18.6912 8.25458C18.6912 4.24322 15.3626 1 11.3513 1C7.33993 1 4.0967 4.24322 4.0967 8.25458C4.0967 8.51062 4.0967 8.85201 4.18205 9.10806C1.87766 9.27875 0 11.1564 0 13.5462C0 16.0212 1.963 17.9842 4.4381 17.9842H7.76667V21.9103L6.82784 21.0568C6.57179 20.8007 6.14506 20.8007 5.88901 21.0568C5.63297 21.3128 5.63297 21.7396 5.88901 21.9956L8.27875 24.2147L10.6685 21.9956C10.9245 21.7396 10.9245 21.3128 10.6685 21.0568C10.4125 20.8007 9.98571 20.8007 9.72967 21.0568L8.79084 21.9103V17.9842H13.3143V12.0952L12.3755 12.9487C12.1194 13.2048 11.6927 13.2048 11.4366 12.9487C11.1806 12.6927 11.1806 12.2659 11.4366 12.0099L13.8264 9.79084L16.2161 12.0099C16.4722 12.2659 16.4722 12.6927 16.2161 12.9487C16.1308 13.1194 15.8747 13.1194 15.704 13.1194C15.5333 13.1194 15.3626 13.0341 15.2773 12.9487L14.3385 12.0952V17.9842H17.8377C17.9231 17.9842 18.0084 17.9842 18.0084 17.8989C20.2275 17.6429 22.0198 15.7652 22.0198 13.4608C22.6172 11.2418 20.8249 9.3641 18.6059 9.10806Z" fill="#354049"/>
|
||||
</g>
|
||||
@ -55,15 +55,15 @@ const NAVIGATION_ITEMS = {
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>`
|
||||
},
|
||||
// HELP: {
|
||||
// label: 'Help',
|
||||
// path: '/help',
|
||||
// svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
},
|
||||
// HELP: {
|
||||
// label: 'Help',
|
||||
// path: '/help',
|
||||
// svg: `<svg class="svg" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
// <path d="M18.8333 3.56068H7.0359C5.11538 3.56068 3.56068 5.11538 3.56068 7.0359V16.7299L1.91453 18.1932V6.85299C1.91453 4.1094 4.1094 2.00598 6.85299 2.00598H16.1812C16.7299 2.00598 17.1872 2.18889 17.6444 2.46325C17.8274 2.64615 18.1932 2.5547 18.3761 2.37179C18.559 2.18889 18.4675 1.82308 18.2846 1.64017C17.6444 1.18291 17.0043 1 16.2727 1H6.94444C3.65214 1 1 3.65214 1 6.85299V19.2906C1 19.4735 1.09145 19.6564 1.27436 19.7479C1.45726 19.8393 1.64017 19.7479 1.82308 19.6564L3.56068 18.1017V21.8513C3.56068 22.0342 3.65214 22.2171 3.83504 22.3085C3.9265 22.3085 3.9265 22.3085 4.01795 22.3085C4.1094 22.3085 4.29231 22.3085 4.38376 22.2171L7.31026 19.565C7.40171 19.4735 7.49316 19.3821 7.58462 19.3821C7.76752 19.2906 7.85897 19.1077 7.85897 19.1077C7.85897 19.1077 8.04188 19.1077 8.22479 19.1077C8.31624 19.1077 8.40769 19.1077 8.5906 19.1077H18.7419C20.6624 19.1077 22.2171 17.553 22.2171 15.6325V7.0359C22.2171 5.11538 20.7538 3.56068 18.8333 3.56068ZM17.7359 14.0778C17.2786 14.9009 16.6385 15.2667 16.1812 14.9923L15.541 14.7179C15.2667 14.9009 14.9923 15.0838 14.6265 15.2667L14.535 16.0897C14.535 16.6385 13.8949 16.9128 12.9803 16.9128C12.0658 16.9128 11.4256 16.547 11.4256 16.0897L11.3342 15.2667C10.9684 15.1752 10.694 14.9923 10.4197 14.7179L9.68803 15.0838C9.50513 15.1752 9.13932 15.2667 8.7735 14.9009C8.5906 14.7179 8.31624 14.4436 8.22479 14.1692C7.76752 13.3462 7.67607 12.6145 8.13333 12.3402L8.7735 11.8829C8.7735 11.7 8.7735 11.5171 8.7735 11.3342C8.7735 11.1513 8.7735 10.9684 8.7735 10.7855L8.13333 10.3282C7.67607 10.0538 7.76752 9.32222 8.22479 8.49915C8.40769 8.22479 8.5906 7.95043 8.7735 7.76752C9.23077 7.40171 9.50513 7.49316 9.68803 7.58462L10.4197 7.95043C10.694 7.76752 10.9684 7.58462 11.3342 7.40171L11.4256 6.57863C11.4256 6.02991 12.0658 5.75556 12.9803 5.75556C13.9863 5.75556 14.535 6.12137 14.535 6.57863L14.6265 7.40171C14.9923 7.58462 15.2667 7.67607 15.541 7.95043L16.2727 7.58462C16.7299 7.31026 17.2786 7.67607 17.8274 8.49915C18.0103 8.7735 18.1017 9.13932 18.1932 9.41368C18.2846 9.96239 18.1017 10.2368 17.9188 10.3282L17.2786 10.7855C17.2786 10.9684 17.2786 11.1513 17.2786 11.3342C17.2786 11.5171 17.2786 11.7 17.2786 11.8829L17.9188 12.3402C18.2846 12.6145 18.2846 13.2547 17.7359 14.0778Z" fill="#354049"/>
|
||||
// <path d="M12.8893 13.2551C13.9499 13.2551 14.8098 12.3952 14.8098 11.3346C14.8098 10.2739 13.9499 9.41406 12.8893 9.41406C11.8286 9.41406 10.9688 10.2739 10.9688 11.3346C10.9688 12.3952 11.8286 13.2551 12.8893 13.2551Z" fill="#354049"/>
|
||||
// </svg>`
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
export default NAVIGATION_ITEMS;
|
||||
|
@ -2,23 +2,23 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
export const NOTIFICATION_IMAGES = {
|
||||
NOTIFICATION: `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
NOTIFICATION: `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="40" height="40" rx="10" fill="#2683FF"/>
|
||||
<path d="M18.1489 17.043H21.9149V28H18.1489V17.043ZM20 12C20.5816 12 21.0567 12.1823 21.4255 12.5468C21.8085 12.8979 22 13.357 22 13.9241C22 14.4776 21.8085 14.9367 21.4255 15.3013C21.0567 15.6658 20.5816 15.8481 20 15.8481C19.4184 15.8481 18.9362 15.6658 18.5532 15.3013C18.1844 14.9367 18 14.4776 18 13.9241C18 13.357 18.1844 12.8979 18.5532 12.5468C18.9362 12.1823 19.4184 12 20 12Z" fill="#F5F6FA"/>
|
||||
</svg>
|
||||
`,
|
||||
SUCCESS: `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
SUCCESS: `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="40" height="40" rx="10" fill="#95D486"/>
|
||||
<path d="M27.7625 17.0601C28.348 16.4741 28.3475 15.5243 27.7614 14.9388C27.1753 14.3533 26.2256 14.3538 25.6401 14.9399L27.7625 17.0601ZM17.7003 25.01L16.6396 26.0707C16.921 26.3521 17.3027 26.5101 17.7007 26.51C18.0986 26.5099 18.4802 26.3517 18.7615 26.0701L17.7003 25.01ZM16.0607 21.249C15.4749 20.6633 14.5251 20.6633 13.9393 21.249C13.3536 21.8348 13.3536 22.7846 13.9393 23.3704L16.0607 21.249ZM25.6401 14.9399L16.6391 23.9499L18.7615 26.0701L27.7625 17.0601L25.6401 14.9399ZM18.761 23.9493L16.0607 21.249L13.9393 23.3704L16.6396 26.0707L18.761 23.9493Z" fill="white"/>
|
||||
</svg>
|
||||
`,
|
||||
ERROR: `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
ERROR: `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="40" height="40" rx="10" fill="#EB5757"/>
|
||||
<path d="M20.5 22.75C21.7676 22.75 22.8047 21.645 22.8047 20.2944V10.4556C22.8047 10.3328 22.797 10.2019 22.7816 10.0791C22.6126 8.90857 21.6523 8 20.5 8C19.2324 8 18.1953 9.10502 18.1953 10.4556V20.2862C18.1953 21.645 19.2324 22.75 20.5 22.75Z" fill="#F5F5F9"/>
|
||||
<path d="M20.5 25.1465C18.7146 25.1465 17.2734 26.5877 17.2734 28.373C17.2734 30.1584 18.7146 31.5996 20.5 31.5996C22.2853 31.5996 23.7265 30.1584 23.7265 28.373C23.7337 26.5877 22.2925 25.1465 20.5 25.1465Z" fill="#F5F5F9"/>
|
||||
</svg>
|
||||
`,
|
||||
CLOSE: `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
CLOSE: `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M23.7071 9.70711C24.0976 9.31658 24.0976 8.68342 23.7071 8.29289C23.3166 7.90237 22.6834 7.90237 22.2929 8.29289L23.7071 9.70711ZM8.29289 22.2929C7.90237 22.6834 7.90237 23.3166 8.29289 23.7071C8.68342 24.0976 9.31658 24.0976 9.70711 23.7071L8.29289 22.2929ZM9.70711 8.29289C9.31658 7.90237 8.68342 7.90237 8.29289 8.29289C7.90237 8.68342 7.90237 9.31658 8.29289 9.70711L9.70711 8.29289ZM22.2929 23.7071C22.6834 24.0976 23.3166 24.0976 23.7071 23.7071C24.0976 23.3166 24.0976 22.6834 23.7071 22.2929L22.2929 23.7071ZM22.2929 8.29289L8.29289 22.2929L9.70711 23.7071L23.7071 9.70711L22.2929 8.29289ZM8.29289 9.70711L22.2929 23.7071L23.7071 22.2929L9.70711 8.29289L8.29289 9.70711Z" fill="#354049"/>
|
||||
</svg>
|
||||
`
|
||||
@ -27,7 +27,7 @@ export const NOTIFICATION_IMAGES = {
|
||||
};
|
||||
|
||||
export const NOTIFICATION_TYPES = {
|
||||
SUCCESS: 'SUCCESS',
|
||||
NOTIFICATION: 'NOTIFICATION',
|
||||
ERROR: 'ERROR',
|
||||
SUCCESS: 'SUCCESS',
|
||||
NOTIFICATION: 'NOTIFICATION',
|
||||
ERROR: 'ERROR',
|
||||
};
|
||||
|
@ -2,18 +2,18 @@
|
||||
// See LICENSE for copying information.
|
||||
|
||||
const ROUTES = {
|
||||
LOGIN: {
|
||||
path: '/login',
|
||||
name: 'Login'
|
||||
},
|
||||
REGISTER: {
|
||||
path: '/register',
|
||||
name: 'Register'
|
||||
},
|
||||
DASHBOARD: {
|
||||
path: '/',
|
||||
name: 'Dashboard'
|
||||
}
|
||||
LOGIN: {
|
||||
path: '/login',
|
||||
name: 'Login'
|
||||
},
|
||||
REGISTER: {
|
||||
path: '/register',
|
||||
name: 'Register'
|
||||
},
|
||||
DASHBOARD: {
|
||||
path: '/',
|
||||
name: 'Dashboard'
|
||||
}
|
||||
};
|
||||
|
||||
export default ROUTES;
|
||||
|
@ -3,5 +3,5 @@
|
||||
|
||||
// Custom string id generator
|
||||
export function getId(): string {
|
||||
return '_' + Math.random().toString(36).substr(2, 9);
|
||||
return '_' + Math.random().toString(36).substr(2, 9);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
const tokenKey: string = 'tokenKey';
|
||||
|
||||
export function getToken(): string {
|
||||
return getCookie(tokenKey);
|
||||
return getCookie(tokenKey);
|
||||
}
|
||||
|
||||
export function setToken(tokenValue: string): void {
|
||||
|
@ -23,20 +23,20 @@ import ROUTES from '@/utils/constants/routerConstants';
|
||||
|
||||
@Component({
|
||||
beforeMount: async function() {
|
||||
const activationTokenParam = this.$route.query['activationToken'];
|
||||
const activationTokenParam = this.$route.query['activationToken'];
|
||||
|
||||
if(activationTokenParam) {
|
||||
const response = await this.$store.dispatch(USER_ACTIONS.ACTIVATE, activationTokenParam);
|
||||
if(!response.isSuccess) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to activate account');
|
||||
this.$router.push(ROUTES.LOGIN);
|
||||
if (activationTokenParam) {
|
||||
const response = await this.$store.dispatch(USER_ACTIONS.ACTIVATE, activationTokenParam);
|
||||
if (!response.isSuccess) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to activate account');
|
||||
this.$router.push(ROUTES.LOGIN);
|
||||
|
||||
removeToken();
|
||||
removeToken();
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
setToken(response.data);
|
||||
setToken(response.data);
|
||||
}
|
||||
// TODO: should place here some animation while all needed data is fetching
|
||||
let response: RequestResponse<User> = await this.$store.dispatch(USER_ACTIONS.GET);
|
||||
|
@ -7,70 +7,70 @@ import * as sinon from 'sinon';
|
||||
|
||||
describe('Button.vue', () => {
|
||||
|
||||
it('renders correctly', () => {
|
||||
it('renders correctly', () => {
|
||||
|
||||
const wrapper = shallowMount(Button);
|
||||
const wrapper = shallowMount(Button);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with isWhite prop', () => {
|
||||
it('renders correctly with isWhite prop', () => {
|
||||
|
||||
const wrapper = shallowMount(Button, {
|
||||
propsData: {
|
||||
isWhite: true
|
||||
}
|
||||
});
|
||||
const wrapper = shallowMount(Button, {
|
||||
propsData: {
|
||||
isWhite: true
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with isDisabled prop', () => {
|
||||
it('renders correctly with isDisabled prop', () => {
|
||||
|
||||
const wrapper = shallowMount(Button, {
|
||||
propsData: {
|
||||
isDisabled: true
|
||||
}
|
||||
});
|
||||
const wrapper = shallowMount(Button, {
|
||||
propsData: {
|
||||
isDisabled: true
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with size and label props', () => {
|
||||
let label = 'testLabel';
|
||||
let width = '30px';
|
||||
let height = '20px';
|
||||
it('renders correctly with size and label props', () => {
|
||||
let label = 'testLabel';
|
||||
let width = '30px';
|
||||
let height = '20px';
|
||||
|
||||
const wrapper = shallowMount(Button, {
|
||||
propsData: {label, width, height},
|
||||
});
|
||||
const wrapper = shallowMount(Button, {
|
||||
propsData: {label, width, height},
|
||||
});
|
||||
|
||||
expect(wrapper.element.style.width).toMatch(width);
|
||||
expect(wrapper.element.style.height).toMatch(height);
|
||||
expect(wrapper.text()).toMatch(label);
|
||||
});
|
||||
expect(wrapper.element.style.width).toMatch(width);
|
||||
expect(wrapper.element.style.height).toMatch(height);
|
||||
expect(wrapper.text()).toMatch(label);
|
||||
});
|
||||
|
||||
it('renders correctly with default props', () => {
|
||||
it('renders correctly with default props', () => {
|
||||
|
||||
const wrapper = shallowMount(Button);
|
||||
const wrapper = shallowMount(Button);
|
||||
|
||||
expect(wrapper.element.style.width).toMatch('inherit');
|
||||
expect(wrapper.element.style.height).toMatch('inherit');
|
||||
expect(wrapper.text()).toMatch('Default');
|
||||
});
|
||||
expect(wrapper.element.style.width).toMatch('inherit');
|
||||
expect(wrapper.element.style.height).toMatch('inherit');
|
||||
expect(wrapper.text()).toMatch('Default');
|
||||
});
|
||||
|
||||
it('trigger onPress correctly', () => {
|
||||
let onPressSpy = sinon.spy();
|
||||
it('trigger onPress correctly', () => {
|
||||
let onPressSpy = sinon.spy();
|
||||
|
||||
const wrapper = mount(Button, {
|
||||
propsData: {
|
||||
onPress: onPressSpy,
|
||||
isDisabled: false
|
||||
}
|
||||
});
|
||||
const wrapper = mount(Button, {
|
||||
propsData: {
|
||||
onPress: onPressSpy,
|
||||
isDisabled: false
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.find('div.container').trigger('click');
|
||||
wrapper.find('div.container').trigger('click');
|
||||
|
||||
expect(onPressSpy.callCount).toBe(1);
|
||||
});
|
||||
expect(onPressSpy.callCount).toBe(1);
|
||||
});
|
||||
});
|
||||
|
@ -6,38 +6,38 @@ import Checkbox from '@/components/common/Checkbox.vue';
|
||||
|
||||
describe('Checkbox.vue', () => {
|
||||
|
||||
it('renders correctly', () => {
|
||||
it('renders correctly', () => {
|
||||
|
||||
const wrapper = shallowMount(Checkbox);
|
||||
const wrapper = shallowMount(Checkbox);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('emit setData on change correctly', () => {
|
||||
it('emit setData on change correctly', () => {
|
||||
|
||||
const wrapper = mount(Checkbox);
|
||||
const wrapper = mount(Checkbox);
|
||||
|
||||
wrapper.find('input').trigger('change');
|
||||
wrapper.find('input').trigger('change');
|
||||
wrapper.find('input').trigger('change');
|
||||
wrapper.find('input').trigger('change');
|
||||
|
||||
expect(wrapper.emitted('setData').length).toEqual(2);
|
||||
});
|
||||
expect(wrapper.emitted('setData').length).toEqual(2);
|
||||
});
|
||||
|
||||
it('emits with data correctly', () => {
|
||||
it('emits with data correctly', () => {
|
||||
|
||||
const wrapper = mount(Checkbox);
|
||||
const wrapper = mount(Checkbox);
|
||||
|
||||
wrapper.vm.$emit('setData', true);
|
||||
wrapper.vm.$emit('setData', true);
|
||||
|
||||
expect(wrapper.emitted('setData')[0][0]).toEqual(true);
|
||||
});
|
||||
expect(wrapper.emitted('setData')[0][0]).toEqual(true);
|
||||
});
|
||||
|
||||
it('renders correctly with error', () => {
|
||||
it('renders correctly with error', () => {
|
||||
|
||||
const wrapper = shallowMount(Checkbox, {
|
||||
propsData: {isCheckboxError: true}
|
||||
});
|
||||
const wrapper = shallowMount(Checkbox, {
|
||||
propsData: {isCheckboxError: true}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -6,76 +6,76 @@ import HeaderedInput from '@/components/common/HeaderedInput.vue';
|
||||
|
||||
describe('HeaderedInput.vue', () => {
|
||||
|
||||
it('renders correctly with default props', () => {
|
||||
it('renders correctly with default props', () => {
|
||||
|
||||
const wrapper = shallowMount(HeaderedInput);
|
||||
const wrapper = shallowMount(HeaderedInput);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with isMultiline props', () => {
|
||||
it('renders correctly with isMultiline props', () => {
|
||||
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {isMultiline: true}
|
||||
});
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {isMultiline: true}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper.contains('textarea')).toBe(true);
|
||||
expect(wrapper.contains('input')).toBe(false);
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper.contains('textarea')).toBe(true);
|
||||
expect(wrapper.contains('input')).toBe(false);
|
||||
});
|
||||
|
||||
it('renders correctly with props', () => {
|
||||
let label = 'testLabel';
|
||||
let additionalLabel = 'addLabel';
|
||||
let width = '30px';
|
||||
let height = '20px';
|
||||
it('renders correctly with props', () => {
|
||||
let label = 'testLabel';
|
||||
let additionalLabel = 'addLabel';
|
||||
let width = '30px';
|
||||
let height = '20px';
|
||||
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {label, width, height, additionalLabel}
|
||||
});
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {label, width, height, additionalLabel}
|
||||
});
|
||||
|
||||
expect(wrapper.find('input').element.style.width).toMatch(width);
|
||||
expect(wrapper.find('input').element.style.height).toMatch(height);
|
||||
expect(wrapper.find('.label-container').text()).toMatch(label);
|
||||
expect(wrapper.find('.label-container__add-label').text()).toMatch(additionalLabel);
|
||||
});
|
||||
expect(wrapper.find('input').element.style.width).toMatch(width);
|
||||
expect(wrapper.find('input').element.style.height).toMatch(height);
|
||||
expect(wrapper.find('.label-container').text()).toMatch(label);
|
||||
expect(wrapper.find('.label-container__add-label').text()).toMatch(additionalLabel);
|
||||
});
|
||||
|
||||
it('renders correctly with isOptional props', () => {
|
||||
it('renders correctly with isOptional props', () => {
|
||||
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {
|
||||
isOptional: true
|
||||
}
|
||||
});
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {
|
||||
isOptional: true
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.find('h4').text()).toMatch('Optional');
|
||||
});
|
||||
expect(wrapper.find('h4').text()).toMatch('Optional');
|
||||
});
|
||||
|
||||
it('renders correctly with input error', () => {
|
||||
let error = 'testError';
|
||||
it('renders correctly with input error', () => {
|
||||
let error = 'testError';
|
||||
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {
|
||||
error
|
||||
}
|
||||
});
|
||||
const wrapper = shallowMount(HeaderedInput, {
|
||||
propsData: {
|
||||
error
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper.find('.label-container').text()).toMatch(error);
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper.find('.label-container').text()).toMatch(error);
|
||||
});
|
||||
|
||||
it('emit setData on input correctly', () => {
|
||||
let testData = 'testData';
|
||||
it('emit setData on input correctly', () => {
|
||||
let testData = 'testData';
|
||||
|
||||
const wrapper = mount(HeaderedInput);
|
||||
const wrapper = mount(HeaderedInput);
|
||||
|
||||
wrapper.find('input').trigger('input');
|
||||
wrapper.find('input').trigger('input');
|
||||
|
||||
expect(wrapper.emitted('setData').length).toEqual(1);
|
||||
expect(wrapper.emitted('setData').length).toEqual(1);
|
||||
|
||||
wrapper.vm.$emit('setData', testData);
|
||||
wrapper.vm.$emit('setData', testData);
|
||||
|
||||
expect(wrapper.emitted('setData')[1][0]).toEqual(testData);
|
||||
});
|
||||
expect(wrapper.emitted('setData')[1][0]).toEqual(testData);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -6,47 +6,47 @@ import HeaderlessInput from '@/components/common/HeaderlessInput.vue';
|
||||
|
||||
describe('HeaderlessInput.vue', () => {
|
||||
|
||||
it('renders correctly with default props', () => {
|
||||
it('renders correctly with default props', () => {
|
||||
|
||||
const wrapper = shallowMount(HeaderlessInput);
|
||||
const wrapper = shallowMount(HeaderlessInput);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with size props', () => {
|
||||
let placeholder = 'test';
|
||||
let width = '30px';
|
||||
let height = '20px';
|
||||
it('renders correctly with size props', () => {
|
||||
let placeholder = 'test';
|
||||
let width = '30px';
|
||||
let height = '20px';
|
||||
|
||||
const wrapper = shallowMount(HeaderlessInput, {
|
||||
propsData: {placeholder, width, height}
|
||||
});
|
||||
const wrapper = shallowMount(HeaderlessInput, {
|
||||
propsData: {placeholder, width, height}
|
||||
});
|
||||
|
||||
expect(wrapper.find('input').element.style.width).toMatch(width);
|
||||
expect(wrapper.find('input').element.style.height).toMatch(height);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper.find('input').element.style.width).toMatch(width);
|
||||
expect(wrapper.find('input').element.style.height).toMatch(height);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with isPassword prop', () => {
|
||||
const wrapper = mount(HeaderlessInput, {
|
||||
propsData: {isPassword: true}
|
||||
});
|
||||
it('renders correctly with isPassword prop', () => {
|
||||
const wrapper = mount(HeaderlessInput, {
|
||||
propsData: {isPassword: true}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('emit setData on input correctly', () => {
|
||||
let testData = 'testData';
|
||||
it('emit setData on input correctly', () => {
|
||||
let testData = 'testData';
|
||||
|
||||
const wrapper = mount(HeaderlessInput);
|
||||
const wrapper = mount(HeaderlessInput);
|
||||
|
||||
wrapper.find('input').trigger('input');
|
||||
wrapper.find('input').trigger('input');
|
||||
|
||||
expect(wrapper.emitted('setData').length).toEqual(1);
|
||||
expect(wrapper.emitted('setData').length).toEqual(1);
|
||||
|
||||
wrapper.vm.$emit('setData', testData);
|
||||
wrapper.vm.$emit('setData', testData);
|
||||
|
||||
expect(wrapper.emitted('setData')[1][0]).toEqual(testData);
|
||||
});
|
||||
expect(wrapper.emitted('setData')[1][0]).toEqual(testData);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -7,30 +7,30 @@ import * as sinon from 'sinon';
|
||||
|
||||
describe('AccountDropdown.vue', () => {
|
||||
|
||||
it('renders correctly', () => {
|
||||
it('renders correctly', () => {
|
||||
|
||||
const wrapper = shallowMount(AccountDropdown);
|
||||
const wrapper = shallowMount(AccountDropdown);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('trigger onPress correctly', () => {
|
||||
let onCloseSpy = sinon.spy();
|
||||
it('trigger onPress correctly', () => {
|
||||
let onCloseSpy = sinon.spy();
|
||||
|
||||
const wrapper = mount(AccountDropdown, {
|
||||
propsData: {
|
||||
onClose: onCloseSpy
|
||||
},
|
||||
mocks: {
|
||||
$router: {
|
||||
push: onCloseSpy
|
||||
}
|
||||
}
|
||||
});
|
||||
const wrapper = mount(AccountDropdown, {
|
||||
propsData: {
|
||||
onClose: onCloseSpy
|
||||
},
|
||||
mocks: {
|
||||
$router: {
|
||||
push: onCloseSpy
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.find('.adItemContainer.settings').trigger('click');
|
||||
wrapper.find('.adItemContainer.settings').trigger('click');
|
||||
|
||||
expect(onCloseSpy.callCount).toBe(1);
|
||||
expect(wrapper.emitted('onClose').length).toEqual(1);
|
||||
});
|
||||
expect(onCloseSpy.callCount).toBe(1);
|
||||
expect(wrapper.emitted('onClose').length).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
@ -7,37 +7,37 @@ import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
|
||||
|
||||
describe('Notification.vue', () => {
|
||||
|
||||
it('renders correctly', () => {
|
||||
const wrapper = shallowMount(Notification);
|
||||
it('renders correctly', () => {
|
||||
const wrapper = shallowMount(Notification);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with props', () => {
|
||||
const testMessage = 'testMessage';
|
||||
it('renders correctly with props', () => {
|
||||
const testMessage = 'testMessage';
|
||||
|
||||
const wrapper = mount(Notification, {
|
||||
propsData: {
|
||||
type: NOTIFICATION_TYPES.SUCCESS,
|
||||
message: testMessage,
|
||||
},
|
||||
});
|
||||
const wrapper = mount(Notification, {
|
||||
propsData: {
|
||||
type: NOTIFICATION_TYPES.SUCCESS,
|
||||
message: testMessage,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper.find('.notification-wrap__text').text()).toMatch(testMessage);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper.find('.notification-wrap__text').text()).toMatch(testMessage);
|
||||
|
||||
wrapper.setProps({
|
||||
type: NOTIFICATION_TYPES.ERROR,
|
||||
message: testMessage,
|
||||
});
|
||||
wrapper.setProps({
|
||||
type: NOTIFICATION_TYPES.ERROR,
|
||||
message: testMessage,
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
|
||||
wrapper.setProps({
|
||||
type: NOTIFICATION_TYPES.NOTIFICATION,
|
||||
message: testMessage,
|
||||
});
|
||||
wrapper.setProps({
|
||||
type: NOTIFICATION_TYPES.NOTIFICATION,
|
||||
message: testMessage,
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -8,30 +8,30 @@ import { DelayedNotification } from '@/types/DelayedNotification';
|
||||
|
||||
describe('Notification.vue', () => {
|
||||
|
||||
it('renders correctly', () => {
|
||||
const wrapper = shallowMount(NotificationArea, {
|
||||
computed: {
|
||||
currentNotification: jest.fn(),
|
||||
},
|
||||
});
|
||||
it('renders correctly', () => {
|
||||
const wrapper = shallowMount(NotificationArea, {
|
||||
computed: {
|
||||
currentNotification: jest.fn(),
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly with notification', () => {
|
||||
const testMessage = 'testMessage';
|
||||
const notification = new DelayedNotification(
|
||||
jest.fn(),
|
||||
NOTIFICATION_TYPES.SUCCESS,
|
||||
testMessage
|
||||
);
|
||||
it('renders correctly with notification', () => {
|
||||
const testMessage = 'testMessage';
|
||||
const notification = new DelayedNotification(
|
||||
jest.fn(),
|
||||
NOTIFICATION_TYPES.SUCCESS,
|
||||
testMessage
|
||||
);
|
||||
|
||||
const wrapper = mount(NotificationArea, {
|
||||
computed: {
|
||||
currentNotification: () => notification,
|
||||
}
|
||||
});
|
||||
const wrapper = mount(NotificationArea, {
|
||||
computed: {
|
||||
currentNotification: () => notification,
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -11,269 +11,269 @@ import Vuex from 'vuex';
|
||||
const mutations = projectMembersModule.mutations;
|
||||
|
||||
describe('mutations', () => {
|
||||
beforeEach(() => {
|
||||
createLocalVue().use(Vuex);
|
||||
});
|
||||
beforeEach(() => {
|
||||
createLocalVue().use(Vuex);
|
||||
});
|
||||
|
||||
it('success delete project members', () => {
|
||||
const state = {
|
||||
projectMembers: [{user: {email: '1'}}, {user: {email: '2'}}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
it('success delete project members', () => {
|
||||
const state = {
|
||||
projectMembers: [{user: {email: '1'}}, {user: {email: '2'}}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const membersToDelete = ['1', '2'];
|
||||
const membersToDelete = ['1', '2'];
|
||||
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.DELETE, membersToDelete);
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.DELETE, membersToDelete);
|
||||
|
||||
expect(state.projectMembers.length).toBe(0);
|
||||
});
|
||||
expect(state.projectMembers.length).toBe(0);
|
||||
});
|
||||
|
||||
it('error delete project members', () => {
|
||||
const state = {
|
||||
projectMembers: [{user: {email: '1'}}, {user: {email: '2'}}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
it('error delete project members', () => {
|
||||
const state = {
|
||||
projectMembers: [{user: {email: '1'}}, {user: {email: '2'}}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const membersToDelete = ['3', '4'];
|
||||
const membersToDelete = ['3', '4'];
|
||||
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.DELETE, membersToDelete);
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.DELETE, membersToDelete);
|
||||
|
||||
expect(state.projectMembers.length).toBe(2);
|
||||
});
|
||||
expect(state.projectMembers.length).toBe(2);
|
||||
});
|
||||
|
||||
it('toggle selection', () => {
|
||||
const state = {
|
||||
projectMembers: [{
|
||||
user: {id: '1'},
|
||||
isSelected: false
|
||||
}, {
|
||||
user: {id: '2'},
|
||||
isSelected: false
|
||||
}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
it('toggle selection', () => {
|
||||
const state = {
|
||||
projectMembers: [{
|
||||
user: {id: '1'},
|
||||
isSelected: false
|
||||
}, {
|
||||
user: {id: '2'},
|
||||
isSelected: false
|
||||
}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const memberId = '1';
|
||||
const memberId = '1';
|
||||
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION, memberId);
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION, memberId);
|
||||
|
||||
expect(state.projectMembers[0].isSelected).toBeTruthy();
|
||||
expect(state.projectMembers[1].isSelected).toBeFalsy();
|
||||
});
|
||||
expect(state.projectMembers[0].isSelected).toBeTruthy();
|
||||
expect(state.projectMembers[1].isSelected).toBeFalsy();
|
||||
});
|
||||
|
||||
it('clear selection', () => {
|
||||
const state = {
|
||||
projectMembers: [{
|
||||
user: {id: '1'},
|
||||
isSelected: true
|
||||
}, {
|
||||
user: {id: '2'},
|
||||
isSelected: true
|
||||
}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
it('clear selection', () => {
|
||||
const state = {
|
||||
projectMembers: [{
|
||||
user: {id: '1'},
|
||||
isSelected: true
|
||||
}, {
|
||||
user: {id: '2'},
|
||||
isSelected: true
|
||||
}]
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.CLEAR_SELECTION);
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.CLEAR_SELECTION);
|
||||
|
||||
expect(state.projectMembers[0].isSelected).toBeFalsy();
|
||||
expect(state.projectMembers[1].isSelected).toBeFalsy();
|
||||
});
|
||||
expect(state.projectMembers[0].isSelected).toBeFalsy();
|
||||
expect(state.projectMembers[1].isSelected).toBeFalsy();
|
||||
});
|
||||
|
||||
it('fetch team members', () => {
|
||||
const state = {
|
||||
projectMembers: []
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
it('fetch team members', () => {
|
||||
const state = {
|
||||
projectMembers: []
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const teamMembers = [{
|
||||
user: {id: '1'}
|
||||
}];
|
||||
const teamMembers = [{
|
||||
user: {id: '1'}
|
||||
}];
|
||||
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.FETCH, teamMembers);
|
||||
store.commit(PROJECT_MEMBER_MUTATIONS.FETCH, teamMembers);
|
||||
|
||||
expect(state.projectMembers.length).toBe(1);
|
||||
});
|
||||
expect(state.projectMembers.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('actions', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
it('success add project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
},
|
||||
searchParameters: {},
|
||||
pagination: {limit: 20, offset: 0}
|
||||
};
|
||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue({isSuccess: true});
|
||||
it('success add project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
},
|
||||
searchParameters: {},
|
||||
pagination: {limit: 20, offset: 0}
|
||||
};
|
||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue({isSuccess: true});
|
||||
|
||||
const emails = ['1', '2'];
|
||||
const emails = ['1', '2'];
|
||||
|
||||
const dispatchResponse = await projectMembersModule.actions.addProjectMembers({rootGetters}, emails);
|
||||
const dispatchResponse = await projectMembersModule.actions.addProjectMembers({rootGetters}, emails);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
|
||||
it('error add project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue({isSuccess: false});
|
||||
it('error add project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue({isSuccess: false});
|
||||
|
||||
const emails = ['1', '2'];
|
||||
const emails = ['1', '2'];
|
||||
|
||||
const dispatchResponse = await projectMembersModule.actions.addProjectMembers({rootGetters}, emails);
|
||||
const dispatchResponse = await projectMembersModule.actions.addProjectMembers({rootGetters}, emails);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
});
|
||||
|
||||
it('success delete project members', async () => {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue({isSuccess: true});
|
||||
it('success delete project members', async () => {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue({isSuccess: true});
|
||||
|
||||
const commit = jest.fn();
|
||||
const emails = ['1', '2'];
|
||||
const commit = jest.fn();
|
||||
const emails = ['1', '2'];
|
||||
|
||||
const dispatchResponse = await projectMembersModule.actions.deleteProjectMembers({commit, rootGetters}, emails);
|
||||
const dispatchResponse = await projectMembersModule.actions.deleteProjectMembers({commit, rootGetters}, emails);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECT_MEMBER_MUTATIONS.DELETE, emails);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECT_MEMBER_MUTATIONS.DELETE, emails);
|
||||
});
|
||||
|
||||
it('error delete project members', async () => {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue({isSuccess: false});
|
||||
it('error delete project members', async () => {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue({isSuccess: false});
|
||||
|
||||
const commit = jest.fn();
|
||||
const emails = ['1', '2'];
|
||||
const commit = jest.fn();
|
||||
const emails = ['1', '2'];
|
||||
|
||||
const dispatchResponse = await projectMembersModule.actions.deleteProjectMembers({commit, rootGetters}, emails);
|
||||
const dispatchResponse = await projectMembersModule.actions.deleteProjectMembers({commit, rootGetters}, emails);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('toggle selection', function () {
|
||||
const commit = jest.fn();
|
||||
const projectMemberId = '1';
|
||||
it('toggle selection', function () {
|
||||
const commit = jest.fn();
|
||||
const projectMemberId = '1';
|
||||
|
||||
projectMembersModule.actions.toggleProjectMemberSelection({commit}, projectMemberId);
|
||||
projectMembersModule.actions.toggleProjectMemberSelection({commit}, projectMemberId);
|
||||
|
||||
expect(commit).toHaveBeenCalledWith(PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION, projectMemberId);
|
||||
});
|
||||
expect(commit).toHaveBeenCalledWith(PROJECT_MEMBER_MUTATIONS.TOGGLE_SELECTION, projectMemberId);
|
||||
});
|
||||
|
||||
it('clear selection', function () {
|
||||
const commit = jest.fn();
|
||||
it('clear selection', function () {
|
||||
const commit = jest.fn();
|
||||
|
||||
projectMembersModule.actions.clearProjectMemberSelection({commit});
|
||||
projectMembersModule.actions.clearProjectMemberSelection({commit});
|
||||
|
||||
expect(commit).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
expect(commit).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('success fetch project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
const state = {
|
||||
pagination:{
|
||||
limit: 20,
|
||||
offset: 0
|
||||
},
|
||||
searchParameters: {
|
||||
searchQuery: ''
|
||||
}
|
||||
};
|
||||
const commit = jest.fn();
|
||||
const projectMemberMockModel: TeamMemberModel = {
|
||||
user: {
|
||||
id: '1',
|
||||
email: '1',
|
||||
firstName: '1',
|
||||
lastName: '1'
|
||||
},
|
||||
joinedAt: '1'
|
||||
};
|
||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: true,
|
||||
data: [projectMemberMockModel]
|
||||
});
|
||||
it('success fetch project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
const state = {
|
||||
pagination:{
|
||||
limit: 20,
|
||||
offset: 0
|
||||
},
|
||||
searchParameters: {
|
||||
searchQuery: ''
|
||||
}
|
||||
};
|
||||
const commit = jest.fn();
|
||||
const projectMemberMockModel: TeamMemberModel = {
|
||||
user: {
|
||||
id: '1',
|
||||
email: '1',
|
||||
firstName: '1',
|
||||
lastName: '1'
|
||||
},
|
||||
joinedAt: '1'
|
||||
};
|
||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: true,
|
||||
data: [projectMemberMockModel]
|
||||
});
|
||||
|
||||
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
||||
state,
|
||||
commit,
|
||||
rootGetters
|
||||
});
|
||||
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
||||
state,
|
||||
commit,
|
||||
rootGetters
|
||||
});
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECT_MEMBER_MUTATIONS.FETCH, [projectMemberMockModel]);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECT_MEMBER_MUTATIONS.FETCH, [projectMemberMockModel]);
|
||||
});
|
||||
|
||||
it('error fetch project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
const state = {
|
||||
pagination:{
|
||||
limit: 20,
|
||||
offset: 0
|
||||
},
|
||||
searchParameters: {
|
||||
searchQuery: ''
|
||||
}
|
||||
};
|
||||
const commit = jest.fn();
|
||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue({isSuccess: false});
|
||||
it('error fetch project members', async function () {
|
||||
const rootGetters = {
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
const state = {
|
||||
pagination:{
|
||||
limit: 20,
|
||||
offset: 0
|
||||
},
|
||||
searchParameters: {
|
||||
searchQuery: ''
|
||||
}
|
||||
};
|
||||
const commit = jest.fn();
|
||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue({isSuccess: false});
|
||||
|
||||
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
||||
state,
|
||||
commit,
|
||||
rootGetters
|
||||
});
|
||||
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
||||
state,
|
||||
commit,
|
||||
rootGetters
|
||||
});
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getters', () => {
|
||||
it('project members', function () {
|
||||
const state = {
|
||||
projectMembers: [{user: {email: '1'}}]
|
||||
};
|
||||
const retrievedProjectMembers = projectMembersModule.getters.projectMembers(state);
|
||||
it('project members', function () {
|
||||
const state = {
|
||||
projectMembers: [{user: {email: '1'}}]
|
||||
};
|
||||
const retrievedProjectMembers = projectMembersModule.getters.projectMembers(state);
|
||||
|
||||
expect(retrievedProjectMembers.length).toBe(1);
|
||||
});
|
||||
expect(retrievedProjectMembers.length).toBe(1);
|
||||
});
|
||||
|
||||
it('selected project members', function () {
|
||||
const state = {
|
||||
projectMembers: [
|
||||
{isSelected: false},
|
||||
{isSelected: true},
|
||||
{isSelected: true},
|
||||
{isSelected: true},
|
||||
{isSelected: false},
|
||||
]
|
||||
};
|
||||
const retrievedSelectedProjectMembers = projectMembersModule.getters.selectedProjectMembers(state);
|
||||
expect(retrievedSelectedProjectMembers.length).toBe(3);
|
||||
});
|
||||
it('selected project members', function () {
|
||||
const state = {
|
||||
projectMembers: [
|
||||
{isSelected: false},
|
||||
{isSelected: true},
|
||||
{isSelected: true},
|
||||
{isSelected: true},
|
||||
{isSelected: false},
|
||||
]
|
||||
};
|
||||
const retrievedSelectedProjectMembers = projectMembersModule.getters.selectedProjectMembers(state);
|
||||
expect(retrievedSelectedProjectMembers.length).toBe(3);
|
||||
});
|
||||
});
|
||||
|
@ -11,359 +11,359 @@ import Vuex from 'vuex';
|
||||
const mutations = projectsModule.mutations;
|
||||
|
||||
describe('mutations', () => {
|
||||
beforeEach(() => {
|
||||
createLocalVue().use(Vuex);
|
||||
});
|
||||
it('create project', () => {
|
||||
const state = {
|
||||
projects: [],
|
||||
};
|
||||
const project = {
|
||||
name: 'testName',
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
beforeEach(() => {
|
||||
createLocalVue().use(Vuex);
|
||||
});
|
||||
it('create project', () => {
|
||||
const state = {
|
||||
projects: [],
|
||||
};
|
||||
const project = {
|
||||
name: 'testName',
|
||||
};
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.CREATE, project);
|
||||
store.commit(PROJECTS_MUTATIONS.CREATE, project);
|
||||
|
||||
expect(state.projects.length).toBe(1);
|
||||
expect(state.projects.length).toBe(1);
|
||||
|
||||
const mutatedProject: Project = state.projects[0];
|
||||
const mutatedProject: Project = state.projects[0];
|
||||
|
||||
expect(mutatedProject.name).toBe('testName');
|
||||
});
|
||||
expect(mutatedProject.name).toBe('testName');
|
||||
});
|
||||
|
||||
it('fetch project', () => {
|
||||
const state = {
|
||||
projects: []
|
||||
};
|
||||
it('fetch project', () => {
|
||||
const state = {
|
||||
projects: []
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const projectsToPush = [{id: '1'}, {id: '2'}];
|
||||
const projectsToPush = [{id: '1'}, {id: '2'}];
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.FETCH, projectsToPush);
|
||||
store.commit(PROJECTS_MUTATIONS.FETCH, projectsToPush);
|
||||
|
||||
expect(state.projects.length).toBe(2);
|
||||
});
|
||||
expect(state.projects.length).toBe(2);
|
||||
});
|
||||
|
||||
it('success select project', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'},],
|
||||
selectedProject: {
|
||||
id: ''
|
||||
}
|
||||
};
|
||||
it('success select project', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'}, ],
|
||||
selectedProject: {
|
||||
id: ''
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const projectId = 'testId';
|
||||
const projectId = 'testId';
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.SELECT, projectId);
|
||||
store.commit(PROJECTS_MUTATIONS.SELECT, projectId);
|
||||
|
||||
expect(state.selectedProject.id).toBe('testId');
|
||||
});
|
||||
expect(state.selectedProject.id).toBe('testId');
|
||||
});
|
||||
|
||||
it('error select project', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'},],
|
||||
selectedProject: {
|
||||
id: 'old'
|
||||
}
|
||||
};
|
||||
it('error select project', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'}, ],
|
||||
selectedProject: {
|
||||
id: 'old'
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const projectId = '3';
|
||||
const projectId = '3';
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.SELECT, projectId);
|
||||
store.commit(PROJECTS_MUTATIONS.SELECT, projectId);
|
||||
|
||||
expect(state.selectedProject.id).toBe('old');
|
||||
});
|
||||
expect(state.selectedProject.id).toBe('old');
|
||||
});
|
||||
|
||||
it('error update project not exist', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'},],
|
||||
selectedProject: {
|
||||
id: 'old'
|
||||
}
|
||||
};
|
||||
it('error update project not exist', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'}, ],
|
||||
selectedProject: {
|
||||
id: 'old'
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const projectId = {id: '3'};
|
||||
const projectId = {id: '3'};
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.UPDATE, projectId);
|
||||
store.commit(PROJECTS_MUTATIONS.UPDATE, projectId);
|
||||
|
||||
expect(state.selectedProject.id).toBe('old');
|
||||
});
|
||||
expect(state.selectedProject.id).toBe('old');
|
||||
});
|
||||
|
||||
it('error update project not selected', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'},],
|
||||
selectedProject: {
|
||||
id: 'old',
|
||||
description: 'oldD'
|
||||
}
|
||||
};
|
||||
it('error update project not selected', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'}, ],
|
||||
selectedProject: {
|
||||
id: 'old',
|
||||
description: 'oldD'
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const project = {id: '2', description: 'newD'};
|
||||
const project = {id: '2', description: 'newD'};
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.UPDATE, project);
|
||||
store.commit(PROJECTS_MUTATIONS.UPDATE, project);
|
||||
|
||||
expect(state.selectedProject.id).toBe('old');
|
||||
expect(state.selectedProject.description).toBe('oldD');
|
||||
});
|
||||
expect(state.selectedProject.id).toBe('old');
|
||||
expect(state.selectedProject.description).toBe('oldD');
|
||||
});
|
||||
|
||||
it('success update project', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'}],
|
||||
selectedProject: {
|
||||
id: '2',
|
||||
description: 'oldD'
|
||||
}
|
||||
};
|
||||
it('success update project', () => {
|
||||
const state = {
|
||||
projects: [{id: '1'}, {id: 'testId'}, {id: '2'}],
|
||||
selectedProject: {
|
||||
id: '2',
|
||||
description: 'oldD'
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const project = {id: '2', description: 'newD'};
|
||||
const project = {id: '2', description: 'newD'};
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.UPDATE, project);
|
||||
store.commit(PROJECTS_MUTATIONS.UPDATE, project);
|
||||
|
||||
expect(state.selectedProject.id).toBe('2');
|
||||
expect(state.selectedProject.description).toBe('newD');
|
||||
});
|
||||
expect(state.selectedProject.id).toBe('2');
|
||||
expect(state.selectedProject.description).toBe('newD');
|
||||
});
|
||||
|
||||
it('error delete project', () => {
|
||||
const state = {
|
||||
selectedProject: {
|
||||
id: '1',
|
||||
}
|
||||
};
|
||||
it('error delete project', () => {
|
||||
const state = {
|
||||
selectedProject: {
|
||||
id: '1',
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const projectId = '2';
|
||||
const projectId = '2';
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.DELETE, projectId);
|
||||
store.commit(PROJECTS_MUTATIONS.DELETE, projectId);
|
||||
|
||||
expect(state.selectedProject.id).toBe('1');
|
||||
});
|
||||
expect(state.selectedProject.id).toBe('1');
|
||||
});
|
||||
|
||||
it('success delete project', () => {
|
||||
const state = {
|
||||
selectedProject: {
|
||||
id: '2',
|
||||
}
|
||||
};
|
||||
it('success delete project', () => {
|
||||
const state = {
|
||||
selectedProject: {
|
||||
id: '2',
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const projectId = '2';
|
||||
const projectId = '2';
|
||||
|
||||
store.commit(PROJECTS_MUTATIONS.DELETE, projectId);
|
||||
store.commit(PROJECTS_MUTATIONS.DELETE, projectId);
|
||||
|
||||
expect(state.selectedProject.id).toBe('');
|
||||
});
|
||||
expect(state.selectedProject.id).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('actions', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
it('success fetch project', async () => {
|
||||
jest.spyOn(api, 'fetchProjectsRequest').mockReturnValue({isSuccess: true, data: [{id: '1'}, {id: '2'}]});
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
it('success fetch project', async () => {
|
||||
jest.spyOn(api, 'fetchProjectsRequest').mockReturnValue({isSuccess: true, data: [{id: '1'}, {id: '2'}]});
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = jest.fn();
|
||||
|
||||
const dispatchResponse = await projectsModule.actions.fetchProjects({commit});
|
||||
const dispatchResponse = await projectsModule.actions.fetchProjects({commit});
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.FETCH, [{id: '1'}, {id: '2'}]);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.FETCH, [{id: '1'}, {id: '2'}]);
|
||||
});
|
||||
|
||||
it('error fetch project', async () => {
|
||||
jest.spyOn(api, 'fetchProjectsRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
const dispatchResponse = await projectsModule.actions.fetchProjects({commit});
|
||||
it('error fetch project', async () => {
|
||||
jest.spyOn(api, 'fetchProjectsRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
const dispatchResponse = await projectsModule.actions.fetchProjects({commit});
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('success create project', async () => {
|
||||
jest.spyOn(api, 'createProjectRequest').mockReturnValue({isSuccess: true, data: {id: '1'}});
|
||||
const commit = jest.fn();
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: '',
|
||||
description: '',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
it('success create project', async () => {
|
||||
jest.spyOn(api, 'createProjectRequest').mockReturnValue({isSuccess: true, data: {id: '1'}});
|
||||
const commit = jest.fn();
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: '',
|
||||
description: '',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
|
||||
const dispatchResponse = await projectsModule.actions.createProject({commit}, project);
|
||||
const dispatchResponse = await projectsModule.actions.createProject({commit}, project);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.CREATE, {id: '1'});
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.CREATE, {id: '1'});
|
||||
});
|
||||
|
||||
it('error create project', async () => {
|
||||
jest.spyOn(api, 'createProjectRequest').mockReturnValue({isSuccess: false});
|
||||
it('error create project', async () => {
|
||||
jest.spyOn(api, 'createProjectRequest').mockReturnValue({isSuccess: false});
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = jest.fn();
|
||||
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: '',
|
||||
description: '',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: '',
|
||||
description: '',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
|
||||
const dispatchResponse = await projectsModule.actions.createProject({commit}, project);
|
||||
const dispatchResponse = await projectsModule.actions.createProject({commit}, project);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('success select project', () => {
|
||||
const commit = jest.fn();
|
||||
it('success select project', () => {
|
||||
const commit = jest.fn();
|
||||
|
||||
projectsModule.actions.selectProject({commit}, 'id');
|
||||
projectsModule.actions.selectProject({commit}, 'id');
|
||||
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.SELECT, 'id');
|
||||
});
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.SELECT, 'id');
|
||||
});
|
||||
|
||||
it('success update project description', async () => {
|
||||
jest.spyOn(api, 'updateProjectRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: 'id',
|
||||
description: 'desc',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
it('success update project description', async () => {
|
||||
jest.spyOn(api, 'updateProjectRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: 'id',
|
||||
description: 'desc',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
|
||||
const dispatchResponse = await projectsModule.actions.updateProject({commit}, project);
|
||||
const dispatchResponse = await projectsModule.actions.updateProject({commit}, project);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toBeCalledWith(PROJECTS_MUTATIONS.UPDATE, project);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toBeCalledWith(PROJECTS_MUTATIONS.UPDATE, project);
|
||||
});
|
||||
|
||||
it('error update project description', async () => {
|
||||
jest.spyOn(api, 'updateProjectRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: '',
|
||||
description: '',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
it('error update project description', async () => {
|
||||
jest.spyOn(api, 'updateProjectRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
const project: Project = {
|
||||
name: '',
|
||||
id: '',
|
||||
description: '',
|
||||
isSelected: false,
|
||||
createdAt: ''
|
||||
};
|
||||
|
||||
const dispatchResponse = await projectsModule.actions.updateProject({commit}, project);
|
||||
const dispatchResponse = await projectsModule.actions.updateProject({commit}, project);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('success delete project', async () => {
|
||||
jest.spyOn(api, 'deleteProjectRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const project = 'id';
|
||||
it('success delete project', async () => {
|
||||
jest.spyOn(api, 'deleteProjectRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const project = 'id';
|
||||
|
||||
const dispatchResponse = await projectsModule.actions.deleteProject({commit}, project);
|
||||
const dispatchResponse = await projectsModule.actions.deleteProject({commit}, project);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.DELETE, project);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(PROJECTS_MUTATIONS.DELETE, project);
|
||||
});
|
||||
|
||||
it('error delete project', async () => {
|
||||
jest.spyOn(api, 'deleteProjectRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
it('error delete project', async () => {
|
||||
jest.spyOn(api, 'deleteProjectRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
|
||||
const dispatchResponse = await projectsModule.actions.deleteProject({commit}, 'id');
|
||||
const dispatchResponse = await projectsModule.actions.deleteProject({commit}, 'id');
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getters', () => {
|
||||
|
||||
it('getter projects', () => {
|
||||
const state = {
|
||||
projects: [{
|
||||
name: '1',
|
||||
id: '1',
|
||||
companyName: '1',
|
||||
description: '1',
|
||||
isTermsAccepted: true,
|
||||
createdAt: '1',
|
||||
}],
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
const projectsGetterArray = projectsModule.getters.projects(state);
|
||||
it('getter projects', () => {
|
||||
const state = {
|
||||
projects: [{
|
||||
name: '1',
|
||||
id: '1',
|
||||
companyName: '1',
|
||||
description: '1',
|
||||
isTermsAccepted: true,
|
||||
createdAt: '1',
|
||||
}],
|
||||
selectedProject: {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
const projectsGetterArray = projectsModule.getters.projects(state);
|
||||
|
||||
expect(projectsGetterArray.length).toBe(1);
|
||||
expect(projectsGetterArray.length).toBe(1);
|
||||
|
||||
const firstProject = projectsGetterArray[0];
|
||||
const firstProject = projectsGetterArray[0];
|
||||
|
||||
expect(firstProject.name).toBe('1');
|
||||
expect(firstProject.id).toBe('1');
|
||||
expect(firstProject.description).toBe('1');
|
||||
expect(firstProject.isTermsAccepted).toBe(true);
|
||||
expect(firstProject.createdAt).toBe('1');
|
||||
});
|
||||
expect(firstProject.name).toBe('1');
|
||||
expect(firstProject.id).toBe('1');
|
||||
expect(firstProject.description).toBe('1');
|
||||
expect(firstProject.isTermsAccepted).toBe(true);
|
||||
expect(firstProject.createdAt).toBe('1');
|
||||
});
|
||||
|
||||
it('getter projects', () => {
|
||||
const state = {
|
||||
projects: [{
|
||||
name: '1',
|
||||
id: '1',
|
||||
companyName: '1',
|
||||
description: '1',
|
||||
isTermsAccepted: true,
|
||||
createdAt: '1',
|
||||
}],
|
||||
selectedProject: {
|
||||
id: '2'
|
||||
}
|
||||
};
|
||||
const projectsGetterArray = projectsModule.getters.projects(state);
|
||||
it('getter projects', () => {
|
||||
const state = {
|
||||
projects: [{
|
||||
name: '1',
|
||||
id: '1',
|
||||
companyName: '1',
|
||||
description: '1',
|
||||
isTermsAccepted: true,
|
||||
createdAt: '1',
|
||||
}],
|
||||
selectedProject: {
|
||||
id: '2'
|
||||
}
|
||||
};
|
||||
const projectsGetterArray = projectsModule.getters.projects(state);
|
||||
|
||||
expect(projectsGetterArray.length).toBe(1);
|
||||
expect(projectsGetterArray.length).toBe(1);
|
||||
|
||||
const firstProject = projectsGetterArray[0];
|
||||
const firstProject = projectsGetterArray[0];
|
||||
|
||||
expect(firstProject.name).toBe('1');
|
||||
expect(firstProject.id).toBe('1');
|
||||
expect(firstProject.description).toBe('1');
|
||||
expect(firstProject.isTermsAccepted).toBe(true);
|
||||
expect(firstProject.createdAt).toBe('1');
|
||||
});
|
||||
expect(firstProject.name).toBe('1');
|
||||
expect(firstProject.id).toBe('1');
|
||||
expect(firstProject.description).toBe('1');
|
||||
expect(firstProject.isTermsAccepted).toBe(true);
|
||||
expect(firstProject.createdAt).toBe('1');
|
||||
});
|
||||
|
||||
it('getters selected project', () => {
|
||||
const state = {
|
||||
selectedProject: {
|
||||
name: '1',
|
||||
id: '1',
|
||||
description: '1',
|
||||
isTermsAccepted: true,
|
||||
createdAt: '1',
|
||||
}
|
||||
};
|
||||
const selectedProjectGetterObject = projectsModule.getters.selectedProject(state);
|
||||
it('getters selected project', () => {
|
||||
const state = {
|
||||
selectedProject: {
|
||||
name: '1',
|
||||
id: '1',
|
||||
description: '1',
|
||||
isTermsAccepted: true,
|
||||
createdAt: '1',
|
||||
}
|
||||
};
|
||||
const selectedProjectGetterObject = projectsModule.getters.selectedProject(state);
|
||||
|
||||
expect(selectedProjectGetterObject.name).toBe('1');
|
||||
expect(selectedProjectGetterObject.id).toBe('1');
|
||||
expect(selectedProjectGetterObject.description).toBe('1');
|
||||
expect(selectedProjectGetterObject.isTermsAccepted).toBe(true);
|
||||
expect(selectedProjectGetterObject.createdAt).toBe('1');
|
||||
});
|
||||
expect(selectedProjectGetterObject.name).toBe('1');
|
||||
expect(selectedProjectGetterObject.id).toBe('1');
|
||||
expect(selectedProjectGetterObject.description).toBe('1');
|
||||
expect(selectedProjectGetterObject.isTermsAccepted).toBe(true);
|
||||
expect(selectedProjectGetterObject.createdAt).toBe('1');
|
||||
});
|
||||
});
|
||||
|
@ -11,196 +11,196 @@ import { createLocalVue } from '@vue/test-utils';
|
||||
const mutations = usersModule.mutations;
|
||||
|
||||
describe('mutations', () => {
|
||||
beforeEach(() => {
|
||||
createLocalVue().use(Vuex);
|
||||
});
|
||||
it('Set user info', () => {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
beforeEach(() => {
|
||||
createLocalVue().use(Vuex);
|
||||
});
|
||||
it('Set user info', () => {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
const user = {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email'
|
||||
};
|
||||
const user = {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email'
|
||||
};
|
||||
|
||||
store.commit(USER_MUTATIONS.SET_USER_INFO, user);
|
||||
store.commit(USER_MUTATIONS.SET_USER_INFO, user);
|
||||
|
||||
expect(state.user.email).toBe('email');
|
||||
expect(state.user.firstName).toBe('firstName');
|
||||
expect(state.user.lastName).toBe('lastName');
|
||||
});
|
||||
expect(state.user.email).toBe('email');
|
||||
expect(state.user.firstName).toBe('firstName');
|
||||
expect(state.user.lastName).toBe('lastName');
|
||||
});
|
||||
|
||||
it('clear user info', () => {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
};
|
||||
it('clear user info', () => {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
store.commit(USER_MUTATIONS.REVERT_TO_DEFAULT_USER_INFO);
|
||||
store.commit(USER_MUTATIONS.REVERT_TO_DEFAULT_USER_INFO);
|
||||
|
||||
expect(state.user.email).toBe('');
|
||||
expect(state.user.firstName).toBe('');
|
||||
expect(state.user.lastName).toBe('');
|
||||
});
|
||||
expect(state.user.email).toBe('');
|
||||
expect(state.user.firstName).toBe('');
|
||||
expect(state.user.lastName).toBe('');
|
||||
});
|
||||
|
||||
it('Update user info', () => {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
const user = {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email'
|
||||
};
|
||||
it('Update user info', () => {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
const user = {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email'
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
const store = new Vuex.Store({state, mutations});
|
||||
|
||||
store.commit(USER_MUTATIONS.UPDATE_USER_INFO, user);
|
||||
store.commit(USER_MUTATIONS.UPDATE_USER_INFO, user);
|
||||
|
||||
expect(state.user.email).toBe('email');
|
||||
expect(state.user.firstName).toBe('firstName');
|
||||
expect(state.user.lastName).toBe('lastName');
|
||||
});
|
||||
expect(state.user.email).toBe('email');
|
||||
expect(state.user.firstName).toBe('firstName');
|
||||
expect(state.user.lastName).toBe('lastName');
|
||||
});
|
||||
});
|
||||
|
||||
describe('actions', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
it('success update account', async () => {
|
||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: true, data: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
});
|
||||
const commit = jest.fn();
|
||||
const user = {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
};
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
it('success update account', async () => {
|
||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: true, data: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
});
|
||||
const commit = jest.fn();
|
||||
const user = {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
};
|
||||
|
||||
const dispatchResponse = await usersModule.actions.updateAccount({commit}, user);
|
||||
const dispatchResponse = await usersModule.actions.updateAccount({commit}, user);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(USER_MUTATIONS.UPDATE_USER_INFO, {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email'
|
||||
});
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
expect(commit).toHaveBeenCalledWith(USER_MUTATIONS.UPDATE_USER_INFO, {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email'
|
||||
});
|
||||
});
|
||||
|
||||
it('error update account', async () => {
|
||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: false
|
||||
});
|
||||
const commit = jest.fn();
|
||||
const user = {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
};
|
||||
it('error update account', async () => {
|
||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: false
|
||||
});
|
||||
const commit = jest.fn();
|
||||
const user = {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
};
|
||||
|
||||
const dispatchResponse = await usersModule.actions.updateAccount({commit}, user);
|
||||
const dispatchResponse = await usersModule.actions.updateAccount({commit}, user);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeFalsy();
|
||||
expect(commit).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('password change', async () => {
|
||||
jest.spyOn(api, 'changePasswordRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const updatePasswordModel = {oldPassword: 'o', newPassword: 'n'};
|
||||
it('password change', async () => {
|
||||
jest.spyOn(api, 'changePasswordRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const updatePasswordModel = {oldPassword: 'o', newPassword: 'n'};
|
||||
|
||||
const requestResponse = await usersModule.actions.changePassword({commit}, updatePasswordModel);
|
||||
const requestResponse = await usersModule.actions.changePassword({commit}, updatePasswordModel);
|
||||
|
||||
expect(requestResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
expect(requestResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
|
||||
it('delete account', async () => {
|
||||
jest.spyOn(api, 'deleteAccountRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const password = '';
|
||||
it('delete account', async () => {
|
||||
jest.spyOn(api, 'deleteAccountRequest').mockReturnValue({isSuccess: true});
|
||||
const commit = jest.fn();
|
||||
const password = '';
|
||||
|
||||
const dispatchResponse = await usersModule.actions.deleteAccount(commit, password);
|
||||
const dispatchResponse = await usersModule.actions.deleteAccount(commit, password);
|
||||
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
expect(dispatchResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
|
||||
it('success get user', async () => {
|
||||
jest.spyOn(api, 'getUserRequest').mockReturnValue({
|
||||
isSuccess: true,
|
||||
data: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
});
|
||||
const commit = jest.fn();
|
||||
it('success get user', async () => {
|
||||
jest.spyOn(api, 'getUserRequest').mockReturnValue({
|
||||
isSuccess: true,
|
||||
data: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
});
|
||||
const commit = jest.fn();
|
||||
|
||||
const requestResponse = await usersModule.actions.getUser({commit});
|
||||
const requestResponse = await usersModule.actions.getUser({commit});
|
||||
|
||||
expect(requestResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
expect(requestResponse.isSuccess).toBeTruthy();
|
||||
});
|
||||
|
||||
it('error get user', async () => {
|
||||
jest.spyOn(api, 'getUserRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
it('error get user', async () => {
|
||||
jest.spyOn(api, 'getUserRequest').mockReturnValue({isSuccess: false});
|
||||
const commit = jest.fn();
|
||||
|
||||
const requestResponse = await usersModule.actions.getUser({commit});
|
||||
const requestResponse = await usersModule.actions.getUser({commit});
|
||||
|
||||
expect(requestResponse.isSuccess).toBeFalsy();
|
||||
});
|
||||
expect(requestResponse.isSuccess).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getters', () => {
|
||||
it('user model', function () {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
};
|
||||
it('user model', function () {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
};
|
||||
|
||||
const retrievedUser = usersModule.getters.user(state);
|
||||
const retrievedUser = usersModule.getters.user(state);
|
||||
|
||||
expect(retrievedUser.firstName).toBe('firstName');
|
||||
expect(retrievedUser.lastName).toBe('lastName');
|
||||
expect(retrievedUser.email).toBe('email');
|
||||
});
|
||||
expect(retrievedUser.firstName).toBe('firstName');
|
||||
expect(retrievedUser.lastName).toBe('lastName');
|
||||
expect(retrievedUser.email).toBe('email');
|
||||
});
|
||||
|
||||
it('user name', function () {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: 'John',
|
||||
lastName: 'Doe'
|
||||
}
|
||||
};
|
||||
it('user name', function () {
|
||||
const state = {
|
||||
user: {
|
||||
firstName: 'John',
|
||||
lastName: 'Doe'
|
||||
}
|
||||
};
|
||||
|
||||
const retrievedUserName = usersModule.getters.userName(state);
|
||||
const retrievedUserName = usersModule.getters.userName(state);
|
||||
|
||||
expect(retrievedUserName).toBe('John Doe');
|
||||
});
|
||||
expect(retrievedUserName).toBe('John Doe');
|
||||
});
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
} from '@/utils/validation';
|
||||
|
||||
describe('validation', () => {
|
||||
it('validateProjectName regex works correctly', () => {
|
||||
it('validateProjectName regex works correctly', () => {
|
||||
const testString1 = 'test';
|
||||
const testString2 = ' ';
|
||||
const testString3 = ' test ';
|
||||
@ -16,7 +16,7 @@ describe('validation', () => {
|
||||
const testString5 = ' test213##221344rfvv^ ';
|
||||
const testString6 = '';
|
||||
|
||||
expect(validateProjectName(testString1)).toBe(true);
|
||||
expect(validateProjectName(testString1)).toBe(true);
|
||||
expect(validateProjectName(testString2)).toBe(true);
|
||||
expect(validateProjectName(testString3)).toBe(true);
|
||||
expect(validateProjectName(testString4)).toBe(false);
|
||||
@ -58,5 +58,5 @@ describe('validation', () => {
|
||||
expect(validateEmail(testString5)).toBe(true);
|
||||
expect(validateEmail(testString6)).toBe(false);
|
||||
expect(validateEmail(testString7)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -20,6 +20,7 @@
|
||||
"quotemark": [true, "single", "avoid-escape"],
|
||||
// Ensures the file ends with a newline.
|
||||
"eofline": true,
|
||||
"indent": [true, "spaces", 4],
|
||||
// Ensures proper spacing between import statement keywords.
|
||||
"import-spacing": true,
|
||||
"interface-name": false,
|
||||
|
Loading…
Reference in New Issue
Block a user