dce-reactkit 3.2.2-beta.15 → 3.2.2-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +62 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +62 -14
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/LogReviewer.tsx +77 -12
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
// Import shared helpers
|
|
22
22
|
import visitServerEndpoint from '../helpers/visitServerEndpoint';
|
|
23
23
|
import getTimeInfoInET from '../helpers/getTimeInfoInET';
|
|
24
|
-
import { showFatalError } from './AppWrapper';
|
|
24
|
+
import { alert, showFatalError } from './AppWrapper';
|
|
25
25
|
|
|
26
26
|
// Import shared constants
|
|
27
27
|
import LOG_REVIEW_ROUTE_PATH_PREFIX from '../constants/LOG_REVIEW_ROUTE_PATH_PREFIX';
|
|
@@ -34,6 +34,7 @@ import LogType from '../types/LogType';
|
|
|
34
34
|
import LogAction from '../types/LogAction';
|
|
35
35
|
import ParamType from '../types/ParamType';
|
|
36
36
|
import IntelliTableColumn from '../types/IntelliTableColumn';
|
|
37
|
+
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
37
38
|
|
|
38
39
|
// Import shared components
|
|
39
40
|
import SimpleDateChooser from './SimpleDateChooser';
|
|
@@ -459,9 +460,25 @@ const reducer = (state: State, action: Action): State => {
|
|
|
459
460
|
};
|
|
460
461
|
}
|
|
461
462
|
case ActionType.UpdateTagFilterState: {
|
|
463
|
+
const { tagFilterState } = action;
|
|
464
|
+
|
|
465
|
+
// Select all if every tag is deselected
|
|
466
|
+
const numTagsSelected = (
|
|
467
|
+
Object.values(tagFilterState)
|
|
468
|
+
.filter((isSelected) => {
|
|
469
|
+
return isSelected;
|
|
470
|
+
})
|
|
471
|
+
.length
|
|
472
|
+
);
|
|
473
|
+
if (numTagsSelected === 0) {
|
|
474
|
+
Object.keys(tagFilterState).forEach((tag) => {
|
|
475
|
+
tagFilterState[tag] = true;
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
|
|
462
479
|
return {
|
|
463
480
|
...state,
|
|
464
|
-
tagFilterState
|
|
481
|
+
tagFilterState,
|
|
465
482
|
};
|
|
466
483
|
}
|
|
467
484
|
case ActionType.UpdateActionErrorFilterState: {
|
|
@@ -532,8 +549,12 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
532
549
|
const subcontextValue = contextValue[subcontext];
|
|
533
550
|
(initContextFilterState[contextValue._] as { [k: string]: boolean })[subcontextValue] = true;
|
|
534
551
|
});
|
|
552
|
+
// Add uncategorized subcontext
|
|
553
|
+
(initContextFilterState[contextValue._] as { [k: string]: boolean })[LogBuiltInMetadata.Context.Uncategorized] = true;
|
|
535
554
|
}
|
|
536
555
|
});
|
|
556
|
+
// Add uncategorized context
|
|
557
|
+
initContextFilterState[LogBuiltInMetadata.Context.Uncategorized] = true;
|
|
537
558
|
|
|
538
559
|
// Create initial tag filter state
|
|
539
560
|
const initTagFilterState: TagFilterState = {};
|
|
@@ -875,6 +896,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
875
896
|
month={dateFilterState.startDate.month}
|
|
876
897
|
day={dateFilterState.startDate.day}
|
|
877
898
|
chooseFromPast
|
|
899
|
+
numMonthsToShow={12}
|
|
878
900
|
onChange={(month, day, year) => {
|
|
879
901
|
dateFilterState.startDate = { month, day, year };
|
|
880
902
|
handleDateRangeUpdated(dateFilterState);
|
|
@@ -890,7 +912,25 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
890
912
|
month={dateFilterState.endDate.month}
|
|
891
913
|
day={dateFilterState.endDate.day}
|
|
892
914
|
chooseFromPast
|
|
915
|
+
numMonthsToShow={12}
|
|
893
916
|
onChange={(month, day, year) => {
|
|
917
|
+
if (
|
|
918
|
+
year < dateFilterState.startDate.year
|
|
919
|
+
|| (
|
|
920
|
+
year === dateFilterState.startDate.year
|
|
921
|
+
&& month < dateFilterState.startDate.month
|
|
922
|
+
)
|
|
923
|
+
|| (
|
|
924
|
+
year === dateFilterState.startDate.year
|
|
925
|
+
&& month === dateFilterState.startDate.month
|
|
926
|
+
&& day < dateFilterState.startDate.day
|
|
927
|
+
)
|
|
928
|
+
) {
|
|
929
|
+
return alert(
|
|
930
|
+
'Invalid Start Date',
|
|
931
|
+
'The start date cannot be before the end date.',
|
|
932
|
+
);
|
|
933
|
+
}
|
|
894
934
|
dateFilterState.endDate = { month, day, year };
|
|
895
935
|
handleDateRangeUpdated(dateFilterState);
|
|
896
936
|
}}
|
|
@@ -931,7 +971,11 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
931
971
|
);
|
|
932
972
|
const item: PickableItem = {
|
|
933
973
|
id: context,
|
|
934
|
-
name:
|
|
974
|
+
name: (
|
|
975
|
+
(context === LogBuiltInMetadata.Context.Uncategorized)
|
|
976
|
+
? 'Uncategorized'
|
|
977
|
+
: context
|
|
978
|
+
),
|
|
935
979
|
isGroup: true,
|
|
936
980
|
children,
|
|
937
981
|
};
|
|
@@ -1504,6 +1548,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1504
1548
|
Object.keys(logMap[year]).forEach((month) => {
|
|
1505
1549
|
logMap[year][month].forEach((log) => {
|
|
1506
1550
|
/* ----------- Date Filter ---------- */
|
|
1551
|
+
console.log('Log:', log);
|
|
1507
1552
|
|
|
1508
1553
|
// Before start date
|
|
1509
1554
|
if (
|
|
@@ -1521,6 +1566,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1521
1566
|
&& (log.day < dateFilterState.startDate.day)
|
|
1522
1567
|
)
|
|
1523
1568
|
) {
|
|
1569
|
+
console.log('RULED OUT: START');
|
|
1524
1570
|
return;
|
|
1525
1571
|
}
|
|
1526
1572
|
|
|
@@ -1540,6 +1586,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1540
1586
|
&& (log.day > dateFilterState.endDate.day)
|
|
1541
1587
|
)
|
|
1542
1588
|
) {
|
|
1589
|
+
console.log('RULED OUT: END');
|
|
1543
1590
|
return;
|
|
1544
1591
|
}
|
|
1545
1592
|
|
|
@@ -1557,13 +1604,16 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1557
1604
|
})
|
|
1558
1605
|
)
|
|
1559
1606
|
) {
|
|
1607
|
+
console.log('RULED OUT: CONTEXT');
|
|
1560
1608
|
return;
|
|
1561
1609
|
}
|
|
1562
1610
|
|
|
1563
1611
|
// Subcontext doesn't match
|
|
1564
1612
|
if (
|
|
1613
|
+
// Log context is not "uncategorized" (no point in further filters)
|
|
1614
|
+
log.context !== LogBuiltInMetadata.Context.Uncategorized
|
|
1565
1615
|
// Log has a subcontext
|
|
1566
|
-
log.subcontext
|
|
1616
|
+
&& log.subcontext
|
|
1567
1617
|
// Context has subcontexts
|
|
1568
1618
|
&& (
|
|
1569
1619
|
contextFilterState[log.context]
|
|
@@ -1573,6 +1623,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1573
1623
|
// Subcontext is not selected
|
|
1574
1624
|
&& !(contextFilterState as any)[log.context][log.subcontext]
|
|
1575
1625
|
) {
|
|
1626
|
+
console.log('RULED OUT: SUBCONTEXT');
|
|
1576
1627
|
return;
|
|
1577
1628
|
}
|
|
1578
1629
|
|
|
@@ -1580,15 +1631,11 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1580
1631
|
|
|
1581
1632
|
// No tags match
|
|
1582
1633
|
if (
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
&& (
|
|
1587
|
-
log.tags.every((tag) => {
|
|
1588
|
-
return !tagFilterState[tag];
|
|
1589
|
-
})
|
|
1590
|
-
)
|
|
1634
|
+
log.tags.every((tag) => {
|
|
1635
|
+
return !tagFilterState[tag];
|
|
1636
|
+
})
|
|
1591
1637
|
) {
|
|
1638
|
+
console.log('RULED OUT: TAGS');
|
|
1592
1639
|
return;
|
|
1593
1640
|
}
|
|
1594
1641
|
|
|
@@ -1601,6 +1648,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1601
1648
|
// Log type doesn't match
|
|
1602
1649
|
&& actionErrorFilterState.type !== log.type
|
|
1603
1650
|
) {
|
|
1651
|
+
console.log('RULED OUT: TYPE');
|
|
1604
1652
|
return;
|
|
1605
1653
|
}
|
|
1606
1654
|
|
|
@@ -1617,6 +1665,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1617
1665
|
actionErrorFilterState.errorMessage.trim().toLowerCase(),
|
|
1618
1666
|
)
|
|
1619
1667
|
) {
|
|
1668
|
+
console.log('RULED OUT: ERROR MESSAGE');
|
|
1620
1669
|
return;
|
|
1621
1670
|
}
|
|
1622
1671
|
|
|
@@ -1631,6 +1680,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1631
1680
|
actionErrorFilterState.errorCode.trim().toUpperCase(),
|
|
1632
1681
|
)
|
|
1633
1682
|
) {
|
|
1683
|
+
console.log('RULED OUT: ERROR CODE');
|
|
1634
1684
|
return;
|
|
1635
1685
|
}
|
|
1636
1686
|
}
|
|
@@ -1644,6 +1694,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1644
1694
|
// Target isn't selected
|
|
1645
1695
|
&& !actionErrorFilterState.target[log.target]
|
|
1646
1696
|
) {
|
|
1697
|
+
console.log('RULED OUT: TARGET');
|
|
1647
1698
|
return;
|
|
1648
1699
|
}
|
|
1649
1700
|
|
|
@@ -1654,6 +1705,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1654
1705
|
// Action isn't selected
|
|
1655
1706
|
&& !actionErrorFilterState.action[log.action]
|
|
1656
1707
|
) {
|
|
1708
|
+
console.log('RULED OUT: ACTION');
|
|
1657
1709
|
return;
|
|
1658
1710
|
}
|
|
1659
1711
|
}
|
|
@@ -1669,6 +1721,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1669
1721
|
advancedFilterState.userFirstName.toLowerCase().trim(),
|
|
1670
1722
|
)
|
|
1671
1723
|
) {
|
|
1724
|
+
console.log('RULED OUT: FIRST');
|
|
1672
1725
|
return;
|
|
1673
1726
|
}
|
|
1674
1727
|
|
|
@@ -1681,6 +1734,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1681
1734
|
advancedFilterState.userLastName.toLowerCase().trim(),
|
|
1682
1735
|
)
|
|
1683
1736
|
) {
|
|
1737
|
+
console.log('RULED OUT: LAST');
|
|
1684
1738
|
return;
|
|
1685
1739
|
}
|
|
1686
1740
|
|
|
@@ -1693,6 +1747,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1693
1747
|
advancedFilterState.userEmail.toLowerCase().trim(),
|
|
1694
1748
|
)
|
|
1695
1749
|
) {
|
|
1750
|
+
console.log('RULED OUT: EMAIL');
|
|
1696
1751
|
return;
|
|
1697
1752
|
}
|
|
1698
1753
|
|
|
@@ -1705,6 +1760,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1705
1760
|
advancedFilterState.userId.trim(),
|
|
1706
1761
|
)
|
|
1707
1762
|
) {
|
|
1763
|
+
console.log('RULED OUT: USER ID');
|
|
1708
1764
|
return;
|
|
1709
1765
|
}
|
|
1710
1766
|
|
|
@@ -1715,6 +1771,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1715
1771
|
// Learners aren't included
|
|
1716
1772
|
&& !advancedFilterState.includeLearners
|
|
1717
1773
|
) {
|
|
1774
|
+
console.log('RULED OUT: LEARNER');
|
|
1718
1775
|
return;
|
|
1719
1776
|
}
|
|
1720
1777
|
|
|
@@ -1725,6 +1782,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1725
1782
|
// TTMs aren't included
|
|
1726
1783
|
&& !advancedFilterState.includeTTMs
|
|
1727
1784
|
) {
|
|
1785
|
+
console.log('RULED OUT: TTM');
|
|
1728
1786
|
return;
|
|
1729
1787
|
}
|
|
1730
1788
|
|
|
@@ -1735,6 +1793,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1735
1793
|
// Admins aren't included
|
|
1736
1794
|
&& !advancedFilterState.includeAdmins
|
|
1737
1795
|
) {
|
|
1796
|
+
console.log('RULED OUT: ADMIN');
|
|
1738
1797
|
return;
|
|
1739
1798
|
}
|
|
1740
1799
|
|
|
@@ -1747,6 +1806,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1747
1806
|
advancedFilterState.courseId.trim(),
|
|
1748
1807
|
)
|
|
1749
1808
|
) {
|
|
1809
|
+
console.log('RULED OUT: COURSE ID');
|
|
1750
1810
|
return;
|
|
1751
1811
|
}
|
|
1752
1812
|
|
|
@@ -1759,6 +1819,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1759
1819
|
advancedFilterState.courseName.trim(),
|
|
1760
1820
|
)
|
|
1761
1821
|
) {
|
|
1822
|
+
console.log('RULED OUT: COURSE NAME');
|
|
1762
1823
|
return;
|
|
1763
1824
|
}
|
|
1764
1825
|
|
|
@@ -1771,6 +1832,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1771
1832
|
// Mobile filter doesn't match
|
|
1772
1833
|
&& (advancedFilterState.isMobile === log.device.isMobile)
|
|
1773
1834
|
) {
|
|
1835
|
+
console.log('RULED OUT: MOBILE');
|
|
1774
1836
|
return;
|
|
1775
1837
|
}
|
|
1776
1838
|
|
|
@@ -1783,6 +1845,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1783
1845
|
// Source filter doesn't match
|
|
1784
1846
|
&& (advancedFilterState.source !== log.source)
|
|
1785
1847
|
) {
|
|
1848
|
+
console.log('RULED OUT: SOURCE');
|
|
1786
1849
|
return;
|
|
1787
1850
|
}
|
|
1788
1851
|
|
|
@@ -1795,6 +1858,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1795
1858
|
// Route path doesn't match
|
|
1796
1859
|
&& !(log.routePath.includes(advancedFilterState.routePath.trim()))
|
|
1797
1860
|
) {
|
|
1861
|
+
console.log('RULED OUT: PATH');
|
|
1798
1862
|
return;
|
|
1799
1863
|
}
|
|
1800
1864
|
|
|
@@ -1807,6 +1871,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1807
1871
|
// Route template doesn't match
|
|
1808
1872
|
&& !(log.routeTemplate.includes(advancedFilterState.routeTemplate.trim()))
|
|
1809
1873
|
) {
|
|
1874
|
+
console.log('RULED OUT: TEMPLATE');
|
|
1810
1875
|
return;
|
|
1811
1876
|
}
|
|
1812
1877
|
|