@vizzly/dashboard 0.15.0-dev-9a1bb7eeb6253cba7039784609f6cab103d5ac04 → 0.15.0-dev-32fe795e105ba47b629e4cd9f11589467fdf3c98

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.
@@ -77788,7 +77788,7 @@ var NoDataSetResolved = /*#__PURE__*/function (_Error) {
77788
77788
  return NoDataSetResolved;
77789
77789
  }( /*#__PURE__*/_wrapNativeSuper(Error));
77790
77790
 
77791
- var useVizzly = function useVizzly(properties, options) {
77791
+ var useVizzly = function useVizzly(properties, options, deps) {
77792
77792
  var _useState = React.useState({
77793
77793
  loading: true,
77794
77794
  error: undefined,
@@ -77799,6 +77799,9 @@ var useVizzly = function useVizzly(properties, options) {
77799
77799
  setState = _useState[1];
77800
77800
  var vizzlyRef = React.useRef();
77801
77801
  var vizzly = vizzlyRef.current;
77802
+ var _useState2 = React.useState(0),
77803
+ refetchCount = _useState2[0],
77804
+ setRefetchCount = _useState2[1];
77802
77805
  React.useEffect(function () {
77803
77806
  var abortController = new AbortController();
77804
77807
  var doWork = /*#__PURE__*/function () {
@@ -77856,91 +77859,22 @@ var useVizzly = function useVizzly(properties, options) {
77856
77859
  return function () {
77857
77860
  return abortController.abort(new LoadingAborted('We stopped loading Vizzly because of an abort signal triggered by an unmount'));
77858
77861
  };
77859
- }, []);
77860
- var refetch = /*#__PURE__*/function () {
77861
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
77862
- var abortController, doWork;
77863
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
77864
- while (1) switch (_context3.prev = _context3.next) {
77865
- case 0:
77866
- abortController = new AbortController();
77867
- doWork = /*#__PURE__*/function () {
77868
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
77869
- var _yield$Promise$all2, globalLibraries, dashboards;
77870
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
77871
- while (1) switch (_context2.prev = _context2.next) {
77872
- case 0:
77873
- _context2.prev = 0;
77874
- _context2.next = 3;
77875
- return Vizzly$1.load(properties, {
77876
- apiHost: (options == null ? void 0 : options.apiHost) || 'https://api.vizzly.co'
77877
- });
77878
- case 3:
77879
- vizzlyRef.current = _context2.sent;
77880
- _context2.next = 6;
77881
- return Promise.all([vizzlyRef.current.getGlobalLibraries({
77882
- abortController: abortController
77883
- }), vizzlyRef.current.getDashboards({
77884
- abortController: abortController
77885
- })]);
77886
- case 6:
77887
- _yield$Promise$all2 = _context2.sent;
77888
- globalLibraries = _yield$Promise$all2[0];
77889
- dashboards = _yield$Promise$all2[1];
77890
- setState({
77891
- loading: false,
77892
- error: undefined,
77893
- dashboards: dashboards,
77894
- globalLibraries: globalLibraries
77895
- });
77896
- _context2.next = 16;
77897
- break;
77898
- case 12:
77899
- _context2.prev = 12;
77900
- _context2.t0 = _context2["catch"](0);
77901
- logError('Error loading Vizzly', _context2.t0);
77902
- setState({
77903
- loading: false,
77904
- error: _context2.t0,
77905
- dashboards: [].concat(state.dashboards),
77906
- globalLibraries: [].concat(state.globalLibraries)
77907
- });
77908
- case 16:
77909
- case "end":
77910
- return _context2.stop();
77911
- }
77912
- }, _callee2, null, [[0, 12]]);
77913
- }));
77914
- return function doWork() {
77915
- return _ref3.apply(this, arguments);
77916
- };
77917
- }();
77918
- doWork();
77919
- return _context3.abrupt("return", function () {
77920
- return abortController.abort(new LoadingAborted('We stopped loading Vizzly because of an abort signal triggered by an unmount'));
77921
- });
77922
- case 4:
77923
- case "end":
77924
- return _context3.stop();
77925
- }
77926
- }, _callee3);
77927
- }));
77928
- return function refetch() {
77929
- return _ref2.apply(this, arguments);
77930
- };
77931
- }();
77862
+ }, [refetchCount].concat(deps || []));
77863
+ var refetch = function refetch() {
77864
+ setRefetchCount(refetchCount + 1);
77865
+ };
77932
77866
  var createDashboard = /*#__PURE__*/function () {
77933
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
77867
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
77934
77868
  var createdDashboard;
77935
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
77936
- while (1) switch (_context4.prev = _context4.next) {
77869
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
77870
+ while (1) switch (_context2.prev = _context2.next) {
77937
77871
  case 0:
77938
77872
  if (!vizzly) {
77939
- _context4.next = 15;
77873
+ _context2.next = 15;
77940
77874
  break;
77941
77875
  }
77942
- _context4.prev = 1;
77943
- _context4.next = 4;
77876
+ _context2.prev = 1;
77877
+ _context2.next = 4;
77944
77878
  return vizzly.createDashboard({
77945
77879
  definition: params.definition,
77946
77880
  // permissions: params.permissions,
@@ -77949,76 +77883,76 @@ var useVizzly = function useVizzly(properties, options) {
77949
77883
  abortSignal: params.abortSignal
77950
77884
  });
77951
77885
  case 4:
77952
- createdDashboard = _context4.sent;
77886
+ createdDashboard = _context2.sent;
77953
77887
  setState(_extends({}, state, {
77954
77888
  dashboards: [].concat(state.dashboards, [createdDashboard])
77955
77889
  }));
77956
- return _context4.abrupt("return", createdDashboard);
77890
+ return _context2.abrupt("return", createdDashboard);
77957
77891
  case 9:
77958
- _context4.prev = 9;
77959
- _context4.t0 = _context4["catch"](1);
77960
- logError(_context4.t0);
77961
- return _context4.abrupt("return", null);
77892
+ _context2.prev = 9;
77893
+ _context2.t0 = _context2["catch"](1);
77894
+ logError(_context2.t0);
77895
+ return _context2.abrupt("return", null);
77962
77896
  case 13:
77963
- _context4.next = 16;
77897
+ _context2.next = 16;
77964
77898
  break;
77965
77899
  case 15:
77966
77900
  throw 'Unable to create a dashboard when vizzly has not been loaded.';
77967
77901
  case 16:
77968
77902
  case "end":
77969
- return _context4.stop();
77903
+ return _context2.stop();
77970
77904
  }
77971
- }, _callee4, null, [[1, 9]]);
77905
+ }, _callee2, null, [[1, 9]]);
77972
77906
  }));
