Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashboard/src/api/apiMethods/entityFormApiMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
getEntityUrl,
getTypedefUrl,
} from "@api/apiUrlLinks/entityFormApiUrl";
import { _get } from "./apiMethod";
import { _delete, _get } from "./apiMethod";
import { entitiesApiUrl } from "@api/apiUrlLinks/entitiesApiUrl";

interface importTmplConfigs {
Expand Down
50 changes: 45 additions & 5 deletions dashboard/src/api/apiMethods/searchApiMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,50 @@ const getRelationShipV2 = (params: { params: Record<string, unknown> }) => {
return fetchApi(url, { method: "GET" });
};

/**
* Dashboard: latest entities via basic search.
* Request `__timestamp` only in `attributes` so responses include system created time
* (Atlas often returns `createTime: 0`; `__timestamp` holds the real ms value).
*/
const getLatestEntities = (limit: number) => {
const timestampMs = Date.now();
return getBasicSearchResult(
{
data: {
typeName: "_ALL_ENTITY_TYPES",
excludeDeletedEntities: true,
includeClassificationAttributes: true,
includeSubClassifications: true,
includeSubTypes: true,
limit,
offset: 0,
tagFilters: null,
entityFilters: {
condition: "AND",
criterion: [
{
attributeName: "__timestamp",
operator: "lte",
attributeValue: String(timestampMs),
type: "date"
}
]
},
classification: null,
termName: null,
relationshipFilters: null,
attributes: ["__timestamp"]
}
},
"basic"
);
};

export {
getBasicSearchResult,
getRelationShipResult,
getGlobalSearchResult,
getRelationShip,
getRelationShipV2
getBasicSearchResult,
getRelationShipResult,
getGlobalSearchResult,
getRelationShip,
getRelationShipV2,
getLatestEntities
};
176 changes: 176 additions & 0 deletions dashboard/src/components/CreateDropdown/CreateDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { useState, useCallback } from "react";
import { Button, Menu, MenuItem } from "@mui/material";
import AddIcon from "@mui/icons-material/Add";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import CategoryIcon from "@mui/icons-material/Category";
import LocalOfferIcon from "@mui/icons-material/LocalOffer";
import MenuBookIcon from "@mui/icons-material/MenuBook";
import BusinessCenterIcon from "@mui/icons-material/BusinessCenter";
import ListIcon from "@mui/icons-material/List";
import { useNavigate } from "react-router-dom";
import EntityForm from "@views/Entity/EntityForm";
import ClassificationForm from "@views/Classification/ClassificationForm";
import AddUpdateGlossaryForm from "@views/Glossary/AddUpdateGlossaryForm";
const CreateDropdown = () => {
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const [entityModal, setEntityModal] = useState(false);
const [classificationModal, setClassificationModal] = useState(false);
const [glossaryModal, setGlossaryModal] = useState(false);
const navigate = useNavigate();

const open = Boolean(anchorEl);

const handleClick = useCallback((event: React.MouseEvent<HTMLElement>) => {
setAnchorEl(event.currentTarget);
}, []);

const handleClose = useCallback(() => {
setAnchorEl(null);
}, []);

const handleEntityClick = useCallback(() => {
handleClose();
setEntityModal(true);
}, [handleClose]);

const handleClassificationClick = useCallback(() => {
handleClose();
setClassificationModal(true);
}, [handleClose]);

const handleGlossaryClick = useCallback(() => {
handleClose();
setGlossaryModal(true);
}, [handleClose]);

const handleBusinessMetadataClick = useCallback(() => {
handleClose();
navigate({
pathname: "/administrator",
search: "tabActive=businessMetadata&create=true"
});
}, [handleClose, navigate]);

const handleEnumClick = useCallback(() => {
handleClose();
navigate({
pathname: "/administrator",
search: "tabActive=enum"
});
}, [handleClose, navigate]);

return (
<>
<Button
variant="contained"
color="primary"
size="small"
onClick={handleClick}
endIcon={<ExpandMoreIcon />}
startIcon={<AddIcon />}
aria-controls={open ? "create-menu" : undefined}
aria-haspopup="true"
aria-expanded={open ? "true" : undefined}
data-cy="create-dropdown"
>
Create
</Button>
<Menu
id="create-menu"
anchorEl={anchorEl}
open={open}
onClose={handleClose}
anchorOrigin={{ horizontal: "left", vertical: "bottom" }}
transformOrigin={{ horizontal: "left", vertical: "top" }}
slotProps={{
paper: {
elevation: 2,
sx: { mt: 1.5, minWidth: 200 }
}
}}
>
<MenuItem
onClick={handleEntityClick}
data-cy="create-entity"
sx={{ gap: 1.5 }}
>
<CategoryIcon fontSize="small" />
Entity
</MenuItem>
<MenuItem
onClick={handleClassificationClick}
data-cy="create-classification"
sx={{ gap: 1.5 }}
>
<LocalOfferIcon fontSize="small" />
Classification
</MenuItem>
<MenuItem
onClick={handleGlossaryClick}
data-cy="create-glossary"
sx={{ gap: 1.5 }}
>
<MenuBookIcon fontSize="small" />
Glossary
</MenuItem>
<MenuItem
onClick={handleBusinessMetadataClick}
data-cy="create-business-metadata"
sx={{ gap: 1.5 }}
>
<BusinessCenterIcon fontSize="small" />
Business Metadata
</MenuItem>
<MenuItem
onClick={handleEnumClick}
data-cy="create-enum"
sx={{ gap: 1.5 }}
>
<ListIcon fontSize="small" />
Enum
</MenuItem>
</Menu>

{entityModal && (
<EntityForm
open={entityModal}
onClose={() => setEntityModal(false)}
/>
)}
{classificationModal && (
<ClassificationForm
open={classificationModal}
isAdd={true}
onClose={() => setClassificationModal(false)}
/>
)}
{glossaryModal && (
<AddUpdateGlossaryForm
open={glossaryModal}
isAdd={true}
onClose={() => setGlossaryModal(false)}
node={undefined}
/>
)}
</>
);
};

export default CreateDropdown;
1 change: 1 addition & 0 deletions dashboard/src/components/CreateDropdown/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./CreateDropdown";
1 change: 1 addition & 0 deletions dashboard/src/components/DialogShowMoreLess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ const DialogShowMoreLess = ({
button2Label="Remove"
button2Handler={handleRemove}
disableButton2={removeLoader}
button2Loading={removeLoader}
isDirty={true}
>
{relatedTerm ? (
Expand Down
Loading
Loading