You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.ts 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2019 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import { getJSON } from '../../../helpers/request';
  21. export interface FeaturedProject {
  22. key: string;
  23. avatarUrl: string | null;
  24. organizationKey: string;
  25. organizationName: string;
  26. name: string;
  27. bugs: number;
  28. codeSmells: number;
  29. coverage?: number;
  30. duplications: number;
  31. gateStatus: string;
  32. languages: string[];
  33. maintainabilityRating: number;
  34. ncloc: number;
  35. reliabilityRating: number;
  36. securityRating: number;
  37. vulnerabilities: number;
  38. }
  39. export interface HomepageData {
  40. generatedAt: string;
  41. publicProjects: number;
  42. publicLoc: number;
  43. rules: number;
  44. featuredProjects: FeaturedProject[];
  45. newPullRequests7d: number;
  46. }
  47. export const LANGUAGES = [
  48. { name: 'Java', file: 'java.svg', width: 65 },
  49. { name: 'JavaScript', file: 'js.svg', width: 60 },
  50. { name: 'TypeScript', file: 'ts.svg', width: 100 },
  51. { name: 'C#', file: 'csharp.svg', width: 60 },
  52. { name: 'Python', file: 'python.svg', width: 65 },
  53. { name: 'C++', file: 'c-c-plus-plus.svg', width: 53 },
  54. { name: 'Go', file: 'go.svg', width: 91 },
  55. { name: 'Kotlin', file: 'kotlin.svg', width: 42 },
  56. { name: 'Ruby', file: 'ruby.svg', width: 43 },
  57. { name: 'Swift', file: 'swift.svg', width: 64 },
  58. { name: 'ABAP', file: 'abap.svg', width: 62 },
  59. { name: 'Apex', file: 'apex.svg', width: 62 },
  60. { name: 'Flex', file: 'flex.png', width: 85 },
  61. { name: 'CSS', file: 'css.svg', width: 40 },
  62. { name: 'HTML', file: 'html5.svg', width: 40 },
  63. { name: 'Objective-C', file: 'obj-c.svg', width: 63 },
  64. { name: 'PHP', file: 'php.svg', width: 57 },
  65. { name: 'Scala', file: 'scala.svg', width: 29 },
  66. { name: 'T-SQL', file: 't-sql.svg', width: 53 },
  67. { name: 'PL/SQL', file: 'pl-sql.svg', width: 65 },
  68. { name: 'VB', file: 'vb.svg', width: 55 },
  69. { name: 'XML', file: 'xml.svg', width: 67 },
  70. { name: 'COBOL', file: 'cobol.svg', width: 65 }
  71. ];
  72. export function requestHomepageData(url: string): Promise<HomepageData> {
  73. return getJSON(url);
  74. }