Skip to content

Commit fbe83e8

Browse files
szabozoltan69frozenhelium
authored andcommitted
hotfix(cos, spark): merge commits for temporary hotfix
- feat(all-surge-alerts): add position, keyword filtering - feat(cos): add risk management page - Reword unavailability test in the spark dashboard - Prepare / Supply Chain / SPARK menu item in navigation - Remove Programmatic Partnerships menu from navigation
1 parent 7607352 commit fbe83e8

File tree

19 files changed

+303
-90
lines changed

19 files changed

+303
-90
lines changed

.changeset/four-facts-glow.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"go-web-app": patch
3+
---
4+
5+
Add Risk Management section in Catalogue of Surge services
6+
Reword unavailablity message in spark dashboard

.changeset/late-hornets-strive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"go-web-app": patch
3+
---
4+
5+
Position and Keywords filter for all Surge Alerts (/alerts/all)

.changeset/twelve-ducks-glow.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"go-web-app": patch
3+
---
4+
5+
Add Prepare / Supply Chain / SPARK menu item to navigation
6+
Remove Programmatic Partnerships menu from navigation
7+
Change aboutHealthMapping PDF URL in /resources

app/src/App/routes/SurgeRoutes.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,20 @@ const surgeCatalogueOtherPreparednessEffectiveResponse = customWrapRoute({
12661266
},
12671267
});
12681268

