@plusscommunities/pluss-maintenance-web-a 1.1.37-beta.6 → 1.1.37
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/index.cjs.js +91 -23
- package/dist/index.esm.js +91 -23
- package/dist/index.umd.js +91 -23
- package/package.json +2 -2
- package/dist/index.js +0 -6724
- package/dist/index.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -811,11 +811,25 @@ class JobList extends React.Component {
|
|
|
811
811
|
}
|
|
812
812
|
return params;
|
|
813
813
|
});
|
|
814
|
+
/**
|
|
815
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
816
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
817
|
+
* query, a single page may yield very few matching results. We keep
|
|
818
|
+
* fetching in the background until we have this many items to display.
|
|
819
|
+
*/
|
|
820
|
+
_defineProperty__default["default"](this, "MIN_PAGE_SIZE", 20);
|
|
814
821
|
/**
|
|
815
822
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
816
823
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
817
|
-
* in-flight fetch checks the counter before
|
|
818
|
-
* if it doesn't match, the results are discarded.
|
|
824
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
825
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
826
|
+
*
|
|
827
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
828
|
+
* (axios supports it via the `signal` config option). That would save
|
|
829
|
+
* bandwidth and server load but requires threading `signal` through
|
|
830
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
831
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
832
|
+
* in the background but their results are ignored.
|
|
819
833
|
*/
|
|
820
834
|
_defineProperty__default["default"](this, "_fetchId", 0);
|
|
821
835
|
/**
|
|
@@ -831,6 +845,9 @@ class JobList extends React.Component {
|
|
|
831
845
|
});
|
|
832
846
|
/**
|
|
833
847
|
* Fetch the first page and render immediately.
|
|
848
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
849
|
+
* kicks off a background loop that keeps fetching and appending
|
|
850
|
+
* so results appear progressively.
|
|
834
851
|
*/
|
|
835
852
|
_defineProperty__default["default"](this, "fetchJobs", async () => {
|
|
836
853
|
const fetchId = ++this._fetchId;
|
|
@@ -840,7 +857,8 @@ class JobList extends React.Component {
|
|
|
840
857
|
}, async () => {
|
|
841
858
|
try {
|
|
842
859
|
const res = await this.fetchPage(null);
|
|
843
|
-
if (this._fetchId !== fetchId) return;
|
|
860
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
861
|
+
|
|
844
862
|
const items = res.data.Items || [];
|
|
845
863
|
const lastKey = res.data.LastKey || null;
|
|
846
864
|
this.setState({
|
|
@@ -851,8 +869,13 @@ class JobList extends React.Component {
|
|
|
851
869
|
});
|
|
852
870
|
this.props.jobsLoaded(items);
|
|
853
871
|
this.setRequesters(items);
|
|
872
|
+
|
|
873
|
+
// Auto-fill in background if first page was sparse
|
|
874
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
875
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
876
|
+
}
|
|
854
877
|
} catch (error) {
|
|
855
|
-
if (this._fetchId !== fetchId) return;
|
|
878
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
856
879
|
console.error('fetchJobs', error);
|
|
857
880
|
this.setState({
|
|
858
881
|
loading: false
|
|
@@ -860,8 +883,52 @@ class JobList extends React.Component {
|
|
|
860
883
|
}
|
|
861
884
|
});
|
|
862
885
|
});
|
|
886
|
+
/**
|
|
887
|
+
* Background loop: keep fetching pages and appending results
|
|
888
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
889
|
+
* Each page is rendered as it arrives so the user sees
|
|
890
|
+
* results appearing progressively.
|
|
891
|
+
*/
|
|
892
|
+
_defineProperty__default["default"](this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
893
|
+
this.setState({
|
|
894
|
+
loadingMore: true
|
|
895
|
+
});
|
|
896
|
+
let currentJobs = existingJobs;
|
|
897
|
+
let currentLastKey = startKey;
|
|
898
|
+
try {
|
|
899
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
900
|
+
const res = await this.fetchPage(currentLastKey);
|
|
901
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
902
|
+
|
|
903
|
+
const items = res.data.Items || [];
|
|
904
|
+
currentLastKey = res.data.LastKey || null;
|
|
905
|
+
currentJobs = [...currentJobs, ...items];
|
|
906
|
+
|
|
907
|
+
// Append to UI immediately after each page arrives
|
|
908
|
+
this.setState({
|
|
909
|
+
jobs: currentJobs,
|
|
910
|
+
lastKey: currentLastKey,
|
|
911
|
+
hasMore: !!currentLastKey
|
|
912
|
+
});
|
|
913
|
+
if (items.length > 0) {
|
|
914
|
+
this.props.jobsLoaded(items);
|
|
915
|
+
this.setRequesters(currentJobs);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
} catch (error) {
|
|
919
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
920
|
+
console.error('autoFillPages', error);
|
|
921
|
+
} finally {
|
|
922
|
+
if (this._fetchId === fetchId) {
|
|
923
|
+
this.setState({
|
|
924
|
+
loadingMore: false
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
});
|
|
863
929
|
/**
|
|
864
930
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
931
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
865
932
|
*/
|
|
866
933
|
_defineProperty__default["default"](this, "loadMore", async () => {
|
|
867
934
|
const fetchId = ++this._fetchId;
|
|
@@ -874,21 +941,30 @@ class JobList extends React.Component {
|
|
|
874
941
|
}, async () => {
|
|
875
942
|
try {
|
|
876
943
|
const res = await this.fetchPage(lastKey);
|
|
877
|
-
if (this._fetchId !== fetchId) return;
|
|
944
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
945
|
+
|
|
878
946
|
const items = res.data.Items || [];
|
|
879
947
|
const newLastKey = res.data.LastKey || null;
|
|
880
948
|
const updatedJobs = [...jobs, ...items];
|
|
881
949
|
this.setState({
|
|
882
950
|
jobs: updatedJobs,
|
|
883
951
|
lastKey: newLastKey,
|
|
884
|
-
hasMore: !!newLastKey
|
|
885
|
-
loadingMore: false
|
|
952
|
+
hasMore: !!newLastKey
|
|
886
953
|
});
|
|
887
954
|
if (items.length > 0) {
|
|
888
955
|
this.props.jobsLoaded(items);
|
|
889
956
|
}
|
|
957
|
+
|
|
958
|
+
// Auto-fill in background if this page was sparse
|
|
959
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
960
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
961
|
+
} else {
|
|
962
|
+
this.setState({
|
|
963
|
+
loadingMore: false
|
|
964
|
+
});
|
|
965
|
+
}
|
|
890
966
|
} catch (error) {
|
|
891
|
-
if (this._fetchId !== fetchId) return;
|
|
967
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
892
968
|
console.error('loadMore', error);
|
|
893
969
|
this.setState({
|
|
894
970
|
loadingMore: false
|
|
@@ -1269,7 +1345,7 @@ class JobList extends React.Component {
|
|
|
1269
1345
|
// Filters (applied to server-side queries)
|
|
1270
1346
|
selectedTypeFilter: null,
|
|
1271
1347
|
selectedPriorityFilter: null,
|
|
1272
|
-
selectedStatusFilter:
|
|
1348
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1273
1349
|
selectedTimeFilterStart: null,
|
|
1274
1350
|
selectedTimeFilterEnd: null,
|
|
1275
1351
|
selectedTimeFilterText: null,
|
|
@@ -1720,24 +1796,16 @@ class JobList extends React.Component {
|
|
|
1720
1796
|
}, "Loading more results\u2026"));
|
|
1721
1797
|
}
|
|
1722
1798
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1799
|
+
className: "flex flex-center-row",
|
|
1723
1800
|
style: {
|
|
1724
|
-
|
|
1725
|
-
position: 'relative',
|
|
1726
|
-
top: -16
|
|
1801
|
+
padding: '16px 0'
|
|
1727
1802
|
}
|
|
1728
1803
|
}, /*#__PURE__*/React__default["default"].createElement(Components$7.Button, {
|
|
1729
|
-
|
|
1804
|
+
inline: true,
|
|
1805
|
+
buttonType: "tertiary",
|
|
1730
1806
|
onClick: this.loadMore,
|
|
1731
|
-
isActive: true
|
|
1732
|
-
|
|
1733
|
-
width: '100%'
|
|
1734
|
-
}
|
|
1735
|
-
}, "Load More Results", /*#__PURE__*/React__default["default"].createElement(FontAwesome__default["default"], {
|
|
1736
|
-
name: "plus",
|
|
1737
|
-
style: {
|
|
1738
|
-
marginLeft: 8
|
|
1739
|
-
}
|
|
1740
|
-
})));
|
|
1807
|
+
isActive: true
|
|
1808
|
+
}, "Load More"));
|
|
1741
1809
|
}
|
|
1742
1810
|
renderContent() {
|
|
1743
1811
|
const {
|
package/dist/index.esm.js
CHANGED
|
@@ -780,11 +780,25 @@ class JobList extends Component {
|
|
|
780
780
|
}
|
|
781
781
|
return params;
|
|
782
782
|
});
|
|
783
|
+
/**
|
|
784
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
785
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
786
|
+
* query, a single page may yield very few matching results. We keep
|
|
787
|
+
* fetching in the background until we have this many items to display.
|
|
788
|
+
*/
|
|
789
|
+
_defineProperty(this, "MIN_PAGE_SIZE", 20);
|
|
783
790
|
/**
|
|
784
791
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
785
792
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
786
|
-
* in-flight fetch checks the counter before
|
|
787
|
-
* if it doesn't match, the results are discarded.
|
|
793
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
794
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
795
|
+
*
|
|
796
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
797
|
+
* (axios supports it via the `signal` config option). That would save
|
|
798
|
+
* bandwidth and server load but requires threading `signal` through
|
|
799
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
800
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
801
|
+
* in the background but their results are ignored.
|
|
788
802
|
*/
|
|
789
803
|
_defineProperty(this, "_fetchId", 0);
|
|
790
804
|
/**
|
|
@@ -800,6 +814,9 @@ class JobList extends Component {
|
|
|
800
814
|
});
|
|
801
815
|
/**
|
|
802
816
|
* Fetch the first page and render immediately.
|
|
817
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
818
|
+
* kicks off a background loop that keeps fetching and appending
|
|
819
|
+
* so results appear progressively.
|
|
803
820
|
*/
|
|
804
821
|
_defineProperty(this, "fetchJobs", async () => {
|
|
805
822
|
const fetchId = ++this._fetchId;
|
|
@@ -809,7 +826,8 @@ class JobList extends Component {
|
|
|
809
826
|
}, async () => {
|
|
810
827
|
try {
|
|
811
828
|
const res = await this.fetchPage(null);
|
|
812
|
-
if (this._fetchId !== fetchId) return;
|
|
829
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
830
|
+
|
|
813
831
|
const items = res.data.Items || [];
|
|
814
832
|
const lastKey = res.data.LastKey || null;
|
|
815
833
|
this.setState({
|
|
@@ -820,8 +838,13 @@ class JobList extends Component {
|
|
|
820
838
|
});
|
|
821
839
|
this.props.jobsLoaded(items);
|
|
822
840
|
this.setRequesters(items);
|
|
841
|
+
|
|
842
|
+
// Auto-fill in background if first page was sparse
|
|
843
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
844
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
845
|
+
}
|
|
823
846
|
} catch (error) {
|
|
824
|
-
if (this._fetchId !== fetchId) return;
|
|
847
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
825
848
|
console.error('fetchJobs', error);
|
|
826
849
|
this.setState({
|
|
827
850
|
loading: false
|
|
@@ -829,8 +852,52 @@ class JobList extends Component {
|
|
|
829
852
|
}
|
|
830
853
|
});
|
|
831
854
|
});
|
|
855
|
+
/**
|
|
856
|
+
* Background loop: keep fetching pages and appending results
|
|
857
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
858
|
+
* Each page is rendered as it arrives so the user sees
|
|
859
|
+
* results appearing progressively.
|
|
860
|
+
*/
|
|
861
|
+
_defineProperty(this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
862
|
+
this.setState({
|
|
863
|
+
loadingMore: true
|
|
864
|
+
});
|
|
865
|
+
let currentJobs = existingJobs;
|
|
866
|
+
let currentLastKey = startKey;
|
|
867
|
+
try {
|
|
868
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
869
|
+
const res = await this.fetchPage(currentLastKey);
|
|
870
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
871
|
+
|
|
872
|
+
const items = res.data.Items || [];
|
|
873
|
+
currentLastKey = res.data.LastKey || null;
|
|
874
|
+
currentJobs = [...currentJobs, ...items];
|
|
875
|
+
|
|
876
|
+
// Append to UI immediately after each page arrives
|
|
877
|
+
this.setState({
|
|
878
|
+
jobs: currentJobs,
|
|
879
|
+
lastKey: currentLastKey,
|
|
880
|
+
hasMore: !!currentLastKey
|
|
881
|
+
});
|
|
882
|
+
if (items.length > 0) {
|
|
883
|
+
this.props.jobsLoaded(items);
|
|
884
|
+
this.setRequesters(currentJobs);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
} catch (error) {
|
|
888
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
889
|
+
console.error('autoFillPages', error);
|
|
890
|
+
} finally {
|
|
891
|
+
if (this._fetchId === fetchId) {
|
|
892
|
+
this.setState({
|
|
893
|
+
loadingMore: false
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
});
|
|
832
898
|
/**
|
|
833
899
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
900
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
834
901
|
*/
|
|
835
902
|
_defineProperty(this, "loadMore", async () => {
|
|
836
903
|
const fetchId = ++this._fetchId;
|
|
@@ -843,21 +910,30 @@ class JobList extends Component {
|
|
|
843
910
|
}, async () => {
|
|
844
911
|
try {
|
|
845
912
|
const res = await this.fetchPage(lastKey);
|
|
846
|
-
if (this._fetchId !== fetchId) return;
|
|
913
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
914
|
+
|
|
847
915
|
const items = res.data.Items || [];
|
|
848
916
|
const newLastKey = res.data.LastKey || null;
|
|
849
917
|
const updatedJobs = [...jobs, ...items];
|
|
850
918
|
this.setState({
|
|
851
919
|
jobs: updatedJobs,
|
|
852
920
|
lastKey: newLastKey,
|
|
853
|
-
hasMore: !!newLastKey
|
|
854
|
-
loadingMore: false
|
|
921
|
+
hasMore: !!newLastKey
|
|
855
922
|
});
|
|
856
923
|
if (items.length > 0) {
|
|
857
924
|
this.props.jobsLoaded(items);
|
|
858
925
|
}
|
|
926
|
+
|
|
927
|
+
// Auto-fill in background if this page was sparse
|
|
928
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
929
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
930
|
+
} else {
|
|
931
|
+
this.setState({
|
|
932
|
+
loadingMore: false
|
|
933
|
+
});
|
|
934
|
+
}
|
|
859
935
|
} catch (error) {
|
|
860
|
-
if (this._fetchId !== fetchId) return;
|
|
936
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
861
937
|
console.error('loadMore', error);
|
|
862
938
|
this.setState({
|
|
863
939
|
loadingMore: false
|
|
@@ -1238,7 +1314,7 @@ class JobList extends Component {
|
|
|
1238
1314
|
// Filters (applied to server-side queries)
|
|
1239
1315
|
selectedTypeFilter: null,
|
|
1240
1316
|
selectedPriorityFilter: null,
|
|
1241
|
-
selectedStatusFilter:
|
|
1317
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1242
1318
|
selectedTimeFilterStart: null,
|
|
1243
1319
|
selectedTimeFilterEnd: null,
|
|
1244
1320
|
selectedTimeFilterText: null,
|
|
@@ -1689,24 +1765,16 @@ class JobList extends Component {
|
|
|
1689
1765
|
}, "Loading more results\u2026"));
|
|
1690
1766
|
}
|
|
1691
1767
|
return /*#__PURE__*/React.createElement("div", {
|
|
1768
|
+
className: "flex flex-center-row",
|
|
1692
1769
|
style: {
|
|
1693
|
-
|
|
1694
|
-
position: 'relative',
|
|
1695
|
-
top: -16
|
|
1770
|
+
padding: '16px 0'
|
|
1696
1771
|
}
|
|
1697
1772
|
}, /*#__PURE__*/React.createElement(Components$7.Button, {
|
|
1698
|
-
|
|
1773
|
+
inline: true,
|
|
1774
|
+
buttonType: "tertiary",
|
|
1699
1775
|
onClick: this.loadMore,
|
|
1700
|
-
isActive: true
|
|
1701
|
-
|
|
1702
|
-
width: '100%'
|
|
1703
|
-
}
|
|
1704
|
-
}, "Load More Results", /*#__PURE__*/React.createElement(FontAwesome, {
|
|
1705
|
-
name: "plus",
|
|
1706
|
-
style: {
|
|
1707
|
-
marginLeft: 8
|
|
1708
|
-
}
|
|
1709
|
-
})));
|
|
1776
|
+
isActive: true
|
|
1777
|
+
}, "Load More"));
|
|
1710
1778
|
}
|
|
1711
1779
|
renderContent() {
|
|
1712
1780
|
const {
|
package/dist/index.umd.js
CHANGED
|
@@ -800,11 +800,25 @@
|
|
|
800
800
|
}
|
|
801
801
|
return params;
|
|
802
802
|
});
|
|
803
|
+
/**
|
|
804
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
805
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
806
|
+
* query, a single page may yield very few matching results. We keep
|
|
807
|
+
* fetching in the background until we have this many items to display.
|
|
808
|
+
*/
|
|
809
|
+
_defineProperty__default["default"](this, "MIN_PAGE_SIZE", 20);
|
|
803
810
|
/**
|
|
804
811
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
805
812
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
806
|
-
* in-flight fetch checks the counter before
|
|
807
|
-
* if it doesn't match, the results are discarded.
|
|
813
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
814
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
815
|
+
*
|
|
816
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
817
|
+
* (axios supports it via the `signal` config option). That would save
|
|
818
|
+
* bandwidth and server load but requires threading `signal` through
|
|
819
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
820
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
821
|
+
* in the background but their results are ignored.
|
|
808
822
|
*/
|
|
809
823
|
_defineProperty__default["default"](this, "_fetchId", 0);
|
|
810
824
|
/**
|
|
@@ -820,6 +834,9 @@
|
|
|
820
834
|
});
|
|
821
835
|
/**
|
|
822
836
|
* Fetch the first page and render immediately.
|
|
837
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
838
|
+
* kicks off a background loop that keeps fetching and appending
|
|
839
|
+
* so results appear progressively.
|
|
823
840
|
*/
|
|
824
841
|
_defineProperty__default["default"](this, "fetchJobs", async () => {
|
|
825
842
|
const fetchId = ++this._fetchId;
|
|
@@ -829,7 +846,8 @@
|
|
|
829
846
|
}, async () => {
|
|
830
847
|
try {
|
|
831
848
|
const res = await this.fetchPage(null);
|
|
832
|
-
if (this._fetchId !== fetchId) return;
|
|
849
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
850
|
+
|
|
833
851
|
const items = res.data.Items || [];
|
|
834
852
|
const lastKey = res.data.LastKey || null;
|
|
835
853
|
this.setState({
|
|
@@ -840,8 +858,13 @@
|
|
|
840
858
|
});
|
|
841
859
|
this.props.jobsLoaded(items);
|
|
842
860
|
this.setRequesters(items);
|
|
861
|
+
|
|
862
|
+
// Auto-fill in background if first page was sparse
|
|
863
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
864
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
865
|
+
}
|
|
843
866
|
} catch (error) {
|
|
844
|
-
if (this._fetchId !== fetchId) return;
|
|
867
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
845
868
|
console.error('fetchJobs', error);
|
|
846
869
|
this.setState({
|
|
847
870
|
loading: false
|
|
@@ -849,8 +872,52 @@
|
|
|
849
872
|
}
|
|
850
873
|
});
|
|
851
874
|
});
|
|
875
|
+
/**
|
|
876
|
+
* Background loop: keep fetching pages and appending results
|
|
877
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
878
|
+
* Each page is rendered as it arrives so the user sees
|
|
879
|
+
* results appearing progressively.
|
|
880
|
+
*/
|
|
881
|
+
_defineProperty__default["default"](this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
882
|
+
this.setState({
|
|
883
|
+
loadingMore: true
|
|
884
|
+
});
|
|
885
|
+
let currentJobs = existingJobs;
|
|
886
|
+
let currentLastKey = startKey;
|
|
887
|
+
try {
|
|
888
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
889
|
+
const res = await this.fetchPage(currentLastKey);
|
|
890
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
891
|
+
|
|
892
|
+
const items = res.data.Items || [];
|
|
893
|
+
currentLastKey = res.data.LastKey || null;
|
|
894
|
+
currentJobs = [...currentJobs, ...items];
|
|
895
|
+
|
|
896
|
+
// Append to UI immediately after each page arrives
|
|
897
|
+
this.setState({
|
|
898
|
+
jobs: currentJobs,
|
|
899
|
+
lastKey: currentLastKey,
|
|
900
|
+
hasMore: !!currentLastKey
|
|
901
|
+
});
|
|
902
|
+
if (items.length > 0) {
|
|
903
|
+
this.props.jobsLoaded(items);
|
|
904
|
+
this.setRequesters(currentJobs);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
} catch (error) {
|
|
908
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
909
|
+
console.error('autoFillPages', error);
|
|
910
|
+
} finally {
|
|
911
|
+
if (this._fetchId === fetchId) {
|
|
912
|
+
this.setState({
|
|
913
|
+
loadingMore: false
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
});
|
|
852
918
|
/**
|
|
853
919
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
920
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
854
921
|
*/
|
|
855
922
|
_defineProperty__default["default"](this, "loadMore", async () => {
|
|
856
923
|
const fetchId = ++this._fetchId;
|
|
@@ -863,21 +930,30 @@
|
|
|
863
930
|
}, async () => {
|
|
864
931
|
try {
|
|
865
932
|
const res = await this.fetchPage(lastKey);
|
|
866
|
-
if (this._fetchId !== fetchId) return;
|
|
933
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
934
|
+
|
|
867
935
|
const items = res.data.Items || [];
|
|
868
936
|
const newLastKey = res.data.LastKey || null;
|
|
869
937
|
const updatedJobs = [...jobs, ...items];
|
|
870
938
|
this.setState({
|
|
871
939
|
jobs: updatedJobs,
|
|
872
940
|
lastKey: newLastKey,
|
|
873
|
-
hasMore: !!newLastKey
|
|
874
|
-
loadingMore: false
|
|
941
|
+
hasMore: !!newLastKey
|
|
875
942
|
});
|
|
876
943
|
if (items.length > 0) {
|
|
877
944
|
this.props.jobsLoaded(items);
|
|
878
945
|
}
|
|
946
|
+
|
|
947
|
+
// Auto-fill in background if this page was sparse
|
|
948
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
949
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
950
|
+
} else {
|
|
951
|
+
this.setState({
|
|
952
|
+
loadingMore: false
|
|
953
|
+
});
|
|
954
|
+
}
|
|
879
955
|
} catch (error) {
|
|
880
|
-
if (this._fetchId !== fetchId) return;
|
|
956
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
881
957
|
console.error('loadMore', error);
|
|
882
958
|
this.setState({
|
|
883
959
|
loadingMore: false
|
|
@@ -1258,7 +1334,7 @@
|
|
|
1258
1334
|
// Filters (applied to server-side queries)
|
|
1259
1335
|
selectedTypeFilter: null,
|
|
1260
1336
|
selectedPriorityFilter: null,
|
|
1261
|
-
selectedStatusFilter:
|
|
1337
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1262
1338
|
selectedTimeFilterStart: null,
|
|
1263
1339
|
selectedTimeFilterEnd: null,
|
|
1264
1340
|
selectedTimeFilterText: null,
|
|
@@ -1709,24 +1785,16 @@
|
|
|
1709
1785
|
}, "Loading more results\u2026"));
|
|
1710
1786
|
}
|
|
1711
1787
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1788
|
+
className: "flex flex-center-row",
|
|
1712
1789
|
style: {
|
|
1713
|
-
|
|
1714
|
-
position: 'relative',
|
|
1715
|
-
top: -16
|
|
1790
|
+
padding: '16px 0'
|
|
1716
1791
|
}
|
|
1717
1792
|
}, /*#__PURE__*/React__default["default"].createElement(Components$7.Button, {
|
|
1718
|
-
|
|
1793
|
+
inline: true,
|
|
1794
|
+
buttonType: "tertiary",
|
|
1719
1795
|
onClick: this.loadMore,
|
|
1720
|
-
isActive: true
|
|
1721
|
-
|
|
1722
|
-
width: '100%'
|
|
1723
|
-
}
|
|
1724
|
-
}, "Load More Results", /*#__PURE__*/React__default["default"].createElement(FontAwesome__default["default"], {
|
|
1725
|
-
name: "plus",
|
|
1726
|
-
style: {
|
|
1727
|
-
marginLeft: 8
|
|
1728
|
-
}
|
|
1729
|
-
})));
|
|
1796
|
+
isActive: true
|
|
1797
|
+
}, "Load More"));
|
|
1730
1798
|
}
|
|
1731
1799
|
renderContent() {
|
|
1732
1800
|
const {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-maintenance-web-a",
|
|
3
|
-
"version": "1.1.37
|
|
3
|
+
"version": "1.1.37",
|
|
4
4
|
"description": "Extension package to enable maintenance on Pluss Communities Platform",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"copy:add": "run(){ ext=${1:-default}; test -f src/values.config.$ext.js || cp src/values.config.default.js src/values.config.$ext.js; }; run",
|
|
19
19
|
"copy:get": "echo $npm_package_name",
|
|
20
20
|
"copy:set": "run(){ target='\\@plusscommunities\\/pluss-maintenance-web'; ext=${1:-default}; [ $ext == 'default' ] && replace=$target || replace=$target'-'$ext; echo 'Setting target to '$replace; test -f src/values.config.$ext.js && cp -f src/values.config.$ext.js src/values.config.js; sed -i '' -e 's/'$target'.*\"/'$replace'\"/g' package.json; }; run",
|
|
21
|
-
"copy:betaupload": "for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run betaupload; done; npm run copy:set;",
|
|
21
|
+
"copy:betaupload": "npm run betapatch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run betaupload; done; npm run copy:set;",
|
|
22
22
|
"copy:upload": "npm run patch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run upload; done; npm run copy:set;"
|
|
23
23
|
},
|
|
24
24
|
"author": "Phillip Suh",
|