@digital-ai/dot-components 4.1.0 → 4.2.0
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/index.esm.js +160 -55
- package/package.json +1 -1
- package/src/lib/components/analytics/dashboard-actions/DashboardActions.d.ts +2 -1
- package/src/lib/components/analytics/dashboard-actions/DashboardOptionsMenu.d.ts +2 -1
- package/src/lib/components/analytics/dashboard-dialog/DashboardDialog.d.ts +8 -1
- package/src/lib/components/analytics/dashboard-header/DashboardHeader.d.ts +1 -1
- package/src/lib/components/analytics/metadata-api/MetadataApiProvider.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -9543,7 +9543,7 @@ function DotDashboardStatusPill({
|
|
|
9543
9543
|
label: "Edit in progress",
|
|
9544
9544
|
size: "small",
|
|
9545
9545
|
variant: "outlined",
|
|
9546
|
-
status: "
|
|
9546
|
+
status: "warning"
|
|
9547
9547
|
})
|
|
9548
9548
|
});
|
|
9549
9549
|
} else {
|
|
@@ -9832,7 +9832,7 @@ const categorySort = (a, b) => a.localeCompare(b);
|
|
|
9832
9832
|
const metadataKey = isPublishedOnly => isPublishedOnly ? 'published' : 'all';
|
|
9833
9833
|
const handleUpdateDashboard = (dashboards, updatedDashboard) => {
|
|
9834
9834
|
updateItemInArray(dashboards, updatedDashboard, ID);
|
|
9835
|
-
return dashboards;
|
|
9835
|
+
return dashboards ? [...dashboards] : dashboards;
|
|
9836
9836
|
};
|
|
9837
9837
|
const DotMetadataApiContext = createContext(null);
|
|
9838
9838
|
const accountHeaderKey = 'X-Digitalai-Account-ID';
|
|
@@ -9860,6 +9860,7 @@ const DotMetadataApiProvider = ({
|
|
|
9860
9860
|
const [accountId, setAccountId] = useState(accountOverrideId);
|
|
9861
9861
|
const [dashboards, setDashboards] = useState();
|
|
9862
9862
|
const [dashboardsLoading, setDashboardsLoading] = useState(true);
|
|
9863
|
+
const [dashboardSearchLoading, setDashboardSearchLoading] = useState(false);
|
|
9863
9864
|
const [metadata, setMetadata] = useState(null);
|
|
9864
9865
|
const [metadataLoading, setMetadataLoading] = useState(true);
|
|
9865
9866
|
const [helpContentLoading, setHelpContentLoading] = useState(true);
|
|
@@ -9892,6 +9893,7 @@ const DotMetadataApiProvider = ({
|
|
|
9892
9893
|
metadataLoading,
|
|
9893
9894
|
dashboardsError,
|
|
9894
9895
|
dashboardsLoading,
|
|
9896
|
+
dashboardSearchLoading,
|
|
9895
9897
|
helpContentLoading,
|
|
9896
9898
|
openedDashboardDetails,
|
|
9897
9899
|
platformConsoleUrl,
|
|
@@ -9921,14 +9923,16 @@ const DotMetadataApiProvider = ({
|
|
|
9921
9923
|
favorite,
|
|
9922
9924
|
returnErrors = false
|
|
9923
9925
|
}) => {
|
|
9926
|
+
if (OpenAPI.BASE === MOCK_API_URL) {
|
|
9927
|
+
setDashboardsError(null);
|
|
9928
|
+
return Promise.resolve([]);
|
|
9929
|
+
}
|
|
9924
9930
|
setAccountIdHeader(accountId);
|
|
9925
|
-
|
|
9931
|
+
setDashboardSearchLoading(true);
|
|
9926
9932
|
return cancelablePromise(DashboardsService.getDashboardsService(start, count, sort, filter, favorite, q, authorFullname, authorId, biType, description, id, isOotbDashboard, lifecycleState, name, targetApp)).then(response => {
|
|
9927
9933
|
setDashboardsError(null);
|
|
9928
|
-
setDashboardsLoading(false);
|
|
9929
9934
|
return response.results;
|
|
9930
9935
|
}).catch(error => {
|
|
9931
|
-
setDashboardsLoading(false);
|
|
9932
9936
|
if (returnErrors) {
|
|
9933
9937
|
return {
|
|
9934
9938
|
error: error.message
|
|
@@ -9937,7 +9941,7 @@ const DotMetadataApiProvider = ({
|
|
|
9937
9941
|
setDashboardsError(error);
|
|
9938
9942
|
return null;
|
|
9939
9943
|
}
|
|
9940
|
-
});
|
|
9944
|
+
}).finally(() => setDashboardSearchLoading(false));
|
|
9941
9945
|
},
|
|
9942
9946
|
deleteDashboard: dashboardId => {
|
|
9943
9947
|
setAccountIdHeader(accountId);
|
|
@@ -10015,6 +10019,12 @@ const DotMetadataApiProvider = ({
|
|
|
10015
10019
|
}
|
|
10016
10020
|
},
|
|
10017
10021
|
updateDashboard: (dashboardId, dashboard, isSync = false) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10022
|
+
if (OpenAPI.BASE === MOCK_API_URL) {
|
|
10023
|
+
setDashboardsError(null);
|
|
10024
|
+
return Promise.resolve(Object.assign(Object.assign({}, dashboard), {
|
|
10025
|
+
id: dashboardId
|
|
10026
|
+
}));
|
|
10027
|
+
}
|
|
10018
10028
|
setAccountIdHeader(accountId);
|
|
10019
10029
|
return cancelablePromise(DashboardsService.patchDashboardsService(dashboardId, dashboard, isSync)).then(response => {
|
|
10020
10030
|
setDashboardsError(null);
|
|
@@ -10029,6 +10039,7 @@ const DotMetadataApiProvider = ({
|
|
|
10029
10039
|
const appTypeMetadata = metadata[appType];
|
|
10030
10040
|
if (key in appTypeMetadata) {
|
|
10031
10041
|
appTypeMetadata[key]['authors'].sort(authorSort);
|
|
10042
|
+
setMetadataLoading(false);
|
|
10032
10043
|
return Promise.resolve(appTypeMetadata[key]['authors']);
|
|
10033
10044
|
}
|
|
10034
10045
|
} else if (OpenAPI.BASE === MOCK_API_URL) {
|
|
@@ -10047,6 +10058,7 @@ const DotMetadataApiProvider = ({
|
|
|
10047
10058
|
const appTypeMetadata = metadata[appType];
|
|
10048
10059
|
if (key in appTypeMetadata) {
|
|
10049
10060
|
appTypeMetadata[key]['categories'].sort(categorySort);
|
|
10061
|
+
setMetadataLoading(false);
|
|
10050
10062
|
return Promise.resolve(appTypeMetadata[key]['categories']);
|
|
10051
10063
|
}
|
|
10052
10064
|
} else if (OpenAPI.BASE === MOCK_API_URL) {
|
|
@@ -10077,7 +10089,7 @@ const DotMetadataApiProvider = ({
|
|
|
10077
10089
|
});
|
|
10078
10090
|
}
|
|
10079
10091
|
})
|
|
10080
|
-
}), [accountId, metadata, metadataLoading, dashboardsError, dashboardsLoading, openedDashboardDetails, platformConsoleUrl, retrieveMetadata]);
|
|
10092
|
+
}), [accountId, metadata, metadataLoading, dashboardsError, dashboardsLoading, dashboardSearchLoading, openedDashboardDetails, platformConsoleUrl, retrieveMetadata]);
|
|
10081
10093
|
if (apiUrl && OpenAPI.BASE !== apiUrl) {
|
|
10082
10094
|
OpenAPI.BASE = apiUrl;
|
|
10083
10095
|
}
|
|
@@ -10864,6 +10876,9 @@ const StyledDashboardDialog = styled(DotDialog)`
|
|
|
10864
10876
|
.dot-input-select {
|
|
10865
10877
|
margin-bottom: ${theme.spacing(2)};
|
|
10866
10878
|
}
|
|
10879
|
+
.disabled-fields-banner {
|
|
10880
|
+
margin-bottom: ${theme.spacing(2)};
|
|
10881
|
+
}
|
|
10867
10882
|
`}
|
|
10868
10883
|
`;
|
|
10869
10884
|
const StyledDialogActions = styled(DialogActions)`
|
|
@@ -10905,6 +10920,10 @@ function DotDashboardDialog({
|
|
|
10905
10920
|
availableCategories,
|
|
10906
10921
|
copyDashboard,
|
|
10907
10922
|
editDashboard,
|
|
10923
|
+
fieldConfig = {
|
|
10924
|
+
apptype: 'disabled'
|
|
10925
|
+
},
|
|
10926
|
+
messages,
|
|
10908
10927
|
open,
|
|
10909
10928
|
onClose,
|
|
10910
10929
|
onSubmit,
|
|
@@ -10921,11 +10940,28 @@ function DotDashboardDialog({
|
|
|
10921
10940
|
name
|
|
10922
10941
|
} = formValues;
|
|
10923
10942
|
const {
|
|
10943
|
+
dashboardSearchLoading,
|
|
10924
10944
|
searchDashboards
|
|
10925
10945
|
} = useDotMetadataApiContext();
|
|
10926
10946
|
const {
|
|
10927
10947
|
cancelablePromise
|
|
10928
10948
|
} = useCancelablePromise();
|
|
10949
|
+
const fieldConfigWithDefault = useMemo(() => {
|
|
10950
|
+
let config = fieldConfig;
|
|
10951
|
+
if (!config) {
|
|
10952
|
+
config = {
|
|
10953
|
+
apptype: 'disabled'
|
|
10954
|
+
};
|
|
10955
|
+
} else if (!('apptype' in config)) {
|
|
10956
|
+
config = Object.assign(Object.assign({}, config), {
|
|
10957
|
+
apptype: 'disabled'
|
|
10958
|
+
});
|
|
10959
|
+
}
|
|
10960
|
+
return config;
|
|
10961
|
+
}, [fieldConfig]);
|
|
10962
|
+
const isDisabled = useCallback((key, b = true) => {
|
|
10963
|
+
return b && key in fieldConfigWithDefault && fieldConfigWithDefault[key] === 'disabled';
|
|
10964
|
+
}, [fieldConfigWithDefault]);
|
|
10929
10965
|
useEffect(() => {
|
|
10930
10966
|
if (copyDashboard) {
|
|
10931
10967
|
setFormValues(orig => Object.assign(Object.assign({}, orig), {
|
|
@@ -10945,30 +10981,23 @@ function DotDashboardDialog({
|
|
|
10945
10981
|
onClose(false);
|
|
10946
10982
|
};
|
|
10947
10983
|
}, []);
|
|
10948
|
-
const handleSubmit = useCallback(
|
|
10984
|
+
const handleSubmit = useCallback(isDone => __awaiter(this, void 0, void 0, function* () {
|
|
10949
10985
|
setIsLoadingSubmit(true);
|
|
10950
10986
|
const useFormValues = Object.assign(Object.assign({}, formValues), {
|
|
10951
10987
|
id: editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.id
|
|
10952
10988
|
});
|
|
10953
10989
|
const validName = yield validateName(useFormValues.name);
|
|
10954
10990
|
if (validName) {
|
|
10955
|
-
yield onSubmit(useFormValues,
|
|
10991
|
+
yield onSubmit(useFormValues, isDone);
|
|
10956
10992
|
}
|
|
10957
10993
|
setIsLoadingSubmit(false);
|
|
10958
10994
|
}), [formValues, editDashboard]);
|
|
10959
10995
|
const handleSubmitCreate = useCallback(() => {
|
|
10960
|
-
handleSubmit(false);
|
|
10961
|
-
}, [handleSubmit]);
|
|
10962
|
-
const handleSubmitEditExit = useCallback(() => {
|
|
10963
10996
|
handleSubmit(true);
|
|
10964
10997
|
}, [handleSubmit]);
|
|
10965
|
-
const
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
} else {
|
|
10969
|
-
onContinue();
|
|
10970
|
-
}
|
|
10971
|
-
}, [isDirty, handleSubmit, onContinue]);
|
|
10998
|
+
const handleSubmitEdit = useCallback(() => {
|
|
10999
|
+
handleSubmit(false);
|
|
11000
|
+
}, [handleSubmit]);
|
|
10972
11001
|
const handleChange = useCallback(event => {
|
|
10973
11002
|
const targetName = event.target.name;
|
|
10974
11003
|
const value = event.target.value;
|
|
@@ -11030,12 +11059,9 @@ function DotDashboardDialog({
|
|
|
11030
11059
|
validateName(newName);
|
|
11031
11060
|
}
|
|
11032
11061
|
}, [validateName]);
|
|
11033
|
-
const validateRequiredFields = () => {
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
}
|
|
11037
|
-
return true;
|
|
11038
|
-
};
|
|
11062
|
+
const validateRequiredFields = useCallback(() => {
|
|
11063
|
+
return !!formValues.name && !nameError;
|
|
11064
|
+
}, [formValues.name, nameError]);
|
|
11039
11065
|
return jsxs(StyledDashboardDialog, {
|
|
11040
11066
|
cancelButtonProps: {
|
|
11041
11067
|
'data-testid': 'cancel-create-dashboard-button'
|
|
@@ -11053,7 +11079,14 @@ function DotDashboardDialog({
|
|
|
11053
11079
|
label: 'Continue'
|
|
11054
11080
|
},
|
|
11055
11081
|
title: title || 'Create dashboard',
|
|
11056
|
-
children: [jsx(
|
|
11082
|
+
children: [messages === null || messages === void 0 ? void 0 : messages.map(message => jsx(DotAlertBanner, {
|
|
11083
|
+
severity: "info",
|
|
11084
|
+
className: "disabled-fields-banner",
|
|
11085
|
+
"data-testid": "disabled-fields-banner",
|
|
11086
|
+
children: jsx(DotTypography, {
|
|
11087
|
+
children: message
|
|
11088
|
+
})
|
|
11089
|
+
}, message)), jsx(DotInputText, {
|
|
11057
11090
|
autoFocus: true,
|
|
11058
11091
|
"data-testid": "dashboard-dialog-name-input",
|
|
11059
11092
|
error: nameError || name.length > DASHBOARD_NAME_MAX_LENGTH,
|
|
@@ -11061,6 +11094,7 @@ function DotDashboardDialog({
|
|
|
11061
11094
|
id: "name",
|
|
11062
11095
|
label: "Dashboard name",
|
|
11063
11096
|
name: "name",
|
|
11097
|
+
disabled: isDisabled('name'),
|
|
11064
11098
|
onBlur: handleNameBlur,
|
|
11065
11099
|
onChange: handleChange,
|
|
11066
11100
|
required: true,
|
|
@@ -11075,6 +11109,7 @@ function DotDashboardDialog({
|
|
|
11075
11109
|
minRows: 4,
|
|
11076
11110
|
maxRows: 4,
|
|
11077
11111
|
name: "description",
|
|
11112
|
+
disabled: isDisabled('description'),
|
|
11078
11113
|
onChange: handleChange,
|
|
11079
11114
|
value: description
|
|
11080
11115
|
}), editDashboard && jsxs(Fragment, {
|
|
@@ -11087,7 +11122,7 @@ function DotDashboardDialog({
|
|
|
11087
11122
|
id: "dashboard-apptype-select",
|
|
11088
11123
|
"data-testid": "dashboard-dialog-apptype-input",
|
|
11089
11124
|
name: "Select application",
|
|
11090
|
-
disabled:
|
|
11125
|
+
disabled: isDisabled('apptype'),
|
|
11091
11126
|
value: editDashboard.target_apps[0]
|
|
11092
11127
|
})]
|
|
11093
11128
|
}), jsx(DotTypography, {
|
|
@@ -11106,6 +11141,7 @@ function DotDashboardDialog({
|
|
|
11106
11141
|
placeholder: "Select categories",
|
|
11107
11142
|
label: "Category",
|
|
11108
11143
|
required: editDashboard && editDashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED,
|
|
11144
|
+
disabled: isDisabled('categories'),
|
|
11109
11145
|
value: getCategoryValues()
|
|
11110
11146
|
}), editDashboard && jsx(Fragment, {
|
|
11111
11147
|
children: jsxs(StyledDialogActions, {
|
|
@@ -11117,16 +11153,10 @@ function DotDashboardDialog({
|
|
|
11117
11153
|
children: "Cancel"
|
|
11118
11154
|
}), jsx(DotButton, {
|
|
11119
11155
|
"data-testid": "save-edit-exit-dashboard-button",
|
|
11120
|
-
disabled: isLoadingSubmit || !isDirty || !validateRequiredFields(),
|
|
11121
|
-
onClick:
|
|
11122
|
-
type: "outlined",
|
|
11123
|
-
children: "Save and exit"
|
|
11124
|
-
}), jsx(DotButton, {
|
|
11125
|
-
"data-testid": "save-edit-continue-dashboard-button",
|
|
11126
|
-
disabled: isLoadingSubmit || !validateRequiredFields(),
|
|
11127
|
-
onClick: handleSubmitEditContinue,
|
|
11156
|
+
disabled: dashboardSearchLoading || isLoadingSubmit || !isDirty || !validateRequiredFields(),
|
|
11157
|
+
onClick: handleSubmitEdit,
|
|
11128
11158
|
type: "primary",
|
|
11129
|
-
children:
|
|
11159
|
+
children: "Save"
|
|
11130
11160
|
})]
|
|
11131
11161
|
})
|
|
11132
11162
|
})]
|
|
@@ -11752,6 +11782,8 @@ const StyledDotMenu = styled(DotMenu)`
|
|
|
11752
11782
|
`}
|
|
11753
11783
|
`;
|
|
11754
11784
|
|
|
11785
|
+
const disabledFieldsMessage = 'Dashboard name and description cannot be modified while the dashboard editor is active. Please save your changes and close the editor, if you need to make a name or description change.';
|
|
11786
|
+
const inProgressEditMessage = 'This is a published dashboard; changes will not be visible to other users until you publish the updated dashboard.';
|
|
11755
11787
|
function DotDashboardOptionsMenu({
|
|
11756
11788
|
dashboard,
|
|
11757
11789
|
currentUser,
|
|
@@ -11761,12 +11793,19 @@ function DotDashboardOptionsMenu({
|
|
|
11761
11793
|
onStartDuplicate,
|
|
11762
11794
|
onStartStatusChange,
|
|
11763
11795
|
onStartRevert,
|
|
11796
|
+
onUpdatedProperties,
|
|
11764
11797
|
onViewOriginal,
|
|
11765
11798
|
onViewMode,
|
|
11766
11799
|
onDetails
|
|
11767
11800
|
}) {
|
|
11768
11801
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
11769
11802
|
const [open, setOpen] = useState(false);
|
|
11803
|
+
const [isEditPropertiesDialogOpen, setIsEditPropertiesDialogOpen] = useState(false);
|
|
11804
|
+
const [categoryOptions, setCategoryOptions] = useState();
|
|
11805
|
+
const {
|
|
11806
|
+
getCategories,
|
|
11807
|
+
updateDashboard
|
|
11808
|
+
} = useDotMetadataApiContext();
|
|
11770
11809
|
const handleMenuClick = useCallback(event => {
|
|
11771
11810
|
setAnchorEl(event.currentTarget);
|
|
11772
11811
|
setOpen(orig => !orig);
|
|
@@ -11779,6 +11818,34 @@ function DotDashboardOptionsMenu({
|
|
|
11779
11818
|
handleMenuClose();
|
|
11780
11819
|
onViewMode(dashboard, 'edit');
|
|
11781
11820
|
}, [dashboard, onViewMode]);
|
|
11821
|
+
const handleEditPropertiesClick = useCallback(() => {
|
|
11822
|
+
var _a;
|
|
11823
|
+
handleMenuClose();
|
|
11824
|
+
setIsEditPropertiesDialogOpen(true);
|
|
11825
|
+
if (((_a = dashboard === null || dashboard === void 0 ? void 0 : dashboard.target_apps) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
11826
|
+
getCategories(dashboard.target_apps[0]).then(retrievedCategories => {
|
|
11827
|
+
// group categories for all app types associated with this dashboard
|
|
11828
|
+
const categoryOptionSet = new Set();
|
|
11829
|
+
retrievedCategories.forEach(categoryOptionSet.add, categoryOptionSet);
|
|
11830
|
+
setCategoryOptions(Array.from(categoryOptionSet));
|
|
11831
|
+
});
|
|
11832
|
+
} else {
|
|
11833
|
+
setCategoryOptions([]);
|
|
11834
|
+
}
|
|
11835
|
+
}, [dashboard]);
|
|
11836
|
+
const handleSubmitEditProperties = useCallback((data, isDone) => __awaiter(this, void 0, void 0, function* () {
|
|
11837
|
+
return updateDashboard(dashboard.id, {
|
|
11838
|
+
name: data.name,
|
|
11839
|
+
description: data.description,
|
|
11840
|
+
categories: data.categories,
|
|
11841
|
+
target_apps: data.target_apps
|
|
11842
|
+
}).then(result => {
|
|
11843
|
+
if (result && 'id' in result) {
|
|
11844
|
+
setIsEditPropertiesDialogOpen(false);
|
|
11845
|
+
onUpdatedProperties(result, isDone);
|
|
11846
|
+
}
|
|
11847
|
+
});
|
|
11848
|
+
}), [dashboard]);
|
|
11782
11849
|
const isDraft = dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT;
|
|
11783
11850
|
const isPublished = dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED;
|
|
11784
11851
|
const dashboardLocked = isPublished && currentUser && dashboard.is_being_modified && dashboard.modified_author_id !== currentUser.id;
|
|
@@ -11796,6 +11863,19 @@ function DotDashboardOptionsMenu({
|
|
|
11796
11863
|
key: 'edit'
|
|
11797
11864
|
});
|
|
11798
11865
|
}
|
|
11866
|
+
if (onUpdatedProperties && !dashboard.is_ootb_dashboard) {
|
|
11867
|
+
menuItems.push({
|
|
11868
|
+
children: jsx(DotButton, {
|
|
11869
|
+
ariaLabel: "Edit dashboard properties",
|
|
11870
|
+
type: "text",
|
|
11871
|
+
startIcon: jsx(DotIcon, {
|
|
11872
|
+
iconId: "edit"
|
|
11873
|
+
}),
|
|
11874
|
+
children: "Edit properties"
|
|
11875
|
+
}),
|
|
11876
|
+
key: 'edit-props'
|
|
11877
|
+
});
|
|
11878
|
+
}
|
|
11799
11879
|
if (onStartStatusChange && !dashboard.is_ootb_dashboard && isDraft) {
|
|
11800
11880
|
menuItems.push({
|
|
11801
11881
|
key: 'publish',
|
|
@@ -11911,6 +11991,9 @@ function DotDashboardOptionsMenu({
|
|
|
11911
11991
|
case 'edit':
|
|
11912
11992
|
handleEditClick();
|
|
11913
11993
|
break;
|
|
11994
|
+
case 'edit-props':
|
|
11995
|
+
handleEditPropertiesClick();
|
|
11996
|
+
break;
|
|
11914
11997
|
case 'duplicate':
|
|
11915
11998
|
onStartDuplicate(dashboard);
|
|
11916
11999
|
break;
|
|
@@ -11933,8 +12016,30 @@ function DotDashboardOptionsMenu({
|
|
|
11933
12016
|
}
|
|
11934
12017
|
handleMenuClose();
|
|
11935
12018
|
}, [menuItems, handleMenuClose]);
|
|
12019
|
+
const handleCloseEditProperties = useCallback(_isDone => {
|
|
12020
|
+
setIsEditPropertiesDialogOpen(false);
|
|
12021
|
+
}, []);
|
|
12022
|
+
const messages = [];
|
|
12023
|
+
if (dashboard.is_being_modified || dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED) {
|
|
12024
|
+
messages.push(inProgressEditMessage);
|
|
12025
|
+
}
|
|
12026
|
+
if (isEdit) {
|
|
12027
|
+
messages.push(disabledFieldsMessage);
|
|
12028
|
+
}
|
|
11936
12029
|
return menuItems.length > 0 ? jsxs(Fragment, {
|
|
11937
|
-
children: [jsx(
|
|
12030
|
+
children: [jsx(DotDashboardDialog, {
|
|
12031
|
+
title: "Edit dashboard properties",
|
|
12032
|
+
availableCategories: categoryOptions,
|
|
12033
|
+
fieldConfig: isEdit ? {
|
|
12034
|
+
name: 'disabled',
|
|
12035
|
+
description: 'disabled'
|
|
12036
|
+
} : undefined,
|
|
12037
|
+
messages: messages,
|
|
12038
|
+
open: isEditPropertiesDialogOpen,
|
|
12039
|
+
onClose: handleCloseEditProperties,
|
|
12040
|
+
onSubmit: handleSubmitEditProperties,
|
|
12041
|
+
editDashboard: dashboard
|
|
12042
|
+
}), jsx(DotIconButton, {
|
|
11938
12043
|
className: "expand-button",
|
|
11939
12044
|
"data-testid": "card-header-action-button",
|
|
11940
12045
|
iconId: "options",
|
|
@@ -12064,6 +12169,7 @@ function DotDashboardActions({
|
|
|
12064
12169
|
onDeleted,
|
|
12065
12170
|
onDuplicated,
|
|
12066
12171
|
onToggleFullscreen,
|
|
12172
|
+
onUpdatedProperties,
|
|
12067
12173
|
onViewMode,
|
|
12068
12174
|
onViewOriginal,
|
|
12069
12175
|
onRevertChanges,
|
|
@@ -12215,6 +12321,7 @@ function DotDashboardActions({
|
|
|
12215
12321
|
onStartDuplicate: handleStartDuplicateIfConfig,
|
|
12216
12322
|
onStartDelete: handleStartDeleteIfConfig,
|
|
12217
12323
|
onStartRevert: handleRevertChangesIfConfig,
|
|
12324
|
+
onUpdatedProperties: onUpdatedProperties,
|
|
12218
12325
|
onDetails: () => setOpenedDashboardDetails(dashboard),
|
|
12219
12326
|
currentUser: currentUser ? currentUser : null
|
|
12220
12327
|
}), onToggleFullscreen && jsx(FullscreenButton, {
|
|
@@ -12294,24 +12401,20 @@ function DotDashboardBanner({
|
|
|
12294
12401
|
});
|
|
12295
12402
|
}
|
|
12296
12403
|
function getDashboardBanner(dashboard, isEdit, onExitEditMode, onPublishChanges, currentUser, modifiedAuthorUser) {
|
|
12297
|
-
if (
|
|
12298
|
-
if (dashboard.
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
}
|
|
12312
|
-
}
|
|
12313
|
-
} else {
|
|
12314
|
-
if (currentUser && dashboard.is_being_modified && dashboard.modified_author_id !== currentUser.id && modifiedAuthorUser) {
|
|
12404
|
+
if (dashboard.is_being_modified && currentUser) {
|
|
12405
|
+
if (dashboard.modified_author_id === currentUser.id) {
|
|
12406
|
+
// We're in Edit mode for a published dashboard, and the dashboard is being modified by the current user.
|
|
12407
|
+
return jsx(DotDashboardBanner, {
|
|
12408
|
+
bannerSeverity: "warning",
|
|
12409
|
+
bannerText: jsx(DotTypography, {
|
|
12410
|
+
children: "The Dashboard is currently locked and only you can make changes. Publish the changes for other users to see the updated dashboard."
|
|
12411
|
+
}),
|
|
12412
|
+
buttonText: "Publish changes",
|
|
12413
|
+
buttonAction: () => {
|
|
12414
|
+
onPublishChanges(dashboard);
|
|
12415
|
+
}
|
|
12416
|
+
});
|
|
12417
|
+
} else if (dashboard.modified_author_id !== currentUser.id && modifiedAuthorUser) {
|
|
12315
12418
|
// We're in View mode for a published dashboard that is being edited by someone else.
|
|
12316
12419
|
const bannerText = jsx(DotTypography, {
|
|
12317
12420
|
children: jsxs("div", {
|
|
@@ -12343,6 +12446,7 @@ function DotDashboardHeader({
|
|
|
12343
12446
|
onRevertChanges,
|
|
12344
12447
|
onViewOriginal,
|
|
12345
12448
|
onToggleFullscreen,
|
|
12449
|
+
onUpdatedProperties,
|
|
12346
12450
|
onViewMode,
|
|
12347
12451
|
showStatus = false,
|
|
12348
12452
|
modifiedAuthorUser = null
|
|
@@ -12416,6 +12520,7 @@ function DotDashboardHeader({
|
|
|
12416
12520
|
onDeleted: onDeleted,
|
|
12417
12521
|
onDuplicated: onDuplicated,
|
|
12418
12522
|
onToggleFullscreen: onToggleFullscreen,
|
|
12523
|
+
onUpdatedProperties: onUpdatedProperties,
|
|
12419
12524
|
onViewMode: onViewMode,
|
|
12420
12525
|
onViewOriginal: onViewOriginal,
|
|
12421
12526
|
currentUser: currentUser ? currentUser : null
|
package/package.json
CHANGED
|
@@ -13,11 +13,12 @@ interface DashboardActionsCommonProps {
|
|
|
13
13
|
onRevertChanges?: (dashboard: DashboardView) => void;
|
|
14
14
|
onStatusChanged?: (dashboard: DashboardView) => void;
|
|
15
15
|
onToggleFullscreen?: (newValue: boolean) => void;
|
|
16
|
+
onUpdatedProperties?: (dashboard: DashboardView, isReload: boolean) => void;
|
|
16
17
|
onViewMode?: (dashboard: DashboardView, mode: string) => void;
|
|
17
18
|
onViewOriginal?: (dashboard: DashboardView) => void;
|
|
18
19
|
}
|
|
19
20
|
interface DashboardActionsProps extends DashboardActionsCommonProps {
|
|
20
21
|
applications: ApplicationModel[];
|
|
21
22
|
}
|
|
22
|
-
declare function DotDashboardActions({ applications, dashboard, isEdit, canEdit, isFullscreen, onClose, onFavorite, onStatusChanged, onDeleted, onDuplicated, onToggleFullscreen, onViewMode, onViewOriginal, onRevertChanges, currentUser, }: DashboardActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function DotDashboardActions({ applications, dashboard, isEdit, canEdit, isFullscreen, onClose, onFavorite, onStatusChanged, onDeleted, onDuplicated, onToggleFullscreen, onUpdatedProperties, onViewMode, onViewOriginal, onRevertChanges, currentUser, }: DashboardActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export { DashboardActionsCommonProps, DotDashboardActions, DashboardActionsProps, };
|
|
@@ -12,8 +12,9 @@ interface DashboardOptionsMenuProps {
|
|
|
12
12
|
onStartDuplicate?: (dashboard: DashboardView) => void;
|
|
13
13
|
onStartRevert?: (dashboard: DashboardView) => void;
|
|
14
14
|
onStartStatusChange?: (dashboard: DashboardView, status: DashboardView.lifecycle_state) => void;
|
|
15
|
+
onUpdatedProperties?: (dashboard: DashboardView, isDone: boolean) => void;
|
|
15
16
|
onViewMode?: (dashboard: DashboardView, mode: string) => void;
|
|
16
17
|
onViewOriginal?: (dashboard: DashboardView) => void;
|
|
17
18
|
}
|
|
18
|
-
export declare function DotDashboardOptionsMenu({ dashboard, currentUser, isEdit, menuPlacement, onStartDelete, onStartDuplicate, onStartStatusChange, onStartRevert, onViewOriginal, onViewMode, onDetails, }: DashboardOptionsMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function DotDashboardOptionsMenu({ dashboard, currentUser, isEdit, menuPlacement, onStartDelete, onStartDuplicate, onStartStatusChange, onStartRevert, onUpdatedProperties, onViewOriginal, onViewMode, onDetails, }: DashboardOptionsMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -8,6 +8,9 @@ interface DashboardData {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const DASHBOARD_NAME_MAX_LENGTH = 250;
|
|
10
10
|
export declare const DASHBOARD_DESCRIPTION_MAX_LENGTH = 250;
|
|
11
|
+
interface FieldConfig {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}
|
|
11
14
|
interface DashboardDialogProps {
|
|
12
15
|
/** Categories for dashboard publishing **/
|
|
13
16
|
availableCategories: string[];
|
|
@@ -15,6 +18,10 @@ interface DashboardDialogProps {
|
|
|
15
18
|
copyDashboard?: DashboardView;
|
|
16
19
|
/** Dashboard to edit **/
|
|
17
20
|
editDashboard?: DashboardView;
|
|
21
|
+
/** config object which can be used to disable certain fields **/
|
|
22
|
+
fieldConfig?: FieldConfig;
|
|
23
|
+
/** An optional info messages **/
|
|
24
|
+
messages?: string[];
|
|
18
25
|
/** When the confirmation is closed (canceled, finished, or clicked away) this function is called **/
|
|
19
26
|
onClose: (returnToList?: boolean) => void;
|
|
20
27
|
/** When the form is submitted with no changes, this function is called **/
|
|
@@ -26,5 +33,5 @@ interface DashboardDialogProps {
|
|
|
26
33
|
/** Dialog title **/
|
|
27
34
|
title?: string;
|
|
28
35
|
}
|
|
29
|
-
declare function DotDashboardDialog({ availableCategories, copyDashboard, editDashboard, open, onClose, onSubmit, onContinue, title, }: Readonly<DashboardDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
declare function DotDashboardDialog({ availableCategories, copyDashboard, editDashboard, fieldConfig, messages, open, onClose, onSubmit, onContinue, title, }: Readonly<DashboardDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
30
37
|
export { DotDashboardDialog, DashboardData };
|
|
@@ -6,5 +6,5 @@ interface DashboardHeaderProps extends DashboardActionsCommonProps {
|
|
|
6
6
|
onBack?: (dashboardId?: string) => void;
|
|
7
7
|
showStatus?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare function DotDashboardHeader({ accountId, dashboard, currentUser, isEdit, canEdit, isFullscreen, onBack, onClose, onFavorite, onStatusChanged, onDeleted, onDuplicated, onRevertChanges, onViewOriginal, onToggleFullscreen, onViewMode, showStatus, modifiedAuthorUser, }: DashboardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function DotDashboardHeader({ accountId, dashboard, currentUser, isEdit, canEdit, isFullscreen, onBack, onClose, onFavorite, onStatusChanged, onDeleted, onDuplicated, onRevertChanges, onViewOriginal, onToggleFullscreen, onUpdatedProperties, onViewMode, showStatus, modifiedAuthorUser, }: DashboardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export { DashboardHeaderProps, DotDashboardHeader };
|