@vizzly/dashboard 0.15.0-dev-5edb8434dd7cdeec2714e56ebae47d56cd384d45 → 0.15.0-dev-5f603171f06ba14586bf9cf5a1a3a54330022c71
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/dashboard.esm.js
CHANGED
|
@@ -77849,7 +77849,7 @@ var NoDataSetResolved = /*#__PURE__*/function (_Error) {
|
|
|
77849
77849
|
return NoDataSetResolved;
|
|
77850
77850
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
77851
77851
|
|
|
77852
|
-
var useVizzly = function useVizzly(properties, options) {
|
|
77852
|
+
var useVizzly = function useVizzly(properties, options, deps) {
|
|
77853
77853
|
var _useState = useState({
|
|
77854
77854
|
loading: true,
|
|
77855
77855
|
error: undefined,
|
|
@@ -77860,6 +77860,9 @@ var useVizzly = function useVizzly(properties, options) {
|
|
|
77860
77860
|
setState = _useState[1];
|
|
77861
77861
|
var vizzlyRef = useRef();
|
|
77862
77862
|
var vizzly = vizzlyRef.current;
|
|
77863
|
+
var _useState2 = useState(0),
|
|
77864
|
+
refetchCount = _useState2[0],
|
|
77865
|
+
setRefetchCount = _useState2[1];
|
|
77863
77866
|
useEffect(function () {
|
|
77864
77867
|
var abortController = new AbortController();
|
|
77865
77868
|
var doWork = /*#__PURE__*/function () {
|
|
@@ -77917,91 +77920,22 @@ var useVizzly = function useVizzly(properties, options) {
|
|
|
77917
77920
|
return function () {
|
|
77918
77921
|
return abortController.abort(new LoadingAborted('We stopped loading Vizzly because of an abort signal triggered by an unmount'));
|
|
77919
77922
|
};
|
|
77920
|
-
}, []);
|
|
77921
|
-
var refetch =
|
|
77922
|
-
|
|
77923
|
-
|
|
77924
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
77925
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
77926
|
-
case 0:
|
|
77927
|
-
abortController = new AbortController();
|
|
77928
|
-
doWork = /*#__PURE__*/function () {
|
|
77929
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
77930
|
-
var _yield$Promise$all2, globalLibraries, dashboards;
|
|
77931
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
77932
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
77933
|
-
case 0:
|
|
77934
|
-
_context2.prev = 0;
|
|
77935
|
-
_context2.next = 3;
|
|
77936
|
-
return Vizzly$1.load(properties, {
|
|
77937
|
-
apiHost: (options == null ? void 0 : options.apiHost) || 'https://api.vizzly.co'
|
|
77938
|
-
});
|
|
77939
|
-
case 3:
|
|
77940
|
-
vizzlyRef.current = _context2.sent;
|
|
77941
|
-
_context2.next = 6;
|
|
77942
|
-
return Promise.all([vizzlyRef.current.getGlobalLibraries({
|
|
77943
|
-
abortController: abortController
|
|
77944
|
-
}), vizzlyRef.current.getDashboards({
|
|
77945
|
-
abortController: abortController
|
|
77946
|
-
})]);
|
|
77947
|
-
case 6:
|
|
77948
|
-
_yield$Promise$all2 = _context2.sent;
|
|
77949
|
-
globalLibraries = _yield$Promise$all2[0];
|
|
77950
|
-
dashboards = _yield$Promise$all2[1];
|
|
77951
|
-
setState({
|
|
77952
|
-
loading: false,
|
|
77953
|
-
error: undefined,
|
|
77954
|
-
dashboards: dashboards,
|
|
77955
|
-
globalLibraries: globalLibraries
|
|
77956
|
-
});
|
|
77957
|
-
_context2.next = 16;
|
|
77958
|
-
break;
|
|
77959
|
-
case 12:
|
|
77960
|
-
_context2.prev = 12;
|
|
77961
|
-
_context2.t0 = _context2["catch"](0);
|
|
77962
|
-
logError('Error loading Vizzly', _context2.t0);
|
|
77963
|
-
setState({
|
|
77964
|
-
loading: false,
|
|
77965
|
-
error: _context2.t0,
|
|
77966
|
-
dashboards: [].concat(state.dashboards),
|
|
77967
|
-
globalLibraries: [].concat(state.globalLibraries)
|
|
77968
|
-
});
|
|
77969
|
-
case 16:
|
|
77970
|
-
case "end":
|
|
77971
|
-
return _context2.stop();
|
|
77972
|
-
}
|
|
77973
|
-
}, _callee2, null, [[0, 12]]);
|
|
77974
|
-
}));
|
|
77975
|
-
return function doWork() {
|
|
77976
|
-
return _ref3.apply(this, arguments);
|
|
77977
|
-
};
|
|
77978
|
-
}();
|
|
77979
|
-
doWork();
|
|
77980
|
-
return _context3.abrupt("return", function () {
|
|
77981
|
-
return abortController.abort(new LoadingAborted('We stopped loading Vizzly because of an abort signal triggered by an unmount'));
|
|
77982
|
-
});
|
|
77983
|
-
case 4:
|
|
77984
|
-
case "end":
|
|
77985
|
-
return _context3.stop();
|
|
77986
|
-
}
|
|
77987
|
-
}, _callee3);
|
|
77988
|
-
}));
|
|
77989
|
-
return function refetch() {
|
|
77990
|
-
return _ref2.apply(this, arguments);
|
|
77991
|
-
};
|
|
77992
|
-
}();
|
|
77923
|
+
}, [refetchCount].concat(deps || []));
|
|
77924
|
+
var refetch = function refetch() {
|
|
77925
|
+
setRefetchCount(refetchCount + 1);
|
|
77926
|
+
};
|
|
77993
77927
|
var createDashboard = /*#__PURE__*/function () {
|
|
77994
|
-
var
|
|
77928
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
77995
77929
|
var createdDashboard;
|
|
77996
|
-
return _regeneratorRuntime().wrap(function
|
|
77997
|
-
while (1) switch (
|
|
77930
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
77931
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
77998
77932
|
case 0:
|
|
77999
77933
|
if (!vizzly) {
|
|
78000
|
-
|
|
77934
|
+
_context2.next = 15;
|
|
78001
77935
|
break;
|
|
78002
77936
|
}
|
|
78003
|
-
|
|
78004
|
-
|
|
77937
|
+
_context2.prev = 1;
|
|
77938
|
+
_context2.next = 4;
|
|
78005
77939
|
return vizzly.createDashboard({
|
|
78006
77940
|
definition: params.definition,
|
|
78007
77941
|
// permissions: params.permissions,
|
|
@@ -78010,76 +77944,76 @@ var useVizzly = function useVizzly(properties, options) {
|
|
|
78010
77944
|
abortSignal: params.abortSignal
|
|
78011
77945
|
});
|
|
78012
77946
|
case 4:
|
|
78013
|
-
createdDashboard =
|
|
77947
|
+
createdDashboard = _context2.sent;
|
|
78014
77948
|
setState(_extends({}, state, {
|
|
78015
77949
|
dashboards: [].concat(state.dashboards, [createdDashboard])
|
|
78016
77950
|
}));
|
|
78017
|
-
return
|
|
77951
|
+
return _context2.abrupt("return", createdDashboard);
|
|
78018
77952
|
case 9:
|
|
78019
|
-
|
|
78020
|
-
|
|
78021
|
-
logError(
|
|
78022
|
-
return
|
|
77953
|
+
_context2.prev = 9;
|
|
77954
|
+
_context2.t0 = _context2["catch"](1);
|
|
77955
|
+
logError(_context2.t0);
|
|
77956
|
+
return _context2.abrupt("return", null);
|
|
78023
77957
|
case 13:
|
|
78024
|
-
|
|
77958
|
+
_context2.next = 16;
|
|
78025
77959
|
break;
|
|
78026
77960
|
case 15:
|
|
78027
77961
|
throw 'Unable to create a dashboard when vizzly has not been loaded.';
|
|
78028
77962
|
case 16:
|
|
78029
77963
|
case "end":
|
|
78030
|
-
return
|
|
77964
|
+
return _context2.stop();
|
|
78031
77965
|
}
|
|
78032
|
-
},
|
|
77966
|
+
}, _callee2, null, [[1, 9]]);
|
|
78033
77967
|
}));
|
|
78034
77968
|
return function createDashboard(_x) {
|
|
78035
|
-
return
|
|
77969
|
+
return _ref2.apply(this, arguments);
|
|
78036
77970
|
};
|
|
78037
77971
|
}();
|
|
78038
77972
|
useEffect(function () {
|
|
78039
77973
|
var abortController = new AbortController();
|
|
78040
77974
|
var doWork = /*#__PURE__*/function () {
|
|
78041
|
-
var
|
|
78042
|
-
var _yield$Promise$
|
|
78043
|
-
return _regeneratorRuntime().wrap(function
|
|
78044
|
-
while (1) switch (
|
|
77975
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
77976
|
+
var _yield$Promise$all2, globalLibraries;
|
|
77977
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
77978
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
78045
77979
|
case 0:
|
|
78046
|
-
|
|
78047
|
-
|
|
77980
|
+
_context3.prev = 0;
|
|
77981
|
+
_context3.next = 3;
|
|
78048
77982
|
return Vizzly$1.load(properties, {
|
|
78049
77983
|
apiHost: (options == null ? void 0 : options.apiHost) || 'https://api.vizzly.co'
|
|
78050
77984
|
});
|
|
78051
77985
|
case 3:
|
|
78052
|
-
vizzlyRef.current =
|
|
78053
|
-
|
|
77986
|
+
vizzlyRef.current = _context3.sent;
|
|
77987
|
+
_context3.next = 6;
|
|
78054
77988
|
return Promise.all([vizzlyRef.current.getGlobalLibraries({
|
|
78055
77989
|
abortController: abortController
|
|
78056
77990
|
})]);
|
|
78057
77991
|
case 6:
|
|
78058
|
-
_yield$Promise$
|
|
78059
|
-
globalLibraries = _yield$Promise$
|
|
77992
|
+
_yield$Promise$all2 = _context3.sent;
|
|
77993
|
+
globalLibraries = _yield$Promise$all2[0];
|
|
78060
77994
|
setState(_extends({}, state, {
|
|
78061
77995
|
globalLibraries: globalLibraries
|
|
78062
77996
|
}));
|
|
78063
|
-
|
|
77997
|
+
_context3.next = 15;
|
|
78064
77998
|
break;
|
|
78065
77999
|
case 11:
|
|
78066
|
-
|
|
78067
|
-
|
|
78068
|
-
logError('Error loading Vizzly',
|
|
78000
|
+
_context3.prev = 11;
|
|
78001
|
+
_context3.t0 = _context3["catch"](0);
|
|
78002
|
+
logError('Error loading Vizzly', _context3.t0);
|
|
78069
78003
|
setState({
|
|
78070
78004
|
loading: false,
|
|
78071
|
-
error:
|
|
78005
|
+
error: _context3.t0,
|
|
78072
78006
|
dashboards: [].concat(state.dashboards),
|
|
78073
78007
|
globalLibraries: [].concat(state.globalLibraries)
|
|
78074
78008
|
});
|
|
78075
78009
|
case 15:
|
|
78076
78010
|
case "end":
|
|
78077
|
-
return
|
|
78011
|
+
return _context3.stop();
|
|
78078
78012
|
}
|
|
78079
|
-
},
|
|
78013
|
+
}, _callee3, null, [[0, 11]]);
|
|
78080
78014
|
}));
|
|
78081
78015
|
return function doWork() {
|
|
78082
|
-
return
|
|
78016
|
+
return _ref3.apply(this, arguments);
|
|
78083
78017
|
};
|
|
78084
78018
|
}();
|
|
78085
78019
|
if (vizzly) {
|
|
@@ -78097,20 +78031,20 @@ var useVizzly = function useVizzly(properties, options) {
|
|
|
78097
78031
|
};
|
|
78098
78032
|
}, [vizzly]);
|
|
78099
78033
|
var updateDashboard = /*#__PURE__*/function () {
|
|
78100
|
-
var
|
|
78034
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
78101
78035
|
var updatedDashboard, dashboards;
|
|
78102
|
-
return _regeneratorRuntime().wrap(function
|
|
78103
|
-
while (1) switch (
|
|
78036
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
78037
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
78104
78038
|
case 0:
|
|
78105
78039
|
if (!vizzly) {
|
|
78106
|
-
|
|
78040
|
+
_context4.next = 20;
|
|
78107
78041
|
break;
|
|
78108
78042
|
}
|
|
78109
78043
|
setState(_extends({}, state, {
|
|
78110
78044
|
saving: SavingState.InProgress
|
|
78111
78045
|
}));
|
|
78112
|
-
|
|
78113
|
-
|
|
78046
|
+
_context4.prev = 2;
|
|
78047
|
+
_context4.next = 5;
|
|
78114
78048
|
return vizzly.updateDashboard({
|
|
78115
78049
|
dashboardId: params.dashboardId,
|
|
78116
78050
|
definition: params.definition,
|
|
@@ -78120,11 +78054,11 @@ var useVizzly = function useVizzly(properties, options) {
|
|
|
78120
78054
|
name: params.name
|
|
78121
78055
|
});
|
|
78122
78056
|
case 5:
|
|
78123
|
-
updatedDashboard =
|
|
78124
|
-
|
|
78057
|
+
updatedDashboard = _context4.sent;
|
|
78058
|
+
_context4.next = 8;
|
|
78125
78059
|
return vizzly.getDashboards();
|
|
78126
78060
|
case 8:
|
|
78127
|
-
dashboards =
|
|
78061
|
+
dashboards = _context4.sent;
|
|
78128
78062
|
setState(function (prevState) {
|
|
78129
78063
|
return _extends({}, prevState, {
|
|
78130
78064
|
dashboards: dashboards,
|
|
@@ -78137,25 +78071,25 @@ var useVizzly = function useVizzly(properties, options) {
|
|
|
78137
78071
|
saving: SavingState.Undefined
|
|
78138
78072
|
}));
|
|
78139
78073
|
}, 500);
|
|
78140
|
-
return
|
|
78074
|
+
return _context4.abrupt("return", updatedDashboard);
|
|
78141
78075
|
case 14:
|
|
78142
|
-
|
|
78143
|
-
|
|
78144
|
-
logError('Error updating dashboard',
|
|
78145
|
-
return
|
|
78076
|
+
_context4.prev = 14;
|
|
78077
|
+
_context4.t0 = _context4["catch"](2);
|
|
78078
|
+
logError('Error updating dashboard', _context4.t0);
|
|
78079
|
+
return _context4.abrupt("return", null);
|
|
78146
78080
|
case 18:
|
|
78147
|
-
|
|
78081
|
+
_context4.next = 21;
|
|
78148
78082
|
break;
|
|
78149
78083
|
case 20:
|
|
78150
78084
|
throw 'Unable to update a dashboard when vizzly has not been loaded.';
|
|
78151
78085
|
case 21:
|
|
78152
78086
|
case "end":
|
|
78153
|
-
return
|
|
78087
|
+
return _context4.stop();
|
|
78154
78088
|
}
|
|
78155
|
-
},
|
|
78089
|
+
}, _callee4, null, [[2, 14]]);
|
|
78156
78090
|
}));
|
|
78157
78091
|
return function updateDashboard(_x2) {
|
|
78158
|
-
return
|
|
78092
|
+
return _ref4.apply(this, arguments);
|
|
78159
78093
|
};
|
|
78160
78094
|
}();
|
|
78161
78095
|
|
|
@@ -36,5 +36,5 @@ declare type State = {
|
|
|
36
36
|
error: Error | undefined;
|
|
37
37
|
saving?: SavingState;
|
|
38
38
|
};
|
|
39
|
-
export declare const useVizzly: (properties: VizzlyServicesProperties, options?: LoaderOptions | undefined) => Returns;
|
|
39
|
+
export declare const useVizzly: (properties: VizzlyServicesProperties, options?: LoaderOptions | undefined, deps?: any[] | undefined) => Returns;
|
|
40
40
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/dashboard",
|
|
3
3
|
"author": "james@vizzly.co",
|
|
4
|
-
"version": "0.15.0-dev-
|
|
4
|
+
"version": "0.15.0-dev-5f603171f06ba14586bf9cf5a1a3a54330022c71",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|