@vizzly/dashboard 0.15.0-dev-c8007c0d91fa66cc8fff6cdeaf34c7e7f49bea17 → 0.15.0-dev-0c175094808a340c84fe99388ac46bcc1bedd9a8
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/charts/src/BubbleChart/BubbleChart.d.ts +1 -1
- package/dist/charts/src/ScatterChart/ScatterChart.d.ts +1 -1
- package/dist/dashboard/src/types.d.ts +1 -130
- package/dist/dashboard.cjs.development.js +1098 -1051
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +1098 -1051
- package/dist/results-driver/src/types.d.ts +2 -0
- package/dist/services/src/index.d.ts +2 -0
- package/dist/shared-logic/src/AliasFields/types.d.ts +5 -0
- package/dist/shared-logic/src/Callbacks/cell.funcs.d.ts +1 -1
- package/dist/shared-logic/src/ComboChartV2/buildComboChartRepresentation.d.ts +3 -3
- package/dist/shared-logic/src/CustomField/AliasField/index.d.ts +7 -0
- package/dist/shared-logic/src/CustomField/CustomField.d.ts +2 -1
- package/dist/shared-logic/src/CustomField/types.d.ts +6 -1
- package/dist/shared-logic/src/DataTable/resultToPivotTableRepresentation.d.ts +2 -1
- package/dist/shared-logic/src/Field/Field.d.ts +4 -3
- package/dist/shared-logic/src/ValueAlias/ValueAlias.d.ts +2 -1
- package/dist/shared-logic/src/VizzlyState/index.d.ts +2 -0
- package/dist/shared-logic/src/api/queryEngine/getRunQueriesCallback.d.ts +2 -1
- package/dist/{dashboard → shared-ui}/src/SetupError.d.ts +2 -2
- package/dist/shared-ui/src/base/ListView/index.d.ts +2 -2
- package/dist/shared-ui/src/base/Panel/Panel.d.ts +1 -1
- package/dist/shared-ui/src/base/Section/Section.d.ts +1 -1
- package/dist/shared-ui/src/base/Table/Table.d.ts +1 -1
- package/dist/shared-ui/src/components/AdditionalFilter/AdvancedPicker/AdvancedSelectFilter.d.ts +1 -1
- package/dist/shared-ui/src/components/AdditionalFilter/asyncLoadFilterOptions.d.ts +2 -1
- package/dist/shared-ui/src/components/AreaChart/AreaChartView.d.ts +1 -1
- package/dist/shared-ui/src/components/BubbleChart/BubbleChartView.d.ts +1 -1
- package/dist/shared-ui/src/components/ComboChart/ComboChartView.d.ts +1 -1
- package/dist/shared-ui/src/components/DataTable/DataTableRow.d.ts +1 -1
- package/dist/shared-ui/src/components/DataTable/buildTableRepresentation.d.ts +2 -1
- package/dist/shared-ui/src/components/DataTable/helpers.d.ts +2 -1
- package/dist/shared-ui/src/components/PieChart/PieChartView.d.ts +1 -1
- package/dist/shared-ui/src/components/Progress/ProgressView.d.ts +1 -1
- package/dist/shared-ui/src/components/ScatterChart/ScatterChartView.d.ts +1 -1
- package/dist/shared-ui/src/components/SingleStat/SingleStatView.d.ts +1 -1
- package/dist/shared-ui/src/contexts/AliasFields/useInteractiveFields.d.ts +6 -0
- package/dist/{dashboard → shared-ui}/src/contexts/GlobalProvider/GlobalProvider.d.ts +1 -1
- package/dist/shared-ui/src/contexts/GlobalProvider/GlobalProvider.test.d.ts +1 -0
- package/dist/{dashboard → shared-ui}/src/contexts/GlobalProvider/buildImplementationMeta.d.ts +1 -1
- package/dist/{dashboard → shared-ui}/src/contexts/GlobalProvider/useGlobalProvider.d.ts +39 -31
- package/dist/shared-ui/src/errors/InvalidProperty.d.ts +5 -0
- package/dist/shared-ui/src/headlessui/components/switch/switch.d.ts +1 -1
- package/dist/shared-ui/src/headlessui/hooks/use-disposables.d.ts +1 -1
- package/dist/shared-ui/src/headlessui/utils/disposables.d.ts +1 -1
- package/dist/shared-ui/src/types/dashboard.d.ts +130 -0
- package/package.json +1 -1
- /package/dist/{dashboard → shared-ui}/src/contexts/GlobalProvider/useOnDashboardLoadCallback.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/contexts/SessionContext/getStrategy.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/contexts/SessionContext/index.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/contexts/SessionContext/useSessionContext.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/contexts/useDashboardStrategy/runStrategy.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/contexts/useDashboardStrategy/types.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/contexts/useDashboardStrategy.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/contexts/useScheduledReports.d.ts +0 -0
- /package/dist/{dashboard → shared-ui}/src/errors/FailedToSaveError.d.ts +0 -0
package/dist/dashboard.esm.js
CHANGED
|
@@ -1110,6 +1110,17 @@ var FieldNotFoundInDataSet = /*#__PURE__*/function (_ValidationError) {
|
|
|
1110
1110
|
return FieldNotFoundInDataSet;
|
|
1111
1111
|
}(ValidationError);
|
|
1112
1112
|
|
|
1113
|
+
var build$1 = function build(measureAttribute, customField, _queryEngineConfig, dataSet, _queryHasDimension, params) {
|
|
1114
|
+
var _params$aliasFields;
|
|
1115
|
+
var newFieldId = ((_params$aliasFields = params.aliasFields) == null || (_params$aliasFields = _params$aliasFields[dataSet.id]) == null ? void 0 : _params$aliasFields[measureAttribute.field]) || customField.allowedFields[0].id;
|
|
1116
|
+
var newField = {
|
|
1117
|
+
type: 'field',
|
|
1118
|
+
"function": measureAttribute["function"] || 'none',
|
|
1119
|
+
value: newFieldId
|
|
1120
|
+
};
|
|
1121
|
+
return newField;
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1113
1124
|
var VariableNotFoundForVariables = /*#__PURE__*/function (_ValidationError) {
|
|
1114
1125
|
function VariableNotFoundForVariables(variableList, missingVariableId) {
|
|
1115
1126
|
var _this;
|
|
@@ -1136,7 +1147,7 @@ var detect = function detect(input) {
|
|
|
1136
1147
|
}
|
|
1137
1148
|
return matches.length > 0 ? matches : undefined;
|
|
1138
1149
|
};
|
|
1139
|
-
var build$
|
|
1150
|
+
var build$2 = function build(variables) {
|
|
1140
1151
|
if (variables) {
|
|
1141
1152
|
var dashboardDefinedVariables = variables();
|
|
1142
1153
|
logInfo('Detected variables', dashboardDefinedVariables);
|
|
@@ -2061,7 +2072,7 @@ var init$1 = function init(publicName, denominatorFieldId, denominatorAggregate,
|
|
|
2061
2072
|
}, queryEngineConfig)
|
|
2062
2073
|
};
|
|
2063
2074
|
};
|
|
2064
|
-
var build$
|
|
2075
|
+
var build$3 = function build(customField, queryEngineConfig, dataSet, _queryHasDimension, params) {
|
|
2065
2076
|
var _customField$numerato, _customField$numerato2, _customField$denomina, _customField$denomina2;
|
|
2066
2077
|
var queryFiltersFromFilterConfig = combineFiltersFromFilterConfig(params.filterConfig, dataSet, params.timeRangeOptions, params.variables);
|
|
2067
2078
|
var _buildPercentageFilte = buildPercentageFilters(customField, params.variables),
|
|
@@ -2175,7 +2186,7 @@ var init$2 = function init(publicName, leftFieldId, operator, rightFieldId, quer
|
|
|
2175
2186
|
}, queryEngineConfig)
|
|
2176
2187
|
};
|
|
2177
2188
|
};
|
|
2178
|
-
var build$
|
|
2189
|
+
var build$4 = function build(measureAttribute, customField, dataSet, params) {
|
|
2179
2190
|
if (measureAttribute["function"] != 'none') {
|
|
2180
2191
|
return {
|
|
2181
2192
|
type: 'function',
|
|
@@ -2238,7 +2249,7 @@ var init$3 = function init(publicName, leftFieldId, leftFunction, operator, righ
|
|
|
2238
2249
|
rightNested: rightNested
|
|
2239
2250
|
};
|
|
2240
2251
|
};
|
|
2241
|
-
var build$
|
|
2252
|
+
var build$5 = function build(customField, variables) {
|
|
2242
2253
|
var buildSide = function buildSide(fieldId, func, variables, nested) {
|
|
2243
2254
|
var value = useValue(fieldId, variables);
|
|
2244
2255
|
if (nested) {
|
|
@@ -2287,7 +2298,7 @@ var init$4 = function init(publicName, fieldId, func, rule, queryEngineConfig) {
|
|
|
2287
2298
|
}, queryEngineConfig)
|
|
2288
2299
|
};
|
|
2289
2300
|
};
|
|
2290
|
-
var build$
|
|
2301
|
+
var build$6 = function build(field, queryEngineConfig, dataSet, params) {
|
|
2291
2302
|
var queryFilterFromField = convertArrayFilterStructureToQueryFilter(field.rule, params.variables);
|
|
2292
2303
|
var completeFilters = buildQueryCustomMetrics(queryFilterFromField, dataSet, queryEngineConfig, params);
|
|
2293
2304
|
var value = useValue(field.fieldId, params.variables);
|
|
@@ -2329,7 +2340,7 @@ var init$5 = function init(publicName, rules, queryEngineConfig) {
|
|
|
2329
2340
|
}, queryEngineConfig)
|
|
2330
2341
|
};
|
|
2331
2342
|
};
|
|
2332
|
-
var build$
|
|
2343
|
+
var build$7 = function build(measureAttribute, customField, queryEngineConfig, dataSet, params) {
|
|
2333
2344
|
var switchField = {
|
|
2334
2345
|
type: 'switchField',
|
|
2335
2346
|
value: {
|
|
@@ -2377,7 +2388,7 @@ var init$6 = function init(publicName, leftFieldId, dateCalculationFunction, rig
|
|
|
2377
2388
|
}, queryEngineConfig)
|
|
2378
2389
|
};
|
|
2379
2390
|
};
|
|
2380
|
-
var build$
|
|
2391
|
+
var build$8 = function build(measureAttribute, customField, variables) {
|
|
2381
2392
|
var leftValue = useValue(customField.leftFieldId, variables);
|
|
2382
2393
|
var rightValue = useValue(customField.rightFieldId, variables);
|
|
2383
2394
|
if (measureAttribute["function"] != 'none') {
|
|
@@ -2448,7 +2459,7 @@ var OperatorType = /*#__PURE__*/function (OperatorType) {
|
|
|
2448
2459
|
return OperatorType;
|
|
2449
2460
|
}({});
|
|
2450
2461
|
|
|
2451
|
-
var build$
|
|
2462
|
+
var build$9 = function build(measureAttribute, customField, dataSet, queryEngineConfig, params) {
|
|
2452
2463
|
if (customField.metric.type === PropertyType.IfLogic) {
|
|
2453
2464
|
return buildIfLogic(customField.metric, dataSet, queryEngineConfig, params, measureAttribute);
|
|
2454
2465
|
}
|
|
@@ -2643,7 +2654,7 @@ var init$8 = function init(publicName, fieldId, roundToDecimalPlaces, queryEngin
|
|
|
2643
2654
|
}, queryEngineConfig)
|
|
2644
2655
|
};
|
|
2645
2656
|
};
|
|
2646
|
-
var build$
|
|
2657
|
+
var build$a = function build(measureAttribute, customField, variables) {
|
|
2647
2658
|
var value = useValue(customField.fieldId, variables);
|
|
2648
2659
|
var builtRoundedNumber = {
|
|
2649
2660
|
type: 'field',
|
|
@@ -2679,6 +2690,9 @@ var isConditional = function isConditional(field) {
|
|
|
2679
2690
|
var isCustomBuildMetric = function isCustomBuildMetric(field) {
|
|
2680
2691
|
return 'metric' in field;
|
|
2681
2692
|
};
|
|
2693
|
+
var isAliasField = function isAliasField(field) {
|
|
2694
|
+
return 'allowedFields' in field;
|
|
2695
|
+
};
|
|
2682
2696
|
var isDateCalculation = function isDateCalculation(field) {
|
|
2683
2697
|
return 'dateCalculationFunction' in field;
|
|
2684
2698
|
};
|
|
@@ -2694,7 +2708,7 @@ var getCustomFieldCategory = function getCustomFieldCategory(field) {
|
|
|
2694
2708
|
throw "Unrecognised custom field type for custom field; " + JSON.stringify(field);
|
|
2695
2709
|
};
|
|
2696
2710
|
var isCustomField = function isCustomField(field) {
|
|
2697
|
-
return isPercentageField(field) || isSimpleMathField(field) || isAggregateMathField(field) || isRules(field) || isRoundedNumberField(field) || isDateCalculation(field) || isConditional(field) || isCustomBuildMetric(field);
|
|
2711
|
+
return isPercentageField(field) || isSimpleMathField(field) || isAggregateMathField(field) || isRules(field) || isRoundedNumberField(field) || isDateCalculation(field) || isConditional(field) || isCustomBuildMetric(field) || isAliasField(field);
|
|
2698
2712
|
};
|
|
2699
2713
|
|
|
2700
2714
|
/**
|
|
@@ -2702,29 +2716,32 @@ var isCustomField = function isCustomField(field) {
|
|
|
2702
2716
|
* a measure.
|
|
2703
2717
|
*/
|
|
2704
2718
|
var toQueryMeasure = function toQueryMeasure(measureAttribute, customField, queryEngineConfig, dataSet, queryHasDimension, params) {
|
|
2719
|
+
if (isAliasField(customField)) {
|
|
2720
|
+
return build$1(measureAttribute, customField, queryEngineConfig, dataSet, queryHasDimension, params);
|
|
2721
|
+
}
|
|
2705
2722
|
if (isPercentageField(customField)) {
|
|
2706
|
-
return build$
|
|
2723
|
+
return build$3(customField, queryEngineConfig, dataSet, queryHasDimension, params);
|
|
2707
2724
|
}
|
|
2708
2725
|
if (isRules(customField)) {
|
|
2709
|
-
return build$
|
|
2726
|
+
return build$7(measureAttribute, customField, queryEngineConfig, dataSet, params);
|
|
2710
2727
|
}
|
|
2711
2728
|
if (isAggregateMathField(customField)) {
|
|
2712
|
-
return build$
|
|
2729
|
+
return build$5(customField, params.variables);
|
|
2713
2730
|
}
|
|
2714
2731
|
if (isSimpleMathField(customField)) {
|
|
2715
|
-
return build$
|
|
2732
|
+
return build$4(measureAttribute, customField, dataSet, params);
|
|
2716
2733
|
}
|
|
2717
2734
|
if (isRoundedNumberField(customField)) {
|
|
2718
|
-
return build$
|
|
2735
|
+
return build$a(measureAttribute, customField, params.variables);
|
|
2719
2736
|
}
|
|
2720
2737
|
if (isConditional(customField)) {
|
|
2721
|
-
return build$
|
|
2738
|
+
return build$6(customField, queryEngineConfig, dataSet, params);
|
|
2722
2739
|
}
|
|
2723
2740
|
if (isDateCalculation(customField)) {
|
|
2724
|
-
return build$
|
|
2741
|
+
return build$8(measureAttribute, customField, params.variables);
|
|
2725
2742
|
}
|
|
2726
2743
|
if (isCustomBuildMetric(customField)) {
|
|
2727
|
-
return build$
|
|
2744
|
+
return build$9(measureAttribute, customField, dataSet, queryEngineConfig, params);
|
|
2728
2745
|
}
|
|
2729
2746
|
throw "Unsupported custom field type; " + JSON.stringify(customField);
|
|
2730
2747
|
};
|
|
@@ -15135,7 +15152,7 @@ var END_USER_DEFAULT_FEATURE_TOGGLES = {
|
|
|
15135
15152
|
showSavingIndicator: true,
|
|
15136
15153
|
disablePersistingGlobalFiltersLocally: false
|
|
15137
15154
|
};
|
|
15138
|
-
var build$
|
|
15155
|
+
var build$b = function build(partialFeatureToggles, queryEngineConfig, mode, scope) {
|
|
15139
15156
|
var featureToggles = {};
|
|
15140
15157
|
featureToggles = _extends({}, END_USER_DEFAULT_FEATURE_TOGGLES, featureToggles, partialFeatureToggles);
|
|
15141
15158
|
if (mode == 'admin') {
|
|
@@ -15866,7 +15883,7 @@ var defaultDateFilterOptions = function defaultDateFilterOptions() {
|
|
|
15866
15883
|
}
|
|
15867
15884
|
return defaultDateFilterOptions;
|
|
15868
15885
|
};
|
|
15869
|
-
var build$
|
|
15886
|
+
var build$c = function build(textOverride, overrides) {
|
|
15870
15887
|
var timeRangeMapping = defaultTimeRangeMapping(textOverride);
|
|
15871
15888
|
var orderedKeys = Object.keys(DEFAULT_DATETIME_FILTER_OPTIONS).map(function (key) {
|
|
15872
15889
|
return key in timeRangeMapping ? "_vizzly_" + key : key;
|
|
@@ -16198,7 +16215,7 @@ var init$b = function init(overrides, includeComponentTypes, excludeComponentTyp
|
|
|
16198
16215
|
return _extends({}, defaultFormatMapping, overrides.defaultFormats ? overrides.defaultFormats() : {});
|
|
16199
16216
|
},
|
|
16200
16217
|
onEditorUpdate: overrides.onEditorUpdate ? overrides.onEditorUpdate : base.onEditorUpdate,
|
|
16201
|
-
dateFilterOptions: build$
|
|
16218
|
+
dateFilterOptions: build$c(textOverride, overrides.dateFilterOptions),
|
|
16202
16219
|
onSave: overrides.onSave ? overrides.onSave : base.onSave,
|
|
16203
16220
|
onScheduledReportChange: overrides.onScheduledReportChange || base.onScheduledReportChange,
|
|
16204
16221
|
dashboardFilters: overrides.dashboardFilters ? overrides.dashboardFilters : base.dashboardFilters,
|
|
@@ -16252,7 +16269,7 @@ function useSubscription(callback, idOverride, deps) {
|
|
|
16252
16269
|
var useFeatureTogglesSetup = function useFeatureTogglesSetup(mode, overrideFeatureToggles, queryEngineConfig, scope, id) {
|
|
16253
16270
|
var base$1 = base;
|
|
16254
16271
|
var buildInitialFeatureToggles = function () {
|
|
16255
|
-
var updatedFeatureToggles = build$
|
|
16272
|
+
var updatedFeatureToggles = build$b(_.merge({}, base$1.featureToggles, overrideFeatureToggles), queryEngineConfig != null ? queryEngineConfig : base$1.queryEngineConfig, mode || base$1.mode, scope || base$1.scope);
|
|
16256
16273
|
return updatedFeatureToggles;
|
|
16257
16274
|
}();
|
|
16258
16275
|
var _useState = useState(buildInitialFeatureToggles),
|
|
@@ -26683,7 +26700,7 @@ var buildFromQueryAttributes = function buildFromQueryAttributes(dataSet, measur
|
|
|
26683
26700
|
};
|
|
26684
26701
|
};
|
|
26685
26702
|
|
|
26686
|
-
var build$
|
|
26703
|
+
var build$d = buildFromQueryAttributes;
|
|
26687
26704
|
var hasDimensions = function hasDimensions(query) {
|
|
26688
26705
|
return query.group.length > 0;
|
|
26689
26706
|
};
|
|
@@ -26833,12 +26850,12 @@ var useVariables = function useVariables(variables, dashboardId) {
|
|
|
26833
26850
|
subscriptionChanges = _useState2[0],
|
|
26834
26851
|
setSubscriptionChanges = _useState2[1];
|
|
26835
26852
|
useEffect(function () {
|
|
26836
|
-
var staticVariables = build$
|
|
26853
|
+
var staticVariables = build$2(variables);
|
|
26837
26854
|
setVariablesState(staticVariables);
|
|
26838
26855
|
}, [JSON.stringify(variables)]);
|
|
26839
26856
|
useSubscription(function (data) {
|
|
26840
26857
|
if (data.variables) {
|
|
26841
|
-
var staticVariables = build$
|
|
26858
|
+
var staticVariables = build$2(variables);
|
|
26842
26859
|
var updatedVariables = _extends({}, staticVariables, data.variables);
|
|
26843
26860
|
logDebug('Updated variables', updatedVariables);
|
|
26844
26861
|
setSubscriptionChanges(data.variables);
|
|
@@ -26925,10 +26942,16 @@ var watchDataSetFieldChanges = function watchDataSetFieldChanges(dataSet, querya
|
|
|
26925
26942
|
}
|
|
26926
26943
|
};
|
|
26927
26944
|
|
|
26945
|
+
var useGlobalContext = function useGlobalContext() {
|
|
26946
|
+
return useContext(GlobalContext);
|
|
26947
|
+
};
|
|
26948
|
+
var GlobalContext = /*#__PURE__*/createContext(undefined);
|
|
26949
|
+
|
|
26928
26950
|
// How to make sure the queries run when a field in a data set has been changed.
|
|
26929
26951
|
// need to pass in the data sets here
|
|
26930
26952
|
|
|
26931
26953
|
var useQueryEffect = function useQueryEffect(queries, runQueriesCallback, filterConfig, dataSet, componentType, variables) {
|
|
26954
|
+
var _global$aliasFields;
|
|
26932
26955
|
var _useState = useState([]),
|
|
26933
26956
|
results = _useState[0],
|
|
26934
26957
|
setResults = _useState[1];
|
|
@@ -26938,6 +26961,7 @@ var useQueryEffect = function useQueryEffect(queries, runQueriesCallback, filter
|
|
|
26938
26961
|
var _useVariablesInDataSe = useVariablesInDataSet(dataSet, queries, variables),
|
|
26939
26962
|
noOfVariableChanges = _useVariablesInDataSe.noOfVariableChanges;
|
|
26940
26963
|
var watchCustomFieldChangesKey = watchDataSetFieldChanges(dataSet, queries);
|
|
26964
|
+
var global = useGlobalContext();
|
|
26941
26965
|
var hasMeasures = function () {
|
|
26942
26966
|
if (typeof queries === 'object' && queries !== null && 'measure' in queries) {
|
|
26943
26967
|
return Array.isArray(queries.measure) && queries.measure.length > 0;
|
|
@@ -27002,7 +27026,8 @@ var useQueryEffect = function useQueryEffect(queries, runQueriesCallback, filter
|
|
|
27002
27026
|
queries: queries,
|
|
27003
27027
|
filterConfig: filterConfig,
|
|
27004
27028
|
watchCustomFieldChangesKey: watchCustomFieldChangesKey,
|
|
27005
|
-
noOfVariableChanges: noOfVariableChanges
|
|
27029
|
+
noOfVariableChanges: noOfVariableChanges,
|
|
27030
|
+
aliasFields: (global == null || (_global$aliasFields = global.aliasFields) == null ? void 0 : _global$aliasFields[dataSet.id]) || {}
|
|
27006
27031
|
})]);
|
|
27007
27032
|
return {
|
|
27008
27033
|
results: results,
|
|
@@ -73456,7 +73481,6 @@ var VizzlyLoader = /*#__PURE__*/function () {
|
|
|
73456
73481
|
if (this.extraCustomFields) {
|
|
73457
73482
|
dataSets = dataSets.map(function (dataSet) {
|
|
73458
73483
|
var newFields = _this2.extraCustomFields ? _this2.extraCustomFields(dataSet) : [];
|
|
73459
|
-
console.log('adding fields', newFields);
|
|
73460
73484
|
return _extends({}, dataSet, {
|
|
73461
73485
|
fields: [].concat(dataSet.fields, newFields)
|
|
73462
73486
|
});
|
|
@@ -74462,7 +74486,7 @@ function getOptionsOrders(dataSetField) {
|
|
|
74462
74486
|
}
|
|
74463
74487
|
|
|
74464
74488
|
var commonToQueries = function commonToQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
74465
|
-
var _Query$build = build$
|
|
74489
|
+
var _Query$build = build$d(dataSet, attributes.measure, attributes.filter, attributes.order, attributes.dimension,
|
|
74466
74490
|
// @ts-ignore
|
|
74467
74491
|
attributes.timeDimension || null, attributes.limit, attributes.offset, queryEngineConfig, params),
|
|
74468
74492
|
query = _Query$build.query,
|
|
@@ -74486,7 +74510,7 @@ var toQueries$6 = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
74486
74510
|
var measures = [];
|
|
74487
74511
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
74488
74512
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
74489
|
-
var _Query$build = build$
|
|
74513
|
+
var _Query$build = build$d(dataSet, measures, attributes.filter, attributes.order, attributes.dimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params),
|
|
74490
74514
|
query = _Query$build.query,
|
|
74491
74515
|
measureDescription = _Query$build.measureDescription;
|
|
74492
74516
|
var resultFields = toResultFields([measureDescription], queryEngineConfig);
|
|
@@ -74498,7 +74522,7 @@ var toQueries$6 = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
74498
74522
|
|
|
74499
74523
|
var toQueries$7 = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
74500
74524
|
var measures = [].concat(attributes.measure || [], attributes.xMeasure || [], attributes.zMeasure || []);
|
|
74501
|
-
var _Query$build = build$
|
|
74525
|
+
var _Query$build = build$d(dataSet, measures, attributes.filter, attributes.order, attributes.dimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params),
|
|
74502
74526
|
query = _Query$build.query,
|
|
74503
74527
|
measureDescription = _Query$build.measureDescription;
|
|
74504
74528
|
var resultFields = toResultFields([measureDescription], queryEngineConfig);
|
|
@@ -74509,8 +74533,8 @@ var toQueries$7 = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
74509
74533
|
};
|
|
74510
74534
|
|
|
74511
74535
|
var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
74512
|
-
var line = build$
|
|
74513
|
-
var bar = build$
|
|
74536
|
+
var line = build$d(dataSet, attributes.lineMeasure, attributes.filter, attributes.order, attributes.lineDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
74537
|
+
var bar = build$d(dataSet, attributes.barMeasure, attributes.filter, attributes.order, attributes.barDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
74514
74538
|
return {
|
|
74515
74539
|
bar: bar,
|
|
74516
74540
|
line: line
|
|
@@ -74529,8 +74553,8 @@ var toQueries$8 = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
74529
74553
|
};
|
|
74530
74554
|
|
|
74531
74555
|
var buildMainQueries$1 = function buildMainQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
74532
|
-
var line = build$
|
|
74533
|
-
var bar = build$
|
|
74556
|
+
var line = build$d(dataSet, attributes.lineMeasure, attributes.filter, attributes.order, attributes.lineDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
74557
|
+
var bar = build$d(dataSet, attributes.barMeasure, attributes.filter, attributes.order, attributes.barDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
74534
74558
|
return {
|
|
74535
74559
|
bar: bar,
|
|
74536
74560
|
line: line
|
|
@@ -74582,7 +74606,7 @@ var toQueries$k = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
74582
74606
|
var measures = [];
|
|
74583
74607
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
74584
74608
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
74585
|
-
var _Query$build = build$
|
|
74609
|
+
var _Query$build = build$d(dataSet, measures, attributes.filter, attributes.order, attributes.dimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params),
|
|
74586
74610
|
query = _Query$build.query,
|
|
74587
74611
|
measureDescription = _Query$build.measureDescription;
|
|
74588
74612
|
var resultFields = toResultFields([measureDescription], queryEngineConfig);
|
|
@@ -74593,7 +74617,7 @@ var toQueries$k = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
74593
74617
|
};
|
|
74594
74618
|
|
|
74595
74619
|
var buildMainQuery = function buildMainQuery(attributes, dataSet, queryEngineConfig, params) {
|
|
74596
|
-
var _Query$build = build$
|
|
74620
|
+
var _Query$build = build$d(dataSet, attributes.measure, attributes.filter, [], [], null, 1, attributes.offset, queryEngineConfig, params),
|
|
74597
74621
|
query = _Query$build.query,
|
|
74598
74622
|
measureDescription = _Query$build.measureDescription;
|
|
74599
74623
|
|
|
@@ -74621,7 +74645,7 @@ var buildMainQuery = function buildMainQuery(attributes, dataSet, queryEngineCon
|
|
|
74621
74645
|
};
|
|
74622
74646
|
var buildDeltaQuery = function buildDeltaQuery(dataSet, attributes, queryEngineConfig, params) {
|
|
74623
74647
|
if (!attributes.deltaTimeDimension) return null;
|
|
74624
|
-
return build$
|
|
74648
|
+
return build$d(dataSet, attributes.measure, attributes.filter, [{
|
|
74625
74649
|
field: attributes.deltaTimeDimension.field,
|
|
74626
74650
|
direction: 'asc',
|
|
74627
74651
|
"function": attributes.deltaTimeDimension.truncate
|
|
@@ -75461,7 +75485,7 @@ function _toResults() {
|
|
|
75461
75485
|
return _toResults.apply(this, arguments);
|
|
75462
75486
|
}
|
|
75463
75487
|
|
|
75464
|
-
var getRunQueriesCallback = function getRunQueriesCallback(identityConfig, queryEngineConfig, timeRangeOptions, variables, runQueries, data, queryEngineEndpoint, timeZone) {
|
|
75488
|
+
var getRunQueriesCallback = function getRunQueriesCallback(identityConfig, queryEngineConfig, timeRangeOptions, variables, aliasFields, runQueries, data, queryEngineEndpoint, timeZone) {
|
|
75465
75489
|
var _identityConfig$dataA2;
|
|
75466
75490
|
var cacheKeyNamespace = fingerprintOfDashboardAccess(identityConfig.dashboardAccess);
|
|
75467
75491
|
if (runQueries) {
|
|
@@ -75484,7 +75508,8 @@ var getRunQueriesCallback = function getRunQueriesCallback(identityConfig, query
|
|
|
75484
75508
|
filterConfig: params.filterConfig || {},
|
|
75485
75509
|
timeRangeOptions: timeRangeOptions,
|
|
75486
75510
|
timeZone: timeZone,
|
|
75487
|
-
variables: variables
|
|
75511
|
+
variables: variables,
|
|
75512
|
+
aliasFields: aliasFields
|
|
75488
75513
|
});
|
|
75489
75514
|
case 2:
|
|
75490
75515
|
return _context.abrupt("return", _context.sent);
|
|
@@ -75516,7 +75541,8 @@ var getRunQueriesCallback = function getRunQueriesCallback(identityConfig, query
|
|
|
75516
75541
|
filterConfig: params.filterConfig || {},
|
|
75517
75542
|
timeRangeOptions: timeRangeOptions,
|
|
75518
75543
|
timeZone: timeZone,
|
|
75519
|
-
variables: variables
|
|
75544
|
+
variables: variables,
|
|
75545
|
+
aliasFields: aliasFields
|
|
75520
75546
|
});
|
|
75521
75547
|
case 2:
|
|
75522
75548
|
return _context2.abrupt("return", _context2.sent);
|
|
@@ -75551,7 +75577,8 @@ var getRunQueriesCallback = function getRunQueriesCallback(identityConfig, query
|
|
|
75551
75577
|
filterConfig: params.filterConfig || {},
|
|
75552
75578
|
timeRangeOptions: timeRangeOptions,
|
|
75553
75579
|
timeZone: timeZone,
|
|
75554
|
-
variables: variables
|
|
75580
|
+
variables: variables,
|
|
75581
|
+
aliasFields: aliasFields
|
|
75555
75582
|
});
|
|
75556
75583
|
case 2:
|
|
75557
75584
|
return _context3.abrupt("return", _context3.sent);
|
|
@@ -76013,7 +76040,7 @@ var VizzlyServices = /*#__PURE__*/function () {
|
|
|
76013
76040
|
}
|
|
76014
76041
|
return undefined;
|
|
76015
76042
|
}();
|
|
76016
|
-
runQueriesCallback = getRunQueriesCallback(service.identityConfig, service.queryEngineConfig, build$
|
|
76043
|
+
runQueriesCallback = getRunQueriesCallback(service.identityConfig, service.queryEngineConfig, build$c(defaultText, params == null ? void 0 : params.dateFilterOptions), (params == null ? void 0 : params.variables) || {}, (params == null ? void 0 : params.aliasFields) || {}, params == null ? void 0 : params.runQueries, params == null ? void 0 : params.data, queryEngineEndpoint);
|
|
76017
76044
|
fetch = /*#__PURE__*/function () {
|
|
76018
76045
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
76019
76046
|
var _params$abortControll;
|
|
@@ -77495,6 +77522,20 @@ var api = function api(config) {
|
|
|
77495
77522
|
};
|
|
77496
77523
|
};
|
|
77497
77524
|
|
|
77525
|
+
var useAliasFields = function useAliasFields(dashboardId) {
|
|
77526
|
+
var _useState = useState({}),
|
|
77527
|
+
aliasFieldsState = _useState[0],
|
|
77528
|
+
setAliasFieldsState = _useState[1];
|
|
77529
|
+
useSubscription(function (data) {
|
|
77530
|
+
if (data.aliasFields) {
|
|
77531
|
+
setAliasFieldsState(data.aliasFields);
|
|
77532
|
+
}
|
|
77533
|
+
}, dashboardId);
|
|
77534
|
+
return {
|
|
77535
|
+
aliasFields: aliasFieldsState
|
|
77536
|
+
};
|
|
77537
|
+
};
|
|
77538
|
+
|
|
77498
77539
|
var buildQueryEngineSignInUrl = function buildQueryEngineSignInUrl(queryEngineEndpoint, queryEngineAccessToken) {
|
|
77499
77540
|
if (!queryEngineAccessToken) return '';
|
|
77500
77541
|
var authToken = queryEngineAccessToken;
|
|
@@ -77517,891 +77558,364 @@ var FailedToSaveError = /*#__PURE__*/function (_Error) {
|
|
|
77517
77558
|
return FailedToSaveError;
|
|
77518
77559
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
77519
77560
|
|
|
77520
|
-
var
|
|
77521
|
-
|
|
77522
|
-
|
|
77523
|
-
|
|
77524
|
-
|
|
77525
|
-
|
|
77526
|
-
|
|
77527
|
-
|
|
77528
|
-
|
|
77529
|
-
|
|
77530
|
-
|
|
77531
|
-
|
|
77532
|
-
|
|
77533
|
-
var connections = props.statusReport.configs.flatMap(function (c) {
|
|
77534
|
-
return c.connections;
|
|
77535
|
-
});
|
|
77536
|
-
return jsxs("div", {
|
|
77537
|
-
className: styles({
|
|
77538
|
-
display: 'grid',
|
|
77539
|
-
gridTemplateColumns: '1fr',
|
|
77540
|
-
gap: '16px',
|
|
77541
|
-
marginTop: '16px'
|
|
77542
|
-
}),
|
|
77543
|
-
children: [jsx(StatusLine, {
|
|
77544
|
-
status: every(props.statusReport.configs, function (c) {
|
|
77545
|
-
return c.validationErrorDetails === null;
|
|
77546
|
-
}),
|
|
77547
|
-
successMessage: "All configs are valid",
|
|
77548
|
-
errorMessage: "Not all configs are valid",
|
|
77549
|
-
unknownMessage: "We did not run any config validation checks"
|
|
77550
|
-
}), jsx(StatusLine, {
|
|
77551
|
-
status: connections.length > 0 ? every(connections, function (conn) {
|
|
77552
|
-
return !!conn.pingResult;
|
|
77553
|
-
}) : null,
|
|
77554
|
-
successMessage: "All connection checks passed",
|
|
77555
|
-
errorMessage: "Not all connection checks passed",
|
|
77556
|
-
unknownMessage: "We did not run a connection check"
|
|
77557
|
-
}), jsx(StatusLine, {
|
|
77558
|
-
status: !!props.statusReport.projectId ? true : null,
|
|
77559
|
-
successMessage: "Valid project ID",
|
|
77560
|
-
errorMessage: "Failed to find your project ID. Please ensure the VIZZLY_PROJECT_ID environment variable has been set",
|
|
77561
|
-
unknownMessage: "Failed to find your project ID. Please ensure the VIZZLY_PROJECT_ID environment variable has been set"
|
|
77562
|
-
}), jsx(StatusLine, {
|
|
77563
|
-
status: true,
|
|
77564
|
-
successMessage: "Using configs from " + humanReadableList(props.statusReport.configs.flatMap(function (c) {
|
|
77565
|
-
var noConnections = c.connections.length === 0;
|
|
77566
|
-
var noDataSets = c.dataSets.length === 0;
|
|
77567
|
-
var noPublicKeys = c.publicKeys.length === 0;
|
|
77568
|
-
var noSqlViews = c.sqlViews.length === 0;
|
|
77569
|
-
if (noConnections && noDataSets && noPublicKeys && noSqlViews) return [];
|
|
77570
|
-
return [c.source.name];
|
|
77571
|
-
})) + ".",
|
|
77572
|
-
errorMessage: "Failed to load configs",
|
|
77573
|
-
unknownMessage: "Failed to load configs"
|
|
77574
|
-
})]
|
|
77575
|
-
});
|
|
77576
|
-
};
|
|
77577
|
-
var SuccessIcon = function SuccessIcon() {
|
|
77578
|
-
return jsx("svg", {
|
|
77579
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
77580
|
-
fill: "none",
|
|
77581
|
-
viewBox: "0 0 24 24",
|
|
77582
|
-
strokeWidth: 1.5,
|
|
77583
|
-
stroke: "currentColor",
|
|
77584
|
-
className: styles({
|
|
77585
|
-
width: '24px',
|
|
77586
|
-
height: '24px',
|
|
77587
|
-
display: 'inline-block'
|
|
77588
|
-
}),
|
|
77589
|
-
children: jsx("path", {
|
|
77590
|
-
strokeLinecap: "round",
|
|
77591
|
-
strokeLinejoin: "round",
|
|
77592
|
-
d: "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
77593
|
-
})
|
|
77594
|
-
});
|
|
77561
|
+
var getDefaultParentDashboardId = function getDefaultParentDashboardId(parentDashboardId, parentDashboardIdOnDashboardAccessToken, dashboards) {
|
|
77562
|
+
if (parentDashboardId) {
|
|
77563
|
+
var parentDashboard = find$1(dashboards, parentDashboardId);
|
|
77564
|
+
if (!(parentDashboard != null && parentDashboard.parentDashboardId)) {
|
|
77565
|
+
return parentDashboardId;
|
|
77566
|
+
} else {
|
|
77567
|
+
throw '[Vizzly] `parentDashboardId` value must specify an ID for a parent dashboard.';
|
|
77568
|
+
}
|
|
77569
|
+
}
|
|
77570
|
+
var parentDashboards = getParentDashboards(dashboards);
|
|
77571
|
+
var programmaticDashboardId = checkAndReturnProgrammaticDashboardId(parentDashboards);
|
|
77572
|
+
if (programmaticDashboardId) return programmaticDashboardId;
|
|
77573
|
+
return parentDashboardIdOnDashboardAccessToken || getFirstCreated(parentDashboards).id;
|
|
77595
77574
|
};
|
|
77596
|
-
|
|
77597
|
-
|
|
77598
|
-
|
|
77599
|
-
|
|
77600
|
-
|
|
77601
|
-
|
|
77602
|
-
|
|
77603
|
-
className: styles({
|
|
77604
|
-
width: '24px',
|
|
77605
|
-
height: '24px',
|
|
77606
|
-
display: 'inline-block'
|
|
77607
|
-
}),
|
|
77608
|
-
children: jsx("path", {
|
|
77609
|
-
strokeLinecap: "round",
|
|
77610
|
-
strokeLinejoin: "round",
|
|
77611
|
-
d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
|
|
77612
|
-
})
|
|
77575
|
+
|
|
77576
|
+
var getStrategy = function getStrategy(vizzly, requestedEndUserParentDashboardId, requestedEndUserDashboardId, isEditor) {
|
|
77577
|
+
if (!('dashboards' in vizzly)) return undefined;
|
|
77578
|
+
if (vizzly.loading || vizzly.error) return undefined;
|
|
77579
|
+
logDebug('Loading dashboard strategy, with props;', {
|
|
77580
|
+
dashboardId: requestedEndUserDashboardId,
|
|
77581
|
+
parentDashboardId: requestedEndUserParentDashboardId
|
|
77613
77582
|
});
|
|
77614
|
-
|
|
77615
|
-
|
|
77616
|
-
|
|
77617
|
-
|
|
77618
|
-
|
|
77619
|
-
|
|
77620
|
-
|
|
77621
|
-
|
|
77622
|
-
|
|
77623
|
-
|
|
77624
|
-
|
|
77625
|
-
|
|
77626
|
-
|
|
77627
|
-
|
|
77628
|
-
|
|
77629
|
-
|
|
77630
|
-
|
|
77631
|
-
|
|
77583
|
+
|
|
77584
|
+
// This is a temporary fix for the issue where the dashboard is not loaded due to multiple hooks.
|
|
77585
|
+
var checkToStopStrategyCheckingWhenDashboardNotLoadedDueToMultipleHooks = isEditor && vizzly.dashboards.length === 0;
|
|
77586
|
+
if (checkToStopStrategyCheckingWhenDashboardNotLoadedDueToMultipleHooks) return undefined;
|
|
77587
|
+
var defaultParentDashboardId = getDefaultParentDashboardId(requestedEndUserParentDashboardId, vizzly.identityConfig.dashboardAccess.dashboardId, vizzly.dashboards);
|
|
77588
|
+
if (vizzly.accessType == 'admin') {
|
|
77589
|
+
logDebug('Admin access found, so we will show the parent dashboard.', defaultParentDashboardId);
|
|
77590
|
+
var dashboardId = defaultParentDashboardId;
|
|
77591
|
+
|
|
77592
|
+
// If the user wants a specific dashboard, then fetch the parent dashboard of it.
|
|
77593
|
+
if (requestedEndUserDashboardId) {
|
|
77594
|
+
var foundRequestedChildDashboard = vizzly.dashboards.find(function (dashboard) {
|
|
77595
|
+
return dashboard.id == requestedEndUserDashboardId;
|
|
77596
|
+
});
|
|
77597
|
+
if (foundRequestedChildDashboard != null && foundRequestedChildDashboard.parentDashboardId) {
|
|
77598
|
+
logDebug('A child dashboard was provided whilst in admin mode. Therefore the parent of the given child will be shown to administer.', foundRequestedChildDashboard.parentDashboardId);
|
|
77599
|
+
dashboardId = foundRequestedChildDashboard.parentDashboardId;
|
|
77600
|
+
}
|
|
77601
|
+
}
|
|
77602
|
+
logDebug('Admin access found, so we will show the parent dashboard.', dashboardId);
|
|
77603
|
+
return {
|
|
77604
|
+
type: 'exact',
|
|
77605
|
+
dashboardId: dashboardId
|
|
77606
|
+
};
|
|
77607
|
+
}
|
|
77608
|
+
if (requestedEndUserDashboardId) {
|
|
77609
|
+
logDebug('Strategy will be to show dashboard', requestedEndUserDashboardId);
|
|
77610
|
+
return {
|
|
77611
|
+
type: 'exact',
|
|
77612
|
+
dashboardId: requestedEndUserDashboardId
|
|
77613
|
+
};
|
|
77614
|
+
}
|
|
77615
|
+
var childDashboards = vizzly.dashboards.filter(function (d) {
|
|
77616
|
+
var isChildDashboard = d.parentDashboardId != null;
|
|
77617
|
+
var hasNotRequestedEndUserParentDashboardId = requestedEndUserParentDashboardId === undefined;
|
|
77618
|
+
var isChildOfRequestedParent = hasNotRequestedEndUserParentDashboardId || d.parentDashboardId === requestedEndUserParentDashboardId;
|
|
77619
|
+
return isChildDashboard && isChildOfRequestedParent;
|
|
77632
77620
|
});
|
|
77621
|
+
|
|
77622
|
+
// Exactly one child dashboard for the user & in read-only mode so someone else is managing the dashboard with the same userReference.
|
|
77623
|
+
// We will show that one dashboard to allow for a common SaaS environment where
|
|
77624
|
+
// multiple users share the same userReference, but some of those users have `read_write` access and other users have read access.
|
|
77625
|
+
// Those with `read` access should see the dashboard managed by those other users...
|
|
77626
|
+
if (childDashboards.length === 1 && vizzly.identityConfig.dashboardAccess.scope == 'read') {
|
|
77627
|
+
logDebug('Strategy will be to show read-only view of the only child dashboard. If you wish to render a read-only view of the parent dashboard, please make sure the `dashboardId` property matches the `parentDashboardId` property.', defaultParentDashboardId);
|
|
77628
|
+
return {
|
|
77629
|
+
type: 'exact',
|
|
77630
|
+
dashboardId: vizzly.dashboards.find(function (d) {
|
|
77631
|
+
return d.parentDashboardId != null;
|
|
77632
|
+
}).id
|
|
77633
|
+
};
|
|
77634
|
+
}
|
|
77635
|
+
|
|
77636
|
+
// No specific dashboard requested, but dashboard access token only grants 'read' access.
|
|
77637
|
+
if (vizzly.identityConfig.dashboardAccess.scope == 'read' && defaultParentDashboardId) {
|
|
77638
|
+
logDebug('Strategy will be to return read-only view of the parent dashboard.', defaultParentDashboardId);
|
|
77639
|
+
return {
|
|
77640
|
+
type: 'exact',
|
|
77641
|
+
dashboardId: defaultParentDashboardId
|
|
77642
|
+
};
|
|
77643
|
+
}
|
|
77644
|
+
var dashboardIdSetInIdentityConfig = vizzly.identityConfig.dashboardAccess.dashboardId;
|
|
77645
|
+
if (dashboardIdSetInIdentityConfig) {
|
|
77646
|
+
var _vizzly$identityConfi, _vizzly$identityConfi2;
|
|
77647
|
+
logDebug('Strategy will be to show a child of the parent dashboard determined by the identity config', (_vizzly$identityConfi = vizzly.identityConfig.dashboardAccess) == null ? void 0 : _vizzly$identityConfi.dashboardId);
|
|
77648
|
+
return {
|
|
77649
|
+
type: 'instantCopyOf',
|
|
77650
|
+
parentDashboardId: (_vizzly$identityConfi2 = vizzly.identityConfig.dashboardAccess) == null ? void 0 : _vizzly$identityConfi2.dashboardId
|
|
77651
|
+
};
|
|
77652
|
+
} else {
|
|
77653
|
+
logDebug('Strategy will be to show a child of the parent dashboard', defaultParentDashboardId);
|
|
77654
|
+
return {
|
|
77655
|
+
type: 'instantCopyOf',
|
|
77656
|
+
parentDashboardId: defaultParentDashboardId
|
|
77657
|
+
};
|
|
77658
|
+
}
|
|
77633
77659
|
};
|
|
77634
77660
|
|
|
77635
|
-
var
|
|
77636
|
-
|
|
77637
|
-
|
|
77661
|
+
var Mode = /*#__PURE__*/function (Mode) {
|
|
77662
|
+
Mode["Admin"] = "admin";
|
|
77663
|
+
Mode["EndUser"] = "endUser";
|
|
77664
|
+
return Mode;
|
|
77665
|
+
}({});
|
|
77666
|
+
var Scope = /*#__PURE__*/function (Scope) {
|
|
77667
|
+
Scope["Read"] = "read";
|
|
77668
|
+
Scope["ReadWrite"] = "read_write";
|
|
77669
|
+
return Scope;
|
|
77670
|
+
}({});
|
|
77671
|
+
|
|
77672
|
+
/*
|
|
77673
|
+
Currently, we just replicate the same behaviour as what we used to have on the API.
|
|
77674
|
+
*/
|
|
77675
|
+
var runStrategy = /*#__PURE__*/function () {
|
|
77676
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(strategy, vizzly) {
|
|
77677
|
+
var currentDashboard, scope, _parentDashboard$perm, parentDashboard, hasParentDashboardWritePermission, dashboardCopies, mostRecentlyUpdatedChildDashboard, created;
|
|
77638
77678
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
77639
77679
|
while (1) switch (_context.prev = _context.next) {
|
|
77640
77680
|
case 0:
|
|
77641
|
-
|
|
77642
|
-
|
|
77643
|
-
|
|
77644
|
-
|
|
77645
|
-
|
|
77646
|
-
|
|
77647
|
-
abortSignal: abortSignal,
|
|
77648
|
-
body: {}
|
|
77681
|
+
if (!(strategy.type == 'exact')) {
|
|
77682
|
+
_context.next = 9;
|
|
77683
|
+
break;
|
|
77684
|
+
}
|
|
77685
|
+
currentDashboard = vizzly.dashboards.find(function (d) {
|
|
77686
|
+
return d.id === strategy.dashboardId;
|
|
77649
77687
|
});
|
|
77650
|
-
|
|
77651
|
-
|
|
77652
|
-
|
|
77653
|
-
|
|
77654
|
-
|
|
77655
|
-
case
|
|
77688
|
+
if (currentDashboard.permission) {
|
|
77689
|
+
_context.next = 4;
|
|
77690
|
+
break;
|
|
77691
|
+
}
|
|
77692
|
+
throw '';
|
|
77693
|
+
case 4:
|
|
77694
|
+
scope = currentDashboard.permission.scope;
|
|
77695
|
+
logDebug('A specific dashboard has been requested. This will be rendered with', scope, 'scope.', strategy.dashboardId);
|
|
77696
|
+
return _context.abrupt("return", {
|
|
77697
|
+
dashboardId: strategy.dashboardId,
|
|
77698
|
+
mode: scope === 'read_write' && currentDashboard.parentDashboardId === null ? Mode.Admin : Mode.EndUser,
|
|
77699
|
+
scope: scope
|
|
77700
|
+
});
|
|
77701
|
+
case 9:
|
|
77702
|
+
if (!(strategy.type == 'instantCopyOf')) {
|
|
77703
|
+
_context.next = 29;
|
|
77704
|
+
break;
|
|
77705
|
+
}
|
|
77706
|
+
// If the user has write access to the parent dashboard, then we return that dashboard ID, with mode=admin
|
|
77707
|
+
parentDashboard = vizzly.dashboards.find(function (d) {
|
|
77708
|
+
return d.id === strategy.parentDashboardId;
|
|
77709
|
+
});
|
|
77710
|
+
hasParentDashboardWritePermission = ((_parentDashboard$perm = parentDashboard.permission) == null ? void 0 : _parentDashboard$perm.scope) === 'read_write';
|
|
77711
|
+
if (!hasParentDashboardWritePermission) {
|
|
77712
|
+
_context.next = 15;
|
|
77713
|
+
break;
|
|
77714
|
+
}
|
|
77715
|
+
logDebug('Write access to the parent dashboard has been found, so this dashboard will be shown with admin access.', strategy.parentDashboardId);
|
|
77716
|
+
return _context.abrupt("return", {
|
|
77717
|
+
dashboardId: strategy.parentDashboardId,
|
|
77718
|
+
mode: Mode.Admin,
|
|
77719
|
+
scope: Scope.ReadWrite
|
|
77720
|
+
});
|
|
77721
|
+
case 15:
|
|
77722
|
+
dashboardCopies = getCopiesOfParentDashboard(strategy.parentDashboardId, vizzly.dashboards);
|
|
77723
|
+
mostRecentlyUpdatedChildDashboard = takeMostRecentlyUpdated(dashboardCopies);
|
|
77724
|
+
if (!mostRecentlyUpdatedChildDashboard) {
|
|
77725
|
+
_context.next = 20;
|
|
77726
|
+
break;
|
|
77727
|
+
}
|
|
77728
|
+
logDebug('An existing child dashboard exists of the parent dashboard. As no specific dashboardId was provided, we will render the most recently updated child dashboard', mostRecentlyUpdatedChildDashboard.id);
|
|
77729
|
+
return _context.abrupt("return", {
|
|
77730
|
+
dashboardId: mostRecentlyUpdatedChildDashboard.id,
|
|
77731
|
+
mode: Mode.EndUser,
|
|
77732
|
+
scope: mostRecentlyUpdatedChildDashboard.permission.scope
|
|
77733
|
+
});
|
|
77734
|
+
case 20:
|
|
77735
|
+
logDebug('No previous child dashboard has been created on behalf of the current user for the parent dashboard', parentDashboard.id, '. Creating a child copy of the parent.');
|
|
77736
|
+
_context.next = 23;
|
|
77737
|
+
return vizzly.createDashboard({
|
|
77738
|
+
parentDashboardId: parentDashboard.id,
|
|
77739
|
+
definition: toSaveableDefinition(parentDashboard),
|
|
77740
|
+
metadata: {}
|
|
77741
|
+
});
|
|
77742
|
+
case 23:
|
|
77743
|
+
created = _context.sent;
|
|
77744
|
+
if (created) {
|
|
77745
|
+
_context.next = 26;
|
|
77746
|
+
break;
|
|
77747
|
+
}
|
|
77748
|
+
throw 'Failed to create first child dashboard for the user.';
|
|
77749
|
+
case 26:
|
|
77750
|
+
return _context.abrupt("return", {
|
|
77751
|
+
dashboardId: created.id,
|
|
77752
|
+
scope: Scope.ReadWrite,
|
|
77753
|
+
mode: Mode.EndUser
|
|
77754
|
+
});
|
|
77755
|
+
case 29:
|
|
77756
|
+
throw "Unsupported strategy";
|
|
77757
|
+
case 30:
|
|
77656
77758
|
case "end":
|
|
77657
77759
|
return _context.stop();
|
|
77658
77760
|
}
|
|
77659
77761
|
}, _callee);
|
|
77660
77762
|
}));
|
|
77661
|
-
return function
|
|
77763
|
+
return function runStrategy(_x, _x2) {
|
|
77662
77764
|
return _ref.apply(this, arguments);
|
|
77663
77765
|
};
|
|
77664
77766
|
}();
|
|
77665
77767
|
|
|
77666
|
-
|
|
77667
|
-
|
|
77668
|
-
|
|
77669
|
-
|
|
77670
|
-
|
|
77671
|
-
|
|
77672
|
-
|
|
77673
|
-
children: props.children
|
|
77674
|
-
});
|
|
77675
|
-
if (!props.href) return code;
|
|
77676
|
-
return jsx("a", {
|
|
77677
|
-
target: "_blank",
|
|
77678
|
-
href: props.href,
|
|
77679
|
-
children: code
|
|
77680
|
-
});
|
|
77681
|
-
};
|
|
77682
|
-
var ImplementationNotice = function ImplementationNotice(props) {
|
|
77683
|
-
var _useState = useState(undefined),
|
|
77684
|
-
queryEngineStatus = _useState[0],
|
|
77685
|
-
setQueryEngineStatus = _useState[1];
|
|
77768
|
+
/*
|
|
77769
|
+
Stores which dashboard is the currently active one...
|
|
77770
|
+
*/
|
|
77771
|
+
var useDashboardStrategy = function useDashboardStrategy(strategy, vizzly, programmaticDashboard) {
|
|
77772
|
+
var _useState = useState(),
|
|
77773
|
+
state = _useState[0],
|
|
77774
|
+
setState = _useState[1];
|
|
77686
77775
|
useEffect(function () {
|
|
77687
|
-
var
|
|
77688
|
-
|
|
77689
|
-
|
|
77690
|
-
var stop, statusBody;
|
|
77776
|
+
var doWork = /*#__PURE__*/function () {
|
|
77777
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
77778
|
+
var _yield$runStrategy, mode, dashboardId, scope;
|
|
77691
77779
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
77692
77780
|
while (1) switch (_context.prev = _context.next) {
|
|
77693
77781
|
case 0:
|
|
77694
|
-
|
|
77695
|
-
|
|
77696
|
-
|
|
77697
|
-
|
|
77698
|
-
|
|
77699
|
-
|
|
77700
|
-
|
|
77701
|
-
|
|
77702
|
-
|
|
77782
|
+
if ('dashboards' in vizzly) {
|
|
77783
|
+
_context.next = 2;
|
|
77784
|
+
break;
|
|
77785
|
+
}
|
|
77786
|
+
return _context.abrupt("return");
|
|
77787
|
+
case 2:
|
|
77788
|
+
if (strategy) {
|
|
77789
|
+
_context.next = 4;
|
|
77790
|
+
break;
|
|
77791
|
+
}
|
|
77792
|
+
return _context.abrupt("return");
|
|
77703
77793
|
case 4:
|
|
77704
|
-
|
|
77705
|
-
|
|
77706
|
-
|
|
77707
|
-
setQueryEngineStatus(statusBody);
|
|
77708
|
-
} else {
|
|
77709
|
-
setQueryEngineStatus(null);
|
|
77794
|
+
if (!vizzly.loading) {
|
|
77795
|
+
_context.next = 6;
|
|
77796
|
+
break;
|
|
77710
77797
|
}
|
|
77711
|
-
_context.
|
|
77798
|
+
return _context.abrupt("return");
|
|
77799
|
+
case 6:
|
|
77800
|
+
_context.next = 8;
|
|
77801
|
+
return runStrategy(strategy, vizzly);
|
|
77802
|
+
case 8:
|
|
77803
|
+
_yield$runStrategy = _context.sent;
|
|
77804
|
+
mode = _yield$runStrategy.mode;
|
|
77805
|
+
dashboardId = _yield$runStrategy.dashboardId;
|
|
77806
|
+
scope = _yield$runStrategy.scope;
|
|
77807
|
+
if (dashboardId != (state == null ? void 0 : state.dashboardId)) setState({
|
|
77808
|
+
mode: mode,
|
|
77809
|
+
dashboardId: dashboardId,
|
|
77810
|
+
scope: scope
|
|
77811
|
+
});
|
|
77812
|
+
case 13:
|
|
77813
|
+
case "end":
|
|
77814
|
+
return _context.stop();
|
|
77815
|
+
}
|
|
77816
|
+
}, _callee);
|
|
77817
|
+
}));
|
|
77818
|
+
return function doWork() {
|
|
77819
|
+
return _ref.apply(this, arguments);
|
|
77820
|
+
};
|
|
77821
|
+
}();
|
|
77822
|
+
doWork();
|
|
77823
|
+
}, [JSON.stringify({
|
|
77824
|
+
strategy: strategy,
|
|
77825
|
+
loading: vizzly.loading
|
|
77826
|
+
})]);
|
|
77827
|
+
if (!('dashboards' in vizzly)) return null;
|
|
77828
|
+
if (!state) return null;
|
|
77829
|
+
if (vizzly.loading) return null;
|
|
77830
|
+
var dashboard = vizzly.dashboards.find(function (dash) {
|
|
77831
|
+
return dash.id == state.dashboardId;
|
|
77832
|
+
}) || null;
|
|
77833
|
+
return {
|
|
77834
|
+
mode: state.mode,
|
|
77835
|
+
dashboard: dashboard,
|
|
77836
|
+
scope: state.scope,
|
|
77837
|
+
isProgrammaticParent: !!programmaticDashboard
|
|
77838
|
+
};
|
|
77839
|
+
};
|
|
77840
|
+
|
|
77841
|
+
var NoDataSetResolved = /*#__PURE__*/function (_Error) {
|
|
77842
|
+
function NoDataSetResolved() {
|
|
77843
|
+
var _this;
|
|
77844
|
+
_this = _Error.call(this, 'At least one data set must be built for the Vizzly dashboard to render.') || this;
|
|
77845
|
+
_this.name = 'NoDataSetResolved';
|
|
77846
|
+
return _this;
|
|
77847
|
+
}
|
|
77848
|
+
_inheritsLoose(NoDataSetResolved, _Error);
|
|
77849
|
+
return NoDataSetResolved;
|
|
77850
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
77851
|
+
|
|
77852
|
+
var useVizzly = function useVizzly(properties, options) {
|
|
77853
|
+
var _useState = useState({
|
|
77854
|
+
loading: true,
|
|
77855
|
+
error: undefined,
|
|
77856
|
+
dashboards: [],
|
|
77857
|
+
globalLibraries: []
|
|
77858
|
+
}),
|
|
77859
|
+
state = _useState[0],
|
|
77860
|
+
setState = _useState[1];
|
|
77861
|
+
var vizzlyRef = useRef();
|
|
77862
|
+
var vizzly = vizzlyRef.current;
|
|
77863
|
+
useEffect(function () {
|
|
77864
|
+
var abortController = new AbortController();
|
|
77865
|
+
var doWork = /*#__PURE__*/function () {
|
|
77866
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
77867
|
+
var _yield$Promise$all, globalLibraries, dashboards;
|
|
77868
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
77869
|
+
while (1) switch (_context.prev = _context.next) {
|
|
77870
|
+
case 0:
|
|
77871
|
+
_context.prev = 0;
|
|
77872
|
+
_context.next = 3;
|
|
77873
|
+
return Vizzly$1.load(properties, _extends({}, options, {
|
|
77874
|
+
apiHost: (options == null ? void 0 : options.apiHost) || 'https://api.vizzly.co'
|
|
77875
|
+
}));
|
|
77876
|
+
case 3:
|
|
77877
|
+
vizzlyRef.current = _context.sent;
|
|
77878
|
+
_context.next = 6;
|
|
77879
|
+
return Promise.all([vizzlyRef.current.getGlobalLibraries({
|
|
77880
|
+
abortController: abortController
|
|
77881
|
+
}), vizzlyRef.current.getDashboards({
|
|
77882
|
+
abortController: abortController
|
|
77883
|
+
})]);
|
|
77884
|
+
case 6:
|
|
77885
|
+
_yield$Promise$all = _context.sent;
|
|
77886
|
+
globalLibraries = _yield$Promise$all[0];
|
|
77887
|
+
dashboards = _yield$Promise$all[1];
|
|
77888
|
+
setState({
|
|
77889
|
+
loading: false,
|
|
77890
|
+
error: undefined,
|
|
77891
|
+
dashboards: dashboards,
|
|
77892
|
+
globalLibraries: globalLibraries
|
|
77893
|
+
});
|
|
77894
|
+
_context.next = 16;
|
|
77712
77895
|
break;
|
|
77713
|
-
case 9:
|
|
77714
|
-
_context.prev = 9;
|
|
77715
|
-
_context.t0 = _context["catch"](1);
|
|
77716
|
-
setQueryEngineStatus(null);
|
|
77717
77896
|
case 12:
|
|
77897
|
+
_context.prev = 12;
|
|
77898
|
+
_context.t0 = _context["catch"](0);
|
|
77899
|
+
logError('Error loading Vizzly', _context.t0);
|
|
77900
|
+
setState({
|
|
77901
|
+
loading: false,
|
|
77902
|
+
error: _context.t0,
|
|
77903
|
+
dashboards: [].concat(state.dashboards),
|
|
77904
|
+
globalLibraries: [].concat(state.globalLibraries)
|
|
77905
|
+
});
|
|
77906
|
+
case 16:
|
|
77718
77907
|
case "end":
|
|
77719
77908
|
return _context.stop();
|
|
77720
77909
|
}
|
|
77721
|
-
}, _callee, null, [[
|
|
77910
|
+
}, _callee, null, [[0, 12]]);
|
|
77722
77911
|
}));
|
|
77723
|
-
return function
|
|
77912
|
+
return function doWork() {
|
|
77724
77913
|
return _ref.apply(this, arguments);
|
|
77725
77914
|
};
|
|
77726
77915
|
}();
|
|
77727
|
-
|
|
77916
|
+
doWork();
|
|
77728
77917
|
return function () {
|
|
77729
|
-
abortController.abort('
|
|
77730
|
-
};
|
|
77731
|
-
}, []);
|
|
77732
|
-
return jsx(EmptyContainer, {
|
|
77733
|
-
title: "Vizzly set up",
|
|
77734
|
-
renderExtra: function renderExtra() {
|
|
77735
|
-
return jsxs("div", {
|
|
77736
|
-
style: {
|
|
77737
|
-
width: '650px'
|
|
77738
|
-
},
|
|
77739
|
-
children: [props.helpSections.map(function (helpSection, indexHelp) {
|
|
77740
|
-
return jsxs("div", {
|
|
77741
|
-
className: styles({
|
|
77742
|
-
margin: '24px 0',
|
|
77743
|
-
borderRadius: '8px',
|
|
77744
|
-
padding: '12px',
|
|
77745
|
-
backgroundColor: '#f3f5f9'
|
|
77746
|
-
}),
|
|
77747
|
-
children: [jsxs("div", {
|
|
77748
|
-
className: styles({
|
|
77749
|
-
textAlign: 'left'
|
|
77750
|
-
}),
|
|
77751
|
-
children: [jsx("h2", {
|
|
77752
|
-
className: ["" + css.text, styles({
|
|
77753
|
-
fontWeight: 'bold',
|
|
77754
|
-
marginBottom: '12px'
|
|
77755
|
-
})].join(' '),
|
|
77756
|
-
children: helpSection.title
|
|
77757
|
-
}), helpSection.text.map(function (paragraph, index) {
|
|
77758
|
-
return jsx("p", {
|
|
77759
|
-
className: ["" + css.text, styles({
|
|
77760
|
-
marginBottom: '8px'
|
|
77761
|
-
})].join(' '),
|
|
77762
|
-
children: paragraph
|
|
77763
|
-
}, index);
|
|
77764
|
-
})]
|
|
77765
|
-
}), helpSection.callToAction && jsx("div", {
|
|
77766
|
-
className: styles({
|
|
77767
|
-
textAlign: 'right',
|
|
77768
|
-
marginTop: '24px'
|
|
77769
|
-
}),
|
|
77770
|
-
children: jsx("a", {
|
|
77771
|
-
target: "_blank",
|
|
77772
|
-
href: helpSection.callToAction.link,
|
|
77773
|
-
children: jsx(Button$2, {
|
|
77774
|
-
children: helpSection.callToAction.text
|
|
77775
|
-
})
|
|
77776
|
-
})
|
|
77777
|
-
})]
|
|
77778
|
-
}, indexHelp);
|
|
77779
|
-
}), queryEngineStatus !== undefined && jsxs("div", {
|
|
77780
|
-
className: styles({
|
|
77781
|
-
textAlign: 'left',
|
|
77782
|
-
borderRadius: '8px',
|
|
77783
|
-
marginTop: '12px',
|
|
77784
|
-
padding: '12px',
|
|
77785
|
-
width: '100%',
|
|
77786
|
-
backgroundColor: '#f3f5f9'
|
|
77787
|
-
}),
|
|
77788
|
-
children: [queryEngineStatus === null && jsxs(Fragment$1, {
|
|
77789
|
-
children: [jsx("h2", {
|
|
77790
|
-
className: ["" + css.text, styles({
|
|
77791
|
-
fontWeight: 'bold',
|
|
77792
|
-
marginBottom: '12px'
|
|
77793
|
-
})].join(' '),
|
|
77794
|
-
children: "Vizzly Query Engine not found"
|
|
77795
|
-
}), jsxs("p", {
|
|
77796
|
-
className: "" + css.text,
|
|
77797
|
-
children: ["If you have deployed the Vizzly Query Engine, then please set the ", jsx(Code$3, {
|
|
77798
|
-
children: "queryEngineEndpoint"
|
|
77799
|
-
}), ' ', "property to the URL where it is deployed too."]
|
|
77800
|
-
}), jsx("div", {
|
|
77801
|
-
className: styles({
|
|
77802
|
-
textAlign: 'right',
|
|
77803
|
-
marginTop: '8px'
|
|
77804
|
-
}),
|
|
77805
|
-
children: jsx("a", {
|
|
77806
|
-
target: "_blank",
|
|
77807
|
-
href: "https://docs.vizzly.co/query-engines/self-hosted-query-engine",
|
|
77808
|
-
children: jsx(Button$2, {
|
|
77809
|
-
children: "Deploy the Query Engine"
|
|
77810
|
-
})
|
|
77811
|
-
})
|
|
77812
|
-
})]
|
|
77813
|
-
}), queryEngineStatus && jsxs(Fragment$1, {
|
|
77814
|
-
children: [jsx("h2", {
|
|
77815
|
-
className: ["" + css.text, styles({
|
|
77816
|
-
fontWeight: 'bold',
|
|
77817
|
-
margin: '12px 0 '
|
|
77818
|
-
})].join(' '),
|
|
77819
|
-
children: "Query engine status"
|
|
77820
|
-
}), jsx(DisplayStatusReport, {
|
|
77821
|
-
statusReport: queryEngineStatus
|
|
77822
|
-
})]
|
|
77823
|
-
})]
|
|
77824
|
-
})]
|
|
77825
|
-
});
|
|
77826
|
-
}
|
|
77827
|
-
});
|
|
77828
|
-
};
|
|
77829
|
-
var NewSelfHostedVizzlyImplementationNotice = function NewSelfHostedVizzlyImplementationNotice(props) {
|
|
77830
|
-
return jsx(ImplementationNotice, {
|
|
77831
|
-
implementationMeta: props.implementationMeta,
|
|
77832
|
-
helpSections: [{
|
|
77833
|
-
title: 'Identity',
|
|
77834
|
-
callToAction: {
|
|
77835
|
-
link: 'https://docs.vizzly.co/dashboard/properties/identity',
|
|
77836
|
-
text: 'Set up identity'
|
|
77837
|
-
},
|
|
77838
|
-
text: [jsxs(Fragment$1, {
|
|
77839
|
-
children: ["We need to replace the current placeholder ", jsx(Code$3, {
|
|
77840
|
-
children: "identity"
|
|
77841
|
-
}), " function with your own identity logic."]
|
|
77842
|
-
}), 'Typically, this is an HTTPS call to your servers to retrieve the Vizzly identity tokens.']
|
|
77843
|
-
}]
|
|
77844
|
-
});
|
|
77845
|
-
};
|
|
77846
|
-
var TokensNotStrings = function TokensNotStrings(props) {
|
|
77847
|
-
return jsx(ImplementationNotice, {
|
|
77848
|
-
implementationMeta: props.implementationMeta,
|
|
77849
|
-
helpSections: [{
|
|
77850
|
-
title: 'Identity',
|
|
77851
|
-
callToAction: {
|
|
77852
|
-
link: 'https://docs.vizzly.co/dashboard/properties/identity',
|
|
77853
|
-
text: 'See the docs'
|
|
77854
|
-
},
|
|
77855
|
-
text: ['The async identity function must return the Vizzly access tokens in the correct format.']
|
|
77856
|
-
}]
|
|
77857
|
-
});
|
|
77858
|
-
};
|
|
77859
|
-
var AtLeastOneDataSetRequired = function AtLeastOneDataSetRequired(props) {
|
|
77860
|
-
var text = [];
|
|
77861
|
-
switch (props.implementationMeta.type) {
|
|
77862
|
-
case 'custom':
|
|
77863
|
-
case 'in-browser':
|
|
77864
|
-
text = [jsxs(Fragment$1, {
|
|
77865
|
-
children: ["The ", jsx(Code$3, {
|
|
77866
|
-
href: "https://docs.vizzly.co/dashboard/properties/dataSets",
|
|
77867
|
-
children: "dataSets"
|
|
77868
|
-
}), "function must provide at least one data set"]
|
|
77869
|
-
})];
|
|
77870
|
-
break;
|
|
77871
|
-
case 'query-engine':
|
|
77872
|
-
text = [jsx(Fragment$1, {
|
|
77873
|
-
children: "To start using the Vizzly dashboard, you must add a data set to the Vizzly Query Engine."
|
|
77874
|
-
}), jsx(Fragment$1, {
|
|
77875
|
-
children: "If you have already done this, check the `dataSets` value in your identity token to make sure it allows at least one data set to be returned."
|
|
77876
|
-
})];
|
|
77877
|
-
break;
|
|
77878
|
-
}
|
|
77879
|
-
return jsx(ImplementationNotice, {
|
|
77880
|
-
implementationMeta: props.implementationMeta,
|
|
77881
|
-
helpSections: [{
|
|
77882
|
-
title: 'At least one data set must be provided',
|
|
77883
|
-
callToAction: {
|
|
77884
|
-
link: 'https://docs.vizzly.co/dashboard/properties/dataSets',
|
|
77885
|
-
text: 'See the docs'
|
|
77886
|
-
},
|
|
77887
|
-
text: text
|
|
77888
|
-
}]
|
|
77889
|
-
});
|
|
77890
|
-
};
|
|
77891
|
-
var InvalidDataSetsNotice = function InvalidDataSetsNotice(props) {
|
|
77892
|
-
return jsx(ImplementationNotice, {
|
|
77893
|
-
implementationMeta: props.implementationMeta,
|
|
77894
|
-
helpSections: [{
|
|
77895
|
-
title: 'We did not fetch your data sets.',
|
|
77896
|
-
callToAction: {
|
|
77897
|
-
link: 'https://docs.vizzly.co/dashboard/properties/dataSets',
|
|
77898
|
-
text: 'See the docs'
|
|
77899
|
-
},
|
|
77900
|
-
text: [jsxs(Fragment$1, {
|
|
77901
|
-
children: ["If you are using the Vizzly Query Engine, then you will need to set the", ' ', jsx(Code$3, {
|
|
77902
|
-
href: "https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",
|
|
77903
|
-
children: "queryEngineEndpoint"
|
|
77904
|
-
}), ' ', "property on the dashboard."]
|
|
77905
|
-
}), jsxs(Fragment$1, {
|
|
77906
|
-
children: ["Alternatively, if you are not using the Vizzly Query Engine, then the", ' ', jsx(Code$3, {
|
|
77907
|
-
href: "https://docs.vizzly.co/dashboard/properties/dataSets",
|
|
77908
|
-
children: "dataSets"
|
|
77909
|
-
}), " property is required, and it must be an async function."]
|
|
77910
|
-
})]
|
|
77911
|
-
}]
|
|
77912
|
-
});
|
|
77913
|
-
};
|
|
77914
|
-
var InvalidQueryEngineEndpointNotice = function InvalidQueryEngineEndpointNotice(props) {
|
|
77915
|
-
return jsx(ImplementationNotice, {
|
|
77916
|
-
implementationMeta: props.implementationMeta,
|
|
77917
|
-
helpSections: [{
|
|
77918
|
-
title: 'Query Engine Endpoint',
|
|
77919
|
-
callToAction: {
|
|
77920
|
-
link: 'https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint',
|
|
77921
|
-
text: 'See the docs'
|
|
77922
|
-
},
|
|
77923
|
-
text: [jsxs(Fragment$1, {
|
|
77924
|
-
children: ["Incorrect ", jsx(Code$3, {
|
|
77925
|
-
children: "queryEngineEndpoint"
|
|
77926
|
-
}), " value", props.invalidEndpoint ? " (" + JSON.stringify(props.invalidEndpoint) + ")" : '', ". Please deploy the", ' ', jsx("a", {
|
|
77927
|
-
className: styles({
|
|
77928
|
-
textDecoration: 'underline'
|
|
77929
|
-
}),
|
|
77930
|
-
href: "https://docs.vizzly.co/query-engines/self-hosted",
|
|
77931
|
-
children: "Vizzly Query Engine"
|
|
77932
|
-
}), ", and then provide the URL to it as a string, or as an object with a string host value."]
|
|
77933
|
-
})]
|
|
77934
|
-
}]
|
|
77935
|
-
});
|
|
77936
|
-
};
|
|
77937
|
-
var InvalidIdentityFunctionNotice = function InvalidIdentityFunctionNotice(props) {
|
|
77938
|
-
return jsx(ImplementationNotice, {
|
|
77939
|
-
implementationMeta: props.implementationMeta,
|
|
77940
|
-
helpSections: [{
|
|
77941
|
-
title: 'Identity',
|
|
77942
|
-
callToAction: {
|
|
77943
|
-
link: 'https://docs.vizzly.co/dashboard/properties/identity',
|
|
77944
|
-
text: 'See the docs'
|
|
77945
|
-
},
|
|
77946
|
-
text: [jsxs(Fragment$1, {
|
|
77947
|
-
children: [jsx(Code$3, {
|
|
77948
|
-
children: "identity"
|
|
77949
|
-
}), " must be an async function that returns your Vizzly identity tokens."]
|
|
77950
|
-
})]
|
|
77951
|
-
}]
|
|
77952
|
-
});
|
|
77953
|
-
};
|
|
77954
|
-
|
|
77955
|
-
// export const IdentityMustBeCallbackNotice = () => {
|
|
77956
|
-
// return (
|
|
77957
|
-
// <EmptyContainer
|
|
77958
|
-
// title="There is an issue with your configuration settings."
|
|
77959
|
-
// renderExtra={() => (
|
|
77960
|
-
// <p className={`${css.text}`}>See logs for more details.</p>
|
|
77961
|
-
// )}
|
|
77962
|
-
// />
|
|
77963
|
-
// );
|
|
77964
|
-
// };
|
|
77965
|
-
|
|
77966
|
-
// export const InvalidQueryEngineEndpointNotice = (props: {
|
|
77967
|
-
// invalidEndpoint?: string;
|
|
77968
|
-
// invalidType?: boolean;
|
|
77969
|
-
// }) => (
|
|
77970
|
-
// <EmptyContainer
|
|
77971
|
-
// title="Invalid Query Engine Endpoint"
|
|
77972
|
-
// renderExtra={() => (
|
|
77973
|
-
// <>
|
|
77974
|
-
// <p
|
|
77975
|
-
// className={`${css.text}`}
|
|
77976
|
-
// >
|
|
77977
|
-
// Incorrect `queryEngineEndpoint` value{props.invalidEndpoint ? ` (${JSON.stringify(props.invalidEndpoint)})` : ''}.
|
|
77978
|
-
// Please deploy the <a href="https://docs.vizzly.co/query-engines/self-hosted">Vizzly Query Engine</a>, and then provide the URL to it as a string.
|
|
77979
|
-
// </p>
|
|
77980
|
-
// <div>
|
|
77981
|
-
// <Button secondary onClick={() => window.location.reload()}>
|
|
77982
|
-
// Retry
|
|
77983
|
-
// </Button>
|
|
77984
|
-
// </div>
|
|
77985
|
-
// </>
|
|
77986
|
-
// )}
|
|
77987
|
-
// />
|
|
77988
|
-
// );
|
|
77989
|
-
|
|
77990
|
-
var NoDataSetResolved = /*#__PURE__*/function (_Error) {
|
|
77991
|
-
function NoDataSetResolved() {
|
|
77992
|
-
var _this;
|
|
77993
|
-
_this = _Error.call(this, 'At least one data set must be built for the Vizzly dashboard to render.') || this;
|
|
77994
|
-
_this.name = 'NoDataSetResolved';
|
|
77995
|
-
return _this;
|
|
77996
|
-
}
|
|
77997
|
-
_inheritsLoose(NoDataSetResolved, _Error);
|
|
77998
|
-
return NoDataSetResolved;
|
|
77999
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
78000
|
-
|
|
78001
|
-
var SetupError = function SetupError(props) {
|
|
78002
|
-
logError(props.error);
|
|
78003
|
-
var renderedError = jsx("p", {
|
|
78004
|
-
children: "Unknown error"
|
|
78005
|
-
});
|
|
78006
|
-
if (props.error instanceof NoDataSetResolved) {
|
|
78007
|
-
renderedError = jsx(AtLeastOneDataSetRequired, {
|
|
78008
|
-
implementationMeta: props.implementationMeta
|
|
78009
|
-
});
|
|
78010
|
-
}
|
|
78011
|
-
if (props.error instanceof InvalidDataSetsPropType) {
|
|
78012
|
-
renderedError = jsx(InvalidDataSetsNotice, {
|
|
78013
|
-
implementationMeta: props.implementationMeta
|
|
78014
|
-
});
|
|
78015
|
-
}
|
|
78016
|
-
if (props.error instanceof InvalidQueryEngineEndpointType) {
|
|
78017
|
-
renderedError = jsx(InvalidQueryEngineEndpointNotice, {
|
|
78018
|
-
implementationMeta: props.implementationMeta,
|
|
78019
|
-
invalidType: true
|
|
78020
|
-
});
|
|
78021
|
-
}
|
|
78022
|
-
if (props.error instanceof InvalidQueryEngineEndpoint) {
|
|
78023
|
-
renderedError = jsx(InvalidQueryEngineEndpointNotice, {
|
|
78024
|
-
implementationMeta: props.implementationMeta,
|
|
78025
|
-
invalidEndpoint: props.error.invalidEndpoint
|
|
78026
|
-
});
|
|
78027
|
-
}
|
|
78028
|
-
if (props.error instanceof InvalidIdentityPropType) {
|
|
78029
|
-
renderedError = jsx(InvalidIdentityFunctionNotice, {
|
|
78030
|
-
implementationMeta: props.implementationMeta
|
|
78031
|
-
});
|
|
78032
|
-
}
|
|
78033
|
-
if (props.error instanceof FailedToLoadIdentity) {
|
|
78034
|
-
renderedError = jsx(IdentityCallbackFailedNotice, {});
|
|
78035
|
-
}
|
|
78036
|
-
if (props.error instanceof InvalidIdentityReturn) {
|
|
78037
|
-
renderedError = jsx(TokensNotStrings, {
|
|
78038
|
-
implementationMeta: props.implementationMeta
|
|
78039
|
-
});
|
|
78040
|
-
}
|
|
78041
|
-
if (props.error instanceof FailedToLoadQueryEngineConfig) {
|
|
78042
|
-
renderedError = jsx(FailedToLoadQueryEngineConfigNotice, {});
|
|
78043
|
-
}
|
|
78044
|
-
if (props.error instanceof FailedToResolveDataSets) {
|
|
78045
|
-
renderedError = jsx(DatasetMustBeCallbackNotice, {});
|
|
78046
|
-
}
|
|
78047
|
-
if (props.error instanceof NewVizzlyImplementation) {
|
|
78048
|
-
renderedError = jsx(NewSelfHostedVizzlyImplementationNotice, {
|
|
78049
|
-
implementationMeta: props.implementationMeta
|
|
78050
|
-
});
|
|
78051
|
-
}
|
|
78052
|
-
if (props.error instanceof LoadingAborted) {
|
|
78053
|
-
renderedError = jsx(LoadingComponent, {
|
|
78054
|
-
override: props.renderLoadingComponent
|
|
78055
|
-
});
|
|
78056
|
-
}
|
|
78057
|
-
return jsxs(ThemeProvider, {
|
|
78058
|
-
children: [jsx(VizzlyGlobalStyles, {}), renderedError]
|
|
78059
|
-
});
|
|
78060
|
-
};
|
|
78061
|
-
|
|
78062
|
-
var getDefaultParentDashboardId = function getDefaultParentDashboardId(parentDashboardId, parentDashboardIdOnDashboardAccessToken, dashboards) {
|
|
78063
|
-
if (parentDashboardId) {
|
|
78064
|
-
var parentDashboard = find$1(dashboards, parentDashboardId);
|
|
78065
|
-
if (!(parentDashboard != null && parentDashboard.parentDashboardId)) {
|
|
78066
|
-
return parentDashboardId;
|
|
78067
|
-
} else {
|
|
78068
|
-
throw '[Vizzly] `parentDashboardId` value must specify an ID for a parent dashboard.';
|
|
78069
|
-
}
|
|
78070
|
-
}
|
|
78071
|
-
var parentDashboards = getParentDashboards(dashboards);
|
|
78072
|
-
var programmaticDashboardId = checkAndReturnProgrammaticDashboardId(parentDashboards);
|
|
78073
|
-
if (programmaticDashboardId) return programmaticDashboardId;
|
|
78074
|
-
return parentDashboardIdOnDashboardAccessToken || getFirstCreated(parentDashboards).id;
|
|
78075
|
-
};
|
|
78076
|
-
|
|
78077
|
-
var getStrategy = function getStrategy(vizzly, requestedEndUserParentDashboardId, requestedEndUserDashboardId, isEditor) {
|
|
78078
|
-
if (!('dashboards' in vizzly)) return undefined;
|
|
78079
|
-
if (vizzly.loading || vizzly.error) return undefined;
|
|
78080
|
-
logDebug('Loading dashboard strategy, with props;', {
|
|
78081
|
-
dashboardId: requestedEndUserDashboardId,
|
|
78082
|
-
parentDashboardId: requestedEndUserParentDashboardId
|
|
78083
|
-
});
|
|
78084
|
-
// This is a temporary fix for the issue where the dashboard is not loaded due to multiple hooks.
|
|
78085
|
-
var checkToStopStrategyCheckingWhenDashboardNotLoadedDueToMultipleHooks = isEditor && vizzly.dashboards.length === 0;
|
|
78086
|
-
if (checkToStopStrategyCheckingWhenDashboardNotLoadedDueToMultipleHooks) return undefined;
|
|
78087
|
-
var defaultParentDashboardId = getDefaultParentDashboardId(requestedEndUserParentDashboardId, vizzly.identityConfig.dashboardAccess.dashboardId, vizzly.dashboards);
|
|
78088
|
-
if (vizzly.accessType == 'admin') {
|
|
78089
|
-
logDebug('Admin access found, so we will show the parent dashboard.', defaultParentDashboardId);
|
|
78090
|
-
var dashboardId = defaultParentDashboardId;
|
|
78091
|
-
// If the user wants a specific dashboard, then fetch the parent dashboard of it.
|
|
78092
|
-
if (requestedEndUserDashboardId) {
|
|
78093
|
-
var foundRequestedChildDashboard = vizzly.dashboards.find(function (dashboard) {
|
|
78094
|
-
return dashboard.id == requestedEndUserDashboardId;
|
|
78095
|
-
});
|
|
78096
|
-
if (foundRequestedChildDashboard != null && foundRequestedChildDashboard.parentDashboardId) {
|
|
78097
|
-
logDebug('A child dashboard was provided whilst in admin mode. Therefore the parent of the given child will be shown to administer.', foundRequestedChildDashboard.parentDashboardId);
|
|
78098
|
-
dashboardId = foundRequestedChildDashboard.parentDashboardId;
|
|
78099
|
-
}
|
|
78100
|
-
}
|
|
78101
|
-
logDebug('Admin access found, so we will show the parent dashboard.', dashboardId);
|
|
78102
|
-
return {
|
|
78103
|
-
type: 'exact',
|
|
78104
|
-
dashboardId: dashboardId
|
|
78105
|
-
};
|
|
78106
|
-
}
|
|
78107
|
-
if (requestedEndUserDashboardId) {
|
|
78108
|
-
logDebug('Strategy will be to show dashboard', requestedEndUserDashboardId);
|
|
78109
|
-
return {
|
|
78110
|
-
type: 'exact',
|
|
78111
|
-
dashboardId: requestedEndUserDashboardId
|
|
78112
|
-
};
|
|
78113
|
-
}
|
|
78114
|
-
var childDashboards = vizzly.dashboards.filter(function (d) {
|
|
78115
|
-
var isChildDashboard = d.parentDashboardId != null;
|
|
78116
|
-
var hasNotRequestedEndUserParentDashboardId = requestedEndUserParentDashboardId === undefined;
|
|
78117
|
-
var isChildOfRequestedParent = hasNotRequestedEndUserParentDashboardId || d.parentDashboardId === requestedEndUserParentDashboardId;
|
|
78118
|
-
return isChildDashboard && isChildOfRequestedParent;
|
|
78119
|
-
});
|
|
78120
|
-
// Exactly one child dashboard for the user & in read-only mode so someone else is managing the dashboard with the same userReference.
|
|
78121
|
-
// We will show that one dashboard to allow for a common SaaS environment where
|
|
78122
|
-
// multiple users share the same userReference, but some of those users have `read_write` access and other users have read access.
|
|
78123
|
-
// Those with `read` access should see the dashboard managed by those other users...
|
|
78124
|
-
if (childDashboards.length === 1 && vizzly.identityConfig.dashboardAccess.scope == 'read') {
|
|
78125
|
-
logDebug('Strategy will be to show read-only view of the only child dashboard. If you wish to render a read-only view of the parent dashboard, please make sure the `dashboardId` property matches the `parentDashboardId` property.', defaultParentDashboardId);
|
|
78126
|
-
return {
|
|
78127
|
-
type: 'exact',
|
|
78128
|
-
dashboardId: vizzly.dashboards.find(function (d) {
|
|
78129
|
-
return d.parentDashboardId != null;
|
|
78130
|
-
}).id
|
|
78131
|
-
};
|
|
78132
|
-
}
|
|
78133
|
-
// No specific dashboard requested, but dashboard access token only grants 'read' access.
|
|
78134
|
-
if (vizzly.identityConfig.dashboardAccess.scope == 'read' && defaultParentDashboardId) {
|
|
78135
|
-
logDebug('Strategy will be to return read-only view of the parent dashboard.', defaultParentDashboardId);
|
|
78136
|
-
return {
|
|
78137
|
-
type: 'exact',
|
|
78138
|
-
dashboardId: defaultParentDashboardId
|
|
78139
|
-
};
|
|
78140
|
-
}
|
|
78141
|
-
var dashboardIdSetInIdentityConfig = vizzly.identityConfig.dashboardAccess.dashboardId;
|
|
78142
|
-
if (dashboardIdSetInIdentityConfig) {
|
|
78143
|
-
var _vizzly$identityConfi, _vizzly$identityConfi2;
|
|
78144
|
-
logDebug('Strategy will be to show a child of the parent dashboard determined by the identity config', (_vizzly$identityConfi = vizzly.identityConfig.dashboardAccess) == null ? void 0 : _vizzly$identityConfi.dashboardId);
|
|
78145
|
-
return {
|
|
78146
|
-
type: 'instantCopyOf',
|
|
78147
|
-
parentDashboardId: (_vizzly$identityConfi2 = vizzly.identityConfig.dashboardAccess) == null ? void 0 : _vizzly$identityConfi2.dashboardId
|
|
78148
|
-
};
|
|
78149
|
-
} else {
|
|
78150
|
-
logDebug('Strategy will be to show a child of the parent dashboard', defaultParentDashboardId);
|
|
78151
|
-
return {
|
|
78152
|
-
type: 'instantCopyOf',
|
|
78153
|
-
parentDashboardId: defaultParentDashboardId
|
|
78154
|
-
};
|
|
78155
|
-
}
|
|
78156
|
-
};
|
|
78157
|
-
|
|
78158
|
-
var Mode;
|
|
78159
|
-
(function (Mode) {
|
|
78160
|
-
Mode["Admin"] = "admin";
|
|
78161
|
-
Mode["EndUser"] = "endUser";
|
|
78162
|
-
})(Mode || (Mode = {}));
|
|
78163
|
-
var Scope;
|
|
78164
|
-
(function (Scope) {
|
|
78165
|
-
Scope["Read"] = "read";
|
|
78166
|
-
Scope["ReadWrite"] = "read_write";
|
|
78167
|
-
})(Scope || (Scope = {}));
|
|
78168
|
-
|
|
78169
|
-
/*
|
|
78170
|
-
Currently, we just replicate the same behaviour as what we used to have on the API.
|
|
78171
|
-
*/
|
|
78172
|
-
var runStrategy = /*#__PURE__*/function () {
|
|
78173
|
-
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(strategy, vizzly) {
|
|
78174
|
-
var currentDashboard, scope, _parentDashboard$perm, parentDashboard, hasParentDashboardWritePermission, dashboardCopies, mostRecentlyUpdatedChildDashboard, created;
|
|
78175
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78176
|
-
while (1) switch (_context.prev = _context.next) {
|
|
78177
|
-
case 0:
|
|
78178
|
-
if (!(strategy.type == 'exact')) {
|
|
78179
|
-
_context.next = 9;
|
|
78180
|
-
break;
|
|
78181
|
-
}
|
|
78182
|
-
currentDashboard = vizzly.dashboards.find(function (d) {
|
|
78183
|
-
return d.id === strategy.dashboardId;
|
|
78184
|
-
});
|
|
78185
|
-
if (currentDashboard.permission) {
|
|
78186
|
-
_context.next = 4;
|
|
78187
|
-
break;
|
|
78188
|
-
}
|
|
78189
|
-
throw '';
|
|
78190
|
-
case 4:
|
|
78191
|
-
scope = currentDashboard.permission.scope;
|
|
78192
|
-
logDebug('A specific dashboard has been requested. This will be rendered with', scope, 'scope.', strategy.dashboardId);
|
|
78193
|
-
return _context.abrupt("return", {
|
|
78194
|
-
dashboardId: strategy.dashboardId,
|
|
78195
|
-
mode: scope === 'read_write' && currentDashboard.parentDashboardId === null ? Mode.Admin : Mode.EndUser,
|
|
78196
|
-
scope: scope
|
|
78197
|
-
});
|
|
78198
|
-
case 9:
|
|
78199
|
-
if (!(strategy.type == 'instantCopyOf')) {
|
|
78200
|
-
_context.next = 29;
|
|
78201
|
-
break;
|
|
78202
|
-
}
|
|
78203
|
-
// If the user has write access to the parent dashboard, then we return that dashboard ID, with mode=admin
|
|
78204
|
-
parentDashboard = vizzly.dashboards.find(function (d) {
|
|
78205
|
-
return d.id === strategy.parentDashboardId;
|
|
78206
|
-
});
|
|
78207
|
-
hasParentDashboardWritePermission = ((_parentDashboard$perm = parentDashboard.permission) == null ? void 0 : _parentDashboard$perm.scope) === 'read_write';
|
|
78208
|
-
if (!hasParentDashboardWritePermission) {
|
|
78209
|
-
_context.next = 15;
|
|
78210
|
-
break;
|
|
78211
|
-
}
|
|
78212
|
-
logDebug('Write access to the parent dashboard has been found, so this dashboard will be shown with admin access.', strategy.parentDashboardId);
|
|
78213
|
-
return _context.abrupt("return", {
|
|
78214
|
-
dashboardId: strategy.parentDashboardId,
|
|
78215
|
-
mode: Mode.Admin,
|
|
78216
|
-
scope: Scope.ReadWrite
|
|
78217
|
-
});
|
|
78218
|
-
case 15:
|
|
78219
|
-
dashboardCopies = getCopiesOfParentDashboard(strategy.parentDashboardId, vizzly.dashboards);
|
|
78220
|
-
mostRecentlyUpdatedChildDashboard = takeMostRecentlyUpdated(dashboardCopies);
|
|
78221
|
-
if (!mostRecentlyUpdatedChildDashboard) {
|
|
78222
|
-
_context.next = 20;
|
|
78223
|
-
break;
|
|
78224
|
-
}
|
|
78225
|
-
logDebug('An existing child dashboard exists of the parent dashboard. As no specific dashboardId was provided, we will render the most recently updated child dashboard', mostRecentlyUpdatedChildDashboard.id);
|
|
78226
|
-
return _context.abrupt("return", {
|
|
78227
|
-
dashboardId: mostRecentlyUpdatedChildDashboard.id,
|
|
78228
|
-
mode: Mode.EndUser,
|
|
78229
|
-
scope: mostRecentlyUpdatedChildDashboard.permission.scope
|
|
78230
|
-
});
|
|
78231
|
-
case 20:
|
|
78232
|
-
logDebug('No previous child dashboard has been created on behalf of the current user for the parent dashboard', parentDashboard.id, '. Creating a child copy of the parent.');
|
|
78233
|
-
_context.next = 23;
|
|
78234
|
-
return vizzly.createDashboard({
|
|
78235
|
-
parentDashboardId: parentDashboard.id,
|
|
78236
|
-
definition: toSaveableDefinition(parentDashboard),
|
|
78237
|
-
metadata: {}
|
|
78238
|
-
});
|
|
78239
|
-
case 23:
|
|
78240
|
-
created = _context.sent;
|
|
78241
|
-
if (created) {
|
|
78242
|
-
_context.next = 26;
|
|
78243
|
-
break;
|
|
78244
|
-
}
|
|
78245
|
-
throw 'Failed to create first child dashboard for the user.';
|
|
78246
|
-
case 26:
|
|
78247
|
-
return _context.abrupt("return", {
|
|
78248
|
-
dashboardId: created.id,
|
|
78249
|
-
scope: Scope.ReadWrite,
|
|
78250
|
-
mode: Mode.EndUser
|
|
78251
|
-
});
|
|
78252
|
-
case 29:
|
|
78253
|
-
throw "Unsupported strategy";
|
|
78254
|
-
case 30:
|
|
78255
|
-
case "end":
|
|
78256
|
-
return _context.stop();
|
|
78257
|
-
}
|
|
78258
|
-
}, _callee);
|
|
78259
|
-
}));
|
|
78260
|
-
return function runStrategy(_x, _x2) {
|
|
78261
|
-
return _ref.apply(this, arguments);
|
|
78262
|
-
};
|
|
78263
|
-
}();
|
|
78264
|
-
|
|
78265
|
-
/*
|
|
78266
|
-
Stores which dashboard is the currently active one...
|
|
78267
|
-
*/
|
|
78268
|
-
var useDashboardStrategy = function useDashboardStrategy(strategy, vizzly, programmaticDashboard) {
|
|
78269
|
-
var _useState = useState(),
|
|
78270
|
-
state = _useState[0],
|
|
78271
|
-
setState = _useState[1];
|
|
78272
|
-
useEffect(function () {
|
|
78273
|
-
var doWork = /*#__PURE__*/function () {
|
|
78274
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
78275
|
-
var _yield$runStrategy, mode, dashboardId, scope;
|
|
78276
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78277
|
-
while (1) switch (_context.prev = _context.next) {
|
|
78278
|
-
case 0:
|
|
78279
|
-
if ('dashboards' in vizzly) {
|
|
78280
|
-
_context.next = 2;
|
|
78281
|
-
break;
|
|
78282
|
-
}
|
|
78283
|
-
return _context.abrupt("return");
|
|
78284
|
-
case 2:
|
|
78285
|
-
if (strategy) {
|
|
78286
|
-
_context.next = 4;
|
|
78287
|
-
break;
|
|
78288
|
-
}
|
|
78289
|
-
return _context.abrupt("return");
|
|
78290
|
-
case 4:
|
|
78291
|
-
if (!vizzly.loading) {
|
|
78292
|
-
_context.next = 6;
|
|
78293
|
-
break;
|
|
78294
|
-
}
|
|
78295
|
-
return _context.abrupt("return");
|
|
78296
|
-
case 6:
|
|
78297
|
-
_context.next = 8;
|
|
78298
|
-
return runStrategy(strategy, vizzly);
|
|
78299
|
-
case 8:
|
|
78300
|
-
_yield$runStrategy = _context.sent;
|
|
78301
|
-
mode = _yield$runStrategy.mode;
|
|
78302
|
-
dashboardId = _yield$runStrategy.dashboardId;
|
|
78303
|
-
scope = _yield$runStrategy.scope;
|
|
78304
|
-
if (dashboardId != (state == null ? void 0 : state.dashboardId)) setState({
|
|
78305
|
-
mode: mode,
|
|
78306
|
-
dashboardId: dashboardId,
|
|
78307
|
-
scope: scope
|
|
78308
|
-
});
|
|
78309
|
-
case 13:
|
|
78310
|
-
case "end":
|
|
78311
|
-
return _context.stop();
|
|
78312
|
-
}
|
|
78313
|
-
}, _callee);
|
|
78314
|
-
}));
|
|
78315
|
-
return function doWork() {
|
|
78316
|
-
return _ref.apply(this, arguments);
|
|
78317
|
-
};
|
|
78318
|
-
}();
|
|
78319
|
-
doWork();
|
|
78320
|
-
}, [JSON.stringify({
|
|
78321
|
-
strategy: strategy,
|
|
78322
|
-
loading: vizzly.loading
|
|
78323
|
-
})]);
|
|
78324
|
-
if (!('dashboards' in vizzly)) return null;
|
|
78325
|
-
if (!state) return null;
|
|
78326
|
-
if (vizzly.loading) return null;
|
|
78327
|
-
var dashboard = vizzly.dashboards.find(function (dash) {
|
|
78328
|
-
return dash.id == state.dashboardId;
|
|
78329
|
-
}) || null;
|
|
78330
|
-
return {
|
|
78331
|
-
mode: state.mode,
|
|
78332
|
-
dashboard: dashboard,
|
|
78333
|
-
scope: state.scope,
|
|
78334
|
-
isProgrammaticParent: !!programmaticDashboard
|
|
78335
|
-
};
|
|
78336
|
-
};
|
|
78337
|
-
|
|
78338
|
-
var useVizzly = function useVizzly(properties, options) {
|
|
78339
|
-
var _useState = useState({
|
|
78340
|
-
loading: true,
|
|
78341
|
-
error: undefined,
|
|
78342
|
-
dashboards: [],
|
|
78343
|
-
globalLibraries: []
|
|
78344
|
-
}),
|
|
78345
|
-
state = _useState[0],
|
|
78346
|
-
setState = _useState[1];
|
|
78347
|
-
var vizzlyRef = useRef();
|
|
78348
|
-
var vizzly = vizzlyRef.current;
|
|
78349
|
-
useEffect(function () {
|
|
78350
|
-
var abortController = new AbortController();
|
|
78351
|
-
var doWork = /*#__PURE__*/function () {
|
|
78352
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
78353
|
-
var _yield$Promise$all, globalLibraries, dashboards;
|
|
78354
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78355
|
-
while (1) switch (_context.prev = _context.next) {
|
|
78356
|
-
case 0:
|
|
78357
|
-
_context.prev = 0;
|
|
78358
|
-
_context.next = 3;
|
|
78359
|
-
return Vizzly$1.load(properties, _extends({}, options, {
|
|
78360
|
-
apiHost: (options == null ? void 0 : options.apiHost) || 'https://api.vizzly.co'
|
|
78361
|
-
}));
|
|
78362
|
-
case 3:
|
|
78363
|
-
vizzlyRef.current = _context.sent;
|
|
78364
|
-
_context.next = 6;
|
|
78365
|
-
return Promise.all([vizzlyRef.current.getGlobalLibraries({
|
|
78366
|
-
abortController: abortController
|
|
78367
|
-
}), vizzlyRef.current.getDashboards({
|
|
78368
|
-
abortController: abortController
|
|
78369
|
-
})]);
|
|
78370
|
-
case 6:
|
|
78371
|
-
_yield$Promise$all = _context.sent;
|
|
78372
|
-
globalLibraries = _yield$Promise$all[0];
|
|
78373
|
-
dashboards = _yield$Promise$all[1];
|
|
78374
|
-
setState({
|
|
78375
|
-
loading: false,
|
|
78376
|
-
error: undefined,
|
|
78377
|
-
dashboards: dashboards,
|
|
78378
|
-
globalLibraries: globalLibraries
|
|
78379
|
-
});
|
|
78380
|
-
_context.next = 16;
|
|
78381
|
-
break;
|
|
78382
|
-
case 12:
|
|
78383
|
-
_context.prev = 12;
|
|
78384
|
-
_context.t0 = _context["catch"](0);
|
|
78385
|
-
logError('Error loading Vizzly', _context.t0);
|
|
78386
|
-
setState({
|
|
78387
|
-
loading: false,
|
|
78388
|
-
error: _context.t0,
|
|
78389
|
-
dashboards: [].concat(state.dashboards),
|
|
78390
|
-
globalLibraries: [].concat(state.globalLibraries)
|
|
78391
|
-
});
|
|
78392
|
-
case 16:
|
|
78393
|
-
case "end":
|
|
78394
|
-
return _context.stop();
|
|
78395
|
-
}
|
|
78396
|
-
}, _callee, null, [[0, 12]]);
|
|
78397
|
-
}));
|
|
78398
|
-
return function doWork() {
|
|
78399
|
-
return _ref.apply(this, arguments);
|
|
78400
|
-
};
|
|
78401
|
-
}();
|
|
78402
|
-
doWork();
|
|
78403
|
-
return function () {
|
|
78404
|
-
return abortController.abort(new LoadingAborted('We stopped loading Vizzly because of an abort signal triggered by an unmount'));
|
|
77918
|
+
return abortController.abort(new LoadingAborted('We stopped loading Vizzly because of an abort signal triggered by an unmount'));
|
|
78405
77919
|
};
|
|
78406
77920
|
}, []);
|
|
78407
77921
|
var refetch = /*#__PURE__*/function () {
|
|
@@ -78686,182 +78200,712 @@ var useVizzly = function useVizzly(properties, options) {
|
|
|
78686
78200
|
getScheduledReports: getScheduledReports
|
|
78687
78201
|
});
|
|
78688
78202
|
};
|
|
78689
|
-
|
|
78690
|
-
var useScheduledReports = function useScheduledReports(params, dashboardAccessToken) {
|
|
78691
|
-
var _useState = useState([]),
|
|
78692
|
-
reports = _useState[0],
|
|
78693
|
-
setReports = _useState[1];
|
|
78203
|
+
|
|
78204
|
+
var useScheduledReports = function useScheduledReports(params, dashboardAccessToken) {
|
|
78205
|
+
var _useState = useState([]),
|
|
78206
|
+
reports = _useState[0],
|
|
78207
|
+
setReports = _useState[1];
|
|
78208
|
+
useEffect(function () {
|
|
78209
|
+
var doWork = /*#__PURE__*/function () {
|
|
78210
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
78211
|
+
var _yield$params$getSche, _reports;
|
|
78212
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78213
|
+
while (1) switch (_context.prev = _context.next) {
|
|
78214
|
+
case 0:
|
|
78215
|
+
if (!(params.getScheduledReports && dashboardAccessToken)) {
|
|
78216
|
+
_context.next = 6;
|
|
78217
|
+
break;
|
|
78218
|
+
}
|
|
78219
|
+
_context.next = 3;
|
|
78220
|
+
return params.getScheduledReports(dashboardAccessToken);
|
|
78221
|
+
case 3:
|
|
78222
|
+
_yield$params$getSche = _context.sent;
|
|
78223
|
+
_reports = _yield$params$getSche.reports;
|
|
78224
|
+
setReports(_reports);
|
|
78225
|
+
case 6:
|
|
78226
|
+
case "end":
|
|
78227
|
+
return _context.stop();
|
|
78228
|
+
}
|
|
78229
|
+
}, _callee);
|
|
78230
|
+
}));
|
|
78231
|
+
return function doWork() {
|
|
78232
|
+
return _ref.apply(this, arguments);
|
|
78233
|
+
};
|
|
78234
|
+
}();
|
|
78235
|
+
doWork();
|
|
78236
|
+
}, [JSON.stringify({
|
|
78237
|
+
dashboardAccessToken: dashboardAccessToken,
|
|
78238
|
+
loadingVizzly: params
|
|
78239
|
+
})]);
|
|
78240
|
+
var updateScheduledReport = /*#__PURE__*/function () {
|
|
78241
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(reportId, newCron) {
|
|
78242
|
+
var updatedReport, newReports, uniqueNewReports;
|
|
78243
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78244
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
78245
|
+
case 0:
|
|
78246
|
+
if (!(params.updateScheduledReport && dashboardAccessToken)) {
|
|
78247
|
+
_context2.next = 7;
|
|
78248
|
+
break;
|
|
78249
|
+
}
|
|
78250
|
+
_context2.next = 3;
|
|
78251
|
+
return params.updateScheduledReport(dashboardAccessToken, reportId, newCron);
|
|
78252
|
+
case 3:
|
|
78253
|
+
updatedReport = _context2.sent;
|
|
78254
|
+
if (updatedReport === true) {
|
|
78255
|
+
// Remove the deleted report...
|
|
78256
|
+
setReports([].concat(reports).filter(function (r) {
|
|
78257
|
+
return r.id != reportId;
|
|
78258
|
+
}));
|
|
78259
|
+
} else if (updatedReport) {
|
|
78260
|
+
// Upsert the report
|
|
78261
|
+
newReports = [].concat(reports, [updatedReport.report]).map(function (r) {
|
|
78262
|
+
return r.id == reportId ? updatedReport.report : r;
|
|
78263
|
+
});
|
|
78264
|
+
uniqueNewReports = uniqBy(newReports, function (r) {
|
|
78265
|
+
return r.id;
|
|
78266
|
+
});
|
|
78267
|
+
setReports(uniqueNewReports);
|
|
78268
|
+
}
|
|
78269
|
+
_context2.next = 8;
|
|
78270
|
+
break;
|
|
78271
|
+
case 7:
|
|
78272
|
+
console.warn('Function to update scheduled report not loaded.');
|
|
78273
|
+
case 8:
|
|
78274
|
+
case "end":
|
|
78275
|
+
return _context2.stop();
|
|
78276
|
+
}
|
|
78277
|
+
}, _callee2);
|
|
78278
|
+
}));
|
|
78279
|
+
return function updateScheduledReport(_x, _x2) {
|
|
78280
|
+
return _ref2.apply(this, arguments);
|
|
78281
|
+
};
|
|
78282
|
+
}();
|
|
78283
|
+
return {
|
|
78284
|
+
reports: reports,
|
|
78285
|
+
getScheduledReports: params.getScheduledReports,
|
|
78286
|
+
updateScheduledReport: updateScheduledReport
|
|
78287
|
+
};
|
|
78288
|
+
};
|
|
78289
|
+
|
|
78290
|
+
/*
|
|
78291
|
+
A context for managing the dashboard session.
|
|
78292
|
+
*/
|
|
78293
|
+
var STILL_LOADING = null;
|
|
78294
|
+
var useSessionContext = function useSessionContext(params) {
|
|
78295
|
+
var _loadedStrategy$dashb, _loadedStrategy$dashb2;
|
|
78296
|
+
var vizzly = useVizzly({
|
|
78297
|
+
queryEngine: params.queryEngine,
|
|
78298
|
+
identity: params.identityCallback,
|
|
78299
|
+
dataSets: params.loadDataSetsCallback,
|
|
78300
|
+
programmaticDashboard: params.programmaticDashboard,
|
|
78301
|
+
extraCustomFields: params.extraCustomFields
|
|
78302
|
+
}, {
|
|
78303
|
+
apiHost: params.apiConfig.host,
|
|
78304
|
+
developerMode: params.developerMode,
|
|
78305
|
+
textOverrides: params.textOverrides
|
|
78306
|
+
});
|
|
78307
|
+
var loadedStrategy = useDashboardStrategy(getStrategy(vizzly, params.parentDashboardId, params.dashboardId, params.isEditor), vizzly, params.programmaticDashboard);
|
|
78308
|
+
var _useScheduledReports = useScheduledReports(vizzly, loadedStrategy == null || (_loadedStrategy$dashb = loadedStrategy.dashboard) == null || (_loadedStrategy$dashb = _loadedStrategy$dashb.permission) == null ? void 0 : _loadedStrategy$dashb.token),
|
|
78309
|
+
reports = _useScheduledReports.reports,
|
|
78310
|
+
updateScheduledReport = _useScheduledReports.updateScheduledReport;
|
|
78311
|
+
if (!vizzly) return STILL_LOADING;
|
|
78312
|
+
if ('error' in vizzly && vizzly.error) return {
|
|
78313
|
+
error: vizzly.error
|
|
78314
|
+
};
|
|
78315
|
+
if ('loading' in vizzly && vizzly.loading) return STILL_LOADING;
|
|
78316
|
+
if (!('dashboards' in vizzly)) return STILL_LOADING;
|
|
78317
|
+
var _ref = vizzly,
|
|
78318
|
+
identityConfig = _ref.identityConfig,
|
|
78319
|
+
queryEngineConfig = _ref.queryEngineConfig;
|
|
78320
|
+
if (!loadedStrategy) return null;
|
|
78321
|
+
if (((loadedStrategy == null || (_loadedStrategy$dashb2 = loadedStrategy.dashboard) == null ? void 0 : _loadedStrategy$dashb2.dataSets) || []).length === 0) {
|
|
78322
|
+
return {
|
|
78323
|
+
error: new NoDataSetResolved()
|
|
78324
|
+
};
|
|
78325
|
+
}
|
|
78326
|
+
var providedValues = {
|
|
78327
|
+
vizzly: vizzly,
|
|
78328
|
+
scope: loadedStrategy.scope,
|
|
78329
|
+
queryEngineConfig: queryEngineConfig,
|
|
78330
|
+
dashboard: loadedStrategy.dashboard,
|
|
78331
|
+
identityConfig: identityConfig,
|
|
78332
|
+
mode: loadedStrategy.mode,
|
|
78333
|
+
vizzlyApiConfig: params.apiConfig,
|
|
78334
|
+
isProgrammaticParent: loadedStrategy.isProgrammaticParent,
|
|
78335
|
+
globalLibraries: vizzly.globalLibraries,
|
|
78336
|
+
reports: reports,
|
|
78337
|
+
updateScheduledReport: updateScheduledReport
|
|
78338
|
+
};
|
|
78339
|
+
return providedValues;
|
|
78340
|
+
};
|
|
78341
|
+
|
|
78342
|
+
var buildImplementationMeta = function buildImplementationMeta(props) {
|
|
78343
|
+
if ('runQueries' in props) {
|
|
78344
|
+
return {
|
|
78345
|
+
type: 'custom',
|
|
78346
|
+
queryEngineEndpoint: props.queryEngineEndpoint
|
|
78347
|
+
};
|
|
78348
|
+
}
|
|
78349
|
+
if ('data' in props) {
|
|
78350
|
+
return {
|
|
78351
|
+
type: 'in-browser',
|
|
78352
|
+
queryEngineEndpoint: props.queryEngineEndpoint
|
|
78353
|
+
};
|
|
78354
|
+
}
|
|
78355
|
+
return {
|
|
78356
|
+
type: 'query-engine',
|
|
78357
|
+
queryEngineEndpoint: props.queryEngineEndpoint
|
|
78358
|
+
};
|
|
78359
|
+
};
|
|
78360
|
+
|
|
78361
|
+
var useOnDashboardLoadCallback = function useOnDashboardLoadCallback(session, onDashboardLoad, updateDashboardHash) {
|
|
78362
|
+
var _session$dashboard2;
|
|
78363
|
+
useEffect(function () {
|
|
78364
|
+
var _session$dashboard;
|
|
78365
|
+
if (session && 'dashboard' in session && session != null && (_session$dashboard = session.dashboard) != null && _session$dashboard.id) {
|
|
78366
|
+
onDashboardLoad == null || onDashboardLoad({
|
|
78367
|
+
id: session.dashboard.id,
|
|
78368
|
+
metadata: session.dashboard.metadata,
|
|
78369
|
+
scope: session.scope,
|
|
78370
|
+
dataSets: session.dashboard.dataSets
|
|
78371
|
+
});
|
|
78372
|
+
updateDashboardHash(session.dashboard);
|
|
78373
|
+
}
|
|
78374
|
+
}, [JSON.stringify({
|
|
78375
|
+
loaded: !!session,
|
|
78376
|
+
dashboardId: session && 'dashboard' in session && (session == null || (_session$dashboard2 = session.dashboard) == null ? void 0 : _session$dashboard2.id)
|
|
78377
|
+
})]);
|
|
78378
|
+
};
|
|
78379
|
+
|
|
78380
|
+
var StatusLine = function StatusLine(props) {
|
|
78381
|
+
return jsx("div", {
|
|
78382
|
+
children: jsxs("span", {
|
|
78383
|
+
children: [jsxs("span", {
|
|
78384
|
+
className: styles({
|
|
78385
|
+
marginRight: '12px'
|
|
78386
|
+
}),
|
|
78387
|
+
children: [props.status === true && jsx(SuccessIcon, {}), props.status === false && jsx(FailureIcon, {}), props.status === null && jsx(UnknownIcon, {})]
|
|
78388
|
+
}), props.status === true && props.successMessage, props.status === false && props.errorMessage, props.status === null && props.unknownMessage]
|
|
78389
|
+
})
|
|
78390
|
+
});
|
|
78391
|
+
};
|
|
78392
|
+
var DisplayStatusReport = function DisplayStatusReport(props) {
|
|
78393
|
+
var connections = props.statusReport.configs.flatMap(function (c) {
|
|
78394
|
+
return c.connections;
|
|
78395
|
+
});
|
|
78396
|
+
return jsxs("div", {
|
|
78397
|
+
className: styles({
|
|
78398
|
+
display: 'grid',
|
|
78399
|
+
gridTemplateColumns: '1fr',
|
|
78400
|
+
gap: '16px',
|
|
78401
|
+
marginTop: '16px'
|
|
78402
|
+
}),
|
|
78403
|
+
children: [jsx(StatusLine, {
|
|
78404
|
+
status: every(props.statusReport.configs, function (c) {
|
|
78405
|
+
return c.validationErrorDetails === null;
|
|
78406
|
+
}),
|
|
78407
|
+
successMessage: "All configs are valid",
|
|
78408
|
+
errorMessage: "Not all configs are valid",
|
|
78409
|
+
unknownMessage: "We did not run any config validation checks"
|
|
78410
|
+
}), jsx(StatusLine, {
|
|
78411
|
+
status: connections.length > 0 ? every(connections, function (conn) {
|
|
78412
|
+
return !!conn.pingResult;
|
|
78413
|
+
}) : null,
|
|
78414
|
+
successMessage: "All connection checks passed",
|
|
78415
|
+
errorMessage: "Not all connection checks passed",
|
|
78416
|
+
unknownMessage: "We did not run a connection check"
|
|
78417
|
+
}), jsx(StatusLine, {
|
|
78418
|
+
status: !!props.statusReport.projectId ? true : null,
|
|
78419
|
+
successMessage: "Valid project ID",
|
|
78420
|
+
errorMessage: "Failed to find your project ID. Please ensure the VIZZLY_PROJECT_ID environment variable has been set",
|
|
78421
|
+
unknownMessage: "Failed to find your project ID. Please ensure the VIZZLY_PROJECT_ID environment variable has been set"
|
|
78422
|
+
}), jsx(StatusLine, {
|
|
78423
|
+
status: true,
|
|
78424
|
+
successMessage: "Using configs from " + humanReadableList(props.statusReport.configs.flatMap(function (c) {
|
|
78425
|
+
var noConnections = c.connections.length === 0;
|
|
78426
|
+
var noDataSets = c.dataSets.length === 0;
|
|
78427
|
+
var noPublicKeys = c.publicKeys.length === 0;
|
|
78428
|
+
var noSqlViews = c.sqlViews.length === 0;
|
|
78429
|
+
if (noConnections && noDataSets && noPublicKeys && noSqlViews) return [];
|
|
78430
|
+
return [c.source.name];
|
|
78431
|
+
})) + ".",
|
|
78432
|
+
errorMessage: "Failed to load configs",
|
|
78433
|
+
unknownMessage: "Failed to load configs"
|
|
78434
|
+
})]
|
|
78435
|
+
});
|
|
78436
|
+
};
|
|
78437
|
+
var SuccessIcon = function SuccessIcon() {
|
|
78438
|
+
return jsx("svg", {
|
|
78439
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78440
|
+
fill: "none",
|
|
78441
|
+
viewBox: "0 0 24 24",
|
|
78442
|
+
strokeWidth: 1.5,
|
|
78443
|
+
stroke: "currentColor",
|
|
78444
|
+
className: styles({
|
|
78445
|
+
width: '24px',
|
|
78446
|
+
height: '24px',
|
|
78447
|
+
display: 'inline-block'
|
|
78448
|
+
}),
|
|
78449
|
+
children: jsx("path", {
|
|
78450
|
+
strokeLinecap: "round",
|
|
78451
|
+
strokeLinejoin: "round",
|
|
78452
|
+
d: "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
78453
|
+
})
|
|
78454
|
+
});
|
|
78455
|
+
};
|
|
78456
|
+
var FailureIcon = function FailureIcon() {
|
|
78457
|
+
return jsx("svg", {
|
|
78458
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78459
|
+
fill: "none",
|
|
78460
|
+
viewBox: "0 0 24 24",
|
|
78461
|
+
strokeWidth: 1.5,
|
|
78462
|
+
stroke: "currentColor",
|
|
78463
|
+
className: styles({
|
|
78464
|
+
width: '24px',
|
|
78465
|
+
height: '24px',
|
|
78466
|
+
display: 'inline-block'
|
|
78467
|
+
}),
|
|
78468
|
+
children: jsx("path", {
|
|
78469
|
+
strokeLinecap: "round",
|
|
78470
|
+
strokeLinejoin: "round",
|
|
78471
|
+
d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
|
|
78472
|
+
})
|
|
78473
|
+
});
|
|
78474
|
+
};
|
|
78475
|
+
var UnknownIcon = function UnknownIcon() {
|
|
78476
|
+
return jsx("svg", {
|
|
78477
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78478
|
+
fill: "none",
|
|
78479
|
+
viewBox: "0 0 24 24",
|
|
78480
|
+
strokeWidth: 1.5,
|
|
78481
|
+
stroke: "currentColor",
|
|
78482
|
+
className: styles({
|
|
78483
|
+
width: '24px',
|
|
78484
|
+
height: '24px',
|
|
78485
|
+
display: 'inline-block'
|
|
78486
|
+
}),
|
|
78487
|
+
children: jsx("path", {
|
|
78488
|
+
strokeLinecap: "round",
|
|
78489
|
+
strokeLinejoin: "round",
|
|
78490
|
+
d: "M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
78491
|
+
})
|
|
78492
|
+
});
|
|
78493
|
+
};
|
|
78494
|
+
|
|
78495
|
+
var status = /*#__PURE__*/function () {
|
|
78496
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queryEngineEndpoint, abortSignal) {
|
|
78497
|
+
var client, _yield$client, status, body;
|
|
78498
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78499
|
+
while (1) switch (_context.prev = _context.next) {
|
|
78500
|
+
case 0:
|
|
78501
|
+
client = queryEngineHttpClient(queryEngineEndpoint);
|
|
78502
|
+
_context.next = 3;
|
|
78503
|
+
return client({
|
|
78504
|
+
path: '/api/v2/status',
|
|
78505
|
+
method: 'post',
|
|
78506
|
+
mode: 'cors',
|
|
78507
|
+
abortSignal: abortSignal,
|
|
78508
|
+
body: {}
|
|
78509
|
+
});
|
|
78510
|
+
case 3:
|
|
78511
|
+
_yield$client = _context.sent;
|
|
78512
|
+
status = _yield$client.status;
|
|
78513
|
+
body = _yield$client.body;
|
|
78514
|
+
return _context.abrupt("return", status == 200 ? body : null);
|
|
78515
|
+
case 7:
|
|
78516
|
+
case "end":
|
|
78517
|
+
return _context.stop();
|
|
78518
|
+
}
|
|
78519
|
+
}, _callee);
|
|
78520
|
+
}));
|
|
78521
|
+
return function status(_x, _x2) {
|
|
78522
|
+
return _ref.apply(this, arguments);
|
|
78523
|
+
};
|
|
78524
|
+
}();
|
|
78525
|
+
|
|
78526
|
+
var Code$3 = function Code(props) {
|
|
78527
|
+
var code = jsx("code", {
|
|
78528
|
+
style: {
|
|
78529
|
+
background: 'rgba(0, 0, 0, 0.05)',
|
|
78530
|
+
borderRadius: '5px',
|
|
78531
|
+
padding: '2px 5px'
|
|
78532
|
+
},
|
|
78533
|
+
children: props.children
|
|
78534
|
+
});
|
|
78535
|
+
if (!props.href) return code;
|
|
78536
|
+
return jsx("a", {
|
|
78537
|
+
target: "_blank",
|
|
78538
|
+
href: props.href,
|
|
78539
|
+
children: code
|
|
78540
|
+
});
|
|
78541
|
+
};
|
|
78542
|
+
var ImplementationNotice = function ImplementationNotice(props) {
|
|
78543
|
+
var _useState = useState(undefined),
|
|
78544
|
+
queryEngineStatus = _useState[0],
|
|
78545
|
+
setQueryEngineStatus = _useState[1];
|
|
78694
78546
|
useEffect(function () {
|
|
78695
|
-
var
|
|
78696
|
-
|
|
78697
|
-
|
|
78547
|
+
var abortController = new AbortController();
|
|
78548
|
+
var doFetch = /*#__PURE__*/function () {
|
|
78549
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queryEngineEndpoint) {
|
|
78550
|
+
var stop, statusBody;
|
|
78698
78551
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78699
78552
|
while (1) switch (_context.prev = _context.next) {
|
|
78700
78553
|
case 0:
|
|
78701
|
-
|
|
78702
|
-
|
|
78703
|
-
|
|
78554
|
+
stop = setTimeout(function () {
|
|
78555
|
+
if (!abortController.signal.aborted && queryEngineStatus === undefined) {
|
|
78556
|
+
abortController.abort();
|
|
78557
|
+
setQueryEngineStatus(null);
|
|
78558
|
+
}
|
|
78559
|
+
}, 2000);
|
|
78560
|
+
_context.prev = 1;
|
|
78561
|
+
_context.next = 4;
|
|
78562
|
+
return status(queryEngineEndpoint, abortController.signal);
|
|
78563
|
+
case 4:
|
|
78564
|
+
statusBody = _context.sent;
|
|
78565
|
+
clearTimeout(stop);
|
|
78566
|
+
if (statusBody) {
|
|
78567
|
+
setQueryEngineStatus(statusBody);
|
|
78568
|
+
} else {
|
|
78569
|
+
setQueryEngineStatus(null);
|
|
78704
78570
|
}
|
|
78705
|
-
_context.next =
|
|
78706
|
-
|
|
78707
|
-
case
|
|
78708
|
-
|
|
78709
|
-
|
|
78710
|
-
|
|
78711
|
-
case
|
|
78571
|
+
_context.next = 12;
|
|
78572
|
+
break;
|
|
78573
|
+
case 9:
|
|
78574
|
+
_context.prev = 9;
|
|
78575
|
+
_context.t0 = _context["catch"](1);
|
|
78576
|
+
setQueryEngineStatus(null);
|
|
78577
|
+
case 12:
|
|
78712
78578
|
case "end":
|
|
78713
78579
|
return _context.stop();
|
|
78714
78580
|
}
|
|
78715
|
-
}, _callee);
|
|
78581
|
+
}, _callee, null, [[1, 9]]);
|
|
78716
78582
|
}));
|
|
78717
|
-
return function
|
|
78583
|
+
return function doFetch(_x) {
|
|
78718
78584
|
return _ref.apply(this, arguments);
|
|
78719
78585
|
};
|
|
78720
78586
|
}();
|
|
78721
|
-
|
|
78722
|
-
|
|
78723
|
-
|
|
78724
|
-
loadingVizzly: params
|
|
78725
|
-
})]);
|
|
78726
|
-
var updateScheduledReport = /*#__PURE__*/function () {
|
|
78727
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(reportId, newCron) {
|
|
78728
|
-
var updatedReport, newReports, uniqueNewReports;
|
|
78729
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78730
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
78731
|
-
case 0:
|
|
78732
|
-
if (!(params.updateScheduledReport && dashboardAccessToken)) {
|
|
78733
|
-
_context2.next = 7;
|
|
78734
|
-
break;
|
|
78735
|
-
}
|
|
78736
|
-
_context2.next = 3;
|
|
78737
|
-
return params.updateScheduledReport(dashboardAccessToken, reportId, newCron);
|
|
78738
|
-
case 3:
|
|
78739
|
-
updatedReport = _context2.sent;
|
|
78740
|
-
if (updatedReport === true) {
|
|
78741
|
-
// Remove the deleted report...
|
|
78742
|
-
setReports([].concat(reports).filter(function (r) {
|
|
78743
|
-
return r.id != reportId;
|
|
78744
|
-
}));
|
|
78745
|
-
} else if (updatedReport) {
|
|
78746
|
-
// Upsert the report
|
|
78747
|
-
newReports = [].concat(reports, [updatedReport.report]).map(function (r) {
|
|
78748
|
-
return r.id == reportId ? updatedReport.report : r;
|
|
78749
|
-
});
|
|
78750
|
-
uniqueNewReports = uniqBy(newReports, function (r) {
|
|
78751
|
-
return r.id;
|
|
78752
|
-
});
|
|
78753
|
-
setReports(uniqueNewReports);
|
|
78754
|
-
}
|
|
78755
|
-
_context2.next = 8;
|
|
78756
|
-
break;
|
|
78757
|
-
case 7:
|
|
78758
|
-
console.warn('Function to update scheduled report not loaded.');
|
|
78759
|
-
case 8:
|
|
78760
|
-
case "end":
|
|
78761
|
-
return _context2.stop();
|
|
78762
|
-
}
|
|
78763
|
-
}, _callee2);
|
|
78764
|
-
}));
|
|
78765
|
-
return function updateScheduledReport(_x, _x2) {
|
|
78766
|
-
return _ref2.apply(this, arguments);
|
|
78587
|
+
props.implementationMeta.type == 'query-engine' && props.implementationMeta.queryEngineEndpoint && doFetch(props.implementationMeta.queryEngineEndpoint);
|
|
78588
|
+
return function () {
|
|
78589
|
+
abortController.abort('Setup notice unmounted');
|
|
78767
78590
|
};
|
|
78768
|
-
}
|
|
78769
|
-
return {
|
|
78770
|
-
|
|
78771
|
-
|
|
78772
|
-
|
|
78773
|
-
|
|
78591
|
+
}, []);
|
|
78592
|
+
return jsx(EmptyContainer, {
|
|
78593
|
+
title: "Vizzly set up",
|
|
78594
|
+
renderExtra: function renderExtra() {
|
|
78595
|
+
return jsxs("div", {
|
|
78596
|
+
style: {
|
|
78597
|
+
width: '650px'
|
|
78598
|
+
},
|
|
78599
|
+
children: [props.helpSections.map(function (helpSection, indexHelp) {
|
|
78600
|
+
return jsxs("div", {
|
|
78601
|
+
className: styles({
|
|
78602
|
+
margin: '24px 0',
|
|
78603
|
+
borderRadius: '8px',
|
|
78604
|
+
padding: '12px',
|
|
78605
|
+
backgroundColor: '#f3f5f9'
|
|
78606
|
+
}),
|
|
78607
|
+
children: [jsxs("div", {
|
|
78608
|
+
className: styles({
|
|
78609
|
+
textAlign: 'left'
|
|
78610
|
+
}),
|
|
78611
|
+
children: [jsx("h2", {
|
|
78612
|
+
className: ["" + css.text, styles({
|
|
78613
|
+
fontWeight: 'bold',
|
|
78614
|
+
marginBottom: '12px'
|
|
78615
|
+
})].join(' '),
|
|
78616
|
+
children: helpSection.title
|
|
78617
|
+
}), helpSection.text.map(function (paragraph, index) {
|
|
78618
|
+
return jsx("p", {
|
|
78619
|
+
className: ["" + css.text, styles({
|
|
78620
|
+
marginBottom: '8px'
|
|
78621
|
+
})].join(' '),
|
|
78622
|
+
children: paragraph
|
|
78623
|
+
}, index);
|
|
78624
|
+
})]
|
|
78625
|
+
}), helpSection.callToAction && jsx("div", {
|
|
78626
|
+
className: styles({
|
|
78627
|
+
textAlign: 'right',
|
|
78628
|
+
marginTop: '24px'
|
|
78629
|
+
}),
|
|
78630
|
+
children: jsx("a", {
|
|
78631
|
+
target: "_blank",
|
|
78632
|
+
href: helpSection.callToAction.link,
|
|
78633
|
+
children: jsx(Button$2, {
|
|
78634
|
+
children: helpSection.callToAction.text
|
|
78635
|
+
})
|
|
78636
|
+
})
|
|
78637
|
+
})]
|
|
78638
|
+
}, indexHelp);
|
|
78639
|
+
}), queryEngineStatus !== undefined && jsxs("div", {
|
|
78640
|
+
className: styles({
|
|
78641
|
+
textAlign: 'left',
|
|
78642
|
+
borderRadius: '8px',
|
|
78643
|
+
marginTop: '12px',
|
|
78644
|
+
padding: '12px',
|
|
78645
|
+
width: '100%',
|
|
78646
|
+
backgroundColor: '#f3f5f9'
|
|
78647
|
+
}),
|
|
78648
|
+
children: [queryEngineStatus === null && jsxs(Fragment$1, {
|
|
78649
|
+
children: [jsx("h2", {
|
|
78650
|
+
className: ["" + css.text, styles({
|
|
78651
|
+
fontWeight: 'bold',
|
|
78652
|
+
marginBottom: '12px'
|
|
78653
|
+
})].join(' '),
|
|
78654
|
+
children: "Vizzly Query Engine not found"
|
|
78655
|
+
}), jsxs("p", {
|
|
78656
|
+
className: "" + css.text,
|
|
78657
|
+
children: ["If you have deployed the Vizzly Query Engine, then please set the ", jsx(Code$3, {
|
|
78658
|
+
children: "queryEngineEndpoint"
|
|
78659
|
+
}), ' ', "property to the URL where it is deployed too."]
|
|
78660
|
+
}), jsx("div", {
|
|
78661
|
+
className: styles({
|
|
78662
|
+
textAlign: 'right',
|
|
78663
|
+
marginTop: '8px'
|
|
78664
|
+
}),
|
|
78665
|
+
children: jsx("a", {
|
|
78666
|
+
target: "_blank",
|
|
78667
|
+
href: "https://docs.vizzly.co/query-engines/self-hosted-query-engine",
|
|
78668
|
+
children: jsx(Button$2, {
|
|
78669
|
+
children: "Deploy the Query Engine"
|
|
78670
|
+
})
|
|
78671
|
+
})
|
|
78672
|
+
})]
|
|
78673
|
+
}), queryEngineStatus && jsxs(Fragment$1, {
|
|
78674
|
+
children: [jsx("h2", {
|
|
78675
|
+
className: ["" + css.text, styles({
|
|
78676
|
+
fontWeight: 'bold',
|
|
78677
|
+
margin: '12px 0 '
|
|
78678
|
+
})].join(' '),
|
|
78679
|
+
children: "Query engine status"
|
|
78680
|
+
}), jsx(DisplayStatusReport, {
|
|
78681
|
+
statusReport: queryEngineStatus
|
|
78682
|
+
})]
|
|
78683
|
+
})]
|
|
78684
|
+
})]
|
|
78685
|
+
});
|
|
78686
|
+
}
|
|
78687
|
+
});
|
|
78774
78688
|
};
|
|
78775
|
-
|
|
78776
|
-
|
|
78777
|
-
|
|
78778
|
-
|
|
78779
|
-
|
|
78780
|
-
|
|
78781
|
-
|
|
78782
|
-
|
|
78783
|
-
|
|
78784
|
-
|
|
78785
|
-
|
|
78786
|
-
|
|
78787
|
-
|
|
78788
|
-
|
|
78789
|
-
|
|
78790
|
-
developerMode: params.developerMode,
|
|
78791
|
-
textOverrides: params.textOverrides
|
|
78689
|
+
var NewSelfHostedVizzlyImplementationNotice = function NewSelfHostedVizzlyImplementationNotice(props) {
|
|
78690
|
+
return jsx(ImplementationNotice, {
|
|
78691
|
+
implementationMeta: props.implementationMeta,
|
|
78692
|
+
helpSections: [{
|
|
78693
|
+
title: 'Identity',
|
|
78694
|
+
callToAction: {
|
|
78695
|
+
link: 'https://docs.vizzly.co/dashboard/properties/identity',
|
|
78696
|
+
text: 'Set up identity'
|
|
78697
|
+
},
|
|
78698
|
+
text: [jsxs(Fragment$1, {
|
|
78699
|
+
children: ["We need to replace the current placeholder ", jsx(Code$3, {
|
|
78700
|
+
children: "identity"
|
|
78701
|
+
}), " function with your own identity logic."]
|
|
78702
|
+
}), 'Typically, this is an HTTPS call to your servers to retrieve the Vizzly identity tokens.']
|
|
78703
|
+
}]
|
|
78792
78704
|
});
|
|
78793
|
-
var loadedStrategy = useDashboardStrategy(getStrategy(vizzly, params.parentDashboardId, params.dashboardId, params.isEditor), vizzly, params.programmaticDashboard);
|
|
78794
|
-
var _useScheduledReports = useScheduledReports(vizzly, loadedStrategy == null || (_loadedStrategy$dashb = loadedStrategy.dashboard) == null || (_loadedStrategy$dashb = _loadedStrategy$dashb.permission) == null ? void 0 : _loadedStrategy$dashb.token),
|
|
78795
|
-
reports = _useScheduledReports.reports,
|
|
78796
|
-
updateScheduledReport = _useScheduledReports.updateScheduledReport;
|
|
78797
|
-
if (!vizzly) return STILL_LOADING;
|
|
78798
|
-
if ('error' in vizzly && vizzly.error) return {
|
|
78799
|
-
error: vizzly.error
|
|
78800
|
-
};
|
|
78801
|
-
if ('loading' in vizzly && vizzly.loading) return STILL_LOADING;
|
|
78802
|
-
if (!('dashboards' in vizzly)) return STILL_LOADING;
|
|
78803
|
-
var identityConfig = vizzly.identityConfig,
|
|
78804
|
-
queryEngineConfig = vizzly.queryEngineConfig;
|
|
78805
|
-
if (!loadedStrategy) return null;
|
|
78806
|
-
if (((loadedStrategy == null || (_loadedStrategy$dashb2 = loadedStrategy.dashboard) == null ? void 0 : _loadedStrategy$dashb2.dataSets) || []).length === 0) {
|
|
78807
|
-
return {
|
|
78808
|
-
error: new NoDataSetResolved()
|
|
78809
|
-
};
|
|
78810
|
-
}
|
|
78811
|
-
var providedValues = {
|
|
78812
|
-
vizzly: vizzly,
|
|
78813
|
-
scope: loadedStrategy.scope,
|
|
78814
|
-
queryEngineConfig: queryEngineConfig,
|
|
78815
|
-
dashboard: loadedStrategy.dashboard,
|
|
78816
|
-
identityConfig: identityConfig,
|
|
78817
|
-
mode: loadedStrategy.mode,
|
|
78818
|
-
vizzlyApiConfig: params.apiConfig,
|
|
78819
|
-
isProgrammaticParent: loadedStrategy.isProgrammaticParent,
|
|
78820
|
-
globalLibraries: vizzly.globalLibraries,
|
|
78821
|
-
reports: reports,
|
|
78822
|
-
updateScheduledReport: updateScheduledReport
|
|
78823
|
-
};
|
|
78824
|
-
return providedValues;
|
|
78825
78705
|
};
|
|
78826
|
-
|
|
78827
|
-
|
|
78828
|
-
|
|
78829
|
-
|
|
78830
|
-
|
|
78831
|
-
|
|
78832
|
-
|
|
78833
|
-
|
|
78834
|
-
|
|
78835
|
-
|
|
78836
|
-
|
|
78837
|
-
|
|
78838
|
-
|
|
78706
|
+
var TokensNotStrings = function TokensNotStrings(props) {
|
|
78707
|
+
return jsx(ImplementationNotice, {
|
|
78708
|
+
implementationMeta: props.implementationMeta,
|
|
78709
|
+
helpSections: [{
|
|
78710
|
+
title: 'Identity',
|
|
78711
|
+
callToAction: {
|
|
78712
|
+
link: 'https://docs.vizzly.co/dashboard/properties/identity',
|
|
78713
|
+
text: 'See the docs'
|
|
78714
|
+
},
|
|
78715
|
+
text: ['The async identity function must return the Vizzly access tokens in the correct format.']
|
|
78716
|
+
}]
|
|
78717
|
+
});
|
|
78718
|
+
};
|
|
78719
|
+
var AtLeastOneDataSetRequired = function AtLeastOneDataSetRequired(props) {
|
|
78720
|
+
var text = [];
|
|
78721
|
+
switch (props.implementationMeta.type) {
|
|
78722
|
+
case 'custom':
|
|
78723
|
+
case 'in-browser':
|
|
78724
|
+
text = [jsxs(Fragment$1, {
|
|
78725
|
+
children: ["The ", jsx(Code$3, {
|
|
78726
|
+
href: "https://docs.vizzly.co/dashboard/properties/dataSets",
|
|
78727
|
+
children: "dataSets"
|
|
78728
|
+
}), "function must provide at least one data set"]
|
|
78729
|
+
})];
|
|
78730
|
+
break;
|
|
78731
|
+
case 'query-engine':
|
|
78732
|
+
text = [jsx(Fragment$1, {
|
|
78733
|
+
children: "To start using the Vizzly dashboard, you must add a data set to the Vizzly Query Engine."
|
|
78734
|
+
}), jsx(Fragment$1, {
|
|
78735
|
+
children: "If you have already done this, check the `dataSets` value in your identity token to make sure it allows at least one data set to be returned."
|
|
78736
|
+
})];
|
|
78737
|
+
break;
|
|
78839
78738
|
}
|
|
78840
|
-
return {
|
|
78841
|
-
|
|
78842
|
-
|
|
78843
|
-
|
|
78739
|
+
return jsx(ImplementationNotice, {
|
|
78740
|
+
implementationMeta: props.implementationMeta,
|
|
78741
|
+
helpSections: [{
|
|
78742
|
+
title: 'At least one data set must be provided',
|
|
78743
|
+
callToAction: {
|
|
78744
|
+
link: 'https://docs.vizzly.co/dashboard/properties/dataSets',
|
|
78745
|
+
text: 'See the docs'
|
|
78746
|
+
},
|
|
78747
|
+
text: text
|
|
78748
|
+
}]
|
|
78749
|
+
});
|
|
78750
|
+
};
|
|
78751
|
+
var InvalidDataSetsNotice = function InvalidDataSetsNotice(props) {
|
|
78752
|
+
return jsx(ImplementationNotice, {
|
|
78753
|
+
implementationMeta: props.implementationMeta,
|
|
78754
|
+
helpSections: [{
|
|
78755
|
+
title: 'We did not fetch your data sets.',
|
|
78756
|
+
callToAction: {
|
|
78757
|
+
link: 'https://docs.vizzly.co/dashboard/properties/dataSets',
|
|
78758
|
+
text: 'See the docs'
|
|
78759
|
+
},
|
|
78760
|
+
text: [jsxs(Fragment$1, {
|
|
78761
|
+
children: ["If you are using the Vizzly Query Engine, then you will need to set the", ' ', jsx(Code$3, {
|
|
78762
|
+
href: "https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",
|
|
78763
|
+
children: "queryEngineEndpoint"
|
|
78764
|
+
}), ' ', "property on the dashboard."]
|
|
78765
|
+
}), jsxs(Fragment$1, {
|
|
78766
|
+
children: ["Alternatively, if you are not using the Vizzly Query Engine, then the", ' ', jsx(Code$3, {
|
|
78767
|
+
href: "https://docs.vizzly.co/dashboard/properties/dataSets",
|
|
78768
|
+
children: "dataSets"
|
|
78769
|
+
}), " property is required, and it must be an async function."]
|
|
78770
|
+
})]
|
|
78771
|
+
}]
|
|
78772
|
+
});
|
|
78773
|
+
};
|
|
78774
|
+
var InvalidQueryEngineEndpointNotice = function InvalidQueryEngineEndpointNotice(props) {
|
|
78775
|
+
return jsx(ImplementationNotice, {
|
|
78776
|
+
implementationMeta: props.implementationMeta,
|
|
78777
|
+
helpSections: [{
|
|
78778
|
+
title: 'Query Engine Endpoint',
|
|
78779
|
+
callToAction: {
|
|
78780
|
+
link: 'https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint',
|
|
78781
|
+
text: 'See the docs'
|
|
78782
|
+
},
|
|
78783
|
+
text: [jsxs(Fragment$1, {
|
|
78784
|
+
children: ["Incorrect ", jsx(Code$3, {
|
|
78785
|
+
children: "queryEngineEndpoint"
|
|
78786
|
+
}), " value", props.invalidEndpoint ? " (" + JSON.stringify(props.invalidEndpoint) + ")" : '', ". Please deploy the", ' ', jsx("a", {
|
|
78787
|
+
className: styles({
|
|
78788
|
+
textDecoration: 'underline'
|
|
78789
|
+
}),
|
|
78790
|
+
href: "https://docs.vizzly.co/query-engines/self-hosted",
|
|
78791
|
+
children: "Vizzly Query Engine"
|
|
78792
|
+
}), ", and then provide the URL to it as a string, or as an object with a string host value."]
|
|
78793
|
+
})]
|
|
78794
|
+
}]
|
|
78795
|
+
});
|
|
78796
|
+
};
|
|
78797
|
+
var InvalidIdentityFunctionNotice = function InvalidIdentityFunctionNotice(props) {
|
|
78798
|
+
return jsx(ImplementationNotice, {
|
|
78799
|
+
implementationMeta: props.implementationMeta,
|
|
78800
|
+
helpSections: [{
|
|
78801
|
+
title: 'Identity',
|
|
78802
|
+
callToAction: {
|
|
78803
|
+
link: 'https://docs.vizzly.co/dashboard/properties/identity',
|
|
78804
|
+
text: 'See the docs'
|
|
78805
|
+
},
|
|
78806
|
+
text: [jsxs(Fragment$1, {
|
|
78807
|
+
children: [jsx(Code$3, {
|
|
78808
|
+
children: "identity"
|
|
78809
|
+
}), " must be an async function that returns your Vizzly identity tokens."]
|
|
78810
|
+
})]
|
|
78811
|
+
}]
|
|
78812
|
+
});
|
|
78844
78813
|
};
|
|
78845
78814
|
|
|
78846
|
-
|
|
78815
|
+
// export const IdentityMustBeCallbackNotice = () => {
|
|
78816
|
+
// return (
|
|
78817
|
+
// <EmptyContainer
|
|
78818
|
+
// title="There is an issue with your configuration settings."
|
|
78819
|
+
// renderExtra={() => (
|
|
78820
|
+
// <p className={`${css.text}`}>See logs for more details.</p>
|
|
78821
|
+
// )}
|
|
78822
|
+
// />
|
|
78823
|
+
// );
|
|
78824
|
+
// };
|
|
78847
78825
|
|
|
78848
|
-
|
|
78849
|
-
|
|
78850
|
-
|
|
78851
|
-
|
|
78852
|
-
|
|
78853
|
-
|
|
78854
|
-
|
|
78855
|
-
|
|
78856
|
-
|
|
78857
|
-
|
|
78858
|
-
|
|
78859
|
-
|
|
78860
|
-
|
|
78861
|
-
|
|
78862
|
-
|
|
78863
|
-
|
|
78864
|
-
|
|
78826
|
+
// export const InvalidQueryEngineEndpointNotice = (props: {
|
|
78827
|
+
// invalidEndpoint?: string;
|
|
78828
|
+
// invalidType?: boolean;
|
|
78829
|
+
// }) => (
|
|
78830
|
+
// <EmptyContainer
|
|
78831
|
+
// title="Invalid Query Engine Endpoint"
|
|
78832
|
+
// renderExtra={() => (
|
|
78833
|
+
// <>
|
|
78834
|
+
// <p
|
|
78835
|
+
// className={`${css.text}`}
|
|
78836
|
+
// >
|
|
78837
|
+
// Incorrect `queryEngineEndpoint` value{props.invalidEndpoint ? ` (${JSON.stringify(props.invalidEndpoint)})` : ''}.
|
|
78838
|
+
// Please deploy the <a href="https://docs.vizzly.co/query-engines/self-hosted">Vizzly Query Engine</a>, and then provide the URL to it as a string.
|
|
78839
|
+
// </p>
|
|
78840
|
+
// <div>
|
|
78841
|
+
// <Button secondary onClick={() => window.location.reload()}>
|
|
78842
|
+
// Retry
|
|
78843
|
+
// </Button>
|
|
78844
|
+
// </div>
|
|
78845
|
+
// </>
|
|
78846
|
+
// )}
|
|
78847
|
+
// />
|
|
78848
|
+
// );
|
|
78849
|
+
|
|
78850
|
+
var SetupError = function SetupError(props) {
|
|
78851
|
+
logError(props.error);
|
|
78852
|
+
var renderedError = jsx("p", {
|
|
78853
|
+
children: "Unknown error"
|
|
78854
|
+
});
|
|
78855
|
+
if (props.error instanceof NoDataSetResolved) {
|
|
78856
|
+
renderedError = jsx(AtLeastOneDataSetRequired, {
|
|
78857
|
+
implementationMeta: props.implementationMeta
|
|
78858
|
+
});
|
|
78859
|
+
}
|
|
78860
|
+
if (props.error instanceof InvalidDataSetsPropType) {
|
|
78861
|
+
renderedError = jsx(InvalidDataSetsNotice, {
|
|
78862
|
+
implementationMeta: props.implementationMeta
|
|
78863
|
+
});
|
|
78864
|
+
}
|
|
78865
|
+
if (props.error instanceof InvalidQueryEngineEndpointType) {
|
|
78866
|
+
renderedError = jsx(InvalidQueryEngineEndpointNotice, {
|
|
78867
|
+
implementationMeta: props.implementationMeta,
|
|
78868
|
+
invalidType: true
|
|
78869
|
+
});
|
|
78870
|
+
}
|
|
78871
|
+
if (props.error instanceof InvalidQueryEngineEndpoint) {
|
|
78872
|
+
renderedError = jsx(InvalidQueryEngineEndpointNotice, {
|
|
78873
|
+
implementationMeta: props.implementationMeta,
|
|
78874
|
+
invalidEndpoint: props.error.invalidEndpoint
|
|
78875
|
+
});
|
|
78876
|
+
}
|
|
78877
|
+
if (props.error instanceof InvalidIdentityPropType) {
|
|
78878
|
+
renderedError = jsx(InvalidIdentityFunctionNotice, {
|
|
78879
|
+
implementationMeta: props.implementationMeta
|
|
78880
|
+
});
|
|
78881
|
+
}
|
|
78882
|
+
if (props.error instanceof FailedToLoadIdentity) {
|
|
78883
|
+
renderedError = jsx(IdentityCallbackFailedNotice, {});
|
|
78884
|
+
}
|
|
78885
|
+
if (props.error instanceof InvalidIdentityReturn) {
|
|
78886
|
+
renderedError = jsx(TokensNotStrings, {
|
|
78887
|
+
implementationMeta: props.implementationMeta
|
|
78888
|
+
});
|
|
78889
|
+
}
|
|
78890
|
+
if (props.error instanceof FailedToLoadQueryEngineConfig) {
|
|
78891
|
+
renderedError = jsx(FailedToLoadQueryEngineConfigNotice, {});
|
|
78892
|
+
}
|
|
78893
|
+
if (props.error instanceof FailedToResolveDataSets) {
|
|
78894
|
+
renderedError = jsx(DatasetMustBeCallbackNotice, {});
|
|
78895
|
+
}
|
|
78896
|
+
if (props.error instanceof NewVizzlyImplementation) {
|
|
78897
|
+
renderedError = jsx(NewSelfHostedVizzlyImplementationNotice, {
|
|
78898
|
+
implementationMeta: props.implementationMeta
|
|
78899
|
+
});
|
|
78900
|
+
}
|
|
78901
|
+
if (props.error instanceof LoadingAborted) {
|
|
78902
|
+
renderedError = jsx(LoadingComponent, {
|
|
78903
|
+
override: props.renderLoadingComponent
|
|
78904
|
+
});
|
|
78905
|
+
}
|
|
78906
|
+
return jsxs(ThemeProvider, {
|
|
78907
|
+
children: [jsx(VizzlyGlobalStyles, {}), renderedError]
|
|
78908
|
+
});
|
|
78865
78909
|
};
|
|
78866
78910
|
|
|
78867
78911
|
var GlobalProvider = function GlobalProvider(props) {
|
|
@@ -78888,7 +78932,7 @@ var GlobalProvider = function GlobalProvider(props) {
|
|
|
78888
78932
|
}));
|
|
78889
78933
|
};
|
|
78890
78934
|
var GlobalProviderContents = function GlobalProviderContents(props) {
|
|
78891
|
-
var _props$developerTools, _props$id, _session$identityConf, _props$dateFilterOpti, _session$vizzly$savin;
|
|
78935
|
+
var _props$developerTools, _props$id, _props$id2, _session$identityConf, _props$dateFilterOpti, _session$vizzly$savin;
|
|
78892
78936
|
var _useState2 = useState(undefined),
|
|
78893
78937
|
dashboardHash = _useState2[0],
|
|
78894
78938
|
setDashboardHash = _useState2[1];
|
|
@@ -78924,6 +78968,8 @@ var GlobalProviderContents = function GlobalProviderContents(props) {
|
|
|
78924
78968
|
};
|
|
78925
78969
|
useOnDashboardLoadCallback(session, props.onDashboardLoad, updateDashboardHash);
|
|
78926
78970
|
var variables = useVariables(props.variables, (_props$id = props.id) != null ? _props$id : '');
|
|
78971
|
+
var _useAliasFields = useAliasFields((_props$id2 = props.id) != null ? _props$id2 : ''),
|
|
78972
|
+
aliasFields = _useAliasFields.aliasFields;
|
|
78927
78973
|
if (session === null) return jsx(LoadingComponent, {
|
|
78928
78974
|
override: props.renderLoadingComponent
|
|
78929
78975
|
});
|
|
@@ -78998,7 +79044,7 @@ var GlobalProviderContents = function GlobalProviderContents(props) {
|
|
|
78998
79044
|
}
|
|
78999
79045
|
};
|
|
79000
79046
|
var resolvedDateFilterOptions = (_props$dateFilterOpti = props.dateFilterOptions) != null ? _props$dateFilterOpti : props.dateTimeFilterOptions;
|
|
79001
|
-
var runQueriesCallback = getRunQueriesCallback(session.identityConfig, session.queryEngineConfig, build$
|
|
79047
|
+
var runQueriesCallback = getRunQueriesCallback(session.identityConfig, session.queryEngineConfig, build$c(textOverride, resolvedDateFilterOptions), variables.variables, aliasFields, props.runQueries, props.data, props.queryEngineEndpoint, props.timeZone);
|
|
79002
79048
|
var aiOnAction = /*#__PURE__*/function () {
|
|
79003
79049
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(conversationId, messageId, actionOptions) {
|
|
79004
79050
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -79079,6 +79125,7 @@ var GlobalProviderContents = function GlobalProviderContents(props) {
|
|
|
79079
79125
|
}();
|
|
79080
79126
|
return jsx(GlobalContext.Provider, {
|
|
79081
79127
|
value: _extends({}, props, {
|
|
79128
|
+
aliasFields: aliasFields,
|
|
79082
79129
|
onSave: onSave
|
|
79083
79130
|
}),
|
|
79084
79131
|
children: jsx(StudioContexts, {
|