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