Skip to content

Commit 1ef0c69

Browse files
committed
Additional issue to insight switching and verification
Signed-off-by: Scott J Dickerson <[email protected]>
1 parent c6f9358 commit 1ef0c69

File tree

8 files changed

+36
-29
lines changed

8 files changed

+36
-29
lines changed

client/public/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@
406406
"jiraConfig": "Jira configuration",
407407
"issue": "Issue",
408408
"issues": "Issues",
409+
"insights": "Insights",
409410
"jobFunction": "Job function",
410411
"jobFunctionDeleted": "Job function deleted",
411412
"jobFunctions": "Job functions",

client/src/app/Constants.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,15 @@ export enum LocalStorageKey {
245245

246246
// URL param prefixes: should be short, must be unique for each table that uses one
247247
export enum TablePersistenceKeyPrefix {
248-
issues = "i",
249248
dependencies = "d",
249+
issues = "i",
250250
issuesAffectedApps = "ia",
251251
issuesAffectedFiles = "if",
252252
issuesRemainingIncidents = "ii",
253+
insights = "in",
254+
insightsAffectedApps = "ina",
255+
insightsAffectedFiles = "inf",
256+
insightsRemainingIncidents = "ini",
253257
dependencyApplications = "da",
254258
archetypes = "ar",
255259
tasks = "t",

client/src/app/pages/insights/affected-applications/affected-applications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const AffectedApplications: React.FC = () => {
5454
const tableControlState = useTableControlState({
5555
tableName: "affected-applications-table",
5656
persistTo: "urlParams",
57-
persistenceKeyPrefix: TablePersistenceKeyPrefix.issuesAffectedApps,
57+
persistenceKeyPrefix: TablePersistenceKeyPrefix.insightsAffectedApps,
5858
columnNames: {
5959
name: "Name",
6060
description: "Description",

client/src/app/pages/insights/helpers.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const useSharedAffectedApplicationFilterCategories = <
140140
];
141141
};
142142

143-
const FROM_ISSUES_PARAMS_KEY = "~fromIssuesParams"; // ~ prefix sorts it at the end of the URL for readability
143+
const FROM_INSIGHTS_PARAMS_KEY = "~fromInsightsParams"; // ~ prefix sorts it at the end of the URL for readability
144144

145145
// URL for Affected Apps page that includes carried filters and a snapshot of original URL params from the Insights page
146146
export const getAffectedAppsUrl = ({
@@ -158,16 +158,16 @@ export const getAffectedAppsUrl = ({
158158
filterKeysToCarry.forEach((key) => {
159159
if (fromFilterValues[key]) toFilterValues[key] = fromFilterValues[key];
160160
});
161-
const baseUrl = Paths.issuesAllAffectedApplications
161+
const baseUrl = Paths.insightsAllAffectedApplications
162162
.replace("/:ruleset/", `/${encodeURIComponent(ruleReport.ruleset)}/`)
163163
.replace("/:rule/", `/${encodeURIComponent(ruleReport.rule)}/`);
164164
const prefix = (key: string) =>
165-
`${TablePersistenceKeyPrefix.issuesAffectedApps}:${key}`;
165+
`${TablePersistenceKeyPrefix.insightsAffectedApps}:${key}`;
166166

167167
return `${baseUrl}?${trimAndStringifyUrlParams({
168168
newPrefixedSerializedParams: {
169169
[prefix("filters")]: serializeFilterUrlParams(toFilterValues).filters,
170-
[FROM_ISSUES_PARAMS_KEY]: fromInsightsParams,
170+
[FROM_INSIGHTS_PARAMS_KEY]: fromInsightsParams,
171171
insightTitle: getInsightTitle(ruleReport),
172172
},
173173
})}`;
@@ -183,13 +183,15 @@ export const getBackToAllInsightsUrl = ({
183183
}) => {
184184
// Pull the fromInsightsParams param out of the current location's URLSearchParams
185185
const fromInsightsParams =
186-
new URLSearchParams(fromLocation.search).get(FROM_ISSUES_PARAMS_KEY) || "";
186+
new URLSearchParams(fromLocation.search).get(FROM_INSIGHTS_PARAMS_KEY) ||
187+
"";
187188
// Pull the params themselves out of fromInsightsParams
188189
const prefixedParamsToRestore = Object.fromEntries(
189190
new URLSearchParams(fromInsightsParams)
190191
);
191192
// Pull the filters param out of that
192-
const prefix = (key: string) => `${TablePersistenceKeyPrefix.issues}:${key}`;
193+
const prefix = (key: string) =>
194+
`${TablePersistenceKeyPrefix.insights}:${key}`;
193195
const filterValuesToRestore = deserializeFilterUrlParams({
194196
filters: prefixedParamsToRestore[prefix("filters")],
195197
});
@@ -199,7 +201,7 @@ export const getBackToAllInsightsUrl = ({
199201
filterValuesToRestore[key] = fromFilterValues[key] || null;
200202
});
201203
// Put it all back together
202-
return `${Paths.issuesAllTab}?${trimAndStringifyUrlParams({
204+
return `${Paths.insightsAllTab}?${trimAndStringifyUrlParams({
203205
newPrefixedSerializedParams: {
204206
...prefixedParamsToRestore,
205207
[prefix("filters")]: serializeFilterUrlParams(filterValuesToRestore)
@@ -229,10 +231,10 @@ export const getInsightsSingleAppSelectedLocation = (
229231
const existingFiltersParam =
230232
fromLocation &&
231233
new URLSearchParams(fromLocation.search).get(
232-
`${TablePersistenceKeyPrefix.issues}:filters`
234+
`${TablePersistenceKeyPrefix.insights}:filters`
233235
);
234236
return {
235-
pathname: Paths.issuesSingleAppSelected.replace(
237+
pathname: Paths.insightsSingleAppSelected.replace(
236238
":applicationId",
237239
String(applicationId)
238240
),

client/src/app/pages/insights/insight-detail-drawer/file-incidents-detail-modal/file-all-incidents-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const FileAllIncidentsTable: React.FC<
2828
const tableControlState = useTableControlState({
2929
tableName: "file-all-incidents-table",
3030
persistTo: "urlParams",
31-
persistenceKeyPrefix: TablePersistenceKeyPrefix.issuesRemainingIncidents,
31+
persistenceKeyPrefix: TablePersistenceKeyPrefix.insightsRemainingIncidents,
3232
columnNames: {
3333
line: "Line #",
3434
message: "Message",

client/src/app/pages/insights/insight-detail-drawer/insight-affected-files-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const InsightAffectedFilesTable: React.FC<
3838
const tableControlState = useTableControlState({
3939
tableName: "affected-files-table",
4040
persistTo: "urlParams",
41-
persistenceKeyPrefix: TablePersistenceKeyPrefix.issuesAffectedFiles,
41+
persistenceKeyPrefix: TablePersistenceKeyPrefix.insightsAffectedFiles,
4242
columnNames: {
4343
file: "File",
4444
incidents: "Incidents",

client/src/app/pages/insights/insights-page.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ export enum InsightFilterGroups {
2525
}
2626

2727
export type InsightsTabPath =
28-
| typeof Paths.issuesAllTab
29-
| typeof Paths.issuesSingleAppTab;
28+
| typeof Paths.insightsAllTab
29+
| typeof Paths.insightsSingleAppTab;
3030

3131
export const InsightsPage: React.FC = () => {
3232
const { t } = useTranslation();
3333
const location = useLocation();
3434
const history = useHistory();
35-
const singleAppTabMatch = useRouteMatch(Paths.issuesSingleAppTab);
36-
const singleAppSelectedMatch = useRouteMatch(Paths.issuesSingleAppSelected);
35+
const singleAppTabMatch = useRouteMatch(Paths.insightsSingleAppTab);
36+
const singleAppSelectedMatch = useRouteMatch(Paths.insightsSingleAppSelected);
3737

3838
const activeTabPath =
3939
singleAppTabMatch || singleAppSelectedMatch
40-
? Paths.issuesSingleAppTab
41-
: Paths.issuesAllTab;
40+
? Paths.insightsSingleAppTab
41+
: Paths.insightsAllTab;
4242

4343
React.useEffect(() => {
44-
if (!activeTabPath) history.push(Paths.issuesAllTab);
44+
if (!activeTabPath) history.push(Paths.insightsAllTab);
4545
}, [activeTabPath, history]);
4646

4747
const [navConfirmPath, setNavConfirmPath] =
@@ -61,7 +61,7 @@ export const InsightsPage: React.FC = () => {
6161
activeKey={activeTabPath}
6262
onSelect={(_event, tabPath) => {
6363
const pageHasFilters = new URLSearchParams(location.search).has(
64-
`${TablePersistenceKeyPrefix.issues}:filters`
64+
`${TablePersistenceKeyPrefix.insights}:filters`
6565
);
6666
if (pageHasFilters) {
6767
setNavConfirmPath(tabPath as InsightsTabPath);
@@ -71,32 +71,32 @@ export const InsightsPage: React.FC = () => {
7171
}}
7272
>
7373
<Tab
74-
eventKey={Paths.issuesAllTab}
74+
eventKey={Paths.insightsAllTab}
7575
title={<TabTitleText>All insights</TabTitleText>}
7676
/>
7777
<Tab
78-
eventKey={Paths.issuesSingleAppTab}
78+
eventKey={Paths.insightsSingleAppTab}
7979
title={<TabTitleText>Single application</TabTitleText>}
8080
/>
8181
</Tabs>
8282
</PageSection>
8383
<PageSection>
84-
{activeTabPath === Paths.issuesAllTab ? (
84+
{activeTabPath === Paths.insightsAllTab ? (
8585
<InsightsTable mode="allInsights" />
86-
) : activeTabPath === Paths.issuesSingleAppTab ? (
86+
) : activeTabPath === Paths.insightsSingleAppTab ? (
8787
<InsightsTable mode="singleApp" />
8888
) : null}
8989
</PageSection>
9090
<ConfirmDialog
9191
isOpen={!!navConfirmPath}
9292
title={`Navigating to ${
93-
navConfirmPath === Paths.issuesSingleAppTab
93+
navConfirmPath === Paths.insightsSingleAppTab
9494
? "single application"
9595
: "all insights"
9696
}`}
9797
titleIconVariant="info"
9898
message={`When navigating to the ${
99-
navConfirmPath === Paths.issuesSingleAppTab
99+
navConfirmPath === Paths.insightsSingleAppTab
100100
? "single application"
101101
: "all insights"
102102
} tab, all filtering settings will be reset.`}

client/src/app/pages/insights/insights-table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const InsightsTable: React.FC<IInsightsTableProps> = ({ mode }) => {
8686

8787
const singleAppSelectedMatch = useRouteMatch<{
8888
applicationId: string;
89-
}>(Paths.issuesSingleAppSelected);
89+
}>(Paths.insightsSingleAppSelected);
9090
const selectedAppId = singleAppSelectedMatch
9191
? Number(singleAppSelectedMatch.params.applicationId)
9292
: null;
@@ -102,7 +102,7 @@ export const InsightsTable: React.FC<IInsightsTableProps> = ({ mode }) => {
102102
const tableControlState = useTableControlState({
103103
tableName: "insights-table",
104104
persistTo: "urlParams",
105-
persistenceKeyPrefix: TablePersistenceKeyPrefix.issues,
105+
persistenceKeyPrefix: TablePersistenceKeyPrefix.insights,
106106
columnNames: {
107107
description: "Insight",
108108
category: "Category",

0 commit comments

Comments
 (0)