Added number of overall API Keys. (#1336)

* Added number of overall API Keys.
This commit is contained in:
Bogdan Artemenko 2019-02-21 13:01:52 +02:00 committed by GitHub
parent c7072620a1
commit d73b7b5fd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 50 deletions

View File

@ -6,8 +6,8 @@
<div class="delete-api-key-container__wrap">
<div class="delete-api-key-container__selected-api-keys-count">
<span class="delete-api-key-container__selected-api-keys-count__button"></span>
<p class="delete-api-key-container__selected-api-keys-count__count">{{ count }}</p>
<p class="delete-api-key-container__selected-api-keys-count__total-count"> of <span>X</span> API Keys Selected</p>
<p class="delete-api-key-container__selected-api-keys-count__count">{{ selectedAPIKeysCount }}</p>
<p class="delete-api-key-container__selected-api-keys-count__total-count"> of <span>{{ allAPIKeysCount }}</span> API Keys Selected</p>
</div>
<div class="delete-api-key-container__buttons-group">
<Button
@ -52,8 +52,11 @@ import { API_KEYS_ACTIONS, NOTIFICATION_ACTIONS } from '@/utils/constants/action
},
},
computed: {
count: function (): number {
selectedAPIKeysCount: function (): number {
return this.$store.getters.selectedAPIKeys.length;
},
allAPIKeysCount: function (): number {
return this.$store.state.apiKeysModule.apiKeys.length;
}
},
components: {

View File

@ -208,11 +208,11 @@ describe('actions', () => {
},
joinedAt: '1'
};
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
Promise.resolve(<RequestResponse<TeamMemberModel[]>>{
isSuccess: true,
data: [projectMemberMockModel]
}));
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
Promise.resolve(<RequestResponse<TeamMemberModel[]>>{
isSuccess: true,
data: [projectMemberMockModel]
}));
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
state,
@ -240,11 +240,11 @@ describe('actions', () => {
}
};
const commit = jest.fn();
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
Promise.resolve(<RequestResponse<TeamMemberModel[]>>{
isSuccess: false,
})
);
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
Promise.resolve(<RequestResponse<TeamMemberModel[]>>{
isSuccess: false,
})
);
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
state,

View File

@ -85,15 +85,15 @@ describe('actions', () => {
jest.resetAllMocks();
});
it('success update account', async () => {
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
Promise.resolve(<RequestResponse<User>>{
isSuccess: true, data: {
firstName: 'firstName',
lastName: 'lastName',
email: 'email',
}
})
);
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
Promise.resolve(<RequestResponse<User>>{
isSuccess: true, data: {
firstName: 'firstName',
lastName: 'lastName',
email: 'email',
}
})
);
const commit = jest.fn();
const user = {
firstName: '',
@ -113,10 +113,10 @@ describe('actions', () => {
it('error update account', async () => {
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
Promise.resolve(<RequestResponse<User>>{
isSuccess: false
})
);
Promise.resolve(<RequestResponse<User>>{
isSuccess: false
})
);
const commit = jest.fn();
const user = {
firstName: '',
@ -132,10 +132,10 @@ describe('actions', () => {
it('password change', async () => {
jest.spyOn(api, 'changePasswordRequest').mockReturnValue(
Promise.resolve(<RequestResponse<null>>{
isSuccess: true
})
);
Promise.resolve(<RequestResponse<null>>{
isSuccess: true
})
);
const commit = jest.fn();
const updatePasswordModel = {oldPassword: 'o', newPassword: 'n'};
@ -145,11 +145,11 @@ describe('actions', () => {
});
it('delete account', async () => {
jest.spyOn(api, 'deleteAccountRequest').mockReturnValue(
Promise.resolve(<RequestResponse<null>>{
isSuccess: true
})
);
jest.spyOn(api, 'deleteAccountRequest').mockReturnValue(
Promise.resolve(<RequestResponse<null>>{
isSuccess: true
})
);
const commit = jest.fn();
const password = '';
@ -160,16 +160,16 @@ describe('actions', () => {
});
it('success get user', async () => {
jest.spyOn(api, 'getUserRequest').mockReturnValue(
Promise.resolve(<RequestResponse<User>>{
isSuccess: true,
data: {
firstName: '',
lastName: '',
email: ''
}
})
);
jest.spyOn(api, 'getUserRequest').mockReturnValue(
Promise.resolve(<RequestResponse<User>>{
isSuccess: true,
data: {
firstName: '',
lastName: '',
email: ''
}
})
);
const commit = jest.fn();
const requestResponse = await usersModule.actions.getUser({commit});
@ -178,11 +178,11 @@ describe('actions', () => {
});
it('error get user', async () => {
jest.spyOn(api, 'getUserRequest').mockReturnValue(
Promise.resolve(<RequestResponse<User>>{
isSuccess: false
})
);
jest.spyOn(api, 'getUserRequest').mockReturnValue(
Promise.resolve(<RequestResponse<User>>{
isSuccess: false
})
);
const commit = jest.fn();
const requestResponse = await usersModule.actions.getUser({commit});