77973
77907
  return function createDashboard(_x) {
77974
- return _ref4.apply(this, arguments);
77908
+ return _ref2.apply(this, arguments);
77975
77909
  };
77976
77910
  }();
77977
77911
  React.useEffect(function () {
77978
77912
  var abortController = new AbortController();
77979
77913
  var doWork = /*#__PURE__*/function () {
77980
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
77981
- var _yield$Promise$all3, globalLibraries;
77982
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
77983
- while (1) switch (_context5.prev = _context5.next) {
77914
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
77915
+ var _yield$Promise$all2, globalLibraries;
77916
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
77917
+ while (1) switch (_context3.prev = _context3.next) {
77984
77918
  case 0:
77985
- _context5.prev = 0;
77986
- _context5.next = 3;
77919
+ _context3.prev = 0;
77920
+ _context3.next = 3;
77987
77921
  return Vizzly$1.load(properties, {
77988
77922
  apiHost: (options == null ? void 0 : options.apiHost) || 'https://api.vizzly.co'
77989
77923
  });
77990
77924
  case 3:
77991
- vizzlyRef.current = _context5.sent;
77992
- _context5.next = 6;
77925
+ vizzlyRef.current = _context3.sent;
77926
+ _context3.next = 6;
77993
77927
  return Promise.all([vizzlyRef.current.getGlobalLibraries({
77994
77928
  abortController: abortController
77995
77929
  })]);
77996
77930
  case 6:
77997
- _yield$Promise$all3 = _context5.sent;
77998
- globalLibraries = _yield$Promise$all3[0];
77931
+ _yield$Promise$all2 = _context3.sent;
77932
+ globalLibraries = _yield$Promise$all2[0];
77999
77933
  setState(_extends({}, state, {
78000
77934
  globalLibraries: globalLibraries
78001
77935
  }));
78002
- _context5.next = 15;
77936
+ _context3.next = 15;
78003
77937
  break;
78004
77938
  case 11:
78005
- _context5.prev = 11;
78006
- _context5.t0 = _context5["catch"](0);
78007
- logError('Error loading Vizzly', _context5.t0);
77939
+ _context3.prev = 11;
77940
+ _context3.t0 = _context3["catch"](0);
77941
+ logError('Error loading Vizzly', _context3.t0);
78008
77942
  setState({
78009
77943
  loading: false,
78010
- error: _context5.t0,
77944
+ error: _context3.t0,
78011
77945
  dashboards: [].concat(state.dashboards),
78012
77946
  globalLibraries: [].concat(state.globalLibraries)
78013
77947
  });
78014
77948
  case 15:
78015
77949
  case "end":
78016
- return _context5.stop();
77950
+ return _context3.stop();
78017
77951
  }
78018
- }, _callee5, null, [[0, 11]]);
77952
+ }, _callee3, null, [[0, 11]]);
78019
77953
  }));
