@plusscommunities/pluss-maintenance-web 1.1.37-beta.5 → 1.1.37-beta.6
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 +22 -90
- package/dist/index.esm.js +22 -90
- package/dist/index.umd.js +22 -90
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -822,25 +822,11 @@ 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);
|
|
832
825
|
/**
|
|
833
826
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
834
827
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
835
|
-
* in-flight fetch
|
|
836
|
-
*
|
|
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.
|
|
828
|
+
* in-flight fetch checks the counter before applying results —
|
|
829
|
+
* if it doesn't match, the results are discarded.
|
|
844
830
|
*/
|
|
845
831
|
_defineProperty__default["default"](this, "_fetchId", 0);
|
|
846
832
|
/**
|
|
@@ -856,9 +842,6 @@ class JobList extends React.Component {
|
|
|
856
842
|
});
|
|
857
843
|
/**
|
|
858
844
|
* 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.
|
|
862
845
|
*/
|
|
863
846
|
_defineProperty__default["default"](this, "fetchJobs", async () => {
|
|
864
847
|
const fetchId = ++this._fetchId;
|
|
@@ -868,8 +851,7 @@ class JobList extends React.Component {
|
|
|
868
851
|
}, async () => {
|
|
869
852
|
try {
|
|
870
853
|
const res = await this.fetchPage(null);
|
|
871
|
-
if (this._fetchId !== fetchId) return;
|
|
872
|
-
|
|
854
|
+
if (this._fetchId !== fetchId) return;
|
|
873
855
|
const items = res.data.Items || [];
|
|
874
856
|
const lastKey = res.data.LastKey || null;
|
|
875
857
|
this.setState({
|
|
@@ -880,13 +862,8 @@ class JobList extends React.Component {
|
|
|
880
862
|
});
|
|
881
863
|
this.props.jobsLoaded(items);
|
|
882
864
|
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
|
-
}
|
|
888
865
|
} catch (error) {
|
|
889
|
-
if (this._fetchId !== fetchId) return;
|
|
866
|
+
if (this._fetchId !== fetchId) return;
|
|
890
867
|
console.error('fetchJobs', error);
|
|
891
868
|
this.setState({
|
|
892
869
|
loading: false
|
|
@@ -894,52 +871,8 @@ class JobList extends React.Component {
|
|
|
894
871
|
}
|
|
895
872
|
});
|
|
896
873
|
});
|
|
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
|
-
});
|
|
940
874
|
/**
|
|
941
875
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
942
|
-
* Fetches one page and also auto-fills in background if sparse.
|
|
943
876
|
*/
|
|
944
877
|
_defineProperty__default["default"](this, "loadMore", async () => {
|
|
945
878
|
const fetchId = ++this._fetchId;
|
|
@@ -952,30 +885,21 @@ class JobList extends React.Component {
|
|
|
952
885
|
}, async () => {
|
|
953
886
|
try {
|
|
954
887
|
const res = await this.fetchPage(lastKey);
|
|
955
|
-
if (this._fetchId !== fetchId) return;
|
|
956
|
-
|
|
888
|
+
if (this._fetchId !== fetchId) return;
|
|
957
889
|
const items = res.data.Items || [];
|
|
958
890
|
const newLastKey = res.data.LastKey || null;
|
|
959
891
|
const updatedJobs = [...jobs, ...items];
|
|
960
892
|
this.setState({
|
|
961
893
|
jobs: updatedJobs,
|
|
962
894
|
lastKey: newLastKey,
|
|
963
|
-
hasMore: !!newLastKey
|
|
895
|
+
hasMore: !!newLastKey,
|
|
896
|
+
loadingMore: false
|
|
964
897
|
});
|
|
965
898
|
if (items.length > 0) {
|
|
966
899
|
this.props.jobsLoaded(items);
|
|
967
900
|
}
|
|
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
|
-
}
|
|
977
901
|
} catch (error) {
|
|
978
|
-
if (this._fetchId !== fetchId) return;
|
|
902
|
+
if (this._fetchId !== fetchId) return;
|
|
979
903
|
console.error('loadMore', error);
|
|
980
904
|
this.setState({
|
|
981
905
|
loadingMore: false
|
|
@@ -1807,16 +1731,24 @@ class JobList extends React.Component {
|
|
|
1807
1731
|
}, "Loading more results\u2026"));
|
|
1808
1732
|
}
|
|
1809
1733
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1810
|
-
className: "flex flex-center-row",
|
|
1811
1734
|
style: {
|
|
1812
|
-
|
|
1735
|
+
margin: '24px 0 40px 0',
|
|
1736
|
+
position: 'relative',
|
|
1737
|
+
top: -16
|
|
1813
1738
|
}
|
|
1814
1739
|
}, /*#__PURE__*/React__default["default"].createElement(Components$7.Button, {
|
|
1815
|
-
|
|
1816
|
-
buttonType: "tertiary",
|
|
1740
|
+
buttonType: "primary",
|
|
1817
1741
|
onClick: this.loadMore,
|
|
1818
|
-
isActive: true
|
|
1819
|
-
|
|
1742
|
+
isActive: true,
|
|
1743
|
+
style: {
|
|
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
|
+
})));
|
|
1820
1752
|
}
|
|
1821
1753
|
renderContent() {
|
|
1822
1754
|
const {
|
package/dist/index.esm.js
CHANGED
|
@@ -791,25 +791,11 @@ 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);
|
|
801
794
|
/**
|
|
802
795
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
803
796
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
804
|
-
* in-flight fetch
|
|
805
|
-
*
|
|
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.
|
|
797
|
+
* in-flight fetch checks the counter before applying results —
|
|
798
|
+
* if it doesn't match, the results are discarded.
|
|
813
799
|
*/
|
|
814
800
|
_defineProperty(this, "_fetchId", 0);
|
|
815
801
|
/**
|
|
@@ -825,9 +811,6 @@ class JobList extends Component {
|
|
|
825
811
|
});
|
|
826
812
|
/**
|
|
827
813
|
* 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.
|
|
831
814
|
*/
|
|
832
815
|
_defineProperty(this, "fetchJobs", async () => {
|
|
833
816
|
const fetchId = ++this._fetchId;
|
|
@@ -837,8 +820,7 @@ class JobList extends Component {
|
|
|
837
820
|
}, async () => {
|
|
838
821
|
try {
|
|
839
822
|
const res = await this.fetchPage(null);
|
|
840
|
-
if (this._fetchId !== fetchId) return;
|
|
841
|
-
|
|
823
|
+
if (this._fetchId !== fetchId) return;
|
|
842
824
|
const items = res.data.Items || [];
|
|
843
825
|
const lastKey = res.data.LastKey || null;
|
|
844
826
|
this.setState({
|
|
@@ -849,13 +831,8 @@ class JobList extends Component {
|
|
|
849
831
|
});
|
|
850
832
|
this.props.jobsLoaded(items);
|
|
851
833
|
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
|
-
}
|
|
857
834
|
} catch (error) {
|
|
858
|
-
if (this._fetchId !== fetchId) return;
|
|
835
|
+
if (this._fetchId !== fetchId) return;
|
|
859
836
|
console.error('fetchJobs', error);
|
|
860
837
|
this.setState({
|
|
861
838
|
loading: false
|
|
@@ -863,52 +840,8 @@ class JobList extends Component {
|
|
|
863
840
|
}
|
|
864
841
|
});
|
|
865
842
|
});
|
|
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
|
-
});
|
|
909
843
|
/**
|
|
910
844
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
911
|
-
* Fetches one page and also auto-fills in background if sparse.
|
|
912
845
|
*/
|
|
913
846
|
_defineProperty(this, "loadMore", async () => {
|
|
914
847
|
const fetchId = ++this._fetchId;
|
|
@@ -921,30 +854,21 @@ class JobList extends Component {
|
|
|
921
854
|
}, async () => {
|
|
922
855
|
try {
|
|
923
856
|
const res = await this.fetchPage(lastKey);
|
|
924
|
-
if (this._fetchId !== fetchId) return;
|
|
925
|
-
|
|
857
|
+
if (this._fetchId !== fetchId) return;
|
|
926
858
|
const items = res.data.Items || [];
|
|
927
859
|
const newLastKey = res.data.LastKey || null;
|
|
928
860
|
const updatedJobs = [...jobs, ...items];
|
|
929
861
|
this.setState({
|
|
930
862
|
jobs: updatedJobs,
|
|
931
863
|
lastKey: newLastKey,
|
|
932
|
-
hasMore: !!newLastKey
|
|
864
|
+
hasMore: !!newLastKey,
|
|
865
|
+
loadingMore: false
|
|
933
866
|
});
|
|
934
867
|
if (items.length > 0) {
|
|
935
868
|
this.props.jobsLoaded(items);
|
|
936
869
|
}
|
|
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
|
-
}
|
|
946
870
|
} catch (error) {
|
|
947
|
-
if (this._fetchId !== fetchId) return;
|
|
871
|
+
if (this._fetchId !== fetchId) return;
|
|
948
872
|
console.error('loadMore', error);
|
|
949
873
|
this.setState({
|
|
950
874
|
loadingMore: false
|
|
@@ -1776,16 +1700,24 @@ class JobList extends Component {
|
|
|
1776
1700
|
}, "Loading more results\u2026"));
|
|
1777
1701
|
}
|
|
1778
1702
|
return /*#__PURE__*/React.createElement("div", {
|
|
1779
|
-
className: "flex flex-center-row",
|
|
1780
1703
|
style: {
|
|
1781
|
-
|
|
1704
|
+
margin: '24px 0 40px 0',
|
|
1705
|
+
position: 'relative',
|
|
1706
|
+
top: -16
|
|
1782
1707
|
}
|
|
1783
1708
|
}, /*#__PURE__*/React.createElement(Components$7.Button, {
|
|
1784
|
-
|
|
1785
|
-
buttonType: "tertiary",
|
|
1709
|
+
buttonType: "primary",
|
|
1786
1710
|
onClick: this.loadMore,
|
|
1787
|
-
isActive: true
|
|
1788
|
-
|
|
1711
|
+
isActive: true,
|
|
1712
|
+
style: {
|
|
1713
|
+
width: '100%'
|
|
1714
|
+
}
|
|
1715
|
+
}, "Load More Results", /*#__PURE__*/React.createElement(FontAwesome, {
|
|
1716
|
+
name: "plus",
|
|
1717
|
+
style: {
|
|
1718
|
+
marginLeft: 8
|
|
1719
|
+
}
|
|
1720
|
+
})));
|
|
1789
1721
|
}
|
|
1790
1722
|
renderContent() {
|
|
1791
1723
|
const {
|
package/dist/index.umd.js
CHANGED
|
@@ -811,25 +811,11 @@
|
|
|
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);
|
|
821
814
|
/**
|
|
822
815
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
823
816
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
824
|
-
* in-flight fetch
|
|
825
|
-
*
|
|
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.
|
|
817
|
+
* in-flight fetch checks the counter before applying results —
|
|
818
|
+
* if it doesn't match, the results are discarded.
|
|
833
819
|
*/
|
|
834
820
|
_defineProperty__default["default"](this, "_fetchId", 0);
|
|
835
821
|
/**
|
|
@@ -845,9 +831,6 @@
|
|
|
845
831
|
});
|
|
846
832
|
/**
|
|
847
833
|
* 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.
|
|
851
834
|
*/
|
|
852
835
|
_defineProperty__default["default"](this, "fetchJobs", async () => {
|
|
853
836
|
const fetchId = ++this._fetchId;
|
|
@@ -857,8 +840,7 @@
|
|
|
857
840
|
}, async () => {
|
|
858
841
|
try {
|
|
859
842
|
const res = await this.fetchPage(null);
|
|
860
|
-
if (this._fetchId !== fetchId) return;
|
|
861
|
-
|
|
843
|
+
if (this._fetchId !== fetchId) return;
|
|
862
844
|
const items = res.data.Items || [];
|
|
863
845
|
const lastKey = res.data.LastKey || null;
|
|
864
846
|
this.setState({
|
|
@@ -869,13 +851,8 @@
|
|
|
869
851
|
});
|
|
870
852
|
this.props.jobsLoaded(items);
|
|
871
853
|
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
|
-
}
|
|
877
854
|
} catch (error) {
|
|
878
|
-
if (this._fetchId !== fetchId) return;
|
|
855
|
+
if (this._fetchId !== fetchId) return;
|
|
879
856
|
console.error('fetchJobs', error);
|
|
880
857
|
this.setState({
|
|
881
858
|
loading: false
|
|
@@ -883,52 +860,8 @@
|
|
|
883
860
|
}
|
|
884
861
|
});
|
|
885
862
|
});
|
|
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
|
-
});
|
|
929
863
|
/**
|
|
930
864
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
931
|
-
* Fetches one page and also auto-fills in background if sparse.
|
|
932
865
|
*/
|
|
933
866
|
_defineProperty__default["default"](this, "loadMore", async () => {
|
|
934
867
|
const fetchId = ++this._fetchId;
|
|
@@ -941,30 +874,21 @@
|
|
|
941
874
|
}, async () => {
|
|
942
875
|
try {
|
|
943
876
|
const res = await this.fetchPage(lastKey);
|
|
944
|
-
if (this._fetchId !== fetchId) return;
|
|
945
|
-
|
|
877
|
+
if (this._fetchId !== fetchId) return;
|
|
946
878
|
const items = res.data.Items || [];
|
|
947
879
|
const newLastKey = res.data.LastKey || null;
|
|
948
880
|
const updatedJobs = [...jobs, ...items];
|
|
949
881
|
this.setState({
|
|
950
882
|
jobs: updatedJobs,
|
|
951
883
|
lastKey: newLastKey,
|
|
952
|
-
hasMore: !!newLastKey
|
|
884
|
+
hasMore: !!newLastKey,
|
|
885
|
+
loadingMore: false
|
|
953
886
|
});
|
|
954
887
|
if (items.length > 0) {
|
|
955
888
|
this.props.jobsLoaded(items);
|
|
956
889
|
}
|
|
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
|
-
}
|
|
966
890
|
} catch (error) {
|
|
967
|
-
if (this._fetchId !== fetchId) return;
|
|
891
|
+
if (this._fetchId !== fetchId) return;
|
|
968
892
|
console.error('loadMore', error);
|
|
969
893
|
this.setState({
|
|
970
894
|
loadingMore: false
|
|
@@ -1796,16 +1720,24 @@
|
|
|
1796
1720
|
}, "Loading more results\u2026"));
|
|
1797
1721
|
}
|
|
1798
1722
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1799
|
-
className: "flex flex-center-row",
|
|
1800
1723
|
style: {
|
|
1801
|
-
|
|
1724
|
+
margin: '24px 0 40px 0',
|
|
1725
|
+
position: 'relative',
|
|
1726
|
+
top: -16
|
|
1802
1727
|
}
|
|
1803
1728
|
}, /*#__PURE__*/React__default["default"].createElement(Components$7.Button, {
|
|
1804
|
-
|
|
1805
|
-
buttonType: "tertiary",
|
|
1729
|
+
buttonType: "primary",
|
|
1806
1730
|
onClick: this.loadMore,
|
|
1807
|
-
isActive: true
|
|
1808
|
-
|
|
1731
|
+
isActive: true,
|
|
1732
|
+
style: {
|
|
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
|
+
})));
|
|
1809
1741
|
}
|
|
1810
1742
|
renderContent() {
|
|
1811
1743
|
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.6",
|
|
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",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"upload:p": "npm run patch && npm run upload",
|
|
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
|
-
"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",
|
|
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
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;",
|
|
22
|
-
"copy:upload": "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;"
|
|
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",
|
|
25
25
|
"license": "ISC",
|