userMocks.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { OrgRole, OrgUser } from 'app/types';
  2. export const getMockUsers = (amount: number) => {
  3. const users = [];
  4. for (let i = 0; i <= amount; i++) {
  5. users.push({
  6. avatarUrl: 'url/to/avatar',
  7. email: `user-${i}@test.com`,
  8. name: `user-${i} test`,
  9. lastSeenAt: '2018-10-01',
  10. lastSeenAtAge: '',
  11. login: `user-${i}`,
  12. orgId: 1,
  13. role: 'Admin',
  14. userId: i,
  15. });
  16. }
  17. return users as OrgUser[];
  18. };
  19. export const getMockUser = () => {
  20. return {
  21. avatarUrl: 'url/to/avatar',
  22. email: `user@test.com`,
  23. name: 'user test',
  24. lastSeenAt: '2018-10-01',
  25. lastSeenAtAge: '',
  26. login: `user`,
  27. orgId: 1,
  28. role: 'Admin' as OrgRole,
  29. userId: 2,
  30. } as OrgUser;
  31. };
  32. export const getMockInvitees = (amount: number) => {
  33. const invitees = [];
  34. for (let i = 0; i <= amount; i++) {
  35. invitees.push({
  36. code: `asdfasdfsadf-${i}`,
  37. createdOn: '2018-10-02',
  38. email: `invitee-${i}@test.com`,
  39. emailSent: true,
  40. emailSentOn: '2018-10-02',
  41. id: i,
  42. invitedByEmail: 'admin@grafana.com',
  43. invitedByLogin: 'admin',
  44. invitedByName: 'admin',
  45. name: `invitee-${i}`,
  46. orgId: 1,
  47. role: 'viewer',
  48. status: 'not accepted',
  49. url: `localhost/invite/${i}`,
  50. });
  51. }
  52. return invitees;
  53. };