@@ -11,51 +11,78 @@ import {
11
11
BaseAnalysisIssueReport ,
12
12
} from "../models" ;
13
13
14
- const ANALYSIS_ISSUE = hub `/analyses/insights/{{id}}` ;
15
- const ANALYSIS_ISSUE_INCIDENTS = hub `/analyses/insights/{{id}}/incidents` ;
16
- const ANALYSIS_RULES = hub `/analyses/report/rules?filter=effort>0` ;
17
- const ANALYSIS_APP_ISSUES = hub `/analyses/report/applications/{{id}}/insights?filter=effort>0` ;
18
- const ANALYSIS_ISSUES_APPS = hub `/analyses/report/insights/applications?filter=effort>0` ;
19
- const ANALYSIS_ISSUE_FILES = hub `/analyses/report/insights/{{id}}/files` ;
14
+ /*
15
+ - Analysis uses a collection of rulesets containing rules, and activating labels to produce a
16
+ report containing dependencies, insights, and incidents.
17
+ - Dependencies are handled on their own page.
18
+ - The insights view will only show insights with an effort =0.
19
+ - Issues are insights with effort >0.
20
+ - Insights have one or more incidents.
21
+ - Incidents are a specific occurrence of the insight/issue/rule in a source file.
22
+ */
20
23
21
- export const getRuleReports = ( params : HubRequestParams = { } ) =>
22
- getHubPaginatedResult < BaseAnalysisRuleReport > ( ANALYSIS_RULES , params ) ;
24
+ const INSIGHT = hub `/analyses/insights/{{id}}` ;
25
+ const INSIGHT_INCIDENTS = hub `/analyses/insights/{{id}}/incidents` ;
26
+ const REPORT_INSIGHT_FILES = hub `/analyses/report/insights/{{id}}/files` ;
23
27
24
- export const getAppReports = ( params : HubRequestParams = { } ) =>
25
- getHubPaginatedResult < AnalysisAppReport > ( ANALYSIS_ISSUES_APPS , params ) ;
28
+ const REPORT_ISSUES = hub `/analyses/report/rules?filter=effort>0` ; // RuleReports
29
+ const REPORT_APP_ISSUES = hub `/analyses/report/applications/{{id}}/insights?filter=effort>0` ; // AppInsightReports
30
+ const REPORT_ISSUES_APPS = hub `/analyses/report/insights/applications?filter=effort>0` ; // InsightAppReports
26
31
27
- export const getIssueReports = (
28
- applicationId ?: number ,
29
- params : HubRequestParams = { }
30
- ) =>
31
- getHubPaginatedResult < BaseAnalysisIssueReport > (
32
- template ( ANALYSIS_APP_ISSUES , { id : applicationId } ) ,
33
- params
34
- ) ;
32
+ const REPORT_INSIGHTS = hub `/analyses/report/rules?filter=effort=0` ; // RuleReports
33
+ const REPORT_APP_INSIGHTS = hub `/analyses/report/applications/{{id}}/insights?filter=effort=0` ; // AppInsightReports
34
+ const REPORT_INSIGHTS_APPS = hub `/analyses/report/insights/applications?filter=effort=0` ; // InsightAppReports
35
35
36
- export const getIssue = ( issueId : number ) =>
36
+ export const getInsight = ( id : number ) =>
37
37
axios
38
- . get < AnalysisIssue > ( template ( ANALYSIS_ISSUE , { id : issueId } ) )
38
+ . get < AnalysisIssue > ( template ( INSIGHT , { id } ) )
39
39
. then ( ( response ) => response . data ) ;
40
40
41
- export const getFileReports = (
42
- issueId ? : number ,
41
+ export const getInsightIncidents = (
42
+ id : number ,
43
43
params : HubRequestParams = { }
44
44
) =>
45
- issueId
46
- ? getHubPaginatedResult < AnalysisFileReport > (
47
- template ( ANALYSIS_ISSUE_FILES , { id : issueId } ) ,
45
+ id
46
+ ? getHubPaginatedResult < AnalysisIncident > (
47
+ template ( INSIGHT_INCIDENTS , { id : id } ) ,
48
48
params
49
49
)
50
50
: Promise . reject ( ) ;
51
51
52
- export const getIncidents = (
53
- issueId ?: number ,
52
+ export const getInsightFiles = ( id : number , params : HubRequestParams = { } ) =>
53
+ getHubPaginatedResult < AnalysisFileReport > (
54
+ template ( REPORT_INSIGHT_FILES , { id } ) ,
55
+ params
56
+ ) ;
57
+
58
+ // Issue specific functions
59
+ export const getReportAllIssues = ( params : HubRequestParams = { } ) =>
60
+ getHubPaginatedResult < BaseAnalysisRuleReport > ( REPORT_ISSUES , params ) ;
61
+
62
+ export const getReportApplicationIssues = (
63
+ applicationId : number ,
54
64
params : HubRequestParams = { }
55
65
) =>
56
- issueId
57
- ? getHubPaginatedResult < AnalysisIncident > (
58
- template ( ANALYSIS_ISSUE_INCIDENTS , { id : issueId } ) ,
59
- params
60
- )
61
- : Promise . reject ( ) ;
66
+ getHubPaginatedResult < BaseAnalysisIssueReport > (
67
+ template ( REPORT_APP_ISSUES , { id : applicationId } ) ,
68
+ params
69
+ ) ;
70
+
71
+ export const getReportIssueApps = ( params : HubRequestParams = { } ) =>
72
+ getHubPaginatedResult < AnalysisAppReport > ( REPORT_ISSUES_APPS , params ) ;
73
+
74
+ // Insight specific functions
75
+ export const getReportAllInsights = ( params : HubRequestParams = { } ) =>
76
+ getHubPaginatedResult < BaseAnalysisRuleReport > ( REPORT_INSIGHTS , params ) ;
77
+
78
+ export const getReportApplicationInsights = (
79
+ applicationId : number ,
80
+ params : HubRequestParams = { }
81
+ ) =>
82
+ getHubPaginatedResult < AnalysisAppReport > (
83
+ template ( REPORT_APP_INSIGHTS , { id : applicationId } ) ,
84
+ params
85
+ ) ;
86
+
87
+ export const getReportInsightApps = ( params : HubRequestParams = { } ) =>
88
+ getHubPaginatedResult < AnalysisAppReport > ( REPORT_INSIGHTS_APPS , params ) ;
0 commit comments