1269+
const surgeCatalogueRiskManagement = customWrapRoute({
1270+
parent: surgeCatalogueLayout,
1271+
path: 'risk-management',
1272+
component: {
1273+
render: () => import('#views/SurgeCatalogueRiskManagement'),
1274+
props: {},
1275+
},
1276+
wrapperComponent: Auth,
1277+
context: {
1278+
title: 'Risk Management',
1279+
visibility: 'anything',
1280+
},
1281+
});
1282+
12691283
const surgeCatalogueOtherRecovery = customWrapRoute({
12701284
parent: surgeCatalogueLayout,
12711285
path: 'other/recovery',
@@ -1684,6 +1698,7 @@ export default {
16841698
surgeCatalogueOtherPreparednessEffectiveResponse,
16851699
surgeCatalogueOtherRecovery,
16861700
surgeCatalogueOtherGreenResponse,
1701+
surgeCatalogueRiskManagement,
16871702
surgeCatalogueOtherUAV,
16881703

16891704
allDeployedPersonnel,

app/src/App/routes/index.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -400,17 +400,17 @@ const preparednessGlobalCatalogue = customWrapRoute({
400400
},
401401
});
402402

403-
const globalThreeW = customWrapRoute({
403+
const globalLogistics = customWrapRoute({
404404
parent: rootLayout,
405-
path: 'three-w/projects',
405+
path: 'spark',
406406
component: {
407-
render: () => import('#views/GlobalThreeW'),
407+
render: () => import('#views/Spark'),
408408
props: {},
409409
},
410410
wrapperComponent: Auth,
411411
context: {
412-
title: 'Global 3W',
413-
visibility: 'anything',
412+
title: 'SPARK',
413+
visibility: 'is-authenticated',
414414
},
415415
});
416416

@@ -742,19 +742,6 @@ const resources = customWrapRoute({
742742
},
743743
});
744744

745-
const spark = customWrapRoute({
746-
parent: rootLayout,
747-
path: 'spark',
748-
component: {
749-
render: () => import('#views/Spark'),
750-
props: {},
751-
},
752-
wrapperComponent: Auth,
753-
context: {
754-
title: 'SPARK',
755-
visibility: 'is-authenticated',
756-
},
757-
});
758745
const operationalLearning = customWrapRoute({
759746
parent: rootLayout,
760747
path: 'operational-learning',
@@ -1314,7 +1301,7 @@ const wrappedRoutes = {
13141301
preparednessGlobalCatalogue,
13151302
preparednessIndex,
13161303
perProcessFormIndex,
1317-
globalThreeW,
1304+
globalLogistics,
13181305
newThreeWProject,
13191306
threeWProjectEdit,
13201307
threeWActivityEdit,
@@ -1331,7 +1318,6 @@ const wrappedRoutes = {
13311318
accountMyFormsDref,
13321319
accountMyFormsThreeW,
13331320
resources,
1334-
spark,
13351321
search,
13361322
allThreeWProject,
13371323
allThreeWActivity,

app/src/components/Navbar/i18n.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
"headerDropdownNew3WActivity":"New 3W Activity",
88
"headerDropdownNewFlashUpdate":"New Flash Update",
99
"headerMenuHome":"Home",
10-
"headerMenuThreeW":"Programmatic Partnerships",
1110
"headerMenuRiskWatch":"Risk Watch",
1211
"headerLogoAltText":"IFRC GO logo",
1312
"userMenuLogin":"Login",
1413
"userMenuRegister":"Register",
1514
"userMenuPrepare":"Prepare",
1615
"userMenuRiskAnalysisLabel":"Risk Analysis",
1716
"userMenuPERLabel":"Preparedness for Effective Response (PER)",
18-
"userMenuGlobal3WProjects": "Programmatic Partnerships",
17+
"userMenuGlobalLogistics": "Supply Chain",
1918
"userMenuGlobalRiskDescription":"The global risk overview presents information about the magnitude of risks per country, per month based on historical events and risk analysis.",
2019
"userMenuPERDescription":"The PER Approach is a continuous and flexible process that enables National Societies to assess, measure and analyse the strengths and gaps of its preparedness and response mechanism.",
2120
"userMenuGlobalSummary":"Global Summary",
@@ -24,7 +23,8 @@
2423
"userMenuMontandonItemDescription":"Montandon - the world's largest disaster database, containing data on hazards, impacts, and what actions were taken to address them.",
2524
"userMenuCatalogueResources":"Catalogue of Resources",
2625
"userMenuStartPER":"Start PER Process",
27-
"userMenuGlobal3WProjectDescription":"The Programmatic Partnership is an innovative and ambitious three-year partnership between the IFRC, many of our member National Societies, and the European Union.",
26+
"userMenuGlobalLogisticsDescription":"Supply chain Preparedness Analysis and Response Knowledge – dashboard",
27+
"userMenuSpark": "SPARK",
2828
"userMenuRespondLabel":"Respond",
2929
"userMenuEmergencies":"Emergencies",
3030
"userMenuEmergenciesDescription": "Follow currently ongoing emergencies, as well as access the list of previous emergencies or IFRC-led operations.",

app/src/components/Navbar/index.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Navbar(props: Props) {
4444
const { isAuthenticated } = useAuth();
4545
const strings = useTranslation(i18n);
4646

47-
type PrepareOptionKey = 'risk-analysis' | 'per' | 'global-3w-projects';
47+
type PrepareOptionKey = 'risk-analysis' | 'per' | 'global-logistics';
4848
const [activePrepareOption, setActivePrepareOption] = useState<PrepareOptionKey>('risk-analysis');
4949

5050
type RespondOptionKey = 'emergencies' | 'early-warning' | 'dref-process' | 'surge';
@@ -168,10 +168,10 @@ function Navbar(props: Props) {
168168
{strings.userMenuPERLabel}
169169
</Tab>
170170
<Tab
171-
name="global-3w-projects"
171+
name="global-logistics"
172172
className={styles.option}
173173
>
174-
{strings.userMenuGlobal3WProjects}
174+
{strings.userMenuGlobalLogistics}
175175
</Tab>
176176
</TabList>
177177
<div className={styles.optionBorder} />
@@ -227,18 +227,18 @@ function Navbar(props: Props) {
227227
</DropdownMenuItem>
228228
</TabPanel>
229229
<TabPanel
230-
name="global-3w-projects"
230+
name="global-logistics"
231231
className={styles.optionDetail}
232232
>
233233
<div className={styles.description}>
234-
{strings.userMenuGlobal3WProjectDescription}
234+
{strings.userMenuGlobalLogisticsDescription}
235235
</div>
236236
<DropdownMenuItem
237237
type="link"
238-
to="globalThreeW"
238+
to="globalLogistics"
239239
variant="tertiary"
240240
>
241-
{strings.headerMenuThreeW}
241+
{strings.userMenuSpark}
242242
</DropdownMenuItem>
243243
</TabPanel>
244244
</Tabs>

app/src/views/AllSurgeAlerts/i18n.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"allSurgeAlertsHeading": "All Surge Alerts ({numSurgeAlerts})",
66
"eventFilterLabel": "Emergency",
77
"countryFilterLabel": "Country",
8+
"positionFilterLabel": "Position",
9+
"keywordsFilterLabel": "Keywords",
810
"defaultPlaceholder": "All",
911
"failedToCreateExport": "Failed to generate export.",
1012
"surgeAlertDate": "Alert Date",

app/src/views/AllSurgeAlerts/index.tsx

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
NumberOutput,
99
Pager,
1010
Table,
11+
TextInput,
1112
} from '@ifrc-go/ui';
1213
import { useTranslation } from '@ifrc-go/ui/hooks';
1314
import {
@@ -20,7 +21,9 @@ import {
2021
} from '@ifrc-go/ui/utils';
2122
import {
2223
isDefined,
24+
isFalsyString,
2325
isNotDefined,
26+
isTruthyString,
2427
} from '@togglecorp/fujs';
2528
import { saveAs } from 'file-saver';
2629
import Papa from 'papaparse';
@@ -111,6 +114,36 @@ export function Component() {
111114
EventItem[] | undefined | null
112115
>([]);
113116

117+
const [positionFilter, setPositionFilter] = useUrlSearchState<string | undefined>(
118+
'position',
119+
(value) => {
120+
const trimmedValue = isTruthyString(value) ? value.trim() : undefined;
121+
122+
if (isFalsyString(trimmedValue)) {
123+
return undefined;
124+
}
125+
126+
setPage(0);
127+
return trimmedValue;
128+
},
129+
(position) => position ?? undefined,
130+
);
131+
132+
const [keywordsFilter, setKeywordsFilter] = useUrlSearchState<string | undefined>(
133+
'keywords',
134+
(value) => {
135+
const trimmedValue = isTruthyString(value) ? value.trim() : undefined;
136+
137+
if (isFalsyString(trimmedValue)) {
138+
return undefined;
139+
}
140+
141+
setPage(0);
142+
return trimmedValue;
143+
},
144+
(keywords) => keywords ?? undefined,
145+
);
146+
114147
useRequest({
115148
skip: isNotDefined(eventFilter)
116149
|| (!!eventOptions?.find((event) => event.id === eventFilter)),
@@ -162,8 +195,9 @@ export function Component() {
162195
offset,
163196
event: eventFilter,
164197
country: countryFilter,
165-
166-
// FIXME: this should come from the useFilterState
198+
message__icontains: positionFilter,
199+
molnix_tag_name: keywordsFilter,
200+
// FIXME: this should come from useFilterState
167201
ordering: 'molnix_status,-opens',
168202
},
169203
});
@@ -290,11 +324,21 @@ export function Component() {
290324
triggerExportStart(
291325
'/api/v2/surge_alert/',
292326
surgeResponse?.count,
293-
{},
327+
{
328+
event: eventFilter,
329+
country: countryFilter,
330+
message__icontains: positionFilter,
331+
molnix_tag_name: keywordsFilter,
332+
ordering: 'molnix_status,-opens',
333+
},
294334
);
295335
}, [
296336
triggerExportStart,
297337
surgeResponse?.count,
338+
eventFilter,
339+
countryFilter,
340+
positionFilter,
341+
keywordsFilter,
298342
]);
299343

300344
const heading = resolveToComponent(
@@ -328,6 +372,20 @@ export function Component() {
328372
onOptionsChange={setEventOptions}
329373
countryId={countryFilter}
330374
/>
375+
<TextInput
376+
name="position"
377+
label={strings.positionFilterLabel}
378+
placeholder={strings.defaultPlaceholder}
379+
value={positionFilter}
380+
onChange={setPositionFilter}
381+
/>
382+
<TextInput
383+
name="keywords"
384+
label={strings.keywordsFilterLabel}
385+
placeholder={strings.defaultPlaceholder}
386+
value={keywordsFilter}
387+
onChange={setKeywordsFilter}
388+
/>
331389
</>
332390
)}
333391
footerActions={(

app/src/views/GlobalThreeW/i18n.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)