78020
77954
  return function doWork() {
78021
- return _ref5.apply(this, arguments);
77955
+ return _ref3.apply(this, arguments);
78022
77956
  };
78023
77957
  }();
78024
77958
  if (vizzly) {
@@ -78036,20 +77970,20 @@ var useVizzly = function useVizzly(properties, options) {
78036
77970
  };
78037
77971
  }, [vizzly]);
78038
77972
  var updateDashboard = /*#__PURE__*/function () {
78039
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
77973
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
78040
77974
  var updatedDashboard, dashboards;
78041
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
78042
- while (1) switch (_context6.prev = _context6.next) {
77975
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
77976
+ while (1) switch (_context4.prev = _context4.next) {
78043
77977
  case 0:
78044
77978
  if (!vizzly) {
78045
- _context6.next = 20;
77979
+ _context4.next = 20;
78046
77980
  break;
78047
77981
  }
78048
77982
  setState(_extends({}, state, {
78049
77983
  saving: SavingState.InProgress
78050
77984
  }));
78051
- _context6.prev = 2;
78052
- _context6.next = 5;
77985
+ _context4.prev = 2;
77986
+ _context4.next = 5;
78053
77987
  return vizzly.updateDashboard({
78054
77988
  dashboardId: params.dashboardId,
78055
77989
  definition: params.definition,
@@ -78059,11 +77993,11 @@ var useVizzly = function useVizzly(properties, options) {
78059
77993
  name: params.name
78060
77994
  });
78061
77995
  case 5:
78062
- updatedDashboard = _context6.sent;
78063
- _context6.next = 8;
77996
+ updatedDashboard = _context4.sent;
77997
+ _context4.next = 8;
78064
77998
  return vizzly.getDashboards();
78065
77999
  case 8:
78066
- dashboards = _context6.sent;
78000
+ dashboards = _context4.sent;
78067
78001
  setState(function (prevState) {
78068
78002
  return _extends({}, prevState, {
78069
78003
  dashboards: dashboards,
@@ -78076,25 +78010,25 @@ var useVizzly = function useVizzly(properties, options) {
78076
78010
  saving: SavingState.Undefined
78077
78011
  }));
78078
78012
  }, 500);
78079
- return _context6.abrupt("return", updatedDashboard);
78013
+ return _context4.abrupt("return", updatedDashboard);
78080
78014
  case 14:
78081
- _context6.prev = 14;
78082
- _context6.t0 = _context6["catch"](2);
78083
- logError('Error updating dashboard', _context6.t0);
78084
- return _context6.abrupt("return", null);
78015
+ _context4.prev = 14;
78016
+ _context4.t0 = _context4["catch"](2);
78017
+ logError('Error updating dashboard', _context4.t0);
78018
+ return _context4.abrupt("return", null);
78085
78019
  case 18:
78086
- _context6.next = 21;
78020
+ _context4.next = 21;
78087
78021
  break;
78088
78022
  case 20:
78089
78023
  throw 'Unable to update a dashboard when vizzly has not been loaded.';
78090
78024
  case 21:
78091
78025
  case "end":
78092
- return _context6.stop();
78026
+ return _context4.stop();
78093
78027
  }
78094
- }, _callee6, null, [[2, 14]]);
78028
+ }, _callee4, null, [[2, 14]]);
78095
78029
  }));
78096
78030
  return function updateDashboard(_x2) {
78097
- return _ref6.apply(this, arguments);
78031
+ return _ref4.apply(this, arguments);
78098
78032
  };
78099
78033
  }();
78100
78034