@plusscommunities/pluss-maintenance-web 1.1.37-beta.6 → 1.1.37-beta.7
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 +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -822,11 +822,25 @@ class JobList extends React.Component {
|
|
|
822
822
|
}
|
|
823
823
|
return params;
|
|
824
824
|
});
|
|
825
|
+
/**
|
|
826
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
827
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
828
|
+
* query, a single page may yield very few matching results. We keep
|
|
829
|
+
* fetching in the background until we have this many items to display.
|
|
830
|
+
*/
|
|
831
|
+
_defineProperty__default["default"](this, "MIN_PAGE_SIZE", 20);
|
|
825
832
|
/**
|
|
826
833
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
827
834
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
828
|
-
* in-flight fetch checks the counter before
|
|
829
|
-
* if it doesn't match, the results are discarded.
|
|
835
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
836
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
837
|
+
*
|
|
838
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
839
|
+
* (axios supports it via the `signal` config option). That would save
|
|
840
|
+
* bandwidth and server load but requires threading `signal` through
|
|
841
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
842
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
843
|
+
* in the background but their results are ignored.
|
|
830
844
|
*/
|
|
831
845
|
_defineProperty__default["default"](this, "_fetchId", 0);
|
|
832
846
|
/**
|
|
@@ -842,6 +856,9 @@ class JobList extends React.Component {
|
|
|
842
856
|
});
|
|
843
857
|
/**
|
|
844
858
|
* Fetch the first page and render immediately.
|
|
859
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
860
|
+
* kicks off a background loop that keeps fetching and appending
|
|
861
|
+
* so results appear progressively.
|
|
845
862
|
*/
|
|
846
863
|
_defineProperty__default["default"](this, "fetchJobs", async () => {
|
|
847
864
|
const fetchId = ++this._fetchId;
|
|
@@ -851,7 +868,8 @@ class JobList extends React.Component {
|
|
|
851
868
|
}, async () => {
|
|
852
869
|
try {
|
|
853
870
|
const res = await this.fetchPage(null);
|
|
854
|
-
if (this._fetchId !== fetchId) return;
|
|
871
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
872
|
+
|
|
855
873
|
const items = res.data.Items || [];
|
|
856
874
|
const lastKey = res.data.LastKey || null;
|
|
857
875
|
this.setState({
|
|
@@ -862,8 +880,13 @@ class JobList extends React.Component {
|
|
|
862
880
|
});
|
|
863
881
|
this.props.jobsLoaded(items);
|
|
864
882
|
this.setRequesters(items);
|
|
883
|
+
|
|
884
|
+
// Auto-fill in background if first page was sparse
|
|
885
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
886
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
887
|
+
}
|
|
865
888
|
} catch (error) {
|
|
866
|
-
if (this._fetchId !== fetchId) return;
|
|
889
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
867
890
|
console.error('fetchJobs', error);
|
|
868
891
|
this.setState({
|
|
869
892
|
loading: false
|
|
@@ -871,8 +894,52 @@ class JobList extends React.Component {
|
|
|
871
894
|
}
|
|
872
895
|
});
|
|
873
896
|
});
|
|
897
|
+
/**
|
|
898
|
+
* Background loop: keep fetching pages and appending results
|
|
899
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
900
|
+
* Each page is rendered as it arrives so the user sees
|
|
901
|
+
* results appearing progressively.
|
|
902
|
+
*/
|
|
903
|
+
_defineProperty__default["default"](this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
904
|
+
this.setState({
|
|
905
|
+
loadingMore: true
|
|
906
|
+
});
|
|
907
|
+
let currentJobs = existingJobs;
|
|
908
|
+
let currentLastKey = startKey;
|
|
909
|
+
try {
|
|
910
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
911
|
+
const res = await this.fetchPage(currentLastKey);
|
|
912
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
913
|
+
|
|
914
|
+
const items = res.data.Items || [];
|
|
915
|
+
currentLastKey = res.data.LastKey || null;
|
|
916
|
+
currentJobs = [...currentJobs, ...items];
|
|
917
|
+
|
|
918
|
+
// Append to UI immediately after each page arrives
|
|
919
|
+
this.setState({
|
|
920
|
+
jobs: currentJobs,
|
|
921
|
+
lastKey: currentLastKey,
|
|
922
|
+
hasMore: !!currentLastKey
|
|
923
|
+
});
|
|
924
|
+
if (items.length > 0) {
|
|
925
|
+
this.props.jobsLoaded(items);
|
|
926
|
+
this.setRequesters(currentJobs);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
} catch (error) {
|
|
930
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
931
|
+
console.error('autoFillPages', error);
|
|
932
|
+
} finally {
|
|
933
|
+
if (this._fetchId === fetchId) {
|
|
934
|
+
this.setState({
|
|
935
|
+
loadingMore: false
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
});
|
|
874
940
|
/**
|
|
875
941
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
942
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
876
943
|
*/
|
|
877
944
|
_defineProperty__default["default"](this, "loadMore", async () => {
|
|
878
945
|
const fetchId = ++this._fetchId;
|
|
@@ -885,21 +952,30 @@ class JobList extends React.Component {
|
|
|
885
952
|
}, async () => {
|
|
886
953
|
try {
|
|
887
954
|
const res = await this.fetchPage(lastKey);
|
|
888
|
-
if (this._fetchId !== fetchId) return;
|
|
955
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
956
|
+
|
|
889
957
|
const items = res.data.Items || [];
|
|
890
958
|
const newLastKey = res.data.LastKey || null;
|
|
891
959
|
const updatedJobs = [...jobs, ...items];
|
|
892
960
|
this.setState({
|
|
893
961
|
jobs: updatedJobs,
|
|
894
962
|
lastKey: newLastKey,
|
|
895
|
-
hasMore: !!newLastKey
|
|
896
|
-
loadingMore: false
|
|
963
|
+
hasMore: !!newLastKey
|
|
897
964
|
});
|
|
898
965
|
if (items.length > 0) {
|
|
899
966
|
this.props.jobsLoaded(items);
|
|
900
967
|
}
|
|
968
|
+
|
|
969
|
+
// Auto-fill in background if this page was sparse
|
|
970
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
971
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
972
|
+
} else {
|
|
973
|
+
this.setState({
|
|
974
|
+
loadingMore: false
|
|
975
|
+
});
|
|
976
|
+
}
|
|
901
977
|
} catch (error) {
|
|
902
|
-
if (this._fetchId !== fetchId) return;
|
|
978
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
903
979
|
console.error('loadMore', error);
|
|
904
980
|
this.setState({
|
|
905
981
|
loadingMore: false
|
|
@@ -1280,7 +1356,7 @@ class JobList extends React.Component {
|
|
|
1280
1356
|
// Filters (applied to server-side queries)
|
|
1281
1357
|
selectedTypeFilter: null,
|
|
1282
1358
|
selectedPriorityFilter: null,
|
|
1283
|
-
selectedStatusFilter:
|
|
1359
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1284
1360
|
selectedTimeFilterStart: null,
|
|
1285
1361
|
selectedTimeFilterEnd: null,
|
|
1286
1362
|
selectedTimeFilterText: null,
|
|
@@ -1731,24 +1807,16 @@ class JobList extends React.Component {
|
|
|
1731
1807
|
}, "Loading more results\u2026"));
|
|
1732
1808
|
}
|
|
1733
1809
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1810
|
+
className: "flex flex-center-row",
|
|
1734
1811
|
style: {
|
|
1735
|
-
|
|
1736
|
-
position: 'relative',
|
|
1737
|
-
top: -16
|
|
1812
|
+
padding: '16px 0'
|
|
1738
1813
|
}
|
|
1739
1814
|
}, /*#__PURE__*/React__default["default"].createElement(Components$7.Button, {
|
|
1740
|
-
|
|
1815
|
+
inline: true,
|
|
1816
|
+
buttonType: "tertiary",
|
|
1741
1817
|
onClick: this.loadMore,
|
|
1742
|
-
isActive: true
|
|
1743
|
-
|
|
1744
|
-
width: '100%'
|
|
1745
|
-
}
|
|
1746
|
-
}, "Load More Results", /*#__PURE__*/React__default["default"].createElement(FontAwesome__default["default"], {
|
|
1747
|
-
name: "plus",
|
|
1748
|
-
style: {
|
|
1749
|
-
marginLeft: 8
|
|
1750
|
-
}
|
|
1751
|
-
})));
|
|
1818
|
+
isActive: true
|
|
1819
|
+
}, "Load More"));
|
|
1752
1820
|
}
|
|
1753
1821
|
renderContent() {
|
|
1754
1822
|
const {
|
package/dist/index.esm.js
CHANGED
|
@@ -791,11 +791,25 @@ class JobList extends Component {
|
|
|
791
791
|
}
|
|
792
792
|
return params;
|
|
793
793
|
});
|
|
794
|
+
/**
|
|
795
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
796
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
797
|
+
* query, a single page may yield very few matching results. We keep
|
|
798
|
+
* fetching in the background until we have this many items to display.
|
|
799
|
+
*/
|
|
800
|
+
_defineProperty(this, "MIN_PAGE_SIZE", 20);
|
|
794
801
|
/**
|
|
795
802
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
796
803
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
797
|
-
* in-flight fetch checks the counter before
|
|
798
|
-
* if it doesn't match, the results are discarded.
|
|
804
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
805
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
806
|
+
*
|
|
807
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
808
|
+
* (axios supports it via the `signal` config option). That would save
|
|
809
|
+
* bandwidth and server load but requires threading `signal` through
|
|
810
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
811
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
812
|
+
* in the background but their results are ignored.
|
|
799
813
|
*/
|
|
800
814
|
_defineProperty(this, "_fetchId", 0);
|
|
801
815
|
/**
|
|
@@ -811,6 +825,9 @@ class JobList extends Component {
|
|
|
811
825
|
});
|
|
812
826
|
/**
|
|
813
827
|
* Fetch the first page and render immediately.
|
|
828
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
829
|
+
* kicks off a background loop that keeps fetching and appending
|
|
830
|
+
* so results appear progressively.
|
|
814
831
|
*/
|
|
815
832
|
_defineProperty(this, "fetchJobs", async () => {
|
|
816
833
|
const fetchId = ++this._fetchId;
|
|
@@ -820,7 +837,8 @@ class JobList extends Component {
|
|
|
820
837
|
}, async () => {
|
|
821
838
|
try {
|
|
822
839
|
const res = await this.fetchPage(null);
|
|
823
|
-
if (this._fetchId !== fetchId) return;
|
|
840
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
841
|
+
|
|
824
842
|
const items = res.data.Items || [];
|
|
825
843
|
const lastKey = res.data.LastKey || null;
|
|
826
844
|
this.setState({
|
|
@@ -831,8 +849,13 @@ class JobList extends Component {
|
|
|
831
849
|
});
|
|
832
850
|
this.props.jobsLoaded(items);
|
|
833
851
|
this.setRequesters(items);
|
|
852
|
+
|
|
853
|
+
// Auto-fill in background if first page was sparse
|
|
854
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
855
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
856
|
+
}
|
|
834
857
|
} catch (error) {
|
|
835
|
-
if (this._fetchId !== fetchId) return;
|
|
858
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
836
859
|
console.error('fetchJobs', error);
|
|
837
860
|
this.setState({
|
|
838
861
|
loading: false
|
|
@@ -840,8 +863,52 @@ class JobList extends Component {
|
|
|
840
863
|
}
|
|
841
864
|
});
|
|
842
865
|
});
|
|
866
|
+
/**
|
|
867
|
+
* Background loop: keep fetching pages and appending results
|
|
868
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
869
|
+
* Each page is rendered as it arrives so the user sees
|
|
870
|
+
* results appearing progressively.
|
|
871
|
+
*/
|
|
872
|
+
_defineProperty(this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
873
|
+
this.setState({
|
|
874
|
+
loadingMore: true
|
|
875
|
+
});
|
|
876
|
+
let currentJobs = existingJobs;
|
|
877
|
+
let currentLastKey = startKey;
|
|
878
|
+
try {
|
|
879
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
880
|
+
const res = await this.fetchPage(currentLastKey);
|
|
881
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
882
|
+
|
|
883
|
+
const items = res.data.Items || [];
|
|
884
|
+
currentLastKey = res.data.LastKey || null;
|
|
885
|
+
currentJobs = [...currentJobs, ...items];
|
|
886
|
+
|
|
887
|
+
// Append to UI immediately after each page arrives
|
|
888
|
+
this.setState({
|
|
889
|
+
jobs: currentJobs,
|
|
890
|
+
lastKey: currentLastKey,
|
|
891
|
+
hasMore: !!currentLastKey
|
|
892
|
+
});
|
|
893
|
+
if (items.length > 0) {
|
|
894
|
+
this.props.jobsLoaded(items);
|
|
895
|
+
this.setRequesters(currentJobs);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
} catch (error) {
|
|
899
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
900
|
+
console.error('autoFillPages', error);
|
|
901
|
+
} finally {
|
|
902
|
+
if (this._fetchId === fetchId) {
|
|
903
|
+
this.setState({
|
|
904
|
+
loadingMore: false
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
});
|
|
843
909
|
/**
|
|
844
910
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
911
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
845
912
|
*/
|
|
846
913
|
_defineProperty(this, "loadMore", async () => {
|
|
847
914
|
const fetchId = ++this._fetchId;
|
|
@@ -854,21 +921,30 @@ class JobList extends Component {
|
|
|
854
921
|
}, async () => {
|
|
855
922
|
try {
|
|
856
923
|
const res = await this.fetchPage(lastKey);
|
|
857
|
-
if (this._fetchId !== fetchId) return;
|
|
924
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
925
|
+
|
|
858
926
|
const items = res.data.Items || [];
|
|
859
927
|
const newLastKey = res.data.LastKey || null;
|
|
860
928
|
const updatedJobs = [...jobs, ...items];
|
|
861
929
|
this.setState({
|
|
862
930
|
jobs: updatedJobs,
|
|
863
931
|
lastKey: newLastKey,
|
|
864
|
-
hasMore: !!newLastKey
|
|
865
|
-
loadingMore: false
|
|
932
|
+
hasMore: !!newLastKey
|
|
866
933
|
});
|
|
867
934
|
if (items.length > 0) {
|
|
868
935
|
this.props.jobsLoaded(items);
|
|
869
936
|
}
|
|
937
|
+
|
|
938
|
+
// Auto-fill in background if this page was sparse
|
|
939
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
940
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
941
|
+
} else {
|
|
942
|
+
this.setState({
|
|
943
|
+
loadingMore: false
|
|
944
|
+
});
|
|
945
|
+
}
|
|
870
946
|
} catch (error) {
|
|
871
|
-
if (this._fetchId !== fetchId) return;
|
|
947
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
872
948
|
console.error('loadMore', error);
|
|
873
949
|
this.setState({
|
|
874
950
|
loadingMore: false
|
|
@@ -1249,7 +1325,7 @@ class JobList extends Component {
|
|
|
1249
1325
|
// Filters (applied to server-side queries)
|
|
1250
1326
|
selectedTypeFilter: null,
|
|
1251
1327
|
selectedPriorityFilter: null,
|
|
1252
|
-
selectedStatusFilter:
|
|
1328
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1253
1329
|
selectedTimeFilterStart: null,
|
|
1254
1330
|
selectedTimeFilterEnd: null,
|
|
1255
1331
|
selectedTimeFilterText: null,
|
|
@@ -1700,24 +1776,16 @@ class JobList extends Component {
|
|
|
1700
1776
|
}, "Loading more results\u2026"));
|
|
1701
1777
|
}
|
|
1702
1778
|
return /*#__PURE__*/React.createElement("div", {
|
|
1779
|
+
className: "flex flex-center-row",
|
|
1703
1780
|
style: {
|
|
1704
|
-
|
|
1705
|
-
position: 'relative',
|
|
1706
|
-
top: -16
|
|
1781
|
+
padding: '16px 0'
|
|
1707
1782
|
}
|
|
1708
1783
|
}, /*#__PURE__*/React.createElement(Components$7.Button, {
|
|
1709
|
-
|
|
1784
|
+
inline: true,
|
|
1785
|
+
buttonType: "tertiary",
|
|
1710
1786
|
onClick: this.loadMore,
|
|
1711
|
-
isActive: true
|
|
1712
|
-
|
|
1713
|
-
width: '100%'
|
|
1714
|
-
}
|
|
1715
|
-
}, "Load More Results", /*#__PURE__*/React.createElement(FontAwesome, {
|
|
1716
|
-
name: "plus",
|
|
1717
|
-
style: {
|
|
1718
|
-
marginLeft: 8
|
|
1719
|
-
}
|
|
1720
|
-
})));
|
|
1787
|
+
isActive: true
|
|
1788
|
+
}, "Load More"));
|
|
1721
1789
|
}
|
|
1722
1790
|
renderContent() {
|
|
1723
1791
|
const {
|
package/dist/index.umd.js
CHANGED
|
@@ -811,11 +811,25 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-maintenance-web",
|
|
3
|
-
"version": "1.1.37-beta.
|
|
3
|
+
"version": "1.1.37-beta.7",
|
|
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",
|