From 6ed2b0e28c6447a04b7c432ab076446d34d20e41 Mon Sep 17 00:00:00 2001 From: Sny Date: Thu, 17 Oct 2024 11:17:49 +0530 Subject: [PATCH] Feedback | Repo view all attributes --- .../common/EntityAttributesDialog.jsx | 10 ++-- src/components/repos/RepoHeader.jsx | 50 ++++++++++++++++++- src/i18n/locales/en/translations.json | 23 ++++++++- 3 files changed, 78 insertions(+), 5 deletions(-) diff --git a/src/components/common/EntityAttributesDialog.jsx b/src/components/common/EntityAttributesDialog.jsx index 9b5808a1..2ac3ce5b 100644 --- a/src/components/common/EntityAttributesDialog.jsx +++ b/src/components/common/EntityAttributesDialog.jsx @@ -12,7 +12,7 @@ import TableRow from '@mui/material/TableRow'; import TableCell from '@mui/material/TableCell'; import { map, get } from 'lodash' import Link from '../common/Link' -import { formatWebsiteLink } from '../../common/utils' +import { formatWebsiteLink, formatDate, formatDateTime } from '../../common/utils' const EntityAttributesDialog = ({ entity, fields, open, onClose }) => { const { t } = useTranslation() @@ -21,10 +21,14 @@ const EntityAttributesDialog = ({ entity, fields, open, onClose }) => { if(value) { if(info.type === 'datetime') return moment(value).format('lll') + if(info.type === 'datetime') + return formatDateTime(value) + if(info.type === 'date') + return formatDate(value) if(info.type === 'external_link') return formatWebsiteLink(value) if(info.type === 'user') - return formatWebsiteLink(`${window.location.origin}/#/users/${value}/`, null, value) + return if(info.type === 'json') return
{JSON.stringify(value, undefined, 2)}
} @@ -35,7 +39,7 @@ const EntityAttributesDialog = ({ entity, fields, open, onClose }) => { open={open} onClose={onClose} scroll='paper' - maxWidth="xs" + maxWidth="sm" sx={{ '& .MuiDialog-paper': { backgroundColor: 'surface.n92', diff --git a/src/components/repos/RepoHeader.jsx b/src/components/repos/RepoHeader.jsx index 48add7af..f518d292 100644 --- a/src/components/repos/RepoHeader.jsx +++ b/src/components/repos/RepoHeader.jsx @@ -4,6 +4,7 @@ import Paper from '@mui/material/Paper' import Button from '@mui/material/Button'; import Typography from '@mui/material/Typography'; import DownIcon from '@mui/icons-material/ArrowDropDown'; +import { uniq, compact } from 'lodash' import RepoVersionChip from './RepoVersionChip'; import RepoChip from './RepoChip' import DotSeparator from '../common/DotSeparator'; @@ -12,11 +13,13 @@ import { PRIMARY_COLORS } from '../../common/colors'; import { formatDate } from '../../common/utils'; import RepoManagementList from './RepoManagementList'; import FollowActionButton from '../common/FollowActionButton' +import EntityAttributesDialog from '../common/EntityAttributesDialog' const RepoHeader = ({repo, owner, versions, onVersionChange, onCreateConceptClick}) => { const { t } = useTranslation() const [menu, setMenu] = React.useState(false) const [menuAnchorEl, setMenuAnchorEl] = React.useState(false) + const [viewAll, setViewAll] = React.useState(false) const onMenuOpen = event => { setMenuAnchorEl(event.currentTarget) setMenu(true) @@ -33,6 +36,14 @@ const RepoHeader = ({repo, owner, versions, onVersionChange, onCreateConceptClic } } + const getRepo = () => { + if(repo?.id) { + const {default_locale, supported_locales} = repo + repo.locales = uniq(compact([default_locale, ...(supported_locales || [])])) + } + return repo + } + return (
@@ -55,13 +66,50 @@ const RepoHeader = ({repo, owner, versions, onVersionChange, onCreateConceptClic
- {t('common.view_all_attributes')} + setViewAll(true)}>{t('common.view_all_attributes')} {t('common.updated_on')} {formatDate(repo.updated_on)}
+ setViewAll(false)} + />
) } diff --git a/src/i18n/locales/en/translations.json b/src/i18n/locales/en/translations.json index 8b1d4119..90a4dd1a 100644 --- a/src/i18n/locales/en/translations.json +++ b/src/i18n/locales/en/translations.json @@ -77,7 +77,8 @@ "draft": "Draft", "highlights": "Highlights", "click_to_copy": "Click to Copy", - "submit": "Submit" + "submit": "Submit", + "external_id": "External ID" }, "errors": { "404": "Sorry your page could not be found.", @@ -187,6 +188,26 @@ "compare_versions": "Compare versions", "compare": "Compare", "visibility": "Visibility", + "locales": "Locales", + "identifier": "Identifier", + "contact": "Contact", + "jurisdiction": "Jurisdiction", + "publisher": "Publisher", + "purpose": "Purpose", + "copyright": "Copyright", + "content_type": "Content Type", + "revision_date": "Revision Date", + "experimental": "Experimental", + "case_sensitive": "Case Sensitive", + "hierarchy_meaning": "Hierarchy Meaning", + "compositional": "Compositional", + "version_needed": "Version Needed", + "autoid_concept_mnemonic": "Concept ID Auto Assignment", + "autoid_concept_external_id": "Concept External ID Auto Assignment", + "autoid_concept_name_external_id": "Concept Name External ID Auto Assignment", + "autoid_concept_description_external_id": "Concept Description External ID Auto Assignment", + "autoid_mapping_mnemonic": "Mapping ID Auto Assignment", + "autoid_mapping_external_id": "Mapping External ID Auto Assignment", "custom_validation_schema": "Custom Validation Schema", "compare_origin_version_disabled_tooltip": "You must select an older version to compare", "compare_destination_version_disabled_tooltip": "You must select a newer version to compare"