{"version":3,"sources":["history.js","config.js","components/errors.js","components/api.js","components/LoginLogout.js","components/units/UnitContext.js","components/units/common.js","components/units/Unit.js","components/units/Quantity.js","utils.js","components/DataStore.js","components/archive/metainfo.js","components/Markdown.js","components/Help.js","components/utils/TooltipButton.js","components/datatable/Datatable.js","components/uploads/UploadStatusIcon.js","components/search/Filter.js","components/search/FilterRegistry.js","hooks.js","components/Actions.js","components/search/widgets/WidgetToggle.js","components/plotting/common.js","components/GUIMenu.js","components/search/input/InputHeader.js","components/search/input/InputTooltip.js","components/search/input/InputSection.js","components/visualization/Ellipsis.js","components/search/FilterTitle.js","components/search/widgets/WidgetHeader.js","components/search/widgets/Widget.js","components/search/SearchSuggestion.js","components/search/SearchContext.js","components/visualization/Placeholder.js","components/search/input/InputText.js","components/units/UnitInput.js","components/units/UnitDimensionSelect.js","components/units/UnitSystemSelect.js","components/units/UnitMenu.js","components/nav/MenuBar.js","images/about.svg","components/search/input/InputConfig.js","components/About.js","components/ErrorHandler.js","components/visualization/H5Web.js","components/archive/Browser.js","components/entry/Download.js","components/dataset/DOI.js","components/visualization/NoData.js","components/Quantity.js","components/buttons/LoadingButton.js","components/buttons/DownloadSystemButton.js","components/visualization/Floatable.js","components/visualization/StructureBase.js","components/visualization/Structure.js","components/archive/FilePreview.js","components/entry/EntryContext.js","components/north/NorthTool.js","components/Page.js","components/north/NorthPage.js","components/north/NorthLaunchButton.js","components/archive/FileBrowser.js","components/archive/visualizations.js","components/visualization/BrillouinZone.js","components/plotting/Plot.js","components/visualization/BandStructure.js","components/visualization/Spectra.js","components/visualization/DOS.js","components/visualization/EnergyVolumeCurve.js","components/archive/Overview.js","components/buttons/SourceDialogButton.js","components/visualization/Pagination.js","components/editQuantity/ListEditQuantity.js","components/editQuantity/DateTimeEditQuantity.js","components/editQuantity/StringEditQuantity.js","components/units/useDisplayUnit.js","components/editQuantity/NumberEditQuantity.js","components/editQuantity/EnumEditQuantity.js","components/editQuantity/AutocompleteEditQuantity.js","components/editQuantity/BoolEditQuantity.js","components/editQuantity/ActionEditQuantity.js","components/editQuantity/OverwriteExistingFileDialog.js","components/uploads/UploadProgressDialog.js","components/editQuantity/FileEditQuantity.js","components/editQuantity/RichTextEditQuantity.js","components/search/SearchSyntaxes.js","components/search/input/InputMetainfo.js","components/search/SearchBar.js","components/uploads/UploadPageContext.js","components/entry/EntryDownloadButton.js","components/entry/properties/PropertyCard.js","components/entry/properties/MaterialCard.js","components/entry/EntryDetails.js","components/material/MaterialDetails.js","components/search/SearchResults.js","components/uploads/SectionSelectDialog.js","components/uploads/SectionSelectAutocomplete.js","components/editQuantity/ReferenceEditQuantity.js","components/utils/apiUtils.js","components/editQuantity/AuthorEditQuantity.js","components/editQuantity/RadioEnumEditQuantity.js","components/visualization/Scrollable.js","components/search/menus/FilterSettings.js","components/search/menus/FilterMenu.js","components/search/input/InputGrid.js","components/search/input/InputCheckbox.js","components/search/input/InputPeriodicTable.js","components/search/widgets/StatisticsBar.js","components/search/input/InputItem.js","components/search/input/InputUnavailable.js","components/search/input/InputField.js","components/plotting/PlotTick.js","components/plotting/PlotLabel.js","components/plotting/PlotAxis.js","components/plotting/PlotBar.js","components/plotting/PlotHistogram.js","components/search/widgets/WidgetHistogram.js","components/search/input/InputRange.js","components/search/menus/FilterSubMenuElements.js","components/search/menus/FilterSubMenuStructure.js","components/search/menus/FilterSubMenuMethod.js","components/search/menus/FilterSubMenuPrecision.js","components/search/menus/FilterSubMenuDFT.js","components/search/menus/FilterSubMenuTB.js","components/search/menus/FilterSubMenuGW.js","components/search/menus/FilterSubMenuBSE.js","components/search/menus/FilterSubMenuDMFT.js","components/search/menus/FilterSubMenuEELS.js","components/search/menus/FilterSubMenuElectronic.js","components/search/menus/FilterSubMenuSolarCell.js","components/search/menus/FilterSubMenuCatalystProperties.js","components/search/menus/FilterSubMenuVibrational.js","components/search/menus/FilterSubMenuMechanical.js","components/search/menus/FilterSubMenuMolecularDynamics.js","components/search/menus/FilterSubMenuELN.js","components/search/menus/FilterSubMenuAuthor.js","components/search/input/InputRadio.js","components/search/menus/FilterSubMenuMetadata.js","components/search/menus/FilterSubMenuOptimade.js","components/search/menus/FilterSubMenuGeometryOptimization.js","components/search/menus/FilterSubMenuCustomQuantities.js","components/search/menus/FilterMainMenu.js","components/search/Query.js","components/plotting/PlotScatter.js","components/search/widgets/WidgetScatterPlot.js","components/search/widgets/WidgetEdit.js","components/search/widgets/WidgetPeriodicTable.js","components/search/widgets/WidgetTerms.js","components/search/widgets/WidgetGrid.js","components/search/widgets/WidgetScatterPlotEdit.js","components/search/widgets/WidgetHistogramEdit.js","components/search/widgets/Dashboard.js","components/search/SearchPage.js","components/editQuantity/QueryEditQuantity.js","components/editQuantity/EditQuantity.js","components/entry/properties/SectionCard.js","components/archive/SectionEditor.js","components/archive/PlotlyFigure.js","components/archive/ArchiveSearchBar.js","components/archive/XYPlot.js","components/archive/ArchiveBrowser.js","components/Histogram.js","components/archive/MetainfoBrowser.js","components/visualization/BandGap.js","components/visualization/GreensFunctions.js","components/visualization/ElectronicProperties.js","components/entry/properties/ElectronicPropertiesCard.js","components/visualization/SolarCell.js","components/visualization/OptoelectronicProperties.js","components/entry/properties/SolarCellPropertiesCard.js","components/visualization/StructureNGL.js","components/entry/properties/MaterialCardTopology.js","components/entry/properties/MaterialCardFormula.js","components/entry/properties/NexusCard.js","components/visualization/HeatCapacity.js","components/visualization/HelmholtzFreeEnergy.js","components/visualization/VibrationalProperties.js","components/entry/properties/VibrationalPropertiesCard.js","components/visualization/MechanicalProperties.js","components/entry/properties/MechanicalPropertiesCard.js","components/visualization/Trajectory.js","components/visualization/ThermodynamicProperties.js","components/entry/properties/ThermodynamicPropertiesCard.js","components/visualization/MeanSquaredDisplacement.js","components/entry/properties/DynamicalPropertiesCard.js","components/visualization/RadialDistributionFunction.js","components/visualization/RadiusOfGyration.js","components/visualization/StructuralProperties.js","components/entry/properties/StructuralPropertiesCard.js","components/visualization/GeometryOptimization.js","components/entry/properties/GeometryOptimizationCard.js","components/entry/properties/SpectroscopicPropertiesCard.js","components/entry/properties/RelatedResourcesCard.js","components/entry/properties/WorkflowCard.js","components/entry/properties/DefinitionsCard.js","components/entry/properties/ReferenceCard.js","components/entry/properties/SampleHistoryCard.js","components/uploads/DeletingReferencesTable.js","components/uploads/DeleteEntriesButton.js","components/entry/OverviewView.js","components/entry/ArchiveEntryView.js","components/entry/ArchiveLogView.js","components/entry/BrowseEntryFilesView.js","components/entry/EntryPage.js","components/uploads/NewUploadButton.js","components/uploads/ExampleUploadButton.js","components/uploads/DeleteUploadsButton.js","components/utils/DialogLink.js","components/utils/WithButton.js","components/uploads/CreateEntry.js","components/uploads/InviteUserDialog.js","components/uploads/memberUtils.js","components/uploads/EditMembersDialog.js","components/uploads/EditMetaDataDialog.js","components/uploads/FilePreview.js","components/uploads/FilesBrowser.js","components/uploads/ProcessingTable.js","components/uploads/UploadName.js","components/nav/MenuBarRoute.js","components/uploads/UploadSearchMenu.js","components/uploads/UploadOverview.js","components/uploads/UploadsPage.js","components/UserdataPage.js","components/AppTokenForm.js","components/APIs.js","components/entry/EntryQuery.js","components/entry/ResolvePID.js","components/dataset/DatasetPage.js","components/dataset/DatasetsPage.js","components/dataset/ResolveDOI.js","components/datatable/DatatableExamples.js","components/editQuantity/SliderEditQuantity.js","components/editQuantity/EditQuantityExamples.js","components/uploads/UploadFilesView.js","components/uploads/UploadProcessingStatus.js","components/archive/PlotExamples.js","components/nav/Routes.js","components/uploads/UploadPage.js","components/nav/MainMenu.js","components/nav/Breadcrumbs.js","components/nav/AppBar.js","components/nav/Navigation.js","components/App.js","index.js"],"names":["createBrowserHistory","basename","process","urlAbs","url","base","window","location","origin","protocol","absUrl","URL","href","oldProtocol","split","slice","length","normalizeConfig","config","isNil","normalize","obj","key","value","Object","entries","isPlainObject","options","include","keys","filter","exclude","includes","map","fromEntries","option","forOwn","v","k","nomadEnv","version","appBase","replace","apiBase","northBase","guiBase","ui","entry_points","plugins","apps","values","entry_point","entry_point_type","forEach","push","app","servicesUploadLimit","keycloakBase","keycloakRealm","keycloakClientId","debug","encyclopediaBase","oasis","globalLoginRequired","appTokenMaxExpiresIn","uploadMembersGroupSearchEnabled","dataciteEnabled","yamlSchemaPrefix","nomadArtifacts","searchQuantities","metainfo","parserMetadata","toolkitMetadata","exampleUploads","category","id","northTools","unitList","unitPrefixes","nomadPrimaryColor","main","light","dark","veryLight","nomadSecondaryColor","nomadFontFamily","join","nomadTheme","createTheme","typography","useNextVariants","fontFamily","fontWeightRegular","fontWeightMedium","palette","primary","secondary","overrides","MuiCssBaseline","backgroundColor","boxSizing","MuiTooltip","tooltip","fontWeight","fontSize","MuiTableRow","root","borderBottom","formatQuantity","x","parts","toString","electronicRange","dateFormat","msgNormalizationWarning","VersionMismatch","Error","constructor","msg","super","this","name","errorContext","React","createContext","errors","raiseError","ErrorSnacksUnstyled","Component","state","error","onError","errorStr","message","startsWith","status","apiMessage","console","log","String","indexOf","setState","onClose","render","children","classes","props","Provider","Snackbar","anchorOrigin","vertical","horizontal","open","handleClose","SnackbarContent","className","errorSnack","style","color","action","IconButton","size","onClick","bind","styles","theme","ErrorSnacks","withStyles","ErrorBoundary","hasError","_error","componentDidCatch","errorInfo","context","document","getElementById","display","useErrors","useContext","contextType","DoesNotExist","NotAuthorized","ApiError","ApiRequestError","handleApiError","e","response","body","description","data","detail","statusText","errorMessage","ResourcesApi","api","apiKey","axios","create","baseURL","paramsSerializer","indexes","path","query","doHttpRequest","get","params","methodName","Api","keycloak","setLoading","nLoading","onFinishLoading","show","onStartLoading","subscriptions","token","Promise","resolve","reject","updateToken","then","headers","catch","datasetId","auth","authHeaders","quantities","input","post","entryId","searchTarget","search","loadingIndicator","request","method","result","returnRequest","put","delete","noLoading","accept","results","jsonResponse","JSON","parse","repairJsonResponse","fullResponse","noHandleErrors","user","prefix","dataset_type","user_id","loadUserInfo","page_size","edit","quantity","many","Array","isArray","apiContext","APIProvider","memo","useKeycloak","useSetRecoilState","apiLoading","useState","setUser","useEffect","authenticated","async","getGroups","userInfo","sub","groups","group","group_id","useMemo","resourcesApi","infoState","atom","default","undefined","useApi","VerifyGlobalLogin","verified","setVerified","Fragment","Box","margin","Typography","GlobalLoginRequired","LoginRequired","padding","spacing","alignItems","marginRight","withLoginRequired","onKeycloakEvent","cookies","Cookies","pathname","set","expires","Date","tokenParsed","exp","timeSkew","sameSite","remove","useStyles","makeStyles","link","textDecoration","button","LoginLogout","variant","Link","Button","marginLeft","logout","startIcon","login","UnitMathJS","UNITS","deleteUnit","BASE_DIMENSIONS","splice","getOwnPropertyNames","BASE_UNITS","prop","PREFIXES","NONE","scientific","PINT","prefixes","isAlphaOriginal","isValidAlpha","c","Set","has","isSpecialChar","charCode","charCodeAt","isGreekLetter","unitToAbbreviationMap","unitDefinitions","def","baseName","dimension","abbreviation","aliases","alias","createUnit","override","unitMap","dimensionMap","oldInfo","label","startCase","toLower","oldList","units","getUnits","unitContext","UnitProvider","initialUnitSystems","initialSelected","resetUnitSystems","cloneDeep","isReset","setIsReset","unitSystems","setUnitSystems","selectedSystem","setSelectedSystem","currentScope","setCurrentScope","scopes","setScopes","scope","setScope","reset","useCallback","system","setScopeInfo","scopeKey","unit","setSelected","unitSystem","setUnits","old","newSystems","isFunction","selected","useUnitContext","defaultUnitSystem","others","deltaPrefixes","requireValue","requireUnit","parseResults","parseInternal","valueString","Unit","str","text","index","skipWhitespace","next","isDigit","charAt","revert","oldIndex","parseUnit","unitName","firstC","parseCharacter","toFind","parseNumber","number","isDigitDot","tentativeNumber","tentativeIndex","TypeError","powerMultiplierCurrent","expectingUnit","parseFloat","SyntaxError","powerMultiplierStack","powerMultiplierStackProduct","uStr","oldC","res","findUnit","power","p","delta","i","dimensions","pop","baseDim","UNIT_SYSTEMS","auto","memoize","endsWith","prefixLen","prefixName","substring","deltaPrefix","DIMENSIONLESS","isString","mathjsUnit","clone","equalBase","abbreviate","showDelta","strNum","strDen","nNum","nDen","getDelta","getName","getPrefix","original","prefixMap","deca","hecto","kilo","mega","giga","tera","peta","exa","zetta","yotta","deci","centi","milli","micro","nano","pico","femto","atto","zepto","yocto","kibi","mebi","gibi","tebi","pebi","exi","zebi","yobi","unitDef","Math","abs","substr","dims","d","to","toDelta","unitMathJS","toSI","toSystem","proposedUnitList","newUnitDefinition","definition","missingBaseDim","newDimensions","baseUnitDefinition","baseUnitList","newUnit","ret","Quantity","normalized","isNumber","normalized_value","denormalize","ignoreOffset","_isDerived","coefficients","conversion_coefficients","mapDeep","unitOffset","offset","unitValue","unitPrefixValue","unitPower","pow","equal","crypto","require","parserLabels","reduce","parser","codeName","codeLabel","capitalize","s","toUpperCase","setDeep","separator","segments","current","segment","func","newValue","mapRecursive","list","newList","iList","scale","factor","add","addition","distance","a","b","sum","now","mergeObjects","source","target","cloned","val","merge","titleCase","splitStr","toLowerCase","nameList","users","expanded","names","authorList","entry","external_db","authors","entryName","entry_name","type","entryType","formula","material","chemical_formula_hill","entry_type","simulation","parser_name","program","workflow","workflow_name","program_name","hasWebGL","hasWebGLSupport","w","canvas","createElement","WebGLRenderingContext","getContext","formatNumber","DType","Float","mode","decimals","absValue","toExponential","Number","toFixed","formatted","toLocaleString","approxInteger","formatInteger","Int","formatTimestamp","format","dateStyle","timeStyle","Timestamp","Enum","Boolean","Unknown","numericTypes","multiTypes","getDatatype","type_data","type_kind","getSerializer","dtype","pretty","newVal","valueConv","serializeMetainfo","getUnit","serializer","sleep","ms","setTimeout","tier","log10","suffix","scaled","nUsed","nDecimals","min","delay","pluralize","word","count","inclusive","dictionary","words","trim","lastWord","isPossessive","plural","form","formatLabel","isWaitingForUpdateTestId","stripIndent","code","lines","start","findIndex","line","indent","trimStart","getLocation","generateEntryId","uploadId","mainfile","mainfileKey","hash","createHash","update","digest","systemMetainfoUrl","refType","freeze","deployment","upload","archive","refRelativeTo","nothing","parseNomadUrl","relativeTo","deploymentUrl","isResolved","isExternal","qualifiedName","versionHash","dataPath","rest","rawPath","bracketPos","apiPos","match","restParts","decodeURIComponent","atPos","dataPathSegments","firstDataPathSegment","resolveNomadUrl","baseUrl","parsedUrl","parsedBaseUrl","resolveNomadUrlNoThrow","relativizeNomadUrl","normalizeNomadUrl","rv","createUploadUrl","rawPathUnescaped","isNaN","rawPathEscaped","urlEncodePath","createEntryUrl","appendDataUrl","dataPathSuffix","urlJoin","components","component","encodeURIComponent","resolveInternalRef","ref","resolveInternalRefSingle","_properties","sub_section","repeats","m_def","parseInt","alphabet","getSuggestions","minLength","normalizer","item","inputNormalized","suggestions","sort","suggestion","download","filename","content","appendChild","remoteData","createObjectURL","click","removeChild","revokeObjectURL","sep","maxsplit","concat","rsplit","getSchemaAbbreviation","schema","parseQuantityName","fullName","dtypeParts","schemaNew","parseOperator","operators","op","getOptions","glob","isEmpty","pattern","minimatch","parseJMESPath","exec","ast","jmespath","compile","validateJMESPath","extras","field","extrasList","recurseAST","node","childFields","childExtras","child","fieldInner","extrasInner","childField","childExtra","cleanse","getDisplayLabel","isArchive","technicalView","labelAnnotation","m_annotations","eln","more","isSection","isEmptyString","isUploadVisibleForAll","viewer_groups","addSubscription","storeObj","cb","_subscriptions","removeSubscription","store","subscription","metainfoArchiveFilter","definitions","metadata","dataStoreContext","useDataStore","DataStore","userRef","useRef","storeKey","selectedEntry","entryBreadCrumb","innerText","uploadBreadCrumb","breadcrumb","uploadRef","entryRef","setUpload","setEntry","getUpload","getEntry","uploadStore","entryStore","metainfoDataStore","frozenMetainfoCache","externalInheritanceCache","uploadStoreObj","deletionRequested","apiData","pagination","page","order","order_by","hasUpload","isProcessing","isViewer","isWriter","isMainAuthor","isEditable","isVisibleForAll","isRefreshing","requestOptions","requireUpload","requireEntriesPage","refreshOptions","updateUpload","dataToUpdate","requestRefreshUpload","subscribeToUpload","initiateUploadRefreshIfNeeded","updateUserDependentAttributes","viewers","writers","writer_groups","some","g","main_author","published","notifySubscribers","oldStoreObj","newStoreObj","process_running","current_process","refreshUpload","currentPagination","uploadDataMissing","entryDataMissing","pag","pagIs","wrongPagination","every","raise","entryStoreObj","metadataApiData","archiveApiData","originalDefinition","exists","editable","archiveVersion","savedArchiveVersion","archiveHasChanges","requireMetadata","requireArchive","handleArchiveChanged","saveArchive","reload","requestRefreshEntry","getEntryAsync","entryRefreshSatisfiesOptions","subscribeToEntry","mergeArchiveFilter","initiateEntryRefreshIfNeeded","updateEntry","refreshEntry","upload_id","u","isEditableArchive","assign","required","fileName","isYaml","isJson","decompress","ignore_mime_type","transformResponse","rawArchive","YAML","processing_logs","oldTimestamp","last_processing_time","newTimestamp","oldRequireArchive","lastRefreshSatisfiesOptions","separatorIndex","lastIndexOf","newArchive","m_ref_archives","stringifiedArchive","stringify","entry_hash","getMetainfoAsync","metainfoData","metainfoBaseUrl","getMetainfoBaseUrl","frozenDef","getMetainfoFromDefinition","_result","fetchMetainfoData","_metainfo","parent","Metainfo","currentSystemMetainfoData","_url","_parsedUrl","parsedMetainfoBaseUrl","frozenMetainfo","definition_id","traversAllInheritingSections","getUrlFromDefinition","_allInternalInheritingSections","recursive","inheritingSection","newUploadObj","contextValue","getUploadAsync","uploadRefreshSatisfiesOptions","getMetainfoDefAsync","getDefByQualifiedName","getDefByPath","getAllInheritingSections","sectionDef","sectionDefs","_qualifiedName","resetIfNeeded","newStoreKey","resetEntryAndMetainfoCaches","useEntryStoreObj","dataStore","setEntryStoreObj","rawStoreObj","reducedEntryStoreObj","oldFilterKey","onEntryStoreUpdated","satisfiesOptions","lastProcessingTime","newFilterKey","archiveFilterExtends","filter1","filter2","level","obj1","obj2","hasIncludeResolved","value1","value2","f","metainfoContext","GlobalMetainfo","globalMetainfo","useMetainfo","allCustomMetainfos","setAllCustomMetainfos","fetchAllCustomMetainfos","refresh","owner","processed","entry_id","foundCustomMetainfos","customMetainfo","useGlobalMetainfo","setMetainfo","PackageMDef","SectionMDef","QuantityMDef","SubSectionMDef","CategoryMDef","AttributeMDef","quantityUsesFullStorage","variable","attributes","_parent","_data","_getMetainfoAsync","_frozenMetainfoCache","_externalInheritanceCache","_defs","_packageDefs","_defsByNameCache","_packagePrefixCache","_rootSectionsCache","_isParsed","_parse","getDefs","getDefsByName","defQualifiedNameSegments","pkg","shift","sectionName","section_def","section_definitions","part","inner_section_def","inner_section_definitions","packageName","_sections","getPackagePrefixes","getRootSectionDefinitions","extends_base_section","_parentSections","localeCompare","getEntryArchiveDefinition","find","packages","_addDefIdsToCache","pkgIndex","_addPackage","subDefs","category_definitions","subDef","categories","resolveDefinitionList","_allBaseSections","base_sections","sub_sections","_parentSubSections","resolvedBaseSections","baseSectionRef","baseSection","resolveDefinition","_initSection","baseBaseSection","baseSectionUrl","externalInheritingSections","allSectionAttributes","allQuantityAttributes","createAddAttributes","inherited","createAddAttribute","allAttributes","attribute","_overwritten","quantitiy","quantityAttributes","reverse","_allAttributes","allAttritbutes","createAddProperties","createAddProperty","property","parentDef","parentProperty","parentIndex","_parentProperty","_parentIndex","_unique_id","_package","innerSectionDef","_addSection","extending_sections","sections","extendingSectionDef","addPropertiesFromSections","_addDef","_allProperties","_getAllProperties","addNewProperty","_section","shape","isReference","referencedDefinition","_referencedDefinition","subSectionsSectionDef","_createAllAttributes","unique_id","pkgParentData","_pkgParentData","categoryDef","nameOrDef","defsByName","visitedSubSections","parentSubSections","subSection","references","reference","resolvedUrl","refPath","reducer","preferMainfile","parentUrl","traverse","section","callback","subSectionDef","subSections","childPath","getQuantities","branch","quantityName","sub_section_def","MarkdownLink","RouterLink","marginTop","position","borderRadius","overflow","WebkitOverflowScrolling","lineHeight","marginBottom","extend","h3","h5","h4","h6","paddingLeft","listStyleType","wordBreak","opacity","hint","width","height","fill","overflowX","borderCollapse","borderSpacing","divider","textAlign","paddingRight","whiteSpace","borderLeft","background","paper","maxWidth","moreProps","letters","peek","newProps","remarkPlugins","RemarkMathPlugin","remarkGfm","math","Node","inlineMath","inline","md","HelpButton","forwardRef","heading","IconProps","IconButtonProps","setOpen","handleToggleOpen","HelpDialog","Dialog","DialogTitle","DialogContent","DialogActions","TooltipButton","title","Tooltip","DatatableContext","StaticDatatableContext","combinePagination","total","page_after_value","next_page_after_value","addColumnDefaults","columns","moreDefaults","filterData","column","keySegments","row","sortable","multiple","align","useDatatableContext","useStaticDatatableContext","DatatablePagePagination","pageSizeValues","onPaginationChanged","TablePagination","rowsPerPageOptions","rowsPerPage","onPageChange","event","newPage","onRowsPerPageChange","useDatatableLoadMorePaginationStyles","flexDirection","justifyContent","flexWrap","DatatableLoadMorePagination","handleClick","CircularProgress","useDateatableScollPaginationStyles","DatatableScrollPagination","loadMessage","useDatatableHeaderStyles","visuallyHidden","border","clip","top","stickyHeader","DatatableHeader","actions","withSelectionFeature","multiSelect","onSelectedChanged","shownColumns","sortingColumns","withSorting","createSortHandler","isAsc","sortableColumns","TableHead","TableRow","TableCell","Checkbox","indeterminate","checked","onChange","columnLabel","placement","sortDirection","TableSortLabel","active","direction","useDatatableRowStyles","rowHover","rowSelected","lighten","rowWithDetails","rowWithUncollapsedDetails","contrastText","rowClickable","cursor","rowActionsCell","paddingTop","paddingBottom","right","rowActionsList","detailsCell","DatatableRow","uncollapsed","onRowUncollapsed","details","progressIcon","getId","numberOfColumns","handleSelect","stopPropagation","hover","clsx","role","tabIndex","colSpan","Collapse","in","timeout","unmountOnExit","useDatatableTableStyles","tableContainer","flexGrow","DatatableTable","noHeader","defaultUncollapsedRow","emptyRows","max","isScrolling","isExtending","scrollParentRef","uncollapsedRow","setUncollapsedRow","handleLoadMore","dataToShow","table","Table","TableBody","process_status","TableContainer","pageStart","loadMore","hasMore","useWindow","getScrollParent","DatatableToolbarActions","selection","hasSelection","useDatatableToolbarStyles","highlight","flex","DatatableToolbar","hideColumns","Toolbar","DatatableColumnSelector","anchorEl","setAnchorEl","onShownColumnsChanged","currentTarget","Popover","transformOrigin","List","ListItem","dense","handleToggle","disableRipple","ListItemText","Datatable","contextProps","setShownColumns","shownColumnsObjects","shownColumn","staticContext","defaultProps","UploadStatusIcon","coauthors","reviewers","shared","isReviewer","isCoauthor","Icon","VisibleIcon","SharedIcon","PrivateIcon","with_embargo","NotVisibleIcon","PublishedIcon","Filter","getRepeatsSection","placeholder","exclusive","queryMode","getEnumOptions","aggs","requestQuantity","nested","getRepeatsQuantity","repeats_section","scalar","global","customSerialization","serializerExact","serializerPretty","deserializer","true","false","keywords","aggregatable","widget","getWidgetConfig","metainfoOptions","opt","y","showinput","autorange","nbins","layout","sm","h","minW","minH","lg","xl","xxl","defaultFilterGroups","defaultFilterData","dtypeMap","idElements","idStructure","idMethod","idDFT","idGW","idBSE","idDMFT","idPrecision","idElectronic","idCatalyst","idMechanical","idSpectroscopic","idMolecularDynamics","idELN","idCustomQuantities","idAuthor","idMetadata","addToGroup","groupName","saveFilter","newConf","registerFilter","subQuantities","subConfig","registerFilterOptions","terms","agg","newQuery","oldQuery","termQuantity","termQuantityBool","termQuantityNonExclusive","termQuantityAll","termQuantityAllNonExclusive","noAggQuantity","nestedQuantity","noQueryQuantity","numberHistogramQuantity","jsonStr","and","elementData","elements","isSet","band_structure_electronic","dos_electronic","greens_functions_electronic","eels","dos_phonon","band_structure_phonon","energy_free_helmholtz","heat_capacity_constant_volume","bulk_modulus","shear_modulus","energy_volume_curve","trajectory","quantityNameSearch","getStaticSuggestions","filters","withFilters","WrappedComponent","WithFilters","initialFilters","yamlOptions","nexusOptions","initialFilterData","initialFilterGroups","defaultFilters","pythonFilterData","mergedFilterGroups","dynamic","loadingYaml","setLoadingYaml","loadingNexus","setLoadingNexus","setFilters","filterGroups","setFilterGroups","nexusFilters","nexusFilterGroups","sectionPath","nx_category","filterPath","newGroups","yamlFilters","yamlFilterGroups","schemaPath","schemaDefinition","apiPath","fetchSchemas","displayName","getWindowSize","windowWidth","innerWidth","windowHeight","innerHeight","useWindowSize","setSize","handleResize","addEventListener","removeEventListener","useBoolState","initialValue","setValue","useSuggestions","quantitiesSuggest","quantitiesAll","debounceTime","loading","setSuggestions","currentRequest","staticSuggestions","fetchSuggestions","flatten","suggestionsList","q","quantitiesFixed","quantitiesDynamic","suggestionsTemp","fixed","promise","esSuggestions","finally","fetchSuggestionsDebounced","debounce","maxWait","trimmedInput","useAsyncError","setError","useActionsStyles","Actions","useDynamicStyles","dynamicStyles","useActionHeaderStyles","minWidth","spacer","ActionHeader","disableSpacer","useActionStyles","Action","disabled","onMouseDown","onMouseUp","TooltipProps","ButtonComponent","ButtonProps","testID","ActionSelect","isStatsTooltipOpen","openStatsTooltip","closeStatsTooltip","items","disableHoverListener","Select","onMouseEnter","onMouseLeave","onOpen","MenuItem","ActionCheckbox","FormControlLabel","control","WidgetToggle","useWidgetValue","useAddWidget","useRemoveWidget","useSearchContext","addWidget","removeWidget","hasWidget","widgetDefault","editing","visible","scales","scalesLimited","getScaler","scaler","domain","range","powScales","powscale","scalePow","exponent","adjustedDomain","scaleLog","argMin","iMin","arr","getXAxisLayout","automargin","linecolor","linewidth","mirror","ticks","showline","fixedrange","standoff","font","family","tickfont","getYAxisLayout","getLineStyles","nLines","nKinds","lineStyles","startColor","endColor","colors","chromaScale","dash","floor","presets","new","icon","iconSize","menu","inputVariant","inputSize","aggIndicator","aggCollapse","usePrototypeMenuItemStyles","GUIMenuItem","FormControl","InputLabel","bottom","zIndex","GUIMenu","setVisible","setIcon","useRecoilState","guiState","setIconSize","setMenu","setInputVariant","setInputSize","setAggIndicator","setAggCollapse","preset","useRecoilValue","presetState","handleHotkey","altKey","updatePreset","useRecoilCallback","presetMap","Menu","atomFamily","menuItem","InputHeader","disableWidget","disableStatistics","onChangeScale","actionsAlign","isSettingsOpen","isDragging","setDragging","setNotDragging","isTooltipOpen","openTooltip","closeTooltip","openMenu","closeMenu","handleMouseDown","handleMouseUp","tooltipProps","menuComp","getContentAnchorEl","keepMounted","FormLabel","RadioGroup","Radio","underscores","InputTooltip","unavailable","inputSectionContext","InputSection","disableHeader","useTheme","descFinal","labelFinal","textOverflow","ellipsisFront","Ellipsis","front","useResizeDetector","showTooltip","setShowTooltip","compareSize","compare","scrollWidth","clientWidth","useStaticStyles","grey","down","writingMode","textOrientation","up","transform","FilterTitle","rotation","disableUnit","noWrap","sectionContext","finalLabel","finalUnit","finalDescription","interactive","enterDelay","enterNextDelay","handle","WidgetHeader","handleRemove","full","Cancel","Widget","onEdit","handleEdit","actionsFinal","Edit","anchored","schemaLayout","object","test","isInteger","Infinity","integer","schemaWidget","string","strip","schemaAxisBase","nullable","schemaAxis","schemaAxisOptional","schemaMarkers","getWidgetsObject","widgetList","widgets","SearchSuggestion","param","history","SuggestionType","useWidthConstrainedStyles","WidthConstrained","parseQueryString","queryString","qs","comma","removeKeycloak","RouteListener","useLocation","useHistory","useQueryString","useSetFilters","useParseQueries","parseQueries","propTypes","searchContext","SearchContextRaw","resource","initialFiltersLocked","initialColumns","initialRows","initialFilterMenus","initialPagination","initialDashboard","initialFilterValues","initialSearchSyntaxes","suggestionHistorySize","oldPagination","paginationResponse","updatedAggsMap","apiQueue","apiMap","updatedFilters","firstLoad","disableUpdate","indexFilters","indexLocked","contextID","uuidv4","initialFilterPaths","initialFilterAbbreviations","getAbbreviations","storageUnit","displayUnit","isList","flattenDeep","renderValue","isBoolean","formatBoolean","upload_create_time","entry_create_time","refs","datasets","dataset","dataset_name","rows","filterMenus","dashboard","initialQuery","initialAggs","filterDefaults","filterFullnames","useFilterLocked","useFiltersLocked","useFiltersLockedState","useFilterValue","useSetFilter","useFilterState","useFilters","useFilterNames","useFiltersData","useFilterMaps","useResetFilters","useDynamicQueryModes","aggsFamily","useSetWidget","useWidgetState","useWidgetsValue","useWidgetsState","useResetWidgets","useQuery","useSearchSuggestionsValue","useSetSearchSuggestions","usePagination","useSetPagination","usePaginationState","useAgg","useAggs","useSetAggsResponse","useUpdateFilter","useIsMenuOpen","useSetIsMenuOpen","useIsCollapsed","useSetIsCollapsed","useIsStatisticsEnabled","useSetIsStatisticsEnabled","useApiQuery","useSetApiQuery","useApiData","useSetApiData","useResults","useSetResults","useResultsUsed","useRequired","isMenuOpenState","isCollapsedState","isStatisticsEnabledState","apiDataState","apiQueryState","resultsState","resultsUsedState","suggestionID","localStorage","getItem","searchSuggestionsState","effects","onSet","_","removeItem","setItem","requiredState","filtersDataState","filterNamesState","selector","queryFamily","dynamicQueryModesFamily","filtersState","filterMapsState","paginationState","guiLocked","lockedFamily","lockedState","locks","queryState","isObject","dynamicQueryModesState","widgetFamily","widgetIds","widgetsState","ids","stats","stat","aggsFamilyRaw","aggKeys","selectorFamily","prev","aggsState","aggsResponseFamily","aggsResponseState","subname","setter","dynamicQueryModeSetter","clearEmpty","filterState","filterNames","filtersData","filterAbbreviations","convert","opKeys","fullPath","keyInner","valueInner","valueConverted","queryStringQuery","indices","convertQueryGUIToQS","setAgg","aggResponse","defaults","finalConfig","useSetFiltersData","setResultsUsed","useSetResultsUsed","setResults","setApiData","setApiQuery","setPagination","updateAggsResponse","dynamicQueryModes","filtersLocked","resultsUsed","timestamp","queryChanged","paginationChanged","aggsToUpdate","callbackAgg","callbackHits","aggregations","newAggs","aggsCustomized","filter_name","aggConfig","aggGet","aggFinal","exhausted","convertAggAPIToGUI","newResults","nextTimestamp","nextResolve","apiCall","updateAggs","aggsChanged","changed","apiQuery","customQuery","convertQueryGUIToAPI","lockedQuery","finalQuery","custom_quantities","visibility","convertAggGUIToAPI","convertPaginationGUItoAPI","convertRequiredGUItoAPI","apiCallDebounced","apiCallInterMediate","forceUpdate","reducedAggs","reduceAggs","searchSyntaxes","useParseQuery","parseQuery","useSearchSuggestions","suggestionFilter","usePushSearchSuggestion","newSuggestions","newSuggestion","useRemoveSearchSuggestion","useRefresh","useHits","useAggCall","aggCall","FreeformSearchContext","SearchContext","compose","WithQueryString","firstRender","valueRef","isOperator","newKey","valueGUI","queryModes","queryCustomized","customize","subKey","sectionData","keyNested","valueNested","queryNormalized","filterName","finalKey","convertQuerySingleGUIToAPI","getFilterMaterialPath","finalQueryMode","combine","entrySearch","convertItem","from","acc","apiValue","apiAggs","apiAgg","aggSet","finalAgg","finalQuantity","exclude_from_search","oldAggs","oldAgg","aggParams","aggParamsOld","isEqual","newAgg","getValue","filterLocked","defaultValue","abbreviations","nameAbbreviationPairs","fullname","materialPath","skeleton","Placeholder","margins","left","Skeleton","useInputTextFieldStyles","InputTextField","initialLabel","TextField","hiddenLabel","useInputTextStyles","popupIndicatorOpen","adornmentList","adornment","listbox","InputText","shrink","onAccept","onSelect","onHighlight","onBlur","onFocus","getOptionLabel","groupBy","renderOption","renderGroup","suggestAllOnFocus","showOpenSuggestions","autoHighlight","ListboxComponent","filterOptions","TextFieldProps","InputProps","PaperComponent","disableClearable","disableAcceptOnBlur","validate","disableValidateOnSelect","suggestAll","setSuggestAll","highlightRef","clearInputValue","handleAccept","valid","handleHighlight","reason","handleBlur","handleKeyDown","preventDefault","handleInputChange","Autocomplete","freeSolo","clearOnBlur","inputValue","fullWidth","onInputChange","onHighlightChange","getOptionSelected","selectOnFocus","renderInput","helperText","onKeyDown","InputLabelProps","endAdornment","iconButton","popupIndicator","InputTextQuantity","disableSuggestions","setInputValue","suggestionInput","setSuggestionInput","highlighted","setHighlighted","quantitiesSuggestion","suggestionsAuto","loadingAuto","finalSuggestions","finalLoading","disableSuggestionsFinal","setFilter","handleChange","handleSubmit","useInputStyles","optionText","scrollbarWidth","UnitInput","disableGroup","optional","finalOptions","unitAbbreviation","filtered","ListboxUnit","primaryTypographyProps","secondaryTypographyProps","other","itemData","Children","toArray","itemCount","getChildSize","isValidElement","ListSubheader","gridRef","resetAfterIndex","useResetCache","OuterElementContext","disablePadding","LISTBOX_PADDING","outerElementType","OuterElementType","innerElementType","itemSize","overscanCount","renderRow","outerProps","cloneElement","UnitDimensionSelect","disabledFinal","locked","oldValue","unitString","UnitSystemSelect","handleSystemChange","UnitMenu","onUnitChange","onSystemChange","dimensionOptions","setDimension","dimensionInput","setDimensionInput","cleanValue","dim","px","py","mt","useMenuBarStyles","MenuBar","MenuBarList","header","MenuList","subheader","useMenuBarItemStyles","MenuBarItem","route","matchPath","useMenuBarMenuStyles","menuPopover","pointerEvents","menuPaper","MenuBarMenu","handleOpen","disableElevation","endIcon","PopoverClasses","elevation","_clipPath","_g","_g2","_g3","_g4","_g5","_tspan","_tspan2","_tspan3","_tspan4","_extends","arguments","prototype","hasOwnProperty","call","apply","SvgAbout","_ref","svgRef","titleId","viewBox","fillRule","clipRule","strokeLinecap","strokeLinejoin","strokeMiterlimit","clipPath","stroke","strokeWidth","fillOpacity","ForwardRef","InputConfig","maxRows","minRows","readOnly","controlledError","serialized","setSerialized","errorInternal","setErrorInternal","errorFinal","formatLib","handleError","multiline","InfoDialog","DialogProps","DistributionInfo","setTitle","plugin_entry_points","entryPoint","plugin_type","plugin_packages","pluginPackage","entryPoints","CodeInfo","introduction","codeUrl","tableOfFiles","parserSpecific","parserGitUrl","CodeList","withUploadInstructions","categorySizes","codes","codeCategory","nameA","nameB","categoryA","categoryB","sizeA","sizeB","currentCategory","categoryIndex","codeshtml","categoryTmp","html","useCardStyles","InfoCard","xs","Grid","Card","CardContent","container","ErrorHandler","Alert","severity","withErrorHandler","withWebGLErrorHandler","H5Web","initialPath","sidebarOpen","filepath","setFilepath","fname","getExportURL","file","Authorization","File","axiosConfig","disableDarkMode","escapeBadPathChars","Adaptor","initialize","cleanup","itemAdaptor","depends","browserContext","useBrowserStyles","flexFlow","lanesContainer","overflowY","scrollBehavior","lanes","sideLane","Browser","adaptor","rootRef","outerRef","innerRef","useRouteMatch","hdf5Path","setHdf5Path","hdf5Filename","setHdf5Filename","checkHdf5Path","m_nx_data_path","checkHdf5File","m_nx_data_file","useLayoutEffect","getBoundingClientRect","scrollAmmount","scrollLeft","setInternalRender","internalUpdate","computingForUrl","computeLanes","rootPath","oldLanes","newLanes","lane","newLaneCreated","encodeURI","initialized","oldLane","m_attributes","invalidateLanesFromIndex","droppedLane","invalidateLanesWithDependency","dependency","dependencies","Lane","laneContext","useLane","useLaneStyles","borderRight","containerRef","oldScrollValue","updateLane","handleScroll","onScrollToEnd","threshold","scrollHeight","clientHeight","scrollTop","onScroll","onRendered","useItemStyles","rootSelected","rootUnSelected","rootUnSelectedHighlighted","rightPaddedItem","childContainer","ItemLink","itemKey","ItemButton","itemLink","Item","chip","isSelected","wrap","classNames","Chip","Content","Compartment","startCollapsed","onUnfold","collapsed","setCollapsed","ItemChip","useTitleStyles","titleGridItem","sectionLabel","sectionValue","flexShrink","LinkWithCopyToClipboard","onCopy","Title","definitionName","subSectionName","Download","DOIUnstyled","doi","parentheses","DOI","fontStyle","userSelect","NoData","useQuantityStyles","valueContainer","valueAction","valueActionButton","valueActionIcon","alignContent","quantityList","quantityPresets","noLabel","withClipboard","hideIfUnavailable","getRenderFromType","clipboardContent","isQuantityString","useLabel","finalValue","PopperProps","disablePortal","nElementMap","ds","RouteLink","dataset_id","comment","last_processing_version","nomad_version","nomad_commit","material_id","MaterialLink","materialId","n","raw_id","external_id","useMetaInfoTableStyles","tableLayout","MetaInfoTable","quantityTableContext","QuantityTable","useRowStyles","QuantityRow","useCellStyles","QuantityCell","contextData","finalData","SectionTable","showIndex","defCustom","unitLabel","j","Q","addMethodQuantities","parentKey","metainfoPath","cell","LoadingButton","buttonProps","formats","cif","xyz","pdb","wrapModes","unwrap","WrapModeRadio","DownloadSystemMenu","setFormat","wrapMode","setWrapMode","handleChangeFormat","handleChangeWrapMode","handleClickDownload","responseType","contentDisposition","select","dialogContent","dialogActions","Floatable","float","onFloat","onResize","actionsHeight","windowRatio","ratio","dialogRoot","maxHeight","useNoReparentStyles","FloatableNoReparent","windowSize","handleFloat","marginAbsolute","Paper","Backdrop","backdrop","legend","minHeight","StructureBase","onWrapModeChange","disableWrapMode","showLatticeConstants","onShowLatticeConstants","disableShowLatticeConstants","showBonds","onShowBonds","disableShowBonds","showCell","onShowCell","disableShowCell","onReset","onTakeScreenshot","onFullscreen","species","prompt","noData","captureName","disableLegend","disableFileDownload","m_path","systemAnchorEl","setSystemAnchorEl","downloadDisabled","setShowBonds","handleWrapModeChange","handleShowLatticeConstants","setShowCell","handleFullscreen","handleReset","openSystemMenu","takeScreencapture","overlay","Species","FullscreenExit","Fullscreen","GetApp","CameraAlt","ViewList","useSpeciesStyles","grid","gridTemplateColumns","gridGap","justifySelf","alignSelf","textShadow","circle","radius","atomicNumber","sqrt","getRadius","alpha","Structure","structuralType","cellType","sizeLimit","bondLimit","fullscreen","setFullscreen","setShowLatticeConstantsState","setShowCellState","center","setCenter","fit","setFit","setWrapState","showPrompt","setShowPrompt","accepted","setAccepted","setShowBondsState","setSpecies","ready","setReady","throwError","refViewer","bonds","enabled","setWrap","setShowLatticeConstants","latticeConstants","readyRef","refCanvasDiv","nAtoms","positions","hasCell","refCanvas","changeHostElement","loadSystem","isHighQuality","renderer","antialias","pixelRatioScale","shadows","atoms","smoothness","outline","StructureViewer","load","controls","resetOnDoubleClick","info","elementNumbers","resetCamera","setRotation","showBondsValue","rotations","alignments","isSubsystem","focus","transparent","rotate","saveCameraReset","toggleFullscreen","takeScreenShot","pdfjs","GlobalWorkerOptions","workerSrc","useFilePreviewStyles","scrollableContainer","img","viewerText","fileExtensions","maxSizePreview","maxSizeAutoPreview","FilePreviewText","setFailedToPreview","src","alt","requiresLoadedData","enableClipboard","displayObjectSize","FilePreviewPdf","withCredentials","cifData","parseCifStructures","cifStructure","structureData","get_cell","pbc","get_pbc","get_positions","get_chemical_symbols","FilePreview","fileExtension","autoPreview","selectedViewer","viewer","preview","setPreview","failedToPreview","useFallbackViewer","setUseFallbackViewer","dataLoaded","setDataLoaded","encodedPath","useFilePreviewTextStyles","containerDiv","fileContents","contents","setContents","setHasMore","loadFailed","setLoadFailed","nBytes","useFilePreviewPdfStyles","pageDiv","numPages","setNumPages","pageWidth","setPageWidth","onLoadSuccess","renderMode","pageNumber","useEntryStore","entryContext","useEntryContext","EntryContext","cards","finalCards","northToolContext","useNorthTool","launchButtonLabels","stoppButtonLabels","LaunchButton","NorthToolButtons","launch","stop","imageIcon","iconRoot","NorthTool","tool","short_description","path_prefix","with_path","getToolStatus","toolStatus","toolUrl","username","upload_mount_dir","marginY","limitedWidth","limitedHeight","fullHeight","Page","pageWithWidth","disableWidth","useNorthToolStyles","iconImg","screenShotImg","NorthToolAccordion","file_extensions","maintainer","Accordion","AccordionSummary","expandIcon","AccordionDetails","email","curr","extension","tools","useTools","setExpanded","north","_tools","NorthLaunchButton","toolsData","Divider","FileBrowser","uploadUrl","rootTitle","highlightedItem","RawDirectoryAdaptor","lastPage","complete_time","fetchData","elementsByName","directory_metadata","element","extendedUrl","scrollToNextPage","is_file","RawFileAdaptor","RawDirectoryContent","CustomDropZone","onDrop","classNameNormal","classNameActive","otherProps","setActive","dragTargetsRef","onDragEnter","onDragLeave","targets","targetIdx","onDragOver","onDropped","useRawDirectoryContentStyles","dropzoneLane","dropzoneTop","dropzoneActive","entryPageMainFile","browser","openConfirmDeleteDirDialog","setOpenConfirmDeleteDirDialog","openCreateDirDialog","setOpenCreateDirDialog","openCopyMoveDialog","setOpenCopyMoveDialog","openDuplicateDialog","setOpenDuplicateDialog","setFileName","copyFileName","createDirName","refreshIfNeeded","handleDropFiles","files","formData","FormData","append","handleDrop","fromEvent","_filePath","dataTransfer","getData","handleCopyMoveFile","moveFile","handleCreateDir","dirName","handleDeleteDir","gotoLane","getRootProps","getInputProps","useDropzone","downloadUrl","DialogContentText","autoFocus","inputRef","RecognizedFileIcon","FileIcon","FolderIcon","file_metadata","archiveUrl","archiveAdaptorFactory","FilePreviewAdaptor","RawFileContent","openConfirmDeleteFileDialog","setOpenConfirmDeleteFileDialog","allNorthTools","applicableNorthTools","niceSize","round","EntryButton","filesize","MatrixPagination","useMatrixStyles","leftBracket","matrix","rightBracket","Matrix","invert","matrixRef","pages","setPages","pageLengths","ii","columnWidth","rowCount","columnCount","rowIndex","columnIndex","rowHeight","fitMargin","BrillouinZone","BrillouinZoneViewer","kpoints","basis","reciprocal_cell","previousPoint","seg","labels","endpoints_labels","end","faces","point","pan","footer","canvasContainer","placeholderRoot","floatable","warning","Plot","floatTitle","metaInfoLink","capture","fixedMargins","placeHolderStyle","noDataStyle","onRelayout","onRedraw","onRelayouting","onHover","onSelected","onSelecting","onDeselect","onWebglContextLost","layoutSubject","disableDefaultActions","throttleResize","setFloat","setRatio","canvasNode","setCanvasNode","attach","sizeReady","setSizeReady","canvasSize","layoutRecoverRef","resetInfo","captureSettings","maxSize","nodata","canvasRef","finalLayout","withTitle","template","annotations","defaultLayout","dragmode","hovermode","showlegend","autosize","l","r","t","yanchor","bgcolor","xaxis","yaxis","yaxis2","scrollZoom","displayModeBar","showTips","responsive","rangeX","rangeY","rangeY2","getLayout","oldLayout","newLayout","fixMargins","currentLayout","subPlots","xMin","xMax","subPlot","getAttribute","totalWidth","Plotly","relayout","requestAnimationFrame","newPlot","subscribe","react","on","hasX","hasY","hasY2","saveLayout","handleCapture","downloadImage","handleDeselect","selections","selectedpoints","useImperativeHandle","allActions","defaultActions","Warning","BandStructure","setFinalData","pathSegments","setPathSegments","energyUnit","energyHighestOccupiedNormalized","isFinite","energy_highest_occupied","plotData","channels","nChannels","nBands","tempSegments","k_path_distances","nKPoints","segmentLength","iKPoint","dist","lineUp","bands","iBand","band","legendgroup","nBand","tmpLayout","tickangle","zeroline","xanchor","computedLayout","labelKPoints","iSegment","startLabel","prevLabel","endLabel","shapes","iShape","labelKPoint","x0","y0","x1","y1","yref","tickmode","tickvals","ticktext","Spectra","spectraNormalize","setSpectraNormalize","maximumIntensity","maxes","trace","intensities","energies","intensity","valueUnit","DOS","initialLayout","showexponent","setFinalLayout","normalizedToHOE","setNormalizedToHOE","dosNormalize","setDosNormalize","processedData","lineColors","isSpinPolarized","mins","iMethod","dos_method","spinChannels","spin_polarized","spinName","iSpin","densities","normalization_factor","normalization_factors","dosRenormalized","energyHighestOccupied","densitiesUnits","referencedLayout","zeroEnergyRefLayout","processNewDosData","density","density_intensity","values1","values2","processOldDosData","volumeUnit","EnergyVolumeCurve","volumes","nPoints","traces","curve","plotLayout","useOverviewAtomsStyles","OverviewAtoms","lattice_vectors","periodic","useOverviewDOSStyles","OverviewDOSElectronic","dos","band_gap","OverviewDOSPhonon","useOverviewBandstructurePhononStyles","OverviewBandstructurePhonon","useOverviewBandstructureElectronicStyles","radio","OverviewBandstructureElectronic","setMode","toggleMode","bs","labelPlacement","useOverviewSpectraStyles","OverviewSpectra","useOverviewEquationOfStateStyles","OverviewEquationOfState","eos_fit","fitted_energies","function_name","Overview","ApiDataContext","useCodeStyles","codeContainer","codeActions","Code","ContentButton","buttonContent","DialogButton","buttonComponent","SourceApiDialogButton","help","SourceDialogDivider","CopyToClipboardButton","useSourceApiCallStyles","SourceApiCall","formatedBody","SourceJson","SourceJsonDialogButton","useSourceJsonStyles","stickyContainer","actionContainer","dataToRender","SourceJsonCode","Pagination","showMore","showLess","disableMore","disableLess","loadingMore","onMore","onLess","moreIcon","lessIcon","useListEditQuantityStyles","unSelected","ListEditQuantity","quantityDef","fixedLength","hasFixedLength","configState","showMeta","FoldableList","nTop","nBottom","pageSize","DateTimeEditQuantity","time","dateValue","setDateValue","date","toJSON","renderProps","jsonValue","keyboardIcon","DateEditQuantity","TimeEditQuantity","useHelpAdornmentStyles","withOtherAdornment","HelpAdornment","InputAdornment","useWithHelpStyles","WithHelp","helpDescription","getFieldProps","elnProps","TextFieldWithHelp","TestId","StringEditQuantity","TextFieldWithLinkButton","validateURL","URLEditQuantity","useDisplayUnit","defaultUnit","defaultDisplayUnit","deprecatedDefaultDisplayUnit","defaultDisplayUnitObj","NumberField","dataType","minValue","maxValue","convertInPlace","previousValue","previousNumber","previousUnitLabel","previousNumberPart","fixDigits","toPrecision","getStoredValue","valueInBaseUnit","parseInput","parsedUnit","isValid","storingValue","trimmed","parsedInput","storedValue","numberedStoredValue","debouncedHandleChange","NumberEditQuantity","dimensionBase","setChecked","displayedValue","setDisplayedValue","fieldProps","setUnit","handleUnitChange","UnitSelect","useUnitSelectStyles","submit","handleOptionChange","handleEnter","forcePopupIcon","EnumEditQuantity","ListboxProps","AutocompleteEditQuantity","BoolEditQuantity","booleanLabels","handleCheckboxChange","handleRadioChange","ActionEditQuantity","dialog","OverwriteExistingFileDialog","onOverwrite","onCancel","disableEscapeKeyDown","LinearProgressWithLabel","mr","LinearProgress","UploadProgressDialog","uploading","useFileEditQuantityStyles","dropzone","borderTopLeftRadius","borderTopRightRadius","FileEditQuantity","onFailed","askForOverwrite","setAskForOverwrite","dropedFiles","setUploading","uploadFile","overwrite","mainfilePathSegments","mainfileDir","mainfileDirEncoded","fullPaths","onUploadProgress","progressEvent","percentCompleted","loaded","isDragAccept","noClick","dropzoneClassName","handleOverwrite","useStyle","focused","transition","transitionProperty","transitionDuration","transitionTimingFunction","transitionDelay","RichTextEditQuantity","initialHeight","editedValue","setFocus","setInitialized","handleImageUpload","blobInfo","success","failure","progress","blob","base64","handleEditorInit","editor","onInit","init","resize","menubar","toolbar","skin","images_upload_handler","paste_data_images","onEditorChange","DOMPurify","sanitize","opMap","opMapReverse","reString","reOp","reEquality","RegExp","reLte","reLteGte","reExists","SearchSyntaxes","existence","regex","readme","examples","labelShort","equality","equals","range_bounded","ltegteSandwich","op1","op2","range_half_bounded","ltegte","aNumber","free_text","InputMetainfoControlled","disableValidation","keysSet","textProps","validateFinal","empty","ListboxMetainfo","MetainfoOption","InputMetainfo","dtypes","dtypesRepeatable","disableNonAggregatable","getMetainfoOptions","InputJMESPath","errorParse","extra","useMetainfoOptionStyles","useSuggestionStyles","Suggestion","onDelete","typeTooltip","schemaTmp","queryContainer","SearchBar","includedFormats","formatReadmeList","example","updateFilter","quantitiesAllSet","quantitiesSuggestable","quantitySetSuggestable","assert","filterList","quantitySet","suggestionNames","setSuggestionNames","suggestionQuantities","suggestionsMatch","setSuggestionsMatch","pushSuggestion","removeSuggestion","suggestionsHistory","suggestionsMetainfo","suggestionObject","clearSuggestions","clearInput","checkMetainfo","getSuggestionsMatch","bestSuggestion","targetTmp","valueTmp","errorMeta","errorQuery","err","normalizedSuggestion","quantityFullname","ListboxSuggestion","startAdornment","uploadPageContext","useUploadPageContext","UploadPageContext","setUploadStoreObj","onUploadStoreUpdated","getUrl","EntryDownloadButton","urlSuffix","queryStringData","usePropertyCardStyles","PropertyCard","headerProps","CardHeader","usePropertyCardActionsStyles","PropertyCardActions","CardActions","disableSpacing","usePropertyTitleStyles","textTransform","PropertyTitle","PropertyGrid","usePropertySubGridStyles","PropertySubGrid","usePropertyItemStyles","PropertyItem","usePropertyProvenanceListStyle","PropertyProvenanceList","MuiAccordion","MuiAccordionSummary","MuiAccordionDetails","PropertyProvenanceItem","newPath","traverseDeep","chunk","defaultExpanded","Formula","chemical_formula_reduced","chemical_formula_descriptive","MaterialCard","properties","structures","hasStructures","structure_original","structure_conventional","structure_primitive","hasLatticeParameters","lattice_parameters","hasSymmetry","symmetry","structureTypes","defaultStructure","structureType","setStructureType","handleStructureChange","urlPrefix","structurePath","structureSection","structure","speciesMap","Map","chemical_symbols","species_at_sites","cartesian_site_positions","fractional","dimension_types","toMateriaStructure","structural_type","MaterialButton","MethodMetadata","methodQuantities","hidden","quantityProps","DomainMetadata","VisitEntryAction","TransitionProps","exit","EntryRowActions","flexBasis","useEntryDetailsStyles","entryDetails","entryDetailsContents","entryDetailsRow","entryDetailsActions","EntryDetails","MaterialRowActions","ActionURL","SearchResults","noAction","defaultUncollapsedEntryID","PaperProps","actionComponents","buttons","searchDialogContext","search_syntaxes","allFilters","filter_menus","flat","resultsTable","searchBar","getSectionsInfo","dataArchive","referencedSubSections","dataMetainfoDefUrl","itemLabelKey","getItemLabelKey","shownValue","getSchemaInfo","schemaArchive","Details","setSections","schemas","fetch","ListItemIcon","inset","SearchBox","unpublished","setUnpublished","setPublished","uploadContext","setVisibilityFilter","setUploadIdFilter","setProcessedFilter","setPublishedFilter","setMainAuthorFilter","handleCancel","definedFilters","SectionSelectDialog","shownEntries","menuType","found","upload_name","entryFilterOptions","pathFilterOptions","SectionSelectAutocomplete","onValueChanged","showSectionLabel","setEntries","setSelectedEntry","lastInputValue","setLastInputValue","setOptions","internalError","setInternalError","showPrimary","setShowPrimary","entryNames","mainfiles","queries","requestBody","or","notFoundEntries","handleInputValueChange","debouncedHandleInputChange","newOptions","setSection","updateInputValue","loadSections","handleEntryClicked","referenceEditQuantityContext","CreateNewReferenceDialog","allEntryDataSections","onSuccess","onCanceled","selectedUpload","setSelectedUpload","selectedSection","setSelectedSection","uploads","uploadName","myUploads","othersUploads","authorsID","usersInfo","affiliation","prepareUploads","createNewEntry","processing","handleCreateClick","thisUpload","ReferenceEditQuantity","createEntryDialogOpen","setCreateEntryDialogOpen","processingError","referencedSectionDef","useReferecedSectionDef","referencedSectionQualifiedName","processing_errors","resolveValue","getReferencePath","changeValue","handleValueChange","referencePath","handleSuccess","handleFailed","handleCanceled","addIconButtonToEndAdornment","inheritingSections","referencedValue","previousError","fetchUsersByIds","userIds","uniqueIds","getUsers","fetchUsersByNamePrefix","lowerPrefix","withQueryInName","aValue","bValue","fields","AuthorEditQuantity","otherFieldProps","author","setAuthor","setEmail","setQuery","searching","setSearching","userOnly","searchUsers","first_name","last_name","affiliation_address","initUser","isValidEmail","handleEmailChange","debouncedSearchUsers","handleUserInputChange","userField","inputProps","RadioEnumEditQuantity","containerOuter","containerInner","scrollHint","scrollUp","scrollDown","borderTop","useScrollStyles","scrollBar","Scrollable","onBottom","hints","refRoot","isOverflowing","setIsOverflowing","isTop","setIsTop","isBottom","setIsBottom","scrollStyles","offsetHeight","updateScrollPosition","systems","FilterSettings","isStatisticsEnabled","setIsStatisticsEnabled","handleStatsChange","filterMenuContext","paddingHorizontal","collapsedMenuWidth","useFilterMenuTopHeaderStyles","FilterMenuTopHeader","useFilterMenuHeaderStyles","FilterMenuHeader","useFilterMenuStyles","willChange","FilterMenu","onSelectedChange","onOpenChange","onCollapsedChange","onSizeChange","useFilterMenuItemsStyles","headerTextVertical","menuBorder","boxShadow","collapsedActions","FilterMenuItems","headerText","useFilterMenuItemStyles","listIcon","fontsize","arrow","gutters","listItem","FilterMenuItem","disableButton","opened","useFilterSubMenusStyles","containerS","containerM","containerL","containerXL","menuS","menuM","menuL","menuXL","FilterSubMenus","nResults","menuStyle","containerStyle","m","useFilterSubMenuStyles","FilterSubMenu","useInputGridStyles","inputGridSpacing","InputGrid","useInputGridItemStyles","InputGridItem","InputCheckbox","useInputCheckboxValueStyles","InputCheckboxValue","useElementStyles","rect","rectDisabled","Element","finalCount","finalScale","strokeColor","textColor","textAnchor","dominantBaseline","symbol","usePeriodicTableStyles","PeriodicTable","aggId","availableValues","elementCountMap","onElementClicked","newValues","cellWidth","cellHeight","shapeRendering","textRendering","xpos","ypos","useInputPeriodicTableStyles","InputPeriodicTable","initialScale","setScale","disableAggSize","rectangle","StatisticsBar","disableValue","disabledBackground","controlLabel","labelContainer","labelPlacementStart","bar","InputItem","disableLabelClick","disableSelect","Control","labelComponent","InputUnavailable","gridAutoFlow","textField","InputField","initialSize","increment","disableSearch","disableOptions","formatLabels","visibleOptions","setVisibleOptions","fixedOptions","nFixedOptions","minSize","requestedAggSize","setRequestedAggSize","incr","receivedAggSize","oldState","handleShowMore","newSize","handleShowLess","searchComponent","optionsComponent","nItems","didNotReceiveMore","noMoreAvailable","nRows","ceil","reservedHeight","itemHeight","actionHeight","allLoaded","gridTemplateRows","noMore","aggComp","usePlotTickStyles","PlotTick","thickness","orientation","usePlotLabelStyles","tick","PlotLabel","labelPadding","tickLength","usePlotAxisStyles","labelPositioner","topTick","verticalAxis","horizontalAxis","PlotAxis","labelHeight","labelWidth","overflowLeft","overflowRight","overflowTop","overflowBottom","axisSize","labelSize","rootStyle","axisStyle","labelList","formatTick","pos","fromUnixTime","millisecondsToSeconds","interval","splitMilliseconds","step","startRound","getTime","endRound","intervals","fiveyears","difference","differenceInYears","eachYearOfInterval","getFullYear","twoyears","years","threemonths","differenceInMonths","eachQuarterOfInterval","months","eachMonthOfInterval","weeks","differenceInWeeks","eachWeekOfInterval","days","differenceInDays","eachDayOfInterval","twelvehours","differenceInHours","eachHourOfInterval","sixhours","hours","thirtyminutes","differenceInMinutes","eachMinuteOfInterval","fifteenminutes","minutes","thirtyseconds","differenceInSeconds","fifteensecond","seconds","differences","dur","setup","differencesValid","diff","isWithinInterval","closestDuration","tickRange","degree","reduction","scaleUtils","nMin","getTicks","finalLabelWidth","maxCharacters","siPostfix","PlotBar","startX","endX","startY","endY","highlightStyle","clamp","leaveDelay","histogram","plot","gridColumn","gridRow","slider","square","inputField","inputFieldDate","thumb","inputMargin","PlotHistogram","xAxis","yAxis","bins","nBins","discretization","dtypeY","tooltipLabel","disableSlider","onRangeChange","onRangeCommit","onMinChange","onMaxChange","onMinBlur","onMaxBlur","onMinSubmit","onMaxSubmit","minXInclusive","maxXInclusive","minError","maxError","minInput","maxInput","minLocal","maxLocal","stepSlider","disableHistogram","disableXTitle","oldRangeRef","isArtificial","isTime","maxX","finalBins","minY","maxY","bucket","toInternalRange","toExternalRange","rangeInternal","gte","lte","handleRangeCommit","handleRangeChange","calculateSelection","bin","rangeLodash","unitStorage","minAdornment","maxAdornment","positionStart","inputMarginDense","inputMinField","inputMaxField","ampm","invalidDateMessage","InputAdornmentProps","histComp","Slider","onChangeCommitted","valueLabelDisplay","titleComp","titletext","autorangeDescription","WidgetHistogram","setWidget","xFilter","xTitle","xType","xUnit","handleChangeScale","Range","nSteps","setMinLocal","setMaxLocal","setPlotData","validRange","rangeChanged","minInputChanged","maxInputChanged","setRange","setMinError","setMaxError","minInclusive","setMinInclusive","maxInclusive","setMaxInclusive","setMinInput","setMaxInput","fromDisplayUnit","fromStorageUnit","toStorageUnit","minRef","gt","maxRef","lt","aggHistogramConfig","filterBounds","extended_bounds","buckets","aggSliderConfig","aggSlider","minGlobal","maxGlobal","nBuckets","stepHistogram","intervalCustom","steps","cap","capped","indexMin","getInterval","toInternal","minInc","maxInc","limit","limitMin","limitMax","validateRange","handleMinChange","setSeconds","handleMaxChange","handleMinSubmit","handleMaxSubmit","handleMinBlur","handleMaxBlur","useInputRangeStyles","InputRange","initialAutorange","setAutorange","periodicTable","FilterSubMenuElements","FilterSubMenuStructure","FilterSubMenuMethod","FilterSubMenuPrecision","FilterSubMenuDFT","FilterSubMenuTB","FilterSubMenuGW","FilterSubMenuBSE","FilterSubMenuDMFT","FilterSubMenuEELS","FilterSubMenuElectronic","FilterSubMenuSolarCell","FilterSubMenuCatalyst","FilterSubMenuMechanical","FilterSubMenuMolecularDynamics","FilterSubMenuELN","FilterSubMenuAuthor","InputRadio","filterProperties","virtual","useDefinitionStyles","Definition","hasChildren","iconProps","childPathPrefix","FilterSubMenuMetadata","tree","defsSet","addDef","all","public","staging","identifiers","FilterSubMenuOptimade","setValues","optimadeFilters","setOptimadeFilters","renderSuggestion","command","identifier","verify_only","optimade_filter","oldValues","loc","errorIndex","commands","matchAll","semanticError","newOptimadeFilters","allSuggestions","optimadeFilter","validation","prepareOptions","debouncedPrepareSuggestions","setOptimadeFilter","newFilters","FilterSubMenuGeometryOptimization","types","typeOperators","valueKeys","componentMap","EditQuantity","componentProps","elnAnnotation","editQuantityComponents","usesCompatibleComponent","QuantityFilter","operator","_quantityDef","handleIdChange","handleOperatorChange","availableOperators","getOperators","menuMap","precision","dft","tb","gw","bse","dmft","electronic","solarcell","heterogeneouscatalyst","vibrational","FilterSubMenuVibrational","mechanical","molecular_dynamics","geometry_optimization","setLoaded","setQuantities","andFilters","setAndFilters","paths","searchableQuantity","search_quantities","section_path","quantity_path","_description","retrieve","handleFilterChange","handleAndClicked","handleClearClicked","searchEnabled","handleSearchClicked","valueKey","getValueKey","valueKeyWithOperator","searchQuantity","optimade","useFilterMainMenuStyles","FilterMainMenu","menuItems","subMenus","Comp","useQueryChipStyles","chipRoot","chipLabel","QueryChip","queryGroupSpacing","useQueryChipGroupStyles","chips","titleRoot","QueryChipGroup","useQueryOpStyles","inside","outside","QueryOp","QueryAnd","QueryOr","QueryCurlyBracketLeft","QueryCurlyBracketRight","createChips","filterValue","isObj","createChip","single","comp","createRangeChip","comparison","QueryChips","addChipsForSection","newChips","newSection","useQueryStyles","Query","resetFilters","colorlabel","PlotScatter","colorAxis","discrete","onNavigateToEntry","hoverTemplate","xLabel","yLabel","colorLabel","yUnit","colorUnit","scatterType","nOptions","d3","xArray","yArray","colorArray","entryIdArray","textposition","hovertemplate","marker","hoverinfo","colorscale","colorbar","ypad","xpad","hoverlabel","bordercolor","pointIndex","points","unitX","unitY","unitColor","StyledToggleButtonGroup","styled","ToggleButtonGroup","alert","WidgetScatterPlot","markers","xParsed","yParsed","colorParsed","unitXObj","unitYObj","unitColorObj","displayUnitX","displayUnitY","displayUnitColor","yFilter","colorFilter","yTitle","yType","colorTitle","unitLabelX","unitLabelY","unitLabelColor","setXFilter","setYFilter","hits","dataRaw","hit","hitData","xShape","getShape","yShape","biggestShape","extendFront","colorShape","reduceRec","inp","reduceInner","array","oldShape","newShape","extendedArray","nTraces","traceArray","extendBack","handleDragModeChanged","handleResetClick","handleSelected","flexItem","ToggleButton","PanTool","CropFree","handleNavigated","bool","inner","extendRec","depth","fillValue","innerShape","innerArray","WidgetEditDialog","paperWidthSm","useEditGroupStyles","WidgetEditGroup","WidgetEditOption","WidgetEditSelect","WidgetPeriodicTable","WidgetPeriodicTableEdit","settings","setSettings","setErrors","schemaWidgetPeriodicTable","isValidSync","validateSyncAt","handleEditAccept","outerContainer","innerContainer","menuItemSelected","WidgetTerms","aggSize","nested_count","nShown","WidgetTermsEdit","schemaWidgetTerms","cols","breakpoints","nCols","sizes","Layout","locationsFit","getAvailableLocations","bestLocation","locations","epsilon","withinItem","yMax","dot","AB","AM","BC","BM","ABAB","ABAM","BCBC","BCBM","WidgetGrid","setWidgets","validWidth","setValidWidth","breakpoint","getNCols","firstLayout","widgetCopies","widgetCopy","breakpointNames","breakpointSmaller","breakpointBigger","layouts","scatterplot","periodictable","handleLayoutChange","allLayouts","compactType","draggableHandle","autoSize","onLayoutChange","isDraggable","isResizable","isBounded","resizeHandle","ResizeHandle","useHandleStyles","handleAxis","restProps","dtypesNumeric","dtypesColor","nPointsOptions","WidgetScatterPlotEdit","setDimensions","handleErrorQuantity","reach","schemaWidgetScatterPlot","validateSync","handleAcceptQuantity","independentErrors","xEmpty","yEmpty","WidgetHistogramEdit","schemaWidgetHistogram","DashboardAccordion","DashboardAccordionSummary","DashboardAccordionDetails","Dashboard","resetWidgets","handleScatterplot","handlePeriodicTable","handleHistogram","handleTerms","handleExpand","DashboardAction","DashboardExportButton","widgetExport","setWidgetExport","widgetImport","setWidgetImport","widgetImportError","setWidgetImportError","widgetsExport","casted","cast","stripUnknown","sorted","handleSave","widgetsInternal","leftColumn","leftColumnCollapsed","shadow","shadowVisible","SearchPage","isMenuOpen","setIsMenuOpen","isCollapsed","setIsCollapsed","SearchDialog","onQueryChanged","queryFilters","filterValues","updateFilters","handleQueryChanged","QueryEditQuantity","storeInArchive","maxData","tags","tag","handleClearResults","limitTags","renderTags","getTagProps","SelectEnumEditQuantity","arrayAction","subSectionAction","PropertyPreview","branding","statusbar","ArchiveButton","SectionPreview","allVisibleProperties","getAllVisibleProperties","SectionCard","archivePath","showJson","setShowJson","row_refs","PropertyEditor","editAnnotation","editComponent","editComponentProps","useSectionEditorStyles","quantityTable","SectionEditor","handleJsonChange","allVisibleQuantities","jsonData","_isEditable","XYPlotError","PlotlyFigure","plotlyGraphObj","toUnit","relativePath","resolvedQuantityDef","resolveSlice","isScalar","pathArr","pathSection","repeatPath","repeat","remainPath","allPaths","allNames","repeatDef","label_quantity","getSlicedPaths","withNames","slicedPaths","Names","slicedPath","pathRelative","getValues","Values","pathArray","Point","Value","PointUnit","xUnits","xLabels","yUnits","yLabels","zUnits","zLabels","resolveReferences","zLabel","ArchiveSearchBar","notchedOutline","XYPlot","XPrime","YPrime","Y","X","xValuesArray","xValues","xPath","isMultiX","yValues","yPath","getColor","sameUnit","titlefont","anchor","overlaying","side","ArchiveBrowser","searchOptions","setSearchOptions","rootSectionDef","isSubscribed","parentName","parentPath","sectionDefUrl","childDef","isSectionDefinitions","pathSections","archiveSearchOptions","ArchiveSaveButton","openErrorDialog","setOpenErrorDialog","setDisabled","handleReload","ArchiveReloadButton","ArchiveConfigForm","setConfig","handleConfigChange","changes","showCodeSpecific","showAllDefined","FormGroup","ArchiveReUploadButton","onchange","archiveRootUrl","archiveRootObj","SectionAdaptor","ArchiveAdaptor","objUrl","isInEln","parsedObjUrl","entryIsEditable","external_refs","metainfoAdaptorFactory","newDefUrl","m_def_id","UnresolvedReferenceAdaptor","QuantityAdaptor","AttributeAdaptor","refUrl","adaptorFactory","attr","text_index","subSectionAdaptor","subSectionIndex","parentRelation","indexStr","resolvedObj","resolvedDef","iData","iDef","iSection","Section","sectionIsInEln","sectionIsEditable","UnresolvedReference","FullStorageQuantity","Attribute","convertComplexArray","real","imag","complex","notation","lowerExp","upperExp","QuantityItemPreview","render_value","typeLabel","re","im","QuantityValue","getRenderValue","systemUnitQ","dangerouslySetInnerHTML","__html","h5Path","h5UploadId","h5File","h5Source","InheritingSections","originalInheritingSectionsRef","currentInheritingSections","getSelectionValue","validSections","sensitivity","showSelection","handleInheritingSectionsChange","sx","FormHelperText","hide","allProperties","filteredProperties","visibleProperties","reversedOrder","m_parent_index","m_parent_sub_section","editableExcluded","propertyName","navEntryId","navButton","jsonButton","deleteButton","removeSubSection","renderQuantityItem","isDefault","renderQuantity","ReferenceValuesList","storage","m_value","subSectionsToRender","subSectionCompartment","SubSection","laneWidth","lane_width","ArchiveTitle","kindLabel","ExternalReferences","getItemLabel","labelQuantity","handleAdd","subSectionKey","showList","PropertyValuesList","usePropertyValuesListStyles","nShownTop","setNShownTop","nShownBottom","setNShownBottom","showSelected","topEnd","bottomStart","bottomEnd","SectionPlots","annotationPlot","sortedFigures","figures","figure","pathIndex","indexedFigures","otherFigures","partition","plots","validPlots","annotationPlots","pathParts","SelectProps","newSelected","selectedIndex","m_unit","Meta","refTypeName","refTypeQualifiedName","isOk","useMetaStyles","graph","metainfoItem","DefinitionLabel","isDefinition","baseQuery","searchResults","setSearchResults","entry_list","entry_references","source_path","referencing_query","target_entry_id","target_path","tooltipContent","Histogram","getValueLabel","numberOfValues","tooltips","card","tooltipHTML","setTooltipHTML","handleItemClicked","numberOfValuesToRender","columnSize","columnsData","containerWidth","offsetWidth","rectColor","svg","columnsG","selectAll","enter","scaleBand","rangeRound","bandwidth","duration","chart","titleTypographyProps","displayEmpty","defCompare","metainfoConfigState","MetainfoBrowser","MetainfoRootAdaptor","sourceBar","textInput","MetainfoConfigForm","packagePrefix","SectionDefAdaptor","SubSectionDefAdaptor","QuantityDefAdaptor","CategoryDefAdaptor","PackageDefAdaptor","AttributeDefAdaptor","MetainfoAdaptor","categoryName","rootSection","packagePrefixes","PackagePrefixAdaptor","DefinitionDocs","defs","categoryDefs","inheritingSectionDef","baseSectionDef","SectionDef","sectionDefAdaptor","attributeDef","SubSectionDef","QuantityDef","DefinitionDetails","AttributeDef","SectionDefContent","metainfoConfig","DefinitionProperties","unused","Attributes","useName","searchAnnotations","hasSearchAnnotations","deprecated","moreKey","derived","dimensionality","links","usage","setUsage","showUsage","setShowUsage","quantityPath","program_names","aggData","use","definitionLabels","Annotations","with","purple","lime","blue","teal","BandGap","extendedColumns","greens_function_iw_im","axis","self_energy_iw_im","greens_function_tau_re","greens_function_freq_im","self_energy_freq_im","GreensFunctions","provenance","plotArray","legendTitle","legendWidth","plotDegeneracy","itemwidth","axisData","oneSpecies","oneSpin","magnetic_state","atomLabels","iAtom","atomData","spinData","iOrb","ElectronicProperties","brillouin_zone","gf","dmftprovenance","bsLayout","dosLayout","bsYSubject","Subject","dosYSubject","handleBSRelayouting","handleDOSRelayouting","ElectronicPropertiesCard","hasDosNew","hasDosOld","hasBs","hasBandGap","hasGf","bsReferences","dosReferences","dos_electronic_new","totalMatch","totalPath","sourceArchive","internalRef","energy_ref","resolveDosNew","resolveDosOld","bg","bz","segmentPath","addBandGaps","bsReferencesIndex","gfReferences","greensFunctions","gfTau","matchTau","tau","pathTau","matchGreensFunctionTau","greens_function_tau","pathGreensFunctionTau","sourceArchiveTau","greensFunctionTau","gfMatsFreq","matchMatsFreq","matsubara_freq","pathMatsFreq","matchGreensFunctionMatsFreq","greens_function_iw","pathGreensFunctionMatsFreq","matchSelfEnergyMatsFreq","self_energy_iw","pathSelfEnergyMatsFreq","sourceArchiveMatsFreq","greensFunctionMatsFreq","selfEnergyMatsFreq","gfImAxis","gfFreq","matchFreq","frequencies","pathFreq","matchGreensFunctionFreq","greens_function_freq","pathGreensFunctionFreq","matchSelfEnergyFreq","self_energy_freq","pathSelfEnergyFreq","sourceArchiveFreq","greensFunctionFreq","selfEnergyFreq","resolveGreensFunctions","SolarCell","efficiency","fill_factor","open_circuit_voltage","short_circuit_current_density","illumination_intensity","device_area","device_architecture","absorber","absorber_fabrication","device_stack","OptoelectronicProperties","bandGap","solarCell","SolarCellPropertiesCard","optoelectronic","solar_cell","canvasParent","StructureNGL","topologyMap","canvasParentRef","setPrompt","setNoData","setDisableShowLatticeContants","setDisableWrapMode","setDisableShowCell","setDisableShowBonds","stageRef","viewerRef","componentsRef","componentRef","alignmentRef","rotationsRef","representationMap","representationRef","selectionRef","asyncError","newEntryId","getPath","atoms_ref","system_id","parent_system","nomadUrl","getSystemAPIQuery","nAtomsAccepted","n_atoms","symbolUpperCase","atomicNumbers","elementColors","padStart","vdwRadii","handleShowBonds","repr","setVisibility","handleShowCell","updateState","unitCell","wrapRepresentation","autoView","view","alignment","stage","viewerControls","orient","THREE","quaternion","directions","finalQuaternion","identity","alignedDirections","targetVector","back","finalVector","alignedDirection","setFromUnitVectors","premultiply","dir","applyQuaternion","getAlignment","quaternionRotate","setFromEuler","PI","zoom","handleTakeScreenshot","imgData","makeImage","Stage","cameraType","clipNear","clipFar","clipDist","zoomSpeed","fogNear","fogFar","loadComponent","componentKey","systemResponse","regexFloat","aPrefix","bPrefix","cPrefix","pbcPrefix","getRoot","addRepresentation","isMonomer","isMolecule","sele","bondRepr","colorScheme","colorValue","bondScale","atomRepr","radiusScale","child_systems","loadFile","ext","defaultRepresentation","fromArray","metaCell","validBases","invalidBases","newBasis","crossVectors","fracToCart","makeBasis","cartToFrac","dashSize","gapSize","lineMaterial","addEdge","lineGeometry","setFromPoints","computeLineDistances","len","basisVector","secondIndex","isSecondCollapsed","secondAddition","thirdIndex","isThirdCollapsed","thirdAddition","createCell","addObject3DToStage","periodicity","periodicIndices","p1","p2","p3","infoColor","axisOffset","iBasis","cellBasisColors","angleColors","beta","gamma","angleStrokeColors","angleStrokeWidths","angleLabels","axisLabels","angleEnableds","axisEnableds","axisFonts","axisFontSizes","strokeColors","strokeWidths","angleFonts","angleFontSizes","iTrueBasis","axisLabel","axisColor","axisFont","axisFontSize","angleFontSize","angleFont","angleColor","angleLabel","angleStrokeColor","angleStrokeWidth","axisEnabled","angleEnabled","collapsed1","collapsed2","collapsed3","valid1","valid2","basisVec1","basisVec2","basisVec3","textPos","multiplyScalar","labelOffset","labelOffset1","labelOffset2","axisLabelSprite","createLabel","cellVectorMaterial","cellVector","cellVectorLine","createCylinder","cellAxisMaterial","axisStart","axisEnd","cellAxisVectorLine","arrowGeometry","arrowMaterial","copy","lookAt","rotateX","arcMaterial","normal","angle","angleTo","maxRadius","minRadius","nArcPoints","getSpacedPoints","arcGeometry","arc","verticesArray","nVertices","lastArcPointLocal","updateMatrixWorld","lastArcPointWorld","localToWorld","arcNormal","planeAngle","updateMatrix","angleLabelPos","angleLabelLen","angleLabelObj","createLatticeConstants","topSelection","topParent","isGroup","independent","child_types","isMonomerGroup","representation","opaque","cellVisible","transparency","setParameters","ctx","fontFactor","fillStyle","textBaseline","lineWidth","strokeStyle","strokeText","fillText","texture","needsUpdate","sprite","trueOffset","addVectors","labelRoot","pos1","pos2","nSegments","subVectors","dirLen","dirNorm","divideScalar","edgeGeometry","edge","pickingGroup","scene","getObjectByName","posNew","posCart","ap","getAtomProxy","positionToVector3","posWrap","applyMatrix4","wrapPositions","posUnwrap","posFrac","centerOfPos","Vector3","iComp","centerComp","xiSum","zetaSum","theta","getComponent","cos","sin","xiMean","zetaMean","atan2","setComponent","getCenterOfPositions","positionFromVector3","_hasCoords","refreshPosition","updateRepresentations","eps","epsArray","iFracPos","remainder","H","D","T","HE","LI","BE","B","C","N","O","F","NE","NA","MG","AL","SI","P","S","CL","AR","K","CA","SC","TI","V","CR","MN","FE","CO","NI","CU","ZN","GA","GE","AS","SE","BR","KR","RB","SR","ZR","NB","MO","TC","RU","RH","PD","AG","CD","IN","SN","SB","TE","I","XE","CS","BA","LA","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","TM","YB","LU","HF","TA","W","RE","OS","IR","PT","AU","HG","TL","PB","BI","PO","AT","RN","FR","RA","AC","TH","PA","U","NP","PU","CM","BK","CF","ES","FM","MD","NO","LR","RF","DB","SG","BH","HS","MT","DS","RG","CN","NH","FL","MC","LV","TS","OG","useMaterialCardStyles","MaterialCardTopology","topologyTrees","topology","roots","atomic_fraction","system_relation","getTopology","tab","setTab","handleTabChange","Topology","MaterialTabs","useTopologyStyles","nodes","nodeIds","TreeView","onNodeToggle","defaultCollapseIcon","defaultExpandIcon","topologyTree","TopologyItem","useTopologyItemStyles","nodeLabelPrimary","nodeLabelSecondary","iconContainer","styleProps","TreeItem","onLabelClick","nodeId","useMaterialTabsStyles","nElems","n_elements","nElemsLabel","tabMap","hasTopology","composition","porosity","largest_cavity_diameter","pore_limiting_diameter","accessible_surface_area","accessible_volume","void_fraction","n_of_channels","sbu","sbu_type","sbu_coordination_number","coreHole","active_orbitals","Tabs","indicatorColor","scrollButtons","TabScrollButtonProps","scrollbutton","Tab","MaterialTab","chemical_formula_iupac","largest_included_sphere_along_free_sphere_path","n_channels","volume","mass_density","atomic_density","crystal_system","bravais_lattice","strukturbericht_designation","space_group_symbol","space_group_number","point_group","hall_number","hall_symbol","prototype_name","prototype_label_aflow","n_electrons_excited","degeneracy","n_quantum_number","l_quantum_symbol","ml_quantum_symbol","ms_quantum_symbol","MaterialCardFormula","useNexusCardStyles","NexusCard","HeatCapacity","tempUnit","capacityUnit","temperatures","heat_capacities","HelmholtzFreeEnergy","VibrationalProperties","freeEnergy","heatCapacity","VibrationalPropertiesCard","hasDos","hasEnergyFree","hasHeatCapacity","dosData","bsData","energyFree","energyFreeData","heatCapacityData","modulusQuantities","MechanicalProperties","evCurves","bulkModulus","shearModulus","MechanicalPropertiesCard","hasEVCurves","hasBulkModulus","hasShearModulus","evCurveData","ev","energies_raw","energies_fit","timeUnit","temperatureUnit","pressureUnit","trajectoryPath","trajectoryError","Trajectory","temperature","pressure","energyPotential","archiveURL","nPlots","ytitle","xtitle","ygap","roworder","iAxis","showticks","showticklabels","subplots","getPlotLayoutVertical","mergedLayout","getPlotTracesVertical","useTrajectoriesStyles","TrajectoriesRaw","trajsIndex","trajsArchive","trajIndex","trajProperties","available_properties","trajArchive","energy_potential","Trajectories","ThermodynamicProperties","ThermodynamicPropertiesCard","distanceUnitSquared","diffusionUnit","msdPath","msdError","MeanSquaredDisplacement","msd","tracesAll","layoutAll","times","diffusion_constant_value","diffusionConstant","D_label","diffusion_constant_errors","R","MeanSquaredDisplacementsRaw","fromEntry","msdAll","msdIndex","msdArchive","MeanSquaredDisplacements","DynamicalPropertiesCard","hasMsd","distanceUnit","rdfPath","rdfError","RadialDistributionFunction","rdf","frame_start","frame_end","rdfPlotShape","PropTypes","oneOfType","arrayOf","oneOf","rdfLabelShape","objectOf","rdfShape","RadialDistributionFunctionsRaw","rdfAll","rdfIndex","rdfArchive","RadialDistributionFunctions","rgPath","rgError","RadiusOfGyration","rg","histnorm","rgPlotShape","rgLabelShape","rgShape","RadiiOfGyrationRaw","rgAll","rgIndex","kind","rgArchive","RadiiOfGyration","StructuralProperties","hasRdf","hasRg","StructuralPropertiesCard","GeometryOptimization","convergence","energyDiffTotal","diffValues","initial","diffTotal","convergenceCriteria","convergence_tolerance_energy_difference","energyDiff","tickformat","showspikes","spikethickness","spikedash","spikecolor","spikemode","final_energy_difference","final_displacement_maximum","final_force_maximum","GeometryOptimizationCard","geoOptProps","hasEnergies","n_calculations","hasConvergence","energiesArchive","SpectroscopicPropertiesCard","hasSpectra","spectras","spectra","spectroscopic","spectraReferences","useResourceDetailsStyles","resourceDetails","resourceDetailsContents","resourceDetailsRow","resourceDetailsActions","resourceURL","ResourceDetails","downloadTime","download_time","ResourceActions","RelatedResourcesCard","externalResources","setExternalResources","spg","wyckoffSets","wyckoff_sets","wyckoff","wyckoff_letter","nsites","database_name","is_retrieving_more","useWorkflowGraphStyles","strokeOpacity","dy","archives","resolveSection","sectionKeys","nChildren","task","inputs","outputs","sectionType","getNodes","resolveIndices","maxNodes","resolved","sectionIndices","mid","getLinks","isLinked","linked","output","sourceNodes","targetNodes","sourceNode","targetNode","Graph","setTooltipContent","setCurrentNode","setShowLegend","setEnableForce","circleRadius","markerWidth","scaling","red","blueGrey","nodeShape","whRatio","legendSize","inOutColor","previousNode","dquery","currentNode","enableForce","dragged","zoomTransform","isWorkflow","nodeColor","trimName","svgGroup","gLegend","dx","addLegend","zoomBehaviors","zoomF","force","velocityDecay","alphaDecay","dragBehaviors","sourceEvent","offsetX","offsetY","fx","fy","zoomTo","alphaTarget","restart","gNode","gLink","setNodesPosition","tasks","inouts","rk","bound","translate","isCircle","dr","vx","vy","vr","sign","sy","targetR","offsetxt","offsetyt","offsetxs","offsetys","fLink","tween","setShowNodes","toNumber","qi","handleClickIcon","maxLength","addLinkMarkers","strength","handleMouseOverIcon","handleMouseOutIcon","linkNode","_name","_type","_links","_nodes","restore","WorkflowCard","tooltipPosition","setTooltipPosition","showLegend","workflow2","nodeType","nodesCount","StopSharp","PlayArrowSharp","LabelOff","Label","Undo","onMouseMove","pageX","pageY","DefinitionsCard","defaultColumns","ReferenceTable","refPool","entry_metadata","ReferenceUsingCard","referencingPool","setReferencingPool","referencedPool","setReferencedPool","openReferencing","setOpenReferencing","openReferenced","setOpenReferenced","targetEntryIds","referencingList","referenced_query","referencedList","colums","HistoryCard","SampleHistoryUsingCard","section_defs","definition_qualified_name","DeletingReferencesTable","entryReferences","brokenEntries","normalizedEntryReferences","target_mainfile","target_upload_id","DeleteEntriesButton","selectedEntries","selectedCount","openDeleteConfirmDialog","setOpenDeleteConfirmDialog","deleteFolders","setDeleteFolders","setEntryReferences","setBrokenEntries","allReferences","handleDelete","include_parent_folders","MetadataSection","rightColumn","editActions","structural","dynamical","energy_fermi","spin_channel","thermodynamic","OverviewView","indexApiData","setResponse","useIndex","archiveTmp","dataMetainfoDef","metainfoDef","setMetainfoDef","useMetainfoDef","overview","getSections","cardComps","cardMap","nexus","relatedResources","isIcon","whyDidYouRender","archiveBrowser","downloadFab","ArchiveEntryView","useLogEntryStyles","amber","exception","LogEntry","keyNames","summaryProps","moreLogs","formControl","seeMore","FilterLogsByLevel","logLevels","onCheckListChanged","FilterLogTagsByKeys","onKeyNamesChanged","uniquekeys","labelId","Input","ArchiveLogView","setData","doesNotExist","setDoesNotExist","setLogLevels","DEBUG","ERROR","CRITICAL","WARNING","INFO","numberOfLogs","setNumberOflogs","setkeyNames","handlekeyNamesChanged","handleCheckListChanged","extendedData","aggregatedKeys","filteredIndices","el","BrowseEntryFilesView","lastSlash","mainfileDirname","mainfileBasename","errorLogs","errorIcon","verticalAlign","EntryTabs","entryHasProcessingError","EntryPage","currentPath","defaultUrls","urlNoSlash","trimEnd","urls","exact","when","strict","NewUploadButton","clicked","setClicked","ExampleUploadDialog","dialogProps","exampleUploadsConfig","filterExamples","renderCategory","exampleUpload","categoryKey","ExampleUploadButton","isOpen","local_path","DeleteUploadsButton","onConfirm","openDialog","setOpenDialog","uploadIDs","nUploads","uploadText","haveText","DialogLink","linkProps","WithButton","clipboard","nameField","schemaField","radioGroup","addSearchIconToEndAdornment","CreateEntry","builtInTemplates","setBuiltInTemplates","builtInTemplate","setBuiltInTemplate","customTemplate","setCustomTemplate","setName","openEntryAlreadyExistsDialog","setOpenEntryAlreadyExistsDialog","openCreateEntryDialog","setOpenCreateEntryDialog","schemaType","setSchemaType","getReference","templates","findCategory","baseDefinition","categoryLabel","categoryNames","categoryOrder","getTemplatesFromGlobalDefinitions","getTemplates","selectedTemplate","handleBuiltInChange","getTemplateFromDefinition","dataSection","file_name","handleCustomChange","useInviteUserDialogStyles","submitWrapper","submitProgress","InviteUserDialog","submitting","setSubmitting","canSubmit","setCanSubmit","inviteUser","responseText","dataKey","ROLES","MAIN_AUTHOR","COAUTHOR","REVIEWER","TYPES","USER","GROUP","MemberIcon","userToMember","groupToMember","usersDict","defaultId","group_name","getMemberIdsByTypeAndRole","members","member","editMembersDialogContext","memberSearch","columnGap","memberSearchType","memberSearchText","renderMemberName","MembersTable","setIsChanged","useReducer","DeleteAction","AddMember","setMembers","searchType","setSearchType","selectedSuggestion","setSelectedSuggestion","suggestionsAreLoading","setSuggestionsAreLoading","search_terms","fetchGroupsByNameSearch","ownersDict","ownerIds","ownerUsers","keyBy","groupsToMembers","filteredSuggestions","handleSearchTypeChange","handleSearchSelectionChange","blurOnSelect","isOwner","filteredMembers","EditMembersDialog","isChanged","openConfirmDialog","setOpenConfirmDialog","fetchMembers","coauthor_groups","reviewer_groups","groupIds","groupRoles","fetchGroupsByIds","groupsDict","memberUserIds","userRoles","userId","groupId","EditComments","EditReferences","onAdd","onRemove","newReference","setNewReference","urlValidation","setUrlValidation","handleChangeReference","validateURLError","apiError","error_reference","ReferencesActions","EditDatasets","userDatasets","onCreate","newDataset","setNewDataset","datasetToAdd","setDatasetToAdd","isDuplicated","handleDatasetToAddChanged","handleNewDatasetChanged","handleCreate","addDatasetButton","error_dataset","DatasetsActions","openDatasetUrl","notSubmitted","useEditMetaDataDialogStyles","EditMetaDataDialog","nSelected","setUserDatasets","userDatasetsFetched","setUserDatasetsFetched","setActions","handleDiscardChanges","selectedEntriesObjects","defaultComment","defaultReferences","referencesList","defaultDatasets","datasetsList","datasetFullData","handleOpenDialog","createNewDatasets","promises","create_dataset","submitChanges","oldActions","isCommentChanged","isReferencesChanged","isDatasetChanged","set_comment","add_reference","remove_reference","add_dataset","notSubmittedDataset","remove_dataset","handleSubmitChanges","flatMap","newDatasets","newDatasetsIDs","_dataset","handleSetComment","newActions","handleAddReference","_actions","handleRemoveReference","handleCreateDataset","handleAddDataset","handleRemoveDataset","handleConfirm","scrollRef","useFolderStyles","FileOrFolder","onToggle","disabledProgress","FilesBrower","renderCounter","setRenderCounter","previewPath","setPreviewPath","allData","resultsByPath","renderFileOrFolder","pathPrefix","folderData","defaultSelectedColumns","ProcessingTable","customTitle","selectedQuery","UploadName","setEdit","trimmedValue","MenuBarRoute","routes","itemRoute","UploadSearchMenu","filteredMenus","useDropButtonStyles","dropzoneAccept","common","white","dropzoneReject","DropButton","isDragReject","EmbargoSelect","embargo","disabledReason","htmlFor","PublishUpload","onPublish","setEmbargo","embargo_length","buttonLabel","to_central_nomad","minWith","PublishUploadExternally","isPublished","published_to","server","ProcessingStatus","processing_successful","processing_failed","mainMessage","stepper","stepContent","mixedButtonIcon","SupportedCodes","UploadDocumentation","SchemaDocumentation","UploadOverview","deleteRequested","openEmbargoConfirmDialog","setOpenEmbargoConfirmDialog","setReadme","openEditMembersDialog","setOpenEditMembersDialog","handleIsVisibleForAll","handlePublish","isAuthenticated","Stepper","Step","StepLabel","StepContent","newPagination","publish_time","useUploadCommandStyles","commandContainer","commandMarkup","UploadCommands","uploadCommands","upload_command","upload_progress_command","upload_tar_command","upload_command_form","upload_command_with_name","UploadActions","UploadButton","setUploadCommands","fetchTimer","clearInterval","setInterval","isDisabled","selectedUploads","currentUserUploadsMap","disableDeleteButton","deleteUploads","allSettled","handleDeleteSubmitted","responses","AppTokenForm","setToken","maxDate","subDays","addSeconds","expiresAt","endOfDay","expiresInS","getUnixTime","app_token","limitExpiresInS","limit_value","limitExpiresAt","formatDistanceToNow","DatePicker","autoOk","disablePast","DatasetPage","setDataset","datasetFilter","dataset_create_time","dataset_modified_time","PageContext","DatasetActions","openConfirmDeleteDialog","setOpenConfirmDeleteDialog","openConfirmDoiDialog","setOpenConfirmDoiDialog","handleAssignDoi","DatasetButton","selectedColumns","createExampleData","DetailsExample","ActionsExample","ScrollDatatableExample","exampleData","nextPageAfterValueInt","loadingMessage","LoadMoreDatatableExample","DatatableExamples","SliderEditQuantity","sliderProps","minValueConverted","maxValueConverted","sliderValue","handleChangeValue","convertedValue","enumValues","Example","EditQuantityExamples","setUpdate","propsRef","sectionRef","createDefaultProps","int","UploadFilesView","UploadProcessingStatus","Slide","mountOnEnter","last_status_message","pvdSection","process_time","set_substrate_temperature","substrate_temperature","chamber_pressure","processSection","PVDEvaporation","pvdExamples","plotly_graph_object","processExamples","PlotExamples","setPlots","setKeys","pvdSectionDef","archiveSectionDef","getSection","graphObject","newPlots","newKeys","plotIndex","plotKey","entryRoutes","queryParams","isLoggedIn","pidMatch","pid","pidWithHandle","datasetRoutes","cache","doiMatch","uploadRoutes","propsUploadId","searchRoutes","routeMap","filters_locked","redirect","UploadsPage","uploadsHelp","DatasetsPage","UserdataPage","metainfoHelp","NorthPage","setInfo","useInfo","makeClickable","querySelector","firstChild","onclick","setText","innerHTML","statistics","n_tutorials","tutorials","nominal","stringValue","consent","allRoutes","addRoute","childRoute","fullRoute","wrapper","Routes","CacheRoute","Route","unmount","saveScrollPosition","commonPathPrefix","RouteButton","routePath","MainMenu","ellipsis","Breadcrumbs","getRef","getFinalBreadcrumb","LoadingIndicator","drawer","logo","logoImg","borderColor","getContrastText","navigation","crumbs","AppBar","disableGutters","ScrollContext","useTermsSnackStyles","termsLink","TermsSnack","setCookie","useCookies","cookieOptions","useBetaSnackStyles","snack","BetaSnack","understood","setUnderstood","isBeta","isTest","usesBetaData","officialUrl","warn","appFrame","Navigation","scrollTo","Keycloak","realm","clientId","App","Helmet","authClient","onEvent","initOptions","onLoad","promiseType","LoadingComponent","utils","DateFnsUtils","unit_systems","ReactRouterRoute","CssBaseline","ReactDOM"],"mappings":"usBAkBeA,cAAqB,CAACC,SAAUC,6B,4CCavC,SAASC,EAAOC,GAA+C,IAA1CC,EAAyC,uDAAlCC,OAAOC,SAASC,OAAQC,EAAU,uCAChEC,EAAS,IAAIC,IAAIP,EAAKC,GAAMO,KAGhC,GAAIH,EAAU,CACZ,MAAMI,EAAcH,EAAOI,MAAM,KAAM,GAAG,GAC1CJ,EAAM,UAAMD,GAAN,OAAiBC,EAAOK,MAAMF,EAAYG,QACjD,CAED,OAAON,CACR,CAYM,SAASO,EAAgBC,GAC5B,GAAIC,gBAA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SACE,gBAAC,KAAD,CAAkBvwL,MAAO9E,GAAzB,UACE,eAAC64L,EAAA,EAAD,IACA,gBAAClsL,GAAD,WACE,eAACirL,GAAD,IACA,eAAC,GAAD,kCAe7B,C,QCzDDkB,IAASt1L,OAAO,eAACy0L,GAAD,IAAS1yL,SAASC,eAAe,Q","file":"static/js/main.7447b5e5.chunk.js","sourcesContent":["/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createBrowserHistory } from 'history'\nexport default createBrowserHistory({basename: process.env.PUBLIC_URL})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTheme } from '@material-ui/core'\nimport { isPlainObject, isNil, forOwn } from 'lodash'\n\n/**\n * Used to normalized the given URL into an absolute form which starts with\n * protocol, host and port.\n *\n * @param {*} url The url to convert\n * @param {*} base The URL base address. Contains the protocol, host and port. Defaults to\n * current window origin.\n * @param {*} protocol The desired protocol. By default the protocol in 'base'\n * is used.\n * @returns Absolute url as a string\n */\n export function urlAbs(url, base = window.location.origin, protocol) {\n let absUrl = new URL(url, base).href\n\n // Convert protocol if one is given\n if (protocol) {\n const oldProtocol = absUrl.split('//', 1)[0]\n absUrl = `${protocol}${absUrl.slice(oldProtocol.length)}`\n }\n\n return absUrl\n}\n\n/**\n * Returns a normalized version of an UI config model. The following changes are applied\n * in the normalized version:\n *\n * - The 'include' and 'exclude' attributes have been used to filter and order the\n * options object and the key is automatically included as an option property.\n *\n * @param {object} config The original UI config.\n * @return Normalized version of the UI config model.\n */\nexport function normalizeConfig(config) {\n if (isNil(config)) return config\n\n function normalize(obj) {\n for (const [key, value] of Object.entries(obj)) {\n if (isPlainObject(value)) {\n normalize(value)\n\n // Normalize the options\n if (!value.options) continue\n const include = value.include || (value.options && Object.keys(value.options))\n const options = include\n ? include\n .filter(key => !value?.exclude?.includes(key))\n .map(key => ({key, ...value.options[key]}))\n : []\n\n const config = {options: Object.fromEntries(options.map(option => [option.key, option]))}\n\n // Carry over all additional fields\n forOwn(value, (v, k) => {\n if (k !== 'options' && k !== 'include' && k !== 'exclude') {\n config[k] = v\n }\n })\n\n obj[key] = config\n }\n }\n }\n\n // Recursively normalize the config\n normalize(config)\n\n return config\n}\n\nwindow.nomadEnv = window.nomadEnv || {}\nexport const version = window.nomadEnv.version\nexport const appBase = urlAbs(window.nomadEnv.appBase.replace(/\\/$/, ''))\nexport const apiBase = `${appBase}/api`\nexport const northBase = urlAbs(window.nomadEnv.northBase)\nexport const guiBase = process.env.PUBLIC_URL\nexport const ui = normalizeConfig(window.nomadEnv.ui)\nexport const entry_points = normalizeConfig(window.nomadEnv?.plugins?.entry_points)\nexport const apps = Object.values(ui?.apps?.options || [])\nObject.values(entry_points?.options || [])\n .filter(entry_point => entry_point.entry_point_type === 'app')\n .forEach(entry_point => {\n apps.push(entry_point.app)\n })\nexport const servicesUploadLimit = window.nomadEnv.servicesUploadLimit\nexport const keycloakBase = window.nomadEnv.keycloakBase\nexport const keycloakRealm = window.nomadEnv.keycloakRealm\nexport const keycloakClientId = window.nomadEnv.keycloakClientId\nexport const debug = window.nomadEnv.debug || false\nexport const encyclopediaBase = window.nomadEnv.encyclopediaBase\nexport const oasis = window.nomadEnv.oasis || false\nexport const globalLoginRequired = window.nomadEnv.globalLoginRequired || false\nexport const appTokenMaxExpiresIn = window.nomadEnv.appTokenMaxExpiresIn || \"2023-10-25\"\nexport const uploadMembersGroupSearchEnabled = window.nomadEnv.uploadMembersGroupSearchEnabled || false\nexport const dataciteEnabled = window.nomadEnv.dataciteEnabled || false\nexport const email = 'support@nomad-lab.eu'\nexport const maxLogsToShow = 50\nexport const schemaSeparator = '#'\nexport const dtypeSeparator = '#'\nexport const yamlSchemaPrefix = 'entry_id:'\n\nwindow.nomadArtifacts = window.nomadArtifacts || {}\nexport const searchQuantities = window.nomadArtifacts.searchQuantities\nexport const metainfo = window.nomadArtifacts.metainfo\nexport const parserMetadata = window.nomadArtifacts.parserMetadata\nexport const toolkitMetadata = window.nomadArtifacts.toolkitMetadata\nexport const exampleUploads = {}\nObject.values(entry_points?.options || [])\n .filter(entry_point => entry_point.entry_point_type === 'example_upload')\n .forEach(entry_point => {\n exampleUploads[entry_point.category] = {...exampleUploads[entry_point.category], [entry_point.id]: entry_point}\n })\nexport const northTools = window.nomadArtifacts.northTools\nexport const unitList = window.nomadArtifacts.unitList\nexport const unitPrefixes = window.nomadArtifacts.unitPrefixes\n\nexport const nomadPrimaryColor = {\n main: '#2A4CDF',\n light: '#7F94EC',\n dark: '#192E86',\n veryLight: '#eaedfc'\n}\n\nexport const nomadSecondaryColor = {\n main: '#008A67',\n light: '#80C583',\n dark: '#00533e',\n veryLight: '#CCE8E1'\n}\n\nexport const nomadFontFamily = [\n 'Titillium Web',\n 'sans-serif'\n].join(',')\n\nexport const nomadTheme = createTheme({\n typography: {\n useNextVariants: true,\n fontFamily: nomadFontFamily,\n fontWeightRegular: 400,\n fontWeightMedium: 600\n },\n palette: {\n primary: nomadPrimaryColor,\n secondary: nomadSecondaryColor\n },\n overrides: {\n // This is used to inject global css styles through the CssBaseline\n // component, see: https://v4.mui.com/howto/customization/globals/#global-css\n MuiCssBaseline: {\n '@global': {\n '.react-grid-item.react-grid-placeholder': {\n backgroundColor: nomadSecondaryColor.main\n },\n // This rule is overwritten. The normalization was added quite late into\n // the app and the 'box-sizing: inherit' -rule would mess up the layout\n // quite a bit.\n '*, *::before, *::after': {\n boxSizing: 'revert'\n }\n }\n },\n MuiTooltip: {\n tooltip: {\n fontWeight: 'normal',\n fontSize: '0.75rem'\n }\n },\n MuiTableRow: {\n root: {\n '&:last-child td': {\n borderBottom: 0\n }\n }\n }\n }\n})\n\nexport const formatQuantity = (x) => {\n const parts = x.toString().split('.')\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n return parts.join('.')\n}\n\nexport function normalizeDisplayValue(value) {\n if (value === 'not processed' || value === 'unavailable') {\n return '-'\n }\n return value\n}\n\n/**\n * The range of electronic energies in eV.\n */\nexport const electronicRange = [-5, 10]\n/**\n * The default date format.\n */\nexport const dateFormat = 'dd/MM/yyyy'\n/**\n * Warning shown when energy values could not be normalized.\n */\nexport const msgNormalizationWarning = `\nEnergy reference could not be found: energies have an unknown shift with\nrespect to the highest occupied energy.\n`\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { SnackbarContent, IconButton, Snackbar, withStyles } from '@material-ui/core'\nimport CloseIcon from '@material-ui/icons/Close'\n\nexport class VersionMismatch extends Error {\n constructor(msg) {\n super(msg)\n this.name = 'VersionMismatch'\n }\n}\n\nexport const errorContext = React.createContext({\n errors: [],\n raiseError: () => { throw Error('Error context used incorrectly.') }\n})\n\nclass ErrorSnacksUnstyled extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n children: PropTypes.any.isRequired\n }\n static styles = theme => ({\n root: {},\n errorSnack: {\n backgroundColor: theme.palette.error.dark\n }\n })\n\n state = {\n errors: [],\n raiseError: (error) => {\n this.onError(error)\n }\n }\n\n onError(error) {\n let errorStr = 'Unexpected error. Please try again and let us know, if this error keeps happening.'\n if (error instanceof Error) {\n if (error.name === 'BadRequest') {\n errorStr = error.message\n } else if (error.name === 'CannotReachApi') {\n errorStr = 'Cannot reach NOMAD, please try again later.'\n } else if (error.name === 'NotAuthorized') {\n errorStr = error.message\n } else if (error.name === 'DoesNotExist') {\n errorStr = 'You are trying to access information that does not exist. Please try again and let us know, if this error keeps happening.'\n } else if (error.name === 'VersionMismatch') {\n errorStr = 'There is a new GUI version available. Please press \"shift\" and reload the page.'\n } else if (error.message.startsWith('could not parse optimade')) {\n errorStr = 'The given OPTiMaDe query can not be parsed.'\n } else if (error.status === 422) {\n errorStr = `Unexpected api error: ${error.apiMessage[0].msg}. Please try again and let us know, if this error keeps happening.`\n console.log(error)\n } else if (error.message) {\n errorStr = `Unexpected error: \"${error.message}\". Please try again and let us know, if this error keeps happening.`\n console.log(error)\n }\n } else if (typeof error === 'string' || error instanceof String) {\n errorStr = `${error} Please close all NOMAD tabs and try again. Let us know, if this error keeps happening.`\n }\n\n if (this.state.errors.indexOf(errorStr) === -1) {\n this.setState({errors: [errorStr, ...this.state.errors]})\n }\n }\n\n onClose() {\n if (this.state.errors.length > 0) {\n this.setState({errors: this.state.errors.slice(1)})\n }\n }\n\n render() {\n const {children, classes} = this.props\n return (\n \n {children}\n 0}\n onClose={this.handleClose}\n >\n {'' + this.state.errors[0]}\n }\n action={[\n \n \n \n ]}\n />\n \n \n )\n }\n}\n\nexport const ErrorSnacks = withStyles(ErrorSnacksUnstyled.styles)(ErrorSnacksUnstyled)\n\nexport function withErrors(Component) {\n function WithErrorComponent(props) {\n return (\n \n {errorContext => }\n \n )\n }\n\n return WithErrorComponent\n}\n\nexport class ErrorBoundary extends React.Component {\n constructor(props) {\n super(props)\n this.state = { hasError: false }\n }\n\n static propTypes = {\n children: PropTypes.any,\n onError: PropTypes.func\n }\n\n static getDerivedStateFromError(_error) {\n // Update state so the next render will show the fallback UI.\n return { hasError: true }\n }\n\n componentDidCatch(error, errorInfo) {\n console.log('caught error in boundary', error, errorInfo)\n if (this.context) {\n this.context.raiseError('There has been a Javascript error.')\n }\n }\n\n render() {\n // If an error is caught, show the 'root' error message. This message will\n // be shown on top of everything does not contain any React or MUI specific\n // code to keep it functional no matter where the error originates from.\n if (this.state.hasError) {\n const error = document.getElementById(\"rootError\")\n if (error) {\n error.style.display = 'block'\n }\n return null\n }\n\n return this.props.children\n }\n}\n\nErrorBoundary.contextType = errorContext\n\nexport function useErrors() {\n return useContext(errorContext)\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useMemo, useState, useContext } from 'react'\nimport {\n atom,\n useSetRecoilState,\n useRecoilValue,\n useRecoilState\n} from 'recoil'\nimport PropTypes from 'prop-types'\nimport Cookies from 'universal-cookie'\nimport { apiBase, globalLoginRequired, appBase, searchQuantities } from '../config'\nimport { Box, Typography, withStyles } from '@material-ui/core'\nimport LoginLogout from './LoginLogout'\nimport { useKeycloak } from '@react-keycloak/web'\nimport axios from 'axios'\nimport { useErrors } from './errors'\n\nexport class DoesNotExist extends Error {\n constructor(msg) {\n super(msg)\n this.name = 'DoesNotExist'\n }\n}\n\nexport class NotAuthorized extends Error {\n constructor(msg) {\n super(msg)\n this.name = 'NotAuthorized'\n }\n}\n\nexport class ApiError extends Error {\n constructor(msg) {\n super(msg)\n this.name = 'CannotReachApi'\n }\n}\n\nexport class ApiRequestError extends Error {\n constructor(msg) {\n super(msg)\n this.name = 'BadRequest'\n }\n}\n\nfunction handleApiError(e) {\n if (e.name === 'CannotReachApi' || e.name === 'NotAuthorized' || e.name === 'DoesNotExist' || e.name === 'BadRequest') {\n throw e\n }\n\n let error = null\n if (e?.message === 'Failed to fetch' || e?.message === 'Network Error') {\n error = new ApiError(e.message)\n error.status = 400\n } else if (e.response) {\n const body = e.response.body\n const message = (body && (body.message || body.description)) || e.response?.data?.detail || e.response.statusText\n const errorMessage = `${message} (${e.response.status})`\n if (e.response.status === 404) {\n error = new DoesNotExist(errorMessage)\n } else if (e.response.status === 401) {\n error = new NotAuthorized(errorMessage)\n } else if (e.response.status === 400) {\n error = new ApiRequestError(errorMessage)\n } else if (e.response.status === 502) {\n error = new ApiError(errorMessage)\n } else {\n error = new Error(errorMessage)\n }\n error.status = e.response.status\n error.apiMessage = message\n } else {\n const errorMessage = e.status ? `${e} (${e.status})` : '' + e\n error = new Error(errorMessage)\n }\n throw error\n}\n\nclass ResourcesApi {\n constructor(api) {\n this.api = api\n this.apiKey = null\n this.axios = axios.create({\n baseURL: `${appBase}/resources`,\n paramsSerializer: {indexes: null}\n })\n }\n\n async get(path, query, config) {\n const GET = (path, body, config) => this.axios.get(path, config)\n return this.api.doHttpRequest(GET, path, null, {params: query, methodName: 'GET', ...config})\n }\n}\n\nclass Api {\n constructor(keycloak, setLoading) {\n this.keycloak = keycloak\n this.setLoading = setLoading\n this.baseURL = `${apiBase}/v1`\n this.axios = axios.create({\n baseURL: this.baseURL,\n paramsSerializer: {indexes: null}\n })\n\n this.nLoading = 0\n\n this.onFinishLoading = (show) => {\n if (show) {\n this.nLoading--\n if (this.nLoading === 0) {\n setLoading(false)\n }\n }\n }\n this.onStartLoading = (show) => {\n if (show) {\n this.nLoading++\n if (this.nLoading > 0) {\n setLoading(true)\n }\n }\n }\n\n this.subscriptions = {}\n }\n\n /**\n * Fetches the up-to-date authorization headers. Performs a token update if\n * the current token has expired.\n * @returns Object containing the authorization header.\n */\n async authHeaders() {\n if (this.keycloak.token) {\n return new Promise((resolve, reject) => {\n this.keycloak.updateToken()\n .then(() => {\n resolve({\n headers: {\n 'Authorization': `Bearer ${this.keycloak.token}`\n }\n })\n })\n .catch(() => {\n reject(new ApiError())\n })\n })\n } else {\n return {}\n }\n }\n\n /**\n * Returns the data related to the specified dataset.\n *\n * @param {string} datasetID\n * @returns Object containing the search index contents.\n */\n async datasets(datasetId) {\n this.onStartLoading()\n const auth = await this.authHeaders()\n try {\n const entry = await this.axios.get(`/datasets/${datasetId}`, auth)\n return entry.data.data\n } catch (errors) {\n handleApiError(errors)\n } finally {\n this.onFinishLoading()\n }\n }\n\n /**\n * Returns a list of suggestions for the given metainfo quantities.\n *\n * @param {string} quantity The quantity names for which suggestions are\n * returned.\n * @param {string} input Input used to filter the responses. Must be provided\n * in order to return suggestions.\n *\n * @returns List of suggested values. The items are ordered by how well they\n * match the input.\n */\n async suggestions(quantities, input) {\n const auth = await this.authHeaders()\n try {\n const suggestions = await this.axios.post(\n `/suggestions`,\n {\n input: input,\n quantities: quantities\n },\n auth\n )\n return suggestions.data\n } catch (errors) {\n handleApiError(errors)\n }\n }\n\n /**\n * Return the raw file metadata for a given entry.\n * @param {string} entryId\n * @returns Object containing the raw file metadata.\n */\n async getRawFileListFromEntry(entryId) {\n this.onStartLoading()\n const auth = await this.authHeaders()\n try {\n const entry = await this.axios.get(`/entries/${entryId}/rawdir`, auth)\n return entry.data\n } catch (errors) {\n handleApiError(errors)\n } finally {\n this.onFinishLoading()\n }\n }\n\n /**\n * Executes the given entry query\n * @param {object} search contains the search object\n * @param {string} searchTarget The target of the search: entries or materials\n * @returns Object containing the raw file metadata.\n */\n async query(searchTarget, search, config) {\n this.onStartLoading(config?.loadingIndicator || false)\n const auth = await this.authHeaders()\n try {\n const request = {\n method: 'POST',\n path: `${searchTarget}/query`,\n url: `${this.baseURL}/${searchTarget}/query`,\n body: search\n }\n const result = await this.axios.post(request.path, request.body, auth)\n if (config.returnRequest) {\n request.response = result.data\n return request\n } else {\n return result.data\n }\n } catch (errors) {\n handleApiError(errors)\n } finally {\n this.onFinishLoading(config?.loadingIndicator || false)\n }\n }\n\n async get(path, query, config) {\n const GET = (path, body, config) => this.axios.get(path, config)\n return this.doHttpRequest(GET, path, null, {params: query, methodName: 'GET', ...config})\n }\n\n async post(path, body, config) {\n const POST = (path, body, config) => this.axios.post(path, body, config)\n return this.doHttpRequest(POST, path, body, {methodName: 'POST', ...config})\n }\n\n async put(path, body, config) {\n const PUT = (path, body, config) => this.axios.put(path, body, config)\n return this.doHttpRequest(PUT, path, body, {methodName: 'PUT', ...config})\n }\n\n async delete(path, config) {\n const DELETE = (path, body, config) => this.axios.delete(path, config)\n return this.doHttpRequest(DELETE, path, null, {methodName: 'DELETE', ...config})\n }\n\n async doHttpRequest(method, path, body, config) {\n const noLoading = config?.noLoading\n this.onStartLoading(!noLoading)\n const auth = await this.authHeaders()\n config = config || {}\n config.params = config.params || {}\n config.headers = {\n accept: 'application/json',\n ...auth.headers,\n ...(config?.headers || {})\n }\n try {\n const results = await method(path, body, config)\n if (config.jsonResponse) {\n results.data = repairJsonResponse(results.data)\n }\n const response = config.fullResponse\n ? results\n : results.data\n if (config.returnRequest) {\n return {\n method: config.methodName || method.name,\n url: `${this.baseURL}/${path}`,\n body: body,\n response: response\n }\n }\n return response\n } catch (errors) {\n if (config.noHandleErrors) {\n throw errors\n }\n handleApiError(errors)\n } finally {\n this.onFinishLoading(!noLoading)\n }\n }\n\n async getGroups(query) {\n // no loading indicator, because this is only used in the background of the edit dialog\n return this.get('groups', query, {noLoading: true}).then(response => response.data)\n }\n\n async getUsers(query) {\n // no loading indicator, because this is only used in the background of the edit dialog\n return this.get('users', query, {noLoading: true}).then(response => response.data)\n }\n\n async inviteUser(user) {\n return this.put('users/invite', user, {noHandleErrors: true})\n }\n\n async getDatasets(prefix) {\n // no loading indicator, because this is only used in the background of the edit dialog\n const user = await this.keycloak.loadUserInfo()\n const query = {\n prefix: prefix,\n dataset_type: 'owned',\n user_id: user.id,\n page_size: 1000\n }\n return this.get('datasets', query, {noLoading: true}).then(response => response.data)\n }\n\n async edit(edit) {\n // We do not call the start and finish loading callbacks, because this one is\n // only used in the background.\n\n // repair the query, the API will only access correct use of lists for many\n // quantities\n Object.keys(edit.query).forEach(quantity => {\n if (searchQuantities[quantity] && searchQuantities[quantity].many) {\n if (!Array.isArray(edit.query[quantity])) {\n edit.query[quantity] = edit.query[quantity].split(',')\n }\n }\n })\n return this.post('entries/edit_v0', edit)\n }\n}\n\n/**\n * Custom JSON parse function that can handle NaNs that can be created by the\n * python JSON serializer.\n */\nfunction repairJsonResponse(result) {\n if (typeof result === 'string') {\n try {\n return JSON.parse(result)\n } catch (e) {\n try {\n return JSON.parse(result.replace(/\\bNaN\\b/g, '\"NaN\"'))\n } catch (e) {\n return result\n }\n }\n } else {\n return result\n }\n}\n\n/**\n * React context that provides access to the API, user information and server\n * information throughout the app.\n */\nexport const apiContext = React.createContext()\nexport const APIProvider = React.memo(({\n children\n}) => {\n const {keycloak} = useKeycloak()\n const setLoading = useSetLoading()\n const api = useState(new Api(keycloak, setLoading))[0]\n const [user, setUser] = useState()\n\n // Update user whenever keycloak instance changes\n useEffect(() => {\n if (!keycloak.authenticated) {\n setUser(null)\n return\n }\n\n keycloak.loadUserInfo().then(async userInfo => {\n api.getGroups({user_id: userInfo.sub}).then(groups => {\n userInfo.groups = groups.map(group => group.group_id)\n setUser(userInfo)\n }).catch(() => {\n userInfo.groups = []\n setUser(userInfo)\n })\n }).catch(() => {\n setUser(null)\n })\n }, [api, keycloak, setUser])\n\n const value = useMemo(() => ({\n api: api,\n resourcesApi: new ResourcesApi(api),\n user: user\n }), [api, user])\n\n return \n {children}\n \n})\nAPIProvider.propTypes = {\n children: PropTypes.node\n}\n\n/**\n * Hook for using server info.\n*/\nconst infoState = atom({\n key: 'info',\n default: undefined\n})\nexport function useInfo() {\n const [info, setInfo] = useRecoilState(infoState)\n const { api } = useApi()\n\n // Get info only once\n useEffect(() => {\n if (!info) {\n api.get('/info').then(setInfo).catch(() => {})\n }\n }, [info, api, setInfo])\n\n return info\n}\n\n/**\n * Hook for using the API context.\n*/\nexport function useApi() {\n return useContext(apiContext)\n}\n\n/**\n * Hooks/state for reading/writing whether the API is loading something.\n*/\nconst apiLoading = atom({\n key: 'apiLoading',\n default: false\n})\nexport function useLoading() {\n return useRecoilValue(apiLoading)\n}\nexport function useLoadingState() {\n return useRecoilState(apiLoading)\n}\nexport function useSetLoading() {\n return useSetRecoilState(apiLoading)\n}\n\nfunction VerifyGlobalLogin({children}) {\n const {api} = useApi()\n const [verified, setVerified] = useState(null)\n\n useEffect(() => {\n api.get('users/me').then(() => setVerified(true)).catch(() => setVerified(false))\n }, [api, setVerified])\n\n if (verified === null) {\n return null\n }\n\n if (!verified) {\n return \n \n \n You are not allowed to access this NOMAD installation. Please logout and try again.\n \n \n }\n\n return \n {children}\n \n}\nVerifyGlobalLogin.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]).isRequired\n}\n\nexport function GlobalLoginRequired({children}) {\n if (!globalLoginRequired) {\n return \n {children}\n \n }\n\n return \n \n {children}\n \n \n}\nGlobalLoginRequired.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]).isRequired\n}\n\nexport const LoginRequired = withStyles(theme => ({\n root: {\n padding: theme.spacing(2),\n display: 'flex',\n alignItems: 'center',\n '& p': {\n marginRight: theme.spacing(1)\n }\n }\n}))(({classes, message, children}) => {\n const {api} = useApi()\n if (api.keycloak.authenticated) {\n return \n {children}\n \n } else {\n return
\n \n {message || 'You have to login to use this functionality.'}\n \n \n
\n }\n})\nLoginRequired.propTypes = {\n message: PropTypes.string,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]).isRequired\n}\n\n/**\n * HOC for wrapping components that require a login. Without login will return\n * the given message together with a login link.\n *\n * @param {*} Component\n * @param {*} message The message to display\n */\nexport function withLoginRequired(Component, message) {\n return ({...props}) => \n \n \n}\n\nexport const withApi = (Component) => React.forwardRef((props, ref) => {\n const apiProps = useApi()\n const {raiseError} = useErrors()\n return \n})\n\nexport const onKeycloakEvent = (keycloak) => {\n const cookies = new Cookies()\n const path = apiBase.startsWith('/') ? apiBase : new URL(apiBase).pathname\n return () => {\n // Will be called whenever a keycloak event occurs\n if (keycloak.authenticated) {\n // Authenticated. Set authentication cookie\n cookies.set('Authorization', 'Bearer ' + keycloak.token,\n {\n path: path,\n expires: new Date((keycloak.tokenParsed.exp + keycloak.timeSkew) * 1000),\n sameSite: 'strict'\n })\n } else {\n // Not authenticated. Remove the cookie.\n cookies.remove('Authorization', {path: path})\n }\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport Typography from '@material-ui/core/Typography'\nimport { Button, Link, makeStyles } from '@material-ui/core'\nimport { keycloakBase, keycloakRealm } from '../config'\nimport LoginIcon from '@material-ui/icons/AccountCircle'\nimport { useApi } from './api'\nimport { useKeycloak } from '@react-keycloak/web'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n alignItems: 'center',\n '& p': {\n marginRight: theme.spacing(2)\n }\n },\n link: {\n textDecoration: 'underline'\n },\n button: {} // to allow overrides\n}))\n\nconst LoginLogout = React.memo(function LoginLogout(props) {\n const classes = useStyles()\n const {user} = useApi()\n const {keycloak} = useKeycloak()\n const {variant, color} = props\n\n if (keycloak?.authenticated) {\n return (\n
\n \n Welcome \n { user ? user.name : '...' }\n \n \n keycloak.logout()}\n startIcon={}\n data-testid='logout-button'\n >Logout\n
\n )\n } else {\n return (\n
\n }\n onClick={() => keycloak.login()}\n data-testid='login-register-button'\n >Login / Register\n
\n )\n }\n})\nLoginLogout.propTypes = {\n variant: PropTypes.string,\n color: PropTypes.string\n}\n\nexport default LoginLogout\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {useState, useMemo, useContext, useCallback, useEffect} from 'react'\nimport PropTypes from 'prop-types'\nimport { isNil, isFunction, startCase, toLower, cloneDeep } from 'lodash'\nimport { Unit as UnitMathJS, createUnit } from 'mathjs'\nimport { unitList, unitPrefixes as prefixes } from '../../config'\n\n// Delete all units and prefixes that come by default with Math.js. This way\n// they cannot be intermixed with the NOMAD units. Notice that we have to clear\n// them in place: they are defined as const.\nObject.keys(UnitMathJS.UNITS).forEach(name => UnitMathJS.deleteUnit(name))\nUnitMathJS.BASE_DIMENSIONS.splice(0, UnitMathJS.BASE_DIMENSIONS.length)\nObject.getOwnPropertyNames(UnitMathJS.BASE_UNITS).forEach(function(prop) {\n delete UnitMathJS.BASE_UNITS[prop]\n})\nObject.getOwnPropertyNames(UnitMathJS.PREFIXES).forEach(function(prop) {\n delete UnitMathJS.PREFIXES[prop]\n})\nUnitMathJS.PREFIXES.NONE = {'': { name: '', value: 1, scientific: true }}\nUnitMathJS.PREFIXES.PINT = prefixes\n\n// Customize the unit parsing to allow certain special symbols\nconst isAlphaOriginal = UnitMathJS.isValidAlpha\nconst isSpecialChar = function(c) {\n const specialChars = new Set(['_', 'Å', 'Å', 'å', '°', 'µ', 'ö', 'é', '∞', 'Δ'])\n return specialChars.has(c)\n}\nconst isGreekLetter = function(c) {\n const charCode = c.charCodeAt(0)\n return (charCode > 912 && charCode < 970)\n}\nUnitMathJS.isValidAlpha = function(c) {\n return isAlphaOriginal(c) || isSpecialChar(c) || isGreekLetter(c)\n}\n\n// Create MathJS unit definitions from the data exported by 'nomad dev units'.\nexport const unitToAbbreviationMap = {}\nconst unitDefinitions = {}\nfor (let def of unitList) {\n const name = def.name\n def = {\n ...def,\n baseName: def.dimension,\n prefixes: 'pint'\n }\n unitDefinitions[name] = def\n if (def.abbreviation) {\n unitToAbbreviationMap[name] = def.abbreviation\n if (def.aliases) {\n for (const alias of def.aliases) {\n unitToAbbreviationMap[alias] = def.abbreviation\n }\n }\n }\n}\ncreateUnit(unitDefinitions, {override: true})\n\n// Export unit options for each unit and dimension\nexport const unitMap = Object.fromEntries(unitList.map(x => [x.name, x]))\nexport const dimensionMap = {}\nfor (const def of unitList) {\n const name = def.name\n const dimension = def.dimension\n if (isNil(dimension)) {\n continue\n }\n const oldInfo = dimensionMap[dimension] || {\n label: startCase(toLower(dimension.replace('_', ' ')))\n }\n const oldList = oldInfo.units || []\n oldList.push(name)\n oldInfo.units = oldList\n dimensionMap[dimension] = oldInfo\n}\n\n/**\n * Convenience function for getting compatible units for a given dimension.\n * Returns all compatible units that have been registered.\n *\n * @param {string} dimension The dimension.\n * @returns Array of compatible units.\n */\nexport function getUnits(dimension) {\n return dimensionMap?.[dimension]?.units || []\n}\n\n/**\n * React context for interacting with unit configurations.\n */\nexport const unitContext = React.createContext()\nexport const UnitProvider = React.memo(({initialUnitSystems, initialSelected, children}) => {\n const resetUnitSystems = useState(cloneDeep(initialUnitSystems))[0]\n const [isReset, setIsReset] = useState(true)\n const [unitSystems, setUnitSystems] = useState(cloneDeep(initialUnitSystems))\n const [selectedSystem, setSelectedSystem] = useState(initialSelected)\n const [currentScope, setCurrentScope] = useState()\n const [scopes, setScopes] = useState({})\n const [scope, setScope] = useState()\n\n const reset = useCallback(() => {\n setUnitSystems(cloneDeep(resetUnitSystems))\n setIsReset(true)\n if (currentScope && scopes?.[currentScope]?.system) {\n setSelectedSystem(scopes[currentScope].system)\n }\n }, [currentScope, scopes, resetUnitSystems])\n\n const setScopeInfo = useCallback((scopeKey, unit) => {\n if (!(scopeKey in scopes)) {\n scopes[scopeKey] = {system: unit || initialSelected, unitSystems: unitSystems}\n setScopes({...scopes})\n }\n setCurrentScope(scopeKey)\n }, [scopes, initialSelected, unitSystems])\n\n useEffect(() => {\n if (currentScope in scopes) {\n setSelectedSystem(scopes[currentScope].system)\n setUnitSystems(scopes[currentScope].unitSystems)\n }\n }, [currentScope, scopes])\n\n const setSelected = useCallback((unitSystem) => {\n setIsReset(false)\n setSelectedSystem(unitSystem)\n setScopes(scopes => {\n scopes[currentScope].system = unitSystem\n return {...scopes}\n })\n }, [currentScope])\n\n const setUnits = useCallback((value) => {\n setIsReset(false)\n setUnitSystems(old => {\n const newSystems = {...old}\n newSystems[selectedSystem].units = isFunction(value)\n ? value(newSystems[selectedSystem].units)\n : value\n setScopes(scopes => {\n scopes[currentScope].unitSystems = newSystems\n return {...scopes}\n })\n return newSystems\n })\n }, [currentScope, selectedSystem])\n\n const values = useMemo(() => {\n return {\n units: unitSystems[selectedSystem].units,\n setUnits: setUnits,\n unitSystems,\n unitMap,\n dimensionMap,\n selected: selectedSystem,\n setSelected,\n reset,\n isReset,\n setScopeInfo,\n scope,\n setScope\n }\n }, [unitSystems, selectedSystem, setUnits, setSelected, reset, isReset, setScopeInfo, scope, setScope])\n\n return \n {children}\n \n})\n\nUnitProvider.propTypes = {\n initialUnitSystems: PropTypes.object,\n initialSelected: PropTypes.string,\n children: PropTypes.node\n}\n\n/**\n * Convenience hook for using the current unit context.\n *\n * @returns Object containing the currently set units for each dimension (e.g.\n * {energy: 'joule'})\n */\nexport const useUnitContext = (scopeKey, defaultUnitSystem) => {\n const context = useContext(unitContext)\n const {setScopeInfo, scope, setScope, ...others} = context\n\n useEffect(() => {\n setScope(!scopeKey ? scopeKey : 'Schema')\n }, [scopeKey, setScope])\n\n useEffect(() => {\n if (scopeKey && scope === 'Schema') {\n setScopeInfo(scopeKey, defaultUnitSystem)\n } else {\n setScopeInfo('Global')\n }\n }, [scopeKey, scope, setScopeInfo, defaultUnitSystem])\n\n return {...others, scope, setScope}\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {memoize, has, isNil} from 'lodash'\nimport {Unit} from './Unit'\nimport { Unit as UnitMathJS } from 'mathjs'\n\nexport const deltaPrefixes = ['delta_', 'Δ']\n\n/**\n * Convenience function for parsing value and unit information from a string.\n * Can parse values, units or both at the same time.\n *\n * @param {string} input The input string to parse\n * @param {object} options Parsing options. These include:\n * - dimension: Dimension for the unit. Note that you should use the base\n * dimensions which you can get e.g. with .dimension(true).\n * - requireValue: Whether an explicit numeric value is required at the start\n * of the input.\n * - requireUnit: Whether an explicit unit in the input is required.\n * @returns Object containing the following properties, if available:\n * - value: Numerical value as a number\n * - valueString: The original number input as a string. Note that this can only return\n * the number when it is used as a prefix, and does not work with numbers\n * that are part of a complex expression, e.g. 300 eV / 1000 K.\n * - unit: Unit instance\n * - error: Error messsage\n */\nexport function parse(input, options) {\n options = {\n dimension: null,\n requireValue: false,\n requireUnit: false,\n ...options\n } || {}\n\n const result = {}\n\n try {\n const parseResults = parseInternal(input, options)\n result.value = isNil(parseResults.value) ? undefined : parseResults.value\n result.valueString = parseResults.valueString || undefined\n if (parseResults.unit?.units?.length) {\n result.unit = new Unit(parseResults.unit)\n }\n } catch (e) {\n result.error = e.message\n return result\n }\n\n // TODO: This check is not enough: the input may be compatible after the base\n // units are compared.\n if (options.dimension !== null && result.unit) {\n if (!(result.unit.dimension(true) === options.dimension || result.unit.dimension(false) === options.dimension)) {\n result.error = `Unit \"${result.unit.label(false)}\" is incompatible with dimension \"${options.dimension}\".`\n }\n }\n\n return result\n}\n\n/**\n * Parse a string into an optional value and a MathJS Unit definition.\n *\n * Throws an exception if the provided string does not contain a valid unit or\n * cannot be parsed.\n *\n * @memberof Unit\n * @param {string} str A string like \"5.2 inch\", \"4e2 cm/s^2\"\n * @param {object} options Parsing options. These include:\n * - requireValue: Whether an explicit numeric value is required at the start\n * of the input.\n * - requireUnit: Whether an explicit unit in the input is required.\n * @returns Object containing the following properties, if available:\n * - value: Numerical value as a number\n * - valueString: The original number input as a string. Note that this can only return\n * the number when it is used as a prefix, and does not work with numbers\n * that are part of a complex expression, e.g. 300 eV / 1000 K.\n * - unit: Unit instance\n */\nexport function parseInternal(str, options) {\n // Replace ** with ^\n str = str.replace(/\\*\\*/g, '^')\n\n options = options || {}\n const text = str\n let index = -1\n let c = ''\n\n function skipWhitespace() {\n while (c === ' ' || c === '\\t') {\n next()\n }\n }\n\n function isDigitDot(c) {\n return ((c >= '0' && c <= '9') || c === '.')\n }\n\n function isDigit(c) {\n return ((c >= '0' && c <= '9'))\n }\n\n function next() {\n index++\n c = text.charAt(index)\n }\n\n function revert(oldIndex) {\n index = oldIndex\n c = text.charAt(index)\n }\n\n function parseUnit() {\n let unitName = ''\n\n // Alphanumeric characters only; matches [a-zA-Z0-9]\n while (isDigit(c) || UnitMathJS.isValidAlpha(c)) {\n unitName += c\n next()\n }\n\n // Must begin with [a-zA-Z]\n const firstC = unitName.charAt(0)\n if (UnitMathJS.isValidAlpha(firstC)) {\n return unitName\n } else {\n return null\n }\n }\n\n function parseCharacter(toFind) {\n if (c === toFind) {\n next()\n return toFind\n } else {\n return null\n }\n }\n\n function parseNumber() {\n let number = ''\n const oldIndex = index\n\n if (c === '+') {\n next()\n } else if (c === '-') {\n number += c\n next()\n }\n\n if (!isDigitDot(c)) {\n // a + or - must be followed by a digit\n revert(oldIndex)\n return null\n }\n\n // get number, can have a single dot\n if (c === '.') {\n number += c\n next()\n if (!isDigit(c)) {\n // this is no legal number, it is just a dot\n revert(oldIndex)\n return null\n }\n } else {\n while (isDigit(c)) {\n number += c\n next()\n }\n if (c === '.') {\n number += c\n next()\n }\n }\n while (isDigit(c)) {\n number += c\n next()\n }\n\n // check for exponential notation like \"2.3e-4\" or \"1.23e50\"\n if (c === 'E' || c === 'e') {\n // The grammar branches here. This could either be part of an exponent or the start of a unit that begins with the letter e, such as \"4exabytes\"\n\n let tentativeNumber = ''\n const tentativeIndex = index\n\n tentativeNumber += c\n next()\n\n if (c === '+' || c === '-') {\n tentativeNumber += c\n next()\n }\n\n // Scientific notation MUST be followed by an exponent (otherwise we assume it is not scientific notation)\n if (!isDigit(c)) {\n // The e or E must belong to something else, so return the number without the e or E.\n revert(tentativeIndex)\n return number\n }\n\n // We can now safely say that this is scientific notation.\n number = number + tentativeNumber\n while (isDigit(c)) {\n number += c\n next()\n }\n }\n\n return number\n }\n\n if (typeof text !== 'string') {\n throw new TypeError('Invalid argument in Unit.parse, string expected')\n }\n\n const unit = new UnitMathJS()\n unit.units = []\n\n let powerMultiplierCurrent = 1\n let expectingUnit = false\n\n // A unit should follow this pattern:\n // [number] ...[ [*/] unit[^number] ]\n // unit[^number] ... [ [*/] unit[^number] ]\n\n // Rules:\n // number is any floating point number.\n // unit is any alphanumeric string beginning with an alpha. Units with names like e3 should be avoided because they look like the exponent of a floating point number!\n // The string may optionally begin with a number.\n // Each unit may optionally be followed by ^number.\n // Whitespace or a forward slash is recommended between consecutive units, although the following technically is parseable:\n // 2m^2kg/s^2\n // it is not good form. If a unit starts with e, then it could be confused as a floating point number:\n // 4erg\n\n next()\n skipWhitespace()\n\n // Optional number at the start of the string\n const valueString = parseNumber()\n let value = null\n if (valueString) {\n value = parseFloat(valueString)\n skipWhitespace() // Whitespace is not required here\n\n // handle multiplication or division right after the value, like '1/s'\n if (parseCharacter('*')) {\n powerMultiplierCurrent = 1\n expectingUnit = true\n } else if (parseCharacter('/')) {\n powerMultiplierCurrent = -1\n expectingUnit = true\n }\n } else if (options.requireValue) {\n throw new SyntaxError('Enter a valid numerical value')\n }\n\n // Stack to keep track of powerMultipliers applied to each parentheses group\n const powerMultiplierStack = []\n\n // Running product of all elements in powerMultiplierStack\n let powerMultiplierStackProduct = 1\n\n while (true) {\n skipWhitespace()\n\n // Check for and consume opening parentheses, pushing powerMultiplierCurrent to the stack\n // A '(' will always appear directly before a unit.\n while (c === '(') {\n powerMultiplierStack.push(powerMultiplierCurrent)\n powerMultiplierStackProduct *= powerMultiplierCurrent\n powerMultiplierCurrent = 1\n next()\n skipWhitespace()\n }\n\n // Is there something here?\n let uStr\n if (c) {\n const oldC = c\n uStr = parseUnit()\n if (uStr === null) {\n throw new SyntaxError('Unexpected \"' + oldC + '\" in \"' + text + '\" at index ' + index.toString())\n }\n } else {\n // End of input.\n break\n }\n\n // Verify the unit exists and get the prefix (if any)\n const res = findUnit(uStr)\n if (res === null) {\n // Unit not found.\n throw new SyntaxError('Unit \"' + uStr + '\" not found.')\n }\n\n let power = powerMultiplierCurrent * powerMultiplierStackProduct\n // Is there a \"^ number\"?\n skipWhitespace()\n if (parseCharacter('^')) {\n skipWhitespace()\n const p = parseNumber()\n if (p === null) {\n // No valid number found for the power!\n throw new SyntaxError('In \"' + str + '\", \"^\" must be followed by a floating-point number')\n }\n power *= p\n }\n\n // Add the unit to the list\n unit.units.push({\n unit: res.unit,\n prefix: res.prefix,\n delta: res.delta,\n power\n })\n for (let i = 0; i < UnitMathJS.BASE_DIMENSIONS.length; i++) {\n unit.dimensions[i] += (res.unit.dimensions[i] || 0) * power\n }\n\n // Check for and consume closing parentheses, popping from the stack.\n // A ')' will always follow a unit.\n skipWhitespace()\n while (c === ')') {\n if (powerMultiplierStack.length === 0) {\n throw new SyntaxError('Unmatched \")\" in \"' + text + '\" at index ' + index.toString())\n }\n powerMultiplierStackProduct /= powerMultiplierStack.pop()\n next()\n skipWhitespace()\n }\n\n // \"*\" and \"/\" should mean we are expecting something to come next.\n // Is there a forward slash? If so, negate powerMultiplierCurrent. The next unit or paren group is in the denominator.\n expectingUnit = false\n\n if (parseCharacter('*')) {\n // explicit multiplication\n powerMultiplierCurrent = 1\n expectingUnit = true\n } else if (parseCharacter('/')) {\n // division\n powerMultiplierCurrent = -1\n expectingUnit = true\n } else {\n // implicit multiplication\n powerMultiplierCurrent = 1\n }\n\n // Replace the unit into the auto unit system\n if (res.unit.base) {\n const baseDim = res.unit.base.key\n UnitMathJS.UNIT_SYSTEMS.auto[baseDim] = {\n unit: res.unit,\n prefix: res.prefix\n }\n }\n }\n\n // Has the string been entirely consumed?\n skipWhitespace()\n if (c) {\n throw new SyntaxError('Could not parse: \"' + str + '\"')\n }\n\n // Is there a trailing slash?\n if (expectingUnit) {\n throw new SyntaxError('Trailing characters: \"' + str + '\"')\n }\n\n // Is the parentheses stack empty?\n if (powerMultiplierStack.length !== 0) {\n throw new SyntaxError('Unmatched \"(\" in \"' + text + '\"')\n }\n\n // Are there any units at all?\n if (unit.units.length === 0 && options.requireUnit) {\n throw new SyntaxError('Unit is required')\n }\n\n return {value, valueString, unit}\n}\n\n/**\n * Find a unit from a string\n *\n * @param {string} str A string like 'cm' or 'inch'\n * @returns {Object | null} When found, an object with fields unit and\n* prefix is returned. Else, null is returned.\n */\nconst findUnit = memoize((str) => {\n // First, match units names exactly. For example, a user could define 'mm' as\n // 10^-4 m, which is silly, but then we would want 'mm' to match the\n // user-defined unit.\n if (has(UnitMathJS.UNITS, str)) {\n const unit = UnitMathJS.UNITS[str]\n const prefix = unit.prefixes['']\n return { unit, prefix, delta: false }\n }\n\n for (const name in UnitMathJS.UNITS) {\n if (has(UnitMathJS.UNITS, name)) {\n if (str.endsWith(name)) {\n const unit = UnitMathJS.UNITS[name]\n const prefixLen = (str.length - name.length)\n let prefixName = str.substring(0, prefixLen)\n let delta = false\n for (const deltaPrefix of deltaPrefixes) {\n if (prefixName.startsWith(deltaPrefix)) {\n prefixName = prefixName.substring(deltaPrefix.length)\n delta = true\n break\n }\n }\n const prefix = has(unit.prefixes, prefixName)\n ? unit.prefixes[prefixName]\n : undefined\n if (prefix !== undefined) {\n return { unit, prefix, delta }\n }\n }\n }\n }\n\n return null\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {isNil, has, isString} from 'lodash'\nimport {Unit as UnitMathJS} from 'mathjs'\nimport {unitToAbbreviationMap} from './UnitContext'\nimport {parseInternal} from './common'\n\nexport const DIMENSIONLESS = 'dimensionless'\n\n/**\n * Helper class for persisting unit information.\n *\n * Builds upon the math.js Unit class, but adds additional functionality,\n * including:\n * - Ability to convert to any unit system given as an argument\n * - Abbreviated labels for dense formatting\n */\nexport class Unit {\n /**\n * @param {str | Unit} unit Unit for the quantity.\n */\n constructor(unit) {\n if (isString(unit)) {\n unit = parseInternal(unit, {requireUnit: true}).unit\n } else if (unit instanceof Unit) {\n unit = unit.mathjsUnit.clone()\n } else if (unit instanceof UnitMathJS) {\n unit = unit.clone()\n } else {\n throw Error('Please provide the unit as a string or as an instance of Unit.')\n }\n this.mathjsUnit = unit\n }\n\n /**\n * Checks if the given unit has the same base dimensions as this one.\n * @param {str | Unit} unit Unit to compare to\n * @returns boolean Whether the units have the same base dimensions.\n */\n equalBase(unit) {\n if (isString(unit)) {\n unit = new Unit(unit)\n }\n return this.mathjsUnit.equalBase(unit.mathjsUnit)\n }\n\n /**\n * Used to create a human-readable description of the unit as a string.\n *\n * @param {bool} abbreviate Whether to abbreviate the label using the\n * abbreviations for each unit and prefix. If false, the original unit names\n * (as given or defined by the unit system) are used.\n * @returns A string representing the unit.\n */\n label(abbreviate = true, showDelta = false) {\n // TODO: The label caching is disabled for now. Because Quantities are\n // stored as recoil.js atoms, they become immutable which causes problems\n // with internal state mutation.\n const units = this.mathjsUnit.units\n let strNum = ''\n let strDen = ''\n let nNum = 0\n let nDen = 0\n\n function getDelta(unit) {\n return (showDelta && unit.delta)\n ? abbreviate ? 'Δ' : 'delta_'\n : ''\n }\n\n function getName(unit) {\n if (unit.base.key === DIMENSIONLESS) return ''\n return abbreviate\n ? unitToAbbreviationMap?.[unit.name] || unit.name\n : unit.name\n }\n\n function getPrefix(original) {\n if (!abbreviate) return original\n const prefixMap = {\n // SI\n deca: 'da',\n hecto: 'h',\n kilo: 'k',\n mega: 'M',\n giga: 'G',\n tera: 'T',\n peta: 'P',\n exa: 'E',\n zetta: 'Z',\n yotta: 'Y',\n deci: 'd',\n centi: 'c',\n milli: 'm',\n micro: 'u',\n nano: 'n',\n pico: 'p',\n femto: 'f',\n atto: 'a',\n zepto: 'z',\n yocto: 'y',\n // IEC\n kibi: 'Ki',\n mebi: 'Mi',\n gibi: 'Gi',\n tebi: 'Ti',\n pebi: 'Pi',\n exi: 'Ei',\n zebi: 'Zi',\n yobi: 'Yi'\n }\n return prefixMap?.[original] || original\n }\n\n for (let i = 0; i < units.length; i++) {\n const unitDef = units[i]\n if (unitDef.power > 0) {\n nNum++\n const prefix = getPrefix(unitDef.prefix.name)\n const name = getName(unitDef.unit)\n const delta = getDelta(unitDef)\n strNum += ` ${delta}${prefix}${name}`\n if (Math.abs(unitDef.power - 1.0) > 1e-15) {\n strNum += '^' + unitDef.power\n }\n } else if (unitDef.power < 0) {\n nDen++\n }\n }\n\n if (nDen > 0) {\n for (let i = 0; i < units.length; i++) {\n const unitDef = units[i]\n if (unitDef.power < 0) {\n const prefix = getPrefix(unitDef.prefix.name)\n const name = getName(unitDef.unit)\n const delta = getDelta(unitDef)\n if (nNum > 0) {\n strDen += ` ${delta}${prefix}${name}`\n if (Math.abs(unitDef.power + 1.0) > 1e-15) {\n strDen += '^' + (-unitDef.power)\n }\n } else {\n strDen += ` ${delta}${prefix}${name}`\n strDen += '^' + (unitDef.power)\n }\n }\n }\n }\n // Remove leading whitespace\n strNum = strNum.substr(1)\n strDen = strDen.substr(1)\n\n // Add parentheses for better copy/paste back into evaluate, for example, or\n // for better pretty print formatting\n if (nNum > 1 && nDen > 0) {\n strNum = '(' + strNum + ')'\n }\n if (nDen > 1 && nNum > 0) {\n strDen = '(' + strDen + ')'\n }\n\n let str = strNum\n if (nNum > 0 && nDen > 0) {\n str += ' / '\n }\n str += strDen\n\n return str\n }\n\n /**\n * Gets the dimension of this unit as a string. The order of the dimensions is\n * fixed (determined at unit registration time).\n *\n * @param {boolean} base Whether to return dimension in base units. Otherwise\n * the original unit dimensions are used.\n * @returns The dimensionality as a string, e.g. 'time^2 energy mass^-2'\n */\n dimension(base = false) {\n const dimensions = Object.keys(UnitMathJS.BASE_UNITS)\n const dimensionMap = Object.fromEntries(dimensions.map(name => [name, 0]))\n\n if (base) {\n const BASE_DIMENSIONS = UnitMathJS.BASE_DIMENSIONS\n for (let i = 0; i < BASE_DIMENSIONS.length; ++i) {\n const power = this?.mathjsUnit.dimensions?.[i]\n if (power) {\n dimensionMap[BASE_DIMENSIONS[i]] += power\n }\n }\n } else {\n for (const unit of this?.mathjsUnit.units) {\n const power = unit.power\n if (power) {\n dimensionMap[unit.unit.base.key] += power\n }\n }\n }\n const dims = Object.entries(dimensionMap).filter(d => d[1] !== 0)\n return dims.length > 0\n ? dims.map(d => `${d[0]}${((d[1] < 0 || d[1] > 1) && `^${d[1]}`) || ''}`).join(' ')\n : DIMENSIONLESS\n }\n\n /**\n * Function for converting to another unit.\n *\n * @param {str | Unit} unit The target unit\n * @returns A new Unit expressed in the given units.\n */\n to(unit) {\n let mathjsUnit\n if (unit instanceof Unit) {\n mathjsUnit = unit.mathjsUnit\n } else if (isString(unit)) {\n mathjsUnit = parseInternal(unit, {requireUnit: true}).unit\n } else {\n throw Error('Unknown unit type. Please provide the unit as as string or as instance of Unit.')\n }\n return new Unit(this.mathjsUnit.to(mathjsUnit))\n }\n\n /**\n * Converts all units to their delta versions.\n *\n * @returns A new Unit with delta units.\n */\n toDelta() {\n const unitMathJS = this.mathjsUnit.clone()\n for (const unit of unitMathJS.units) {\n unit.delta = true\n }\n return new Unit(unitMathJS)\n }\n\n /**\n * Function for converting the value of this Unit to the SI unit system.\n *\n * @returns A new Unit instance in the SI unit system.\n */\n toSI() {\n return this.toSystem({\n \"dimensionless\": { \"definition\": \"dimensionless\" },\n \"length\": { \"definition\": \"m\" },\n \"mass\": { \"definition\": \"kg\" },\n \"time\": { \"definition\": \"s\" },\n \"current\": { \"definition\": \"A\" },\n \"temperature\": { \"definition\": \"K\" },\n \"luminosity\": { \"definition\": \"cd\" },\n \"luminous_flux\": { \"definition\": \"lm\" },\n \"substance\": { \"definition\": \"mol\" },\n \"angle\": { \"definition\": \"rad\" },\n \"information\": { \"definition\": \"bit\" },\n \"force\": { \"definition\": \"N\" },\n \"energy\": { \"definition\": \"J\" },\n \"power\": { \"definition\": \"W\" },\n \"pressure\": { \"definition\": \"Pa\" },\n \"charge\": { \"definition\": \"C\" },\n \"resistance\": { \"definition\": \"Ω\" },\n \"conductance\": { \"definition\": \"S\" },\n \"inductance\": { \"definition\": \"H\" },\n \"magnetic_flux\": { \"definition\": \"Wb\" },\n \"magnetic_field\": { \"definition\": \"T\" },\n \"frequency\": { \"definition\": \"Hz\" },\n \"luminance\": { \"definition\": \"nit\" },\n \"illuminance\": { \"definition\": \"lx\" },\n \"electric_potential\": { \"definition\": \"V\" },\n \"capacitance\": { \"definition\": \"F\" },\n \"activity\": { \"definition\": \"kat\" }\n })\n }\n\n /**\n * Function for converting the value of this unit to another unit system.\n *\n * Notice that converting a unit to another unit system is not as easy as\n * conversions to a specific unit. When converting to a specific unit one can\n * simply check that the dimensions match and go ahead with the conversion.\n * With unit systems, there can be multiple alternative forms, and choosing a\n * good one is more difficult. E.g. should 'a_u_force * angstrom' be converted\n * into:\n *\n * a) N m\n * b) J\n * c) (kg m^2) / s^2\n *\n * By default this function will try to preserve the original unit dimensions\n * and not convert everything down to base units. If a derived unit is not\n * present, it will, however, attempt to convert it to the base units. Any\n * further simplication is not performed.\n *\n * If the converted unit has any delta-units, the converted units will also\n * become delta-units.\n *\n * @param {object} system The target unit system.\n * @returns A new Unit instance in the given system.\n */\n toSystem(system) {\n // Go through the currently defined units, identify their dimension and look\n // for the corresponding dimension in the given unit system. If one is\n // present, convert to it. Otherwise convert to base dimensions.\n const UNITS = UnitMathJS.UNITS\n const PREFIXES = UnitMathJS.PREFIXES\n const BASE_DIMENSIONS = UnitMathJS.BASE_DIMENSIONS\n const BASE_UNITS = UnitMathJS.BASE_UNITS\n const proposedUnitList = []\n for (const unit of this.mathjsUnit.units) {\n const dimension = unit.unit.base.key\n const newUnitDefinition = system?.[dimension]?.definition\n\n // If the unit for this dimension is defined, use it\n if (!isNil(newUnitDefinition)) {\n const newUnit = new Unit(newUnitDefinition)\n for (const unitDef of newUnit.mathjsUnit.units) {\n proposedUnitList.push({...unitDef, power: unitDef.power * unit.power, delta: unit.delta})\n }\n // Otherwise convert to base units\n } else {\n let missingBaseDim = false\n const baseUnit = BASE_UNITS[dimension]\n const newDimensions = baseUnit.dimensions\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n const baseDim = BASE_DIMENSIONS[i]\n if (Math.abs(newDimensions[i] || 0) > 1e-12) {\n if (has(system, baseDim)) {\n let unitDef\n const baseUnitDefinition = system[baseDim].definition\n // First try to look up the unit in the list of known units:\n // most likely it is already there. If not found, then we need\n // to try and parse the unit definition: this happens e.g. when\n // units with prefixes are used as base units in the unit\n // system.\n unitDef = UNITS[system[baseDim]?.definition]\n if (!unitDef) {\n try {\n const baseUnit = new Unit(baseUnitDefinition)\n const baseUnitList = baseUnit.mathjsUnit.units\n if (baseUnitList.length === 1) unitDef = baseUnitList[0].unit\n } catch (e) {}\n }\n if (!unitDef) {\n throw Error(`Could not find base unit for \"${system[baseDim].definition}\"`)\n }\n proposedUnitList.push({\n unit: unitDef,\n prefix: PREFIXES.NONE[''],\n power: unit.power ? newDimensions[i] * unit.power : 0,\n delta: unit.delta\n })\n } else {\n missingBaseDim = true\n }\n }\n }\n if (missingBaseDim) {\n throw Error(`The given unit system does not contain the required unit definitions for converting ${unit.name} with dimension ${dimension}.`)\n }\n }\n }\n\n const ret = this.mathjsUnit.clone()\n ret.units = proposedUnitList\n return new Unit(ret)\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {isNumber, isArray} from 'lodash'\nimport {Unit} from './Unit'\nimport {mapDeep} from '../../utils'\n\n/**\n * Class for persisting persisting a numeric value together with unit\n * information.\n */\nexport class Quantity {\n /**\n * @param {number | n-dimensional array of numbers} value Numeric value. See\n * also the argument 'normalized'.\n * @param {str | Unit} unit Unit for the quantity.\n * @param {boolean} normalized Whether the given numeric value is already\n * normalized to base units.\n */\n constructor(value, unit, normalized = false) {\n this.unit = new Unit(unit)\n if (!isNumber(value) && !isArray(value)) {\n throw Error('Please provide the value for a Quantity as a number, or as a multidimensional array of numbers.')\n }\n\n // This attribute stores the quantity value in 'normalized' form that is\n // given in the base units (=SI). This value should only be determined once\n // during initialization and all calls to value() will then lazily determine\n // the value in the currently set units. This avoids 'drift' in the value\n // caused by several consecutive changes of the units.\n this.normalized_value = normalized ? value : this.normalize(value)\n }\n\n /**\n * Get value in current units.\n * @returns The numeric value in the currently set units.\n */\n value() {\n return this.denormalize(this.normalized_value)\n }\n\n /**\n * Convert value from currently set units to base units.\n * @param {n-dimensional array} value Value in currently set units.\n * @returns Value in base units.\n */\n normalize(values) {\n // Pre-calculate coefficients for currently set units. This speeds up\n // conversion for large arrays.\n const unit = this.unit.mathjsUnit\n const ignoreOffset = unit._isDerived()\n const coefficients = this.conversion_coefficients()\n\n return mapDeep(values, (value) => {\n if (value === null || value === undefined) {\n return value\n }\n\n let result = value\n for (let i = 0; i < unit.units.length; i++) {\n const unitDef = unit.units[i]\n const unitOffset = unitDef.unit.offset\n const variable = (ignoreOffset || unitDef.delta)\n ? result\n : result + unitOffset\n result = variable * coefficients[i]\n }\n return result\n })\n }\n\n /**\n * Convert value from base units to currently set units.\n * @param {n-dimensional array} value Value in base units.\n * @returns Value in currently set units.\n */\n denormalize(values) {\n // Pre-calculate coefficients for currently set units. This speeds up\n // conversion for large arrays.\n const unit = this.unit.mathjsUnit\n const ignoreOffset = unit._isDerived()\n const coefficients = this.conversion_coefficients()\n\n return mapDeep(values, (value) => {\n if (value === null || value === undefined) {\n return value\n }\n\n let result = value\n for (let i = 0; i < unit.units.length; i++) {\n const unitDef = unit.units[i]\n const unitOffset = unitDef.unit.offset\n result = (ignoreOffset || unitDef.delta)\n ? result / coefficients[i]\n : result / coefficients[i] - unitOffset\n }\n return result\n })\n }\n\n /**\n * Returns a set of conversion coefficients based on the currently set units.\n * @returns Array of conversion coefficients, one for each unit that is present.\n */\n conversion_coefficients() {\n const unit = this.unit.mathjsUnit\n const coefficients = []\n for (let i = 0; i < unit.units.length; i++) {\n const unitDef = unit.units[i]\n const unitValue = unitDef.unit.value\n const unitPrefixValue = unitDef.prefix.value\n const unitPower = unitDef.power\n coefficients.push((Math.pow(unitValue * unitPrefixValue, unitPower)))\n }\n return coefficients\n }\n\n label() {\n return this.unit.label()\n }\n\n dimension(base = false) {\n return this.unit.dimension(base)\n }\n\n to(unit) {\n return new Quantity(this.normalized_value, this.unit.to(unit), true)\n }\n\n toSI() {\n return new Quantity(this.normalized_value, this.unit.toSI(), true)\n }\n\n toSystem(system) {\n return new Quantity(this.normalized_value, this.unit.toSystem(system), true)\n }\n\n /**\n * Checks if the given Quantity is equal to this one.\n * @param {Quantity} quantity Quantity to compare to\n * @returns boolean Whether quantities are equal\n */\n equal(quantity) {\n if (quantity instanceof Quantity) {\n return this.normalized_value === quantity.normalized_value && this.unit.equalBase(quantity.unit)\n } else {\n throw Error('The given value is not an instance of Quantity.')\n }\n }\n}\n","/* eslint-disable no-unused-vars */\n/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport minimatch from 'minimatch'\nimport { cloneDeep, merge, isSet, isNil, isArray, isBoolean, isString, isNumber, isPlainObject, startCase, isEmpty, keys } from 'lodash'\nimport { Quantity } from './components/units/Quantity'\nimport { format } from 'date-fns'\nimport jmespath from 'jmespath'\nimport { dateFormat, guiBase, apiBase, searchQuantities, parserMetadata, schemaSeparator, dtypeSeparator, yamlSchemaPrefix } from './config'\nconst crypto = require('crypto')\n\nconst parserLabels = Object.keys(parserMetadata).reduce((result, key) => {\n const parser = parserMetadata[key]\n result[`parsers/${parser.codeName}`] = parser.codeLabel\n result[parser.codeName] = parser.codeLabel\n return result\n}, {})\n\nexport const isEquivalent = (a, b) => {\n // Create arrays of property names\n const aProps = Object.getOwnPropertyNames(a)\n const bProps = Object.getOwnPropertyNames(b)\n\n // If number of properties is different,\n // objects are not equivalent\n if (aProps.length !== bProps.length) {\n return false\n }\n\n for (let i = 0; i < aProps.length; i++) {\n const propName = aProps[i]\n\n // If values of same property are not equal,\n // objects are not equivalent\n if (a[propName] !== b[propName]) {\n return false\n }\n }\n\n // If we made it this far, objects\n // are considered equivalent\n return true\n}\n\nexport const capitalize = (s) => {\n if (typeof s !== 'string') {\n return ''\n }\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\n/**\n * Recursive object traversal.\n *\n * @param {*} data The data to traverse.\n * @param {bool} fullPath Whether to return the full path as a list of keys. Defaults to\n * false which means that only the last key is returned.\n * @return List of pairs of keys and values.\n */\nexport function traverseDeep(object, fullPath = false) {\n const items = []\n const traverse = (obj, path) => {\n for (const [key, value] of Object.entries(obj)) {\n const newPath = [...path]\n newPath.push(key)\n if (value && isPlainObject(value)) {\n traverse(value, newPath)\n } else {\n items.push([fullPath ? [...newPath] : key, value])\n }\n }\n }\n traverse(object, [])\n return items\n}\n\n/**\n * Used to set a value to a nested object. Will create the hierarchy on the go\n * if it is missing.\n *\n * @param {object} data The data to traverse.\n * @param {str} path Path to use\n * @param {value} path Value to store\n */\nexport function setDeep(data, path, value, separator = '.') {\n const segments = path.split(separator)\n let current = data\n for (let i = 0; i < segments.length; ++i) {\n const segment = segments[i]\n if (i === segments.length - 1) {\n current[segment] = value\n } else {\n if (isNil(current[segment])) {\n current[segment] = {}\n }\n current = current[segment]\n }\n }\n}\n\n/**\n * Map that works on n-dimensional arrays. Implemented with simple for loops for\n * performance.\n *\n * @param {*} value The original values.\n * @param {number} factor Number used for scaling.\n *\n * @return {*} A copy of the original data with numbers scaled.\n */\nexport function mapDeep(value, func) {\n // Function for recursively applying the function\n function mapRecursive(list, newList) {\n const isScalarArray = !Array.isArray(list[0])\n if (isScalarArray) {\n for (let i = 0, size = list.length; i < size; ++i) {\n newList.push(func(list[i]))\n }\n } else {\n for (let i = 0, size = list.length; i < size; ++i) {\n const iList = []\n newList.push(iList)\n mapRecursive(list[i], iList)\n }\n }\n }\n // If given a scalar variable, simply apply the function. If a list is given,\n // perform the mapping recursively.\n let newValue\n if (!isArray(value)) {\n newValue = func(value)\n } else {\n newValue = []\n mapRecursive(value, newValue)\n }\n return newValue\n}\n\n/**\n * Scales values of an n-dimensional array.\n *\n * @param {n-dimensional array} value The original values.\n * @param {number} factor Scaling factor.\n *\n * @return {n-dimensional array} A copy of the original data with numbers scaled.\n */\nexport function scale(value, factor) {\n return mapDeep(value, x => x * factor)\n}\n\n/**\n * Adds the given value to all elements of an n-dimensional array.\n *\n * @param {n-dimensional array} value The original values.\n * @param {number} addition Value to add.\n *\n * @return {n-dimensional array} A copy of the original data with the addition.\n */\nexport function add(value, addition) {\n return mapDeep(value, x => x + addition)\n}\n\n/**\n * Used to calculate the distance between two n-dimensional points,\n *\n * @param {*} a First point\n * @param {*} b Second point\n *\n * @return {*} Euclidean distance between the given two points.\n */\nexport function distance(a, b) {\n return a\n .map((x, i) => Math.abs(x - b[i]) ** 2) // square the difference\n .reduce((sum, now) => sum + now) ** // sum\n (1 / 2)\n}\n\n/**\n * Used to merge two Javascript objects into a new third object by recursively\n * overwriting and extending the target object with properties from the source\n * object.\n *\n * @param {*} target The values to convert\n * @param {*} source Original unit.\n *\n * @return {*} A copy of the original data with units converted.\n */\nexport function mergeObjects(source, target, copy = false) {\n // First create a deep clone that will be used as the returned object\n const cloned = cloneDeep(target)\n const val = merge(cloned, source)\n return val\n}\n\nexport function arraysEqual(_arr1, _arr2) {\n if (!Array.isArray(_arr1) || !Array.isArray(_arr2) || _arr1.length !== _arr2.length) {\n return false\n }\n\n const arr1 = _arr1.concat().sort()\n const arr2 = _arr2.concat().sort()\n\n for (let i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) { return false }\n }\n\n return true\n}\n\nexport function onlyUnique(value, index, self) {\n return self.indexOf(value) === index\n}\n\nexport function objectFilter(obj, predicate) {\n return Object.keys(obj)\n .filter(key => predicate(key))\n .reduce((res, key) => {\n res[key] = obj[key]\n return res\n }, {})\n}\n\nexport function titleCase(str) {\n const splitStr = str.toLowerCase().split(/[_ ]/)\n for (let i = 0; i < splitStr.length; i++) {\n // You do not need to check if i is larger than splitStr length, as your for does that for you\n // Assign it back to the array\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1)\n }\n // Directly return the joined string\n return splitStr.join(' ')\n}\n\nexport function nameList(users, expanded) {\n const names = users.map(user => titleCase(user.name)).filter(name => name !== '')\n if (names.length > 3 && !expanded) {\n return [names[0], names[names.length - 1]].join(', ') + ' et al'\n } else {\n return names.join(', ')\n }\n}\n\nexport function authorList(entry, expanded) {\n if (!entry) {\n return ''\n }\n\n if (entry.external_db) {\n if (entry.authors?.length > 1 && expanded) {\n return `${entry.external_db} (${nameList(entry.authors)})`\n }\n return entry.external_db\n } else {\n return nameList(entry.authors || [], expanded)\n }\n}\n\n/**\n * @param {*} entry metadata retrived from NOMAD api\n * @returns The name from the metadata, a fallback entry name for simulations, or null\n */\nexport function entryName(entry) {\n const results = entry?.results\n const name = entry?.entry_name\n if (name) {\n return name\n }\n const type = entryType(entry)\n if (!type) {\n return null\n }\n const formula = results?.material?.chemical_formula_hill\n if (formula) {\n return `${formula} ${type}`\n }\n return type\n}\n\n/**\n * @param {*} entry metadata retrived from NOMAD api\n * @returns The type from the metadata, a fallback entry type for simulations, or null\n */\nexport function entryType(entry) {\n const results = entry?.results\n let type = entry?.entry_type\n if (type) {\n return type\n }\n if (!(results?.method?.simulation && results?.material)) {\n const parser = entry?.parser_name\n if (!parser) {\n return null\n }\n if (parser === 'parsers/eels') {\n return 'EELS DB entry'\n }\n const program = parserLabels[parser]\n if (!program) {\n return null\n }\n return `${program} simulation`\n }\n type = ''\n let workflow = results.method.workflow_name?.[0]\n if (workflow === 'single_point') {\n workflow = null\n }\n if (workflow) {\n type += workflow + ' '\n }\n const program = results.method.simulation.program_name\n if (program) {\n type += program + ' '\n }\n if (type === '') {\n return null\n }\n type += 'simulation'\n return type\n}\n\n/**\n * Returns whether the used browser supports WebGL.\n * @return {boolean} Is WebGL supported.\n */\nlet hasWebGL\nexport function hasWebGLSupport() {\n if (isNil(hasWebGL)) {\n const w = window\n try {\n const canvas = document.createElement('canvas')\n hasWebGL = !!(w.WebGLRenderingContext && (\n canvas.getContext('webgl') ||\n canvas.getContext('experimental-webgl'))\n )\n } catch (e) {\n hasWebGL = false\n }\n }\n return hasWebGL\n}\n\n/**\n * Converts the given structure in the format used by section_results into the\n * format used by the materia-library.\n *\n * @param {object} structure.\n *\n * @return {undefined|object} If the given structure cannot be converted,\n * returns an empty object.\n */\nexport function toMateriaStructure(structure) {\n if (!structure) {\n return undefined\n }\n\n try {\n // Resolve atomic species using the labels and their mapping to chemical\n // elements.\n const speciesMap = new Map(structure.species.map(s => [s.name, s.chemical_symbols[0]]))\n\n const structMateria = {\n species: structure.species_at_sites.map(x => speciesMap.get(x)),\n cell: structure.lattice_vectors\n ? new Quantity(structure.lattice_vectors, 'meter').to('angstrom').value()\n : undefined,\n positions: new Quantity(structure.cartesian_site_positions, 'meter').to('angstrom').value(),\n fractional: false,\n pbc: structure.dimension_types ? structure.dimension_types.map((x) => !!x) : undefined\n }\n return structMateria\n } catch (error) {\n return {}\n }\n}\n\n/**\n * Given an array of numbers, calculates and returns the difference between\n * each array item and the first value in the array.\n *\n * @param {array} values Array containing values\n *\n * @return {array} Array containing the total difference values.\n */\nexport function diffTotal(values) {\n const diffValues = []\n const initial = values[0]\n for (let i = 0; i < values.length; i++) {\n diffValues.push(values[i] - initial)\n }\n return diffValues\n}\n\n/**\n * Formats the given number.\n *\n * @param {number} value Number to format\n * @param {string} type Number data type.\n * @param {number} decimals Number of decimals to use. Note\n * @param {string} mode The formatting mode to use. One of:\n * - 'scientific'\n * - 'separators'\n * - 'standard'\n *\n * @return {string} The number as a string with new formatting\n */\nexport function formatNumber(value, type = DType.Float, mode = 'scientific', decimals = 3) {\n // Nill values\n if (isNil(value)) {\n return value\n }\n // Zero\n if (value === 0) {\n return value.toString()\n }\n\n // Scientific format. parseFloat is used to get rid of trailig insignificant\n // zeros.\n if (mode === 'scientific') {\n const absValue = Math.abs(value)\n return (absValue > 1e3 || absValue < 1e-2)\n ? parseFloat(value.toExponential(decimals)).toExponential()\n : parseFloat(Number(value.toFixed(decimals))).toString()\n } else {\n // Integers in-non-scientific formats are always shown without decimals\n if (type?.startsWith('int')) {\n decimals = 0\n }\n const formatted = Number(value.toFixed(decimals))\n // Format with separators\n if (mode === 'separators') {\n return formatted.toLocaleString()\n // Standard formatting\n } else if (mode === 'standard') {\n return formatted.toString()\n // SI formatting\n } else if (mode === 'SI') {\n return approxInteger(formatted)\n } else {\n throw Error('Unknown formatting mode')\n }\n }\n}\n\n/**\n * Formats the given integer number.\n *\n * @param {number} value Integer to format\n *\n * @return {number} The number with new formatting\n */\nexport function formatInteger(value) {\n return formatNumber(value, DType.Int, 'separators', 0)\n}\n\n/**\n * Formats the given boolean value. Boolean values may not correctly serialized\n * as string by default.\n *\n * @param {number} value Boolean to format\n *\n * @return {number} The boolean with new formatting\n */\nexport function formatBoolean(value) {\n return isBoolean(value)\n ? capitalize(`${value}`)\n : ''\n}\n\n/**\n * Formats the given timestamp.\n *\n * @param {number} value The timestamp to format\n * @return {str} The timestamp with new formatting\n */\nexport function formatTimestamp(value, mode = undefined) {\n if (isNil(value)) {\n return value\n }\n\n let format\n switch (mode) {\n case 'date':\n format = {dateStyle: 'short'}\n break\n case 'time':\n format = {timeStyle: 'short'}\n break\n default:\n format = undefined\n }\n\n if (value.search(/([+-][0-9]{2}:[0-9]{2}|Z)\\b/) === -1) { // search for timezone information\n try {\n // assume UTC timestamp from server and attempt to manually add UTC timezone,\n // new Date will wrongly assume local timezone.\n const result = new Date(`${value}Z`).toLocaleString(undefined, format)\n if (result !== 'Invalid Date') {\n return result\n }\n } catch {}\n }\n // create string for timestamp with correct timezone information or fallback\n return new Date(value).toLocaleString(undefined, format)\n}\n\n/**\n * Determines the data type of the given metainfo.\n *\n * @param {object | str} def The metainfo name or definition.\n *\n * @return {DType} The data type of the metainfo.\n */\nexport const DType = {\n Int: 'int',\n Float: 'float',\n Timestamp: 'timestamp',\n String: 'string',\n Enum: 'enum',\n Boolean: 'boolean',\n Unknown: 'unknown'\n}\nconst numericTypes = new Set([DType.Int, DType.Float])\nexport const multiTypes = new Set([DType.String, DType.Enum, DType.Boolean])\nexport function getDatatype(quantity) {\n if (typeof quantity === 'string') {\n quantity = searchQuantities[quantity]\n }\n const type_data = quantity?.type?.type_data\n const type_kind = quantity?.type?.type_kind\n\n if (isString(type_data) && type_data.includes('int')) {\n return DType.Int\n } else if (isString(type_data) && type_data.includes('float')) {\n return DType.Float\n } else if (type_data === 'nomad.metainfo.metainfo._Datetime' || type_data === 'nomad.metainfo.data_type.Datetime') {\n return DType.Timestamp\n } else if (type_data === 'str') {\n return DType.String\n } else if (type_kind?.toLowerCase() === 'enum') {\n return DType.Enum\n } else if (type_data === 'bool') {\n return DType.Boolean\n } else {\n return DType.Unknown\n }\n}\n\n/**\n * Returns the unit of the given metainfo if any specified.\n *\n * @param {string} quantity The metainfo name (full path). Must exist in\n * window.nomadArtifacts.searchQuantities.\n *\n * @return {string} The unit of the metainfo or undefined if no unit definition\n * found.\n */\nexport function getUnit(quantity) {\n return searchQuantities[quantity]?.unit\n}\n\n/**\n * Returns a function that can be used to serialize values for a given datatype.\n * @param {string} dtype The datatype\n * @param {bool} pretty Whether to serialize using a prettier, but possibly\n * lossy format.\n *\n * @return {func} Function for serializing values with the given datatype.\n */\nexport function getSerializer(dtype, pretty = true) {\n if (numericTypes.has(dtype)) {\n return (value, units) => {\n if (isNil(value)) {\n return value\n }\n if (value instanceof Quantity) {\n const newVal = units ? value.toSystem(units) : value\n const label = newVal.label()\n const valueConv = newVal.value()\n return `${pretty ? formatNumber(valueConv) : valueConv}${label ? ` ${label}` : ''}`\n }\n return pretty ? formatNumber(value) : value\n }\n } else if (dtype === DType.Timestamp) {\n return (value) => {\n if (isNil(value)) {\n return value\n }\n return pretty ? format(new Date(value), dateFormat) : value\n }\n } else if (dtype === DType.Boolean) {\n return (value) => value ? 'true' : 'false'\n } else {\n return (value) => value\n }\n}\n\n/**\n *\n */\nexport function serializeMetainfo(quantity, value, units) {\n const dtype = getDatatype(quantity)\n if (dtype === DType.Int || dtype === DType.Float) {\n if (!(value instanceof Quantity) && !isNil(value)) {\n const unit = getUnit(quantity) || 'dimensionless'\n value = new Quantity(value, unit)\n }\n }\n const serializer = getSerializer(dtype)\n return serializer(value, units)\n}\n\n/**\n * Returns a function that can be used to deserialize values for a given datatype.\n * @param {string} dtype The datatype\n * @param {string} dimension Optional dimension for the filter. Used to\n * determine default unit when a dimensionless value is given.\n *\n * @return {func} Function for deserializing values with the given datatype.\n */\nexport function getDeserializer(dtype, dimension) {\n if (numericTypes.has(dtype)) {\n return (value, units) => {\n if (isNil(value)) {\n return value\n }\n if (isString(value)) {\n const split = value.split(' ')\n value = Number(split[0])\n if (isNaN(value)) {\n throw Error(`Could not parse the number ${split[0]}`)\n }\n return split.length === 1\n ? new Quantity(value, units?.[dimension]?.definition || 'dimensionless')\n : new Quantity(value, split[1])\n } if (isNumber(value)) {\n return new Quantity(value, units?.[dimension]?.definition || 'dimensionless')\n }\n return value\n }\n } else if (dtype === DType.Timestamp) {\n return (value) => {\n if (isNil(value)) {\n return value\n }\n return parseInt(value)\n }\n } else if (dtype === DType.Boolean) {\n return (value) => {\n if (isNil(value)) {\n return value\n }\n let newValue = value\n if (isString(value)) {\n const lowercase = value.toLowerCase()\n const keywords = {\n true: true,\n false: false\n }\n newValue = keywords[lowercase]\n if (isNil(newValue)) {\n throw Error(`Could not parse boolean value from ${value}`)\n }\n }\n return newValue\n }\n } else {\n return (value) => {\n const keywords = {\n true: true,\n false: false\n }\n if (value in keywords) {\n return keywords[value]\n }\n return value\n }\n }\n}\n\n/**\n * Converts a set into an array. The array will be in the insertion order of the\n * set.\n *\n * @param {Set} target Set to be converted.\n *\n * @return {number} Array containing the total difference values.\n */\nexport function setToArray(target) {\n if (target !== undefined && isSet(target)) {\n return [...target]\n }\n return target\n}\n\n/**\n * A simple promise based sleep.\n * @param {} ms Time in ms.\n * @returns The promise. Use .then(() => ...) to do something after sleep.\n */\nexport function sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms))\n}\n\n/**\n * Converts a number into an approximated format with SI suffixes. The number is\n * guaranteed to be no longer than five characters, including the possible SI\n * suffix.\n *\n * @param {number} number Number to approximate\n *\n * @return {string} The number in approximated format.\n */\nexport function approxInteger(number) {\n // Determine the number of digits and the tier of the number\n const temp = Math.log10(Math.abs(number))\n const tier = temp / 3 | 0\n\n // What tier? (determines SI symbol)\n const SISymbol = ['', 'k', 'M', 'G', 'T', 'P', 'E']\n\n // If zero, we don't need a suffix\n if (tier === 0) return number.toFixed(0)\n\n // Get suffix and determine scale\n const suffix = SISymbol[tier]\n const scale = Math.pow(10, tier * 3)\n\n // Scale the number and count the number of decimals\n const scaled = number / scale\n let nUsed, nDecimals\n const split = scaled.toString().split('.')\n if (split.length > 1) {\n nUsed = split[0].length\n nDecimals = split[1].length\n } else {\n nUsed = split[0].length\n nDecimals = 0\n }\n\n // Format number and add suffix\n return scaled.toFixed(Math.min(3 - nUsed, nDecimals)) + suffix\n}\n\n/**\n * Forces the given function to be placed in the Javascript event queue and\n * executed once the queue is free. Returns a promise that also correctly\n * catches errors within the execution.\n *\n * @param {func} func Function to delay\n */\nexport function delay(func) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n try {\n func()\n resolve()\n } catch (e) {\n reject(e)\n }\n })\n })\n}\n\n/**\n * Returns the correct form (plural/singular) for the given word. The syntax is\n * similar to the \"pluralize\"-library.\n *\n * @param {string} word The word to pluralize\n * @param {count} number How many of the words exist\n * @param {boolean} inclusive Whether to prefix with the number (e.g. 3 ducks)\n * @param {boolean} format Whether to format the number.\n * @param {string} prefix An optional prefix that is placed between the number\n * and the word.\n */\nexport function pluralize(word, count, inclusive, format = true, prefix) {\n // Dictionary of known words. If it becomes too bothersome to keep track of\n // these words, the pluralize-library should be used instead.\n const dictionary = {\n 'result': 'results',\n 'entry': 'entries',\n 'value': 'values',\n 'material': 'materials',\n 'dataset': 'datasets',\n 'item': 'items',\n 'upload': 'uploads',\n 'code': 'codes',\n 'manager': 'managers',\n 'filter': 'filters',\n 'mainfile': 'mainfiles',\n 'folder': 'folders',\n 'has': 'have',\n 'activity': 'activities',\n 'parser': 'parsers',\n 'normalizer': 'normalizers',\n 'app': 'apps',\n 'package': 'packages'\n }\n const words = word.trim().split(\" \")\n let lastWord = words[words.length - 1]\n const isPossessive = lastWord.endsWith(\"'s\")\n if (isPossessive) {\n lastWord = lastWord.slice(0, -2)\n }\n let plural = dictionary[lastWord]\n if (isNil(plural)) {\n throw Error(`The word ${word} is not in the dictionary, please add it.`)\n }\n if (isPossessive) {\n plural = plural.endsWith(\"s\") ? `${plural}'` : `${plural}'s`\n }\n words[words.length - 1] = plural\n plural = words.join(\" \")\n const form = count === 1\n ? word\n : plural\n\n const number = inclusive\n ? format ? formatNumber(count, DType.Int, 'separators', 0) : count\n : undefined\n return `${isNil(number)\n ? ''\n : `${number} `}${isNil(prefix)\n ? ''\n : `${prefix} `}${form}`\n}\n\n/**\n * Used to create a formatted label for a metainfo name or value. Replaces\n * underscores with whitespace and capitalizes the first letters.\n *\n * @param {str} name Metainfo name\n * @returns A formatted label constructed from the metainfo name.\n */\nexport function formatLabel(label) {\n label = label.replace(/_/g, ' ')\n label = startCase(label)\n return label\n}\n\n/**\n * Used for testing purposes: setting a data-testid to this value signals that the\n * component waits for further updates of some kind. This is used by some automated tests\n * to determine if a component is *really* done rendering (when we don't really care what\n * we are waiting for, and just want a way to determine when we're done). When done,\n * the data-testid should be removed or updated to something else.\n */\nexport const isWaitingForUpdateTestId = 'waiting-for-update'\n\n/**\n * Removes indentation from the given multiline code string\n * @param {*} code\n */\nexport function stripIndent(code) {\n let lines = code.split('\\n')\n const start = lines.findIndex(line => line.trim() !== '')\n lines = lines.slice(start)\n if (lines.length === 0) {\n return ''\n }\n const indent = lines[0].length - lines[0].trimStart().length\n return lines.map(line => line.substring(indent)).join('\\n')\n}\n\n/**\n * Used to imperatively get a path that works for react-router and points to the\n * currently displayed page. The useLocation hook should be preferred, but\n * sometimes getting the path imperatively can prevent unnecessary renders.\n *\n * @returns A formatted label constructed from the metainfo name.\n */\nexport function getLocation() {\n return `${window.location.pathname.slice(guiBase.length)}`\n}\n\n/**\n * Calculates the entryId given the uploadId, the mainfile, and, optionally, the mainfileKey.\n */\n export function generateEntryId(uploadId, mainfile, mainfileKey) {\n const hash = crypto.createHash('sha512').update(uploadId).update(mainfile)\n if (mainfileKey) {\n hash.update(mainfileKey)\n }\n return hash.digest('base64').slice(0, 28)\n .replace(/\\+/g, '-') // Convert '+' to '-'\n .replace(/\\//g, '_') // Convert '/' to '_'\n}\n\n/**\n * Utilities parse and analyze *nomad urls*. A nomad url identifies some *base resource*,\n * which can be:\n * 1) a nomad deployment,\n * 2) an upload,\n * 3) an archive, or\n * 4) a metainfo schema.\n *\n * A *metainfo schema* is a json data structure, which is either\n * A) the system metainfo, generated from the python classes,\n * B) provided in an entry uploaded by a user, or\n * C) a *frozen* metainfo schema.\n * A frozen metainfo schema is a historical \"snapshot\" of a metainfo schema provided using\n * method A or B. The only difference between the frozen version and the original version is that\n * in the frozen version, references to other metainfo schemas are replaced with references to\n * frozen versions of these schemas. The purpose of this is to allow us to handle changing\n * metainfo schemas.\n *\n * In addition to specifying the base resource, a nomad url can specify a location *within*\n * this resource (identifying a raw file or folder in an upload, a location in an archive, or\n * a section in a metainfo schema). For urls identifying sections in a metainfo schema,\n * it is generally also possible to specify a versionHash, which uniquely identifies a frozen\n * version of this section definition.\n *\n * Nomad urls can be absolute or relative. Absolute urls contain all information needed to\n * locate the resource, including the nomad deployment url. Relative urls can only be resolved\n * when given a *base url*, which defines our \"point of origin\".\n *\n * Possible formats (expressions in [brackets] are optional):\n * ----------------------------------------------------------\n * Absolute urls:\n * \n * /uploads/ [ /raw/ [ # [ @ ] ] ]\n * /uploads//archive/ [ # [ @ ] ]\n * /uploads//archive/mainfile/ [ # [ @ ] ]\n * Urls relative to the current deployment:\n * ../uploads/ [ /raw/ [ # [ @ ] ] ]\n * ../uploads//archive/ [ # [ @ ] ]\n * ../uploads//archive/mainfile/ [ # [ @ ] ]\n * (TODO: how to handle versions, deploymentUrl etc)\n * Urls relative to the current upload:\n * ../upload [ /raw/ [ # [ @ ] ] ]\n * ../upload/archive/ [ # [ @ ] ]\n * ../upload/archive/mainfile/ [ # [ @ ] ]\n * Urls relative to the current data (i.e. current archive or metainfo schema json):\n * # (preferred)\n * /\n * Note:\n * - An is a normal url, starting with \"http://\" or \"https://\", locating\n * the api of the nomad deployment. Should always end with \"/api\".\n * Example:\n * https://nomad-lab.eu/prod/rae/api\n * - Urls with versionHash are considered to be relative to the deployment rather than the\n * upload or data.\n * - The rawPath and mainFile paths need to be escaped with urlEncodePath to ensure a valid url.\n * (i.e. each segment needs to individually be escaped using encodeURIComponent)\n * - The dataPath, if provided, must always start from the root of the archive.\n * Leading and duplicate slashes are ignored.\n * - If the first segment in dataPath is 'definitions' or 'packages', the url is recognized\n * as a reference to a metainfo schema.\n * - Metainfo sections defined in python can be referred using the qualifiedName, which\n * is a \"python style\" name of alphanumerics separated by dots.\n * - If no versionHash is specified for a url identifying a metainfo schema, it means\n * we refer to the version defined by the base url (if the url is schema-relative), otherwise\n * the latest version (in the nomad deployment in question).\n */\n\nexport const systemMetainfoUrl = `system-metainfo` // TODO: should use absolute url with hash when implemented\n\n/**\n * Enum for the `type` attribute of parsed/resolved url objects\n */\nexport const refType = Object.freeze({\n deployment: 'deployment',\n upload: 'upload',\n archive: 'archive',\n metainfo: 'metainfo'\n})\n\n/**\n * Enum for the `relativeTo` attribute of parsed/resolved url objects\n */\nexport const refRelativeTo = Object.freeze({\n deployment: 'deployment',\n upload: 'upload',\n data: 'data',\n nothing: null\n})\n\n/**\n * Parses a nomad url and returns an object with the following attributes:\n * url\n * the original url string.\n * type\n * One of: refType.deployment | refType.upload | refType.archive | refType.metainfo\n * relativeTo\n * One of: refRelativeTo.deployment | refRelativeTo.upload | refRelativeTo.data | refRelativeTo.nothing (null)\n * deploymentUrl\n * The nomad deployment url, if it can be determined.\n * uploadId\n * The uploadId, if it can be determined.\n * entryId\n * The entryId, if it can be determined.\n * mainfile\n * The mainfile path, if it can be determined (unescaped!).\n * path\n * The path within the base resource (dataPath | rawPath (unescaped!)), if specified.\n * If it is a dataPath, it will have a leading slash.\n * qualifiedName\n * The qualifiedName, if specified.\n * versionHash\n * The versionHash, if specified.\n * isResolved\n * True if the url is fully resolved, i.e. we have everything we need to fetch the data.\n * isExternal\n * If the url refers to a resource in an external nomad deployment. Note, for relative\n * urls the value will be undefined, which means we don't know.\n *\n * If the url cannot be parsed, an error is thrown.\n *\n * @param {*} url either a string, or an object. If an object, it is expected to be parsed already,\n * and we will return the object \"as is\" directly, without any parsing.\n */\nexport function parseNomadUrl(url) {\n if (isPlainObject(url) && url.url && url.type) return url // already parsed, pass through.\n const prefix = `Could not parse nomad url \"${url}\": `\n if (!url) throw new Error(prefix + 'empty value')\n if (typeof url !== 'string') throw new Error(prefix + 'bad type, expected string, got ' + typeof url)\n\n if (url === systemMetainfoUrl) {\n // TODO proper handling, using a url containing deploymentUrl + versionHash somehow?\n return {\n url,\n relativeTo: refRelativeTo.deployment,\n type: refType.metainfo,\n deploymentUrl: apiBase,\n isResolved: true,\n isExternal: false\n }\n }\n\n let relativeTo, type, deploymentUrl, uploadId, entryId, mainfile, path, qualifiedName, versionHash\n let dataPath, rest, rawPath\n if (url.startsWith('/')) {\n dataPath = url\n rest = ''\n } else {\n const bracketPos = url.indexOf('#')\n dataPath = bracketPos !== -1 ? url.slice(bracketPos + 1) : undefined\n rest = bracketPos !== -1 ? url.slice(0, bracketPos) : url\n }\n\n if (rest.startsWith('http://') || rest.startsWith('https://')) {\n // Url includes deploymentUrl\n let apiPos = rest.indexOf('/api/')\n if (apiPos === -1 && rest.endsWith('/api')) apiPos = rest.length - 4\n if (apiPos === -1) throw new Error(prefix + 'absolute nomad deployment url does not contain \"/api\"')\n deploymentUrl = url.slice(0, apiPos + 4)\n rest = rest.slice(apiPos + 5)\n if (rest && !rest.startsWith('uploads/')) throw new Error(prefix + 'expected \"/uploads/\" in absolute url')\n relativeTo = null\n } else if (url.startsWith('../')) {\n rest = rest.slice(3)\n } else if (url.startsWith('#') || url.startsWith('/')) {\n relativeTo = refRelativeTo.data\n } else if (url.match(/^([a-zA-Z]\\w*\\.)*[a-zA-Z]\\w*$/)) {\n qualifiedName = url\n relativeTo = refRelativeTo.deployment\n } else if (url.startsWith(yamlSchemaPrefix)) {\n [entryId, qualifiedName] = split(url.slice(yamlSchemaPrefix.length), '.', 1)\n relativeTo = refRelativeTo.deployment\n } else {\n throw new Error(prefix + 'bad url')\n }\n const restParts = rest.split('/')\n if ((deploymentUrl && rest) || url.startsWith('../')) {\n // Expect upload ref\n if (restParts[0] === 'uploads') {\n // Ref with upload id\n if (!deploymentUrl) {\n relativeTo = refRelativeTo.deployment\n }\n if (restParts.length === 1) throw new Error(prefix + 'expected \"/uploads/\" in url')\n uploadId = restParts[1]\n restParts.splice(0, 2)\n } else if (restParts[0] === 'upload') {\n // Relative ref\n relativeTo = refRelativeTo.upload\n restParts.splice(0, 1)\n } else {\n throw new Error(prefix + 'expected \"/upload\" or \"/uploads\" in url')\n }\n if (restParts.length) {\n // There is more. Expect \"raw\" or \"archive\"\n if (restParts[0] === 'raw') {\n rawPath = restParts.slice(1).map(decodeURIComponent).join('/')\n } else if (restParts[0] === 'archive') {\n if (restParts.length === 1) throw new Error(prefix + '\"archive\" must be followed by entry id or \"mainfile\"')\n if (restParts[1] === 'mainfile') {\n if (restParts.length === 2) throw new Error(prefix + '\"mainfile\" must be followed by a mainfile path')\n mainfile = restParts.slice(2).map(decodeURIComponent).join('/')\n } else {\n if (restParts.length !== 2) throw new Error(prefix + 'unexpected path element after entry id')\n entryId = restParts[1]\n }\n } else {\n throw new Error(prefix + 'expected \"raw\" or \"archive\" after upload ref')\n }\n }\n }\n if (qualifiedName && !entryId) {\n // Refers to the global schema\n type = refType.metainfo\n } else if (deploymentUrl && !uploadId) {\n // Pure deployment url\n type = refType.deployment\n } else if (dataPath !== undefined) {\n // Has dataPath\n if (!url.startsWith('#') && !url.startsWith('/') && !entryId && !mainfile && !rawPath) throw new Error(prefix + 'Unexpected dataPath without entry reference')\n mainfile = mainfile || rawPath\n const atPos = dataPath.indexOf('@')\n if (atPos !== -1) {\n versionHash = dataPath.slice(atPos + 1)\n dataPath = dataPath.slice(0, atPos)\n }\n const dataPathSegments = dataPath.split('/').filter(segment => segment)\n const firstDataPathSegment = dataPathSegments[0]\n type = (firstDataPathSegment === 'definitions' || firstDataPathSegment === 'packages') ? refType.metainfo : refType.archive\n dataPath = '/' + dataPathSegments.join('/') // Ensure leading slash, but no duplicate slashes\n path = dataPath\n } else if (entryId || mainfile) {\n // Refers to an archive, but has no dataPath\n type = refType.archive\n } else {\n // Refers to an upload\n type = refType.upload\n path = rawPath\n }\n if (versionHash !== undefined) {\n if (type !== refType.metainfo) throw new Error(prefix + 'versionHash can only be specified for metainfo urls.')\n if (!versionHash.match(/\\w+/)) throw new Error(prefix + 'bad versionHash provided')\n if (relativeTo) {\n relativeTo = refRelativeTo.deployment\n }\n }\n\n if (uploadId && mainfile) {\n entryId = generateEntryId(uploadId, mainfile)\n }\n\n return {\n url,\n relativeTo,\n type,\n deploymentUrl,\n uploadId,\n entryId,\n mainfile,\n path,\n qualifiedName,\n versionHash,\n isResolved: !relativeTo,\n isExternal: deploymentUrl ? (deploymentUrl !== apiBase) : undefined,\n toString: () => { return url + ' (parsed)' }\n }\n}\n\n/**\n * Resolves the url with respect to the given baseUrl. Each of the two url arguments can\n * be either a string or a parsed/resolved nomad url object (i.e. an object returned by calling\n * parseNomadUrl or resolveNomadUrl). If the url is absolute, no baseUrl is required and the argument\n * is ignored. If url is relative, however, baseUrl is required, and it needs to be either a string\n * which is an absolute url, or a resolved nomad url object.\n *\n * If succesful, returns an resolved nomad url object, which is similar to the one returned\n * by parseNomadUrl, but\n * 1) It additionally has the attribute baseUrl, which stores the baseUrl argument,\n * 2) the isResolved flag should be guaranteed to be true, and\n * 3) all applicable attributes (like deploymentUrl, uploadId, entryId, etc) are set\n * to the resolved valules.\n *\n * NOTE, if you pass an object as the url argument, and it is not already resolved, the\n * original object will be modified by this call, and the modified version is also the\n * object that will be returned by the function.\n */\nexport function resolveNomadUrl(url, baseUrl) {\n const parsedUrl = parseNomadUrl(url)\n if (parsedUrl.isResolved) return parsedUrl\n parsedUrl.baseUrl = baseUrl\n const prefix = `Could not normalize url \"${parsedUrl.url}\" with baseUrl \"${baseUrl?.url || baseUrl}\": `\n\n if (parsedUrl.relativeTo) {\n // Url is relative.\n if (!baseUrl) throw new Error(prefix + 'a baseUrl is required.')\n const parsedBaseUrl = parseNomadUrl(baseUrl)\n if (!parsedBaseUrl.isResolved) throw new Error(prefix + 'unresolved baseUrl')\n // Copy data from parsedBaseUrl\n parsedUrl.deploymentUrl = parsedBaseUrl.deploymentUrl // Should always be copied\n if (parsedUrl.relativeTo === refRelativeTo.upload) {\n if (!parsedBaseUrl.uploadId) throw new Error(prefix + 'missing information about uploadId')\n parsedUrl.uploadId = parsedBaseUrl.uploadId\n if (parsedUrl.mainfile) {\n parsedUrl.entryId = generateEntryId(parsedUrl.uploadId, parsedUrl.mainfile)\n }\n } else if (parsedUrl.relativeTo === refRelativeTo.data) {\n if (!parsedBaseUrl.entryId || !parsedBaseUrl.uploadId) throw new Error(prefix + 'missing information about entryId')\n parsedUrl.uploadId = parsedBaseUrl.uploadId\n parsedUrl.entryId = parsedBaseUrl.entryId\n }\n }\n\n parsedUrl.isExternal = !!parsedUrl.deploymentUrl && parsedUrl.deploymentUrl !== apiBase\n parsedUrl.isResolved = true\n return parsedUrl\n}\n\n/**\n * Works like resolveNomadUrl, but does not throw errors in case of failure. Instead:\n * 1) If url is empty, we return null\n * 2) If the url is non-empty and unresolvable, we return an *resolve failed object*, which\n * is an object containing {url, baseUrl, error}\n */\nexport function resolveNomadUrlNoThrow(url, baseUrl) {\n if (!url) return null\n try {\n return resolveNomadUrl(url, baseUrl)\n } catch (error) {\n return {url, baseUrl, error}\n }\n}\n\n/**\n * Relativizes a url with respect to the provided deploymentUrl, uploadId, entryId, and\n * returns the shortest possible relative url, as a string.\n * This method thus basically does the *opposite* of resolveNomadUrl. You can specify either none,\n * the first, the two first, or all three arguments of the (deploymentUrl, uploadId, entryId)\n * tuple. The url provided must be absolute.\n */\nexport function relativizeNomadUrl(url, deploymentUrl, uploadId, entryId) {\n const parsedUrl = parseNomadUrl(url)\n if (!parsedUrl.isResolved) {\n throw new Error(`Absolute url required, got ${url}.`)\n }\n if (!parsedUrl.uploadId) {\n throw new Error(`Expected url to specify an upload, got ${url}`)\n }\n if (parsedUrl.deploymentUrl !== deploymentUrl) {\n // Nothing to relativize\n return normalizeNomadUrl(parsedUrl)\n }\n if (parsedUrl.entryId === entryId) {\n // Same deployment and entry\n return '#' + (parsedUrl.path || '/')\n }\n // Same deployment, possibly also same upload\n let rv = parsedUrl.uploadId === uploadId ? '../upload' : `../uploads/${parsedUrl.uploadId}`\n if (parsedUrl.type === refType.archive || parsedUrl.type === refType.metainfo) {\n rv = `${rv}/archive/${parsedUrl.entryId}`\n if (parsedUrl.path) {\n rv = `${rv}#${parsedUrl.path}`\n }\n } else if (parsedUrl.type === refType.upload) {\n if (parsedUrl.path) {\n rv = `${rv}/raw/${parsedUrl.path}`\n }\n }\n return rv\n}\n\n/**\n * Returns a url string which is \"normalized\", i.e. it is absolute and have the preferred\n * url form for referencing the resource/data. Normalized urls always prefer identifying\n * entries with entryId rather than by specifying a mainfile.\n * @param {*} url A string or resolved nomad url object.\n */\nexport function normalizeNomadUrl(url) {\n const parsedUrl = parseNomadUrl(url)\n if (!parsedUrl.isResolved) throw new Error(`Failed to normalize url ${url.url}: provided url is unresolved`)\n if (parsedUrl.type === refType.deployment) {\n return parsedUrl.deploymentUrl\n } else if (parsedUrl.type === refType.upload) {\n return `${parsedUrl.deploymentUrl}/uploads/${parsedUrl.uploadId}` + (parsedUrl.path ? '/raw/' + parsedUrl.path : '')\n } else if (parsedUrl.entryId) {\n return `${parsedUrl.deploymentUrl}/uploads/${parsedUrl.uploadId}/archive/${parsedUrl.entryId}` + (\n parsedUrl.path ? '#' + parsedUrl.path + (parsedUrl.versionHash ? '@' + parsedUrl.versionHash : '') : '')\n } else if (parsedUrl.qualifiedName) {\n return parsedUrl.qualifiedName\n }\n throw new Error(`Failed to normalize url ${url.url}: unhandled url format`) // Should not happen\n}\n\n/**\n * Utility for creating an absolute upload url, given deploymentUrl, uploadId and an UNESCAPED rawPath\n */\nexport function createUploadUrl(deploymentUrl, uploadId, rawPathUnescaped, index) {\n if (isNaN(index)) {\n const rawPathEscaped = urlEncodePath(rawPathUnescaped || '')\n return `${deploymentUrl}/uploads/${uploadId}/raw/${rawPathEscaped}`\n } else {\n if (rawPathUnescaped[index] !== null) {\n const rawPathEscaped = urlEncodePath(rawPathUnescaped[index] || '')\n return `${deploymentUrl}/uploads/${uploadId}/raw/${rawPathEscaped}`\n } else {\n return `${deploymentUrl}/uploads/${uploadId}/raw`\n }\n }\n}\n\n/**\n * Utility for creating an absolute entry url, given deploymentUrl, uploadId, entryId, and dataPath\n */\nexport function createEntryUrl(deploymentUrl, uploadId, entryId, dataPath) {\n let rv = `${deploymentUrl}/uploads/${uploadId}/archive/${entryId}`\n if (dataPath) {\n rv += '#' + (!dataPath.startsWith('/') ? '/' : '') + dataPath\n }\n return rv\n}\n\n/**\n * Given parsedUrl, which should be a resolved, parsed url, specifying an entry and some dataPath\n * within this entry (the path may be empty), append the dataPathSuffix, and return the resulting\n * url as a string. If the dataPath of parsedUrl is empty, it will be interpreted to mean the archive\n * root element. The dataPathSuffix should not start with a '/'.\n */\nexport function appendDataUrl(parsedUrl, dataPathSuffix) {\n if (!parsedUrl.isResolved) throw new Error(`appendDataUrl: a resolved url required, got ${parsedUrl}`)\n if (parsedUrl.type !== refType.archive) throw new Error(`appendDataUrl: an archive url required, got ${parsedUrl}`)\n return urlJoin(\n `${parsedUrl.deploymentUrl}/uploads/${parsedUrl.uploadId}/archive/${parsedUrl.entryId}#${parsedUrl.path || '/'}`,\n dataPathSuffix)\n}\n\n/**\n * A simple method for joining url components. The componenst should be strings, and the return\n * value is also a string. A '/' is inserted between all components, if needed (i.e. if the preceding\n * component does not end with a '/').\n *\n * Note that the standard join method defined in the path library does not quite work like\n * this, it reduces all occurances of '//' to '/' in the returned value, and we don't want this\n * for urls (we want to keep the double slash in expressions like 'http://' etc).\n */\nexport function urlJoin(...components) {\n let rv = ''\n for (const component of components) {\n if (component) {\n if (rv && !rv.endsWith('/')) {\n rv += '/'\n }\n rv += component\n }\n }\n return rv\n}\n\n/**\n * Encodes a file system path (which may include various characters not allowed in urls, or that\n * have special meanings in urls, like ' ' and '#' and '?') into a path that is url safe.\n */\nexport function urlEncodePath(path) {\n return path.split('/').map(encodeURIComponent).join('/')\n}\n\n/**\n * Decodes a url encoded file system path (the inverse of urlEncodePath)\n */\nexport function urlDecodePath(urlPath) {\n return urlPath.split('/').map(decodeURIComponent).join('/')\n}\n\n/**\n * Given an internal url and a data object, gets the value at the corresponding location (path)\n * in this data object. The data object should be an archive or a metainfo data object. The\n * url parameter can be a single url or an array of urls. If it is an array of urls, the method\n * will return an array of values instead of a single value. The url argument can be empty,\n * in which case null will be returned. Otherwise, the url(s) MUST be internal (i.e. data-relative,\n * starting with a '#' or a '/'), and they can be either strings or parsed nomad url objects.\n */\nexport function resolveInternalRef(url, data, throwOnError = true) {\n if (!url) return null\n if (Array.isArray(url)) {\n return url.map(ref => resolveInternalRefSingle(ref, data, throwOnError))\n }\n return resolveInternalRefSingle(url, data, throwOnError)\n}\n\nfunction resolveInternalRefSingle(url, data) {\n let path\n if (url.relativeTo === refRelativeTo.data) {\n // We have a parsed url obj\n path = url.path\n } else {\n // Should be a string object\n if (typeof url !== 'string' || (!url.startsWith('#') && !url.startsWith('/'))) throw new Error(`Expected internal ref, got ${url}`)\n path = url.slice(1)\n }\n const segments = path.split('/').filter(segment => segment !== '')\n let current = data\n for (const segment of segments) {\n if (!current) throw new Error(`Path does not exist: ${path}`)\n if (isNaN(segment)) {\n current = current[segment] || current._properties?.[segment] || current.sub_section?._properties?.[segment]\n } else {\n if (current.repeats && current.m_def) {\n } else {\n let index = parseInt(segment)\n if (index < 0) index = current.length + index\n current = current[index]\n }\n }\n }\n return current\n}\n\n/**\n * Defines an alphabet in capital letters\n */\nexport const alphabet = [\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',\n 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'\n]\n\n/**\n * Function for creating suggestions functionality for a list of string values.\n * Mimics the suggestion logic used by the suggestions API endpoint.\n *\n * @param {array} values Array of available values\n * @param {number} minLength Minimum input length before suggestions are considered.\n * @param {func} text Function that maps the value into the suggested text input\n *\n * @return {object} Object containing a list of options and a function for\n * filtering them based on the input.\n */\nexport function getSuggestions(values, minLength = 2, get = (x) => x) {\n const normalizer = (input) => {\n return input\n .replace(/[_.]/g, ' ') // Ignore dots and underscores\n .replace(/[ ]/g, '') // Ignore whitespacing\n .toLowerCase() // Ignore case\n }\n\n const options = values\n .map(item => {\n const value = get(item)\n return {\n value: value,\n normalized: normalizer(value),\n original: item\n }\n })\n const filter = (input) => {\n // Minimum input length\n if (input.length < minLength) {\n return []\n }\n // Gather all matches\n const inputNormalized = normalizer(input)\n let suggestions = options.filter(option => option.normalized.includes(inputNormalized))\n\n // Sort matches based on value length (the more the input covers from the\n // value, the better the match)\n suggestions = suggestions.sort((a, b) => a.value.length - b.value.length)\n return suggestions.map(suggestion => suggestion.original)\n }\n\n return {options, filter}\n}\n\n/**\n * Removes the given prefix from the string if it is present.\n *\n * @param {str} string String to remove prefix from\n * @param {str} prefix Prefix to remove\n */\nexport function removePrefix(string, prefix) {\n if (string.startsWith(prefix)) {\n string = string.substring(prefix.length)\n }\n return string\n}\n\n/**\n * Used to download a file using the native browser mechanism. You can either\n * provide an URL or the raw data as content.\n */\nexport function download(filename, content) {\n const link = document.createElement('a')\n link.style.display = \"none\"\n document.body.appendChild(link)\n const remoteData = isString(content)\n const url = remoteData\n ? content\n : window.URL.createObjectURL(content)\n link.href = url\n link.download = filename\n link.click()\n document.body.removeChild(link)\n !remoteData &&\n setTimeout(() => {\n window.URL.revokeObjectURL(url)\n }, 0)\n}\n\n/**\n * Mimics the Python split function.\n */\nexport function split(value, sep, maxsplit) {\n const split = value.split(sep)\n return maxsplit\n ? split.slice(0, maxsplit).concat(split.slice(maxsplit).join(sep))\n : split\n}\n\n/**\n * Mimics the Python rsplit function.\n */\nexport function rsplit(value, sep, maxsplit) {\n const split = value.split(sep)\n return maxsplit\n ? [split.slice(0, -maxsplit).join(sep)].concat(split.slice(-maxsplit))\n : split\n}\n\n/**\n * Used to abbreviate a schema name.\n */\nexport function getSchemaAbbreviation(schema) {\n if (!schema) return schema\n return schema.startsWith('../')\n ? schema\n : rsplit(schema, '.', 1).pop()\n}\n\n/**\n * Used to split a quantity name into path, schema and dtype.\n */\nexport function parseQuantityName(fullName) {\n if (!fullName) return {}\n const parts = split(fullName, schemaSeparator, 1)\n const [path, schema] = parts.length === 2\n ? parts\n : [fullName, undefined]\n const dtypeParts = split(schema, dtypeSeparator, 1)\n const [schemaNew, dtype] = parts.length === 2\n ? dtypeParts\n : [schema, undefined]\n return {path, schema: schemaNew, dtype}\n}\n\n/**\n * Used to parse a possible query operator from a quantity name.\n */\nexport function parseOperator(fullName) {\n const operators = new Set(['any', 'all', 'none'])\n const parts = rsplit(fullName, ':', 1)\n let [quantity, op] = parts.length === 2\n ? parts\n : [fullName, undefined]\n if (!operators.has(op)) {\n quantity = fullName\n op = undefined\n }\n return {quantity, op}\n}\n\n/**\n * Used to determine the final set of available option names from an object that\n * adheres to the include/exclude/options pattern.\n */\nexport function getOptions(config, options) {\n const include = config?.include || (options || (config?.options ? Object.keys(config.options) : []))\n const exclude = config?.exclude || []\n return include.filter((key) => !exclude?.includes(key))\n}\n\n/**\n * Returns a filtered object of options based on the config object that adheres\n * to the include/exclude/options pattern.\n */\nexport function filterOptions(config) {\n const options = {}\n for (const option of getOptions(config)) {\n options[option] = config.options[option]\n }\n return options\n}\n\n/**\n * Returns whether the given path should be accepted based on include and\n * exclude glob patterns.\n */\nexport function glob(path, include, exclude) {\n let match = false\n if (!isEmpty(include)) {\n for (const pattern of include) {\n if (minimatch(path, pattern)) {\n match = true\n break\n }\n }\n }\n if (!isEmpty(exclude)) {\n for (const pattern of exclude) {\n if (minimatch(path, pattern)) {\n match = false\n break\n }\n }\n }\n return match\n}\n\n/**\n * Used to validate JMESPath.\n * @param {str} input\n * @returns\n */\nexport function validateJMESPath(input) {\n return jmespath.compile(input)\n}\n\n/**\n * Used to parse a JMESPath input.\n * @param {str} input\n * @returns\n */\nexport function parseJMESPath(input) {\n // Remove possible schema+dtype specification\n const regexp = /#[a-zA-Z0-9_.#]+/g\n const match = regexp.exec(input)\n let schema = ''\n let path = input\n if (match) {\n schema = match[0]\n path = input.slice(0, match.index) + input.slice(match.index + schema.length)\n }\n\n // Try to compile JMESPath call, report error\n let error\n let ast\n try {\n ast = validateJMESPath(path)\n } catch (e) {\n return {quantity: undefined, path: undefined, extras: undefined, error: e.message, schema: ''}\n }\n\n // Walk down depth-first the AST to extract the targeted quantity\n function recurseAST(node) {\n const type = node?.type\n const name = node?.name\n const children = node?.children\n let field = []\n let extras = []\n\n if (children) {\n const childFields = []\n const childExtras = []\n for (const child of children) {\n const [fieldInner, extrasInner] = recurseAST(child)\n childFields.push(fieldInner)\n childExtras.push(extrasInner)\n }\n // In filter projections we save the filter field in extras\n if (type === 'FilterProjection') {\n for (const childField of childFields.slice(0, 2)) {\n field = [...field, ...childField]\n }\n extras = [...extras, [...childFields[0], ...childFields[2]]]\n // In *_by we save the referenced variable in extras\n } else if (type === 'Function' && name === 'min_by') {\n field = [...field, ...childFields[0]]\n extras = [...extras, [...childFields[0], ...childFields[1]]]\n // For other types we simply extend definitions and extras in the order\n // they are defined in\n } else {\n for (const childField of childFields) {\n field = [...field, ...childField]\n }\n for (const childExtra of childExtras) {\n extras = [...extras, ...childExtra]\n }\n }\n } else {\n if (type === 'Field') {\n return [[name], extras]\n }\n }\n return [field, extras]\n }\n\n const [field, extrasList] = recurseAST(ast)\n const quantity = field.join('.') + schema\n const extras = extrasList.map(x => x.join('.') + schema)\n\n return {quantity, extras, path, schema, error}\n}\n\n/**\n * Cleans the given object/array recursively from undefined values and empty\n * objects.\n * @param {*} obj The input list or object to clean.\n */\nexport function cleanse(obj) {\n // Clean array\n if (isArray(obj)) {\n for (const item of obj) {\n cleanse(item)\n }\n // Clean object\n } else {\n for (const key of keys(obj)) {\n // Get this value and its type\n const value = obj[key]\n const type = typeof value\n if (isPlainObject(value)) {\n cleanse(value)\n if (isEmpty(value)) {\n delete obj[key]\n }\n } else if (isArray(value)) {\n for (const item of value) {\n cleanse(item)\n }\n } else if (type === \"undefined\") {\n delete obj[key]\n }\n }\n }\n}\n\n/**\n * Get the display label of the quantity\n * @param {*} def The quantity definition\n * @param {*} isArchive Determines the archive scope\n * @param {*} technicalView Returns the technical exploring name\n */\nexport function getDisplayLabel(def, isArchive = false, technicalView = false) {\n if (!def) {\n return undefined\n }\n if (technicalView) {\n return def.name\n }\n // Use label from annotations if one is given\n const labelAnnotation = def?.m_annotations?.display?.[0]?.label\n const eln = def?.m_annotations?.eln\n if (labelAnnotation) {\n if (typeof labelAnnotation === 'string') {\n return labelAnnotation\n } else {\n throw new Error('Unsupported format for label annotation')\n }\n }\n const override = eln?.[0].label || def?.more?.label || def?.label\n if (override) {\n return override\n }\n // Default to autogenerated label\n let name = def.name.replace(/_/g, ' ')\n const isSection = def.m_def === 'nomad.metainfo.metainfo.Section' || def.m_def === 'nomad.metainfo.metainfo.SubSection'\n if (isSection) {\n name = name.replace(/([a-z])([A-Z])/g, '$1 $2')\n }\n return (isArchive ? name : capitalize(name))\n}\n\n/**\n * Checks if the given string is empty: undefined, null or contains only\n * whitespace.\n * @param {*} value The value to check\n * @returns Whether the string is empty\n */\nexport function isEmptyString(value) {\n return value === undefined || value === null || !value?.trim?.()?.length\n}\n\n/**\n * Checks if upload is visible for all users (including guests)\n * @param {Object} upload The upload object\n * @returns {boolean|undefined} Whether the upload is visible\n */\nexport function isUploadVisibleForAll(upload) {\n return upload?.viewer_groups?.includes('all')\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext, useRef, useState, useCallback, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { useApi, DoesNotExist } from './api'\nimport { useErrors } from './errors'\nimport { apiBase, metainfo as currentSystemMetainfoData } from '../config'\nimport { refType, parseNomadUrl, createEntryUrl, systemMetainfoUrl, isUploadVisibleForAll } from '../utils'\nimport { getMetainfoFromDefinition, getUrlFromDefinition, Metainfo } from './archive/metainfo'\nimport YAML from 'yaml'\n\nfunction addSubscription(storeObj, cb) {\n storeObj._subscriptions.push(cb)\n}\n\nfunction removeSubscription(store, key, cb) {\n const storeObj = store[key]\n if (storeObj) {\n storeObj._subscriptions = storeObj._subscriptions.filter(subscription => subscription !== cb)\n }\n}\n\nconst metainfoArchiveFilter = Object.freeze({\n // Archive data required to create a Metainfo object\n definitions: '*',\n metadata: '*'\n})\n\nexport const dataStoreContext = React.createContext()\n\nexport function useDataStore() {\n return useContext(dataStoreContext)\n}\n\nconst DataStore = React.memo(({children}) => {\n const {raiseError} = useErrors()\n const {api, user} = useApi()\n const userRef = useRef()\n userRef.current = user // The logged in user may change during component lifecycle\n const storeKey = useRef() // A key used to determine when the caches should be cleared\n const selectedEntry = useRef() // stores identity of the selected entry (used to determine if editable)\n const entryBreadCrumb = useRef({innerText: 'Entry'})\n const uploadBreadCrumb = useRef({innerText: 'Upload'})\n const breadcrumb = {\n uploadRef: uploadBreadCrumb,\n entryRef: entryBreadCrumb,\n setUpload: (breadcrumb) => {\n if (uploadBreadCrumb.current) {\n uploadBreadCrumb.current.innerText = breadcrumb\n }\n },\n setEntry: (breadcrumb) => {\n if (entryBreadCrumb.current) {\n entryBreadCrumb.current.innerText = breadcrumb\n }\n },\n getUpload: () => uploadBreadCrumb.current?.innerText,\n getEntry: () => entryBreadCrumb.current?.innerText\n }\n\n const uploadStore = useRef({}) // The upload store objects\n const entryStore = useRef({}) // The entry store objects\n const metainfoDataStore = useRef({}) // The metainfo data store objects\n const frozenMetainfoCache = useRef({}) // Stores frozen metainfo objects by their version hash\n const externalInheritanceCache = useRef({}) // Used to keep track of inheritance between metainfos\n\n /**\n * Gets an upload object from the store, creating it if it doesn't exist (in which case\n * an object with default values, mostly undefined or nulls, will be returned). Note, it\n * does not cause the store to fetch any data, it just returns what's currently in the store.\n */\n function getUpload(deploymentUrl, uploadId) {\n if (!uploadId) return undefined\n if (deploymentUrl !== apiBase) throw new Error('Fetching uploads from external deployments is not yet supported')\n let uploadStoreObj = uploadStore.current[uploadId]\n if (!uploadStoreObj) {\n // Creates an initial, empty upload store object.\n uploadStoreObj = {\n deploymentUrl, // ReadOnly\n uploadId, // ReadOnly\n isExternal: deploymentUrl !== apiBase, // ReadOnly\n deletionRequested: false, // Writable - If this upload has been sent for deletion\n upload: undefined, // Writeable - The last upload proc data fetched.\n entries: undefined, // ReadOnly - The last list of entries fetched by the store (when subscribing to an entry page).\n apiData: undefined, // ReadOnly - Object with the last api request and response fetched by the store (when subscribing to an entry page).\n pagination: {\n page_size: 5, page: 1, order: 'asc', order_by: 'process_status'\n }, // Writeable - Value for pagination to use when an entries page is requested\n\n // ReadOnly - Derived values (computed when calling updateUpload)\n hasUpload: false,\n isProcessing: false,\n isViewer: false,\n isWriter: false,\n isMainAuthor: false,\n isEditable: false,\n isVisibleForAll: false,\n\n // ReadOnly - Managed by the store\n error: undefined, // If we had an api error from the last store refresh\n isRefreshing: false,\n requestOptions: {requireUpload: false, requireEntriesPage: false}, // Options specifying data requested\n refreshOptions: null, // Options specifying data actually fetched (or attempted to fetch) at last refresh\n _subscriptions: [],\n\n // Convenience methods\n updateUpload: (dataToUpdate) => { updateUpload(deploymentUrl, uploadId, dataToUpdate) },\n requestRefreshUpload: () => { requestRefreshUpload(deploymentUrl, uploadId) }\n }\n uploadStore.current[uploadId] = uploadStoreObj\n }\n return uploadStoreObj\n }\n\n /**\n * Gets an upload from the store asychronously, waiting for the store to refresh if needed.\n * If the required data has already been fetched, we return the store object immediately.\n */\n async function getUploadAsync(deploymentUrl, uploadId, requireUpload, requireEntriesPage) {\n if (!uploadId) return undefined\n const uploadStoreObj = getUpload(deploymentUrl, uploadId)\n if (uploadRefreshSatisfiesOptions(uploadStoreObj, requireUpload, requireEntriesPage)) {\n return uploadStoreObj // Store has already been refreshed with the required options\n }\n // Set up temporary subscription and wait for it to refresh\n return new Promise(function(resolve, reject) {\n function cb(oldStoreObj, newStoreObj) {\n if (uploadRefreshSatisfiesOptions(newStoreObj, requireUpload, requireEntriesPage)) {\n removeSubscription(uploadStore.current, uploadId, cb)\n resolve(newStoreObj)\n }\n }\n subscribeToUpload(deploymentUrl, uploadId, cb, requireUpload, requireEntriesPage)\n })\n }\n\n /**\n * Subscribes the callback cb to an upload, and returns a function to be called to unsubscribe.\n * Typically used in useEffect. The callback will be called when the store value changes.\n */\n function subscribeToUpload(deploymentUrl, uploadId, cb, requireUpload, requireEntriesPage) {\n if (!uploadId) return undefined\n if (requireUpload === undefined || requireEntriesPage === undefined) {\n throw Error('Store error: missing upload subscription parameter')\n }\n const uploadStoreObj = getUpload(deploymentUrl, uploadId)\n // Update requestOptions\n uploadStoreObj.requestOptions.requireUpload = uploadStoreObj.requestOptions.requireUpload || requireUpload\n uploadStoreObj.requestOptions.requireEntriesPage = uploadStoreObj.requestOptions.requireEntriesPage || requireEntriesPage\n // Add subscription and trigger refresh if needed\n addSubscription(uploadStoreObj, cb)\n initiateUploadRefreshIfNeeded(deploymentUrl, uploadId)\n return function unsubscriber() { removeSubscription(uploadStore.current, uploadId, cb) }\n }\n\n function updateUserDependentAttributes(storeObj, user) {\n const viewers = storeObj.upload?.viewers\n const writers = storeObj.upload?.writers\n const viewer_groups = storeObj.upload?.viewer_groups\n const writer_groups = storeObj.upload?.writer_groups\n storeObj.isViewer = !!(user && (\n viewers?.includes(user.sub) || viewer_groups?.some(g => user?.groups?.includes(g))\n ))\n storeObj.isWriter = !!(user && (\n writers?.includes(user.sub) || writer_groups?.some(g => user?.groups?.includes(g))\n ))\n storeObj.isMainAuthor = user && storeObj.upload?.main_author === user.sub\n storeObj.isEditable = storeObj.isWriter && !storeObj.upload.published\n storeObj.isVisibleForAll = isUploadVisibleForAll(storeObj.upload)\n }\n\n function notifySubscribers(oldStoreObj, newStoreObj) {\n for (const cb of newStoreObj._subscriptions) {\n try {\n cb(oldStoreObj, newStoreObj)\n } catch (error) {\n console.error('DataStore: failed to notify subscriber: ' + error.message)\n }\n }\n }\n\n /**\n * Updates the store upload with the specified data and notifies all subscribers.\n */\n function updateUpload(deploymentUrl, uploadId, dataToUpdate) {\n if (deploymentUrl !== apiBase) throw new Error('Cannot update external upload')\n const oldStoreObj = getUpload(deploymentUrl, uploadId)\n const newStoreObj = {...oldStoreObj, ...dataToUpdate}\n // Compute derived values\n newStoreObj.hasUpload = !!newStoreObj.upload\n newStoreObj.isProcessing = !!newStoreObj.upload?.process_running\n if (dataToUpdate.upload || dataToUpdate.entries) {\n dataToUpdate.error = undefined // Updating upload or entries -> reset error\n }\n if (dataToUpdate?.upload?.current_process === 'delete_upload') {\n newStoreObj.deletionRequested = true // Will treat subsequent 404 errors\n }\n updateUserDependentAttributes(newStoreObj, userRef.current)\n // Update the store\n uploadStore.current[uploadId] = newStoreObj\n notifySubscribers(oldStoreObj, newStoreObj)\n // Report any unexpected api errors to the user\n if (newStoreObj.error && (!oldStoreObj.error || oldStoreObj.error?.apiMessage !== newStoreObj.error?.apiMessage)) {\n if (newStoreObj.error instanceof DoesNotExist && newStoreObj.deletionRequested) {\n // Expected to happen when user deletes an upload, ignore\n } else {\n // Unexpected error occured when refreshing\n raiseError(newStoreObj.error)\n }\n }\n // Possibly, start a refresh job\n initiateUploadRefreshIfNeeded(deploymentUrl, uploadId)\n }\n\n async function refreshUpload(deploymentUrl, uploadId) {\n // Internal use: refresh an upload store obj with data from the API.\n const uploadStoreObj = getUpload(deploymentUrl, uploadId)\n const refreshOptions = {...uploadStoreObj.requestOptions}\n const {requireUpload, requireEntriesPage} = refreshOptions\n if (!requireUpload && !requireEntriesPage) return\n // There's something that can be refreshed\n uploadStoreObj.isRefreshing = true\n const currentPagination = uploadStoreObj.pagination\n\n const apiCall = requireEntriesPage\n ? api.get(`/uploads/${uploadId}/entries`, currentPagination, {returnRequest: true})\n : api.get(`/uploads/${uploadId}`)\n\n apiCall.then(apiData => {\n const dataToUpdate = requireEntriesPage\n ? {error: undefined, isRefreshing: false, upload: apiData.response?.upload, entries: apiData.response?.data, apiData, pagination: currentPagination, refreshOptions}\n : {error: undefined, isRefreshing: false, upload: apiData.data, entries: undefined, apiData: undefined, refreshOptions}\n updateUpload(deploymentUrl, uploadId, dataToUpdate)\n }).catch((error) => {\n if (requireEntriesPage && error.apiMessage === 'Page out of range requested.') {\n // Special case: can happen if entries have been deleted and the page we were on is no longer in range\n if (currentPagination && currentPagination.page !== 1) {\n // Rather than sending an update to all subscribers with an error, we first try\n // jumping to page 1 (will probably solve the problem)\n getUpload(deploymentUrl, uploadId).pagination.page = 1\n refreshUpload(deploymentUrl, uploadId)\n return\n }\n }\n updateUpload(deploymentUrl, uploadId, {error: error, isRefreshing: false, refreshOptions})\n })\n }\n\n /**\n * Use to nicely request a refresh of the upload store object.\n */\n function requestRefreshUpload(deploymentUrl, uploadId) {\n const uploadStoreObj = getUpload(deploymentUrl, uploadId)\n if (!uploadStoreObj.isRefreshing) {\n // Refresh is not already in progress\n refreshUpload(deploymentUrl, uploadId)\n }\n }\n\n async function initiateUploadRefreshIfNeeded(deploymentUrl, uploadId) {\n // Internal use: check if a refresh of the store is needed, and if so, initiate it.\n let uploadStoreObj = getUpload(deploymentUrl, uploadId)\n if (uploadStoreObj.isRefreshing) return // refresh already in progress\n if (uploadStoreObj.isProcessing) {\n // Upload is processing\n uploadStoreObj.isRefreshing = true // Signal start of a refresh\n await new Promise(resolve => setTimeout(resolve, 1000)) // wait one sec\n uploadStoreObj = getUpload(deploymentUrl, uploadId)\n }\n // Determine if a refresh is needed or not\n const {requireUpload, requireEntriesPage} = uploadStoreObj.requestOptions\n const uploadDataMissing = requireUpload && !uploadStoreObj.upload\n const entryDataMissing = requireEntriesPage && !uploadStoreObj.entries\n const pag = uploadStoreObj.pagination\n const pagIs = uploadStoreObj.apiData?.response?.pagination\n const wrongPagination = requireEntriesPage && !Object.entries(pag).every(([key, value]) => pagIs?.[key] === value)\n if (!uploadStoreObj.error && (uploadDataMissing || entryDataMissing || wrongPagination || uploadStoreObj.isProcessing)) {\n // Need to fetch data from the api\n refreshUpload(deploymentUrl, uploadId)\n } else {\n uploadStoreObj.isRefreshing = false\n }\n }\n\n /**\n * Gets an entry object from the store, creating it if it doesn't exist (in which case\n * an object with default values, mostly undefined or nulls, will be returned). Note, it\n * does not cause the store to fetch any data, it just returns what's currently in the store.\n */\n function getEntry(deploymentUrl, entryId, raise = true) {\n if (!entryId) return undefined\n if (deploymentUrl !== apiBase) throw new Error('Fetching entries from external deployments is not yet supported')\n let entryStoreObj = entryStore.current[entryId]\n if (!entryStoreObj) {\n // Creates an initial, empty entry store object.\n entryStoreObj = {\n deploymentUrl, // ReadOnly\n entryId: entryId, // ReadOnly\n uploadId: undefined, // ReadOnly - fetched by the store\n url: undefined, // ReadOnly - populated when uploadId fetched from the store\n metadata: undefined, // ReadOnly - fetched by the store\n metadataApiData: undefined, // ReadOnly - fetched by the store\n archive: undefined, // Modifiable object - fetched by the store, but the object *content* can be changed when editing.\n archiveApiData: undefined, // Modifiable object - fetched by the store, but the \"archive\" key is the same object as above, i.e. modifiable.\n originalDefinition: undefined, // original definition defined by user obtained from raw file\n\n // ReadOnly - Derived or managed by the store\n exists: true,\n isProcessing: false,\n editable: false,\n archiveVersion: 0, // Used to keep track of manual edits\n savedArchiveVersion: 0,\n archiveHasChanges: false,\n\n raise: raise, // Whether to use raiseError on exceptions\n error: undefined, // If we had an api error from the last store refresh\n isRefreshing: false,\n requestOptions: {requireMetadata: false, requireArchive: undefined}, // Options specifying data requested\n refreshOptions: null, // Options specifying data actually fetched (or attempted to fetch) at last refresh\n _subscriptions: [],\n\n // Convenience methods\n handleArchiveChanged: () => { handleArchiveChanged(deploymentUrl, entryId) },\n saveArchive: () => { return saveArchive(deploymentUrl, entryId) },\n reload: () => { requestRefreshEntry(deploymentUrl, entryId) }\n }\n entryStore.current[entryId] = entryStoreObj\n }\n return entryStoreObj\n }\n\n /**\n * Gets an entry from the store asychronously, waiting for the store to refresh if needed.\n * If the required data has already been fetched, we return the store object immediately.\n */\n async function getEntryAsync(deploymentUrl, entryId, requireMetadata, requireArchive, raise = true) {\n if (!entryId) return undefined\n const entryStoreObj = getEntry(deploymentUrl, entryId, raise)\n if (entryRefreshSatisfiesOptions(entryStoreObj, requireMetadata, requireArchive)) {\n return entryStoreObj // Store has already been refreshed with the required options\n }\n // Set up temporary subscription and wait for it to refresh\n return new Promise(function(resolve, reject) {\n function cb(oldStoreObj, newStoreObj) {\n if (entryRefreshSatisfiesOptions(newStoreObj, requireMetadata, requireArchive)) {\n removeSubscription(entryStore.current, entryId, cb)\n resolve(newStoreObj)\n }\n }\n subscribeToEntry(deploymentUrl, entryId, cb, requireMetadata, requireArchive, raise)\n })\n }\n\n /**\n * Subscribes the callback cb to an entry, and returns a function to be called to unsubscribe.\n * Typically used in useEffect. The callback will be called when the store value changes.\n */\n function subscribeToEntry(deploymentUrl, entryId, cb, requireMetadata, requireArchive, raise = true) {\n if (!entryId) return undefined\n if (requireMetadata === undefined || !(requireArchive === undefined || requireArchive === '*' || typeof requireArchive === 'object')) {\n throw Error('Store error: bad subscription parameter supplied')\n }\n const entryStoreObj = getEntry(deploymentUrl, entryId)\n // Update requestOptions\n entryStoreObj.requestOptions.requireMetadata = entryStoreObj.requestOptions.requireMetadata || requireMetadata\n entryStoreObj.requestOptions.requireArchive = mergeArchiveFilter(\n entryStoreObj.requestOptions.requireArchive, requireArchive)\n // Add subscription and trigger refresh if needed\n addSubscription(entryStoreObj, cb)\n initiateEntryRefreshIfNeeded(deploymentUrl, entryId, raise)\n return function unsubscriber() { removeSubscription(entryStore.current, entryId, cb) }\n }\n\n /**\n * Updates the store entry with the specified data and notifies all subscribers.\n */\n function updateEntry(deploymentUrl, entryId, dataToUpdate, raise = true) {\n const oldStoreObj = getEntry(deploymentUrl, entryId)\n const newStoreObj = {...oldStoreObj, ...dataToUpdate}\n // Compute derived values not set by the refreshEntry method\n newStoreObj.url = newStoreObj.uploadId ? `${deploymentUrl}/uploads/${newStoreObj.uploadId}/archive/${entryId}` : undefined\n newStoreObj.exists = newStoreObj?.error?.name !== 'DoesNotExist'\n newStoreObj.archiveHasChanges = newStoreObj.archiveVersion !== newStoreObj.savedArchiveVersion\n\n // Update the store\n entryStore.current[entryId] = newStoreObj\n\n // Notify subscribers\n for (const cb of newStoreObj._subscriptions) {\n try {\n cb(oldStoreObj, newStoreObj)\n } catch (error) {\n console.error('DataStore: failed to notify subscriber: ' + error.message)\n }\n }\n // Report any unexpected api errors to the user\n if (newStoreObj.exists && newStoreObj.error && (!oldStoreObj.error || oldStoreObj.error?.apiMessage !== newStoreObj.error?.apiMessage)) {\n // Unexpected error occured when refreshing\n raise && raiseError(newStoreObj.error)\n }\n // Possibly, start a refresh job\n initiateEntryRefreshIfNeeded(deploymentUrl, entryId, raise)\n }\n\n async function refreshEntry(deploymentUrl, entryId, raise = true) {\n // Internal use: refresh an entry store obj with data from the API.\n let entryStoreObj = getEntry(deploymentUrl, entryId)\n let refreshOptions = {...entryStoreObj.requestOptions}\n let {requireMetadata, requireArchive} = refreshOptions\n if (!requireMetadata && !requireArchive) return\n // There's something that can be refreshed\n entryStoreObj.isRefreshing = true\n const dataToUpdate = {refreshOptions}\n try {\n if (requireMetadata) {\n const metadataApiData = await api.get(`/entries/${entryId}`, null, {returnRequest: true})\n const metadata = metadataApiData?.response?.data\n const uploadId = metadata?.upload_id\n const user = userRef.current\n const isWriter = !!(user && (\n metadata.writers?.some(u => u.user_id === user.sub) ||\n metadata.writer_groups?.some(g => user.groups?.includes(g))\n ))\n const isEditableArchive = metadata && !metadata.published && metadata.quantities && metadata.quantities.includes('data')\n const editable = isWriter && isEditableArchive && selectedEntry.current === `${deploymentUrl}:${entryId}`\n const isProcessing = !!metadata?.process_running\n Object.assign(dataToUpdate, {metadataApiData, metadata, uploadId, editable, isProcessing, error: undefined})\n // Fetch the options again, in case some subscriptions were added while waiting for the api call\n entryStoreObj = getEntry(deploymentUrl, entryId)\n refreshOptions = {...entryStoreObj.requestOptions}\n requireArchive = refreshOptions.requireArchive\n dataToUpdate.refreshOptions.requireArchive = requireArchive\n }\n if (requireArchive) {\n const required = requireArchive === '*' ? '*' : {...requireArchive, 'resolve-inplace': false}\n const archiveApiData = await api.post(\n `/entries/${entryId}/archive/query`, {required}, {returnRequest: true, jsonResponse: true})\n const archive = archiveApiData?.response?.data?.archive\n if (archive) {\n const fileName = archive.metadata.mainfile\n const isYaml = fileName.endsWith('yaml') || fileName.endsWith('yml')\n const isJson = fileName.endsWith('json')\n if (isYaml || isJson) {\n const path = `/uploads/${archive.metadata.upload_id}/raw/${fileName}`\n let content\n try {\n content = await api.get(path,\n {decompress: true, ignore_mime_type: true}, {transformResponse: []})\n } catch (e) {}\n if (content) {\n let rawArchive = {}\n if (isYaml) {\n try {\n rawArchive = YAML.parse(content)\n } catch (error) {\n throw Error(`Could not parse YAML Schema defined here: ${path}. Failed with the following parsing error: ${error.message}`)\n }\n } else if (isJson) {\n try {\n rawArchive = JSON.parse(content)\n } catch (error) {\n throw Error(`Could not parse JSON Schema defined here: ${path}. Failed with the following parsing error: ${error.message}`)\n }\n }\n if ('definitions' in rawArchive) {\n dataToUpdate.originalDefinition = rawArchive.definitions\n }\n }\n }\n archive.processing_logs = undefined\n if (archive.metadata?.upload_id) {\n dataToUpdate.uploadId = archive.metadata.upload_id\n }\n }\n dataToUpdate.archiveApiData = archiveApiData\n dataToUpdate.archive = archive\n }\n } catch (error) {\n dataToUpdate.error = error\n }\n\n // Check: should we keep current data? (A bit hacky)\n const oldTimestamp = entryStoreObj.archive?.metadata?.last_processing_time\n const newTimestamp = dataToUpdate.archive?.metadata?.last_processing_time\n if (oldTimestamp && oldTimestamp === newTimestamp) {\n const oldRequireArchive = entryStoreObj.refreshOptions.requireArchive\n if (oldRequireArchive === '*' || oldRequireArchive?.data === '*') {\n // Fields under the data key might be edited by the user, so we don't want to overwrite\n // it with data fetched from the api unless the archive timestamp has changed.\n dataToUpdate.archive.data = entryStoreObj.archive.data\n }\n }\n\n dataToUpdate.isRefreshing = false\n updateEntry(deploymentUrl, entryId, dataToUpdate, raise)\n }\n\n /**\n * Use to nicely request a refresh of the entry store object.\n */\n function requestRefreshEntry(deploymentUrl, entryId) {\n const entryStoreObj = getEntry(deploymentUrl, entryId)\n if (!entryStoreObj.isRefreshing) {\n // Refresh is not already in progress\n refreshEntry(deploymentUrl, entryId)\n }\n }\n\n async function initiateEntryRefreshIfNeeded(deploymentUrl, entryId, raise = true) {\n // Internal use: check if a refresh of the store is needed, and if so, initiate it.\n let entryStoreObj = getEntry(deploymentUrl, entryId)\n if (entryStoreObj.isRefreshing) return // refresh already in progress\n if (entryStoreObj.isProcessing) {\n // Entry is processing\n entryStoreObj.isRefreshing = true // Signal start of a refresh\n await new Promise(resolve => setTimeout(resolve, 1000)) // wait one sec\n entryStoreObj = getEntry(deploymentUrl, entryId)\n }\n // Determine if a refresh is needed or not\n const {requireMetadata, requireArchive} = entryStoreObj.requestOptions\n const lastRefreshSatisfiesOptions = entryRefreshSatisfiesOptions(entryStoreObj, requireMetadata, requireArchive)\n if (!entryStoreObj.error && (!lastRefreshSatisfiesOptions || entryStoreObj.isProcessing)) {\n // Need to fetch data from the api\n refreshEntry(deploymentUrl, entryId, raise)\n } else {\n entryStoreObj.isRefreshing = false\n }\n }\n\n /**\n * Used to save the archive and trigger a store refresh.\n */\n function saveArchive(deploymentUrl, entryId) {\n const {uploadId, metadata, archive, archiveVersion, originalDefinition} = getEntry(deploymentUrl, entryId)\n const {mainfile} = metadata\n if (uploadId) {\n const separatorIndex = mainfile.lastIndexOf('/')\n const path = mainfile.substring(0, separatorIndex + 1)\n const fileName = mainfile.substring(separatorIndex + 1)\n const newArchive = {...archive}\n delete newArchive.metadata\n delete newArchive.results\n delete newArchive.processing_logs\n delete newArchive.m_ref_archives\n\n if (originalDefinition) {\n newArchive.definitions = originalDefinition\n }\n\n const config = {}\n let stringifiedArchive\n if (fileName.endsWith('yaml') || fileName.endsWith('yml')) {\n config.headers = {\n 'Content-Type': 'application/yaml'\n }\n stringifiedArchive = YAML.stringify(newArchive)\n }\n return new Promise((resolve, reject) => {\n api.put(`/uploads/${uploadId}/raw/${path}?file_name=${fileName}&wait_for_processing=true&entry_hash=${archive.metadata.entry_hash}`, stringifiedArchive || newArchive, config)\n .then(response => {\n requestRefreshEntry(deploymentUrl, entryId)\n resolve()\n })\n .catch(error => {\n if (error?.status === 409) {\n reject(error)\n } else {\n raiseError(error)\n }\n })\n updateEntry(deploymentUrl, entryId, {savedArchiveVersion: archiveVersion})\n })\n }\n }\n\n /**\n * Call to signal that the archive has been manually edited.\n */\n function handleArchiveChanged(deploymentUrl, entryId) {\n const {archiveVersion} = getEntry(deploymentUrl, entryId)\n updateEntry(deploymentUrl, entryId, {archiveVersion: archiveVersion + 1})\n }\n\n /**\n * Gets a parsed metainfo object from the store, asynchronously.\n * The url can be a string or a parsed Url object. If it is empty, null will be returned.\n * Note, this method always returns the whole metainfo object. I.e. if the url specifies a\n * particular section definition, we return the metainfo object which *contains* this\n * definition, not just the definition itself.\n */\n async function getMetainfoAsync(url, raise = true) {\n if (!url) return null\n // Check cache (different caches, depending on if we have a versionHash or not)\n let metainfoData\n const metainfoBaseUrl = getMetainfoBaseUrl(url)\n if (metainfoBaseUrl.versionHash) {\n const frozenDef = frozenMetainfoCache.current[metainfoBaseUrl.versionHash]\n if (frozenDef) {\n return await getMetainfoFromDefinition(frozenDef)._result\n }\n } else {\n metainfoData = metainfoDataStore.current[metainfoBaseUrl]\n }\n if (!metainfoData) {\n // Not found in cache. Fetch data object.\n metainfoData = await fetchMetainfoData(metainfoBaseUrl, raise)\n if (!metainfoBaseUrl.versionHash) {\n metainfoDataStore.current[metainfoBaseUrl] = metainfoData\n }\n }\n // If needed, create metainfo (which will also initiate parsing)\n if (!metainfoData._metainfo) {\n const parent = metainfoBaseUrl === systemMetainfoUrl ? undefined : await getMetainfoAsync(systemMetainfoUrl, raise)\n metainfoData._metainfo = new Metainfo(\n parent, metainfoData, getMetainfoAsync, frozenMetainfoCache.current, externalInheritanceCache.current)\n }\n // Returned object after parsing is completed.\n return await metainfoData._metainfo._result\n }\n\n /**\n * Gets the parsed metainfo definition specified by the url, asynchronously.\n * The url can be a string or a parsed Url object. If it is empty, null will be returned.\n */\n async function getMetainfoDefAsync(url) {\n if (!url) return null\n const parsedUrl = parseNomadUrl(url)\n if (parsedUrl.versionHash) {\n const frozenDef = frozenMetainfoCache.current[parsedUrl.versionHash]\n if (frozenDef) {\n return frozenDef\n }\n }\n const metainfo = await getMetainfoAsync(parsedUrl)\n if (parsedUrl.versionHash) {\n return frozenMetainfoCache.current[parsedUrl.versionHash] // If we get here, it should be in the cache\n } else if (parsedUrl.qualifiedName) {\n return metainfo.getDefByQualifiedName(parsedUrl.qualifiedName)\n } else if (parsedUrl.path) {\n return metainfo.getDefByPath(parsedUrl.path)\n }\n throw new Error(`Expected metainfo definition url, got: ${url}`)\n }\n\n function getMetainfoBaseUrl(url) {\n // Internal use: computes the *metainfo base url*, given an absolute metainfo url.\n // The base url is an absolute url, identifying the metainfo data obj to parse\n // (to get the Metainfo object). For urls identifying non-frozen schemas, the\n // metainfo base url is also used as the cache key to store the resulting Metainfo object.\n // For urls referring to frozen schemas, we just return the parsed url. The\n // frozen schemas are stored in a different cache, indexed by versionHashes rather than\n // by the base url).\n if ((url.url || url) === systemMetainfoUrl) return systemMetainfoUrl\n url = parseNomadUrl(url)\n if (url.type !== refType.metainfo && url.type !== refType.archive) throw new Error(`Cannot get metainfo: bad url type (${url})`)\n if (!url.isResolved) throw new Error(`Url not resolved: ${url}`)\n\n if (url.versionHash) {\n return url\n } else if (url.entryId) {\n return createEntryUrl(url.deploymentUrl, url.uploadId, url.entryId, '/definitions')\n } else if (url.qualifiedName) {\n return systemMetainfoUrl\n }\n }\n\n async function fetchMetainfoData(metainfoBaseUrl, raise = true) {\n // Internal use: fetches the metainfo data\n if (metainfoBaseUrl === systemMetainfoUrl) {\n currentSystemMetainfoData._url = systemMetainfoUrl\n currentSystemMetainfoData._parsedUrl = parseNomadUrl(systemMetainfoUrl)\n return currentSystemMetainfoData\n }\n const parsedMetainfoBaseUrl = parseNomadUrl(metainfoBaseUrl)\n if (parsedMetainfoBaseUrl.versionHash) {\n const frozenMetainfo = await api.get(`/metainfo/${parsedMetainfoBaseUrl.versionHash}`)\n frozenMetainfo._url = createEntryUrl(\n parsedMetainfoBaseUrl.deploymentUrl,\n 'todo-uploadid',\n 'todo-entryid',\n `definitions@${frozenMetainfo.data.definition_id}`)\n frozenMetainfo._parsedUrl = parseNomadUrl(frozenMetainfo._url)\n // Rename data -> definitions\n frozenMetainfo.definitions = frozenMetainfo.data\n delete frozenMetainfo.data\n return frozenMetainfo\n } else if (parsedMetainfoBaseUrl.entryId) {\n const entryStoreObj = await getEntryAsync(\n parsedMetainfoBaseUrl.deploymentUrl, parsedMetainfoBaseUrl.entryId, false, metainfoArchiveFilter, raise)\n if (entryStoreObj.error) {\n throw new Error(`Error fetching entry ${parsedMetainfoBaseUrl.entryId}: ${entryStoreObj.error}`)\n } else if (!entryStoreObj.archive?.definitions) {\n throw new Error(`Entry ${parsedMetainfoBaseUrl.entryId} does not contain metainfo definitions`)\n }\n return {\n definitions: JSON.parse(JSON.stringify(entryStoreObj.archive.definitions)),\n metadata: JSON.parse(JSON.stringify(entryStoreObj.archive.metadata)),\n _url: metainfoBaseUrl,\n _parsedUrl: parsedMetainfoBaseUrl\n }\n }\n }\n\n function traversAllInheritingSections(definition) {\n const rv = []\n // Add subclasses (i.e. *directly* inheriting from this section)\n const url = getUrlFromDefinition(definition)\n rv.push(...(definition._allInternalInheritingSections || []))\n rv.push(...(externalInheritanceCache.current[url] || []))\n // Add recursively (sub-sub classes, sub-sub-sub classes etc.)\n const recursive = []\n for (const inheritingSection of rv) {\n recursive.push(...traversAllInheritingSections(inheritingSection))\n }\n rv.push(...recursive)\n return rv\n }\n\n /**\n * Gets all the inheriting sections of the provided section definition. That is: all inheriting\n * sections *currently known to the store*. The result is returned as a list of definitions.\n */\n function getAllInheritingSections(definition) {\n const inheritingSections = traversAllInheritingSections(definition)\n // There may be duplicated section defs resulted from different parents.\n return inheritingSections.filter((sectionDef, index, sectionDefs) => {\n return sectionDefs.findIndex(def => (def._qualifiedName === sectionDef._qualifiedName)) === index\n })\n }\n\n /**\n * Used to reset the data store (i.e. clear its caches). If the provided newStoreKey is\n * non-empty and different from the current storeKey, we clear everything.\n */\n function resetIfNeeded(newStoreKey) {\n if (newStoreKey && newStoreKey !== storeKey.current) {\n if (storeKey.current) {\n // Reset!\n uploadStore.current = {}\n entryStore.current = {}\n metainfoDataStore.current = {}\n externalInheritanceCache.current = {}\n }\n storeKey.current = newStoreKey\n }\n }\n\n /**\n * Used to specifically clear the entry and metainfo caches of the data store.\n */\n function resetEntryAndMetainfoCaches() {\n entryStore.current = {}\n metainfoDataStore.current = {}\n externalInheritanceCache.current = {}\n }\n\n useEffect(() => {\n for (const uploadId in uploadStore.current) {\n const newUploadObj = {...uploadStore.current[uploadId]}\n updateUserDependentAttributes(newUploadObj, user)\n notifySubscribers(uploadStore.current[uploadId], newUploadObj)\n uploadStore.current[uploadId] = newUploadObj\n }\n }, [user])\n\n const contextValue = {\n getUpload,\n getUploadAsync,\n subscribeToUpload,\n updateUpload,\n requestRefreshUpload,\n getEntry,\n getEntryAsync,\n subscribeToEntry,\n selectedEntry,\n breadcrumb,\n getMetainfoAsync,\n getMetainfoDefAsync,\n getAllInheritingSections,\n resetIfNeeded,\n resetEntryAndMetainfoCaches\n }\n\n return \n {children}\n \n})\nDataStore.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\nexport default DataStore\n\n/**\n * React function for getting an entry from the store with certain subscription options.\n * If the store already has fetched the entry and all the required data, it will be returned\n * immediately from the cache. If the store has loaded the entry, but it has not yet fetched\n * all data required by the subscription options, the function will return a copy of the store\n * object without the following fields: metadata, metadataApiData, archive, archiveApiData.\n * This is to signal to the component that all data requested is not yet available in the store.\n * For optimization purposes, we ignore updates from the store that should not invalidate\n * any of the requested data.\n *\n * Subscription options:\n * @param {Boolean} requireMetadata If we require the store to fetch the entry metadata\n * @param {*} requireArchive If we require the store to fetch the archive, and if so, what\n * parts of it. Should be one of:\n * a) undefined (no archive data required)\n * b) '*' (load entire archive), or\n * c) an object specifying a simple archive data filter (see the doc for mergeArchiveFilter).\n */\nexport function useEntryStoreObj(deploymentUrl, entryId, requireMetadata, requireArchive) {\n const dataStore = useDataStore()\n const [entryStoreObj, setEntryStoreObj] = useState(\n () => {\n if (deploymentUrl && entryId) {\n const rawStoreObj = dataStore.getEntry(deploymentUrl, entryId)\n const satisfiesOptions = entryRefreshSatisfiesOptions(rawStoreObj, requireMetadata, requireArchive)\n return satisfiesOptions ? rawStoreObj : reducedEntryStoreObj(rawStoreObj)\n }\n return null\n })\n const oldFilterKey = useRef()\n\n const onEntryStoreUpdated = useCallback((oldStoreObj, newStoreObj) => {\n // Determine if we should actually trigger an update\n const satisfiesOptions = entryRefreshSatisfiesOptions(newStoreObj, requireMetadata, requireArchive)\n const newError = newStoreObj.error !== entryStoreObj?.error\n if (!newError) {\n if (!satisfiesOptions) {\n return // Skip update, still waiting for our data.\n }\n // Satisfies the options\n const lastProcessingTime = (\n newStoreObj.metadata?.last_processing_time || newStoreObj.archive?.metadata?.last_processing_time)\n const newFilterKey = `${deploymentUrl}${entryId}${lastProcessingTime}${newStoreObj.archiveVersion}`\n if (newFilterKey === oldFilterKey.current) {\n return // Skip update, using old data should be fine.\n }\n oldFilterKey.current = newFilterKey\n }\n // Trigger update\n setEntryStoreObj(satisfiesOptions ? newStoreObj : reducedEntryStoreObj(newStoreObj))\n }, [entryStoreObj, setEntryStoreObj, deploymentUrl, entryId, requireMetadata, requireArchive])\n\n useEffect(() => {\n if (deploymentUrl && entryId) {\n return dataStore.subscribeToEntry(deploymentUrl, entryId, onEntryStoreUpdated, requireMetadata, requireArchive)\n }\n }, [deploymentUrl, entryId, requireMetadata, requireArchive, dataStore, onEntryStoreUpdated])\n\n return entryStoreObj\n}\n\n/**\n * Misc internal helper funcions\n */\n\nfunction reducedEntryStoreObj(entryStoreObj) {\n // Returns a reduced entry store obj, signalling that not all data is available.\n const rv = {...entryStoreObj}\n delete rv.metadata\n delete rv.metadataApiData\n delete rv.archive\n delete rv.archiveApiData\n return rv\n}\n\nfunction uploadRefreshSatisfiesOptions(uploadStoreObj, requireUpload, requireEntriesPage) {\n // Internal use: Determine if the last store refresh satisfies the given options.\n const refreshOptions = uploadStoreObj?.refreshOptions\n if (refreshOptions) {\n return (refreshOptions.requireUpload || !requireUpload) || (refreshOptions.requireEntriesPage || !requireEntriesPage)\n }\n return false\n}\n\nfunction entryRefreshSatisfiesOptions(entryStoreObj, requireMetadata, requireArchive) {\n // Internal use: Determine if the last store refresh satisfies the given options.\n const refreshOptions = entryStoreObj?.refreshOptions\n if (refreshOptions) {\n return (refreshOptions.requireMetadata || !requireMetadata) && archiveFilterExtends(refreshOptions.requireArchive, requireArchive)\n }\n return false\n}\n\n/**\n * Merges two archive data filters, filter1 and filter2, returning a filter which will fetch all data\n * fetched by either filter1 or filter2.\n * Note, this method only handles certain simple types of filters, used by the gui.\n * Each filter can either have the value\n * 1) undefined (meaning include nothing)\n * 2) '*' (meaning include everything, but do not add resolved data)\n * 3) 'include-resolved' (include everything and add resolved data)\n * 4) an object with subkeys (will be treated recursively)\n * The `resolve-inplace` option should not be specified (it will be implicitly set to false).\n */\nfunction mergeArchiveFilter(filter1, filter2, level = 0) {\n if (filter1 === filter2) return filter1\n if (filter1 === undefined) return filter2\n if (filter2 === undefined) return filter1\n if (filter1 === 'include-resolved' || filter2 === 'include-resolved') return 'include-resolved'\n const obj1 = typeof filter1 === 'object'\n const obj2 = typeof filter2 === 'object'\n if (filter1 === '*' && obj2) return level !== 0 && hasIncludeResolved(filter2) ? 'include-resolved' : '*'\n if (filter2 === '*' && obj1) return level !== 0 && hasIncludeResolved(filter1) ? 'include-resolved' : '*'\n if (!obj1 || !obj2) throw new Error('Cannot merge filters: bad values')\n\n // Two objects. Inspect recursively.\n const rv = {}\n for (const key in {...filter1, ...filter2}) {\n const value1 = filter1[key]\n const value2 = filter2[key]\n rv[key] = mergeArchiveFilter(value1, value2, level + 1)\n }\n return rv\n}\n\n/**\n * True if the archive filter filter1 *extends* the filter filter2, i.e. if all data passing\n * filter2 will also pass filter1.\n * Note, this method only handles certain simple types of filters, used by the gui.\n */\nfunction archiveFilterExtends(filter1, filter2, level = 0) {\n if (filter1 === filter2) return true\n if (filter2 === undefined) return true\n if (filter1 === undefined) return false\n if (filter1 === 'include-resolved') return true\n if (filter2 === 'include-resolved') return false\n const obj1 = typeof filter1 === 'object'\n const obj2 = typeof filter2 === 'object'\n if (filter1 === '*' && obj2) return level === 0 || !hasIncludeResolved(filter2)\n if (filter2 === '*' && obj1) return false\n if (!obj1 || !obj2) throw new Error('Cannot compare filters: bad values')\n // Two objects. Inspect recursively.\n for (const key in filter2) {\n const value1 = filter1[key]\n const value2 = filter2[key]\n if (!archiveFilterExtends(value1, value2, level + 1)) return false\n }\n return true\n}\n\nfunction hasIncludeResolved(f) {\n for (const key in f) {\n const v = f[key]\n if (v === 'include-resolved') return true\n if (typeof v === 'object') {\n if (hasIncludeResolved(v)) return true\n }\n }\n return false\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useContext, useEffect, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { isEmpty } from 'lodash'\nimport { useErrors } from '../errors'\nimport { useApi } from '../api'\nimport { useDataStore } from '../DataStore'\nimport {\n parseNomadUrl, resolveNomadUrl, resolveInternalRef, systemMetainfoUrl, createEntryUrl,\n urlEncodePath, urlJoin, relativizeNomadUrl\n} from '../../utils'\nimport { apiBase } from '../../config'\n\nconst metainfoContext = React.createContext()\n\nexport const GlobalMetainfo = React.memo(function GlobalMetainfo({ children }) {\n const dataStore = useDataStore()\n const globalMetainfo = useMetainfo(systemMetainfoUrl)\n const { api } = useApi()\n const [allCustomMetainfos, setAllCustomMetainfos] = useState()\n\n const fetchAllCustomMetainfos = useCallback(async (refresh, query) => {\n if (allCustomMetainfos && !refresh) {\n return allCustomMetainfos\n }\n if (allCustomMetainfos) {\n // Refreshing.\n dataStore.resetEntryAndMetainfoCaches()\n }\n\n // TODO paginate?\n // TODO Only grab new ones?\n query = query || {}\n const response = await api.post(`entries/archive/query`, {\n owner: 'visible',\n query: {\n ...query,\n quantities: 'definitions.section_definitions',\n processed: true\n },\n required: {\n metadata: {\n entry_id: '*'\n }\n }\n })\n const foundCustomMetainfos = []\n for (const data of response.data) {\n try {\n const url = createEntryUrl(apiBase, data.upload_id, data.entry_id)\n const customMetainfo = await dataStore.getMetainfoAsync(url)\n foundCustomMetainfos.push(customMetainfo)\n } catch (error) {\n // Unparseable metainfo\n }\n }\n setAllCustomMetainfos(foundCustomMetainfos)\n return foundCustomMetainfos\n }, [api, dataStore, allCustomMetainfos, setAllCustomMetainfos])\n\n if (globalMetainfo) {\n globalMetainfo.fetchAllCustomMetainfos = fetchAllCustomMetainfos\n }\n return \n {children}\n \n})\nGlobalMetainfo.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nexport function useGlobalMetainfo() {\n return useContext(metainfoContext)\n}\n\n/**\n * React function for fetching a parsed metainfo object, given a url.\n * The url can be a string or a parsed Url object. If it is empty, null will be returned.\n * Note, this method always returns the whole data object. I.e. if the url specifies a\n * particular section definition, we return the metainfo data object which *contains* this\n * definition, not just the definition itself.\n */\nexport function useMetainfo(url) {\n const dataStore = useDataStore()\n const { raiseError } = useErrors()\n const [metainfo, setMetainfo] = useState()\n\n useEffect(() => {\n dataStore.getMetainfoAsync(url)\n .then(setMetainfo)\n .catch(error => {\n raiseError(error)\n setMetainfo(null)\n })\n }, [url, dataStore, raiseError, setMetainfo])\n\n return metainfo\n}\n\n/**\n * React function for fetching a parsed metainfo def, given a url.\n * The url can be a string or a parsed Url object. If it is empty, null will be returned.\n */\nexport function useMetainfoDef(url) {\n const dataStore = useDataStore()\n const { raiseError } = useErrors()\n const [metainfoDef, setMetainfoDef] = useState(null)\n\n useEffect(() => {\n if (!url) {\n setMetainfoDef(null)\n } else if (url.error) {\n raiseError(url.error)\n setMetainfoDef(null)\n } else {\n dataStore.getMetainfoDefAsync(url)\n .then(result => {\n setMetainfoDef(result)\n })\n .catch(error => {\n raiseError(error)\n setMetainfoDef(null)\n })\n }\n }, [url, setMetainfoDef, dataStore, raiseError])\n\n return metainfoDef\n}\n\nexport const PackageMDef = 'nomad.metainfo.metainfo.Package'\nexport const SectionMDef = 'nomad.metainfo.metainfo.Section'\nexport const QuantityMDef = 'nomad.metainfo.metainfo.Quantity'\nexport const SubSectionMDef = 'nomad.metainfo.metainfo.SubSection'\nexport const CategoryMDef = 'nomad.metainfo.metainfo.Category'\nexport const AttributeMDef = 'nomad.metainfo.metainfo.Attribute'\n\nexport function quantityUsesFullStorage(def) {\n return def.repeats || def.variable || def.attributes?.length\n}\n\n/**\n * Represents and manages schema data.\n *\n * It is responsible to create derived definition properties that are necessary for the\n * browser's function and to allow to resolve references to definitions.\n *\n * It allows to access schema data in two ways: via references and via qualified names\n * (e.g. based on packages name + section name).\n *\n * For package-based access, metainfo instances can be linked. A metainfo can have a parent.\n * Here metainfo instances will first try to resolve a qualified names with itself and it's\n * parent.\n *\n * For reference-based access, contexts can be used. A metainfo instance represents a single\n * root section (e.g. Package or Environment). URL fragments can be resolved here. The\n * rest of the reference URL can be used load respective resources with the context.\n */\nexport class Metainfo {\n /**\n * Constructs a Metainfo object. Note, this should only be invoked by the store.\n */\n constructor(parent, data, getMetainfoAsync, frozenMetainfoCache, externalInheritanceCache) {\n this._parent = parent\n this._data = data\n this._getMetainfoAsync = getMetainfoAsync\n this._frozenMetainfoCache = frozenMetainfoCache\n this._externalInheritanceCache = externalInheritanceCache\n this._url = data._url // the data url, always string\n this._parsedUrl = parseNomadUrl(data._url)\n\n this._defs = new Set()\n this._packageDefs = {}\n this._defsByNameCache = null\n this._packagePrefixCache = null\n this._rootSectionsCache = null\n\n // Initiate a single call to _parse, using a promise\n this._isParsed = false\n this._result = new Promise((resolve, reject) => {\n this._parse().then(resolve).catch(reject)\n })\n }\n\n /**\n * @returns All definitions as an Array.\n */\n getDefs() {\n if (this._parent) {\n return this._parent.getDefs().concat([...this._defs])\n } else {\n return [...this._defs]\n }\n }\n\n /**\n * @returns An object with all definition names as keys. Packages are excluded.\n * The values are arrays with all the definitions that share the name.\n */\n getDefsByName() {\n if (this._defsByNameCache) {\n return this._defsByNameCache\n }\n this._defsByNameCache = this.getDefs().filter(def => def.m_def !== PackageMDef).reduce((result, def) => {\n result[def.name] = result[def.name] || []\n result[def.name].push(def)\n return result\n }, {})\n return this._defsByNameCache\n }\n\n /**\n * Gets a definition by its qualified name\n */\n getDefByQualifiedName(qualifiedName) {\n const defQualifiedNameSegments = qualifiedName.split('.')\n let def\n\n // Nexus inner sections require special handling as they are not stored at\n // the package root\n if (qualifiedName.startsWith('nexus.')) {\n const pkg = this._packageDefs[defQualifiedNameSegments.shift()]\n const sectionName = defQualifiedNameSegments.shift()\n for (const section_def of pkg.section_definitions) {\n if (sectionName === section_def.name) {\n def = section_def\n break\n }\n }\n for (const part of defQualifiedNameSegments) {\n for (const inner_section_def of def.inner_section_definitions) {\n if (part === inner_section_def.name) {\n def = inner_section_def\n break\n }\n }\n }\n } else {\n const packageName = defQualifiedNameSegments.slice(0, -1).join('.')\n const sectionName = defQualifiedNameSegments[defQualifiedNameSegments.length - 1]\n const pkg = this._packageDefs[packageName || '*']\n def = pkg?._sections?.[sectionName]\n }\n\n return def\n }\n\n /**\n * Gets a definition by its path (starting with '#' or '/', i.e. from the 'root' of the metainfo data)\n */\n getDefByPath(path) {\n return resolveInternalRef(path, this._data)\n }\n\n /**\n * @returns An object with all package prefixes (the part of the name before the first \".\")\n * The values are arrays with all the packages that share the prefix.\n */\n getPackagePrefixes() {\n if (this._packagePrefixCache) {\n return this._packagePrefixCache\n }\n this._packagePrefixCache = this.getDefs()\n // The definition needs to point to a Package which has a name\n .filter(def => def.m_def === PackageMDef && def.name)\n .reduce((results, pkg) => {\n const packageName = pkg.name\n if (packageName !== '*') {\n const prefix = packageName.split('.')[0]\n results[prefix] = results[prefix] || {}\n results[prefix][packageName] = pkg\n }\n return results\n }, {})\n return this._packagePrefixCache\n }\n\n /**\n * @returns An array with all section definitions where not sub-section is using them\n * as section definition.\n */\n getRootSectionDefinitions() {\n if (this._rootSectionsCache) {\n return this._rootSectionsCache\n }\n const sortDefs = defs => defs.sort((a, b) => a.name.localeCompare(b.name))\n this._rootSectionsCache = sortDefs(this.getDefs().filter(def => (\n def.m_def === SectionMDef && !def.extends_base_section && def._parentSections.length === 0)\n ))\n return this._rootSectionsCache\n }\n\n getEntryArchiveDefinition() {\n // TODO this is a super wasteful implementation\n const entryArchiveDefinition = this.getRootSectionDefinitions().find(def => def.name === 'EntryArchive')\n return entryArchiveDefinition\n }\n\n /**\n * Parses the metainfo data\n */\n async _parse() {\n // Parse data\n if (this._data.packages) {\n // Initial parsing\n for (const pkg of this._data.packages) {\n this._addDefIdsToCache(pkg)\n }\n // Main parsing\n let pkgIndex = 0\n for (const pkg of this._data.packages) {\n await this._addPackage(pkg, null, this._data, 'packages', pkgIndex++)\n }\n }\n if (this._data.definitions) {\n // Initial parsing\n this._addDefIdsToCache(this._data.definitions)\n // Main parsing\n const entryId = this._parsedUrl.entryId\n await this._addPackage(this._data.definitions, `entry_id:${entryId}`, this._data, 'definitions')\n }\n this._isParsed = true\n return this\n }\n\n _addDefIdsToCache(def) {\n // Used for an initial, synchronous shallow parsing, which adds all encountered definition_ids\n // to this._frozenMetainfoCache, so they can be used when resolving references during the\n // main parsing step.\n if (def.definition_id) {\n if (!this._frozenMetainfoCache[def.definition_id]) {\n this._frozenMetainfoCache[def.definition_id] = def\n }\n }\n for (const subDefs of [def.category_definitions, def.section_definitions, def.inner_section_definitions, def.quantities]) {\n if (subDefs) {\n for (const subDef of subDefs) {\n this._addDefIdsToCache(subDef)\n }\n }\n }\n }\n\n async _addDef(def) {\n // only add if not already added\n if (this._defs.has(def)) {\n return\n }\n def.more = def.more || {}\n def.categories = await this.resolveDefinitionList(def.categories || [])\n this._defs.add(def)\n this._defsByNameCache = null\n }\n\n async _initSection(sectionDef) {\n if (sectionDef._allBaseSections !== undefined) {\n return sectionDef\n }\n\n sectionDef.base_sections = sectionDef.base_sections || []\n sectionDef.quantities = sectionDef.quantities || []\n sectionDef.sub_sections = sectionDef.sub_sections || []\n sectionDef.inner_section_definitions = sectionDef.inner_section_definitions || []\n sectionDef._allBaseSections = []\n sectionDef._allInternalInheritingSections = []\n sectionDef._parentSections = []\n sectionDef._parentSubSections = []\n\n const resolvedBaseSections = []\n for (const baseSectionRef of sectionDef.base_sections) {\n const baseSection = await this.resolveDefinition(baseSectionRef)\n resolvedBaseSections.push(baseSection)\n if (!sectionDef.extends_base_section) {\n await this._initSection(baseSection)\n sectionDef._allBaseSections.push(baseSection)\n baseSection._allBaseSections.forEach(baseBaseSection => sectionDef._allBaseSections.push(baseBaseSection))\n if (typeof baseSectionRef === 'string' && (baseSectionRef.startsWith('#') || baseSectionRef.startsWith('/'))) {\n // Internal base section link (both this and the base section defined in the same metainfo data)\n if (!baseSection._allInternalInheritingSections.includes(sectionDef)) {\n baseSection._allInternalInheritingSections.push(sectionDef)\n }\n } else {\n // External base section link. These are stored in a separate cache in the store.\n const baseSectionUrl = getUrlFromDefinition(baseSection)\n let externalInheritingSections = this._externalInheritanceCache[baseSectionUrl]\n if (!externalInheritingSections) {\n externalInheritingSections = []\n this._externalInheritanceCache[baseSectionUrl] = externalInheritingSections\n }\n if (!externalInheritingSections.includes(sectionDef)) {\n externalInheritingSections.push(sectionDef)\n }\n }\n }\n }\n sectionDef.base_sections = resolvedBaseSections\n return sectionDef\n }\n\n async _createAllAttributes(sectionDef) {\n const allSectionAttributes = {}\n const allQuantityAttributes = {}\n function createAddAttributes(inherited) {\n return (sectionDef) => {\n function createAddAttribute(m_def, allAttributes, inherited) {\n return (attribute) => {\n if (!inherited && allAttributes[attribute.name]) {\n attribute._overwritten = true\n }\n attribute.m_def = m_def\n allAttributes[attribute.name] = attribute\n }\n }\n sectionDef.attributes?.forEach(createAddAttribute(AttributeMDef, allSectionAttributes, inherited))\n sectionDef.quantities.forEach(quantitiy => {\n allQuantityAttributes[quantitiy.name] = allQuantityAttributes[quantitiy.name] || {}\n const quantityAttributes = allQuantityAttributes[quantitiy.name]\n quantitiy.attributes?.forEach(createAddAttribute(\n AttributeMDef, quantityAttributes, quantitiy._parent !== sectionDef))\n })\n }\n }\n sectionDef = await this._initSection(sectionDef)\n const reversedBaseSections = [...sectionDef._allBaseSections].reverse()\n reversedBaseSections.forEach(createAddAttributes(true))\n createAddAttributes(false)(sectionDef)\n\n sectionDef._allAttributes = Object.keys(allSectionAttributes).map(key => allSectionAttributes[key])\n sectionDef.quantities.forEach(quantitiy => {\n const allAttritbutes = allQuantityAttributes[quantitiy.name]\n quantitiy._allAttributes = Object.keys(allAttritbutes).map(key => allAttritbutes[key])\n })\n }\n\n async _getAllProperties(sectionDef) {\n const results = {}\n function createAddProperties(inherited) {\n return (sectionDef) => {\n function createAddProperty(m_def) {\n return (property) => {\n if (!inherited && results[property.name]) {\n property._overwritten = true\n }\n property.m_def = m_def\n results[property.name] = property\n }\n }\n sectionDef.quantities.forEach(createAddProperty(QuantityMDef))\n sectionDef.sub_sections.forEach(createAddProperty(SubSectionMDef))\n }\n }\n sectionDef = await this._initSection(sectionDef)\n const reversedBaseSections = [...sectionDef._allBaseSections].reverse()\n reversedBaseSections.forEach(createAddProperties(true))\n createAddProperties(false)(sectionDef)\n return Object.keys(results).map(key => results[key])\n }\n\n async _addSection(pkg, sectionDef, parentDef, parentProperty, parentIndex) {\n this._rootSectionsCache = null\n sectionDef.m_def = SectionMDef\n sectionDef._parent = parentDef\n sectionDef._parentProperty = parentProperty\n sectionDef._parentIndex = parentIndex\n pkg._sections[sectionDef.name] = sectionDef\n await this._initSection(sectionDef)\n sectionDef._qualifiedName = parentDef ? `${parentDef._qualifiedName || parentDef._unique_id || parentDef.name}.${sectionDef.name}` : sectionDef.name\n sectionDef._package = pkg\n\n let index = 0\n for (const innerSectionDef of sectionDef.inner_section_definitions) {\n await this._addSection(pkg, innerSectionDef, sectionDef, 'inner_section_definitions', index)\n index++\n }\n\n const addPropertiesFromSections = async sections => {\n for (const ref of sections) {\n const extendingSectionDef = await this.resolveDefinition(ref)\n if (extendingSectionDef.quantities) {\n sectionDef.quantities.push(...extendingSectionDef.quantities)\n }\n if (extendingSectionDef.sub_sections) {\n sectionDef.sub_sections.push(...extendingSectionDef.sub_sections)\n }\n }\n }\n sectionDef.extending_sections = sectionDef.extending_sections || []\n await addPropertiesFromSections(sectionDef.extending_sections)\n if (!sectionDef.extends_base_section) {\n await this._addDef(sectionDef)\n }\n\n sectionDef._allProperties = await this._getAllProperties(sectionDef)\n sectionDef._properties = {}\n\n // Do for new properties (i.e. defined in THIS section, not inherited from base sections)\n const addNewProperty = async (property, parentProperty, index) => {\n property._section = sectionDef\n property._parentProperty = parentProperty\n property._parentIndex = index\n property._qualifiedName = `${sectionDef._qualifiedName}.${property.name}`\n property._package = pkg\n property._parent = sectionDef\n for (const attribute of (property?.attributes || [])) {\n attribute._parent = property\n }\n await this._addDef(property)\n if (property.m_def === QuantityMDef) {\n property.shape = property.shape || []\n if (isReference(property)) {\n const referencedDefinition = await this.resolveDefinition(property.type.type_data)\n property.type._referencedDefinition = referencedDefinition\n }\n } else if (property.m_def === SubSectionMDef) {\n property.sub_section = await this.resolveDefinition(property.sub_section)\n const subSectionsSectionDef = property.sub_section\n await this._initSection(subSectionsSectionDef)\n subSectionsSectionDef._parentSections.push(sectionDef)\n subSectionsSectionDef._parentSubSections.push(property)\n property._section = sectionDef\n }\n }\n for (const attribute of (sectionDef?.attributes || [])) {\n attribute._parent = sectionDef\n }\n for (const def of sectionDef.quantities) {\n await addNewProperty(def, 'quantities', index)\n }\n for (const def of sectionDef.sub_sections) {\n await addNewProperty(def, 'sub_sections', index)\n }\n\n // Do for all properties (new + inherited)\n for (const property of sectionDef._allProperties) {\n sectionDef._properties[property.name] = property\n }\n\n await this._createAllAttributes(sectionDef)\n }\n\n async _addPackage(pkg, unique_id, pkgParentData, parentProperty, parentIndex) {\n this._packagePrefixCache = null\n pkg.m_def = PackageMDef\n if (unique_id) {\n pkg._unique_id = unique_id\n }\n const packageName = pkg.name || '*'\n this._packageDefs[packageName] = pkg\n for (const alias of pkg?.aliases || []) {\n this._packageDefs[alias] = pkg\n }\n await this._addDef(pkg)\n\n pkg._pkgParentData = pkgParentData\n pkg._parentProperty = parentProperty\n pkg._parentIndex = parentIndex\n pkg._sections = {}\n pkg.category_definitions = pkg.category_definitions || []\n pkg.section_definitions = pkg.section_definitions || []\n for (const categoryDef of pkg.category_definitions) {\n categoryDef.m_def = CategoryMDef\n categoryDef._qualifiedName = `${pkg._unique_id || pkg.name}.${categoryDef.name}`\n categoryDef._package = pkg\n await this._addDef(categoryDef)\n }\n\n let index = 0\n for (const sectionDef of pkg.section_definitions) {\n await this._addSection(pkg, sectionDef, pkg, 'section_definitions', index++)\n }\n }\n\n path(nameOrDef) {\n let def\n if (typeof nameOrDef === 'string') {\n const defsByName = this.getDefsByName()\n def = defsByName[nameOrDef] && defsByName[nameOrDef].find(def => true)\n } else {\n def = nameOrDef\n }\n\n if (!def) {\n return null\n }\n\n if (def.m_def === SubSectionMDef) {\n def = def.sub_section\n }\n\n if (def.m_def === CategoryMDef) {\n return `${def._package.name.split('.')[0]}/category_definitions@${def._qualifiedName}`\n }\n\n const path = []\n const visitedSubSections = new Set()\n while (def) {\n if (def.m_def === SectionMDef) {\n // See if there is a sub-section that uses this section. If there is only one\n // sub-section, we use this sub-section to represent the section def, because\n // typically it is more desirable to show the section within the overall hierarchy\n // than just the section def in its defining package.\n // We also remember visited sub-sections to avoid circles.\n const parentSubSections = def._parentSubSections && def._parentSubSections.filter(\n subSection => !visitedSubSections.has(subSection))\n if (parentSubSections.length === 1) {\n def = parentSubSections[0]\n visitedSubSections.add(def)\n }\n }\n\n if (def._parent?.m_def === PackageMDef) {\n // For package contents, we need to annotate the path segment corresponding to\n // the package adaptor in the Metainfo browser.\n if (def.m_def === SectionMDef) {\n path.push(`section_definitions@${def._qualifiedName}`)\n } else if (def.m_def === CategoryMDef) {\n path.push(`category_definitions@${def._qualifiedName}`)\n }\n } else if (def.m_def === PackageMDef) {\n // For packages, we use only the root package name. This merges you all the\n // sub-pacakges in one. This is just how the Metainfo adaptor hierarchy is setup.\n path.push(def.name.split('.')[0])\n } else {\n path.push(def.name)\n }\n\n if (def._qualifiedName === 'nomad.datamodel.datamodel.EntryArchive') {\n // If definitions are contained in EntryArchive, we adapt to show them below\n // the root section EntryArchive instead of its package nomad.\n path[path.length - 1] = def._qualifiedName\n def = null\n } else {\n def = def._parent\n }\n\n while (def && def.extends_base_section) {\n def = def.base_sections[0]\n }\n }\n return path.reverse().join('/')\n }\n\n async resolveDefinitionList(references) {\n const result = []\n for (const reference of references) {\n result.push(await this.resolveDefinition(reference))\n }\n return result\n }\n\n /**\n * Resolves a reference found inside this metainfo object\n */\n async resolveDefinition(reference, raise = true) {\n if (typeof reference !== 'string') {\n // already resolved\n return reference\n }\n let resolvedUrl\n if (reference.includes('@')) {\n const versionHash = reference.split('@')[1]\n const frozenDef = this._frozenMetainfoCache[versionHash]\n if (frozenDef) {\n // Found in cache\n return frozenDef\n } else {\n // Not found in cache. Fetch it.\n resolvedUrl = resolveNomadUrl(reference, this._parsedUrl)\n await this._getMetainfoAsync(resolvedUrl, raise)\n return this._frozenMetainfoCache[versionHash] // Should now be in the cache\n }\n }\n if (reference.startsWith('#') || reference.startsWith('/')) {\n // Local path reference\n return this.getDefByPath(reference)\n }\n resolvedUrl = resolveNomadUrl(reference, this._parsedUrl)\n if (resolvedUrl.entryId && resolvedUrl.qualifiedName) {\n // Reference to entry metainfo\n const metainfo = await this._getMetainfoAsync(resolvedUrl, raise)\n return metainfo.getDefByQualifiedName(resolvedUrl.qualifiedName)\n } else if (resolvedUrl.qualifiedName) {\n // Reference to the system metainfo, using qualified name\n const systemMetainfo = this._url === systemMetainfoUrl ? this : await this._getMetainfoAsync(systemMetainfoUrl, raise)\n return systemMetainfo.getDefByQualifiedName(resolvedUrl.qualifiedName)\n } else if (resolvedUrl.entryId) {\n // Reference to entry metainfo\n const metainfo = await this._getMetainfoAsync(resolvedUrl, raise)\n return metainfo.getDefByPath(resolvedUrl.path)\n }\n throw new Error(`Bad reference encountered: ${reference}`)\n }\n}\n\n/**\n * Converts a reference given in the /section//subsection format (used\n * in the metainfo) to the /section:/subsection format (used by the\n * archive browser).\n * @param {*} ref The reference to convert.\n */\nexport function refPath(ref) {\n try {\n if (ref.startsWith('#')) {\n ref = ref.slice(1)\n }\n const segments = ref.split('/').filter(segment => segment !== '')\n const reducer = (current, segment) => {\n return isNaN(segment) ? `${current}/${segment}` : `${current}:${segment}`\n }\n return segments.reduce(reducer)\n } catch (e) {\n console.log('could not convert the path: ' + ref)\n throw e\n }\n}\n\nexport function isReference(property) {\n return property.type && (\n property.type.type_kind === 'reference' ||\n property.type.type_kind === 'quantity_reference')\n}\n\n/**\n * @param {*} def A section definition.\n * @returns True, if sections of the given section def are editable.\n */\nexport function isEditable(def) {\n return !!def._allProperties.find(prop => prop.m_annotations?.eln) || !!def.m_annotations?.eln\n}\n\nexport function removeSubSection(section, subSectionDef, index) {\n if (subSectionDef.repeats) {\n section[subSectionDef.name].splice(index, 1)\n } else {\n section[subSectionDef.name] = undefined\n delete section[subSectionDef.name]\n }\n}\n\n/**\n * Given a definition, compute its url (string). Optionally, you can specify relativeTo, an\n * object of the form {deploymentUrl, uploadId, entryId} (containing the first, the two first,\n * or all three atributes, depending on what you want the url to be relative to). If relativeTo\n * is left out, we return an absolute url. You may also specify preferMainfile = true if you\n * want the url to use the mainfile rather than the entryId when possible (more humanly readable).\n */\nexport function getUrlFromDefinition(definition, relativeTo = null, preferMainfile = false) {\n const pkg = definition.m_def === PackageMDef ? definition : definition._package\n const metainfo = pkg._pkgParentData._metainfo\n if (!metainfo._parsedUrl.entryId && relativeTo?.deploymentUrl === metainfo._parsedUrl.deploymentUrl) {\n return definition._qualifiedName\n }\n let parentUrl\n switch (definition.m_def) {\n case PackageMDef: {\n const entryId = metainfo._parsedUrl.entryId\n if (entryId) {\n // Custom metainfo\n let rv\n if (relativeTo) {\n rv = relativizeNomadUrl(\n metainfo._parsedUrl, relativeTo.deploymentUrl, relativeTo.uploadId, relativeTo.entryId)\n } else {\n rv = metainfo._url\n }\n if (preferMainfile) {\n const mainfile = metainfo._data.metadata.mainfile\n rv = rv.replace(`/archive/${entryId}`, `/raw/${urlEncodePath(mainfile)}`)\n }\n return rv\n }\n // System metainfo\n return urlJoin(metainfo._url, 'packages', definition._parentIndex)\n }\n case SectionMDef:\n parentUrl = getUrlFromDefinition(definition._parent, relativeTo, preferMainfile)\n break\n case SubSectionMDef:\n case QuantityMDef:\n parentUrl = getUrlFromDefinition(definition._section, relativeTo, preferMainfile)\n break\n case CategoryMDef:\n parentUrl = getUrlFromDefinition(definition._package, relativeTo, preferMainfile)\n break\n default:\n throw new Error('Could not get url from definition: bad m_def')\n }\n const ref = `${parentUrl}/${definition._parentProperty}`\n if (!isNaN(definition._parentIndex)) {\n return `${ref}/${definition._parentIndex}`\n }\n return ref\n}\n\n/**\n * Given a definition, gets the metainfo object in which it is defined.\n */\nexport function getMetainfoFromDefinition(definition) {\n if (definition._pkgParentData) return definition._pkgParentData._metainfo\n return getMetainfoFromDefinition(definition._package || definition._parent || definition._section)\n}\n\n/**\n * Allows to traverse a given section through all its sub-sections.\n * @param {Object} section The section to traverse\n * @param {Object} definition The definition of the section\n * @param {str} path The archive path to the section\n * @param {function} callback The callback that is called on each section\n */\nexport function traverse(section, definition, path, callback) {\n callback(section, definition, path)\n for (const subSectionDef of definition._allProperties.filter(prop => prop.m_def === SubSectionMDef)) {\n let subSections = []\n if (!subSectionDef.repeats) {\n const subSection = section[subSectionDef.name]\n if (subSection) {\n subSections = [subSection]\n }\n } else {\n subSections = section[subSectionDef.name] || []\n }\n\n subSections.forEach((subSection, index) => {\n let childPath = `${path}/${subSectionDef.name}`\n if (subSectionDef.repeats) {\n childPath = `${childPath}/${index}`\n }\n traverse(subSection, subSectionDef.sub_section, childPath, callback)\n })\n }\n}\n\n/**\n * Generator for efficiently returning all quantities of a section. Note that\n * speed becomes quite important with very large metainfo.\n *\n * @param {Object} definition The definition of the section\n * @param {str} prefix The current path\n * @param {array} branch Container that is populated with with add secion\n * definitions that have been ancountered on a certain path through the\n * metainfo. This information is used for avoiding loops that may be\n * present in the metainfo.\n *\n */\nexport function * getQuantities(definition, prefix, branch, repeats = false) {\n if (!branch) {\n branch = new Set()\n }\n if (definition._allProperties) {\n for (const def of definition._allProperties) {\n const quantityName = prefix ? `${prefix}.${def.name}` : def.name\n if (def.m_def === 'nomad.metainfo.metainfo.Quantity') {\n yield [def, quantityName, repeats || !isEmpty(def.shape)]\n } else {\n yield * getQuantities(def, quantityName, new Set(branch), repeats || def.repeats)\n }\n }\n }\n const sub_section_def = definition.sub_section\n if (sub_section_def) {\n if (branch.has(sub_section_def)) return\n branch.add(sub_section_def)\n yield * getQuantities(sub_section_def, prefix, branch, repeats)\n }\n}\n\n/**\n * Constructs a graph from and with the definition. The graph will contain the given nodes,\n * all its outgoing and incomming references, the parents up to root (for sections and categories)\n *\n * @param {Object} def\n */\nexport function vicinityGraph(def) {\n const nodesMap = {}\n const nodes = []\n const edges = []\n const dx = 100\n const dy = 75\n\n function addEdge(from, to, def) {\n const edge = {\n def: def,\n source: from,\n target: to,\n value: 1\n }\n edges.push(edge)\n }\n\n function addNode(def, more, id) {\n id = id || (d => d._qualifiedName)\n const { recursive, x, y, i } = more || {}\n\n const key = id(def)\n if (nodesMap[key]) {\n return nodesMap[key]\n }\n\n const node = {\n id: key,\n def: def,\n x: x,\n y: y,\n i: i\n }\n\n nodes.push(node)\n nodesMap[key] = node\n\n if (recursive) {\n if (def.m_def === SectionMDef) {\n def._parentSections.forEach(parentSection => {\n const parent = addNode(parentSection, {\n recursive: true,\n x: x - dx,\n y: y,\n i: i + 1\n })\n addEdge(node, parent, {})\n })\n const references = def.quantities.filter(quantity => quantity.type.type_kind === 'reference')\n const layoutMiddle = (references.length - 1) * dx / 2\n const metainfo = getMetainfoFromDefinition(def)\n references.forEach((reference, i) => {\n try {\n const referencedSectionDef = resolveInternalRef(reference.type.type_data, metainfo)\n const referenced = addNode(\n referencedSectionDef,\n { x: x + i * dx - layoutMiddle, y: y + dy, i: i },\n () => reference._qualifiedName)\n addEdge(node, referenced, reference)\n } catch (error) {\n // Ignore for now. External ref?\n }\n })\n } else if (def.m_def === QuantityMDef) {\n const section = addNode(def._section, {\n recursive: true,\n x: x - dx,\n y: y,\n i: i + 1\n })\n addEdge(node, section, {})\n }\n\n if (def.categories) {\n const layoutMiddle = (def.categories.length - 1) * dx / 2\n def.categories.forEach((categoryDef, i) => {\n const category = addNode(categoryDef, {\n recursive: true,\n x: x + i * dx - layoutMiddle,\n y: y - dy,\n i: i\n })\n addEdge(node, category, {})\n })\n }\n }\n\n return node\n }\n\n addNode(def, { recursive: true, x: 0, y: 0, i: 0 })\n\n return {\n nodes: nodes,\n links: edges\n }\n}\n","/* eslint-disable no-unused-vars */\n/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { withStyles, Link } from '@material-ui/core'\nimport { Link as RouterLink } from 'react-router-dom'\nimport extend from '@babel/runtime/helpers/extends'\nimport ReactMarkdown from 'react-markdown'\nimport MathJax from 'react-mathjax'\nimport RemarkMathPlugin from 'remark-math'\nimport remarkGfm from 'remark-gfm'\nimport { useGlobalMetainfo } from './archive/metainfo'\nimport { appBase } from '../config'\n\n/**\n * A simple markdown component.\n *\n * It uses marked with styled 'borrowed' from the materials ui docs system.\n */\n\nconst styles = theme => {\n return {\n root: {\n fontFamily: theme.typography.fontFamily,\n fontSize: 16,\n color: theme.palette.text.primary,\n '& .anchor-link': {\n marginTop: -96,\n // Offset for the anchor.\n position: 'absolute'\n },\n '& pre, & pre[class*=\"language-\"]': {\n margin: '24px 0',\n padding: '12px 18px',\n backgroundColor: theme.palette.primary.veryLight,\n borderRadius: theme.shape.borderRadius,\n overflow: 'auto',\n WebkitOverflowScrolling: 'touch' // iOS momentum scrolling.\n\n },\n '& code': {\n display: 'inline-block',\n lineHeight: 1,\n fontFamily: 'Consolas, \"Liberation Mono\", Menlo, Courier, monospace',\n padding: '5px 4px 2px 4px',\n color: theme.palette.text.primary.dark,\n backgroundColor: theme.palette.primary.veryLight,\n borderRadius: theme.shape.borderRadius,\n fontSize: 14\n },\n '& p code, & ul code': {\n fontSize: 14\n },\n '& pre code': {\n fontSize: 14,\n lineHeight: 1.6\n },\n '& p:first-child': {\n marginTop: 0\n },\n '& p:last-child': {\n marginBottom: 0\n },\n '& h1': (0, extend)({}, theme.typography.h3, {\n color: theme.palette.text.primary,\n margin: '32px 0 16px'\n }),\n '& .description': (0, extend)({}, theme.typography.h5, {\n margin: '0 0 40px'\n }),\n '& h2': (0, extend)({}, theme.typography.h4, {\n color: theme.palette.text.primary,\n margin: '32px 0 24px'\n }),\n '& h3': (0, extend)({}, theme.typography.h5, {\n color: theme.palette.text.primary,\n margin: '32px 0 24px'\n }),\n '& h4': (0, extend)({}, theme.typography.h6, {\n color: theme.palette.text.primary,\n margin: '24px 0 16px'\n }),\n '& p, & ul, & ol': {\n lineHeight: theme.typography.lineHeight,\n marginBottom: theme.spacing(1)\n },\n '& ul': {\n paddingLeft: theme.spacing(4),\n '& li': {\n listStyleType: 'square',\n fontSize: 'inherit'\n }\n },\n '& h1, & h2, & h3, & h4': {\n '& code': {\n fontSize: 'inherit',\n lineHeight: 'inherit',\n // Remove scroll on small screens.\n wordBreak: 'break-word'\n },\n '& .anchor-link-style': {\n opacity: 0,\n // To prevent the link to get the focus.\n display: 'none'\n },\n '&:hover .anchor-link-style': {\n display: 'inline-block',\n opacity: 1,\n padding: '0 8px',\n color: theme.palette.text.hint,\n '&:hover': {\n color: theme.palette.text.secondary\n },\n '& svg': {\n width: '0.55em',\n height: '0.55em',\n fill: 'currentColor'\n }\n }\n },\n '& table': {\n width: '100%',\n display: 'block',\n overflowX: 'auto',\n WebkitOverflowScrolling: 'touch',\n // iOS momentum scrolling.\n borderCollapse: 'collapse',\n borderSpacing: 0,\n overflow: 'hidden',\n '& .prop-name': {\n fontSize: 13,\n fontFamily: 'Consolas, \"Liberation Mono\", Menlo, monospace'\n },\n '& .required': {\n color: theme.palette.type === 'light' ? '#006500' : '#9bc89b'\n },\n '& .prop-type': {\n fontSize: 13,\n fontFamily: 'Consolas, \"Liberation Mono\", Menlo, monospace',\n color: theme.palette.type === 'light' ? '#932981' : '#dbb0d0'\n },\n '& .prop-default': {\n fontSize: 13,\n fontFamily: 'Consolas, \"Liberation Mono\", Menlo, monospace',\n borderBottom: '1px dotted '.concat(theme.palette.text.hint)\n }\n },\n '& thead': {\n fontSize: 14,\n fontWeight: theme.typography.fontWeightMedium,\n color: theme.palette.text.secondary\n },\n '& tbody': {\n fontSize: 14,\n lineHeight: 1.5,\n color: theme.palette.text.primary\n },\n '& td': {\n borderBottom: '1px solid '.concat(theme.palette.divider),\n padding: '8px 16px 8px 8px',\n textAlign: 'left'\n },\n '& td:last-child': {\n paddingRight: 24\n },\n '& td compact': {\n paddingRight: 24\n },\n '& td code': {\n fontSize: 13,\n lineHeight: 1.6\n },\n '& th': {\n whiteSpace: 'pre',\n borderBottom: '1px solid '.concat(theme.palette.divider),\n fontWeight: theme.typography.fontWeightMedium,\n padding: '0 16px 0 8px',\n textAlign: 'left'\n },\n '& th:last-child': {\n paddingRight: 24\n },\n '& tr': {\n height: 48\n },\n '& thead tr': {\n height: 64\n },\n '& strong': {\n fontWeight: theme.typography.fontWeightMedium\n },\n '& blockquote': {\n borderLeft: '5px solid '.concat(theme.palette.text.hint),\n backgroundColor: theme.palette.background.paper,\n padding: '4px 24px',\n margin: '24px 0'\n },\n '& a, & a code': {\n // Style taken from the Link component\n color: theme.palette.primary.main,\n textDecoration: 'none',\n '&:hover': {\n textDecoration: 'underline'\n }\n },\n '& img': {\n maxWidth: '100%'\n }\n }\n }\n}\n\nfunction MarkdownLink({href, ...props}) {\n if (href.match(/^https?:\\/\\//) || href.startsWith(appBase)) {\n return \n } else {\n return \n }\n}\nMarkdownLink.propTypes = {\n href: PropTypes.string.isRequired\n}\n\nfunction Markdown(props) {\n const { classes, text, children, ...moreProps } = props\n const globalMetainfo = useGlobalMetainfo()\n\n let content = text\n if (children) {\n const state = []\n // We modify the children for the following reasons:\n // - remove unnecessary whitespaces that might break the markdown layout\n // - escape _ (usually in metainfo names) with sensitivity to _ used in latex math\n // - put metainfo names into code quotes\n // - turn metainfo names into links into the metainfo\n let word = ''\n const letters = children.replace(/^ +/gm, '').split('')\n content = letters.map((c, i) => {\n if (c === '`' || c === '$') {\n if (state.peek === c) {\n state.pop()\n } else {\n state.push(c)\n }\n }\n\n if (c === '[') {\n state.push(c)\n }\n if (c === ']' && state.peek === '[') {\n state.pop()\n }\n\n if (c.match(/[a-zA-Z0-9_]/)) {\n word += c\n if (letters.length - 1 === i) {\n return word\n }\n } else {\n if (state.length === 0 && (word.match(/_/g) || word.match(/[a-z]+[A-Z]/g)) && word.match(/^[a-zA-Z0-9_]+$/g) && c !== ']') {\n const path = globalMetainfo?.path(word)\n if (path) {\n word = `[\\`${word}\\`](/metainfo/${path})`\n } else if (word.includes('_')) {\n word = `\\`${word}\\``\n }\n }\n const result = word + c\n word = ''\n return result\n }\n return ''\n }).join('')\n }\n\n const math = ({value}) => \n const inlineMath = ({value}) => \n const newProps = {\n ...moreProps,\n children: content,\n remarkPlugins: [\n RemarkMathPlugin,\n remarkGfm\n ],\n components: {\n ...moreProps.components,\n math: math,\n inlineMath: inlineMath,\n a: props => \n }\n }\n const md = (\n \n \n \n )\n\n return (\n
{md}
\n )\n}\n\nMarkdown.propTypes = {\n classes: PropTypes.object.isRequired,\n text: PropTypes.string,\n children: PropTypes.string\n}\n\nexport default withStyles(styles)(Markdown)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { forwardRef, useCallback, useState } from 'react'\nimport { Button, IconButton, Dialog, DialogTitle, DialogContent, DialogActions } from '@material-ui/core'\nimport Markdown from './Markdown'\nimport PropTypes from 'prop-types'\nimport HelpIcon from '@material-ui/icons/Help'\n\nexport const HelpButton = forwardRef(({heading, content, text, maxWidth, IconProps, children, ...IconButtonProps}, ref) => {\n const [open, setOpen] = useState(false)\n const handleToggleOpen = useCallback(() => {\n setOpen(old => !old)\n IconButtonProps?.onClick?.()\n }, [IconButtonProps])\n\n return <>\n \n {children || }\n \n \n \n})\n\nHelpButton.propTypes = {\n heading: PropTypes.string,\n content: PropTypes.string,\n text: PropTypes.string,\n maxWidth: PropTypes.string,\n IconProps: PropTypes.object,\n children: PropTypes.node\n}\n\nconst HelpDialog = ({heading, content, text, maxWidth, open, onClose}) => {\n return \n {heading || 'Help'}\n \n {content}\n \n \n \n \n \n}\n\nHelpDialog.propTypes = {\n heading: PropTypes.string,\n content: PropTypes.string,\n text: PropTypes.string,\n maxWidth: PropTypes.string,\n open: PropTypes.bool,\n onClose: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Button, Tooltip } from '@material-ui/core'\n\n/** A button wrapped in a tooltip. All further props are forwarded to the button component. */\nconst TooltipButton = React.forwardRef(function TooltipButton(props, ref) {\n const {title, component, ...moreProps} = props\n const button = React.createElement(component || Button, {...moreProps, ref: ref})\n return \n {button}\n \n})\nTooltipButton.propTypes = {\n /** The tooltip title. */\n title: PropTypes.string.isRequired,\n /** The button component. Default is MUI Button. */\n component: PropTypes.elementType,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nexport default TooltipButton\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext, useRef, useState, useMemo, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { isNil, isEmpty, isFunction } from 'lodash'\nimport { IconButton, makeStyles, lighten, TableHead, TableRow, TableCell, TableSortLabel,\n Checkbox, TableContainer, Table, TableBody, TablePagination, Box, Collapse, Toolbar, Typography,\n List, ListItem, ListItemText, Popover, CircularProgress, Button, Tooltip } from '@material-ui/core'\nimport TooltipButton from '../utils/TooltipButton'\nimport EditColumnsIcon from '@material-ui/icons/ViewColumn'\nimport InfiniteScroll from 'react-infinite-scroller'\nimport {capitalize} from \"../../utils\"\n\nconst DatatableContext = React.createContext({})\nconst StaticDatatableContext = React.createContext({})\n\n/**\n * Combines a pagination request object with an reponse object. This allows to create\n * pagination object as they are expected by Datatable.\n *\n * @param {object} request The request pagination object (i.e. without total, next_page_afte_value, etc.)\n * @param {object} response The response pagination object (returned by NOMAD API)\n * @returns The combined pagination object.\n */\nexport function combinePagination(request, response) {\n const result = {\n page_size: request.page_size || response?.page_size,\n order_by: response.order_by || request?.order_by,\n order: request.order || response?.order,\n page: request.page || response?.page,\n total: response?.total\n }\n\n if (!result.page) {\n result.page_after_value = request.page_after_value || response?.page_after_value\n result.next_page_after_value = response?.next_page_after_value\n }\n\n return result\n}\n\n/**\n * Ensures that all given columns have default values for necessary keys.\n * @param {array} columns An array of columns to extend/check.\n * @param {object} moreDefaults Object containing additional default values\n * @param {object} filterData Object that contains quantity/Filter pairs\n */\nexport function addColumnDefaults(columns, moreDefaults, filterData) {\n columns.forEach(column => {\n if (moreDefaults) {\n Object.keys(moreDefaults).filter(key => !column[key]).forEach(key => { column[key] = moreDefaults[key] })\n }\n if (!column.label) {\n const keySegments = column.key.split('.')\n const name = keySegments[keySegments.length - 1]\n column.label = name.replace(/_/g, ' ')\n column.label = column.label[0].toUpperCase() + column.label.slice(1)\n }\n if (!column.render) {\n const segments = column.key.split('.')\n column.render = (row) => segments.reduce((current, segment) => current && current[segment], row)\n }\n if (column.sortable !== false) {\n column.sortable = true\n }\n const multiple = !isEmpty(filterData?.[column.key]?.shape)\n if (multiple) {\n column.sortable = false\n } else if (isNil(column.sortable)) {\n column.sortable = !multiple\n }\n if (!column.align) {\n column.align = 'center'\n }\n if (!column.description) {\n column.description = filterData?.[column.key]?.description\n }\n })\n}\n\nfunction useDatatableContext() {\n const context = useContext(DatatableContext)\n return context\n}\n\nfunction useStaticDatatableContext() {\n const context = useContext(StaticDatatableContext)\n return context\n}\n\n/** The page based table pagination. Must be a child of DatatableTable component. */\nexport const DatatablePagePagination = React.memo(function DatatablePagePagination({pageSizeValues}) {\n const {pagination, onPaginationChanged} = useDatatableContext()\n\n const handleChangePage = (event, newPage) => {\n onPaginationChanged({\n ...pagination,\n page: newPage + 1\n })\n }\n\n const handleChangeRowsPerPage = (event) => {\n onPaginationChanged({\n ...pagination,\n page: 1,\n page_size: parseInt(event.target.value, 10)\n })\n }\n\n return \n})\nDatatablePagePagination.propTypes = {\n /** Optional array of selectable page size values. Default is [5, 10, 50, 100]. */\n pageSizeValues: PropTypes.arrayOf(PropTypes.number)\n}\n\nconst useDatatableLoadMorePaginationStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(1),\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap'\n }\n}))\n\n/** Pagination that uses a \"load more button\" if more data is available. */\nexport const DatatableLoadMorePagination = React.memo(function DatatableLoadMorePagination(props) {\n const classes = useDatatableLoadMorePaginationStyles()\n const {pagination, onPaginationChanged} = useDatatableContext()\n\n const handleClick = useCallback(() => {\n onPaginationChanged({\n ...pagination,\n page_after_value: pagination.next_page_after_value\n })\n }, [pagination, onPaginationChanged])\n\n if (pagination.next_page_after_value) {\n if (pagination.page_after_value === pagination.next_page_after_value) {\n return
\n \n
\n }\n\n return
\n \n
\n }\n\n return null\n})\nDatatableLoadMorePagination.propTypes = {}\n\nconst useDateatableScollPaginationStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(2),\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n fontWeight: 'bold',\n '& > *': {\n paddingLeft: theme.spacing(1)\n }\n }\n}))\n\n/** The scroll based table pagination. Must be a child of DatatableTable component. */\nexport const DatatableScrollPagination = React.memo(function DatatablePagePagination({loadMessage}) {\n const {pagination} = useDatatableContext()\n const classes = useDateatableScollPaginationStyles()\n if (pagination.next_page_after_value && (pagination.next_page_after_value === pagination.page_after_value)) {\n return
\n \n {loadMessage || 'oading more items ...'}\n
\n } else {\n return null\n }\n})\nDatatableScrollPagination.propTypes = {\n loadMessage: PropTypes.string\n}\n\nconst useDatatableHeaderStyles = makeStyles(theme => ({\n root: {},\n visuallyHidden: {\n border: 0,\n clip: 'rect(0 0 0 0)',\n height: 1,\n margin: -1,\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n top: 20,\n width: 1\n },\n stickyHeader: {\n background: '#fff'\n }\n}))\n\nconst DatatableHeader = React.memo(function DatatableHeader({actions}) {\n const classes = useDatatableHeaderStyles()\n const {withSelectionFeature, multiSelect} = useStaticDatatableContext()\n const {\n selected,\n onSelectedChanged,\n shownColumns,\n sortingColumns,\n pagination,\n onPaginationChanged\n } = useDatatableContext()\n const columns = shownColumns\n const {order, order_by} = pagination\n const withSorting = !!onPaginationChanged\n\n const handleSelectAllChanged = () => {\n if (selected === 'all') {\n onSelectedChanged(new Set())\n } else {\n onSelectedChanged('all')\n }\n }\n\n const createSortHandler = (column) => (event) => {\n const isAsc = order_by === column.key && order === 'asc'\n onPaginationChanged?.({\n ...pagination,\n order: isAsc ? 'desc' : 'asc',\n order_by: column.key\n })\n }\n\n const sortableColumns = useMemo(() => {\n if (sortingColumns) {\n return sortingColumns\n } else {\n return columns.filter(column => column.sortable).map(column => column.key)\n }\n }, [sortingColumns, columns])\n\n return \n \n {withSelectionFeature && multiSelect && \n 0 && selected !== 'all'}\n checked={selected === 'all'}\n onChange={handleSelectAllChanged}\n />\n }\n {columns.map(column => {\n const label = column.label || capitalize(column.key)\n const description = column.description || ''\n const columnLabel = \n {label}\n \n return \n {withSorting && sortableColumns.includes(column.key) ? \n {columnLabel}\n {order_by === column.key ? (\n \n {order === 'desc' ? 'sorted descending' : 'sorted ascending'}\n \n ) : null}\n : columnLabel}\n \n })}\n {actions && }\n \n \n})\nDatatableHeader.propTypes = {\n actions: PropTypes.oneOfType([\n PropTypes.elementType,\n PropTypes.func\n ])\n}\n\nconst useDatatableRowStyles = makeStyles(theme => ({\n // The default transparent hover/selection colors are overridden here in order\n // to make the last actions column work with a 'sticky' positioning.\n row: {\n backgroundColor: '#fff'\n },\n rowHover: {\n '&:hover': {\n backgroundColor: '#f5f5f5 !important'\n }\n },\n rowSelected: {\n backgroundColor: `${lighten(theme.palette.secondary.light, 0.85)} !important`,\n '&:hover': {\n backgroundColor: `${lighten(theme.palette.secondary.light, 0.85)} !important`\n }\n },\n rowWithDetails: {\n '& > *': {\n borderBottom: 'unset'\n }\n },\n rowWithUncollapsedDetails: {\n backgroundColor: `${theme.palette.primary.main} !important`,\n '&:hover': {\n backgroundColor: `${theme.palette.primary.main} !important`\n },\n '& *': {\n fontWeight: 'bold',\n color: `${theme.palette.primary.contrastText} !important`\n }\n },\n rowClickable: {\n cursor: 'pointer'\n },\n rowActionsCell: {\n textAlign: 'right',\n width: 1,\n whiteSpace: 'nowrap',\n paddingTop: 0,\n paddingBottom: 0,\n position: 'sticky',\n right: 0,\n backgroundColor: 'inherit'\n },\n rowActionsList: {\n display: 'flex'\n },\n detailsCell: {\n padding: 0\n }\n}))\n\nconst DatatableRow = React.memo(function DatatableRow({data, selected, uncollapsed, onRowUncollapsed, actions, details, progressIcon}) {\n const classes = useDatatableRowStyles()\n const {withSelectionFeature, multiSelect, getId, shownColumns, onSelectedChanged} = useStaticDatatableContext()\n const columns = shownColumns\n const row = data\n const numberOfColumns = columns.length + (withSelectionFeature && multiSelect ? 1 : 0) + (actions ? 1 : 0)\n\n const handleRowCollapseChange = (event) => {\n onRowUncollapsed(uncollapsed ? null : row)\n }\n\n const handleSelect = onSelectedChanged ? (event) => {\n event.stopPropagation()\n onSelectedChanged(selected => {\n if (multiSelect) {\n if (selected === 'all') {\n return new Set([getId(row)])\n }\n const isSelected = selected.has(getId(row))\n if (isSelected) {\n selected.delete(getId(row))\n return new Set(selected)\n } else {\n selected.add(getId(row))\n return new Set(selected)\n }\n } else {\n return new Set([getId(row)])\n }\n })\n } : null\n\n return <>\n \n {withSelectionFeature && multiSelect && \n {progressIcon || }\n }\n {columns.map(column => \n {(column?.render && column?.render(row)) || row[column.key] || ''}\n )}\n {actions && event.stopPropagation()}\n >\n
\n {isFunction(actions)\n ? actions(row)\n : React.createElement(actions, {data: row})\n }\n
\n }\n \n {details && \n \n \n {React.createElement(details, {data: row})}\n \n \n }\n \n})\nDatatableRow.propTypes = {\n data: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired,\n selected: PropTypes.bool,\n uncollapsed: PropTypes.bool,\n onRowUncollapsed: PropTypes.func.isRequired,\n actions: PropTypes.oneOfType([PropTypes.elementType, PropTypes.func]),\n details: PropTypes.elementType,\n progressIcon: PropTypes.node\n}\n\nconst useDatatableTableStyles = makeStyles(theme => ({\n tableContainer: {\n flexGrow: 1\n }\n}))\n\n/** The actional table, including pagination. Must be child of a Datatable component. */\nexport const DatatableTable = React.memo(function DatatableTable({children, actions, details, noHeader, defaultUncollapsedRow}) {\n const classes = useDatatableTableStyles()\n const {withSelectionFeature, multiSelect, getId} = useStaticDatatableContext()\n const {shownColumns, data, pagination, onPaginationChanged, selected} = useDatatableContext()\n const {page_size} = pagination\n const emptyRows = Math.max(0, page_size - data.length)\n const columns = shownColumns\n const numberOfColumns = columns.length + (withSelectionFeature && multiSelect ? 1 : 0) + (actions ? 1 : 0)\n const isScrolling = children?.type === DatatableScrollPagination\n const isExtending = children?.type === DatatableScrollPagination || children?.type === DatatableLoadMorePagination\n const scrollParentRef = useRef(null)\n\n const [uncollapsedRow, setUncollapsedRow] = useState(defaultUncollapsedRow || null)\n\n const handleLoadMore = useCallback(() => {\n onPaginationChanged(pagination => {\n const {next_page_after_value, page_after_value} = pagination\n if (next_page_after_value && page_after_value !== next_page_after_value) {\n return {\n ...pagination,\n page_after_value: next_page_after_value\n }\n } else {\n return pagination\n }\n })\n }, [onPaginationChanged])\n\n let dataToShow\n if (isExtending) {\n // If list extends, all data is rendered regardless of pagination.\n dataToShow = data\n } else {\n // If used correctly, data should give given to Datatable already correctly sliced.\n // We simply enforce that data is not longer than page_size, just in case.\n dataToShow = data.slice(data.length < pagination.page_size ? 0 : data.length - pagination.page_size)\n }\n\n const table = \n {!noHeader && }\n \n {dataToShow.map((row, index) => (\n }\n />\n ))}\n {!isExtending && (emptyRows > 0) && (\n \n \n \n )}\n \n \n
\n\n return \n {isScrolling ? (\n scrollParentRef.current}\n >\n {table}\n \n ) : (\n table\n )}\n {children}\n \n})\nDatatableTable.propTypes = {\n /** Objectal render function or component for row details. Function and component\n * get row object as \"data\" prop. */\n details: PropTypes.elementType,\n /** Objectal render function or component for row actions. Function and component\n * get row object as \"data\" prop. */\n actions: PropTypes.oneOfType([PropTypes.elementType, PropTypes.func]),\n /** Do not show the table header */\n noHeader: PropTypes.bool,\n /** Optional pagination component, e.g. DatatablePagePagination. */\n children: PropTypes.node,\n /** Optional props to set a row be uncollapsed by default */\n defaultUncollapsedRow: PropTypes.object\n}\n\n/** Actions displayed in a DatatableToolbar. Must be child of a DatatableToolbar. */\nexport const DatatableToolbarActions = React.memo(function DatatableToolbarActions({children, selection}) {\n const {selected} = useDatatableContext()\n\n const hasSelection = selected === 'all' || selected?.size > 0\n if ((hasSelection && selection) || (!hasSelection && !selection)) {\n return \n {children}\n \n }\n\n return null\n})\nDatatableToolbarActions.propTypes = {\n /** If true, this component is only shown if the surrounding table as an active selection. */\n selection: PropTypes.bool,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nconst useDatatableToolbarStyles = makeStyles(theme => ({\n root: {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(1)\n },\n highlight: {\n color: theme.palette.secondary.main,\n backgroundColor: lighten(theme.palette.secondary.light, 0.85),\n '& *': {\n color: theme.palette.secondary.main\n }\n },\n title: {\n flex: '1 1 100%',\n fontSize: '1.1rem'\n }\n}))\n\n/** A toolbar shown on top of tables. It shows a title, general table actions, and actions\n * on selected rows. Must be child of a Datatable */\nexport const DatatableToolbar = React.memo(function DatatableToolbar({children, title, hideColumns}) {\n const classes = useDatatableToolbarStyles()\n const {multiSelect} = useStaticDatatableContext()\n const {selected} = useDatatableContext()\n return (\n 0 && multiSelect\n })}\n >\n {selected?.length > 0 && multiSelect ? (\n \n {selected === 'all' ? 'All' : selected.length} selected\n \n ) : (\n \n {title || ''}\n \n )}\n {children}\n {!hideColumns && !(selected?.length > 0) && }\n \n )\n})\nDatatableToolbar.propTypes = {\n /** Optional table title */\n title: PropTypes.string,\n hideColumns: PropTypes.bool,\n /** Children, e.g. DatatableToolbarActions for general and selection actions. */\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nconst DatatableColumnSelector = React.memo(function DatatableColumnSelector({children}) {\n const [anchorEl, setAnchorEl] = useState(null)\n const {columns, shownColumns, onShownColumnsChanged} = useDatatableContext()\n\n const handleToggle = (column) => {\n const index = shownColumns.indexOf(column)\n if (index > -1) {\n onShownColumnsChanged([...shownColumns.slice(0, index), ...shownColumns.slice(index + 1)])\n } else {\n onShownColumnsChanged([...shownColumns, column])\n }\n }\n return \n setAnchorEl(anchorEl ? null : event.currentTarget)}\n >\n \n \n setAnchorEl(null)}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center'\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center'\n }}\n data-testid={'column-select-menu'}\n >\n \n {columns.map(column => handleToggle(column)}\n >\n \n \n )}\n \n \n \n})\nDatatableColumnSelector.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\n/** A table with optional header, selectable rows, actions on table, selection, or rows,\n * foldable row details, sortable coluns, editable columns, and pagination.\n * Table is based on array data with row objects and matching speficiation of columns.\n */\nexport const Datatable = React.memo(function Datatable(props) {\n const {children, multiSelect, getId, ...contextProps} = props\n const {data, columns} = contextProps\n\n const [shownColumns, setShownColumns] = useState(\n props.shownColumns ? columns.filter(column => props.shownColumns.includes(column.key)) : columns\n )\n const withSelectionFeature = !!contextProps.selected\n const shownColumnsObjects = useMemo(() => (\n columns.filter(column => shownColumns.map(shownColumn => shownColumn.key).includes(column.key))\n ), [columns, shownColumns])\n\n const context = {\n pagination: {\n page: 1,\n page_size: data.length,\n total: data.length\n },\n ...contextProps,\n shownColumns: shownColumnsObjects,\n onShownColumnsChanged: setShownColumns\n }\n\n const staticContext = useMemo(() => ({\n withSelectionFeature: withSelectionFeature,\n multiSelect: multiSelect,\n getId: getId,\n shownColumns: shownColumnsObjects,\n onSelectedChanged: props.onSelectedChanged\n }), [\n shownColumnsObjects,\n withSelectionFeature,\n getId,\n multiSelect,\n props.onSelectedChanged])\n\n return \n \n \n {children || }\n \n \n \n})\nconst paginationBaseProps = {\n page_size: PropTypes.number,\n total: PropTypes.number,\n order: PropTypes.oneOf(['asc', 'desc']),\n order_by: PropTypes.string\n}\n\nconst selected = function(props, propName, componentName) {\n const value = props[propName]\n if ((typeof value === 'string' && (value === 'all' || value === 'All')) || value instanceof Set) {\n if (value && !props['getId']) {\n throw new Error(`${componentName} requires 'getId' property when using '${propName}' property.`)\n }\n } else if (!isNil(value)) {\n throw new Error(`Invalid props passed to the ${componentName}. '${propName}' accepts 'all' or a Set() of string IDs.`)\n }\n}\n\nDatatable.propTypes = {\n /** Specification for all possible column. */\n columns: PropTypes.arrayOf(PropTypes.shape({\n /** Unique key for this column. Should be the row object key for this columns value.\n * Also used as order_by value. */\n key: PropTypes.string.isRequired,\n /** Optional human readible label. Default is key. */\n label: PropTypes.string,\n /** Optional human readible description. */\n description: PropTypes.string,\n /** If this columns should be sortable. */\n sortable: PropTypes.bool,\n /** The alignment of header and values. Default is right. */\n align: PropTypes.oneOf(['right', 'left', 'center']),\n /** Optional value render function. Default will render value taken from row object by\n * columns key. */\n render: PropTypes.func\n })),\n /** Optional array of column keys. Only those columns will be visible. Default is to\n * show all columns */\n shownColumns: PropTypes.arrayOf(PropTypes.string),\n sortingColumns: PropTypes.arrayOf(PropTypes.string),\n /** Optional table data as array of objects. Default is empty table. */\n data: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.object, PropTypes.string])),\n /** Optional pagination object (e.g. from NOMAD API). Used to display current pagination\n * and ordering information. Either based on page (if using DatatablePagePagination) or\n * page_after_value (if using DatatableScrollPagination). */\n pagination: PropTypes.oneOfType([\n PropTypes.shape({\n ...paginationBaseProps,\n next_page_after_value: PropTypes.number,\n page_after_value: PropTypes.number\n }),\n PropTypes.shape({\n ...paginationBaseProps,\n page: PropTypes.number\n })\n ]),\n /** Optional callback to on pagination changes (page, page size, order, ...). Function\n * that takes new pagination object as parameter. */\n onPaginationChanged: PropTypes.func,\n /** Optional value for selected rows to show. It is either the string \"all\" or\n * an array of selected row objects. If same object, row is shown as\n * selected. If no value is given, the table will not show any selection boxes. */\n selected: selected,\n /** A function to get a unique id or key from the provided rows. Required if selected is provided. */\n getId: PropTypes.func,\n multiSelect: PropTypes.bool,\n /** Optional callback for selection changes. Takes either \"all\" or new array of\n * selected row objects as parameter. */\n onSelectedChanged: PropTypes.func,\n /** Children, e.g. DatatableToolbar and DatatableTable */\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nDatatable.defaultProps = {\n multiSelect: true\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Tooltip } from '@material-ui/core'\nimport PublishedIcon from '@material-ui/icons/Public'\nimport PrivateIcon from '@material-ui/icons/AccountCircle'\nimport SharedIcon from '@material-ui/icons/SupervisedUserCircle'\nimport VisibleIcon from '@material-ui/icons/Visibility'\nimport NotVisibleIcon from '@material-ui/icons/VisibilityOff'\nimport { isUploadVisibleForAll } from '../../utils'\n\n/**\n * Used to display the status of an Upload. Can work both with upload data and\n * entry data which have different data models.\n */\nconst UploadStatusIcon = React.memo(({data, user, ...props}) => {\n const coauthors = data?.coauthors || data?.authors?.map(user => user.user_id)\n const reviewers = data?.reviewers || data?.viewers?.map(user => user.user_id)\n const isVisibleForAll = isUploadVisibleForAll(data)\n const shared = data?.coauthors?.length > 0 || data?.reviewers?.length > 0 || data?.viewers?.length > 1\n const isMainAuthor = user && (data.main_author?.user_id === user.sub || data.main_author === user.sub)\n const isReviewer = user && reviewers?.find(user_id => user_id === user.sub)\n const isCoauthor = user && coauthors?.find(user_id => user_id === user.sub)\n let Icon = isVisibleForAll ? VisibleIcon : shared ? SharedIcon : PrivateIcon\n\n let tooltip, color, role\n if (!data) {\n tooltip = 'Upload status not available'\n color = 'action'\n } else if (data.published) {\n if (data.with_embargo) {\n color = 'error'\n if (isMainAuthor) {\n tooltip = \"Published with embargo by you and only accessible by you, coauthors and reviewers\"\n } else if (isCoauthor) {\n tooltip = \"Published with embargo and accessible by you as a coauthor\"\n } else if (isReviewer) {\n tooltip = \"Published with embargo and accessible by you as a reviewer\"\n } else {\n Icon = NotVisibleIcon\n if (user) {\n tooltip = \"Published with embargo and not accessible by you\"\n } else {\n tooltip = \"Published with embargo and might become accessible after login\"\n }\n }\n } else {\n role = 'published-upload-icon'\n tooltip = \"Published and accessible by everyone\"\n Icon = PublishedIcon\n color = 'primary'\n }\n } else {\n if (isVisibleForAll) {\n tooltip = \"Unpublished but accessible by everyone\"\n } else if (isMainAuthor) {\n tooltip = \"Unpublished, accessible by you, coauthors and reviewers\"\n } else if (isCoauthor) {\n tooltip = \"Unpublished, accessible by you as a coauthor\"\n } else if (isReviewer) {\n tooltip = \"Unpublished, accessible by you as a reviewer\"\n } else {\n tooltip = \"Unpublished\"\n }\n color = 'error'\n }\n\n return \n \n \n})\nUploadStatusIcon.propTypes = {\n data: PropTypes.object, // The upload/entry data\n user: PropTypes.object // The user object from API\n}\n\nexport default UploadStatusIcon\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { isNil, isArray, isEmpty } from 'lodash'\nimport { searchQuantities } from '../../config'\nimport {\n getDatatype,\n getSerializer,\n getDeserializer,\n getDisplayLabel,\n DType,\n multiTypes\n} from '../../utils'\nimport { Unit } from '../units/Unit'\n\n/**\n * Filter is a wrapper for metainfo (quantity or section) that can be searched.\n * It contains information extracted from the metainfo together with additional\n * configuration that can e.g. be extracted from the NOMAD configuration file.\n */\nexport class Filter {\n options\n aggs\n value\n placeholder\n multiple\n exclusive\n unit\n dtype\n customSerialization\n serializerExact\n serializerPretty\n dimension\n deserializer\n label\n nested\n aggregatable\n section\n repeats\n widget\n parent\n description\n scale\n /**\n * @param {obj} def Metainfo definition. Optional as filters may not\n * correspond to metainfo items.\n * @param {obj} params Contains configuration for the filter.\n * - dtype: The data type for this filter. If no value is given and the\n * name corresponds to a metainfo name the data type is read directly from\n * the metainfo.\n * - description: Description of the filter shown e.g. in the tooltips. If no\n * value is given and the name corresponnds to a metainfo, the metainfo\n * description is used.\n * - unit: The unit for this filter. If no value is given and the name\n * corresponds to a metainfo name the data type is read directly from the\n * metainfo.\n * - label: Short name displayed for this filter. If no value is given and the\n * name corresponds to a metainfo name the description is read directly\n * from the metainfo.\n * - quantity: The quantity that this filter targets in the metainfo.\n * - schema: The schema in which the filter quantity is defined in\n * - placeholder: Placeholder displayed for this filter in input fields.\n * - multiple: Whether the user can simultaneously provide multiple values for\n * this filter.\n * - exclusive: Whether this filter is exclusive: only one value is\n * associated with a single entry.\n * - queryMode: The default query mode (e.g. 'any', 'all) when multiple values\n * can specified for this filter. Defaults to 'any'.\n * - options: Object containing explicit options that this filter supports.\n * - default: A default value which is implicitly enforced in the API call.\n * This value will not be serialized in the search bar.\n * - scale: The default scaling to perform for filter statistics.\n * - value: Optional object containing a custom setter/getter for the filter value.\n * Used when transforming the value from GUI to API and vice versa. E.g.\n * value = {\n * get: (value) => value\n * set: (value) => value\n * }\n * - aggs: Object containing default values for specific aggregation types\n * that may be requested for this filter.\n * Also completely customized setter/getter methods are supported. E.g.\n * aggs = {\n * terms: {size: 5},\n * histogram: {buckets: 20},\n * min_max: {set: (config) => ({}), get: (agg) => ({})}\n * }\n * - requestQuantity: Optional name to use for this quantity in the final API call.\n * - nested: Provided for sections, determines whether they are configured as\n * nested field types in ES.\n * - repeats: Provided for sections, determines whether they can be repeated.\n * - global: Whether this is a 'global' filter. Global filters can affect the\n * behaviour of other filters without being serialized into the query\n * itself. E.g. toggling the exclusive search for elements is a global\n * filter that does not correspond to any metainfo and only affects how\n * the element search is performed.\n * - customSerialization:\n * - serializerExact: Function that serializes the value of the filter in an exact way.\n * Used to e.g. serialize the filter value for the URL.\n * - serializerPretty: Function that serializes the value for displaying it in the GUI.\n * May e.g. contain less decimals and not be serializable in the URL.\n * - deserializer: Function that deserializes the value from the URL and from\n * user input.\n * - aggregatable: Indicates whether this filter can be used in term aggregations.\n * - widget: Object that determines the default widget for this filter.\n * @param {Filter} parent Optional parent filter\n */\n constructor(def, params, parent) {\n this.def = def\n this.name = params?.name || def?.name\n this.quantity = params?.quantity || def?.quantity\n this.schema = params?.schema || def?.schema\n\n function getRepeatsSection(def) {\n return isNil(def?.repeats)\n ? false\n : def.repeats\n }\n function getRepeatsQuantity(def) {\n if (!isEmpty(def?.shape)) return true\n return getRepeatsSection(def)\n }\n\n this.dtype = params?.dtype || getDatatype(def)\n this.shape = params?.shape || params?.shape\n this.description = params?.description || def?.description\n this.unit = params?.unit || def?.unit\n this.dimension = def?.unit ? new Unit(def?.unit).dimension() : 'dimensionless'\n this.label = params?.label || getDisplayLabel(def)\n this.parent = parent\n this.group = params.group\n this.placeholder = params?.placeholder\n this.multiple = params?.multiple === undefined\n ? multiTypes.has(this.dtype)\n : params?.multiple\n this.exclusive = params?.exclusive === undefined ? true : params?.exclusive\n this.queryMode = params?.queryMode || (this.multiple ? 'any' : undefined)\n this.options = params?.options || getEnumOptions(def)\n this.default = params?.default\n this.suggestion = !isNil(params?.suggestion) ? params.suggestion : (!isNil(def?.suggestion) ? def.suggestion : false)\n this.scale = params?.scale || 'linear'\n this.value = params?.value\n this.aggs = params?.aggs\n this.requestQuantity = params?.requestQuantity\n this.nested = params?.nested === undefined ? false : params?.nested\n this.repeats = params?.repeats === undefined ? getRepeatsQuantity(def) : params?.repeats\n this.repeats_section = getRepeatsSection(def)\n this.scalar = isEmpty(def?.shape)\n this.global = params?.global === undefined ? false : params?.global\n this.section = !isNil(def?.nested)\n this.customSerialization = !!params?.serializerExact\n this.serializerExact = params?.serializerExact || getSerializer(this.dtype, false)\n this.serializerPretty = params?.serializerPretty || getSerializer(this.dtype, true)\n this.deserializer = params?.deserializer || getDeserializer(this.dtype, this.dimension)\n this.aggregatable = params?.aggregatable === undefined ? false : params?.aggregatable\n this.widget = params?.widget || getWidgetConfig(this.quantity, this.dtype, params?.aggregatable, this.scale)\n\n if (this.default && !this.global) {\n throw Error(`Error constructing filter for ${this.name}: only filters that do not correspond to a metainfo value may have default values set.`)\n }\n if (this.queryMode && !this.multiple) {\n throw Error(`Error constructing filter for ${this.name}: only filters that accept multiple values may have a query mode.`)\n }\n }\n}\n\n/**\n * Used to gather a list of fixed filter options from the metainfo.\n * @param {string} quantity Metainfo name\n * @returns Dictionary containing the available options and their labels.\n */\nexport function getEnumOptions(quantity, exclude = ['not processed']) {\n const metainfoOptions = searchQuantities?.[quantity]?.type?.type_data\n if (isArray(metainfoOptions) && metainfoOptions.length > 0) {\n const opt = {}\n for (const name of metainfoOptions) {\n opt[name] = {label: name}\n }\n exclude.forEach(value => delete opt[value])\n return opt\n }\n}\n\n/**\n * Tries to automatically create a default widget config for the given\n * quantity.\n *\n * @param {string} parent Parent quantity\n * @param {DType} dtype Datatype of the quantity\n * @param {bool} aggregatable Whether the quantity is aggregatable\n * @returns A widget config object.\n */\nexport const getWidgetConfig = (quantity, dtype, aggregatable, scale) => {\n if (dtype === DType.Float || dtype === DType.Int || dtype === DType.Timestamp) {\n return {\n x: {quantity},\n y: {scale: 'linear'},\n type: 'histogram',\n scale,\n showinput: false,\n autorange: false,\n nbins: 30,\n layout: {\n sm: {w: 8, h: 3, minW: 3, minH: 3},\n md: {w: 8, h: 3, minW: 3, minH: 3},\n lg: {w: 8, h: 3, minW: 3, minH: 3},\n xl: {w: 8, h: 3, minW: 3, minH: 3},\n xxl: {w: 8, h: 3, minW: 3, minH: 3}\n }\n }\n } else if (aggregatable) {\n return {\n quantity,\n type: 'terms',\n scale: scale,\n showinput: false,\n layout: {\n sm: {w: 6, h: 9, minW: 3, minH: 3},\n md: {w: 6, h: 9, minW: 3, minH: 3},\n lg: {w: 6, h: 9, minW: 3, minH: 3},\n xl: {w: 6, h: 9, minW: 3, minH: 3},\n xxl: {w: 6, h: 9, minW: 3, minH: 3}\n }\n }\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useGlobalMetainfo, getQuantities } from '../archive/metainfo'\nimport { setToArray, DType, getSuggestions, getOptions, getDatatype, glob, parseQuantityName } from '../../utils'\nimport { searchQuantities, schemaSeparator, dtypeSeparator, yamlSchemaPrefix } from '../../config'\nimport { Filter, getEnumOptions } from './Filter'\nimport elementData from '../../elementData'\nimport { Typography, Box } from '@material-ui/core'\nimport { useErrors } from '../errors'\n\n// Containers for filter information\nexport const defaultFilterGroups = {} // Mapping from a group name -> set of filter names\nexport const defaultFilterData = {} // Stores data for each registered filter\nconst dtypeMap = {\n [DType.Int]: 'int',\n [DType.Float]: 'float',\n [DType.Timestamp]: 'datetime',\n [DType.String]: 'str',\n [DType.Enum]: 'str',\n [DType.Boolean]: 'bool'\n}\n\n// Ids for the filter menus: used to tie filter chips to a specific menu.\nconst idElements = 'elements'\nconst idStructure = 'structure'\nconst idMethod = 'method'\nconst idDFT = 'dft'\nconst idTB = 'tb'\nconst idGW = 'gw'\nconst idBSE = 'bse'\nconst idDMFT = 'dmft'\nconst idPrecision = 'precision'\nconst idProperties = 'properties'\nconst idElectronic = 'electronic'\nconst idSolarCell = 'solarcell'\nconst idCatalyst = 'heterogeneouscatalyst'\nconst idVibrational = 'vibrational'\nconst idMechanical = 'mechanical'\nconst idSpectroscopic = 'spectroscopic'\nconst idMolecularDynamics = 'molecular_dynamics'\nconst idGeometryOptimization = 'geometry_optimization'\nconst idELN = 'eln'\nconst idCustomQuantities = 'custom_quantities'\nconst idAuthor = 'author'\nconst idMetadata = 'metadata'\nconst idOptimade = 'optimade'\n\n/**\n * Associates the given quantity name with the given group name in the filter\n * group data.\n *\n * @param {object} groups The groups to work on.\n * @param {str} groupName\n * @param {str} quantityName\n */\nfunction addToGroup(groups, groupName, quantityName) {\n groups[groupName]\n ? groups[groupName].add(quantityName)\n : groups[groupName] = new Set([quantityName])\n}\n\n/**\n * This function is used to register a new filter within the SearchContext.\n * Filters are entities that can be searched through the filter panel and the\n * search bar, and can be encoded in the URL. Notice that a filter in this\n * context does not necessarily have to correspond to a quantity in the\n * metainfo, altought typically this is preferrable.\n *\n * Only registered filters may be searched for. The registration must happen\n * before any components use the filters. This is because:\n * - The initial aggregation results must be fetched before any components\n * using the filter values are rendered.\n * - Several components need to know the list of available filters (e.g. the\n * search bar and the search panel). If filters are only registered during\n * component initialization, it may already be too late to update other\n * components.\n *\n * @param {string} name Name of the filter.\n * @param {string} group The group into which the filter belongs to. Groups\n * are used to e.g. in showing FilterSummaries about a group of filters.\n * @param {obj} config Data object containing options for the filter.\n */\nfunction saveFilter(name, group, config, parent) {\n if (defaultFilterData[name]) {\n throw Error(`Trying to register filter \"${name}\"\" multiple times.`)\n }\n const def = searchQuantities[name]\n const {path: quantity, schema} = parseQuantityName(name)\n const newConf = {...(config || {}), quantity, schema, name: config?.name || def?.name || name, aggregatable: def?.aggregatable, group: group}\n const data = defaultFilterData[name] || new Filter(def, newConf, parent)\n defaultFilterData[name] = data\n return data\n}\n\n/**\n * Used to register a filter value for an individual metainfo quantity or\n * section.\n */\nfunction registerFilter(name, group, config, subQuantities) {\n const parent = saveFilter(name, group, config)\n if (subQuantities) {\n for (const subConfig of subQuantities) {\n const subname = `${name}.${subConfig.name}`\n saveFilter(subname, group, subConfig, parent)\n }\n }\n}\n\n/**\n * Used to register a filter that is based on a subset of quantity values.\n */\nfunction registerFilterOptions(name, group, target, label, description, options) {\n const keys = Object.keys(options)\n registerFilter(\n name,\n group,\n {\n aggs: {\n terms: {\n set: ((target) => (config) => ({quantity: target, include: keys, ...config}))(target),\n get: (() => (agg) => agg)(target)\n }\n },\n value: {\n set: (newQuery, oldQuery, value) => {\n const data = newQuery[target] || new Set()\n value.forEach((item) => { data.add(item) })\n newQuery[`${target}:all`] = data\n }\n },\n dtype: DType.Enum,\n multiple: true,\n repeats: true,\n exclusive: false,\n queryMode: 'all',\n options: options,\n label: label,\n description: description\n }\n )\n}\n\n// Presets for different kind of quantities\nconst termQuantity = {aggs: {terms: {size: 5}}}\nconst termQuantityLarge = {aggs: {terms: {size: 10}}}\nconst termQuantityBool = {\n aggs: {terms: {size: 2, include: ['false', 'true']}},\n options: {\n false: {label: 'false'},\n true: {label: 'true'}\n }\n}\nconst termQuantityNonExclusive = {aggs: {terms: {size: 5}}, exclusive: false}\nconst termQuantityAll = {aggs: {terms: {size: 5}}, exclusive: false, multiple: true, queryMode: 'all'}\nconst termQuantityAllNonExclusive = {...termQuantityNonExclusive, queryMode: 'all'}\nconst noAggQuantity = {}\nconst nestedQuantity = {}\nconst noQueryQuantity = {multiple: false, global: true}\nconst numberHistogramQuantity = {multiple: false, exclusive: false}\n\n// Filters that directly correspond to a metainfo value\nregisterFilter(\n 'results.material.structural_type',\n idStructure,\n {\n ...termQuantity,\n scale: 'log',\n label: \"Dimensionality\",\n options: getEnumOptions('results.material.structural_type', ['not processed', 'unavailable'])\n }\n)\n\nregisterFilter('results.material.functional_type', idStructure, termQuantityNonExclusive)\nregisterFilter('results.material.compound_type', idStructure, termQuantityNonExclusive)\nregisterFilter('results.material.material_name', idStructure, termQuantity)\nregisterFilter('results.material.chemical_formula_hill', idElements, {...termQuantity, placeholder: \"E.g. H2O2, C2H5Br\"})\nregisterFilter('results.material.chemical_formula_iupac', idElements, {...termQuantity, placeholder: \"E.g. GaAs, SiC\", label: 'Chemical formula IUPAC'})\nregisterFilter('results.material.chemical_formula_reduced', idElements, {...termQuantity, placeholder: \"E.g. H2NaO, ClNa\"})\nregisterFilter('results.material.chemical_formula_anonymous', idElements, {...termQuantity, placeholder: \"E.g. A2B, A3B2C2\"})\nregisterFilter('results.material.n_elements', idElements, {...numberHistogramQuantity})\nregisterFilter('results.material.symmetry.bravais_lattice', idStructure, termQuantity)\nregisterFilter('results.material.symmetry.crystal_system', idStructure, termQuantity)\nregisterFilter(\n 'results.material.symmetry.structure_name',\n idStructure,\n {\n ...termQuantity,\n options: getEnumOptions('results.material.symmetry.structure_name', ['not processed', 'cubic perovskite'])\n }\n)\nregisterFilter('results.material.symmetry.strukturbericht_designation', idStructure, termQuantity)\nregisterFilter('results.material.symmetry.space_group_symbol', idStructure, {...termQuantity, placeholder: \"E.g. Pnma, Fd-3m, P6_3mc\"})\nregisterFilter('results.material.symmetry.point_group', idStructure, {...termQuantity, placeholder: \"E.g. 6mm, m-3m, 6/mmm\"})\nregisterFilter('results.material.symmetry.hall_symbol', idStructure, {...termQuantity, placeholder: \"E.g. F 4d 2 3 -1d\"})\nregisterFilter('results.material.symmetry.prototype_aflow_id', idStructure, {...termQuantity, placeholder: \"E.g. A_cF8_227_a\"})\nregisterFilter(\n 'results.material.topology',\n idStructure,\n nestedQuantity,\n [\n {name: 'label', ...termQuantity},\n {name: 'method', ...termQuantity},\n {name: 'description', ...termQuantity},\n {name: 'material_id', ...termQuantity},\n {name: 'material_name', ...termQuantity},\n {name: 'structural_type', ...termQuantity},\n {name: 'dimensionality', ...termQuantity},\n {name: 'building_block', ...termQuantity},\n {name: 'elements', ...termQuantity},\n {name: 'n_elements', ...numberHistogramQuantity},\n {name: 'chemical_formula_hill', ...termQuantity, placeholder: \"E.g. H2O2, C2H5Br\"},\n {name: 'chemical_formula_iupac', ...termQuantity, placeholder: \"E.g. GaAs, SiC\", label: 'Chemical formula IUPAC'},\n {name: 'chemical_formula_reduced', ...termQuantity, placeholder: \"E.g. H2NaO, ClNa\"},\n {name: 'chemical_formula_anonymous', ...termQuantity, placeholder: \"E.g. A2B, A3B2C2\"},\n {name: 'atomic_fraction', ...numberHistogramQuantity},\n {name: 'mass_fraction', ...numberHistogramQuantity},\n {name: 'n_atoms', ...numberHistogramQuantity},\n {name: 'system_relation.type', ...termQuantity},\n {name: 'cell.a', ...numberHistogramQuantity},\n {name: 'cell.b', ...numberHistogramQuantity},\n {name: 'cell.c', ...numberHistogramQuantity},\n {name: 'cell.alpha', ...numberHistogramQuantity},\n {name: 'cell.beta', ...numberHistogramQuantity},\n {name: 'cell.gamma', ...numberHistogramQuantity},\n {name: 'cell.atomic_density', ...numberHistogramQuantity},\n {name: 'cell.mass_density', ...numberHistogramQuantity},\n {name: 'cell.volume', ...numberHistogramQuantity},\n {name: 'symmetry.bravais_lattice', ...termQuantity},\n {name: 'symmetry.crystal_system', ...termQuantity},\n {name: 'symmetry.hall_symbol', ...termQuantity},\n {name: 'symmetry.point_group', ...termQuantity, placeholder: \"E.g. 6mm, m-3m, 6/mmm\"},\n {name: 'symmetry.space_group_symbol', ...termQuantity, placeholder: \"E.g. Pnma, Fd-3m, P6_3mc\"},\n {name: 'symmetry.strukturbericht_designation', ...termQuantity, placeholder: \"E.g. Pnma, Fd-3m, P6_3mc\"},\n {name: 'symmetry.prototype_name', ...termQuantity},\n {name: 'symmetry.prototype_label_aflow', ...termQuantity},\n {name: 'sbu_type', ...termQuantity},\n {name: 'largest_cavity_diameter', ...numberHistogramQuantity},\n {name: 'pore_limiting_diameter', ...numberHistogramQuantity},\n {name: 'largest_included_sphere_along_free_sphere_path', ...numberHistogramQuantity},\n {name: 'accessible_surface_area', ...numberHistogramQuantity},\n {name: 'accessible_volume', ...numberHistogramQuantity},\n {name: 'void_fraction', ...numberHistogramQuantity},\n {name: 'n_channels', ...numberHistogramQuantity},\n {name: 'sbu_coordination_number', ...numberHistogramQuantity}\n ]\n)\nregisterFilter(\n 'results.material.elemental_composition',\n idStructure,\n nestedQuantity,\n [\n {name: 'element', ...termQuantity},\n {name: 'atomic_fraction', ...numberHistogramQuantity},\n {name: 'mass_fraction', ...numberHistogramQuantity}\n ]\n)\nregisterFilter(\n 'results.material.topology.elemental_composition',\n idStructure,\n nestedQuantity,\n [\n {name: 'element', ...termQuantity},\n {name: 'mass', ...numberHistogramQuantity},\n {name: 'atomic_fraction', ...numberHistogramQuantity},\n {name: 'mass_fraction', ...numberHistogramQuantity}\n ]\n)\nregisterFilter(\n 'results.material.topology.active_orbitals',\n idStructure,\n nestedQuantity,\n [\n {name: 'n_quantum_number', ...termQuantity},\n {name: 'l_quantum_number', ...termQuantity},\n {name: 'l_quantum_symbol', ...termQuantity},\n {name: 'ml_quantum_symbol', ...termQuantity},\n {name: 'ms_quantum_symbol', ...termQuantity},\n {name: 'j_quantum_number', ...termQuantity},\n {name: 'mj_quantum_number', ...termQuantity},\n {name: 'occupation', ...termQuantity},\n {name: 'n_electrons_excited', ...termQuantity},\n {name: 'degeneracy', ...termQuantity}\n ]\n)\nregisterFilter('results.method.method_name', idMethod, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.workflow_name', idMethod, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.program_name', idMethod, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.program_version', idMethod, termQuantity)\nregisterFilter('results.method.simulation.program_version_internal', idMethod, termQuantity)\nregisterFilter('results.method.simulation.precision.native_tier', idPrecision, {...termQuantity, placeholder: \"E.g. VASP - accurate\", label: 'Code-specific tier'})\nregisterFilter('results.method.simulation.precision.k_line_density', idPrecision, {...numberHistogramQuantity, scale: 'log', label: 'k-line density'})\nregisterFilter('results.method.simulation.precision.basis_set', idPrecision, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.precision.planewave_cutoff', idPrecision, {...numberHistogramQuantity, label: 'Plane-wave cutoff', scale: 'log'})\nregisterFilter('results.method.simulation.precision.apw_cutoff', idPrecision, {...numberHistogramQuantity, label: 'APW cutoff', scale: 'log'})\nregisterFilter('results.method.simulation.dft.core_electron_treatment', idDFT, termQuantity)\nregisterFilter('results.method.simulation.dft.jacobs_ladder', idDFT, {...termQuantity, scale: 'log', label: 'Jacob\\'s ladder'})\nregisterFilter('results.method.simulation.dft.xc_functional_type', idDFT, {\n ...termQuantity,\n scale: 'log',\n label: 'Jacob\\'s ladder',\n options: {\n 'LDA': {label: 'LDA'},\n 'GGA': {label: 'GGA'},\n 'meta-GGA': {label: 'Meta-GGA'},\n 'hyper-GGA': {label: 'Hyper-GGA'},\n 'hybrid': {label: 'Hybrid'}\n }\n})\nregisterFilter('results.method.simulation.dft.xc_functional_names', idDFT, {...termQuantityNonExclusive, scale: 'log', label: 'XC functional names'})\nregisterFilter('results.method.simulation.dft.exact_exchange_mixing_factor', idDFT, {...numberHistogramQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.dft.hubbard_kanamori_model.u_effective', idDFT, {...numberHistogramQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.dft.relativity_method', idDFT, termQuantity)\nregisterFilter('results.method.simulation.tb.type', idTB, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.tb.localization_type', idTB, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.gw.type', idGW, {...termQuantity, label: 'GW type'})\nregisterFilter('results.method.simulation.gw.starting_point_type', idGW, {\n ...termQuantity,\n scale: 'log',\n options: {\n 'LDA': {label: 'LDA'},\n 'GGA': {label: 'GGA'},\n 'meta-GGA': {label: 'Meta-GGA'},\n 'hyper-GGA': {label: 'Hyper-GGA'},\n 'hybrid': {label: 'Hybrid'},\n 'HF': {label: 'HF'}\n }\n})\nregisterFilter('results.method.simulation.gw.basis_set_type', idGW, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.bse.type', idBSE, termQuantity)\nregisterFilter('results.method.simulation.bse.solver', idBSE, termQuantity)\nregisterFilter('results.method.simulation.bse.starting_point_type', idBSE, {\n ...termQuantity,\n scale: 'log',\n options: {\n 'LDA': {label: 'LDA'},\n 'GGA': {label: 'GGA'},\n 'meta-GGA': {label: 'Meta-GGA'},\n 'hyper-GGA': {label: 'Hyper-GGA'},\n 'hybrid': {label: 'Hybrid'},\n 'HF': {label: 'HF'}\n }\n})\nregisterFilter('results.method.simulation.bse.basis_set_type', idBSE, {...termQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.bse.gw_type', idBSE, {...termQuantity, scale: 'log', label: `GW type`})\nregisterFilter('results.method.simulation.dmft.impurity_solver_type', idDMFT, {...termQuantity})\nregisterFilter('results.method.simulation.dmft.magnetic_state', idDMFT, {...termQuantity})\nregisterFilter('results.method.simulation.dmft.inverse_temperature', idDMFT, {...numberHistogramQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.dmft.u', idDMFT, {...numberHistogramQuantity, scale: 'log'})\nregisterFilter('results.method.simulation.dmft.jh', idDMFT, {...numberHistogramQuantity, label: `JH`, scale: 'log'})\nregisterFilter('results.method.simulation.dmft.analytical_continuation', idDMFT, {...termQuantity})\nregisterFilter('results.eln.sections', idELN, termQuantity)\nregisterFilter('results.eln.tags', idELN, termQuantity)\nregisterFilter('results.eln.methods', idELN, termQuantity)\nregisterFilter('results.eln.instruments', idELN, termQuantity)\nregisterFilter('results.eln.lab_ids', idELN, {...termQuantity, label: 'Lab IDs'})\nregisterFilter('results.eln.names', idELN, noAggQuantity)\nregisterFilter('results.eln.descriptions', idELN, noAggQuantity)\nregisterFilter('external_db', idAuthor, {...termQuantity, label: 'External database', scale: 'log'})\nregisterFilter('authors.name', idAuthor, {...termQuantityNonExclusive, label: 'Author name'})\nregisterFilter('upload_create_time', idAuthor, {...numberHistogramQuantity, scale: 'log'})\nregisterFilter('entry_create_time', idAuthor, {...numberHistogramQuantity, scale: 'log'})\nregisterFilter('datasets.dataset_name', idAuthor, {...termQuantityLarge, label: 'Dataset name'})\nregisterFilter('datasets.doi', idAuthor, {...termQuantity, label: 'Dataset DOI'})\nregisterFilter('datasets.dataset_id', idAuthor, termQuantity)\nregisterFilter('domain', idMetadata, termQuantity)\nregisterFilter('entry_id', idMetadata, termQuantity)\nregisterFilter('entry_name', idMetadata, termQuantity)\nregisterFilter('mainfile', idMetadata, termQuantity)\nregisterFilter('upload_id', idMetadata, termQuantity)\nregisterFilter('upload_name', idMetadata, termQuantity)\nregisterFilter('published', idMetadata, termQuantity)\nregisterFilter('main_author.user_id', idMetadata, termQuantity)\nregisterFilter('quantities', idMetadata, {...noAggQuantity, label: 'Metainfo definition', queryMode: 'all'})\nregisterFilter('sections', idMetadata, {...noAggQuantity, label: 'Metainfo sections', queryMode: 'all'})\nregisterFilter('section_defs.definition_qualified_name', idMetadata, {...noAggQuantity, label: 'Section defs qualified name', queryMode: 'all'})\nregisterFilter('entry_references.target_entry_id', idMetadata, {...noAggQuantity, label: 'Entry references target entry id', queryMode: 'all'})\nregisterFilter('entry_type', idMetadata, {...noAggQuantity, label: 'Entry type', queryMode: 'all'})\nregisterFilter('entry_name.prefix', idMetadata, {...noAggQuantity, label: 'Entry name', queryMode: 'all'})\nregisterFilter('results.material.material_id', idMetadata, termQuantity)\nregisterFilter('optimade_filter', idOptimade, {multiple: true, queryMode: 'all'})\nregisterFilter('processed', idMetadata, {label: 'Processed', queryMode: 'all'})\nregisterFilter('text_search_contents', idMetadata, {multiple: true, queryMode: 'all'})\nregisterFilter('custom_quantities', idCustomQuantities, {\n serializerExact: value => {\n const jsonStr = JSON.stringify(value)\n const result = encodeURIComponent(jsonStr)\n return result\n },\n serializerPretty: value => {\n if (!value) {\n return null\n }\n return `${value.and.length} condition${value.and.length > 0 ? 's' : ''}`\n },\n deserializer: value => {\n const jsonStr = decodeURIComponent(value)\n const result = JSON.parse(jsonStr)\n return result\n },\n multiple: false,\n value: {\n set: () => {\n // TODO: We ignore the query here, it is later added to the final API query.\n // We had to do this hack, because there is not way to add a logical query\n // behind a prefix.\n }\n }\n})\nregisterFilter(\n 'results.properties.spectroscopic.spectra.provenance.eels',\n idSpectroscopic,\n {...nestedQuantity, label: 'Electron energy loss spectrum (EELS)'},\n [\n {name: 'detector_type', ...termQuantity},\n {name: 'resolution', ...numberHistogramQuantity},\n {name: 'min_energy', ...numberHistogramQuantity},\n {name: 'max_energy', ...numberHistogramQuantity}\n ]\n)\nregisterFilter(\n 'results.properties.electronic.band_structure_electronic',\n idElectronic,\n {...nestedQuantity, label: 'Band structure'},\n [\n {name: 'spin_polarized', label: 'Spin-polarized', ...termQuantityBool}\n ]\n)\nregisterFilter(\n 'results.properties.electronic.dos_electronic',\n idElectronic,\n {...nestedQuantity, label: 'Density of states'},\n [\n {name: 'spin_polarized', label: 'Spin-polarized', ...termQuantityBool}\n ]\n)\nregisterFilter(\n 'results.properties.electronic.band_structure_electronic.band_gap',\n idElectronic,\n nestedQuantity,\n [\n {name: 'type', ...termQuantity},\n {name: 'value', ...numberHistogramQuantity, scale: 'log'}\n ]\n)\nregisterFilter(\n 'results.properties.electronic.band_gap',\n idElectronic,\n nestedQuantity,\n [\n {name: 'type', ...termQuantity},\n {name: 'value', ...numberHistogramQuantity, scale: 'log'}\n ]\n)\nregisterFilter('results.properties.electronic.band_gap.provenance.label', idElectronic, termQuantity)\nregisterFilter(\n 'results.properties.optoelectronic.solar_cell',\n idSolarCell,\n nestedQuantity,\n [\n {name: 'efficiency', ...numberHistogramQuantity, scale: 'log'},\n {name: 'fill_factor', ...numberHistogramQuantity, scale: 'log'},\n {name: 'open_circuit_voltage', ...numberHistogramQuantity, scale: 'log'},\n {name: 'short_circuit_current_density', ...numberHistogramQuantity, scale: 'log'},\n {name: 'illumination_intensity', ...numberHistogramQuantity, scale: 'log'},\n {name: 'device_area', ...numberHistogramQuantity, scale: 'log'},\n {name: 'device_architecture', ...termQuantity},\n {name: 'absorber_fabrication', ...termQuantity},\n {name: 'device_stack', ...termQuantityAllNonExclusive},\n {name: 'absorber', ...termQuantityAllNonExclusive},\n {name: 'electron_transport_layer', ...termQuantityAllNonExclusive},\n {name: 'hole_transport_layer', ...termQuantityAllNonExclusive},\n {name: 'substrate', ...termQuantityAllNonExclusive},\n {name: 'back_contact', ...termQuantityAllNonExclusive}\n ]\n)\nregisterFilter(\n 'results.properties.catalytic.catalyst',\n idCatalyst,\n nestedQuantity,\n [\n {name: 'characterization_methods', ...termQuantity},\n {name: 'surface_area', ...numberHistogramQuantity, scale: 'log'},\n {name: 'catalyst_name', ...termQuantity},\n {name: 'catalyst_type', ...termQuantity},\n {name: 'preparation_method', ...termQuantity}\n ]\n)\nregisterFilter(\n 'results.properties.catalytic.reaction',\n idCatalyst,\n nestedQuantity,\n [\n {name: 'name', ...termQuantity},\n {name: 'type', ...termQuantity}\n ]\n)\nregisterFilter(\n 'results.properties.catalytic.reaction.reaction_conditions',\n idCatalyst,\n nestedQuantity,\n [\n {name: 'temperature', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'pressure', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'weight_hourly_space_velocity', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'gas_hourly_space_velocity', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'flow_rate', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'time_on_stream', ...numberHistogramQuantity, scale: 'linear'}\n ]\n)\nregisterFilter(\n 'results.properties.catalytic.reaction.products',\n idCatalyst,\n nestedQuantity,\n [\n {name: 'name', ...termQuantityAllNonExclusive},\n {name: 'gas_concentration_out', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'selectivity', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'space_time_yield', ...numberHistogramQuantity, scale: 'linear'}\n ]\n)\nregisterFilter(\n 'results.properties.catalytic.reaction.reactants',\n idCatalyst,\n nestedQuantity,\n [\n {name: 'name', ...termQuantityAllNonExclusive},\n {name: 'gas_concentration_in', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'gas_concentration_out', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'conversion', ...numberHistogramQuantity, scale: 'linear'}\n ]\n)\nregisterFilter(\n 'results.properties.catalytic.reaction.rates',\n idCatalyst,\n nestedQuantity,\n [\n {name: 'name', ...termQuantityAllNonExclusive},\n {name: 'reaction_rate', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'specific_mass_rate', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'specific_surface_area_rate', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'rate', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'turnover_frequency', ...numberHistogramQuantity, scale: 'linear'}\n ]\n)\nregisterFilter(\n 'results.properties.catalytic.reaction.reaction_mechanism',\n idCatalyst,\n nestedQuantity,\n [\n {name: 'initial_states', ...termQuantity},\n {name: 'final_states', ...termQuantity},\n {name: 'reaction_enthalpy', ...numberHistogramQuantity, scale: 'linear'},\n {name: 'activation_energy', ...numberHistogramQuantity, scale: 'linear'}\n ]\n)\nregisterFilter(\n 'results.properties.mechanical.bulk_modulus',\n idMechanical,\n nestedQuantity,\n [\n {name: 'type', ...termQuantity},\n {name: 'value', ...numberHistogramQuantity}\n ]\n)\nregisterFilter(\n 'results.properties.mechanical.shear_modulus',\n idMechanical,\n nestedQuantity,\n [\n {name: 'type', ...termQuantity},\n {name: 'value', ...numberHistogramQuantity}\n ]\n)\nregisterFilter(\n 'results.properties.available_properties',\n idProperties,\n termQuantityAll\n)\nregisterFilter(\n 'results.properties.mechanical.energy_volume_curve',\n idMechanical,\n nestedQuantity,\n [\n {name: 'type', ...termQuantity}\n ]\n)\nregisterFilter(\n 'results.properties.geometry_optimization',\n idGeometryOptimization,\n nestedQuantity,\n [\n {name: 'final_energy_difference', ...numberHistogramQuantity, scale: 'log'},\n {name: 'final_displacement_maximum', ...numberHistogramQuantity, scale: 'log'},\n {name: 'final_force_maximum', ...numberHistogramQuantity, scale: 'log'}\n ]\n)\nregisterFilter(\n 'results.properties.thermodynamic.trajectory',\n idMolecularDynamics,\n nestedQuantity,\n [\n {name: 'available_properties', ...termQuantityAll},\n {name: 'provenance.molecular_dynamics.ensemble_type', ...termQuantity},\n {name: 'provenance.molecular_dynamics.time_step', ...numberHistogramQuantity}\n ]\n)\n\n// Visibility: controls the 'owner'-parameter in the API query, not part of the\n// query itself.\nregisterFilter(\n 'visibility',\n idMetadata,\n {\n ...noQueryQuantity,\n default: 'visible',\n description: 'The visibility of the entry.'\n }\n)\n\n// Combine: controls whether materials search combines data from several\n// entries.\nregisterFilter(\n 'combine',\n undefined,\n {\n ...noQueryQuantity,\n default: true,\n description: 'If selected, your filters may be matched from several entries that contain the same material. When unchecked, the material has to have a single entry that matches all your filters.'\n }\n)\n\n// Exclusive: controls the way elements search is done.\nregisterFilter(\n 'exclusive',\n undefined,\n {\n ...noQueryQuantity,\n default: false,\n description: \"Search for entries with compositions that only (exclusively) contain the selected atoms. The default is to return all entries that have at least (inclusively) the selected atoms.\"\n }\n)\n\n// In exclusive element query the elements names are sorted and concatenated\n// into a single string.\nregisterFilter(\n 'results.material.elements',\n idElements,\n {\n widget: {\n quantity: 'results.material.elements',\n type: 'periodictable',\n scale: 'log',\n layout: {\n sm: {w: 12, h: 8, minW: 12, minH: 8},\n md: {w: 12, h: 8, minW: 12, minH: 8},\n lg: {w: 12, h: 8, minW: 12, minH: 8},\n xl: {w: 12, h: 8, minW: 12, minH: 8},\n xxl: {w: 12, h: 8, minW: 12, minH: 8}\n }\n },\n aggs: {terms: {size: elementData.elements.length}},\n value: {\n set: (newQuery, oldQuery, value) => {\n if (oldQuery.exclusive) {\n if (value.size !== 0) {\n newQuery['results.material.elements_exclusive'] = setToArray(value).sort().join(' ')\n }\n } else {\n newQuery['results.material.elements'] = value\n }\n }\n },\n multiple: true,\n exclusive: false,\n queryMode: 'all'\n }\n)\n\n// Electronic properties: subset of results.properties.available_properties\nregisterFilterOptions(\n 'electronic_properties',\n idElectronic,\n 'results.properties.available_properties',\n 'Electronic properties',\n 'The electronic properties that are present in an entry.',\n {\n 'electronic.band_structure_electronic.band_gap': {label: 'Band gap'},\n band_structure_electronic: {label: 'Band structure'},\n dos_electronic: {label: 'Density of states'},\n greens_functions_electronic: {label: 'Green\\u0027s functions'},\n eels: {label: 'Electron energy loss spectrum'}\n }\n)\n\n// Vibrational properties: subset of results.properties.available_properties\nregisterFilterOptions(\n 'vibrational_properties',\n idVibrational,\n 'results.properties.available_properties',\n 'Vibrational properties',\n 'The vibrational properties that are present in an entry.',\n {\n dos_phonon: {label: 'Phonon density of states'},\n band_structure_phonon: {label: 'Phonon band structure'},\n energy_free_helmholtz: {label: 'Helmholtz free energy'},\n heat_capacity_constant_volume: {label: 'Heat capacity constant volume'}\n }\n)\n\n// Mechanical properties: subset of results.properties.available_properties\nregisterFilterOptions(\n 'mechanical_properties',\n idMechanical,\n 'results.properties.available_properties',\n 'Mechanical properties',\n 'The mechanical properties that are present in an entry.',\n {\n bulk_modulus: {label: 'Bulk modulus'},\n shear_modulus: {label: 'Shear modulus'},\n energy_volume_curve: {label: 'Energy-volume curve'}\n }\n)\n\n// Spectroscopic properties: subset of results.properties.available_properties\nregisterFilterOptions(\n 'spectroscopic_properties',\n idSpectroscopic,\n 'results.properties.available_properties',\n 'Spectroscopic properties',\n 'The spectroscopic properties that are present in an entry.',\n {\n eels: {label: 'Electron energy loss spectrum'}\n }\n)\n\n// Thermodynamical properties: subset of results.properties.available_properties\nregisterFilterOptions(\n 'thermodynamic_properties',\n idMolecularDynamics,\n 'results.properties.available_properties',\n 'Thermodynamic properties',\n 'The thermodynamic properties that are present.',\n {\n trajectory: {label: 'Trajectory'}\n }\n)\n\n/**\n * Creates static suggestion for all metainfo quantities that have an enum\n * value. Also provides suggestions for quantity names.\n */\nexport const quantityNameSearch = 'quantity name'\nexport function getStaticSuggestions(quantities, filterData) {\n const suggestions = {}\n const filters = quantities\n ? [...quantities]\n : Object.keys(filterData)\n\n // Add suggestions from metainfo\n for (const quantity of filters) {\n const data = searchQuantities[quantity]\n const isEnum = data?.type?.type_kind?.toLowerCase() === 'enum'\n if (isEnum) {\n const options = data.type.type_data\n const maxLength = Math.max(...options.map(option => option.length))\n const minLength = maxLength <= 2 ? 1 : 2\n suggestions[quantity] = getSuggestions(\n options,\n minLength\n )\n }\n }\n\n // Add suggestions for quantity names\n if (quantities.has(quantityNameSearch)) {\n suggestions[quantityNameSearch] = getSuggestions(\n filters.filter(value => value !== quantityNameSearch && !filterData[value].section),\n 2\n )\n }\n return suggestions\n}\n\n/**\n * HOC that is used to preload search filters from all required schemas. This\n * simplifies the rendering logic by first loading all schemas before rendering\n * any components that rely on them.\n */\nexport const withFilters = (WrappedComponent) => {\n const WithFilters = ({initialFilters, ...rest}) => {\n // Here we load the python schemas, and determine which YAML/Nexus schemas\n // to load later.\n const [yamlOptions, nexusOptions, initialFilterData, initialFilterGroups] = useMemo(() => {\n const options = getOptions(initialFilters)\n const yamlOptions = options.filter((name) => name.includes(`#${yamlSchemaPrefix}`))\n const nexusOptions = options.filter((name) => name.startsWith('nexus.'))\n\n // Perform glob filtering on default filters. Only exclude affects the\n // default filters.\n const defaultFilters = {}\n for (const [key, value] of Object.entries(defaultFilterData)) {\n if (glob(key, [key], initialFilters?.exclude)) {\n defaultFilters[key] = value\n if (value.group) {\n addToGroup(defaultFilterGroups, value.group, key)\n }\n }\n }\n\n // Load the python filters from plugins\n const pythonFilterData = {}\n const mergedFilterGroups = {...defaultFilterGroups}\n for (const [name, def] of Object.entries(searchQuantities)) {\n if (def.dynamic && glob(name, initialFilters?.include, initialFilters?.exclude)) {\n const {path, schema} = parseQuantityName(name)\n const params = {\n name: path,\n quantity: path,\n schema,\n aggregatable: def.aggregatable\n }\n pythonFilterData[name] = new Filter(def, params)\n addToGroup(mergedFilterGroups, idCustomQuantities, name)\n }\n }\n\n return [\n yamlOptions,\n nexusOptions,\n {...defaultFilters, ...pythonFilterData},\n mergedFilterGroups\n ]\n }, [initialFilters])\n\n const metainfo = useGlobalMetainfo()\n const [loadingYaml, setLoadingYaml] = useState(yamlOptions.length)\n const [loadingNexus, setLoadingNexus] = useState(nexusOptions.length)\n const [filters, setFilters] = useState(initialFilterData)\n const [filterGroups, setFilterGroups] = useState({...initialFilterGroups})\n const { raiseError } = useErrors()\n\n // Nexus metainfo is loaded here once metainfo is ready\n useEffect(() => {\n if (!nexusOptions.length || !metainfo) return\n const pkg = metainfo._packageDefs['nexus']\n const sections = pkg.section_definitions\n const nexusFilters = {}\n const nexusFilterGroups = {}\n for (const section of sections) {\n const sectionPath = `nexus.${section.name}`\n\n // The NeXus section is skipped (it contains duplicate information)\n if (sectionPath === 'nexus.NeXus') continue\n\n // Only applications definitions are loaded\n if (section?.more?.nx_category !== 'application') continue\n\n // Sections from which no quantities are included are skipped\n if (!glob(sectionPath, initialFilters?.include, initialFilters?.exclude) && !initialFilters?.include.some(x => x.includes(sectionPath))) {\n continue\n }\n\n // Add all included quantities recursively\n for (const [def, path, repeats] of getQuantities(section)) {\n const filterPath = `${sectionPath}.${path}`\n const included = glob(filterPath, initialFilters?.include, initialFilters?.exclude)\n if (!included) continue\n const dtype = dtypeMap[getDatatype(def)]\n // TODO: For some Nexus quantities, the data types cannot be fetched.\n if (!dtype) {\n continue\n }\n const params = {\n name: filterPath,\n quantity: filterPath,\n aggregatable: new Set([DType.String, DType.Enum, DType.Boolean]).has(getDatatype(def)),\n repeats: repeats\n }\n nexusFilters[filterPath] = new Filter(def, params)\n addToGroup(nexusFilterGroups, idCustomQuantities, filterPath)\n }\n }\n setFilters((old) => ({...old, ...nexusFilters}))\n setFilterGroups((old) => {\n const newGroups = {...old}\n for (const [groupName, names] of Object.entries(nexusFilterGroups)) {\n for (const quantityName of [...names]) {\n addToGroup(newGroups, groupName, quantityName)\n }\n }\n return newGroups\n })\n setLoadingNexus(false)\n }, [metainfo, nexusOptions, initialFilters])\n\n // YAML schemas are loaded here asynchronously\n useEffect(() => {\n if (!yamlOptions.length || !metainfo) return\n async function fetchSchemas(options) {\n const yamlFilters = {}\n const yamlFilterGroups = {}\n for (const schemaPath of options) {\n let schemaDefinition\n try {\n schemaDefinition = await metainfo.resolveDefinition(schemaPath)\n } catch (e) {\n raiseError(`\n Unable to load the schema ${schemaPath} that is used in this app.\n If the schema has not been published, please make sure that you\n are logged in and have the correct access rights.\n `)\n throw e\n }\n for (const [def, path] of getQuantities(schemaDefinition)) {\n const dtype = dtypeMap[getDatatype(def)]\n if (!dtype) {\n throw Error(`Unable to load the data type for ${path}.`)\n }\n const filterPath = `data.${path}${schemaSeparator}${schemaPath}`\n const included = glob(filterPath, initialFilters?.include, initialFilters?.exclude)\n if (!included) continue\n const apiPath = `${filterPath}${dtypeSeparator}${dtype}`\n const {path: quantity, schema} = parseQuantityName(filterPath)\n yamlFilters[filterPath] = new Filter(def, {name: path, schema, quantity, requestQuantity: apiPath})\n addToGroup(yamlFilterGroups, idCustomQuantities, filterPath)\n }\n }\n setFilters((old) => ({...old, ...yamlFilters}))\n setFilterGroups((old) => {\n const newGroups = {...old}\n for (const [groupName, names] of Object.entries(yamlFilterGroups)) {\n for (const quantityName of [...names]) {\n addToGroup(newGroups, groupName, quantityName)\n }\n }\n return newGroups\n })\n setLoadingYaml(false)\n }\n\n // Get a list of all distinct YAML schemas. These are loaded one by one\n // and the required filters are registered from each.\n const yamlSchemas = new Set(yamlOptions.map(x => x.split('#').pop()))\n fetchSchemas(yamlSchemas)\n }, [yamlOptions, metainfo, raiseError, initialFilters])\n\n return (loadingYaml || loadingNexus)\n ? \n Loading the required schemas...\n \n : \n }\n\n WithFilters.displayName = `withFilter(${WrappedComponent.displayName || WrappedComponent.name})`\n WithFilters.propTypes = {\n initialFilters: PropTypes.object // Determines which filters are available\n }\n\n return WithFilters\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useCallback, useEffect, useState, useRef, useMemo } from 'react'\nimport { debounce, isEmpty } from 'lodash'\nimport { useApi } from './components/api'\nimport { getStaticSuggestions } from './components/search/FilterRegistry'\n\n/**\n * Function for returning the current window size.\n *\n * @return {string} The number in approximated format.\n */\nfunction getWindowSize() {\n return {windowWidth: window.innerWidth, windowHeight: window.innerHeight}\n}\n\n/**\n * Hook for returning the current window size.\n *\n * @return {string} The number in approximated format.\n */\nexport function useWindowSize() {\n const [size, setSize] = useState(getWindowSize())\n\n useEffect(() => {\n function handleResize() {\n setSize(getWindowSize())\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n return size\n}\n\n/**\n * Convenience hook for a simple boolean state.\n *\n * @param {bool} initialvalue The initial boolean value.\n * @return {array} Array containing current value and functions for setting to\n * true or false.\n */\nexport function useBoolState(initialValue) {\n const [value, setValue] = useState(initialValue)\n const setTrue = useCallback(() => setValue(true), [])\n const setFalse = useCallback(() => setValue(false), [])\n\n return [value, setTrue, setFalse]\n}\n\n/**\n * Hook for fetching suggestions for metainfo quantities. Uses a mixture of\n * metainfo Enumeration values and dynamic suggestions fetched through the API.\n * The fetching is debounced and retrieval of only the latest results is\n * ensured. Notice that not all quantities support suggestions.\n *\n * @param {array} quantitiesSuggest List of quantity definitions for which\n * suggestions are fetched for. Notice that the suggestions are returned in this\n * order.\n * @param {set} quantitiesAll Set of all quantity names. Used to return\n * suggestions for quantity names.\n * @param {str} input Text input used for the suggestions. Must be non-empty in\n * order to fetch any suggestions.\n * @param {object} filterData Contains the available filters\n * @param {number} minLength Minimum input length before any dynamic\n * suggestions are fetched through the API.\n * @param {number} suggestionsStatic An object containing any fixed suggestion\n * values that should be added. Names that match a metainfo quantity will\n * override any dynamical values.\n * @param {number} debounceTime The debounce time for restricting the number of\n * API calls.\n * @return {object} Array of suggestions containing the suggested value and the\n * quantity name.\n */\nexport function useSuggestions(quantitiesSuggest, quantitiesAll, input, filterData, minLength = 2, debounceTime = 150) {\n const {api} = useApi()\n const [loading, setLoading] = useState(false)\n const [suggestions, setSuggestions] = useState([])\n const currentRequest = useRef()\n const staticSuggestions = useMemo(() => getStaticSuggestions(quantitiesAll, filterData), [quantitiesAll, filterData])\n\n // Used to retrieve suggestions for this field.\n const fetchSuggestions = useCallback((quantities, input) => {\n setLoading(true)\n\n // Used to flatten suggestions into a list that is correctly ordered.\n function flatten(value) {\n let suggestionsList = []\n quantities.forEach(q => {\n const options = value[q.name]\n if (!isEmpty(options)) {\n suggestionsList = suggestionsList.concat(options)\n }\n })\n return suggestionsList\n }\n\n // Split the requested quantities into static and dynamic\n const quantitiesFixed = []\n const quantitiesDynamic = []\n for (const quantity of quantities) {\n if (quantity.name in staticSuggestions) {\n quantitiesFixed.push(quantity)\n } else if (filterData[quantity.name].suggestion) {\n quantitiesDynamic.push(quantity)\n }\n }\n\n // Gather the fixed suggestions first. The fixed suggestion size is\n // currently not limited.\n const suggestionsTemp = {}\n for (const quantity of quantitiesFixed) {\n const fixed = staticSuggestions[quantity.name]\n suggestionsTemp[quantity.name] = fixed.filter(input).map((value) => ({value, category: quantity.name}))\n }\n\n // Start loading the dynamic suggestions\n if (input.length >= minLength && quantitiesDynamic.length > 0) {\n const promise = api.suggestions(quantitiesDynamic, input)\n currentRequest.current = promise\n promise\n .then(data => {\n if (currentRequest.current === promise) {\n for (const quantity of quantitiesDynamic) {\n const esSuggestions = data[quantity.name]\n if (esSuggestions) {\n suggestionsTemp[quantity.name] = esSuggestions.map(suggestion => ({\n category: quantity.name,\n value: suggestion.value\n }))\n }\n }\n setSuggestions(flatten(suggestionsTemp))\n }\n })\n .catch((error) => {\n console.log(error)\n })\n .finally(() => {\n if (currentRequest.current === promise) {\n setLoading(false)\n }\n })\n } else {\n setSuggestions(flatten(suggestionsTemp))\n setLoading(false)\n }\n }, [api, minLength, staticSuggestions, filterData])\n\n // Debounced version. Notice that we specify a maxWait option in order to keep\n // on suggesting while the user is typing.\n const fetchSuggestionsDebounced = useMemo(() => (\n debounce(fetchSuggestions, debounceTime, {maxWait: 300})\n ), [fetchSuggestions, debounceTime])\n\n // Whenever input or the targeted quantities change, fetch suggestions\n useEffect(() => {\n const trimmedInput = input?.trim()\n if (trimmedInput && trimmedInput.length > 0) {\n fetchSuggestionsDebounced(quantitiesSuggest, input)\n } else {\n setSuggestions(old => old.length > 0 ? [] : old)\n }\n }, [fetchSuggestionsDebounced, quantitiesSuggest, input])\n\n const results = useMemo(() => [suggestions, loading], [suggestions, loading])\n return results\n}\n\n/**\n * Custom hook that returns a function that can be used to propertly catch\n * errors within React ErrorBoundaries raised by asynchronous calls.\n */\nexport const useAsyncError = () => {\n const setError = useState()[1]\n return useCallback(\n e => {\n setError(() => {\n throw e\n })\n },\n [setError]\n )\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@material-ui/core/styles'\nimport {\n Tooltip,\n IconButton,\n MenuItem,\n Select,\n Checkbox,\n FormControlLabel\n} from '@material-ui/core'\nimport clsx from 'clsx'\nimport { isArray } from 'lodash'\nimport { useBoolState } from '../hooks'\n\nconst useActionsStyles = makeStyles((theme) => ({\n root: {\n display: 'flex',\n width: '100%',\n boxSizing: 'border-box',\n alignItems: 'center'\n }\n}))\nexport const Actions = React.memo(({\n justifyContent,\n className,\n classes,\n children\n}) => {\n const useDynamicStyles = makeStyles((theme) => ({\n root: {\n justifyContent: justifyContent\n }\n }))\n const styles = useActionsStyles({classes: classes})\n const dynamicStyles = useDynamicStyles()\n\n return
\n {children}\n
\n})\n\nActions.propTypes = {\n justifyContent: PropTypes.string, // The flexbox justification of buttons\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.node\n}\n\nActions.defaultProps = {\n justifyContent: 'flex-end'\n}\n\nconst useActionHeaderStyles = makeStyles((theme) => ({\n root: {\n flexGrow: 1,\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n minWidth: 0,\n marginRight: theme.spacing(0.5)\n },\n spacer: {\n flexGrow: 1,\n minWidth: 0\n }\n}))\nexport const ActionHeader = React.memo(({\n disableSpacer,\n className,\n classes,\n children\n}) => {\n const styles = useActionHeaderStyles({classes: classes})\n return
\n {children}\n {!disableSpacer &&
}\n
\n})\n\nActionHeader.propTypes = {\n disableSpacer: PropTypes.bool, // Used to disable flexbox spacer\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.node\n}\n\nconst useActionStyles = makeStyles((theme) => ({\n root: {\n marginRight: theme.spacing(1),\n '&:last-child': {\n marginRight: 0\n }\n }\n}))\nexport const Action = React.memo(({\n color,\n size,\n href,\n disabled,\n onClick,\n onMouseDown,\n onMouseUp,\n tooltip,\n TooltipProps,\n className,\n classes,\n children,\n ButtonComponent,\n ButtonProps,\n 'data-testid': testID\n}) => {\n const styles = useActionStyles({classes: classes})\n\n return \n \n \n {children}\n \n \n \n})\n\nAction.propTypes = {\n variant: PropTypes.string, // The variant of the MUI buttons\n color: PropTypes.string, // The color of the MUI buttons\n size: PropTypes.string, // Size of the MUI buttons\n href: PropTypes.string,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n onMouseDown: PropTypes.func,\n onMouseUp: PropTypes.func,\n tooltip: PropTypes.string,\n TooltipProps: PropTypes.object,\n ButtonComponent: PropTypes.elementType,\n ButtonProps: PropTypes.object,\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.node,\n 'data-testid': PropTypes.string\n}\n\nAction.defaultProps = {\n size: 'small',\n ButtonComponent: IconButton\n}\n\n/**\n * Dropdown menu action.\n */\nexport const ActionSelect = React.memo(({value, options, tooltip, onChange}) => {\n const [isStatsTooltipOpen, openStatsTooltip, closeStatsTooltip] = useBoolState(false)\n const items = isArray(options)\n ? Object.fromEntries(options.map(x => [x, x]))\n : options\n return \n onChange && onChange(event.target.value)}\n >\n {Object.entries(items).map(([key, value]) =>\n {value}\n )}\n \n \n})\n\nActionSelect.propTypes = {\n value: PropTypes.string,\n options: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.string)]),\n tooltip: PropTypes.string,\n onChange: PropTypes.func\n}\n\n/**\n * Checkbox action.\n */\nexport const ActionCheckbox = React.memo(({value, label, tooltip, onChange}) => {\n const styles = useActionStyles()\n return \n onChange && onChange(value)}\n size=\"small\"\n />}\n className={styles.root}\n label={label}\n />\n \n})\n\nActionCheckbox.propTypes = {\n value: PropTypes.bool,\n label: PropTypes.string,\n tooltip: PropTypes.string,\n onChange: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { cloneDeep } from 'lodash'\nimport AddCircleIcon from '@material-ui/icons/AddCircle'\nimport CancelIcon from '@material-ui/icons/Cancel'\nimport { useSearchContext } from '../SearchContext'\nimport { Action } from '../../Actions'\n\n/**\n * Toggle for hiding/showing a particular widget.\n */\nconst WidgetToggle = React.memo(({quantity, disabled, 'data-testid': testID}) => {\n const { useWidgetValue, useAddWidget, useRemoveWidget, filterData } = useSearchContext()\n const widget = useWidgetValue(quantity)\n const addWidget = useAddWidget()\n const removeWidget = useRemoveWidget()\n const hasWidget = !!widget\n const widgetDefault = filterData[quantity]?.widget\n\n // If there is no default widget configured, then do not show the toggle.\n if (!widgetDefault) return null\n\n return {\n const config = {\n id: quantity,\n editing: false,\n visible: true,\n ...cloneDeep(widgetDefault)\n }\n if (hasWidget) {\n removeWidget(quantity)\n } else {\n addWidget(quantity, config)\n }\n }}\n >\n {hasWidget\n ? \n : }\n \n})\n\nWidgetToggle.propTypes = {\n quantity: PropTypes.string.isRequired,\n disabled: PropTypes.bool,\n 'data-testid': PropTypes.string\n}\n\nexport default WidgetToggle\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { range, size } from 'lodash'\nimport { scalePow, scaleLog } from 'd3-scale'\nimport {\n format,\n getTime,\n fromUnixTime,\n millisecondsToSeconds,\n eachMinuteOfInterval,\n eachHourOfInterval,\n eachDayOfInterval,\n eachWeekOfInterval,\n eachMonthOfInterval,\n eachYearOfInterval,\n differenceInYears,\n differenceInMonths,\n differenceInWeeks,\n differenceInDays,\n differenceInHours,\n differenceInMinutes,\n differenceInSeconds,\n isWithinInterval,\n eachQuarterOfInterval\n} from 'date-fns'\nimport { scale as chromaScale } from 'chroma-js'\nimport { scale as scaleUtils, add, DType, formatNumber } from '../../utils.js'\n\nexport const scales = {\n 'linear': 'linear',\n 'log': 'log',\n '1/2': '1/2',\n '1/4': '1/4',\n '1/8': '1/8'\n}\n\nexport const scalesLimited = {\n 'linear': 'linear',\n 'log': 'log'\n}\n\n/**\n * Creates a scaling function based on the provided type.\n *\n * @param {string} type - The type of scaling function ('linear', '1/2', '1/4', '1/8', 'log').\n * @param {number[]} [domain=[0, 1]] - The input domain for the scale.\n * @param {number[]} [range=[0, 1]] - The output range for the scale.\n * @returns {function} - The scaling function with added properties and methods.\n * @throws {Error} - Throws an error if the scaling type is invalid.\n */\nexport function getScaler(type, domain = [0, 1], range = [0, 1]) {\n let scaler\n\n const powScales = {\n 'linear': 1,\n '1/2': 0.5,\n '1/4': 0.25,\n '1/8': 0.125\n }\n\n const powscale = powScales[type]\n\n if (powscale !== undefined) {\n scaler = scalePow()\n .exponent(powscale)\n .domain(domain)\n .range(range)\n } else if (type === 'log') {\n const adjustedDomain = [Math.max(domain[0], 1), domain[1]]\n scaler = scaleLog()\n .base(10)\n .domain(adjustedDomain)\n .range(range)\n } else {\n throw new Error('Invalid scaling type.')\n }\n\n // Invalid values are mapped to zero. Important especially for log scales.\n const func = (value) => scaler(value) || 0\n\n // Copy all properties and methods from scaler to func\n Object.assign(func, scaler)\n\n return func\n}\n\n/**\n * Returns interval that can be used to split the given range into\n * human-readable, uniformly spaced steps.\n *\n * @param {number} range The range to divide\n * @param {number} steps The targeted number of steps.\n * @param {string} dtype Data type.\n * @param {bool} cap controls whether the final number of intervals can be\n * bigger than the requested amount.\n *\n * @returns The interval as a number\n */\nexport function getInterval(value, steps, dtype, cap = true) {\n const interval = value / steps\n const degree = Math.pow(10, (Math.round(Math.log10(interval))))\n const multipliers = [0.1, 0.2, 0.25, 0.5, 1, 2, 2.5, 5, 10]\n const intervals = scaleUtils(multipliers, degree).filter(x => {\n const capped = cap ? (x >= interval) : true\n const valid = dtype === DType.Int ? x % 1 === 0 : true\n return capped && valid\n })\n const differences = add(intervals, -interval).map(x => Math.abs(x))\n const indexMin = differences.reduce(argMin, 0)\n return intervals[indexMin]\n}\n\nexport const argMin = (iMin, x, i, arr) => {\n return x < arr[iMin] ? i : iMin\n}\n\n/**\n * Returns human-readable, (mostly) uniformly spaced ticks for the given\n * interval. Takes the data type into account when determinining the ticks their\n * formatting. If not valid ticks can be generated, returns an empty list.\n *\n * @param {number} min The minimum value\n * @param {number} max The maximum value\n * @param {number} n Targeted number of ticks. Notice that this typically does\n * not correspond to the final number of ticks.\n * @param {string} dtype Data type for the values\n * @param {number} decimals Number of decimals to show\n * @param {bool} scientific Whether to use scientific notation\n *\n * @returns Array of tick objects containing value and tick.\n */\nexport function getTicks(min, max, n, scale = 'linear', dtype, mode = 'scientific', decimals = 3) {\n if (dtype === DType.Timestamp) {\n const start = fromUnixTime(millisecondsToSeconds(min))\n const end = fromUnixTime(millisecondsToSeconds(max))\n const interval = {start, end}\n\n // Function for splitting ranges using milliseconds\n const splitMilliseconds = (step) => ({start, end}) => {\n const startRound = Math.ceil(getTime(start) / step)\n const endRound = Math.floor(getTime(end) / step)\n return range(startRound, endRound + 1).map(x => x * step)\n }\n\n // Config for the available intervals\n const intervals = {\n fiveyears: {\n difference: (end, start) => differenceInYears(end, start) / 5,\n split: (interval) => eachYearOfInterval(interval).filter(x => {\n return !(x.getFullYear() % 5)\n }),\n format: 'yyyy'\n },\n twoyears: {\n difference: (end, start) => differenceInYears(end, start) / 2,\n split: (interval) => eachYearOfInterval(interval).filter(x => {\n return !(x.getFullYear() % 2)\n }),\n format: 'yyyy'\n },\n years: {\n difference: differenceInYears,\n split: eachYearOfInterval,\n format: 'yyyy'\n },\n threemonths: {\n difference: (end, start) => differenceInMonths(end, start) / 3,\n split: eachQuarterOfInterval,\n format: 'MMM yyyy'\n },\n months: {\n difference: differenceInMonths,\n split: eachMonthOfInterval,\n format: 'MMM'\n },\n weeks: {\n difference: differenceInWeeks,\n split: eachWeekOfInterval,\n format: 'MMM d'\n },\n days: {\n difference: differenceInDays,\n split: eachDayOfInterval,\n format: 'MMM d'\n },\n twelvehours: {\n difference: (end, start) => differenceInHours(end, start) / 12,\n split: (interval) => eachHourOfInterval(interval).filter(x => {\n const values = new Set(['12:00', '24:00'])\n return values.has(format(x, 'k:mm'))\n }),\n format: 'k:mm'\n },\n sixhours: {\n difference: (end, start) => differenceInHours(end, start) / 6,\n split: (interval) => eachHourOfInterval(interval).filter(x => {\n const values = new Set(['6:00', '12:00', '18:00', '24:00'])\n return values.has(format(x, 'k:mm'))\n }),\n format: 'k:mm'\n },\n hours: {\n difference: differenceInHours,\n split: eachHourOfInterval,\n format: 'k:mm'\n },\n thirtyminutes: {\n difference: (end, start) => differenceInMinutes(end, start) / 30,\n split: (interval) => eachMinuteOfInterval(interval, {step: 30}),\n format: 'k:mm'\n },\n fifteenminutes: {\n difference: (end, start) => differenceInMinutes(end, start) / 15,\n split: (interval) => eachMinuteOfInterval(interval, {step: 15}),\n format: 'k:mm'\n },\n minutes: {\n difference: differenceInMinutes,\n split: eachMinuteOfInterval,\n format: 'k:mm'\n },\n thirtyseconds: {\n difference: (end, start) => differenceInSeconds(end, start) / 30,\n split: splitMilliseconds(30000),\n format: 'k:mm:ss'\n },\n fifteensecond: {\n difference: (end, start) => differenceInSeconds(end, start) / 15,\n split: splitMilliseconds(15000),\n format: 'k:mm:ss'\n },\n seconds: {\n difference: differenceInSeconds,\n split: splitMilliseconds(1000),\n format: 'k:mm:ss'\n }\n }\n\n // Calculate the minimum number of ticks that each option may produce. The\n // actual number of ticks cannot be easily calculated without actually\n // producing the ticks, which is not viable when there may be a very large\n // number of them (e.g. milliseconds in a year.)\n const differences = {}\n Object.entries(intervals)\n .forEach(([dur, setup]) => { differences[dur] = setup.difference(end, start) })\n\n // For each sensible option, calculate the actual ticks and their amount.\n const differencesValid = Object.entries(differences)\n .filter(([dur, diff]) => diff <= n) // Filter out values where the minimum number of ticks is beyond the target.\n .map(([dur, diff]) => [dur, intervals[dur].split(interval).filter(x => isWithinInterval(x, interval))]) // Calculate the actual ticks\n .filter(([dur, ticks]) => ticks.length <= n) // Filter out options with more ticks than requested\n .map(([dur, ticks]) => [dur, Math.abs(ticks.length - n), ticks]) // Calculate abs difference to n\n\n // If no valid ticks can be determined, return an empty list.\n if (!differencesValid.length) {\n return []\n }\n\n // Determine the option that has the closest amount of ticks to the targeted\n // amount.\n const closestDuration = differencesValid\n .reduce((prev, curr) => prev[1] < curr[1] ? prev : curr)\n const ticks = closestDuration[2]\n const setup = intervals[closestDuration[0]]\n\n // Format the results and return both the formatted tick and the final\n // value.\n return ticks.map(x => ({value: getTime(x), tick: format(x, setup.format)}))\n } else {\n // Log scale ticks are divided into evenly spaced intervals in the log scale\n if (scale === 'log') {\n const tickRange = max - min\n const degree = Math.floor(Math.log10(tickRange))\n const reduction = Math.ceil(degree / n)\n const degrees = range(1, degree + 1, degree > n ? reduction : 1)\n return degrees.map(x => {\n const value = Math.pow(10, x)\n return {value, tick: formatNumber(value, dtype, mode, decimals)}\n })\n // Calculate reasonable ticks for other scales\n } else {\n const tickRange = max - min\n const multipliers = [0.1, 0.2, 0.25, 0.5, 1, 2, 2.5, 5, 10]\n const degree = Math.pow(10, (Math.round(Math.log10(tickRange))))\n const closestDuration = scaleUtils(multipliers, degree)\n .filter(x => dtype === DType.Int ? x % 1 === 0 : true) // Filter out invalid intervals\n .map(x => [x, Math.floor(tickRange / x)]) // Calculate minimum number of ticks\n .filter(([interval, nMin]) => nMin <= n) // Filter out values where the minimum number of ticks is beyond the target.\n .map(([interval, nMin]) => { // Calculate actual ticks\n const startRound = Math.ceil(min / interval)\n const endRound = Math.floor(max / interval)\n const ticks = range(startRound, endRound + 1).map(x => {\n const value = (x * interval)\n return {value, tick: formatNumber(value, dtype, mode, decimals)}\n })\n return ticks\n })\n .filter((ticks) => ticks.length <= n) // Filter out options with more ticks than requested\n .map((ticks) => [ticks, Math.abs(ticks.length - n)]) // Calculate abs difference to n\n .reduce((prev, curr) => prev[1] < curr[1] ? prev : curr) // Select best option\n return closestDuration[0]\n }\n }\n}\n\n/**\n * Returns the default x-axis layout used in the plots.\n *\n * @param {object} theme The current app theme.\n * @returns An object containing a plotly configuration for an x-axis.\n */\nexport function getXAxisLayout(theme) {\n return {\n automargin: false,\n autorange: true,\n linecolor: '#333',\n linewidth: 1,\n mirror: true,\n ticks: 'outside',\n showline: true,\n fixedrange: true,\n title: {\n standoff: 10,\n font: {\n family: theme.typography.fontFamily,\n size: 16,\n color: '#333'\n },\n tickfont: {\n family: theme.typography.fontFamily,\n size: 14,\n color: '#333'\n }\n }\n }\n}\n\n/**\n * Returns the default y-axis layout used in the plots.\n *\n * @param {object} theme The current app theme.\n * @returns An object containing a plotly configuration for a y-axis.\n */\nexport function getYAxisLayout(theme) {\n return {\n automargin: true,\n autorange: true,\n linecolor: '#333',\n linewidth: 1,\n mirror: true,\n ticks: 'outside',\n showline: true,\n title: {\n standoff: 10,\n font: {\n family: theme.typography.fontFamily,\n size: 16,\n color: '#333'\n }\n },\n tickfont: {\n family: 'Titillium Web,sans-serif',\n size: 14,\n color: '#333'\n }\n }\n}\n\n/**\n * Returns a list of linestyles.\n *\n * @param {number} nLines number of lines to plot\n */\nexport function getLineStyles(nLines, theme, nKinds) {\n const styles = []\n const lineStyles = ['solid', 'dot', 'dashdot']\n const [startColor, endColor] = theme ? [theme.palette.primary.dark, theme.palette.secondary.light] : ['#005271', '#f57c00']\n const colors = chromaScale([startColor, endColor])\n .mode('lch').colors(nLines === 1 ? 2 : nLines)\n for (let i = 0; i < nLines; ++i) {\n const line = {\n dash: nKinds ? lineStyles[(i % nKinds) % lineStyles.length] : nLines <= 5 ? 'solid' : lineStyles[i % lineStyles.length],\n color: colors[Math.floor(i / nKinds) % colors.length],\n width: 2\n }\n styles.push(line)\n }\n return styles\n}\n\n/**\n * Returns a layout for a plot with several vertically stacked plots with a\n * shared x-axis.\n *\n * @param {number} nLines number of lines to plot\n */\nexport function getPlotLayoutVertical(plots, xtitle, theme) {\n // Static layout configuration\n const layout = {\n showlegend: false,\n grid: {\n ygap: 0.15,\n columns: 1,\n pattern: 'independent',\n roworder: 'top to bottom'\n }\n }\n\n // Create configuration for each axis that has valid data.\n let iAxis = 0\n for (const plot of plots) {\n if (plot.data !== false) {\n ++iAxis\n const n = iAxis === 1 ? '' : iAxis\n layout[`yaxis${n}`] = { ...getYAxisLayout(theme), title: plot.ytitle }\n layout[`xaxis${n}`] = {\n ...getXAxisLayout(theme),\n showticks: true,\n showticklabels: false\n }\n }\n }\n\n // The last available plot gets the shared x-axis label\n const n = iAxis === 1 ? '' : iAxis\n layout[`xaxis${n}`] = {\n ...getXAxisLayout(theme),\n showticklabels: true,\n title: xtitle\n }\n\n // Add subplot layout based on the found valid data\n layout.grid.subplots = range(1, iAxis + 1).map(i => {\n const n = i === 1 ? '' : i\n return `x${n}y${n}`\n })\n layout.grid.rows = iAxis\n\n return layout\n}\n\n/**\n * Returns traces for a plot with several vertically stacked plots with a shared\n * x-axis.\n *\n * @param {number} nLines number of lines to plot\n */\nexport function getPlotTracesVertical(plots, theme) {\n const traces = []\n let iAxis = 0\n for (const plot of plots) {\n if (plot.data) {\n ++iAxis\n const n = iAxis === 1 ? '' : iAxis\n traces.push(\n {\n x: plot.data.x,\n y: plot.data.y,\n yaxis: `y${n}`,\n xaxis: `x${n}`,\n type: 'scatter',\n mode: 'lines',\n line: {\n color: theme.palette.primary.main,\n width: 2\n }\n }\n )\n }\n }\n return size(traces) ? traces : undefined\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useState } from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport {\n Menu,\n MenuItem,\n FormControl,\n Tooltip,\n InputLabel,\n Select,\n Button\n} from '@material-ui/core'\nimport { atom, atomFamily, useRecoilState, useRecoilCallback, useRecoilValue } from 'recoil'\n\nconst presets = {\n new: {\n icon: 'filled',\n iconSize: 'small',\n menu: 'visible',\n inputVariant: 'filled',\n inputSize: 'small',\n aggIndicator: 'on',\n aggCollapse: 'off'\n },\n old: {\n icon: 'plain',\n iconSize: 'medium',\n menu: 'hidden',\n inputVariant: 'outlined',\n inputSize: 'medium',\n aggIndicator: 'off',\n aggCollapse: 'off'\n }\n}\n\n/**\n * Item in the GUI menu.\n */\nconst usePrototypeMenuItemStyles = makeStyles(theme => ({\n root: {},\n form: {\n width: '100%'\n }\n}))\nconst GUIMenuItem = React.memo(({title, tooltip, value, onChange, options}) => {\n const styles = usePrototypeMenuItemStyles()\n return \n \n \n {title}\n \n \n \n \n})\nGUIMenuItem.propTypes = {\n title: PropTypes.string,\n tooltip: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func,\n options: PropTypes.array\n}\n\n/**\n * GUI menu that can be used to dynamically control the GUI layout the menu is\n * hidden by default but can be shown by pressing Alt+G.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n position: 'fixed',\n bottom: theme.spacing(2),\n right: theme.spacing(2),\n zIndex: 2\n },\n menu: {\n width: theme.spacing(25)\n }\n}))\nconst GUIMenu = React.memo(() => {\n const styles = useStyles()\n const [visible, setVisible] = useState(false)\n const [icon, setIcon] = useRecoilState(guiState('icon'))\n const [iconSize, setIconSize] = useRecoilState(guiState('iconSize'))\n const [menu, setMenu] = useRecoilState(guiState('menu'))\n const [inputVariant, setInputVariant] = useRecoilState(guiState('inputVariant'))\n const [inputSize, setInputSize] = useRecoilState(guiState('inputSize'))\n const [aggIndicator, setAggIndicator] = useRecoilState(guiState('aggIndicator'))\n const [aggCollapse, setAggCollapse] = useRecoilState(guiState('aggCollapse'))\n const preset = useRecoilValue(presetState)\n const [anchorEl, setAnchorEl] = React.useState(null)\n const open = Boolean(anchorEl)\n const handleClick = (event) => {\n setAnchorEl(event.currentTarget)\n }\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n // When the menu is mounted, add a global key listener that can be used to\n // toggle the menu.\n useEffect(() => {\n function handleHotkey(event) {\n if (event.altKey && event.key === 'g') {\n setAnchorEl(old => old === null ? old : null)\n setVisible(old => !old)\n }\n }\n window.addEventListener('keydown', handleHotkey)\n return () => window.removeEventListener('keydown', handleHotkey)\n }, [])\n\n const updatePreset = useRecoilCallback(({set}) => (preset) => {\n const presetMap = presets[preset]\n for (const [key, value] of Object.entries(presetMap)) {\n set(guiState(key), value)\n }\n set(presetState, preset)\n }, [])\n\n return
\n \n \n
\n \n \n \n \n \n \n \n \n
\n \n
\n})\nconst presetDefault = 'new'\nexport const presetState = atom({\n key: 'preset',\n default: presetDefault\n})\nexport const guiState = atomFamily({\n key: 'guiState',\n default: (name) => presets[presetDefault][name]\n})\n\nexport default GUIMenu\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo, useCallback } from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport {\n Radio,\n FormControl,\n FormLabel,\n FormControlLabel,\n RadioGroup,\n Menu\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { useRecoilValue } from 'recoil'\nimport MoreVertIcon from '@material-ui/icons/MoreVert'\nimport FilterTitle from '../FilterTitle'\nimport { Actions, ActionHeader, Action, ActionSelect } from '../../Actions'\nimport WidgetToggle from '../widgets/WidgetToggle'\nimport { scales } from '../../plotting/common'\nimport { guiState } from '../../GUIMenu'\nimport { useBoolState } from '../../../hooks'\n\n/**\n * The quantity label and actions shown by all filter components.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n marginBottom: theme.spacing(0.5),\n height: '2.5rem',\n width: '100%'\n },\n menuItem: {\n width: '10rem',\n margin: theme.spacing(2),\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1)\n },\n row: {\n display: 'flex',\n height: '100%',\n alignItems: 'center',\n flexGrow: 1,\n minWidth: 0\n },\n spacer: {\n flexGrow: 1,\n minWidth: 0\n }\n}))\nconst InputHeader = React.memo(({\n quantity,\n label,\n description,\n disableWidget,\n disableStatistics,\n scale,\n onChangeScale,\n actions,\n actionsAlign,\n className,\n classes\n}) => {\n const styles = useStyles({classes: classes})\n const [anchorEl, setAnchorEl] = React.useState(null)\n const isSettingsOpen = Boolean(anchorEl)\n const [isDragging, setDragging, setNotDragging] = useBoolState(false)\n const [isTooltipOpen, openTooltip, closeTooltip] = useBoolState(false)\n const menu = useRecoilValue(guiState('menu'))\n\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n const closeMenu = useCallback(() => {\n setAnchorEl(null)\n }, [])\n const handleMouseDown = useCallback((event) => {\n setDragging()\n closeTooltip()\n }, [closeTooltip, setDragging])\n const handleMouseUp = useCallback(() => {\n setNotDragging()\n }, [setNotDragging])\n const tooltipProps = useMemo(() => ({\n open: isTooltipOpen,\n onClose: closeTooltip,\n onOpen: () => !isDragging && openTooltip()\n }), [isTooltipOpen, closeTooltip, isDragging, openTooltip])\n\n // Dedice the menu component. The tooltip of scale dropdown needs to be\n // controlled, otherwise it won't close as we open the select menu.\n const menuComp = menu === 'hidden'\n ? <>\n \n \n \n \n \n Statistics scaling\n onChangeScale(value) : undefined}\n >\n {Object.entries(scales).map(([key, value]) =>\n } />\n )}\n \n \n \n \n : \n\n return \n \n \n \n
\n
\n
\n {actionsAlign === 'left' && actions}\n {!disableStatistics && menuComp}\n {!disableWidget && }\n {actionsAlign === 'right' && actions}\n
\n})\n\nInputHeader.propTypes = {\n quantity: PropTypes.string.isRequired,\n label: PropTypes.string,\n description: PropTypes.string,\n disableWidget: PropTypes.bool,\n disableStatistics: PropTypes.bool,\n scale: PropTypes.string,\n onChangeScale: PropTypes.func,\n variant: PropTypes.string,\n actions: PropTypes.node,\n actionsAlign: PropTypes.oneOf(['left', 'right']),\n className: PropTypes.string,\n classes: PropTypes.object\n}\n\nInputHeader.defaultProps = {\n underscores: false,\n disableWidget: false,\n disableStatistics: false,\n actionsAlign: 'left',\n scale: 'linear'\n}\n\nexport default InputHeader\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport { Tooltip } from '@material-ui/core'\nimport PropTypes from 'prop-types'\n\n/**\n * The quantity label shown by all filter components.\n */\nconst InputTooltip = React.memo(({\n unavailable,\n ...rest\n}) => {\n let title = rest?.title || ''\n if (unavailable) title = 'No options available with current query.'\n\n return \n})\n\nInputTooltip.propTypes = {\n unavailable: PropTypes.bool,\n children: PropTypes.node\n}\n\nexport default InputTooltip\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { createContext } from 'react'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport InputHeader from './InputHeader'\nimport InputTooltip from './InputTooltip'\nimport { useSearchContext } from '../SearchContext'\n\nexport const inputSectionContext = createContext()\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n flexDirection: 'column',\n boxSizing: 'border-box'\n },\n label: {\n marginBottom: `${theme.spacing(-0.5)}px !important`\n }\n}))\nconst InputSection = React.memo(({\n label,\n section,\n description,\n className,\n disableHeader,\n classes,\n children,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const styles = useStyles({classes: classes, theme: theme})\n const { filterData } = useSearchContext()\n\n // Determine the description and units\n const def = filterData[section]\n const nested = def?.nested\n const repeats = def?.repeats\n const descFinal = description || def?.description || ''\n const labelFinal = label || def?.label\n\n return \n
\n {!disableHeader && }\n \n {children}\n \n
\n
\n})\n\nInputSection.propTypes = {\n label: PropTypes.string,\n section: PropTypes.string.isRequired,\n description: PropTypes.string,\n disableHeader: PropTypes.bool,\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.node,\n 'data-testid': PropTypes.string\n}\n\nexport default InputSection\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useState, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles, Tooltip } from '@material-ui/core'\nimport { useResizeDetector } from 'react-resize-detector'\n\n/**\n * Component for displaying text that should be truncated with an Ellipsis\n * either in front of the text or after the text. Can lso show the full text on\n * hover as a tooltip.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'block',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n },\n // This is a trick to make the ellipsis appear in front. Note the special sign\n // injected in front that makes the content flow form left-to-right.\n ellipsisFront: {\n direction: 'rtl',\n textAlign: 'left',\n '&::before': {\n content: '\"‎\"'\n }\n }\n}))\n\nconst Ellipsis = React.memo(({front, children, tooltip}) => {\n const styles = useStyles()\n const {width, ref} = useResizeDetector()\n const [showTooltip, setShowTooltip] = useState(false)\n\n // Used to determine whether to show the tooltip or not\n const compareSize = useCallback(() => {\n if (!ref?.current) return\n const compare =\n ref.current.scrollWidth > ref.current.clientWidth\n setShowTooltip(compare)\n }, [ref])\n\n // Whenever the component width changes, check if tooltip should be shown\n useEffect(() => { compareSize() }, [width, compareSize])\n\n // Define state and function to update the value\n return \n {children}\n \n})\n\nEllipsis.propTypes = {\n children: PropTypes.node,\n tooltip: PropTypes.string,\n front: PropTypes.bool\n}\n\nEllipsis.defaultProps = {\n tooltip: ''\n}\n\nexport default Ellipsis\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo, useContext } from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { Typography, Tooltip } from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { useSearchContext } from './SearchContext'\nimport { inputSectionContext } from './input/InputSection'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport Ellipsis from '../visualization/Ellipsis'\n\n/**\n * Title for a metainfo quantity or section that is used in a search context.\n * By default the label, description and unit are automatically retrieved from\n * the filter config.\n */\nconst useStaticStyles = makeStyles(theme => ({\n root: {\n },\n text: {\n },\n title: {\n fontWeight: 600,\n color: theme.palette.grey[800]\n },\n right: {\n overflow: 'hidden'\n },\n down: {\n overflow: 'hidden',\n writingMode: 'vertical-rl',\n textOrientation: 'mixed'\n },\n up: {\n overflow: 'hidden',\n writingMode: 'vertical-rl',\n textOrientation: 'mixed',\n transform: 'rotate(-180deg)'\n }\n}))\nconst FilterTitle = React.memo(({\n quantity,\n label,\n description,\n unit,\n variant,\n TooltipProps,\n onMouseDown,\n onMouseUp,\n className,\n classes,\n rotation,\n disableUnit,\n noWrap\n}) => {\n const styles = useStaticStyles({classes})\n const { filterData } = useSearchContext()\n const sectionContext = useContext(inputSectionContext)\n const {units} = useUnitContext()\n const section = sectionContext?.section\n\n // Create the final label\n const finalLabel = useMemo(() => {\n let finalLabel = label || filterData[quantity]?.label\n if (!disableUnit) {\n let finalUnit\n if (unit) {\n finalUnit = new Unit(unit).label()\n } else if (filterData[quantity]?.unit) {\n finalUnit = new Unit(filterData[quantity].unit).toSystem(units).label()\n }\n if (finalUnit) {\n finalLabel = `${finalLabel} (${finalUnit})`\n }\n }\n return finalLabel\n }, [filterData, quantity, units, label, unit, disableUnit])\n\n // Determine the final description\n const finalDescription = description || filterData[quantity]?.description || ''\n let tooltip = ''\n if (finalDescription && quantity) {\n tooltip = (\n <>\n {finalLabel}\n Description: {finalDescription}
\n Path: {quantity}\n \n )\n }\n\n return \n
\n \n {finalLabel}\n \n
\n
\n})\n\nFilterTitle.propTypes = {\n quantity: PropTypes.string,\n label: PropTypes.string,\n unit: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n description: PropTypes.string,\n variant: PropTypes.string,\n className: PropTypes.string,\n classes: PropTypes.object,\n rotation: PropTypes.oneOf(['up', 'right', 'down']),\n disableUnit: PropTypes.bool,\n TooltipProps: PropTypes.object, // Properties forwarded to the Tooltip\n onMouseDown: PropTypes.func,\n onMouseUp: PropTypes.func,\n placement: PropTypes.string,\n noWrap: PropTypes.bool\n}\n\nFilterTitle.defaultProps = {\n variant: 'body2',\n rotation: 'right',\n noWrap: true\n}\n\nexport default FilterTitle\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo, useCallback } from 'react'\nimport { makeStyles } from '@material-ui/core'\nimport { Cancel } from '@material-ui/icons'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { useSearchContext } from '../SearchContext'\nimport FilterTitle from '../FilterTitle'\nimport { Actions, ActionHeader, Action } from '../../Actions'\nimport { useBoolState } from '../../../hooks'\n\n/**\n * The header displayed by all widgets.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n marginBottom: theme.spacing(0.5),\n height: '2.5rem',\n width: '100%'\n },\n handle: {\n display: 'flex',\n height: '100%',\n alignItems: 'center',\n flexGrow: 1,\n minWidth: 0,\n cursor: 'grabbing'\n },\n spacer: {\n flexGrow: 1,\n minWidth: 0\n }\n}))\nconst WidgetHeader = React.memo(({\n id,\n quantity,\n label,\n description,\n disableUnit,\n actions,\n className,\n classes\n}) => {\n const styles = useStyles({classes: classes})\n const { useRemoveWidget } = useSearchContext()\n const removeWidget = useRemoveWidget()\n const [isDragging, setDragging, setNotDragging] = useBoolState(false)\n const [isTooltipOpen, openTooltip, closeTooltip] = useBoolState(false)\n\n const handleMouseDown = useCallback((event) => {\n setDragging()\n closeTooltip()\n }, [closeTooltip, setDragging])\n\n const handleMouseUp = useCallback(() => {\n setNotDragging()\n }, [setNotDragging])\n\n const handleRemove = useCallback(() => {\n removeWidget(id)\n }, [removeWidget, id])\n\n const tooltipProps = useMemo(() => ({\n open: isTooltipOpen,\n onClose: closeTooltip,\n onOpen: () => !isDragging && openTooltip()\n }), [isTooltipOpen, closeTooltip, isDragging, openTooltip])\n\n return \n \n \n \n
\n
\n
\n {actions}\n \n \n \n
\n})\n\nWidgetHeader.propTypes = {\n id: PropTypes.string.isRequired,\n quantity: PropTypes.string,\n label: PropTypes.string,\n description: PropTypes.string,\n disableUnit: PropTypes.bool,\n variant: PropTypes.string,\n actions: PropTypes.node,\n className: PropTypes.string,\n classes: PropTypes.object\n}\n\nexport default WidgetHeader\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useMemo } from 'react'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { cloneDeep, isNil } from 'lodash'\nimport { object, string, number } from 'yup'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { Edit } from '@material-ui/icons'\nimport { Action } from '../../Actions'\nimport WidgetHeader from './WidgetHeader'\n\n/**\n * A thin wrapper for displaying widgets.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n flexDirection: 'column'\n }\n}))\nexport const Widget = React.memo(({\n id,\n quantity,\n title,\n description,\n onEdit,\n className,\n children,\n actions\n}) => {\n const styles = useStyles()\n\n const handleEdit = useCallback(() => {\n onEdit && onEdit()\n }, [onEdit])\n\n const actionsFinal = useMemo(() => {\n return <>\n {!!actions && actions}\n \n \n \n \n }, [handleEdit, actions])\n\n return
\n \n {children}\n
\n})\n\nWidget.propTypes = {\n id: PropTypes.string.isRequired,\n quantity: PropTypes.string,\n title: PropTypes.string,\n description: PropTypes.string,\n onEdit: PropTypes.func,\n className: PropTypes.string,\n children: PropTypes.node,\n actions: PropTypes.node\n}\n\nexport const schemaLayout = object({\n x: number().test(\n 'is-integer-or-infinity',\n // eslint-disable-next-line no-template-curly-in-string\n '${path} is not a valid integer number',\n (value, context) => Number.isInteger(value) || value === Infinity || isNil(value)\n ),\n y: number().integer(),\n w: number().integer(),\n h: number().integer(),\n minW: number().integer(),\n minH: number().integer()\n})\nexport const schemaWidget = object({\n type: string().required(),\n title: string(),\n layout: object({\n sm: schemaLayout,\n md: schemaLayout,\n lg: schemaLayout,\n xl: schemaLayout,\n xxl: schemaLayout\n }),\n id: string().strip(),\n editing: string().strip(),\n visible: string().strip()\n})\nexport const schemaAxisBase = object({\n scale: string().nullable()\n})\nexport const schemaAxis = object({\n quantity: string().required(),\n unit: string().nullable(),\n title: string().nullable(),\n scale: string().nullable()\n})\nexport const schemaAxisOptional = object({\n quantity: string().nullable(),\n unit: string().nullable(),\n title: string().nullable(),\n scale: string().nullable()\n})\nexport const schemaMarkers = object({\n color: schemaAxisOptional\n})\n\n/**\n * Transforms a list of widgets into the internal object representation.\n * @param {array} widgetList Array of widget configs.\n */\nexport function getWidgetsObject(widgetList) {\n const widgets = cloneDeep(widgetList)\n return widgets\n ? Object.fromEntries(widgets.map((widget, index) => {\n return [\n index.toString(),\n {...widget, id: index.toString(), editing: false, visible: true}\n ]\n }))\n : {}\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Represents a suggestable option in the search bar. In TypeScript this would\n * be an interface.\n */\nexport class SearchSuggestion {\n input\n type\n history\n\n constructor(param) {\n this.input = param.input\n this.type = param.type\n this.history = param.history\n this.key = `${this.input}-${this.type}`\n }\n}\n\n/**\n * Enum for types of suggestions. In TypeScript this would be an Enum.\n */\nexport const SuggestionType = {\n Freetext: 'free_text',\n Equality: 'equality',\n RangeHalfBounded: 'range_half_bounded',\n RangeBounded: 'range_bounded',\n Existence: 'existence',\n Name: 'name'\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useEffect, useState, useRef, useMemo, useContext } from 'react'\nimport compose from 'compose-function'\nimport jmespath from 'jmespath'\nimport {\n atom,\n atomFamily,\n selector,\n selectorFamily,\n useSetRecoilState,\n useRecoilValue,\n useRecoilState,\n useRecoilCallback\n} from 'recoil'\nimport {\n debounce,\n isBoolean,\n isEmpty,\n isEqual,\n isArray,\n isPlainObject,\n isNil,\n isSet,\n isObject,\n isFunction,\n size,\n cloneDeep,\n flattenDeep\n} from 'lodash'\nimport qs from 'qs'\nimport { useLocation, useHistory } from 'react-router-dom'\nimport { Box, Link, makeStyles } from '@material-ui/core'\nimport { v4 as uuidv4 } from 'uuid'\nimport PropTypes from 'prop-types'\nimport { useApi } from '../api'\nimport {\n authorList,\n entryName,\n entryType,\n formatTimestamp,\n formatNumber,\n formatBoolean,\n parseQuantityName,\n parseJMESPath,\n rsplit,\n parseOperator,\n getSuggestions,\n DType\n} from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useErrors } from '../errors'\nimport { combinePagination, addColumnDefaults } from '../datatable/Datatable'\nimport UploadStatusIcon from '../uploads/UploadStatusIcon'\nimport { getWidgetsObject } from './widgets/Widget'\nimport { inputSectionContext } from './input/InputSection'\nimport { SearchSuggestion } from './SearchSuggestion'\nimport { withFilters } from './FilterRegistry'\nimport { useUnitContext } from '../units/UnitContext'\n\nconst useWidthConstrainedStyles = makeStyles(theme => ({\n root: {\n maxWidth: '500px',\n textOverflow: 'ellipsis',\n overflow: 'hidden'\n }\n}))\n\nfunction WidthConstrained(props) {\n const styles = useWidthConstrainedStyles()\n return \n {props.children}\n \n}\nWidthConstrained.propTypes = {\n children: PropTypes.node\n}\n\nconst debounceTime = 450\n\nfunction parseQueryString(queryString) {\n return queryString\n ? qs.parse(queryString, {comma: true})\n : undefined\n}\n\n/**\n * Removes keycloak-specific fragments from the given URL.\n*/\nfunction removeKeycloak(url) {\n for (const pattern of ['#state=', '#iss=', '#error=']) {\n url = url.split(pattern)[0]\n }\n return url\n}\n\nconst RouteListener = React.memo(() => {\n const location = useLocation()\n const history = useHistory()\n const { useQueryString, useSetFilters, useParseQueries } = useSearchContext()\n const queryString = useQueryString()()\n const setFilters = useSetFilters()\n const parseQueries = useParseQueries()\n const oldQuery = useRef()\n\n // When query changes, update history\n useEffect(() => {\n history.replace(history.location.pathname + '?' + queryString)\n oldQuery.current = queryString\n }, [history, queryString])\n\n // When location changes, update SearchContext if query has changed.\n useEffect(() => {\n // The query string needs to contain everything in the hash as well, since\n // the syntax for data within custom schemas uses a hashtag. TODO: Keycloak\n // seems to use the hashtag for special purposes as well, which causes some\n // clashes when loading the page from scratch.\n const queryString = removeKeycloak(location.search.slice(1) + location.hash)\n // Empty query string preserves the old filters, as this will enable people\n // to preserve filters when changing apps. This causes minor\n // inconsistencies, but might be better for the UX.\n if (!isEmpty(queryString) && queryString !== oldQuery.current) {\n setFilters(parseQueries(parseQueryString(queryString)))\n }\n }, [location, setFilters, parseQueries])\n\n return null\n})\n\nRouteListener.propTypes = {\n}\n\n/**\n * HOC that handles the two-way syncing of URL query parameters and\n * SearchContext filter values.\n */\nexport const withQueryString = (WrappedComponent) => {\n const WithQueryString = ({initialFilterValues, children, ...rest}) => {\n const firstRender = useRef(true)\n const valueRef = useRef()\n\n // Extract URL query parameters, ignore keycloak authentication state\n // parameters starting with '#iss='.\n useMemo(() => {\n if (firstRender.current) {\n const split = window.location.href.split('?')\n const search = (split.length > 1)\n ? parseQueryString(removeKeycloak(split.slice(-1)[0]))\n : {}\n valueRef.current = {...(initialFilterValues || {}), ...search}\n firstRender.current = false\n }\n }, [initialFilterValues])\n\n return \n {children}\n \n \n }\n\n WithQueryString.displayName = `withQueryString(${WrappedComponent.displayName || WrappedComponent.name})`\n WithQueryString.propTypes = {\n initialFilterValues: PropTypes.object, // Determines which filters are available\n children: PropTypes.node // Determines which filters are available\n }\n\n return WithQueryString\n}\n\n/**\n * React context that provides access to the search state implemented with\n * Recoil.js. The purpose of this context is to hide the Recoil.js\n * implementation details and provide a clean access to individual states.\n *\n * Each search filter, aggregation query and aggregation result is mapped into a\n * separate Recoil.js Atom. This allows components to hook into individual\n * search parameters (both for setting and reading their value). This performs\n * much better than having larger Atoms, as this would cause several components\n * to render even if they are not affected by some other search filter or\n * result.\n *\n * Access to the search state is typically made through functions that can be\n * accessed from the context. This way components can hook into individual\n * values of information and do not have to re-render. If we were to provide\n * e.g. the filter values directly within the search context, each component\n * depending on the context would re-render for each filter change regardless if\n * it actually changes the state of that component or not.\n */\nexport const searchContext = React.createContext()\nexport const SearchContextRaw = React.memo(({\n resource,\n initialFiltersLocked,\n initialColumns,\n initialRows,\n initialFilterMenus,\n initialPagination,\n initialDashboard,\n initialFilterData,\n initialFilterGroups,\n initialFilterValues,\n initialSearchSyntaxes,\n id,\n suggestionHistorySize,\n children\n}) => {\n const {api, user} = useApi()\n const {units} = useUnitContext()\n const {raiseError} = useErrors()\n const oldQuery = useRef(undefined)\n const oldPagination = useRef(undefined)\n const paginationResponse = useRef(undefined)\n const updatedAggsMap = useRef({})\n const apiQueue = useRef([])\n const apiMap = useRef({})\n const updatedFilters = useRef(new Set())\n const firstLoad = useRef(true)\n const disableUpdate = useRef(false)\n const indexFilters = useRef(0)\n const indexLocked = useRef(0)\n const contextID = useMemo(() => uuidv4(), [])\n\n // Initialize the set of filters that are available in this context\n const {initialFilterPaths, initialFilterAbbreviations} = useMemo(() => {\n return {\n initialFilterPaths: new Set(Object.keys(initialFilterData)),\n initialFilterAbbreviations: getAbbreviations(initialFilterData)\n }\n }, [initialFilterData])\n\n // The final set of columns\n const columns = useMemo(() => {\n if (!initialColumns) return undefined\n\n let options = cloneDeep(initialColumns)\n options.forEach(option => {\n const parseResults = parseJMESPath(option.quantity)\n if (parseResults.error) {\n throw Error(`Invalid JMESPath query in the app columns: ${option.quantity}`)\n }\n option.sortable = parseResults.quantity === option.quantity\n const filter = initialFilterData[parseResults.quantity]\n const storageUnit = filter?.unit\n const displayUnit = option.unit\n const finalUnit = (storageUnit || displayUnit)\n ? displayUnit\n ? new Unit(displayUnit)\n : new Unit(storageUnit).toSystem(units)\n : undefined\n option.label = option.title || filter?.label\n if (finalUnit) {\n option.label = `${option.label} (${finalUnit.label()})`\n }\n\n // Automatically determine the render function based on metainfo.\n option.render = (data) => {\n // Get value using JMESPath\n let value = jmespath.search(data, parseResults.path)\n if (isNil(value)) return value\n\n // Flatten arrays to a single list\n const isList = isArray(value)\n value = isList ? flattenDeep(value) : value\n\n // Function for rendering individual values\n const renderValue = (value, option) => {\n const format = option.format\n const dtype = filter?.dtype\n\n if (dtype === DType.Timestamp) {\n return formatTimestamp(value, format?.mode)\n } else if (dtype === DType.Boolean) {\n return formatBoolean(value)\n }\n\n if (finalUnit) {\n value = new Quantity(value, storageUnit).to(finalUnit).value()\n }\n if (dtype === DType.Int || dtype === DType.Float) {\n return formatNumber(value, dtype, format?.mode, format?.decimals)\n }\n\n return value\n }\n\n return isList\n ? value.map((v) => renderValue(v, option)).join(option?.format?.separator || \", \")\n : renderValue(value, option)\n }\n })\n\n // Custom render and other setting overrides are used for a subset of\n // columns.\n const overrides = {\n entry_name: {\n render: (entry) => {entryName(entry)}\n },\n entry_type: {\n render: (entry) => {entryType(entry)}\n },\n upload_create_time: {\n render: row => row?.upload_create_time\n ? formatTimestamp(row.upload_create_time)\n : no upload time\n },\n entry_create_time: {\n render: row => row?.entry_create_time\n ? formatTimestamp(row.entry_create_time)\n : no entry time\n },\n authors: {\n sortable: false,\n render: row => authorList(row),\n align: 'left'\n },\n references: {\n sortable: false,\n render: row => {\n const refs = row.references || []\n if (refs.length > 0) {\n return (\n
\n {refs.map((ref, i) => \n {ref}{(i + 1) < refs.length ? ', ' : }\n )}\n
\n )\n } else {\n return no references\n }\n }\n },\n datasets: {\n sortable: false,\n render: entry => {\n const datasets = entry.datasets || []\n if (datasets.length > 0) {\n return datasets.map(dataset => dataset.dataset_name).join(', ')\n } else {\n return no datasets\n }\n }\n },\n published: {\n render: (entry) => \n }\n }\n\n // Add key, defaults, and custom overrides\n options = options.map((column) => ({...column, key: column.quantity}))\n addColumnDefaults(options, undefined, initialFilterData)\n options = options.map((column) => ({...column, ...(overrides[column.quantity] || {})}))\n\n return options\n }, [initialFilterData, initialColumns, user, units])\n\n // The final row configuration\n const rows = useMemo(() => {\n return initialRows || undefined\n }, [initialRows])\n\n // The final menu configuration\n const filterMenus = useMemo(() => {\n return initialFilterMenus || undefined\n }, [initialFilterMenus])\n\n // The final dashboard configuration\n const dashboard = useMemo(() => {\n return initialDashboard\n ? {...initialDashboard, widgets: getWidgetsObject(initialDashboard?.widgets || [])}\n : undefined\n }, [initialDashboard])\n\n // Initialize the search context state: any parameters in the URL are read and\n // default values as specified in filter registry are loaded\n const [initialQuery, initialAggs, filterDefaults] = useMemo(() => {\n const filterDefaults = {}\n for (const [key, value] of Object.entries(initialFilterData)) {\n if (!isNil(value.default)) {\n filterDefaults[key] = value.default\n }\n }\n const initialAggs = {}\n for (const key of initialFilterPaths) {\n initialAggs[key] = {\n default: {update: false}\n }\n }\n return [\n parseQueries(initialFilterValues, initialFilterData, initialFilterAbbreviations.filterFullnames),\n initialAggs,\n filterDefaults\n ]\n }, [initialFilterData, initialFilterAbbreviations, initialFilterValues, initialFilterPaths])\n\n // Atoms + setters and getters are used instead of regular React states to\n // avoid re-rendering components that are not depending on these values. The\n // Recoil mechanisms are abstracted under hooks in order to make it easier to\n // replace Recoil with some other state management library in the future.\n const {\n useFilterLocked,\n useFiltersLocked,\n useFiltersLockedState,\n useFilterValue,\n useSetFilter,\n useFilterState,\n useFilters,\n useFilterNames,\n useFiltersData,\n useFilterMaps,\n useResetFilters,\n useQueryString,\n useDynamicQueryModes,\n aggsFamily,\n useWidgetValue,\n useSetWidget,\n useWidgetState,\n useWidgetsValue,\n useWidgetsState,\n useAddWidget,\n useRemoveWidget,\n useResetWidgets,\n useQuery,\n useSearchSuggestionsValue,\n useSetSearchSuggestions,\n usePagination,\n useSetPagination,\n usePaginationState,\n useAgg,\n useAggs,\n useSetAggsResponse,\n useSetFilters,\n useUpdateFilter,\n useIsMenuOpen,\n useSetIsMenuOpen,\n useIsCollapsed,\n useSetIsCollapsed,\n useIsStatisticsEnabled,\n useSetIsStatisticsEnabled,\n useApiQuery,\n useSetApiQuery,\n useApiData,\n useSetApiData,\n useResults,\n useSetResults,\n useResultsUsed,\n useRequired\n } = useMemo(() => {\n const isMenuOpenState = atom({\n key: `isMenuOpen_${contextID}`,\n default: false\n })\n\n const isCollapsedState = atom({\n key: `isCollapsed_${contextID}`,\n default: false\n })\n\n const isStatisticsEnabledState = atom({\n key: `statisticsEnabled_${contextID}`,\n default: true\n })\n\n const apiDataState = atom({\n key: `apiData_${contextID}`,\n default: null\n })\n\n const apiQueryState = atom({\n key: `apiQuery_${contextID}`,\n default: null\n })\n\n const resultsState = atom({\n key: `results_${contextID}`,\n default: {\n pagination: {}\n }\n })\n\n const resultsUsedState = atom({\n key: `resultsUsed_${contextID}`,\n default: false\n })\n\n let suggestions = []\n const suggestionID = id && `nomad-searchcontext-${id}`\n if (suggestionID) {\n try {\n suggestions = JSON\n .parse(window.localStorage.getItem(suggestionID))\n .map(item => new SearchSuggestion(item))\n .slice(0, suggestionHistorySize)\n } catch (e) {\n }\n }\n const searchSuggestionsState = atom({\n key: `searchSuggestions_${contextID}`,\n default: suggestions,\n effects: [\n ({onSet}) => {\n if (suggestionID) {\n onSet((newValue, _, isReset) => {\n isReset\n ? window.localStorage.removeItem(suggestionID)\n : window.localStorage.setItem(suggestionID, JSON.stringify(newValue))\n })\n }\n }\n ]\n })\n\n const requiredState = atom({\n key: `required_${contextID}`,\n default: {\n exclude: resource === 'entries' ? ['quantities', 'sections', 'files'] : undefined\n }\n })\n\n // Stores the available filters. Initialized with static filters, can be\n // modified later.\n const filtersDataState = atom({\n key: `filtersData_${contextID}`,\n default: initialFilterData\n })\n\n const filterNamesState = selector({\n key: `filters${contextID}`,\n get: ({get}) => new Set(Object.keys(get(filtersDataState)))\n })\n\n const queryFamily = atomFamily({\n key: `queryFamily_${contextID}`,\n default: (name) => initialQuery[name]\n })\n\n const dynamicQueryModesFamily = atomFamily({\n key: `dynamicQueryModesFamily_${contextID}`,\n default: (name) => undefined\n })\n\n // Used to get/set the state of all filters at once\n const filtersState = selector({\n key: `filtersState_${contextID}`,\n get: ({get}) => {\n const query = {}\n for (const key of get(filterNamesState)) {\n const filter = get(queryFamily(key))\n query[key] = filter\n }\n return query\n },\n set: ({get, set}, values) => {\n for (const key of get(filterNamesState)) {\n set(queryFamily(key), values?.[key])\n }\n }\n })\n\n // Stores a mapping between filter abbreviations and their full names.\n const filterMapsState = selector({\n key: `filterAbbreviations_${contextID}`,\n get: ({get}) => {\n const filterData = get(filtersDataState)\n return getAbbreviations(filterData)\n }\n })\n\n const paginationState = atom({\n key: `pagination_${contextID}`,\n default: initialPagination\n })\n\n const guiLocked = parseQueries(initialFiltersLocked, initialFilterData, initialFilterAbbreviations.filterFullnames)\n const lockedFamily = atomFamily({\n key: `lockedFamily_${contextID}`,\n default: (name) => guiLocked?.[name]\n })\n\n // Used to set the locked state of several filters at once\n const lockedState = selector({\n key: `lockedState_${contextID}`,\n get: ({get}) => {\n const locks = {}\n for (const key of get(filterNamesState)) {\n const filter = get(lockedFamily(key))\n if (!isNil(filter)) locks[key] = filter\n }\n return locks\n }\n })\n\n /**\n * A Recoil.js selector that aggregates all the currently set filters into a\n * single query object used by the API.\n */\n const queryState = selector({\n key: `query_${contextID}`,\n get: ({get}) => {\n const query = {}\n for (const key of get(filterNamesState)) {\n const filter = get(queryFamily(key))\n if (!isNil(filter) && (!isObject(filter) || !isEmpty(filter))) {\n query[key] = filter\n }\n }\n return query\n },\n set: ({ set, get }, data) => {\n for (const filter of get(filterNamesState)) {\n set(queryFamily(filter), undefined)\n }\n if (data) {\n for (const [key, value] of Object.entries(data)) {\n set(queryFamily(key), value)\n }\n }\n }\n })\n\n /**\n * A Recoil.js selector that return the dynamic query modes state\n */\n const dynamicQueryModesState = selector({\n key: `dynamicQueryModes_${contextID}`,\n get: ({get}) => {\n const query = {}\n for (const key of get(filterNamesState)) {\n const filter = get(dynamicQueryModesFamily(key))\n if (filter !== undefined) {\n query[key] = filter\n }\n }\n return query\n },\n set: ({ set, get }, data) => {\n for (const filter of get(filterNamesState)) {\n set(dynamicQueryModesFamily(filter), undefined)\n }\n if (data) {\n for (const [key, value] of Object.entries(data)) {\n set(dynamicQueryModesFamily(key), value)\n }\n }\n }\n })\n\n function useDynamicQueryModes() {\n return useRecoilValue(dynamicQueryModesState)\n }\n\n const widgetFamily = atomFamily({\n key: `widgetFamily_${contextID}`,\n default: (name) => dashboard?.widgets?.[name]\n })\n\n const widgetIds = atom({\n key: `widgetIds_${contextID}`,\n default: [...Object.keys(dashboard?.widgets || {})]\n })\n\n // Used to get/set the widgets configuration\n const widgetsState = selector({\n key: `widgetsState_${contextID}`,\n set: ({set, reset}, value) => {\n if (value) {\n const ids = Object.keys(value)\n Object.entries(value).forEach(([key, val]) => set(widgetFamily(key), val))\n set(widgetIds, ids)\n } else {\n reset(widgetIds)\n reset(widgetFamily)\n }\n },\n get: ({get}) => {\n const stats = {}\n const ids = get(widgetIds)\n for (const id of ids) {\n const stat = get(widgetFamily(id))\n if (stat) stats[id] = stat\n }\n return stats\n }\n })\n\n function useQuery(name) {\n return useRecoilValue(queryState)\n }\n\n /**\n * This hook will expose a function for reading if widgets are shown\n * on the search page. Use this hook if you intend to only view the value and\n * are not interested in setting the value.\n *\n * @param {string} name Name of the filter.\n * @returns Whether the widgets are shown.\n */\n function useWidgetValue(name) {\n return useRecoilValue(widgetFamily(name))\n }\n\n /**\n * This hook will expose a function for setting if widget are shown\n * on the search page. Use this hook if you intend to only set the value and are\n * not interested in reading it.\n *\n * @param {string} name Name of the quantity to set.\n * @returns Function for setting the value\n */\n function useSetWidget(name) {\n return useSetRecoilState(widgetFamily(name))\n }\n\n /**\n * This hook will expose a function for getting and setting whether the\n * widgets are shown. Use this hook if you intend to both read and write the\n * filter value.\n *\n * @param {string} name Name of the filter.\n * @returns Array containing the value and a function for setting it.\n */\n function useWidgetState(name) {\n return useRecoilState(widgetFamily(name))\n }\n\n /**\n * This hook will expose a function for reading a list of anchored quantities.\n *\n * @returns A list containing the anchored quantity names.\n */\n function useWidgetsValue() {\n return useRecoilValue(widgetsState)\n }\n\n /**\n * This hook will expose a function for reading and writing the object\n * containing all the current widgets.\n *\n * @returns Array containing the value and a function for setting it.\n */\n function useWidgetsState() {\n return useRecoilState(widgetsState)\n }\n\n /**\n * Returns a function that can be used to add a new widget.\n *\n * @returns Function for setting a new widget value.\n */\n const useAddWidget = () => {\n const add = useRecoilCallback(({set}) => (id, value) => {\n set(widgetFamily(id), value)\n set(widgetIds, (old) => [...old, id])\n }, [])\n return add\n }\n\n /**\n * Returns a function that can be used to remove a widget.\n *\n * @returns Function for removing a widget by id.\n */\n const useRemoveWidget = () => {\n const remove = useRecoilCallback(({set}) => (id) => {\n set(widgetFamily(id), undefined)\n set(widgetIds, (old) => [...old].filter(item => item !== id))\n }, [])\n return remove\n }\n\n /**\n * This hook will expose a function for resetting widgets to the initial\n * configuration.\n *\n * @param {string} name Name of the quantity to set.\n * @returns Function for setting the value\n */\n const useResetWidgets = () => {\n const ids = useRecoilValue(widgetIds)\n const reset = useRecoilCallback(({reset}) => () => {\n for (const id of ids) {\n reset(widgetFamily(id))\n }\n reset(widgetIds)\n }, [])\n return reset\n }\n\n const aggsFamilyRaw = atomFamily({\n key: `aggsFamilyRaw_${contextID}`,\n default: (name) => initialAggs[name]\n })\n\n const aggKeys = atom({\n key: `aggKeys_${contextID}`,\n default: []\n })\n\n const aggsFamily = selectorFamily({\n key: `aggsFamily_${contextID}`,\n get: (id) => ({ get }) => {\n return get(aggsFamilyRaw(id))\n },\n set: (id) => ({set}, value) => {\n set(aggsFamilyRaw(id), value)\n set(aggKeys, prev => [...prev, id])\n }\n })\n\n /**\n * A Recoil.js selector that aggregates all the currently set aggregation\n * requests into a single query object used by the API.\n */\n const aggsState = selector({\n key: `aggs_${contextID}`,\n get: ({get}) => {\n const aggs = {}\n for (const key of get(aggKeys)) {\n const agg = get(aggsFamily(key))\n if (agg !== undefined) {\n aggs[key] = agg\n }\n }\n return aggs\n }\n })\n\n // Atom for each aggregation response.\n const aggsResponseFamily = atomFamily({\n key: `aggsResponseFamily_${contextID}`,\n default: undefined\n })\n\n // Recoil.js selector for updating the aggs response in one go.\n const aggsResponseState = selector({\n key: `aggsResponse_${contextID}`,\n get: ({get}) => {\n return undefined\n },\n set: ({ set }, data) => {\n if (data) {\n for (const [key, value] of Object.entries(data)) {\n set(aggsResponseFamily(key), value)\n }\n }\n }\n })\n\n /**\n * This hook will expose a function for reading filter values. Use this hook if\n * you intend to only view the filter values and are not interested in setting\n * the filter.\n *\n * @param {string} name Name of the filter.\n * @returns currently set filter value.\n */\n const useFilterValue = (name) => {\n // See in which context this filter is being called. If defined within an\n // inputSectionContext, we set the filter inside nested query.\n const sectionContext = useContext(inputSectionContext)\n const section = sectionContext?.section\n const subname = useMemo(() => section ? name.slice(section.length + 1) : undefined, [name, section])\n\n const value = useRecoilValue(queryFamily(section || name))\n\n return section\n ? value?.[subname]\n : value\n }\n /**\n * This hook will expose a function for setting a filter value. Use this hook if\n * you intend to only set the filter value and are not interested in the query\n * results.\n *\n * @param {string} name Name of the quantity to set.\n * @returns function for setting the value for the given quantity\n */\n const useSetFilter = (name) => {\n // See in which context this filter is being called. If defined within an\n // inputSectionContext, we set the filter inside nested query.\n const sectionContext = useContext(inputSectionContext)\n const section = sectionContext?.section\n const subname = useMemo(() => section ? name.slice(section.length + 1) : undefined, [name, section])\n const setter = useSetRecoilState(queryFamily(section || name))\n const dynamicQueryModeSetter = useSetRecoilState(dynamicQueryModesFamily(section || name))\n\n return useCallback((value, config = undefined) => {\n updatedFilters.current.add(name)\n dynamicQueryModeSetter(config?.queryMode)\n section\n ? setter(old => {\n const newValue = isNil(old) ? {} : {...old}\n if (isFunction(value)) {\n value = value(newValue[subname])\n }\n newValue[subname] = value\n return clearEmpty(newValue)\n })\n : setter(isFunction(value)\n ? (old) => clearEmpty(value(old))\n : clearEmpty(value))\n }, [name, dynamicQueryModeSetter, section, setter, subname])\n }\n\n /**\n * This hook will expose a function for getting and setting filter values. Use\n * this hook if you intend to both read and write the filter value.\n *\n * @param {string} name Name of the filter.\n * @returns Array containing the filter value and setter function for it.\n */\n const useFilterState = (name) => {\n const value = useFilterValue(name)\n const setter = useSetFilter(name)\n return useMemo(() => [value, setter], [value, setter])\n }\n\n /**\n * Hook that returns a function that returns the current query as a query string\n *\n * @returns {function} A function that updates the query string to reflect the\n * current search page state.\n */\n const useQueryString = () => {\n const query = useRecoilValue(queryState)\n const filtersData = useRecoilValue(filtersDataState)\n const {filterAbbreviations} = useRecoilValue(filterMapsState)\n\n return useCallback(() => {\n return convertQueryGUIToQS(query, filtersData, filterAbbreviations)\n }, [query, filtersData, filterAbbreviations])\n }\n\n /**\n * Returns a function that can be called to reset all current filters.\n *\n * @returns Function for resetting all filters.\n */\n const useResetFilters = () => {\n const filterNames = useRecoilValue(filterNamesState)\n const reset = useRecoilCallback(({set}) => () => {\n for (const filter of filterNames) {\n set(queryFamily(filter), undefined)\n set(dynamicQueryModesFamily(filter), undefined)\n }\n }, [])\n return reset\n }\n\n /**\n * This hook will expose a function for reading if the given filter is locked.\n *\n * @param {string} name Name of the filter.\n * @returns Whether the filter is locked or not.\n */\n const useFilterLocked = (name) => {\n return useRecoilValue(lockedFamily(name))\n }\n\n /**\n * This hook will expose a function for reading the locked status of all\n * filters.\n *\n * @returns An object containing a mapping from filter name to a boolean\n * indicating whether it is locked or not.\n */\n const useFiltersLocked = () => {\n return useRecoilValue(lockedState)\n }\n\n /**\n * This hook will expose a function for reading if the given set of filters are\n * locked.\n *\n * @param {string} names Names of the filters.\n * @returns Array containing the filter values in a map and a setter function.\n */\n const useFiltersLockedState = (names) => {\n // We dynamically create a Recoil.js selector that is subscribed to the\n // filters specified in the input. This way only the specified filters will\n // cause a render. Recoil.js requires that each selector/atom has an unique\n // id. Because this hook can be called dynamically, we simply generate the ID\n // sequentially.\n const filterState = useMemo(() => {\n const id = `locked_selector_${contextID}_${indexLocked.current}`\n indexLocked.current += 1\n return selector({\n key: id,\n get: ({get}) => {\n const query = {}\n for (const key of names) {\n const filter = get(lockedFamily(key))\n query[key] = filter\n }\n return query\n }\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return useRecoilValue(filterState)\n }\n\n /**\n * This hook will expose a function for getting and setting filter values for\n * the specified list of filters. Use this hook if you intend to both read and\n * write the filter values.\n *\n * @param {string} names Names of the filters.\n * @returns Array containing the filter values in a map and a setter function.\n */\n const useFilters = (names) => {\n // We dynamically create a Recoil.js selector that is subscribed to the\n // filters specified in the input. This way only the specified filters will\n // cause a render. Recoil.js requires that each selector/atom has an unique\n // id. Because this hook can be called dynamically, we simply generate the ID\n // sequentially.\n const filterState = useMemo(() => {\n const id = `dynamic_selector_${contextID}_${indexFilters.current}`\n indexFilters.current += 1\n return selector({\n key: id,\n get: ({get}) => {\n const query = {}\n for (const key of names) {\n const filter = get(queryFamily(key))\n query[key] = filter\n }\n return query\n }\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return useRecoilValue(filterState)\n }\n\n /**\n * Hook for returning an object containing the currently fetched results,\n * pagination and a function for changing the pagination.\n *\n * @returns {object} {data, pagination, setPagination}\n */\n const useResults = () => {\n const setResultsUsed = useSetRecoilState(resultsUsedState)\n\n // When loading results for the first time, inform the context that\n // results need to be fetched.\n useEffect(() => {\n setResultsUsed(true)\n }, [setResultsUsed])\n\n return useRecoilValue(resultsState)\n }\n\n /**\n * Hook for modifying an aggregation request and fetching the latest values for\n * this aggregation.\n *\n * @param {string} name The filter name\n * @param {bool} update Whether the hook needs to react to changes in the\n * current query context. E.g. if the component showing the data is not visible,\n * this can be set to false.\n * @param {string} id The aggregation identifier\n * @param {object} config The aggregation configuration. Remember that the\n * value should be a constant or be memoized to avoid a new object being\n * created for each call.\n *\n * @returns {object} An object containing the aggregation results: the layout is\n * specific for each aggregation type.\n */\n const useAgg = (name, update, id = 'default', config = undefined) => {\n const key = useMemo(() => `${name}:${id}`, [name, id])\n const setAgg = useSetRecoilState(aggsFamily(key))\n const aggResponse = useRecoilValue(aggsResponseFamily(key))\n const filtersData = useRecoilValue(filtersDataState)\n\n // Whenever the aggregation requirements change, create the final\n // aggregation config and set it in the search context: this will then\n // trigger any required API calls that also return the aggregation\n // response that is returned by this hook.\n useEffect(() => {\n const defaults = filtersData[name]?.aggs?.[config?.type]\n const finalConfig = {\n update: update,\n ...defaults || {},\n ...config\n }\n setAgg(finalConfig)\n }, [name, update, setAgg, config, filtersData])\n\n return aggResponse\n }\n\n /**\n * This hook will expose a function for setting the values of all filters.\n *\n * @returns An object containing a mapping from filter name to a boolean\n * indicating whether it is locked or not.\n */\n const useSetFilters = () => {\n return useSetRecoilState(filtersState)\n }\n\n /**\n * Used to update a single filter value with a dynamic name. Supports\n * callback and optionally also setting the queryMode.\n */\n const useUpdateFilter = () => {\n return useRecoilCallback(({set}) => ([key, value, queryMode]) => {\n set(queryFamily(key), value)\n if (queryMode) set(dynamicQueryModesFamily(key), queryMode)\n }, [])\n }\n\n /**\n * Used to retrieve the currently set search suggestions.\n *\n * @returns Array containing the value and a function for setting it.\n */\n function useSearchSuggestionsValue() {\n return useRecoilValue(searchSuggestionsState)\n }\n\n /**\n * Used to set the currently set search suggestions.\n */\n function useSetSearchSuggestions() {\n return useSetRecoilState(searchSuggestionsState)\n }\n\n return {\n useFilterLocked,\n useFiltersLocked,\n useFiltersLockedState,\n useFilterValue,\n useSetFilter,\n useFilterState,\n useFilters,\n useResetFilters,\n useQueryString,\n useDynamicQueryModes,\n aggsFamily,\n useWidgetValue,\n useSetWidget,\n useWidgetState,\n useWidgetsValue,\n useWidgetsState,\n useAddWidget,\n useRemoveWidget,\n useResetWidgets,\n useAgg,\n useSetFilters,\n useUpdateFilter,\n useQuery,\n useSearchSuggestionsValue,\n useSetSearchSuggestions,\n useFilterNames: () => useRecoilValue(filterNamesState),\n useFiltersData: () => useRecoilValue(filtersDataState),\n useFilterMaps: () => useRecoilValue(filterMapsState),\n useSetFiltersData: () => useSetRecoilState(filtersDataState),\n useAggs: () => useRecoilValue(aggsState),\n useSetAggsResponse: () => useSetRecoilState(aggsResponseState),\n usePagination: () => useRecoilValue(paginationState),\n useSetPagination: () => useSetRecoilState(paginationState),\n usePaginationState: () => useRecoilState(paginationState),\n useIsMenuOpen: () => useRecoilValue(isMenuOpenState),\n useSetIsMenuOpen: () => useSetRecoilState(isMenuOpenState),\n useIsCollapsed: () => useRecoilValue(isCollapsedState),\n useSetIsCollapsed: () => useSetRecoilState(isCollapsedState),\n useIsStatisticsEnabled: () => useRecoilValue(isStatisticsEnabledState),\n useSetIsStatisticsEnabled: () => useSetRecoilState(isStatisticsEnabledState),\n useApiQuery: () => useRecoilValue(apiQueryState),\n useSetApiQuery: () => useSetRecoilState(apiQueryState),\n useApiData: () => useRecoilValue(apiDataState),\n useSetApiData: () => useSetRecoilState(apiDataState),\n useResults,\n useSetResults: () => useSetRecoilState(resultsState),\n useResultsUsed: () => useRecoilValue(resultsUsedState),\n useSetResultsUsed: () => useSetRecoilState(resultsUsedState),\n useRequired: () => useRecoilValue(requiredState)\n }\n }, [\n resource,\n contextID,\n initialQuery,\n initialFilterData,\n initialFilterAbbreviations,\n initialFiltersLocked,\n initialPagination,\n dashboard,\n initialAggs,\n id,\n suggestionHistorySize\n ])\n\n const setResults = useSetResults()\n const setApiData = useSetApiData()\n const setApiQuery = useSetApiQuery()\n const filters = useFilterNames()\n const filtersData = useFiltersData()\n const { filterAbbreviations, filterFullnames } = useFilterMaps()\n const [pagination, setPagination] = usePaginationState()\n const updateAggsResponse = useSetAggsResponse()\n const aggs = useAggs()\n const query = useQuery()\n const dynamicQueryModes = useDynamicQueryModes()\n const filtersLocked = useFiltersLocked()\n const required = useRequired()\n const resultsUsed = useResultsUsed()\n\n /**\n * This function is used to sync up API calls so that they update the search\n * context state in the same order as they were originally issued.\n *\n * As we cannot guarantee the order in which the API calls finish, we push all\n * calls into a queue. The queue makes sure that API calls get resolved in the\n * original order not matter how long the actual call takes.\n */\n const resolve = useCallback(prop => {\n const {response, timestamp, queryChanged, paginationChanged, search, aggsToUpdate, resource, callbackAgg, callbackHits} = prop\n const data = response.response\n const next = apiQueue.current[0]\n if (next !== timestamp) {\n apiMap.current[timestamp] = prop\n return\n }\n // Update the aggregations if new aggregation data is received. The old\n // aggregation data is preserved and new information is updated.\n if (!isEmpty(data.aggregations)) {\n const newAggs = convertAggAPIToGUI(data.aggregations, aggsToUpdate, resource, filtersData)\n callbackAgg && callbackAgg(newAggs, undefined, true)\n } else {\n callbackAgg && callbackAgg(undefined, undefined, false)\n }\n // Update the query results if new data is received.\n if (queryChanged || paginationChanged) {\n paginationResponse.current = data.pagination\n const newResults = {\n response: response,\n pagination: combinePagination(search.pagination, data.pagination),\n setPagination: setPagination\n }\n callbackHits && callbackHits(newResults, undefined, true, search)\n } else {\n callbackHits && callbackHits(undefined, undefined, false, search)\n }\n // Remove this query from queue and see if next can be resolved.\n apiQueue.current.shift()\n const nextTimestamp = apiQueue.current[0]\n const nextResolve = apiMap.current[nextTimestamp]\n if (nextResolve) {\n resolve(nextResolve)\n }\n }, [setPagination, filtersData])\n\n /**\n * Function that preprocesses API call requests and finally performs the\n * actual API call.\n *\n * All of the heavier pre-processing, checking, etc. should be done in this\n * function, as it is the final one that gets called after the debounce\n * interval.\n *\n * @param {bool} global Whether the api call is made in the global context\n * that introduces a series of optimizations by keeping track of the previous\n * queries. Should be false when making API calls that should not affect the\n * global context, e.g. when just getting hits with a different pagination etc.\n */\n const apiCall = useCallback((query, aggs, pagination, required, resultsUsed, queryChanged, paginationChanged, updateAggs, callbackAgg = undefined, callbackHits = undefined, global = true) => {\n // Gather aggregations that need to be updated (=require and API call), and\n // the ones that have changed (have changed but do not require an API call).\n const aggsToUpdate = []\n const aggsChanged = []\n for (const [key, agg] of Object.entries(aggs)) {\n if (agg.update) {\n aggsToUpdate.push(key)\n }\n if (agg.changed) {\n aggsChanged.push(key)\n }\n }\n const apiQuery = {...query}\n if (filterDefaults) {\n for (const [key, value] of Object.entries(filterDefaults)) {\n if (isNil(query[key])) {\n apiQuery[key] = value\n }\n }\n }\n\n // The locked filters are applied as a parallel AND query. This is the only\n // way to consistently apply them. If we mix them inside 'regular' filters,\n // they can be accidentally overwritten with an OR statement.\n const customQuery = convertQueryGUIToAPI(apiQuery, resource, filtersData, dynamicQueryModes)\n const lockedQuery = convertQueryGUIToAPI(filtersLocked, resource, filtersData, dynamicQueryModes)\n\n let finalQuery = customQuery\n if (!isEmpty(lockedQuery)) {\n finalQuery = {\n and: [finalQuery, lockedQuery]\n }\n }\n\n // TODO: This is just a temp hack to somehow allow filter queries with ands/ors\n if (query.custom_quantities) {\n finalQuery = {\n and: [finalQuery, query.custom_quantities]\n }\n }\n\n const search = {\n owner: filtersLocked?.visibility || apiQuery.visibility,\n query: finalQuery,\n aggregations: convertAggGUIToAPI(\n aggs,\n resource,\n filtersData\n ),\n pagination: convertPaginationGUItoAPI(pagination, filtersData),\n required: convertRequiredGUItoAPI(required, filtersData)\n }\n\n // When aggregations have changed but the query has not, we request only the\n // aggregation data without any hits. Also if results are not needed, we\n // don't return them.\n if ((updateAggs && !queryChanged && !paginationChanged) || !resultsUsed) {\n search.pagination = {page_size: 0}\n search.required = { include: [] }\n }\n\n // If query changes or the pagination changes without page_after_value\n // changing, we request the first page. This is a simple way ensure that\n // results are consistent.\n if (queryChanged || (paginationChanged && (pagination.page_after_value && pagination.page_after_value === paginationResponse.current.page_after_value))) {\n search.pagination.page_after_value = undefined\n search.pagination.next_page_after_value = undefined\n }\n\n if (global) {\n // When the query changes, information about the most recent agg update (no\n // matter if it causes an API call or not) gets stored. When the query has\n // not changed, the last agg that caused an actual API call is added to the\n // existing list. This way previous aggregation data can be re-used.\n if (queryChanged) {\n updatedAggsMap.current = Object.fromEntries(aggsChanged.map((key) => [key, aggs[key]]))\n } else {\n aggsToUpdate.forEach((key) => { updatedAggsMap.current[key] = aggs[key] })\n }\n\n // The list of updated filters are always reset.\n updatedFilters.current = new Set()\n firstLoad.current = false\n oldQuery.current = query\n oldPagination.current = pagination\n }\n\n const timestamp = Date.now()\n apiQueue.current.push(timestamp)\n setApiQuery(search?.query)\n api.query(resource, search, {loadingIndicator: true, returnRequest: true})\n .then((response) => {\n return resolve({\n response,\n timestamp,\n queryChanged,\n paginationChanged,\n search,\n aggsToUpdate,\n resource,\n callbackAgg,\n callbackHits\n })\n })\n .catch((error) => {\n raiseError(error)\n callbackAgg && callbackAgg(undefined, error, true)\n callbackHits && callbackHits(undefined, error, true, undefined)\n })\n }, [filtersData, filterDefaults, filtersLocked, resource, api, raiseError, resolve, dynamicQueryModes, setApiQuery])\n\n // This is a debounced version of apiCall.\n const apiCallDebounced = useMemo(() => debounce(apiCall, debounceTime), [apiCall])\n\n /**\n * Intermediate function that should primarily be used when trying to perform\n * an API call. Ensures that ensures that:\n * - Calls are debounced when necessary\n * - API calls are made only if necessary\n */\n const apiCallInterMediate = useCallback((query, aggs, pagination, required, resultsUsed = true, callbackAgg = undefined, callbackHits = undefined, forceUpdate = false, global = true) => {\n if (disableUpdate.current) {\n disableUpdate.current = false\n return\n }\n\n // Determine which parts need to be updated. Due to the queueing mechanism\n // we can instantly update the reference to contain the latest information\n // about what will be updated by this query. This ensures that the next query\n // immediately knows the current state even before the API call is finished\n // (or even if no API call is made).\n const queryChanged = forceUpdate ? true : query !== oldQuery.current\n const paginationChanged = pagination !== oldPagination.current\n const [reducedAggs, updateAggs] = reduceAggs(\n aggs,\n updatedAggsMap.current,\n queryChanged,\n updatedFilters.current,\n filtersData\n )\n\n // If results are needed and query and pagination have not changed and\n // aggregations do not need to be updated, no update is necessary. The API\n // calls is made immediately when requesting the first set of results, when\n // the pagination changes or when only aggregations need to be updated.\n // Otherwise it is debounced.\n if ((resultsUsed && (paginationChanged || queryChanged)) || updateAggs) {\n if (firstLoad.current || paginationChanged || !queryChanged) {\n apiCall(query, reducedAggs, pagination, required, resultsUsed, queryChanged, paginationChanged, updateAggs, callbackAgg, callbackHits, global)\n } else {\n apiCallDebounced(query, reducedAggs, pagination, required, resultsUsed, queryChanged, paginationChanged, updateAggs, callbackAgg, callbackHits, global)\n }\n } else {\n callbackAgg && callbackAgg(undefined, undefined, false)\n callbackHits && callbackHits(undefined, undefined, false, undefined)\n }\n }, [apiCall, apiCallDebounced, filtersData])\n\n // When query, aggregation or pagination changes, update the search context\n useEffect(() => {\n apiCallInterMediate(\n query,\n aggs,\n pagination,\n required,\n resultsUsed,\n (data, error, update) => (update && !error) && updateAggsResponse(data),\n (results, error, update, search) => {\n if (error || !update) return\n setApiData(results.response)\n const data = results.response.response\n const extend = search?.pagination?.page_after_value\n setResults(old => {\n const newResults = old ? {...old} : {}\n extend ? newResults.data = [...newResults.data, ...data.data] : newResults.data = data.data\n newResults.pagination = combinePagination(search.pagination, data.pagination)\n newResults.setPagination = setPagination\n return newResults\n })\n },\n false,\n true\n )\n }, [query, aggs, pagination, required, resultsUsed, apiCallInterMediate, updateAggsResponse, setPagination, setResults, setApiData])\n\n // The context contains a set of functions that can be used to hook into\n // different data.\n const values = useMemo(() => {\n // Hook for refreshing the results.\n const useRefresh = () => {\n const query = useQuery()\n const aggs = useAggs()\n const pagination = usePagination()\n const required = useRequired()\n const resultsUsed = useResultsUsed()\n\n const refresh = useCallback(() => {\n apiCallInterMediate(\n query,\n aggs,\n pagination,\n required,\n resultsUsed,\n (data, error, update) => (update && !error) && updateAggsResponse(data),\n (results, error, update, search) => {\n if (error || !update) return\n setApiData(results.response)\n const data = results.response.response\n const extend = search?.pagination?.page_after_value\n setResults(old => {\n const newResults = old ? {...old} : {}\n extend ? newResults.data = [...newResults.data, ...data.data] : newResults.data = data.data\n newResults.pagination = combinePagination(search.pagination, data.pagination)\n newResults.setPagination = setPagination\n return newResults\n })\n },\n true,\n true\n )\n }, [aggs, pagination, required, query, resultsUsed])\n return refresh\n }\n\n // Hook for imperatively requesting aggregation data. By using this hook you\n // can track the state of individual calls and perform callbacks.\n const useAggCall = (name, id) => {\n const key = useMemo(() => `${name}:${id}`, [name, id])\n const query = useQuery()\n const pagination = usePagination()\n const required = useRequired()\n const resultsUsed = useResultsUsed()\n const setAgg = useSetRecoilState(aggsFamily(key))\n\n /**\n * @param {number} size The new aggregation size\n * @param {string} id Identifier for this call\n * @param {function} callback: Function that returns an array containing the\n * new aggregation response and an error if one was encountered. Returns the\n * special value 'undefined' for the response if no update was necessary.\n */\n const aggCall = useCallback((config, callback) => {\n const aggs = {[key]: {...config, update: true}}\n apiCallInterMediate(\n query,\n aggs,\n pagination,\n required,\n resultsUsed,\n (response, error, update) => {\n if (update && !error) {\n updateAggsResponse(response)\n }\n callback(response && response[key], error, update)\n },\n undefined,\n false,\n true\n )\n\n // We also need to update aggregation request state, otherwise the\n // subsequent calls will not be able to know what was done by this call.\n // To do this without triggering another API call, we disable API updates\n // for one cycle.\n disableUpdate.current = true\n aggs[key].update = false\n setAgg(aggs[key])\n }, [key, query, pagination, required, resultsUsed, setAgg])\n\n return aggCall\n }\n\n /**\n * Hook for fetching an independent set of hits based on the currently set\n * filters.\n *\n * @param {string} id Unique identified for this set of hits\n * @param {object} required The required field of the API call\n * @param {object} pagination The API pagination\n *\n * @returns {Array} Array of hit objects.\n */\n const useHits = (id = 'default', required, pagination, callback) => {\n const [results, setResults] = useState()\n const query = useQuery()\n const apiCallDebounced = useMemo(() => debounce(apiCall, debounceTime), [])\n\n // Update hits when query, includes, excludes or pagination change.\n useEffect(() => {\n apiCallDebounced(\n query,\n {},\n convertPaginationGUItoAPI(pagination, filtersData),\n convertRequiredGUItoAPI(required, filtersData),\n true,\n true,\n true,\n false,\n undefined,\n (results, error, update) => {\n if (!error && update) {\n const data = results.response.response\n update && !error && setResults(data?.data)\n }\n callback(results, error, update)\n },\n false\n )\n }, [query, required, pagination, apiCallDebounced, callback])\n\n return results\n }\n\n /**\n * Hook that can be used to fetch search suggestions stored in the local\n * device.\n * */\n const useSearchSuggestions = (input, size = 5) => {\n const suggestions = useSearchSuggestionsValue()\n const suggestionFilter = useMemo(() => {\n const sugg = getSuggestions(suggestions, 0, suggestion => suggestion.input)\n return sugg.filter\n }, [suggestions])\n\n return input.trim() === ''\n ? suggestions.slice(0, size)\n : suggestionFilter(input).slice(0, size)\n }\n\n /**\n * Hook for pushing new suggestion values to the search context. New values\n * are pushed to the top of the list, and if the suggestion already exists,\n * it is simply pulled to the top.\n * */\n const usePushSearchSuggestion = () => {\n const setSuggestions = useSetSearchSuggestions()\n return useCallback((suggestion) => {\n setSuggestions(old => {\n let newSuggestions = old.filter(x => x.key !== suggestion.key)\n const newSuggestion = new SearchSuggestion(suggestion)\n newSuggestion.history = true\n newSuggestions = [newSuggestion, ...old].slice(0, suggestionHistorySize)\n return newSuggestions\n })\n }, [setSuggestions])\n }\n\n /**\n * Hook for deleting specific suggestion values from the search context\n * using the suggestion key.\n * */\n const useRemoveSearchSuggestion = () => {\n const setSuggestions = useSetSearchSuggestions()\n return useCallback((key) => {\n setSuggestions(old => {\n const newSuggestions = [...old].filter(x => x.key !== key)\n return newSuggestions\n })\n }, [setSuggestions])\n }\n\n /**\n * Hook that returns a function for parsing a single filter key, value pair\n * into a form that is supported by the GUI. The parsing depends on the\n * SearchContext as filters may define a custom deserialization function and\n * only certain filters may be available.\n * */\n const useParseQuery = () => {\n return useCallback(\n (key, value, path, multiple) => parseQuery(key, value, filtersData, units, path, multiple),\n []\n )\n }\n /**\n * Hook that returns a function for parsing an object containing filter\n * values into a form that is supported by the GUI. The parsing depends on\n * the SearchContext as filters may define a custom deserialization function\n * and only certain filters may be available.\n * */\n const useParseQueries = () => {\n return useCallback(\n (values) => parseQueries(values, filtersData, filterFullnames),\n []\n )\n }\n\n return {\n resource,\n columns,\n rows,\n filterMenus,\n filters,\n filterData: filtersData,\n filterGroups: initialFilterGroups,\n filterFullnames,\n filterAbbreviations,\n searchSyntaxes: initialSearchSyntaxes,\n useIsMenuOpen,\n useSetIsMenuOpen,\n useIsCollapsed,\n useSetIsCollapsed,\n useIsStatisticsEnabled,\n useSetIsStatisticsEnabled,\n useApiData,\n useApiQuery,\n useQuery,\n useSetPagination,\n useParseQuery,\n useParseQueries,\n useSearchSuggestions,\n usePushSearchSuggestion,\n useRemoveSearchSuggestion,\n useFilterValue,\n useSetFilter,\n useFilterState,\n useFilters,\n useResetFilters,\n useRefresh,\n useFilterLocked,\n useFiltersLocked,\n useFiltersLockedState,\n useWidgetValue,\n useSetWidget,\n useWidgetState,\n useWidgetsValue,\n useWidgetsState,\n useAddWidget,\n useRemoveWidget,\n useResetWidgets,\n useQueryString,\n useResults,\n useHits,\n useAgg,\n useAggCall,\n useSetFilters,\n useUpdateFilter\n }\n }, [\n resource,\n rows,\n columns,\n filterMenus,\n filters,\n filtersData,\n initialFilterGroups,\n filterFullnames,\n filterAbbreviations,\n initialSearchSyntaxes,\n useIsMenuOpen,\n useSetIsMenuOpen,\n useIsCollapsed,\n useSetIsCollapsed,\n useIsStatisticsEnabled,\n useSetIsStatisticsEnabled,\n useFilterValue,\n useSetFilter,\n useFilterState,\n useFilters,\n useResetFilters,\n useFilterLocked,\n useFiltersLocked,\n useFiltersLockedState,\n useWidgetValue,\n useSetWidget,\n useWidgetState,\n useWidgetsValue,\n useWidgetsState,\n useAddWidget,\n useRemoveWidget,\n useResetWidgets,\n useQueryString,\n usePagination,\n useSetPagination,\n useResults,\n useResultsUsed,\n useRequired,\n useApiQuery,\n useApiData,\n useAgg,\n useAggs,\n useQuery,\n useSetFilters,\n useUpdateFilter,\n apiCallInterMediate,\n apiCall,\n aggsFamily,\n updateAggsResponse,\n setPagination,\n setResults,\n setApiData,\n units,\n suggestionHistorySize,\n useSearchSuggestionsValue,\n useSetSearchSuggestions\n ])\n\n return \n {children}\n \n})\n\nSearchContextRaw.propTypes = {\n resource: PropTypes.string,\n initialFiltersLocked: PropTypes.object,\n initialColumns: PropTypes.arrayOf(PropTypes.object),\n initialRows: PropTypes.object,\n initialFilterMenus: PropTypes.object,\n initialPagination: PropTypes.object,\n initialDashboard: PropTypes.object,\n initialFilterData: PropTypes.object, // Determines which filters are available\n initialFilterGroups: PropTypes.object, // Maps filter groups to a set of filter names\n initialFilterValues: PropTypes.object, // Here one can provide default filter values\n initialSearchSyntaxes: PropTypes.object, // Determines which syntaxes are supported\n children: PropTypes.node,\n id: PropTypes.string,\n suggestionHistorySize: PropTypes.number\n}\n\nSearchContextRaw.defaultProps = {\n suggestionHistorySize: 20\n}\n\nexport const FreeformSearchContext = withFilters(SearchContextRaw)\nexport const SearchContext = compose(withQueryString, withFilters)(SearchContextRaw)\n\n/**\n * Hook for accessing the current SearchContext.\n */\nexport function useSearchContext() {\n return useContext(searchContext)\n}\n\n/**\n * Parses a single filter value into a form that is supported by the GUI. This includes:\n * - Arrays are are transformed into Sets\n * - If multiple values are supported, scalar values are stored inside sets.\n * - Numerical values with units are transformed into Quantities.\n * - Custom serialization defined for the filter will be used if defined.\n *\n * @param {string} key Name of the filter or an operator name.\n * @param {any} value Value of the filter or operator\n * @param {object} filtersData All of the filters that are available\n * @param {object} units Unit system for unit conversion\n * @param {string} path The full path for the filter without an operator name.\n *\n * @returns {any} The filter value in a format that is suitable for the GUI.\n */\nfunction parseQuery(key, value, filtersData, units = undefined, path = undefined, multiple = undefined) {\n let newValue\n const fullPath = path ? `${path}.${key}` : key\n if (isPlainObject(value)) {\n newValue = {}\n for (const [keyInner, valueInner] of Object.entries(value)) {\n const valueConverted = parseQuery(keyInner, valueInner, filtersData, units, fullPath)\n if (!isNil(valueConverted)) {\n newValue[keyInner] = valueConverted\n }\n }\n } else {\n // If the key is an operator, the filter name is read from the path.\n const opKeys = new Set(['lte', 'lt', 'gte', 'gt'])\n const isOperator = opKeys.has(key)\n const filterPath = isOperator ? path : fullPath\n multiple = multiple ?? filtersData[filterPath].multiple\n const deserializer = filtersData[filterPath].deserializer\n if (isArray(value) || isSet(value)) {\n newValue = new Set(value.map((v) => deserializer(v, units)))\n } else {\n newValue = deserializer(value, units)\n if (!isOperator && multiple) {\n newValue = new Set([newValue])\n }\n }\n }\n return newValue\n}\n\n/**\n * Cleans an entire query object into a form that is supported by the GUI. This\n * includes:\n * - Arrays are are transformed into Sets\n * - If multiple values are supported, scalar values are stored inside sets.\n * - Numerical values with units are transformed into Quantities.\n *\n * @param {object} query Query object to transform.\n * @param {object} filtersData All of the filters that are available\n * @param {object} units The desired unit system used when reading quantities.\n *\n * @returns {any} The filter object in a format that is suitable for the GUI.\n */\nfunction parseQueries(query, filtersData, filterFullnames, units = undefined) {\n const newQuery = {}\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n const newKey = filterFullnames[key] || key\n const valueGUI = parseQuery(newKey, value, filtersData, units)\n newQuery[newKey] = valueGUI\n }\n }\n return newQuery\n}\n\n/**\n * Converts a query object into a valid query string.\n *\n * @param {object} query Query object representing the currently active\n * filters in a search context.\n * @param {object} filtersData All of the filters that are available\n * @returns URL querystring, not encoded to improve readability.\n */\nfunction convertQueryGUIToQS(query, filtersData, filterAbbreviations) {\n // Used to recursively convert the query into a serializable format.\n function convert(key, value, path) {\n // If the key is an operator, the filter name is read from the path.\n const opKeys = new Set(['lte', 'lt', 'gte', 'gt'])\n const fullPath = path ? `${path}.${key}` : key\n const filterPath = opKeys.has(key) ? path : fullPath\n const filterData = filtersData[filterPath]\n let newValue\n if (isPlainObject(value) && !filterData.customSerialization) {\n newValue = {}\n for (const [keyInner, valueInner] of Object.entries(value)) {\n const valueConverted = convert(\n keyInner,\n valueInner,\n path ? fullPath : key\n )\n newValue[keyInner] = valueConverted\n }\n } else {\n const serializer = filterData.serializerExact\n if (isArray(value)) {\n newValue = value.map(serializer)\n } else if (value instanceof Set) {\n newValue = [...value].map(serializer)\n } else {\n newValue = serializer(value)\n }\n }\n return newValue\n }\n\n // The query is serialized first: locked items will not be displayed in the\n // URL\n const queryStringQuery = {}\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n const valueConverted = convert(key, value)\n if (!isNil(valueConverted)) {\n queryStringQuery[key] = valueConverted\n }\n }\n }\n\n return qs.stringify(queryStringQuery, {indices: false})\n}\n\n/**\n * Converts the contents of a query into a format that is suitable for the API.\n *\n * Should only be called when making the final API call, as during the\n * construction of the query it is much more convenient to store filters within\n * e.g. Sets.\n *\n * @param {number} query The query object.\n * @param {string} resource The resource we are looking at: entries or materials.\n * @param {object} filtersData All of the filters that are available\n * @param {object} queryModes Query modes for filters\n *\n * @returns {object} A copy of the object with certain items cleaned into a\n * format that is supported by the API.\n */\nfunction convertQueryGUIToAPI(query, resource, filtersData, queryModes) {\n const queryCustomized = {}\n if (!query) {\n return undefined\n }\n\n // Perform custom transformations. Note that these calls may add new keys to\n // the query.\n function customize(key, value, parent, subKey = undefined) {\n const data = filtersData[key]\n\n // Global filters are not serialized into the API call.\n if (data?.global) return\n\n // Sections need to be recursively handled. Notice that we can't directly\n // write to an recoil Atom and create a new object for storing the values.\n const section = data?.section\n if (section) {\n const sectionData = {}\n for (const [keyNested, valueNested] of Object.entries(value)) {\n customize(`${key}.${keyNested}`, valueNested, sectionData, keyNested)\n }\n parent[key] = sectionData\n // Regular values are set directly to the parent. A custom setter may be\n // used.\n } else {\n const setter = data?.value?.set\n if (setter) {\n setter(queryCustomized, query, value)\n } else {\n parent[subKey || key] = value\n }\n }\n }\n for (const [k, v] of Object.entries(query)) {\n if (!isNil(v)) {\n customize(k, v, queryCustomized)\n }\n }\n\n // Create the API-compatible keys and values.\n const queryNormalized = {}\n for (const [k, v] of Object.entries(queryCustomized)) {\n const {quantity: filterName, op: queryMode} = parseOperator(k)\n let finalKey = filtersData[filterName]?.requestQuantity || filterName\n const newValue = convertQuerySingleGUIToAPI(v, filterName, filtersData)\n finalKey = resource === 'materials' ? getFilterMaterialPath(finalKey) : finalKey\n let finalQueryMode = queryMode || queryModes?.[k]\n if (isNil(finalQueryMode) && isArray(newValue)) {\n finalQueryMode = filtersData[k]?.queryMode\n }\n finalKey = finalQueryMode ? `${finalKey}:${finalQueryMode}` : finalKey\n queryNormalized[finalKey] = newValue\n }\n\n if (resource === 'materials') {\n // When combining results, we split each filter and each filter value into\n // it's own separate entries query. These queries are then joined with\n // 'and'.\n const combine = query.combine\n if (combine) {\n const entrySearch = []\n for (const [k, v] of Object.entries(queryNormalized)) {\n if (k.startsWith('entries.')) {\n const {quantity: newKey, op: queryMode} = parseOperator(k)\n // When the queryMode is 'all', each value can come from a separate\n // entry.\n if (isArray(v) && queryMode === 'all') {\n for (const item of v) {\n entrySearch.push({[newKey]: item})\n }\n } else {\n entrySearch.push({[k]: v})\n }\n delete queryNormalized[k]\n }\n }\n if (entrySearch.length > 0) {\n queryNormalized.and = entrySearch\n }\n // When combining results is not allowed, we simply make a nested query by\n // moving all method/properties filters inside a single entries-subsection.\n } else {\n const entrySearch = {}\n for (const [k, v] of Object.entries(queryNormalized)) {\n if (k.startsWith('entries.')) {\n const name = k.split('entries.').pop()\n entrySearch[name] = v\n delete queryNormalized[k]\n }\n }\n if (!isEmpty(entrySearch)) {\n queryNormalized.entries = entrySearch\n }\n }\n }\n\n return queryNormalized\n}\n\n/**\n * Cleans a single filter value into a form that is supported by the API. This includes:\n * - Sets are transformed into Arrays\n * - Quantities are converted to storage unit values\n * - Empty containers are set to undefined\n *\n * @param {any} value Filter value\n * @param {Filter} filter Filter object\n *\n * @returns {any} The filter value in a format that is suitable for the API.\n */\nfunction convertQuerySingleGUIToAPI(value, name, filterData) {\n const unit = filterData[name]?.unit || 'dimensionless'\n const convertItem = (item) => item instanceof Quantity ? item.to(unit).value() : item\n\n if (value instanceof Set) {\n const newValue = Array.from(value).map(convertItem)\n return newValue.length ? newValue : undefined\n }\n\n if (value instanceof Quantity) {\n return value.to(unit).value()\n }\n\n if (isArray(value)) {\n const newValue = value.map(convertItem)\n return newValue.length ? newValue : undefined\n }\n\n if (isPlainObject(value)) {\n const newValue = Object.entries(value).reduce((acc, [key, val]) => {\n const filterName = isPlainObject(val) ? `${name}.${key}` : name\n const apiValue = convertQuerySingleGUIToAPI(val, filterName, filterData)\n if (!isNil(apiValue)) acc[key] = apiValue\n return acc\n }, {})\n\n return isEmpty(newValue) ? undefined : newValue\n }\n\n return value\n}\n\n/**\n * Used to transform a GUI aggregation query into a form that is usable by the\n * API.\n *\n * @param {object} aggs The aggregation data as constructed by the GUI.\n * @param {object} updatedFilters Set of filters that were updated together with\n * this call.\n * @param {string} resource The resource we are looking at: entries or materials.\n * @param {object} filtersData All of the filters that are available\n *\n * @returns {object} Aggregation query that is usable by the API.\n */\nfunction convertAggGUIToAPI(aggs, resource, filtersData) {\n const apiAggs = {}\n for (const [key, agg] of Object.entries(aggs)) {\n const filterName = rsplit(key, ':', 1)[0]\n if (agg.update) {\n const exclusive = filtersData[filterName].exclusive\n const type = agg.type\n const apiAgg = apiAggs[key] || {}\n const aggSet = agg.set\n const finalAgg = aggSet ? aggSet(agg) : agg\n let finalQuantity = finalAgg.quantity || filterName\n\n // If the targeted quantity has a special requestQuantity, it is used in\n // the final API call.\n finalQuantity = filtersData[finalQuantity]?.requestQuantity || finalQuantity\n\n // The targeted quantity is decided based on the resource as materials\n // search need to target slightly different fields.\n finalQuantity = resource === 'materials'\n ? getFilterMaterialPath(finalQuantity)\n : finalQuantity\n\n apiAgg[type] = {\n // Exclusive quantities (quantities that have one value per entry) are\n // always fetched with exclude_from_search\n exclude_from_search: exclusive,\n ...finalAgg,\n quantity: finalQuantity\n }\n apiAggs[key] = apiAgg\n }\n }\n return apiAggs\n}\n\n/**\n * Used to transform an API aggregation result into a form that is usable by the\n * GUI.\n *\n * @param {object} aggs The aggregation data as returned by the API.\n * @param {array} aggsToUpdate The set of targeted filters. Needed because the keys\n * in the aggs dictionary may be different due to custom aggregation set/get.\n * @param {object} filtersData All of the filters that are available\n *\n * @returns {object} Aggregation result that is usable by the GUI.\n */\nfunction convertAggAPIToGUI(aggs, aggsToUpdate, filtersData) {\n if (isEmpty(aggs)) {\n return {}\n }\n\n // Perform custom transformations\n const aggsCustomized = {}\n for (const key of aggsToUpdate) {\n const filter_name = rsplit(key, ':', 1)[0]\n const aggConfig = aggs[key]\n if (!isNil(aggConfig)) {\n for (const [type, agg] of Object.entries(aggConfig)) {\n const aggGet = filtersData[filter_name]?.aggs?.[type]?.get\n const aggFinal = aggGet ? aggGet(agg) : agg\n // Add flag for if all terms have been returned, and the total number of\n // items. TODO: Could this total be given by the API directly?\n if (type === 'terms') {\n aggFinal.exhausted = aggFinal.size > aggFinal.data.length\n aggFinal.total = aggFinal.data.reduce((a, b) => a + b.count, 0)\n }\n aggsCustomized[key] = aggFinal\n }\n }\n }\n return aggsCustomized\n}\n\n/**\n * Used to transform a GUI pagination call result into a form that is usable by the\n * API.\n *\n * @param {object} pagination The aggregation data as returned by the API.\n * @param {object} filtersData All of the filters that are available\n *\n * @returns {object} Pagination object that is usable by the API.\n */\nfunction convertPaginationGUItoAPI(pagination, filtersData) {\n if (!pagination) return {}\n return {\n ...pagination,\n order_by: filtersData[pagination.order_by]?.requestQuantity || pagination.order_by\n }\n}\n\n/**\n * Used to transform a GUI pagination call result into a form that is usable by the\n * API.\n *\n * @param {object} pagination The aggregation data as returned by the API.\n * @param {object} filtersData All of the filters that are available\n *\n * @returns {object} Pagination object that is usable by the API.\n */\nfunction convertRequiredGUItoAPI(required, filtersData) {\n if (!required) return {}\n return {\n ...required,\n include: required.include?.map(name => filtersData[name]?.requestQuantity || name),\n exclude: required.exclude?.map(name => filtersData[name]?.requestQuantity || name)\n }\n}\n\n/**\n * Goes through the given aggregations and compares then against the old results\n * and the current query to identify and return the aggregations that need to be\n * called.\n *\n * @param {object} aggs The current aggregation configuration.\n * @param {object} oldAggs Reduced aggregation config from latest finished query.\n * @param {bool} queryChanged Whether the query has changed.\n * @param {object} filtersData All of the filters that are available\n *\n * @returns {object} Reduced aggregation config.\n */\nfunction reduceAggs(aggs, oldAggs, queryChanged, updatedFilters, filtersData) {\n // Loop through the different aggregations for each quantity and see if any\n // of them need to be updated.\n const reducedAggs = {}\n let updateAggs = false\n for (const [key, agg] of Object.entries(aggs)) {\n const filter_name = rsplit(key, ':', 1)[0]\n if (!isBoolean(agg.update)) {\n throw Error(`It was not specified whether the aggregation ${key} should update or not.`)\n }\n let update = agg.update\n let changed = agg.update\n\n // If the old aggregation data is a superset of the newly queried\n // aggregation data, and the query has not changed, there is no need to\n // update.\n const oldAgg = oldAggs?.[key]\n if (update && !queryChanged && oldAgg) {\n const aggParams = {...agg}\n const aggParamsOld = {...oldAgg}\n delete aggParams.changed\n delete aggParams.update\n delete aggParamsOld.changed\n delete aggParamsOld.update\n if (isEqual(aggParams, aggParamsOld)) {\n update = false\n changed = false\n } else if (!isNil(agg.size)) {\n delete aggParams.size\n delete aggParamsOld.size\n if (isEqual(aggParams, aggParamsOld) && oldAgg.size >= agg.size) {\n update = false\n }\n }\n }\n\n // If the filter is exclusive, and ONLY it has been modified in this\n // query, we do not update it's aggregation.\n const exclude = isNil(agg.exclude_from_search)\n ? filtersData[filter_name].exclusive\n : agg.exclude_from_search\n if (exclude && updatedFilters.has(filter_name) && updatedFilters.size === 1) {\n update = false\n }\n\n // Create the new reduced version\n const newAgg = {...agg, update, changed}\n if (update) {\n updateAggs = true\n }\n reducedAggs[key] = newAgg\n }\n return [reducedAggs, updateAggs]\n}\n\n/**\n * Returns the final value that should be shown for the given filter.\n *\n * @param {*} def The quantity definition\n * @param {*} filter The current filter value in the search context\n * @param {*} filterLocked The current locked filter value in the search context\n * @param {*} initialValue Initial value that overrides any default specified in\n * the FilterRegistry\n *\n * @returns The final value for the filter.\n */\nexport function getValue(def, filter, filterLocked, initialValue) {\n const defaultValue = isNil(initialValue) ? def.default : initialValue\n const val = (def.global && !isNil(filterLocked)) ? filterLocked : filter\n return isNil(val) ? defaultValue : val\n}\n\n/**\n * Used to turn empty containers into undefined which is used to indicate that a\n * search filter has not been specified.\n */\nfunction clearEmpty(value) {\n function isEmpty(value) {\n if (isPlainObject(value)) {\n return Object.values(value).every(isEmpty)\n } else if ((isSet(value) || isArray(value)) && size(value) === 0) {\n return true\n }\n return false\n }\n return isEmpty(value) ? undefined : value\n}\n\n/**\n * Returns a mapping from full filter names to their abbreviations\n * and vice-versa.\n*/\nfunction getAbbreviations(filterData) {\n const abbreviations = {}\n const filterAbbreviations = {}\n const filterFullnames = {}\n const nameAbbreviationPairs = Object.keys(filterData).map(\n fullname => {\n const {path, schema} = parseQuantityName(fullname)\n return [fullname, schema ? path : path.split('.').pop()]\n }\n )\n for (const [fullname, abbreviation] of nameAbbreviationPairs) {\n const old = abbreviations[abbreviation]\n if (old === undefined) {\n abbreviations[abbreviation] = 1\n } else {\n abbreviations[abbreviation] += 1\n }\n filterAbbreviations[fullname] = fullname\n filterFullnames[fullname] = fullname\n }\n for (const [fullname, abbreviation] of nameAbbreviationPairs) {\n if (abbreviations[abbreviation] === 1) {\n filterAbbreviations[fullname] = abbreviation\n filterFullnames[abbreviation] = fullname\n }\n }\n return {filterAbbreviations, filterFullnames}\n}\n\n/**\n * Function that is used to automatically convert paths that target the correct\n * property in the materials index.\n * @param {string} path Path in the entry index\n * @returns The correct path in the materials index\n */\nfunction getFilterMaterialPath(path) {\n const prefix = 'results.material.'\n let materialPath\n if (path.startsWith(prefix)) {\n materialPath = path.substring(prefix.length)\n } else {\n materialPath = `entries.${path}`\n }\n return materialPath\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo } from 'react'\nimport { isArray } from 'lodash'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport { Skeleton } from '@material-ui/lab'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\n\n/**\n * Component that is used as a placeholder while loading data. Implemented as a\n * simple wrapper around the MUI Skeleton component.\n *\n * Override the 'placeholder' CSS-class to control the size of the placeholder\n * with respect to the root component.\n */\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%',\n position: 'relative'\n },\n skeleton: {\n width: '100%',\n height: '100%'\n }\n}))\nconst Placeholder = React.memo(({\n className,\n classes,\n 'data-testid':\n testID,\n margin\n}) => {\n const styles = useStyles({classes: classes})\n const theme = useTheme()\n const margins = useMemo(() => {\n let marginTop, marginRight, marginBottom, marginLeft\n if (isArray(margin)) {\n marginTop = margin[0]\n marginRight = margin[1]\n marginBottom = margin[2]\n marginLeft = margin[3]\n } else {\n marginTop = margin\n marginRight = margin\n marginBottom = margin\n marginLeft = margin\n }\n return {\n position: 'absolute',\n top: theme.spacing(marginTop),\n left: theme.spacing(marginLeft),\n right: theme.spacing(marginRight),\n bottom: theme.spacing(marginBottom)\n }\n }, [theme, margin])\n\n return
\n
\n \n
\n
\n})\n\nPlaceholder.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n /**\n * Margin with respect to the parent in theme spacing units.\n */\n margin: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),\n 'data-testid': PropTypes.string\n}\n\nPlaceholder.defaultProps = {\n margin: [0, 1, 0, 1]\n}\n\nexport default Placeholder\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useState, useMemo, useRef, useEffect } from 'react'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { CircularProgress, Tooltip, IconButton, TextField } from '@material-ui/core'\nimport Autocomplete from '@material-ui/lab/Autocomplete'\nimport ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown'\nimport CloseIcon from '@material-ui/icons/Close'\nimport { isNil } from 'lodash'\nimport { useSearchContext } from '../SearchContext'\nimport { useSuggestions } from '../../../hooks'\nimport { searchQuantities } from '../../../config'\nimport Placeholder from '../../visualization/Placeholder'\n\n/*\n * Low-level representational component for all text fields used in the search.\n */\nconst useInputTextFieldStyles = makeStyles(theme => ({\n root: {\n height: '3rem'\n }\n}))\nexport const InputTextField = React.memo((props) => {\n const initialLabel = useState(props.label)[0]\n const styles = useInputTextFieldStyles({classes: props.classes})\n\n return props.loading\n ? \n : \n})\n\nInputTextField.propTypes = {\n label: PropTypes.string,\n loading: PropTypes.bool,\n className: PropTypes.string,\n classes: PropTypes.object\n}\n\n/*\n * Customized version of Autocomplete with custom NOMAD styling and behaviour.\n *\n * Defines default behaviour for user input such as clearing inputs when\n * pressing esc and submitting values when pressing enter. Can also display\n * customizable list of suggestions.\n */\nconst useInputTextStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'center',\n flexDirection: 'column',\n boxSizing: 'border-box'\n },\n popupIndicatorOpen: {\n transform: 'rotate(180deg)'\n },\n adornmentList: {\n display: 'flex',\n alignItems: 'center'\n },\n adornment: {\n padding: '3px'\n },\n listbox: {\n boxSizing: 'border-box',\n '& ul': {\n padding: 0,\n margin: 0\n }\n },\n option: {\n paddingTop: 0,\n paddingBottom: 0\n }\n}))\nexport const InputText = React.memo(({\n value,\n error,\n shrink,\n suggestions,\n loading,\n onChange,\n onAccept,\n onSelect,\n onHighlight,\n onBlur,\n onFocus,\n onError,\n getOptionLabel,\n groupBy,\n renderOption,\n renderGroup,\n suggestAllOnFocus,\n showOpenSuggestions,\n autoHighlight,\n ListboxComponent,\n filterOptions,\n className,\n classes,\n TextFieldProps,\n InputProps,\n PaperComponent,\n disableClearable,\n disableAcceptOnBlur,\n validate,\n disableValidateOnSelect\n}) => {\n const theme = useTheme()\n const styles = useInputTextStyles({classes: classes, theme: theme})\n const [open, setOpen] = useState(false)\n const [suggestAll, setSuggestAll] = useState(false)\n const disabled = TextFieldProps?.disabled\n // The highlighted item is stored in a ref to keep the component more\n // responsive during browsing the suggestions\n const highlightRef = useRef(null)\n\n // Clears the input value and closes suggestions list\n const clearInputValue = useCallback(() => {\n onError?.(undefined)\n onChange?.(\"\")\n setOpen(false)\n }, [onChange, onError])\n\n const handleAccept = useCallback((value) => {\n const {valid, error, data} = validate ? validate(value) : {valid: true, error: undefined, data: undefined}\n if (valid) {\n onAccept?.(value && value.trim(), data)\n } else {\n onError?.(error)\n }\n }, [onAccept, validate, onError])\n\n // Validate the initial value if it is non-empty.\n useEffect(() => {\n if (!(isNil(value) || value?.trim?.() === '')) {\n handleAccept(value)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const handleSelect = useCallback((value) => {\n if (disableValidateOnSelect) {\n onSelect?.(value && value.trim())\n } else {\n const {valid, error, data} = validate ? validate(value) : {valid: true, error: undefined, data: undefined}\n if (valid) {\n onSelect?.(value && value.trim(), data)\n } else {\n onError?.(error)\n }\n }\n }, [onSelect, disableValidateOnSelect, validate, onError])\n\n // Handle item highlighting: items can he highlighted with mouse or keyboard.\n const handleHighlight = useCallback((event, value, reason) => {\n onHighlight?.(value, reason)\n highlightRef.current = value\n }, [highlightRef, onHighlight])\n\n // Handle blur\n const handleBlur = useCallback(() => {\n onBlur?.()\n !disableAcceptOnBlur && handleAccept(value)\n }, [onBlur, handleAccept, value, disableAcceptOnBlur])\n\n // Handles special key presses\n const handleKeyDown = useCallback((event) => {\n // When escape is pressed, close the menu if it is visible and showing some\n // items. Otherwise clear the current text input.\n if (event.key === 'Escape') {\n if (open && suggestions?.length > 0) {\n setOpen(false)\n } else {\n clearInputValue()\n }\n event.stopPropagation()\n event.preventDefault()\n }\n // When enter is pressed, select currently highlighted value and close menu,\n // or if menu is not open submit the value.\n if (event.key === 'Enter') {\n if (open && highlightRef.current) {\n handleSelect?.(getOptionLabel(highlightRef.current).trim())\n } else {\n handleAccept(value && value.trim())\n }\n event.stopPropagation()\n event.preventDefault()\n setOpen(false)\n }\n }, [open, suggestions, handleSelect, handleAccept, value, getOptionLabel, clearInputValue, highlightRef])\n\n // Handle input events. Errors are cleaned in input change, regular typing\n // emits onChange, selection with mouse emits onSelect.\n const handleInputChange = useCallback((event, value, reason) => {\n setSuggestAll(false)\n onError && onError(undefined)\n if (event) {\n if (reason === 'reset') {\n handleSelect?.(value)\n } else {\n onChange?.(value)\n }\n }\n }, [onChange, handleSelect, onError])\n\n return
\n setOpen(true)}\n onClose={() => setOpen(false)}\n onBlur={handleBlur}\n fullWidth\n disableClearable\n autoHighlight={autoHighlight}\n classes={{\n listbox: styles.listbox,\n option: styles.option\n }}\n ListboxComponent={ListboxComponent}\n PaperComponent={PaperComponent}\n options={suggestions}\n onInputChange={handleInputChange}\n onHighlightChange={handleHighlight}\n getOptionLabel={getOptionLabel}\n getOptionSelected={(option, value) => false}\n groupBy={groupBy}\n renderGroup={renderGroup}\n filterOptions={suggestAll\n ? (opt) => opt\n : filterOptions\n }\n renderOption={renderOption}\n selectOnFocus={true}\n renderInput={(params) => {\n // We need to strip out the styling of the input field that is imposed\n // by Autocomplete. Otherwise the styles enabled by the\n // hiddenLabel-property will be overridden.\n params.InputProps.className = undefined\n return { suggestAllOnFocus && setSuggestAll(true); onFocus?.() } }\n onKeyDown={handleKeyDown}\n InputLabelProps={{shrink}}\n InputProps={{\n ...params.InputProps,\n ...InputProps,\n endAdornment: (
\n {loading ? : null}\n {(value?.length && !disableClearable)\n ? \n \n \n \n \n : null\n }\n {(showOpenSuggestions)\n ? setOpen(old => !old)}\n className={clsx(styles.popupIndicator, {\n [styles.popupIndicatorOpen]: open\n })}\n >\n \n \n : null\n }\n {InputProps?.endAdornment || null}\n
)\n }}\n {...TextFieldProps}\n />\n }}\n />\n
\n})\n\nInputText.propTypes = {\n value: PropTypes.string,\n error: PropTypes.string, // Error shown underneath the text\n shrink: PropTypes.bool, // Whether the label should automatically \"shrink\" on input\n suggestions: PropTypes.array, // Array of suggested values\n loading: PropTypes.bool, // Whether loading icon should be shown\n onChange: PropTypes.func, // Triggered whenever the input text changes\n onSelect: PropTypes.func, // Triggered when an option is selected from suggestions\n onAccept: PropTypes.func, // Triggered when value should be accepted\n onBlur: PropTypes.func, // Triggered when text goes out of focus\n onFocus: PropTypes.func, // Triggered when text is focused\n onHighlight: PropTypes.func, // Triggered when selection is highlighted\n onError: PropTypes.func, // Triggered when any errors should be cleared\n getOptionLabel: PropTypes.func,\n groupBy: PropTypes.func,\n renderOption: PropTypes.func,\n renderGroup: PropTypes.func,\n ListboxComponent: PropTypes.any,\n PaperComponent: PropTypes.any,\n TextFieldProps: PropTypes.object,\n InputProps: PropTypes.object,\n filterOptions: PropTypes.func,\n disableClearable: PropTypes.bool,\n autoHighlight: PropTypes.bool,\n disableAcceptOnBlur: PropTypes.bool,\n validate: PropTypes.func, // Function that can be used to validate the input\n disableValidateOnSelect: PropTypes.bool, // Whether validation on selecting autocompletion value should be disabled\n suggestAllOnFocus: PropTypes.bool, // Whether to provide all suggestion values when input is focused\n showOpenSuggestions: PropTypes.bool, // Whether to show button for opening suggestions\n className: PropTypes.string,\n classes: PropTypes.object\n}\n\nInputText.defaultProps = {\n getOptionLabel: (option) => option.value,\n showOpenSuggestions: false,\n autoHighlight: false\n}\n\n/*\n * Text field that can be used to submit filter values that target a specific\n * quantity. Can also suggest values.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'center',\n flexDirection: 'column',\n boxSizing: 'border-box'\n }\n}))\nexport const InputTextQuantity = React.memo(({\n quantity,\n suggestions,\n loading,\n onChange,\n disableSuggestions,\n className,\n classes,\n ...TextFieldProps\n}) => {\n const theme = useTheme()\n const { filterData, useSetFilter } = useSearchContext()\n const styles = useStyles({classes: classes, theme: theme})\n const [inputValue, setInputValue] = useState('')\n const [suggestionInput, setSuggestionInput] = useState('')\n const [highlighted, setHighlighted] = useState({value: ''})\n const [open, setOpen] = useState(false)\n const [error, setError] = useState(false)\n const [quantitiesSuggestion, quantitiesAll] = useMemo(() => [\n [{name: quantity, size: 5}],\n new Set([quantity])\n ], [quantity])\n const [suggestionsAuto, loadingAuto] = useSuggestions(quantitiesSuggestion, quantitiesAll, suggestionInput, filterData)\n const finalSuggestions = suggestions || suggestionsAuto\n const finalLoading = loading || loadingAuto\n const disableSuggestionsFinal = suggestions\n ? true\n : isNil(disableSuggestions)\n ? !searchQuantities[quantity]?.suggestion\n : disableSuggestions\n\n // Attach the filter hook\n const setFilter = useSetFilter(quantity)\n const disabled = TextFieldProps.disabled\n\n // Sets the input value and calls the callback if given\n const handleChange = useCallback((input) => {\n setInputValue(input)\n onChange && onChange(input)\n }, [onChange])\n\n // Clears the input and suggestions\n const clearInputValue = useCallback(() => {\n handleChange('')\n setSuggestionInput('')\n setOpen(false)\n }, [handleChange])\n\n // Triggered when a value is submitted by pressing enter or clicking the\n // search icon.\n const handleSubmit = useCallback((value) => {\n if (value.trim().length === 0) {\n return\n }\n const valid = true\n if (valid) {\n // Submit to search context on successful validation.\n setFilter(old => {\n const multiple = filterData[quantity].multiple\n return (isNil(old) || !multiple) ? new Set([value]) : new Set([...old, value])\n })\n clearInputValue()\n } else {\n setError(`Invalid query`)\n }\n }, [filterData, quantity, setFilter, clearInputValue])\n\n const handleHighlight = useCallback((event, value, reason) => {\n setHighlighted(value)\n }, [])\n\n // Handles special key presses\n const handleKeyDown = useCallback((event) => {\n // When escape is pressed, close the menu if it is visible and showing some\n // items. Otherwise clear the current text input.\n if (event.key === 'Escape') {\n if (open && suggestions?.length > 0) {\n setOpen(false)\n } else {\n clearInputValue()\n }\n event.stopPropagation()\n event.preventDefault()\n }\n // When enter is pressed, select currently highlighted value and close menu,\n // or if menu is not open submit the value.\n if (event.key === 'Enter') {\n if (open && highlighted?.value) {\n handleSubmit(highlighted.value)\n } else {\n handleSubmit(inputValue)\n }\n event.stopPropagation()\n event.preventDefault()\n }\n }, [open, suggestions, highlighted, handleSubmit, inputValue, clearInputValue])\n\n // Handle typing events.\n const handleInputChange = useCallback((event, value, reason) => {\n setError(error => error ? undefined : null)\n\n // When an option is selected (mouse or keyboard), the filter is immediately\n // submitted and the field value cleared.\n if (reason === 'reset') {\n handleSubmit(value)\n } else {\n handleChange(value)\n }\n\n // Suggestions are only retrieved on user input, or when the value has been\n // cleared (this clears the suggestions)\n if (!disableSuggestionsFinal && (value.trim() === '' || reason === 'input')) {\n setSuggestionInput(value)\n }\n }, [disableSuggestionsFinal, handleSubmit, handleChange])\n\n return
\n setOpen(true)}\n onClose={() => setOpen(false)}\n fullWidth\n disableClearable\n classes={{endAdornment: styles.endAdornment}}\n options={finalSuggestions}\n onInputChange={handleInputChange}\n onHighlightChange={handleHighlight}\n getOptionLabel={option => option.value}\n getOptionSelected={(option, value) => false}\n renderInput={(params) => {\n // We need to strip out the styling of the input field that is imposed\n // by Autocomplete. Otherwise the styles enabled by the\n // hiddenLabel-property will be overridden.\n params.InputProps.className = undefined\n return \n {finalLoading ? : null}\n {(inputValue?.length || null) && <>\n \n \n \n \n \n }\n )\n }}\n {...TextFieldProps}\n />\n }}\n />\n
\n})\n\nInputTextQuantity.propTypes = {\n /*\n * The quantity targeted by the text field target.\n */\n quantity: PropTypes.string,\n /*\n * A manual array of suggestions.\n */\n suggestions: PropTypes.array,\n /*\n * Whether suggestions are being loaded.\n */\n loading: PropTypes.bool,\n /*\n * Callback for when the input changes.\n */\n onChange: PropTypes.bool,\n /*\n * Whether to enable or disable automatic suggestions. Will be forcefully set\n * to true if manual list of suggestions are provided. If no value is given\n * the suggestions are turned on if they are available for the quantity.\n */\n disableSuggestions: PropTypes.bool,\n className: PropTypes.string,\n classes: PropTypes.object\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {useCallback, useEffect, useMemo, useRef, useContext, createContext} from 'react'\nimport PropTypes from 'prop-types'\nimport {isNil} from 'lodash'\nimport {getSuggestions} from '../../utils'\nimport {unitMap} from './UnitContext'\nimport {parse} from './common'\nimport {List, ListItemText, ListSubheader, makeStyles} from '@material-ui/core'\nimport {VariableSizeList} from 'react-window'\nimport {InputText} from '../search/input/InputText'\n\n/**\n * Wrapper around InputText that is specialized in showing unit options.\n */\nexport const useInputStyles = makeStyles(theme => ({\n optionText: {\n flexGrow: 1,\n overflowX: 'scroll',\n '&::-webkit-scrollbar': {\n display: 'none'\n },\n '-ms-overflow-style': 'none',\n scrollbarWidth: 'none'\n },\n noWrap: {\n whiteSpace: 'nowrap'\n },\n option: {\n width: '100%',\n display: 'flex',\n alignItems: 'stretch'\n }\n}))\nexport const UnitInput = React.memo(({value, error, onChange, onAccept, onSelect, onError, dimension, options, disabled, label, disableGroup, optional}) => {\n const styles = useInputStyles()\n\n // Predefine all option objects, all option paths and also pre-tokenize the\n // options for faster matching.\n const {keys, filter, finalOptions} = useMemo(() => {\n const finalOptions = {}\n Object.entries(unitMap)\n .filter(([key, unit]) => dimension ? unit.dimension === dimension : true)\n .forEach(([key, unit]) => {\n const unitAbbreviation = unit.abbreviation ? ` (${unit.abbreviation})` : ''\n finalOptions[key] = {\n key: key,\n primary: `${unit.label}${unitAbbreviation}`,\n secondary: unit.aliases?.splice(1).join(', '),\n dimension: unit.dimension,\n unit: unit\n }\n })\n const keys = Object.keys(finalOptions)\n const {filter} = getSuggestions(keys, 0)\n return {keys, filter, finalOptions}\n }, [dimension])\n\n const validate = useCallback((value) => {\n if (isNil(value) || value?.trim?.() === '') {\n if (optional) {\n return {valid: true}\n } else {\n return {valid: false, error: 'Please specify a value'}\n }\n }\n const {error, unit} = parse(value, {dimension, requireUnit: true})\n return {valid: !error, error, data: unit}\n }, [optional, dimension])\n\n // Revalidate input when dimension changes\n useEffect(() => {\n if (!value) return\n const {error} = validate(value)\n if (error) {\n onError?.(error)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dimension])\n\n // Used to filter the shown options based on input\n const filterOptions = useCallback((opt, { inputValue }) => {\n let filtered = filter(inputValue)\n if (!disableGroup) filtered = filtered.sort((a, b) => options[a].group > options[b].group ? 1 : -1)\n return filtered\n }, [disableGroup, filter, options])\n\n return finalOptions?.[key]?.dimension}\n renderGroup={disableGroup ? undefined : renderGroup}\n getOptionLabel={option => option}\n filterOptions={filterOptions}\n renderOption={(key) => {\n const option = finalOptions[key]\n return
\n \n
\n }}\n />\n})\nUnitInput.propTypes = {\n value: PropTypes.string,\n error: PropTypes.string,\n label: PropTypes.string,\n dimension: PropTypes.string,\n options: PropTypes.object,\n onChange: PropTypes.func,\n onAccept: PropTypes.func,\n onSelect: PropTypes.func,\n onBlur: PropTypes.func,\n onError: PropTypes.func,\n disabled: PropTypes.bool,\n disableGroup: PropTypes.bool,\n optional: PropTypes.bool\n}\n\nexport default UnitInput\n\n/**\n * Custom virtualized list component for displaying unit values.\n */\nconst ListboxUnit = React.forwardRef((props, ref) => {\n const { children, ...other } = props\n const itemSize = 64\n const headerSize = 40\n const itemData = React.Children.toArray(children)\n const itemCount = itemData.length\n\n // Calculate size of child element.\n const getChildSize = (child) => {\n return React.isValidElement(child) && child.type === ListSubheader\n ? headerSize\n : itemSize\n }\n\n // Calculates the height of the suggestion box\n const getHeight = () => {\n return itemCount > 8\n ? 8 * itemSize\n : itemData.map(getChildSize).reduce((a, b) => a + b, 0)\n }\n\n const gridRef = useResetCache(itemCount)\n\n return
\n \n \n getChildSize(itemData[index])}\n overscanCount={5}\n itemCount={itemCount}\n >\n {renderRow}\n \n \n \n
\n})\n\nListboxUnit.propTypes = {\n children: PropTypes.node\n}\n\nconst LISTBOX_PADDING = 8\nconst OuterElementContext = createContext({})\n\nconst OuterElementType = React.forwardRef((props, ref) => {\n const outerProps = useContext(OuterElementContext)\n return
\n})\n\nconst renderGroup = (params) => [\n \n {params.group}\n ,\n params.children\n]\n\nfunction useResetCache(data) {\n const ref = useRef(null)\n useEffect(() => {\n if (ref.current != null) {\n ref.current.resetAfterIndex(0, true)\n }\n }, [data])\n return ref\n}\n\nfunction renderRow({ data, index, style }) {\n return React.cloneElement(data[index], {\n style: {\n ...style,\n top: style.top + LISTBOX_PADDING\n }\n })\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useEffect, useCallback, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport {useUnitContext} from './UnitContext'\nimport UnitInput from './UnitInput'\n\n/**\n * Controls the unit for the specified dimension in the current unit context.\n */\nconst UnitDimensionSelect = React.memo(({label, dimension, onChange, disabled}) => {\n const {units, setUnits} = useUnitContext()\n const [error, setError] = useState()\n const unit = units?.[dimension]\n const disabledFinal = disabled || unit?.locked\n const labelFinal = label || dimension\n const oldValue = useRef(unit?.definition)\n const [inputValue, setInputValue] = useState(unit?.definition)\n\n // React to changes in units\n useEffect(() => {\n setError(undefined)\n setInputValue(unit?.definition)\n }, [unit, dimension])\n\n const handleAccept = useCallback((unitString, unit) => {\n setUnits(old => {\n const newUnits = {\n ...old,\n [dimension]: {...old[dimension], definition: unitString}\n }\n return newUnits\n })\n onChange?.(unit)\n oldValue.current = unitString\n }, [dimension, onChange, setUnits])\n\n const handleSelect = useCallback((unitString, unit) => {\n handleAccept(unit.label(), unit)\n }, [handleAccept])\n\n const handleChange = useCallback((value) => {\n oldValue.current = value\n setInputValue(value)\n }, [])\n\n return (unit && dimension !== 'dimensionless')\n ? \n : null\n})\nUnitDimensionSelect.propTypes = {\n value: PropTypes.string,\n label: PropTypes.string,\n dimension: PropTypes.string,\n onChange: PropTypes.func,\n disabled: PropTypes.bool\n}\n\nexport default UnitDimensionSelect\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback } from 'react'\nimport {FormControlLabel, RadioGroup, Radio} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport {useUnitContext} from './UnitContext'\n\n/**\n * Controls the unit system in the current unit context.\n */\nconst UnitSystemSelect = React.memo(({onChange}) => {\n const {unitSystems, selected, setSelected} = useUnitContext()\n\n const handleSystemChange = useCallback((event) => {\n setSelected(event.target.value)\n onChange && onChange(event)\n }, [onChange, setSelected])\n\n return \n {Object.entries(unitSystems).map(([key, system]) =>\n } label={system.label} />\n )}\n \n})\nUnitSystemSelect.propTypes = {\n onChange: PropTypes.func,\n disabled: PropTypes.bool\n}\n\nexport default UnitSystemSelect\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useState, useMemo } from 'react'\nimport {\n Box, Button, Menu, FormLabel, makeStyles, Typography\n} from '@material-ui/core'\nimport SettingsIcon from '@material-ui/icons/Settings'\nimport ReplayIcon from '@material-ui/icons/Replay'\nimport PropTypes from 'prop-types'\nimport { HelpButton } from '../Help'\nimport { InputText } from '../search/input/InputText'\nimport UnitDimensionSelect from './UnitDimensionSelect'\nimport UnitSystemSelect from './UnitSystemSelect'\nimport { useUnitContext } from './UnitContext'\nimport { Action, ActionHeader, Actions } from '../Actions'\n\n/**\n * Menu for controlling all units in the current unit context.\n */\nconst useStyles = makeStyles(theme => ({\n // MUI will automatically add a padding whe scroll bar is visible. This is\n // disabled here because the contents already have a sufficient margin.\n list: {\n paddingRight: '0 !important',\n width: '100% !important'\n },\n option: {\n paddingTop: '6px',\n paddingBottom: '6px'\n }\n}))\nconst UnitMenu = React.memo(({\n className,\n onUnitChange,\n onSystemChange\n}) => {\n const {units, dimensionMap, reset} = useUnitContext()\n const [anchorEl, setAnchorEl] = useState(null)\n const open = Boolean(anchorEl)\n const styles = useStyles()\n\n const dimensionOptions = useMemo(() => {\n return Object.keys(units)\n .filter((name) => name !== 'dimensionless')\n .sort()\n }, [units])\n const [dimension, setDimension] = useState(dimensionOptions[0])\n const [dimensionInput, setDimensionInput] = useState(dimensionMap[dimensionOptions[0]].label)\n\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n const closeMenu = useCallback(() => {\n setAnchorEl(null)\n }, [])\n\n const handleChange = useCallback((value) => {\n setDimensionInput(value)\n }, [])\n\n const handleBlur = useCallback(() => {\n const cleanValue = dimensionInput.trim().toLowerCase()\n const dim = dimensionMap[cleanValue]\n if (dim) {\n setDimensionInput(dim.label)\n setDimension(cleanValue)\n } else {\n setDimensionInput(dimensionMap[dimension].label)\n }\n }, [dimension, dimensionInput, dimensionMap])\n\n const handleSelect = useCallback((value) => {\n setDimension(value)\n setDimensionInput(dimensionMap[value].label)\n }, [dimensionMap])\n\n return <>\n }\n >\n Units\n \n \n \n \n \n \n Unit Settings\n \n \n \n \n \n \n \n \n \n {/* \n Scope\n setScope(event.target.value)}\n >\n Global\n Schema\n \n */}\n \n Select unit system\n \n \n Select dimension and unit\n \n \n {dimensionMap[option].label}\n }\n getOptionLabel={(option) => option}\n TextFieldProps={{label: 'Dimension'}}\n />\n \n \n \n \n \n})\n\nUnitMenu.propTypes = {\n onUnitChange: PropTypes.func,\n onSystemChange: PropTypes.func,\n className: PropTypes.string\n}\n\nexport default UnitMenu\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport {\n Button,\n Box,\n makeStyles,\n MenuList,\n MenuItem,\n Menu,\n ListItemText,\n Typography, Tooltip, IconButton\n} from '@material-ui/core'\nimport KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'\nimport { matchPath, useHistory, useLocation } from 'react-router-dom'\n\nconst useMenuBarStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'nowrap',\n justifyContent: 'left',\n boxSizing: 'border-box'\n }\n}))\n\n/**\n * Reusable menubar e.g. for navigation.\n*/\nexport function MenuBar({children}) {\n const classes = useMenuBarStyles()\n\n return
\n {children}\n
\n}\nMenuBar.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nexport const MenuBarList = React.memo(({header, children}) => {\n return \n {header}\n
\n }\n >\n {children}\n \n})\nMenuBarList.propTypes = {\n header: PropTypes.string,\n children: PropTypes.node\n}\n\nconst useMenuBarItemStyles = makeStyles(theme => ({\n selected: {\n color: theme.palette.primary.main\n }\n}))\n\nexport const MenuBarItem = React.forwardRef(({label, tooltip, route, href}, ref) => {\n const classes = useMenuBarItemStyles()\n const {pathname} = useLocation()\n const selected = matchPath(pathname, route) && true\n\n const history = useHistory()\n\n const handleClick = () => {\n if (route) {\n history.push(route)\n }\n }\n\n return \n \n \n})\nMenuBarItem.propTypes = {\n label: PropTypes.string.isRequired,\n tooltip: PropTypes.string,\n icon: PropTypes.node,\n route: PropTypes.string,\n href: PropTypes.string\n}\n\nconst useMenuBarMenuStyles = makeStyles(theme => ({\n root: {\n marginLeft: theme.spacing(1),\n '&:first-child': {\n marginLeft: theme.spacing(0)\n }\n },\n menuPopover: {\n pointerEvents: 'none'\n },\n menuPaper: {\n pointerEvents: 'all'\n }\n}))\n\nexport function MenuBarMenu({label, children, route, icon}) {\n const classes = useMenuBarMenuStyles()\n const {pathname} = useLocation()\n const [anchorEl, setAnchorEl] = useState(null)\n const selected = matchPath(pathname, route) && true\n\n const handleOpen = (event) => {\n setAnchorEl(event.currentTarget)\n }\n\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n return
\n {icon && \n \n {icon}\n \n }\n {!icon && }\n >\n {label}\n }\n \n {children}\n \n
\n}\nMenuBarMenu.propTypes = {\n label: PropTypes.string.isRequired,\n route: PropTypes.string.isRequired,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]),\n icon: PropTypes.node\n}\n","var _clipPath, _g, _g2, _g3, _g4, _g5, _tspan, _tspan2, _tspan3, _tspan4;\n\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport * as React from \"react\";\n\nfunction SvgAbout(_ref, svgRef) {\n let {\n title,\n titleId,\n ...props\n } = _ref;\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: \"100%\",\n height: \"100%\",\n viewBox: \"0 0 1130 643\",\n style: {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeMiterlimit: 1.5\n },\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"g\", {\n id: \"Artboard1\",\n transform: \"matrix(1.10933,0,0,1.0562,-2.94,0)\"\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: 2.65,\n y: 0,\n width: 1018.16,\n height: 608.36,\n style: {\n fill: \"none\"\n }\n }), _clipPath || (_clipPath = /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"_clip1\"\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: 2.65,\n y: 0,\n width: 1018.16,\n height: 608.36\n }))), /*#__PURE__*/React.createElement(\"g\", {\n clipPath: \"url(#_clip1)\"\n }, _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.901444,0,0,0.946793,4.80392,8.02979)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M729.794,14.858L475.275,161.805L472.775,157.475L729.794,9.085L823.721,63.313L821.221,67.644L729.794,14.858Z\"\n }))), _g2 || (_g2 = /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.901444,0,0,0.946793,2.65025,10.1583)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M727.514,161.143L866.967,241.657L861.984,244.534L717.514,161.143L834.28,93.728L836.78,98.058L727.514,161.143Z\"\n }))), _g3 || (_g3 = /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.901444,0,0,0.946793,2.64456,9.81211)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M927.126,246.844L960.764,227.423L958.264,223.092L922.126,243.957L927.126,246.844Z\"\n }))), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.907222,0,0,0.948123,0.245885,22.4155)\"\n }, /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.993631,0,0,1.02527,2.65025,-10.5415)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M30.051,395.2L9,382.85L9,-9.946\",\n style: {\n fill: \"none\",\n stroke: \"black\",\n strokeWidth: \"0.49px\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.25077,0,0,1.2906,-102.959,-7.90252)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M570.5,154.635L570.5,-9.946\",\n style: {\n fill: \"none\",\n stroke: \"black\",\n strokeWidth: \"0.39px\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.993631,0,0,0.998598,2.65025,0)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M173.761,518.483L173.761,615.873\",\n style: {\n fill: \"none\",\n stroke: \"black\",\n strokeWidth: \"0.5px\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.993631,0,0,0.998598,2.65025,0)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M476.136,344.02L551.24,386.958L551.24,615.873\",\n style: {\n fill: \"none\",\n stroke: \"black\",\n strokeWidth: \"0.5px\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.993631,0,0,0.998598,2.65025,0)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M884.281,286.732L855.686,302.319L855.686,615.873\",\n style: {\n fill: \"none\",\n stroke: \"black\",\n strokeWidth: \"0.5px\"\n }\n }))), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-379.833,-86.4269)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M247.871,178.885L278.855,196.774\",\n style: {\n fill: \"none\",\n stroke: \"black\",\n strokeWidth: \"2.07px\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-379.833,-86.4269)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M247.871,214.663L309.839,250.44L371.806,214.663L371.806,207.187L309.839,171.41L247.871,207.187L247.871,214.663Z\",\n style: {\n fill: \"rgb(123,31,162)\"\n }\n })), _g4 || (_g4 = /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.901444,0,0,0.946793,2.65025,10.1583)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M33.307,410.333L475.711,154.911L554.127,200.185L551.627,204.515L475.711,160.685L38.307,413.22L33.307,410.333Z\"\n }))), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-364.035,-76.847)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M334.92,182.002L350.44,190.782L386.918,169.722L390.144,158.425L371.63,160.807L334.92,182.002Z\",\n style: {\n stroke: \"white\",\n strokeWidth: \"0.83px\",\n strokeLinecap: \"square\",\n strokeLinejoin: \"miter\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-634.471,87.1444)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M332.901,183.168L348.421,191.948L386.918,169.722L390.144,158.425L371.63,160.807L332.901,183.168Z\",\n style: {\n stroke: \"white\",\n strokeWidth: \"0.83px\",\n strokeLinecap: \"square\",\n strokeLinejoin: \"miter\"\n }\n })), _g5 || (_g5 = /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.901444,0,0,0.946793,2.65025,10.1583)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M858.552,280.292L863.552,283.179L475.711,507.099L397.295,461.826L399.795,457.496L475.711,501.326L858.552,280.292Z\"\n }))), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-379.833,-86.4269)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M453.475,154.483L495.742,178.885\",\n style: {\n fill: \"none\",\n stroke: \"black\",\n strokeWidth: \"2.07px\",\n strokeLinecap: \"butt\",\n strokeLinejoin: \"miter\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-379.833,-86.4269)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M371.806,143.108L433.774,178.885L495.742,143.108L495.742,135.633L433.774,99.856L371.806,135.633L371.806,143.108Z\",\n style: {\n fill: \"rgb(0,121,107)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-161.861,-218.406)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M371.806,143.108L420.589,171.187L482.557,135.409L482.557,127.934L433.774,99.856L371.806,135.633L371.806,143.108Z\",\n style: {\n fill: \"rgb(255,179,0)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(2.18207,0,0,2.29185,-32.4192,-139.913)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M371.806,143.108L420.589,171.187L482.557,135.409L482.557,127.934L433.774,99.856L371.806,135.633L371.806,143.108Z\",\n style: {\n fill: \"rgb(124,179,66)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-596.364,363.645)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"344.745px\",\n style: {\n fontFamily: \"'TitilliumWeb-Bold', 'Titillium Web'\",\n fontWeight: 700,\n fontSize: \"14.25px\",\n fill: \"rgb(235,235,235)\"\n }\n }, \"repository\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-667.812,320.32)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n id: \"repositoryStats\",\n x: \"280px\",\n y: \"322.821px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"9.5px\",\n fill: \"rgb(235,235,235)\"\n }\n }, \"repository stats\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-396.817,155.989)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n id: \"archiveStats\",\n x: \"280px\",\n y: \"322.821px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"9.5px\",\n fill: \"rgb(235,235,235)\"\n }\n }, \"archiv\", _tspan || (_tspan = /*#__PURE__*/React.createElement(\"tspan\", {\n x: \"303.76px \",\n y: \"322.821px \"\n }, \"e\")), \" stats\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-177.867,23.2191)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n id: \"encStats\",\n x: \"280px\",\n y: \"322.821px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"9.5px\",\n fill: \"rgb(235,235,235)\"\n }\n }, \"encyclopedia stats\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-48.2806,101.8)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n id: \"toolkitStats\",\n x: \"280px\",\n y: \"322.821px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"9.5px\",\n fill: \"rgb(235,235,235)\"\n }\n }, \"ai toolkit stats\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-468.236,273.281)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"324.526px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"11.875px\",\n fill: \"white\"\n }\n }, \"pr\", _tspan2 || (_tspan2 = /*#__PURE__*/React.createElement(\"tspan\", {\n x: \"290.248px \",\n y: \"324.526px \"\n }, \"o\")), \"cessing\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-739.332,437.673)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"324.526px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"11.875px\",\n fill: \"white\"\n }\n }, \"upload\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-832.377,317.37)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"324.526px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"11.875px\"\n }\n }, \"explor\", _tspan3 || (_tspan3 = /*#__PURE__*/React.createElement(\"tspan\", {\n x: \"310.578px \",\n y: \"324.526px \"\n }, \"e\")))), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-137.471,258.922)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"320.14px\",\n y: \"325.332px\",\n style: {\n fontFamily: \"'TitilliumWeb-Regular', 'Titillium Web'\",\n fontSize: \"11.875px\"\n }\n }, \"API\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-325.553,199.427)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"344.745px\",\n style: {\n fontFamily: \"'TitilliumWeb-Bold', 'Titillium Web'\",\n fontWeight: 700,\n fontSize: \"14.25px\",\n fill: \"rgb(235,235,235)\"\n }\n }, \"archive\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-135.371,48.9883)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"344.745px\",\n style: {\n fontFamily: \"'TitilliumWeb-Bold', 'Titillium Web'\",\n fontWeight: 700,\n fontSize: \"14.25px\",\n fill: \"white\"\n }\n }, \"ency\", _tspan4 || (_tspan4 = /*#__PURE__*/React.createElement(\"tspan\", {\n x: \"308.514px \",\n y: \"344.745px \"\n }, \"c\")), \"lopedia\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.31481,-0.797294,1.51821,0.920636,-36.3098,109.059)\"\n }, /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"336.589px\",\n style: {\n fontFamily: \"'TitilliumWeb-Bold', 'Titillium Web'\",\n fontWeight: 700,\n fontSize: \"14.25px\",\n fill: \"white\"\n }\n }, \"artificial\"), /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"350.839px\",\n style: {\n fontFamily: \"'TitilliumWeb-Bold', 'Titillium Web'\",\n fontWeight: 700,\n fontSize: \"14.25px\",\n fill: \"white\"\n }\n }, \"intelligence\"), /*#__PURE__*/React.createElement(\"text\", {\n x: \"280px\",\n y: \"365.089px\",\n style: {\n fontFamily: \"'TitilliumWeb-Bold', 'Titillium Web'\",\n fontWeight: 700,\n fontSize: \"14.25px\",\n fill: \"white\"\n }\n }, \"toolkit\")), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(35.0386,0,0,36.8013,112.044,587.742)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M0.232,-0.65C0.249,-0.633 0.269,-0.625 0.291,-0.625C0.313,-0.625 0.333,-0.633 0.35,-0.65C0.367,-0.667 0.375,-0.687 0.375,-0.709C0.375,-0.731 0.367,-0.75 0.35,-0.767C0.333,-0.783 0.313,-0.791 0.291,-0.791C0.269,-0.791 0.25,-0.783 0.233,-0.767C0.217,-0.75 0.209,-0.731 0.209,-0.709C0.209,-0.687 0.217,-0.667 0.232,-0.65ZM0.834,-0.875C0.846,-0.875 0.855,-0.871 0.863,-0.863C0.871,-0.855 0.875,-0.846 0.875,-0.834L0.875,-0.584C0.875,-0.572 0.871,-0.562 0.863,-0.554C0.855,-0.545 0.846,-0.541 0.834,-0.541L0.166,-0.541C0.154,-0.541 0.145,-0.545 0.137,-0.554C0.129,-0.562 0.125,-0.572 0.125,-0.584L0.125,-0.834C0.125,-0.846 0.129,-0.855 0.137,-0.863C0.145,-0.871 0.154,-0.875 0.166,-0.875L0.834,-0.875ZM0.232,-0.232C0.249,-0.217 0.269,-0.209 0.291,-0.209C0.313,-0.209 0.333,-0.217 0.35,-0.233C0.367,-0.25 0.375,-0.269 0.375,-0.291C0.375,-0.313 0.367,-0.333 0.35,-0.35C0.333,-0.367 0.313,-0.375 0.291,-0.375C0.269,-0.375 0.25,-0.367 0.233,-0.35C0.217,-0.333 0.209,-0.313 0.209,-0.291C0.209,-0.269 0.217,-0.249 0.232,-0.232ZM0.834,-0.459C0.846,-0.459 0.855,-0.455 0.863,-0.446C0.871,-0.438 0.875,-0.428 0.875,-0.416L0.875,-0.166C0.875,-0.154 0.871,-0.145 0.863,-0.137C0.855,-0.129 0.846,-0.125 0.834,-0.125L0.166,-0.125C0.154,-0.125 0.145,-0.129 0.137,-0.137C0.129,-0.145 0.125,-0.154 0.125,-0.166L0.125,-0.416C0.125,-0.428 0.129,-0.438 0.137,-0.446C0.145,-0.455 0.154,-0.459 0.166,-0.459L0.834,-0.459Z\",\n style: {\n fillRule: \"nonzero\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(38.6852,0,0,40.6314,-1.17035,438.333)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M0.264,-0.471C0.3,-0.434 0.344,-0.416 0.396,-0.416C0.449,-0.416 0.493,-0.434 0.529,-0.471C0.566,-0.507 0.584,-0.551 0.584,-0.604C0.584,-0.656 0.566,-0.7 0.529,-0.736C0.493,-0.773 0.449,-0.791 0.396,-0.791C0.344,-0.791 0.3,-0.773 0.264,-0.736C0.227,-0.7 0.209,-0.656 0.209,-0.604C0.209,-0.551 0.227,-0.507 0.264,-0.471ZM0.646,-0.416L0.854,-0.209L0.791,-0.146L0.584,-0.354L0.584,-0.387L0.572,-0.398C0.523,-0.355 0.464,-0.334 0.396,-0.334C0.321,-0.334 0.257,-0.36 0.204,-0.412C0.151,-0.464 0.125,-0.528 0.125,-0.604C0.125,-0.679 0.151,-0.743 0.204,-0.796C0.257,-0.849 0.321,-0.875 0.396,-0.875C0.472,-0.875 0.536,-0.849 0.588,-0.796C0.64,-0.743 0.666,-0.679 0.666,-0.604C0.666,-0.536 0.645,-0.477 0.602,-0.428L0.613,-0.416L0.646,-0.416Z\",\n style: {\n fillRule: \"nonzero\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(0.907222,0,0,0.983302,0.245885,10.1583)\"\n }, /*#__PURE__*/React.createElement(\"g\", {\n id: \"search\",\n transform: \"matrix(0.993631,0,0,0.962871,2.65025,0)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M0,412.944L17.195,395.308L76.244,360.184L96.747,377.857L34.39,413.859L34.39,448.142L0,448.142L0,412.944Z\",\n style: {\n fill: \"white\",\n fillOpacity: 0\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n id: \"upload\",\n transform: \"matrix(2.40523,0,0,2.33077,-698.41,78.9745)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M325.331,178.885L356.547,196.64L395.044,174.413L390.948,158.89L364.06,156.525L325.331,178.885Z\",\n style: {\n fill: \"white\",\n fillOpacity: 0\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n id: \"encyclopedia\",\n transform: \"matrix(2.40523,0,0,2.33077,-178.719,-250.269)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M371.806,143.108L420.769,171.377L482.737,135.6L433.774,107.331L371.806,143.108Z\",\n style: {\n fill: \"white\",\n fillOpacity: 0\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n id: \"toolkit\",\n transform: \"matrix(2.40523,0,0,2.33077,-20.7432,-162.081)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M365.21,139.3L414.822,167.943L476.79,132.166L427.178,103.523L365.21,139.3Z\",\n style: {\n fill: \"white\",\n fillOpacity: 0\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n id: \"api\",\n transform: \"matrix(0.993631,0,0,0.962871,2.65025,0)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M858.874,315.909L833.39,301.196L869.409,280.401L869.409,242.554L922.903,242.554L922.903,276.811L887.712,297.128L858.874,315.909Z\",\n style: {\n fill: \"white\",\n fillOpacity: 0\n }\n }))), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(35.0386,0,0,36.8013,69.3381,560.079)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M0.834,-0.375L0.834,-0.791L0.166,-0.791L0.166,-0.375L0.834,-0.375ZM0.584,-0.25L0.584,-0.291L0.416,-0.291L0.416,-0.25L0.584,-0.25ZM0.916,-0.25L1,-0.25L1,-0.166L0,-0.166L0,-0.25L0.084,-0.25L0.084,-0.875L0.916,-0.875L0.916,-0.25Z\",\n style: {\n fillRule: \"nonzero\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(35.0386,0,0,36.8013,792.965,275.883)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M0.834,-0.375L0.834,-0.791L0.166,-0.791L0.166,-0.375L0.834,-0.375ZM0.584,-0.25L0.584,-0.291L0.416,-0.291L0.416,-0.25L0.584,-0.25ZM0.916,-0.25L1,-0.25L1,-0.166L0,-0.166L0,-0.25L0.084,-0.25L0.084,-0.875L0.916,-0.875L0.916,-0.25Z\",\n style: {\n fillRule: \"nonzero\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(35.0386,0,0,36.8013,29.7411,529.218)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M0.279,-0.369C0.356,-0.4 0.43,-0.416 0.5,-0.416C0.57,-0.416 0.644,-0.401 0.72,-0.37C0.796,-0.34 0.834,-0.299 0.834,-0.25L0.834,-0.166L0.166,-0.166L0.166,-0.25C0.166,-0.299 0.204,-0.339 0.279,-0.369ZM0.617,-0.549C0.585,-0.516 0.546,-0.5 0.5,-0.5C0.454,-0.5 0.415,-0.516 0.383,-0.549C0.35,-0.581 0.334,-0.62 0.334,-0.666C0.334,-0.712 0.35,-0.751 0.383,-0.784C0.415,-0.817 0.454,-0.834 0.5,-0.834C0.546,-0.834 0.585,-0.817 0.617,-0.784C0.65,-0.751 0.666,-0.712 0.666,-0.666C0.666,-0.62 0.65,-0.581 0.617,-0.549Z\",\n style: {\n fillRule: \"nonzero\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,-137.43,-420.642)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M552.85,404.535L552.85,415.278L463.786,466.7L463.786,455.956L552.85,404.535Z\",\n style: {\n fill: \"rgb(0,76,64)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,51.77,-570.266)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M552.85,404.535L552.85,415.278L463.786,466.7L463.786,455.956L552.85,404.535Z\",\n style: {\n fill: \"rgb(255,111,0)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,181.468,-491.618)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M552.85,404.535L552.85,415.278L463.786,466.7L463.786,455.956L552.85,404.535Z\",\n style: {\n fill: \"rgb(51,105,30)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,-407.531,-256.447)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M552.629,404.407L552.629,415.151L463.786,466.7L463.786,455.956L552.629,404.407Z\",\n style: {\n fill: \"rgb(74,0,114)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,-137.43,-420.642)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M463.786,466.7L374.722,415.278L374.722,404.535L463.786,455.956L463.786,466.7Z\",\n style: {\n fill: \"rgb(72,169,153)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,80.5414,-552.819)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M444.835,455.758L374.722,415.278L374.722,404.535L444.835,445.015L444.835,455.758Z\",\n style: {\n fill: \"rgb(255,213,79)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,210.076,-474.072)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M444.835,455.758L374.722,415.278L374.722,404.535L444.835,445.015L444.835,455.758Z\",\n style: {\n fill: \"rgb(174,213,129)\"\n }\n })), /*#__PURE__*/React.createElement(\"g\", {\n transform: \"matrix(1.51821,0,0,1.59459,-407.531,-256.447)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M463.786,466.7L374.501,415.151L374.501,404.407L463.786,455.956L463.786,466.7Z\",\n style: {\n fill: \"rgb(174,82,212)\"\n }\n })))));\n}\n\nconst ForwardRef = /*#__PURE__*/React.forwardRef(SvgAbout);\nexport default __webpack_public_path__ + \"static/media/about.a4d06242.svg\";\nexport { ForwardRef as ReactComponent };","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { TextField } from '@material-ui/core'\nimport { isNil, isEmpty } from 'lodash'\nimport YAML from 'yaml'\n\n/**\n * Form used for editing a YAML or JSON config.\n */\nconst InputConfig = React.memo(({data, format, maxRows, minRows, onChange, error, onError, readOnly}) => {\n const controlledError = useRef(error !== undefined)\n const [serialized, setSerialized] = useState()\n const [errorInternal, setErrorInternal] = useState()\n const errorFinal = error || errorInternal\n const formatLib = {\n 'JSON': JSON,\n 'YAML': YAML\n }[format]\n\n useEffect(() => {\n setSerialized(isEmpty(data)\n ? ''\n : formatLib.stringify(\n data,\n (k, v) => { return v === Infinity ? \"Infinity\" : v },\n 2)\n )\n }, [data, formatLib])\n\n const handleError = useCallback((e) => {\n if (!controlledError.current) {\n setErrorInternal(e)\n onError && onError(e)\n } else {\n if (!isNil(e)) onError && onError(e)\n }\n }, [onError])\n\n const handleChange = useCallback((event) => {\n const value = event.target.value\n setSerialized(value)\n try {\n const data = formatLib.parse(value)\n onChange && onChange(data)\n handleError(null)\n } catch (e) {\n handleError(`This is not ${format}: ` + e)\n }\n }, [onChange, handleError, formatLib, format])\n\n return (\n \n )\n})\nInputConfig.propTypes = {\n data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n format: PropTypes.oneOf(['JSON', 'YAML']),\n maxRows: PropTypes.number,\n minRows: PropTypes.number,\n onChange: PropTypes.func,\n error: PropTypes.string,\n onError: PropTypes.func,\n readOnly: PropTypes.bool\n}\n\nInputConfig.defaultProps = {\n format: 'JSON',\n maxRows: 20\n}\n\nexport default InputConfig\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useLayoutEffect, useRef, useCallback, useEffect, useState, useMemo } from 'react'\nimport { ReactComponent as AboutSvg } from '../images/about.svg'\nimport PropTypes from 'prop-types'\nimport Markdown from './Markdown'\nimport { isNil } from 'lodash'\nimport { appBase, debug, encyclopediaBase, parserMetadata, toolkitMetadata as tutorials } from '../config'\nimport {\n Button,\n Card,\n CardContent,\n Dialog,\n DialogTitle,\n DialogContent,\n DialogActions,\n Grid,\n Link,\n makeStyles,\n Typography\n} from '@material-ui/core'\nimport { Link as RouterLink, useHistory } from 'react-router-dom'\nimport InputConfig from './search/input/InputConfig'\nimport { useInfo } from './api'\nimport { pluralize } from '../utils'\n\n/**\n * Displays an info dialog.\n */\nfunction InfoDialog({title, data, DialogProps, onClose}) {\n if (!data) return null\n\n return \n {title}\n \n \n \n \n \n \n \n}\nInfoDialog.propTypes = {\n title: PropTypes.string,\n data: PropTypes.object,\n DialogProps: PropTypes.object,\n onClose: PropTypes.func\n}\n\n/**\n * Displays a list of information about the version, plugin package and plugin\n * entry points.\n */\nexport const DistributionInfo = React.memo(({data}) => {\n const [selected, setSelected] = useState()\n const [title, setTitle] = useState()\n\n const categories = useMemo(() => {\n if (!data) return {}\n\n const categories = {}\n data.plugin_entry_points\n .forEach((entryPoint) => {\n let category = entryPoint.entry_point_type || entryPoint.plugin_type\n // TODO: Schema plugins are recategorized as package plugins. This can be\n // removed once all plugins have been migrated and we remove the old plugin\n // models.\n if (category === 'schema') {\n category = 'schema_package'\n }\n category = category.replace('_', ' ')\n if (categories[category]) {\n categories[category].push(entryPoint)\n } else {\n categories[category] = [entryPoint]\n }\n })\n\n Object.keys(categories).forEach(category => {\n categories[category] = categories[category].sort((a, b) => {\n const nameA = a.name\n const nameB = b.name\n return (nameA > nameB) ? 1 : -1\n })\n })\n\n return categories\n }, [data])\n\n return data\n ?
    \n
  • version: {data.version}
  • \n {data?.plugin_packages?.length\n ?
  • {\"plugin packages: \"}\n {data.plugin_packages.map((pluginPackage, i) => <>\n {\n setSelected(pluginPackage)\n setTitle('Plugin package')\n }}>{pluginPackage.name}\n {i !== data.plugin_packages.length - 1 ? \", \" : null}\n )}\n
  • \n : null\n }\n {Object.keys(categories)\n .sort()\n .map((category) => {\n const entryPoints = categories[category]\n return
  • \n {`${pluralize(category, 2)}: `}\n {entryPoints\n .sort((a, b) => (a.id > b.id) ? 1 : ((b.id > a.id) ? -1 : 0))\n .map((entryPoint, i) => <>\n {\n setSelected(entryPoint)\n setTitle('Plugin entry point')\n }}>{entryPoint.id}\n {i !== entryPoints.length - 1 ? \", \" : null}\n )}\n
  • \n })}\n setSelected(null)} />\n
\n : 'Loading...'\n})\n\nDistributionInfo.propTypes = {\n data: PropTypes.object\n}\n\nfunction CodeInfo({code, ...props}) {\n if (!code) {\n return null\n }\n\n const metadata = parserMetadata[code]\n\n let introduction = `\n For [${metadata.codeLabel || code}](${metadata.codeUrl}) please provide\n all input and output files and any other relevant files you may have produced.\n `\n if (metadata.tableOfFiles && metadata.tableOfFiles !== '') {\n introduction = `\n For [${metadata.codeLabel || code}](${metadata.codeUrl}) please provide at least\n the files from the following table (if applicable). We recommend to upload\n all input and output files and any other relevant files you may have produced.\n `\n }\n\n return \n {metadata.codeLabel || code}\n \n {`\n ${introduction} All files located in the same directory as a *mainfile* (i.e. a parseable\n file which defines an entry) are considered to be associated with the entry.\n You should therefore put all files related to the same entry in the same directory.\n However, try to avoid putting multiple *mainfiles* in the same directory, to avoid\n confusion. For CMS calculations, we recommend a separate directory for each code run.\n\n ${metadata.tableOfFiles}\n\n ${(metadata.parserSpecific && metadata.parserSpecific !== '' &&\n `Please note specifically for ${metadata.codeLabel || code}: ${metadata.parserSpecific}`) || ''}\n\n You can find further information on [the project page for NOMAD's ${metadata.codeLabel || code} parser](${metadata.parserGitUrl}).\n `}\n \n \n \n \n \n}\nCodeInfo.propTypes = {\n code: PropTypes.string,\n onClose: PropTypes.func\n}\n\nexport const CodeList = React.memo(({withUploadInstructions}) => {\n const [selected, setSelected] = useState(null)\n\n // Create lists containing code name and category\n const categorySizes = {}\n const codes = Object.entries(parserMetadata)\n .filter(([code, metadata]) => metadata && code !== 'example')\n .map(([code, metadata], index) => {\n const name = metadata.codeLabel || code\n const category = metadata.codeCategory\n if (categorySizes[category]) {\n categorySizes[category] += 1\n } else {\n categorySizes[category] = 1\n }\n\n if (withUploadInstructions) {\n return [code, category, setSelected(code)}>{name}]\n } else if (metadata.codeUrl) {\n return [code, category, {name}]\n } else {\n return [code, category, name]\n }\n })\n\n // Sort by category size, then by program name. Codes without category go to\n // the end.\n codes.sort((a, b) => {\n const nameA = a[0]\n const nameB = b[0]\n const categoryA = a[1]\n const categoryB = b[1]\n const sizeA = categorySizes[categoryA]\n const sizeB = categorySizes[categoryB]\n if (isNil(categoryA) && !isNil(categoryB)) return 1\n if (isNil(categoryB) && !isNil(categoryA)) return -1\n if (sizeA > sizeB) return -1\n if (sizeA < sizeB) return 1\n if (nameA > nameB) return 1\n if (nameA < nameB) return -1\n return 0\n })\n\n // Create a renderable version\n let currentCategory = null\n let categoryIndex = 0\n const codeshtml = codes.reduce((list, value) => {\n let index = -1\n const categoryTmp = value[1]\n const html = value[2]\n const category = categoryTmp ? pluralize(categoryTmp) : 'Miscellaneous'\n\n if (currentCategory !== category) {\n index = 0\n if (categoryIndex !== 0) {\n list.push(', ')\n }\n list.push( {category}: )\n categoryIndex += 1\n currentCategory = category\n }\n\n if (html) {\n if (index !== 0) {\n list.push(', ')\n }\n list.push(html)\n }\n return list\n }, [])\n\n return \n {codeshtml.map((html, index) => {html})}\n setSelected(null)} />\n \n})\nCodeList.propTypes = {\n withUploadInstructions: PropTypes.bool\n}\n\nconst useCardStyles = makeStyles(theme => ({\n title: {\n marginBottom: theme.spacing(1)\n }\n}))\n\nfunction InfoCard({title, children, xs, top, bottom}) {\n const classes = useCardStyles()\n const style = {}\n if (top) {\n style['paddingBottom'] = 0\n }\n if (bottom) {\n style['paddingTop'] = 0\n }\n return \n \n \n {title}\n {children}\n \n \n \n}\nInfoCard.propTypes = {\n title: PropTypes.string.isRequired,\n children: PropTypes.node,\n xs: PropTypes.number,\n top: PropTypes.bool,\n bottom: PropTypes.bool\n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3)\n },\n container: {\n maxWidth: 1024,\n margin: 'auto',\n width: '100%'\n },\n header: {\n margin: '24px 0px'\n }\n}))\n\nexport default function About() {\n const classes = useStyles()\n const info = useInfo()\n const svg = useRef()\n const history = useHistory()\n\n const makeClickable = useCallback((id, onClick) => {\n const element = svg.current.querySelector('#' + id)\n element.style.cursor = 'pointer'\n element.firstChild.onclick = () => {\n onClick()\n }\n }, [svg])\n\n const setText = useCallback((id, lines) => {\n const element = svg.current.querySelector('#' + id)\n const x = element.getAttribute('x')\n element.innerHTML = lines.map((line, i) => `${line}`).join('')\n }, [svg])\n\n useLayoutEffect(() => {\n makeClickable('upload', () => {\n history.push('/upload')\n })\n if (encyclopediaBase) {\n makeClickable('encyclopedia', () => {\n window.location.href = encyclopediaBase\n })\n }\n makeClickable('search', () => {\n history.push('/search')\n })\n }, [svg, makeClickable, setText, history])\n\n useEffect(() => {\n const statistics = (info && {...info.statistics}) || {}\n statistics.n_tutorials = tutorials?.tutorials?.length || 25\n const value = (key, unit) => {\n const nominal = statistics[key]\n let stringValue = null\n if (nominal) {\n if (nominal >= 1.0e+9) {\n stringValue = (nominal / 1.0e+9).toFixed(1) + ' billion'\n } else if (nominal >= 1.0e+6) {\n stringValue = (nominal / 1.0e+6).toFixed(1) + ' million'\n } else if (nominal >= 1.0e+3) {\n stringValue = (nominal / 1.0e+3).toFixed(1) + ' thousand'\n } else {\n stringValue = nominal.toString()\n }\n return `${stringValue || '...'} ${unit}`\n } else {\n return '...'\n }\n }\n setText('repositoryStats', [\n value('n_entries', 'entries')\n // value('n_uploads', 'uploads')\n ])\n setText('archiveStats', [\n value('n_calculations', 'results'),\n value('n_quantities', 'quantities')\n ])\n setText('encStats', [\n value('n_materials', 'materials')\n ])\n setText('toolkitStats', [\n `${statistics.n_tutorials} notebooks`\n ])\n }, [svg, info, setText])\n\n return
\n \n \n {`\n # **NOMAD** – Manage and Publish Materials Data\n\n This is the *graphical user interface* (GUI) of NOMAD. It allows you to **search,\n access, and download all NOMAD data** in its\n *raw files* and *processed data* form. You can **upload and manage your own\n raw materials science data**. You can access all published data without an account.\n If you want to provide your own data, please login or register for an account.\n\n You can learn more about NOMAD on its\n [homepage](https://nomad-lab.eu/repo-arch), our\n [documentation](${appBase}/docs/index.html).\n There is also an [FAQ](https://nomad-lab.eu/repository-archive-faqs)\n and the more detailed [uploader documentation](${appBase}/docs/web.html).\n `}\n \n \n NOMAD extracts rich metadata from uploaded raw-data. \n Explore NOMAD's data by creating complex queries from interactive data visualizations of key\n properties, including the simulated composition/system, used method, upload metadata,\n as well as material classifications and available quantities. Or use\n the Optimade filter language to add arbitrarily nested queries.\n \n \n NOMAD provides data in processed and normalized form in a machine processable and common hierarchical format.\n This processed data, i.e. the NOMAD Archive, is organized into nested sections of quantities with well defined units,\n data types, shapes, and descriptions. These definitions are called the NOMAD Metainfo and they\n can be browsed here.\n \n \n \n \n \n

\n You provide your own data as is. Just zip your files as they are,\n including nested directory structures and potential auxiliary files, and upload\n up to 32GB in a single .zip or .tar(.gz) file. NOMAD will automatically discover\n and process the relevant files.\n

\n

\n You can privately inspect, curate, or delete your data before publishing.\n Data can be published with an embargo (up to 3 years) to only share data with\n selected users.\n

\n

\n Add additional metadata like comments, references to websites or papers, and\n your co-authors. Organize the uploaded entries into datasets and\n cite your data with a DOI that we provide on request.\n

\n

\n You can provide via GUI or shell command or manage already uploaded\n data here.\n

\n
\n \n

\n Uploaded data is automatically processed and made available\n in the uploaded raw files or in its unified processed data form.\n NOMAD parsers convert raw files into NOMAD's common data format.\n You can inspect the processed data and extracted metadata before\n publishing your data.\n

\n

NOMAD supports most community codes and file formats:

\n

\n To use NOMAD's parsers and normalizers outside of NOMAD read here.\n Read here on how to install\n our software and how to use NOMAD processing in your Python environment.\n

\n
\n {`\n The NOMAD can also be accessed programmatically via ReST APIs.\n There is the proprietary NOMAD API,an implementation of the\n standardized [OPTiMaDe API](https://github.com/Materials-Consortia/OPTiMaDe/tree/master)\n materials science database API, and more.\n\n We offer a [tutorial on how to use the API with plain Python](${appBase}/docs/api.html).\n Another [tutorial covers how to install and use NOMAD's Python client library](${appBase}/docs/archive.html).\n The [NOMAD Analytics Toolkit](https://nomad-lab.eu/AIToolkit) allows to use\n this without installation and directly on NOMAD servers.\n\n Visit our [API page](/analyze/apis).\n `}\n \n {`\n ### Getting Help\n If you encounter any difficulties, please write to\n support@nomad-lab.eu . If you think\n that this web-page is not working as expected, or if you want to start a discussion\n about possible features, feel free to open an issue on our\n [github project](https://github.com/nomad-coe/nomad/issues).\n\n ### Developer Documentation\n The [in-depth documentation](${appBase}/docs/index.html)\n contains a general introduction to NOMAD and its underlying architecture,\n more information and tutorials, how to prepare uploads, how\n to use the API, developer information, how to operate your own NOMAD (a so called\n Oasis), how to contribute parsers, and much more.\n\n ### Source code\n The source-code for NOMAD is maintained\n at the MPCDF's [gitlab](https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR).\n To push code, you need an MPCDF account and you can apply\n [here](https://www.mpcdf.mpg.de/userspace/new-users).\n\n ${debug ? `\n ### Material science data and domains\n Originally NOMAD was build for DFT calculations and data from the respective\n community codes. But NOMAD is now extended to support multiple materials science domains,\n such as experiments, synthesis, and computational methods at different scales.` : ''}\n\n ${debug ? `\n ### Log management with Elastic stack\n We use a central logging system based on the *elastic*-stack\n (previously called *Elastic Logstash Kibana* (ELK)-stack).\n This system pushes logs, events, monitoring data,\n and other application metrics to a central database where it\n can be analysed visually by us.\n\n ### Test user\n During development this GUI might not be connected to the actual NOMAD\n repository. Therefore, you cannot create a user or login with an existing\n user. You might use the test user \\`leonard.hofstadter@nomad-fairdi.tests.de\\`\n with password \\`password\\`. The user \\`sheldon.cooper@nomad-fairdi.tests.de\\` is\n used for data that has no provenance with the original NOMAD CoE database.\n ` : ''}\n `}\n \n \n About this distribution\n \n \n
\n
\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport Alert from '@material-ui/lab/Alert'\nimport { hasWebGLSupport } from '../utils'\n\nexport class ErrorHandler extends React.Component {\n state = {\n hasError: false\n }\n\n static getDerivedStateFromError(error) {\n return {\n hasError: true,\n error: error\n }\n }\n\n componentDidCatch(error, errorInfo) {\n console.log(error, errorInfo)\n }\n\n render() {\n if (this.state.hasError) {\n const msg = typeof this.props.message === 'string' ? this.props.message : this.props.message(this.state.error)\n return \n {msg}\n \n }\n return this.props.children\n }\n}\nErrorHandler.propTypes = ({\n children: PropTypes.node,\n message: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), // Provide either a fixed error message or a callback that will receive the error details.\n classes: PropTypes.object,\n className: PropTypes.string\n})\n\nexport const withErrorHandler = (message) => (WrappedComponent) => props => {\n return \n \n \n}\nwithErrorHandler.propTypes = ({\n message: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) // Provide either a fixed error message or a callback that will receive the error details.\n})\n\nexport const webGlError = 'Could not display the visualization as your browser does not support WebGL content.'\nexport const withWebGLErrorHandler = WrappedComponent => props => {\n const hasWebGL = useState(hasWebGLSupport())[0]\n\n // If WebGL is not available, the content cannot be shown.\n if (hasWebGL) {\n return WrappedComponent({...props})\n } else {\n return \n {webGlError}\n \n }\n}\n\nwithErrorHandler.propTypes = ({\n message: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) // Provide either a fixed error message or a callback that will receive the error details.\n})\n","import React, { useEffect, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { appBase } from '../../config'\nimport { H5GroveProvider, App } from '@h5web/app'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport axios from 'axios'\n\nimport '@h5web/lib/dist/styles.css'\nimport '@h5web/app/dist/styles.css'\nimport './H5Web.css'\n\nconst H5Web = ({upload_id, filename, initialPath, sidebarOpen, source}) => {\n const {api} = useApi()\n const {raiseError} = useErrors()\n const [filepath, setFilepath] = useState(false)\n\n if (!source) source = 'raw'\n\n useEffect(() => {\n if (filename && upload_id) {\n if (filename.includes('.yaml') || filename.includes('.yml')) {\n api.get(`/uploads/${upload_id}/raw/${filename}`)\n .then(data => {\n const fname = data.match(/output:[ \\t]*(.*nxs)/i)?.[1]\n setFilepath(fname)\n })\n .catch(raiseError)\n } else {\n setFilepath(filename)\n }\n }\n }, [filepath, api, filename, upload_id, raiseError])\n\n if (filepath) {\n return (\n async () => {\n const response = await axios.get(appBase + '/h5grove/data/', {\n params: {\n file: filepath, upload_id: upload_id, format, path: dataset.path, source: source\n },\n headers: {Authorization: \"Bearer \" + api?.keycloak?.token}\n })\n return new File([response.data], \"test.\" + format)\n }}\n axiosConfig={{params: {file: filepath, upload_id: upload_id, source: source}, headers: {Authorization: \"Bearer \" + api?.keycloak?.token}}}\n >\n \n\n \n )\n }\n return 'Loading...'\n}\nH5Web.propTypes = {\n upload_id: PropTypes.string.isRequired,\n filename: PropTypes.string.isRequired,\n initialPath: PropTypes.string.isRequired,\n sidebarOpen: PropTypes.bool,\n source: PropTypes.string\n}\n\nexport default H5Web\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles, Card, CardContent, Box, Typography, Grid, Chip, Tooltip, IconButton } from '@material-ui/core'\nimport grey from '@material-ui/core/colors/grey'\nimport classNames from 'classnames'\nimport { useLocation, useRouteMatch, Link } from 'react-router-dom'\nimport { ErrorHandler } from '../ErrorHandler'\nimport { useDataStore } from '../DataStore'\nimport { useApi } from '../api'\nimport NavigateIcon from '@material-ui/icons/ArrowRight'\nimport H5Web from '../visualization/H5Web'\nimport {CopyToClipboard} from \"react-copy-to-clipboard\"\nimport ClipboardIcon from \"@material-ui/icons/Assignment\"\n\nfunction escapeBadPathChars(s) {\n return s.replace(/!/g, '!0').replace(/\\?/g, '!1').replace(/#/g, '!2').replace(/%/g, '!3').replace(/\\\\/g, '!4')\n}\n\nfunction unescapeBadPathChars(s) {\n return s.replace(/!4/g, '\\\\').replace(/!3/g, '%').replace(/!2/g, '#').replace(/!1/g, '?').replace(/!0/g, '!')\n}\n\n/**\n * Browsers are made out of lanes. Each lane uses an adaptor that determines how to render\n * the lane contents and what adaptor is used for the next lane (depending on what is\n * selected in this lane).\n */\nexport class Adaptor {\n constructor() {\n if (new.target === Adaptor) {\n throw new TypeError('Cannot construct Abstract instances directly')\n }\n }\n\n /**\n * A potentially asynchronous method called to initialize an adaptor, before any\n * calls are made to the itemAdaptor or render methods.\n */\n initialize(api, dataStore) {\n }\n\n /**\n * A potentially asynchronous method called when the adaptor is cleaned up due to user navigation\n */\n cleanup() {\n }\n\n /**\n * Optional additional methods:\n * onScrollToEnd: called when the user scrolls to the bottom of the lane. Useful to load more info.\n * onRendered: called in a useEffect after the adaptor has been rendered.\n */\n\n /**\n * A potentially asynchronous method that is used to determine the adaptor for the\n * next lane depending on the given key/url segment.\n * @returns An adaptor that is used to render the next lane.\n */\n itemAdaptor(key) {\n return null\n }\n\n /**\n * Optionally returns a set of strings defining this lanes dependencies. These dependencies\n * are used to determine if an adaptor is to be invalidated when calling invalidateLanesWithDependency\n */\n depends() {\n return null\n }\n\n /**\n * Renders the contents of the current lane (the lane that this adaptor represents).\n */\n render() {\n return null\n }\n}\n\nexport const browserContext = React.createContext()\n\nconst useBrowserStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n flexFlow: 'column',\n margin: `-${theme.spacing(2)}px`,\n marginBottom: `-${theme.spacing(3)}px`\n },\n lanesContainer: {\n flex: '1 1 auto',\n height: '100%',\n overflowX: 'auto',\n overflowY: 'hidden',\n scrollBehavior: 'smooth'\n },\n lanes: {\n display: 'flex',\n overflow: 'hidden',\n height: '100%',\n overflowY: 'hidden',\n width: 'fit-content'\n },\n sideLane: {\n display: 'flex',\n height: '100%'\n }\n}))\nexport const Browser = React.memo(function Browser({adaptor, form}) {\n const classes = useBrowserStyles()\n const dataStore = useDataStore()\n const rootRef = useRef()\n const outerRef = useRef()\n const innerRef = useRef()\n const { pathname } = useLocation()\n const { url } = useRouteMatch()\n\n const { api } = useApi()\n\n const [hdf5Path, setHdf5Path] = useState(null)\n const [hdf5Filename, setHdf5Filename] = useState(null)\n\n const checkHdf5Path = (m_nx_data_path) => {\n if (typeof m_nx_data_path !== 'undefined') {\n setHdf5Path(m_nx_data_path)\n } else {\n setHdf5Path(null)\n }\n }\n\n const checkHdf5File = (m_nx_data_file) => {\n if (typeof m_nx_data_file !== 'undefined') {\n setHdf5Filename(m_nx_data_file)\n }\n }\n\n useLayoutEffect(() => {\n function update() {\n const height = window.innerHeight - outerRef.current.getBoundingClientRect().top - 24\n rootRef.current.style.height = `${height}px`\n const scrollAmmount = innerRef.current.clientWidth - outerRef.current.clientWidth\n outerRef.current.scrollLeft = Math.max(scrollAmmount, 0)\n }\n if (url !== undefined) {\n update()\n window.addEventListener('resize', update)\n return () => window.removeEventListener('resize', update)\n }\n })\n\n const [, setInternalRender] = useState(0)\n const internalUpdate = useCallback(() => {\n setInternalRender(current => current + 1)\n }, [setInternalRender])\n const lanes = useRef([])\n const computingForUrl = useRef(null)\n const computeLanes = useCallback(async () => {\n if (!url || computingForUrl.current === url) {\n // We have no url (happens if we navigate to a different tab), or we're already in the\n // midst of computing lanes for this url\n return\n }\n computingForUrl.current = url\n const rootPath = url.endsWith('/') ? url.substring(0, url.length - 1) : url\n const path = pathname?.replace(/\\/(-?\\d*)(\\/|$)/g, \":$1/\").replace(/\\/$/, \"\")\n const segments = ['root'].concat(path.substring(url.length).split('/').filter(segment => segment))\n const oldLanes = lanes.current\n const newLanes = []\n\n for (let index = 0; index < segments.length; index++) {\n const segment = unescapeBadPathChars(segments[index])\n const prev = index === 0 ? null : newLanes[index - 1]\n let lane\n let newLaneCreated = false\n\n if (oldLanes[index]?.key === segment && !newLaneCreated) {\n // reuse the existing lane (incl. its adaptor and data)\n lane = oldLanes[index]\n lane.next = null\n } else {\n // create new lane\n lane = {\n index: index,\n key: segment,\n path: prev ? prev.path + '/' + encodeURI(escapeBadPathChars(segment)) : rootPath,\n next: null,\n prev: prev,\n initialized: false\n }\n if (!newLaneCreated) {\n // First newly created lane. Cleanup all adaptors that are being discarded\n oldLanes.slice(index).forEach(oldLane => oldLane.adaptor?.cleanup())\n }\n newLaneCreated = true\n\n if (typeof adaptor?.obj?.metadata?.mainfile !== 'undefined') {\n setHdf5Filename(adaptor?.obj?.metadata?.mainfile)\n }\n\n // Set or create the lane adaptor\n if (!prev) {\n // The root lane - use provided adaptor\n lane.adaptor = adaptor\n } else {\n // Non-root lane - create adaptor\n try {\n lane.adaptor = await prev.adaptor.itemAdaptor(segment)\n checkHdf5Path(lane.adaptor?.obj?.m_attributes?.m_nx_data_path)\n checkHdf5File(lane.adaptor?.obj?.m_attributes?.m_nx_data_file)\n } catch (error) {\n console.log(error)\n lane.error = `The item \"${segment}\" could not be found.`\n }\n }\n\n // initialize the adaptor\n if (lane.adaptor) {\n try {\n await lane.adaptor.initialize(api, dataStore)\n lane.initialized = true\n } catch (error) {\n console.log(error)\n lane.error = 'Could not initialize view' + (lane.index > 0 ? `: item \"${segment}\" not found.` : '.')\n }\n }\n }\n\n if (prev) {\n prev.next = lane\n checkHdf5Path(lane.adaptor?.obj?.m_attributes?.m_nx_data_path)\n checkHdf5File(lane.adaptor?.obj?.m_attributes?.m_nx_data_file)\n }\n newLanes.push(lane)\n if (lane.error) {\n break // Ignore subsequent segments/lanes\n }\n }\n lanes.current = newLanes\n computingForUrl.current = null\n internalUpdate()\n }, [adaptor, api, dataStore, internalUpdate, url, pathname])\n\n // Method used to invalidate and refresh lanes from the provided lane index and forward.\n const invalidateLanesFromIndex = useCallback((index) => {\n index = index || 0\n const droppedLanes = lanes.current.splice(index)\n droppedLanes.forEach(droppedLane => droppedLane.adaptor?.cleanup())\n computeLanes()\n }, [computeLanes])\n\n // Method used to invalidate all lanes that have a certain dependency. The first lane which\n // has this dependency, and all subsequent lanes, are invalidated.\n const invalidateLanesWithDependency = useCallback((dependency) => {\n for (const lane of lanes.current) {\n const dependencies = lane.adaptor && lane.adaptor.depends()\n if (dependencies && dependencies.has(dependency)) {\n invalidateLanesFromIndex(lane.index)\n return\n }\n }\n }, [invalidateLanesFromIndex])\n\n useEffect(() => {\n return () => {\n // Cleanup method, will run when the root adaptor changes or the Browser component is dismounted\n // We should then cleanup all existing adaptors and not reuse any lanes.\n lanes.current.forEach(lane => lane.adaptor?.cleanup())\n lanes.current = []\n }\n }, [adaptor])\n\n useEffect(() => {\n computeLanes()\n }, [computeLanes])\n\n const contextValue = useMemo(() => {\n return {\n lanes,\n invalidateLanesFromIndex,\n invalidateLanesWithDependency\n }\n }, [lanes, invalidateLanesFromIndex, invalidateLanesWithDependency])\n\n if (url === undefined) {\n // Can happen when navigating to another tab, possibly with the browser's back/forward buttons\n // We want to keep the cached lanes, in case the user goes back to this tab, so return immediately.\n return null\n }\n\n return \n {form}\n \n \n \n \n
\n
\n
\n {lanes.current && lanes.current.map((lane, index) => (\n \n ))}\n
\n
\n
\n
\n
\n
\n {hdf5Path && hdf5Filename && adaptor?.obj?.metadata?.upload_id && \n \n {/* We use the key prop in the H5Web component here to force re-render on path changes while browsing with the browser. The prop, initialPath, does not re-render the component. */}\n \n \n }\n
\n
\n})\nBrowser.propTypes = ({\n adaptor: PropTypes.object.isRequired,\n form: PropTypes.node\n})\nexport default Browser\n\nexport const laneContext = React.createContext()\n\nexport const useLane = () => {\n return useContext(laneContext)\n}\n\nexport const laneErrorBoundryMessage = 'This section could not be rendered, due to an unexpected error'\n\nconst useLaneStyles = makeStyles(theme => ({\n root: {\n width: 'min-content',\n borderRight: `solid 1px ${grey[500]}`,\n display: 'inline-block'\n },\n container: {\n display: 'inline-block',\n height: '100%',\n overflowX: 'clip',\n overflowY: 'scroll'\n },\n error: {\n margin: theme.spacing(1),\n minWidth: 300\n }\n}))\nfunction Lane({lane}) {\n const classes = useLaneStyles()\n const containerRef = useRef(null)\n const { key, adaptor, next, initialized, error } = lane\n const oldScrollValue = useRef(0)\n lane.containerRef = containerRef\n const [internalUpdate, setInternalRender] = useState(0)\n const updateLane = useCallback(() => {\n setInternalRender(current => current + 1)\n }, [setInternalRender])\n\n const handleScroll = useCallback((e) => {\n if (adaptor.onScrollToEnd) {\n const threshold = (e.target.scrollHeight - e.target.clientHeight) * 95 / 100\n if (e.target.scrollTop >= threshold && oldScrollValue.current < threshold) {\n adaptor.onScrollToEnd(e, updateLane)\n }\n oldScrollValue.current = e.target.scrollTop\n }\n }, [adaptor, updateLane])\n\n const content = useMemo(() => {\n if (error) {\n return
\n ERROR\n {error}\n
\n }\n if (!adaptor || !initialized) {\n return null\n }\n return
\n
\n \n \n {adaptor.render()}\n \n \n
\n
\n // We deliberetly break the React rules here. The goal is to only update if the\n // lanes contents change and not the lane object.\n // eslint-disable-next-line\n }, [lane, key, adaptor, initialized, next?.key, classes, error, internalUpdate])\n\n useEffect(() => {\n if (adaptor && initialized && containerRef.current && adaptor.onRendered) {\n adaptor.onRendered({target: containerRef.current}, updateLane)\n }\n // eslint-disable-next-line\n }, [key, adaptor, internalUpdate, updateLane])\n\n return content\n}\nLane.propTypes = ({\n lane: PropTypes.object.isRequired\n})\n\nconst useItemStyles = makeStyles(theme => ({\n root: {\n color: theme.palette.text.primary,\n textDecoration: 'none',\n margin: `0 -${theme.spacing(1)}px`,\n padding: `0 0 0 ${theme.spacing(1)}px`,\n whiteSpace: 'nowrap',\n display: 'flex',\n '& $icon': {\n color: theme.palette.grey[700]\n }\n },\n rootSelected: {\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.primary.contrastText,\n whiteSpace: 'nowrap',\n '& $icon': {\n color: theme.palette.primary.contrastText\n }\n },\n rootUnSelected: {\n '&:hover': {\n backgroundColor: grey[300]\n }\n },\n rootUnSelectedHighlighted: {\n color: theme.palette.primary.main,\n '& $icon': {\n color: theme.palette.primary.main\n },\n '&:hover': {\n backgroundColor: grey[300]\n }\n },\n disabled: {\n color: 'grey'\n },\n rightPaddedItem: {\n padding: `0 ${theme.spacing(1)}px 0 0`\n },\n childContainer: {\n flexGrow: 1,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n },\n icon: {\n fontSize: 16,\n marginTop: 4\n }\n}))\n\nconst ItemLink = React.forwardRef(function ItemLink({itemKey, ...props}, ref) {\n const lane = useContext(laneContext)\n if (lane && itemKey) {\n return \n } else {\n // If this is used in a non Browser context\n return \n }\n})\nItemLink.propTypes = {\n itemKey: PropTypes.string.isRequired\n}\n\nexport function ItemButton({itemKey, itemLink, icon, ...props}) {\n // ItemButtons are often used in clickable context and we should stop the propagation\n // of click events to prevent unwanted behavior.\n const handleClick = useCallback((event) => {\n event.stopPropagation()\n }, [])\n return (\n \n {icon || }\n \n )\n}\nItemButton.propTypes = {\n itemKey: PropTypes.string.isRequired,\n itemLink: PropTypes.element,\n icon: PropTypes.node\n}\n\nexport function Item({children, itemKey, length, disabled, highlighted, icon, actions, chip}) {\n const classes = useItemStyles()\n const lane = useLane()\n let selected = lane?.next && lane?.next.key\n let [label, index] = selected ? selected.split(':') : []\n if (index && length) {\n index = parseInt(index)\n if (index < 0) index = index + length\n selected = `${label}:${index}`\n }\n const isSelected = itemKey && (selected === itemKey || selected?.replace(':', '/') === itemKey)\n if (disabled) {\n return \n {icon && \n {React.createElement(icon, {fontSize: 'small', className: classes.icon})}\n }\n \n {children}\n \n {actions && \n {actions}\n }\n \n }\n\n return \n \n {icon && \n {React.createElement(icon, {fontSize: 'small', className: classes.icon})}\n }\n \n {children}\n \n {chip && (\n \n \n \n )}\n {actions && \n {actions}\n }\n {itemKey && \n \n }\n \n \n}\nItem.propTypes = ({\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]).isRequired,\n itemKey: PropTypes.string,\n length: PropTypes.number,\n disabled: PropTypes.bool,\n highlighted: PropTypes.bool,\n icon: PropTypes.elementType,\n chip: PropTypes.string,\n actions: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]),\n open: PropTypes.bool,\n onClick: PropTypes.func\n})\n\nexport function Content(props) {\n return \n}\n\nexport function Compartment({title, children, color, startCollapsed, onUnfold}) {\n const [collapsed, setCollapsed] = useState(startCollapsed)\n const handleClick = useCallback(() => {\n setCollapsed(value => !value)\n onUnfold && onUnfold()\n }, [setCollapsed, onUnfold])\n if (!React.Children.count(children)) {\n return null\n }\n\n return \n \n {title && {title}}\n {collapsed && }\n \n {(!collapsed) && children}\n \n}\nCompartment.propTypes = ({\n title: PropTypes.string,\n color: PropTypes.string,\n startCollapsed: PropTypes.bool,\n onUnfold: PropTypes.func,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]).isRequired\n})\n\nconst useTitleStyles = makeStyles(theme => ({\n titleGridItem: {\n flexGrow: 1,\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n },\n sectionLabel: {\n whiteSpace: 'nowrap'\n },\n sectionValue: {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n display: 'flex',\n marginLeft: 3\n },\n sectionName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n flexShrink: 1\n }\n}))\n\nfunction LinkWithCopyToClipboard(props) {\n const classes = useTitleStyles()\n const {label, name, itemKey, ...moreProps} = props\n const lane = useLane()\n const selected = lane?.next && lane?.next.key\n const isSelected = itemKey && (selected === itemKey)\n\n return \n {label && (\n \n {label}\n \n )}\n {name && (\n \n \n {isSelected\n ? \n : \n {name}\n }\n \n null}\n >\n \n \n \n \n \n \n \n )}\n \n}\nLinkWithCopyToClipboard.propTypes = ({\n label: PropTypes.string,\n name: PropTypes.string,\n itemKey: PropTypes.string\n})\n\nexport function Title({title, label, definitionName, subSectionName, tooltip, actions, ...moreProps}) {\n const classes = useTitleStyles()\n return \n \n \n {tooltip ? (\n \n {title || unnamed}\n \n ) : (\n {title || unnamed}\n )}\n \n {actions && (\n \n {actions}\n \n )}\n \n \n {definitionName ? : }\n {subSectionName && }\n \n \n}\nTitle.propTypes = ({\n title: PropTypes.string,\n label: PropTypes.string,\n definitionName: PropTypes.string,\n subSectionName: PropTypes.string,\n tooltip: PropTypes.string,\n actions: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n})\n\nexport function ItemChip(props) {\n return \n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { apiBase } from '../../config'\nimport { makeStyles, Tooltip } from '@material-ui/core'\n\nconst useStyles = makeStyles(theme => ({\n root: {}\n}))\n\nexport const Download = React.memo(function Download(props) {\n const classes = useStyles(props)\n const {url, component, children, disabled, color, size, tooltip} = props\n\n const handleClick = () => {\n window.location.assign(`${apiBase}/v1/${url}`)\n }\n\n const Component = component\n\n const button = (\n \n {children}\n \n )\n\n if (tooltip && !disabled) {\n return {button}\n } else {\n return button\n }\n})\nDownload.propTypes = {\n url: PropTypes.string,\n component: PropTypes.any,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]).isRequired,\n disabled: PropTypes.bool,\n tooltip: PropTypes.string,\n color: PropTypes.string,\n size: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nexport default Download\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { withStyles, IconButton, Tooltip, Link } from '@material-ui/core'\nimport ClipboardIcon from '@material-ui/icons/Assignment'\nimport { CopyToClipboard } from 'react-copy-to-clipboard'\n\nclass DOIUnstyled extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n doi: PropTypes.string.isRequired,\n parentheses: PropTypes.bool\n }\n\n static defaultProps = {\n parentheses: false\n }\n\n static styles = theme => ({\n root: {\n display: 'inline-flex',\n alignItems: 'center',\n flexDirection: 'row',\n flexWrap: 'nowrap'\n }\n })\n\n render() {\n const {classes, doi, parentheses} = this.props\n const url = `https://dx.doi.org/${doi}`\n return \n {parentheses &&
(
}\n {doi}\n null}\n >\n \n \n \n \n \n \n {parentheses &&
)
}\n
\n }\n}\n\nexport const DOI = withStyles(DOIUnstyled.styles)(DOIUnstyled)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo } from 'react'\nimport { isArray } from 'lodash'\nimport { Typography, makeStyles, useTheme } from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\n\n/**\n * Component that is used as a replacement for data that is not available.\n * Notice that this is different from invalid data (this should display an\n * ErrorCard) or from a placeholder!\n */\n\n// These styles do not depend on any props: they can be created once and are\n// shared by each instance.\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%',\n position: 'relative'\n },\n placeholder: {\n width: '100%',\n height: '100%',\n backgroundColor: theme.palette.grey[100],\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n },\n message: {\n color: theme.palette.primary.main,\n fontStyle: 'italic',\n opacity: 0.5,\n userSelect: 'none'\n }\n}))\nexport default function NoData({\n className,\n margin,\n 'data-testid': testID\n}) {\n const styles = useStyles()\n const theme = useTheme()\n const margins = useMemo(() => {\n let marginTop, marginRight, marginBottom, marginLeft\n if (isArray(margin)) {\n marginTop = margin[0]\n marginRight = margin[1]\n marginBottom = margin[2]\n marginLeft = margin[3]\n } else {\n marginTop = margin\n marginRight = margin\n marginBottom = margin\n marginLeft = margin\n }\n return {\n position: 'absolute',\n top: theme.spacing(marginTop),\n left: theme.spacing(marginLeft),\n right: theme.spacing(marginRight),\n bottom: theme.spacing(marginBottom)\n }\n }, [theme, margin])\n\n return
\n
\n
\n no data\n
\n
\n
\n}\n\nNoData.propTypes = {\n className: PropTypes.string,\n /**\n * Margin with respect to the parent in theme spacing units.\n */\n margin: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),\n 'data-testid': PropTypes.string\n}\n\nNoData.defaultProps = {\n margin: [0, 1, 0, 1]\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useMemo, useContext, useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport {\n makeStyles,\n Typography,\n Tooltip,\n IconButton,\n TableBody,\n TableContainer,\n TableHead,\n Table,\n TableRow,\n TableCell,\n Link,\n Box\n} from '@material-ui/core'\nimport { DOI } from './dataset/DOI'\nimport ClipboardIcon from '@material-ui/icons/Assignment'\nimport { CopyToClipboard } from 'react-copy-to-clipboard'\nimport { get, isNil, isString, isNumber } from 'lodash'\nimport { searchQuantities } from '../config'\nimport Placeholder from './visualization/Placeholder'\nimport Ellipsis from './visualization/Ellipsis'\nimport NoData from './visualization/NoData'\nimport {formatNumber, formatTimestamp, authorList, serializeMetainfo, getDisplayLabel} from '../utils'\nimport { Quantity as Q } from './units/Quantity'\nimport { Unit } from './units/Unit'\nimport { useUnitContext } from './units/UnitContext'\nimport { defaultFilterData } from './search/FilterRegistry'\nimport { MaterialLink, RouteLink } from './nav/Routes'\n\n/**\n * Component for showing a metainfo quantity value together with a name and\n * description.\n*/\nconst useQuantityStyles = makeStyles(theme => ({\n root: {\n width: '100%'\n },\n valueContainer: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'row',\n maxWidth: '100%'\n },\n value: {\n flexGrow: 1\n },\n valueAction: {},\n valueActionButton: {\n padding: 4\n },\n valueActionIcon: {\n fontSize: 16\n },\n row: {\n display: 'flex',\n flexWrap: 'wrap',\n flexDirection: 'row',\n '& > :not(:last-child)': {\n marginRight: theme.spacing(3)\n }\n },\n column: {\n display: 'flex',\n flexDirection: 'column',\n '& > :not(:first-child)': {\n marginTop: theme.spacing(1)\n }\n },\n flex: {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignContent: 'flex-start',\n '& div': {\n marginRight: theme.spacing(1)\n }\n },\n label: {\n color: 'rgba(0, 0, 0, 0.54)',\n fontSize: '0.75rem',\n fontWeight: 500\n },\n quantityList: {\n display: 'flex',\n flexDirection: 'column'\n }\n}))\n\nconst Quantity = React.memo((props) => {\n const styles = useQuantityStyles()\n const presets = quantityPresets[props.quantity] || {}\n const {\n quantity,\n label,\n description,\n value,\n loading,\n placeholder,\n typography,\n noWrap,\n noLabel,\n row,\n column,\n flex,\n data,\n withClipboard,\n ellipsisFront,\n hideIfUnavailable,\n maxWidth,\n format\n } = {...presets, ...props}\n\n const getRenderFromType = useCallback((quantity, data) => {\n const type = quantity.type\n const value = data[quantity.name]\n if (type.type_data === 'str') {\n return \n {value}\n \n } else if (typeof value === 'boolean') {\n return \n {value.toString()}\n \n } else if (type.type_data === 'nomad.metainfo.metainfo._Datetime' || type.type_data === 'nomad.metainfo.data_type.Datetime') {\n return \n {formatTimestamp(value)}\n \n } else if (type.type_data === 'nomad.metainfo.metainfo._JSON' || type.type_data === 'nomad.metainfo.data_type.JSON') {\n return \n JSON Formatted Data\n \n }\n return \n {value}\n \n }, [])\n\n // Determine the rendered children. They may have been given explicitly, or\n // this quantity may have a default rendering function for a value, or this\n // quantity may have a default rendering function for data, or the data type\n // may be associated with a particular rendering function.\n const children = props.children ||\n ((presets.render && !isNil(data)) && presets.render(data)) ||\n ((presets.renderValue && !isNil(value)) && presets.renderValue(value)) ||\n ((quantity?.name && !isNil(quantity.type)) && getRenderFromType(quantity, data))\n\n const {units} = useUnitContext()\n let content = null\n let clipboardContent = null\n\n const isQuantityString = isString(quantity)\n const def = isQuantityString\n ? (searchQuantities[quantity])\n : quantity?.name && quantity.type && quantity\n\n // Determine the final label to show\n const useLabel = useMemo(() => {\n let useLabel = label\n if (!useLabel) {\n // Primarily use a lowercase 'pretty' label if one is defined in FilterRegistry\n if (isQuantityString && defaultFilterData?.[quantity]?.label) {\n useLabel = defaultFilterData?.[quantity]?.label\n // Alternatively use the original name in metainfo, underscores replaced by spaces\n } else if (def?.name) {\n useLabel = getDisplayLabel(def)\n } else if (isQuantityString) {\n useLabel = quantity\n } else {\n useLabel = 'MISSING LABEL'\n }\n }\n return useLabel\n }, [quantity, label, def, isQuantityString])\n\n const tooltip = description || def?.description || ''\n\n // Determine the final value to show.\n if (!loading) {\n let finalValue = value\n if (isNil(value)) {\n if (typeof quantity === 'string') {\n finalValue = data && quantity && get(data, quantity)\n } else if (children) {\n } else {\n try {\n finalValue = quantity(data)\n } catch {\n finalValue = undefined\n }\n }\n }\n\n if (finalValue === 'not processed') {\n finalValue = 'unavailable'\n }\n\n if (finalValue === 'unavailable') {\n finalValue = ''\n }\n\n if (format) {\n finalValue = serializeMetainfo(quantity, finalValue, units)\n }\n\n if ((!finalValue && !children) && hideIfUnavailable) {\n return null\n }\n\n if (finalValue && Array.isArray(finalValue)) {\n finalValue = finalValue.join(', ')\n }\n clipboardContent = clipboardContent || finalValue\n\n if (children && children.length !== 0) {\n content = children\n } else if (finalValue || finalValue === 0) {\n content = \n {(noWrap && ellipsisFront)\n ? {finalValue}\n : finalValue\n }\n \n } else {\n content = \n {placeholder || 'unavailable'}\n \n }\n }\n\n if (row || column || flex) {\n return
{children}
\n } else {\n return (\n
\n {!noLabel ? {useLabel} : ''}\n
\n {loading\n ? \n loading ...\n \n // The tooltip portal is disabled for custom contents that may\n // contain links. Pressing a link while the tooltip is shown will\n // cause a navigation that leaves the popup opened (the Tooltip\n // state does not get updated since the page may be cached and a new\n // page is shown immediately).\n : \n {content}\n \n }\n {withClipboard\n ? null}\n >\n \n
\n \n \n \n
\n
\n \n : ''\n }\n
\n
\n )\n }\n})\n\nQuantity.propTypes = {\n children: PropTypes.node,\n label: PropTypes.string,\n typography: PropTypes.string,\n loading: PropTypes.bool,\n placeholder: PropTypes.string,\n noWrap: PropTypes.bool,\n noLabel: PropTypes.bool,\n row: PropTypes.bool,\n column: PropTypes.bool,\n flex: PropTypes.bool,\n data: PropTypes.object,\n value: PropTypes.any,\n quantity: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.func,\n PropTypes.object\n ]),\n withClipboard: PropTypes.bool,\n ellipsisFront: PropTypes.bool,\n hideIfUnavailable: PropTypes.bool,\n description: PropTypes.string,\n format: PropTypes.bool,\n maxWidth: PropTypes.string\n}\n\nQuantity.defaultProps = {\n maxWidth: '280px'\n}\n\nexport default Quantity\n\n// Preset configuration for quantities\nconst nElementMap = {\n 1: 'unary',\n 2: 'binary',\n 3: 'ternary',\n 4: 'quaternary',\n 5: 'quinary',\n 6: 'sexinary',\n 7: 'septenary',\n 8: 'octanary',\n 9: 'nonary',\n 10: 'decimary'\n}\nconst quantityPresets = {\n datasets: {\n label: 'Datasets',\n placeholder: 'no datasets',\n render: (data) => (data.datasets && data.datasets.length !== 0) &&\n
\n {data.datasets.map(ds => (\n \n {ds.dataset_name}\n {ds.doi ?   : ''}\n ))}\n
\n },\n authors: {\n label: 'Authors',\n placeholder: 'no authors',\n render: (data) => \n {authorList(data || [], true)}\n \n },\n references: {\n label: 'References',\n placeholder: 'no references',\n render: (data) => (data?.references &&
\n {data.references.map(ref => \n {ref}\n )}\n
)\n },\n comment: {\n label: 'Comment',\n placeholder: 'no comment'\n },\n upload_id: {\n noWrap: true,\n withClipboard: true,\n render: (data) => (\n \n \n {data.upload_id}\n \n \n )\n },\n last_processing_time: {\n noWrap: true,\n placeholder: 'not processed',\n render: (data) => \n {formatTimestamp(data.last_processing_time)}\n \n },\n last_processing_version: {\n description: 'Version used in the last processing',\n label: 'Processing version',\n noWrap: true,\n placeholder: 'not processed',\n render: (data) => \n {data.nomad_version}/{data.nomad_commit}\n \n },\n upload_create_time: {\n noWrap: true,\n render: (data) => \n {formatTimestamp(data.upload_create_time)}\n \n },\n entry_id: {\n noWrap: true,\n withClipboard: true,\n render: (data) => (\n \n \n {data.entry_id}\n \n \n )\n },\n 'results.material.material_id': {\n noWrap: true,\n hideIfUnavailable: true,\n placeholder: 'unavailable',\n withClipboard: true,\n render: (data) => {\n return data?.results?.material?.material_id\n ? \n \n {data.results.material.material_id}\n \n \n : null\n }\n },\n 'results.material.topology.material_id': {\n noWrap: true,\n hideIfUnavailable: true,\n placeholder: 'unavailable',\n withClipboard: true,\n renderValue: (value) => {\n return value\n ? \n \n {value}\n \n \n : null\n }\n },\n 'results.material.n_elements': {\n noWrap: true,\n label: \"Number of elements\",\n render: (data) => {\n const n = get(data, 'results.material.n_elements')\n const label = nElementMap[n]\n return {`${n}${label ? ` (${label})` : ''}`}\n }\n },\n mainfile: {\n noWrap: true,\n ellipsisFront: true,\n withClipboard: true\n },\n raw_id: {\n noWrap: true,\n withClipboard: true,\n hideIfUnavailable: true\n },\n external_id: {\n noWrap: true,\n withClipboard: true,\n hideIfUnavailable: true\n }\n}\n/**\n * Representational component for tables containing metainfo data.\n */\nconst useMetaInfoTableStyles = makeStyles(theme => ({\n root: {\n border: `1px solid ${theme.palette.grey[300]}`\n },\n wrap: {\n borderBottom: `none`\n },\n fixed: {\n tableLayout: 'fixed'\n }\n}))\nexport const MetaInfoTable = React.memo(({fixed, wrap, className, classes, children}) => {\n const styles = useMetaInfoTableStyles(classes)\n return \n \n {children}\n
\n
\n})\nMetaInfoTable.propTypes = {\n fixed: PropTypes.bool, // Whether the table cells should have equal sizes\n wrap: PropTypes.bool, // Whether the table rows should wrap\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.node\n}\n\n/**\n * Used to organize individual quantities in a table.\n */\nconst quantityTableContext = React.createContext()\nexport const QuantityTable = React.memo(({data, fixed, wrap, className, children}) => {\n return \n \n \n {children}\n \n \n \n})\nQuantityTable.propTypes = {\n data: PropTypes.object,\n fixed: PropTypes.bool,\n wrap: PropTypes.bool,\n className: PropTypes.string,\n children: PropTypes.node\n}\n\n/**\n * Used to organize Quantities in a table row.\n */\nconst useRowStyles = makeStyles(theme => ({\n root: {},\n separator: {\n borderBottom: `1px solid ${theme.palette.grey[300]}`\n },\n wrap: {\n display: 'inline-flex',\n flexWrap: 'wrap',\n overflow: 'hidden'\n }\n}))\nexport const QuantityRow = React.memo(({className, classes, separator, children}) => {\n const styles = useRowStyles()\n const wrap = useContext(quantityTableContext)?.wrap\n return \n {children}\n \n})\n\nQuantityRow.propTypes = {\n className: PropTypes.string,\n separator: PropTypes.bool, // Whether to show a bottom border for the row\n wrap: PropTypes.bool, // Whether to wrap the cells once they overflow\n classes: PropTypes.object,\n children: PropTypes.node\n}\n\n/**\n * Used to display a quantity in a table cell.\n */\nconst useCellStyles = makeStyles(theme => ({\n wrap: {\n borderBottom: `1px solid ${theme.palette.grey[300]} !important`,\n flexGrow: 1\n }\n}))\nexport const QuantityCell = React.memo(({\n quantity,\n value,\n data,\n label,\n description,\n classes,\n className,\n hideIfUnavailable,\n format,\n children,\n maxWidth,\n ...other\n}) => {\n const context = useContext(quantityTableContext)\n const wrap = context?.wrap\n const contextData = context?.data\n const finalData = data || contextData\n const styles = useCellStyles()\n\n return (hideIfUnavailable && isNil(value))\n ? null\n : \n {children || }\n \n})\n\nQuantityCell.propTypes = {\n quantity: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n value: PropTypes.any,\n data: PropTypes.object,\n label: PropTypes.string,\n description: PropTypes.string,\n options: PropTypes.object,\n maxWidth: PropTypes.string,\n className: PropTypes.string,\n hideIfUnavailable: PropTypes.bool,\n format: PropTypes.bool,\n classes: PropTypes.object,\n children: PropTypes.node\n}\n\nQuantityCell.defaultProps = {\n format: true\n}\n\n/**\n * Used to display data from one or many sections in a table.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%'\n },\n table: {\n marginBottom: theme.spacing(1)\n }\n}))\nexport const SectionTable = React.memo(({\n data,\n section,\n quantities,\n horizontal,\n showIndex,\n classes,\n className,\n units,\n 'data-testid': testID\n}) => {\n const styles = useStyles({classes: classes})\n if (showIndex && !horizontal) {\n throw Error('Showing index in a vertically displayed table is not currently supported.')\n }\n\n // If data is set explicitly to False, we show the NoData component.\n let content\n if (data === false) {\n content = \n } else if (!data) {\n content = \n } else {\n content = \n \n {horizontal\n ? \n {showIndex && \n \n Index\n \n }\n {Object.keys(quantities).map((key, index) => {\n const defCustom = quantities[key]\n const def = defaultFilterData[`${section}.${key}`]\n const unitName = defCustom.unit || def?.unit\n const unit = unitName && new Unit(unitName)\n const unitLabel = unit && unit.toSystem(units).label()\n const label = defCustom.label || def?.label\n const description = defCustom.description || def?.description || ''\n const content = unit ? `${label} (${unitLabel})` : defCustom.label\n const align = defCustom.align || 'right'\n return \n \n \n {content}\n \n \n \n })}\n \n : null\n }\n \n \n {horizontal\n ? <>{data.data.map((row, i) => (\n \n {showIndex && {i}}\n {Object.keys(quantities).map((key, j) => {\n const defCustom = quantities[key]\n const def = searchQuantities[`${section}.${key}`]\n const unit = defCustom.unit || def?.unit\n const dtype = defCustom?.type?.type_data || def?.type?.type_data\n const align = defCustom.align || 'right'\n let value = row[key]\n if (value !== undefined) {\n if (!isNaN(value)) {\n value = formatNumber(\n unit ? new Q(value, unit).toSystem(units).value() : value,\n dtype\n )\n }\n } else {\n value = defCustom.placeholder || 'unavailable'\n }\n return {value}\n })}\n \n ))}\n : <>{Object.keys(quantities).map((key, i) => (\n \n {data.data.map((row, j) => {\n const defCustom = quantities[key]\n const def = defaultFilterData[`${section}.${key}`]\n const unitName = defCustom.unit || def?.unit\n const unit = unitName && new Unit(unitName)\n const unitLabel = unit ? ` ${unit.toSystem(units).label()}` : ''\n const description = defCustom.description || def?.description || ''\n const dtype = defCustom?.type?.type_data || def?.type?.type_data\n const align = defCustom.align || 'right'\n const label = defCustom.label || def?.label\n let value = row[key]\n if (value !== undefined) {\n if (!isNaN(value)) {\n value = `${formatNumber(\n unit ? new Q(value, unit).toSystem(units).value() : value,\n dtype\n )}${unitLabel}`\n }\n } else {\n value = defCustom.placeholder || 'unavailable'\n }\n return <>\n \n \n \n {label}\n \n \n \n {value}\n \n })}\n \n ))}\n }\n \n \n }\n\n return
\n {content}\n
\n})\n\nSectionTable.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.bool, // Set to False to show NoData component\n PropTypes.shape({\n data: PropTypes.arrayOf(PropTypes.object).isRequired\n })\n ]),\n section: PropTypes.string,\n quantities: PropTypes.any,\n horizontal: PropTypes.bool,\n showIndex: PropTypes.bool, // Whether to display the item index\n className: PropTypes.string,\n classes: PropTypes.object,\n units: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\n/**\n * Recursively displays all of the quantities that are present within the given\n * section.\n */\nexport const SectionTableAutomatic = React.memo(({data, prefix, columns}) => {\n // Figure out a flat list of quantities to display\n const quantities = []\n const addMethodQuantities = (obj, parentKey) => {\n const children = {}\n Object.keys(obj).forEach(key => {\n const value = obj[key]\n if (Array.isArray(value) || isString(value) || isNumber(value)) {\n const metainfoPath = `${prefix}.${parentKey === '' ? '' : `${parentKey}.`}${key}`\n quantities.push({\n label: key.replace(/_/g, ' '),\n quantity: metainfoPath,\n value: value\n })\n } else if (value instanceof Object) {\n children[key] = value\n }\n })\n Object.keys(children).forEach(key => addMethodQuantities(children[key], `${parentKey === '' ? '' : `${parentKey}.`}${key}`))\n }\n addMethodQuantities(data, '')\n\n // Create rows that each have a fixed number of items\n const rows = []\n quantities.forEach((quantity, index) => {\n if (index % columns === 0) {\n rows.push([])\n }\n const row = rows[Math.floor(index / columns)]\n row.push(quantity)\n })\n\n return \n {rows.map((row, i) => \n {row.map((cell) => )}\n )}\n \n})\n\nSectionTableAutomatic.propTypes = {\n data: PropTypes.object,\n prefix: PropTypes.string, // Possible prefix that is needed to resolve the quantity metainfo\n columns: PropTypes.number // The number of columns to display\n}\n\nSectionTableAutomatic.defaultProps = {\n columns: 3\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Button } from '@material-ui/core'\n\n/**\n * Button that has a loading status and cannot be used while loading.\n */\nexport default function LoadingButton({loading, children, ...buttonProps}) {\n buttonProps.disabled = buttonProps.disabled || loading\n return \n}\n\nLoadingButton.propTypes = {\n loading: PropTypes.bool,\n children: PropTypes.node\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nt* See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport {\n Menu,\n MenuItem,\n FormControl,\n FormLabel,\n FormControlLabel,\n IconButton,\n TextField,\n Typography,\n DialogActions,\n Box,\n Tooltip,\n Radio,\n RadioGroup\n} from '@material-ui/core'\nimport LoadingButton from './LoadingButton'\nimport { download } from '../../utils'\nimport { useErrors } from '../errors'\nimport { useApi } from '../api'\n\n// TODO: The available options could be passed down to the GUI via pydantic\n// model serialization.\nconst formats = {\n cif: {\n label: 'CIF'\n },\n xyz: {\n label: 'XYZ'\n },\n pdb: {\n label: 'PDB'\n }\n}\nexport const wrapModes = {\n original: {\n key: 'original',\n label: 'Original',\n description: 'Original positions'\n },\n wrap: {\n key: 'wrap',\n label: 'Wrap',\n description: 'Positions are wrapped to be inside the cell respecting periodic boundary conditions'\n },\n unwrap: {\n key: 'unwrap',\n label: 'Unwrap',\n description: `Positions are reconstructed so that the structure is not split\n by periodic cell boundaries. Note that this produces meaningful results only\n if the system dimensions are smaller than the unit cell.`\n }\n}\n\nexport const WrapModeRadio = ({value, onChange, disabled, className}) => {\n return \n Wrap mode\n \n {Object.entries(wrapModes).map(([key, data]) =>\n }\n label={\n {data.label}\n }\n />\n )}\n \n \n}\n\nWrapModeRadio.propTypes = {\n value: PropTypes.string,\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n className: PropTypes.string\n}\n\n/*\n * Menu for downloading a specific system.\n */\nexport const DownloadSystemMenu = React.memo(React.forwardRef(({entryId, path, anchorEl, onClose, ...rest}, ref) => {\n const {api} = useApi()\n const {raiseError} = useErrors()\n const [format, setFormat] = useState('cif')\n const [wrapMode, setWrapMode] = useState('original')\n const [loading, setLoading] = useState(false)\n const open = Boolean(anchorEl)\n\n const handleChangeFormat = useCallback((event) => {\n setFormat(event.target.value)\n }, [])\n\n const handleChangeWrapMode = useCallback((event) => {\n setWrapMode(event.target.value)\n }, [])\n\n const handleClickDownload = useCallback(() => {\n setLoading(true)\n api.get(\n `systems/${entryId}?path=${path}&format=${format}&wrap_mode=${wrapMode}`,\n undefined,\n {responseType: 'blob', fullResponse: true}\n )\n .then((response) => {\n const contentDisposition = response.headers['content-disposition']\n const fileName = contentDisposition?.split('\"')[1] || `system.${format}`\n download(fileName, response.data)\n })\n .finally(() => setLoading(false))\n .catch(raiseError)\n }, [entryId, path, format, wrapMode, api, raiseError])\n\n return \n \n \n Download system\n \n \n \n {Object.entries(formats).map(([key, value]) => {\n return {value.label}\n })}\n \n \n \n \n \n \n Download\n \n \n \n \n \n}))\n\nDownloadSystemMenu.propTypes = {\n entryId: PropTypes.string,\n path: PropTypes.string,\n anchorEl: PropTypes.object,\n onClose: PropTypes.func\n}\n\n/*\n * Button for downloading a specific system.\n */\nexport const DownloadSystemButton = React.memo(React.forwardRef(({entryId, path, ...rest}, ref) => {\n const [anchorEl, setAnchorEl] = useState(null)\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n return <>\n \n setAnchorEl(null)}/>\n \n}))\n\nDownloadSystemButton.propTypes = {\n entryId: PropTypes.string,\n path: PropTypes.string,\n onClose: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useCallback, useMemo, useRef } from 'react'\nimport { useResizeDetector } from 'react-resize-detector'\nimport { makeStyles } from '@material-ui/core/styles'\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogActions,\n Box,\n Paper,\n Backdrop\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { isNil } from 'lodash'\nimport { useWindowSize } from '../../hooks'\n\n/**\n * Component that wraps it's children in a container that can be 'floated',\n * i.e. displayed on an html element that is positioned relative to the\n * viewport and is above all other elements.\n */\nconst useStyles = makeStyles((theme) => {\n const actionsHeight = 52.5 // Size of the actions element that is shown when floating\n const padding = 20 // Padding arount the floating object\n return {\n root: {\n width: '100%',\n height: '100%'\n },\n dialogContent: {\n boxSizing: 'border-box',\n padding: padding\n },\n 'dialogContent:first-child': {\n paddingTop: `${padding} !important`\n },\n dialogActions: {\n height: actionsHeight,\n boxSizing: 'border-box'\n }\n }\n})\nexport default function Floatable({\n className,\n classes,\n style,\n float,\n children,\n onFloat,\n onResize\n}) {\n // The ratio is calculated dynamically from the final size\n const { height, width, ref } = useResizeDetector()\n const dim = useRef({width: 800, height: 600})\n\n // When the figure is floated, fix the width/height.\n useEffect(() => {\n if (!float) {\n dim.current = {\n width: width,\n height: height\n }\n }\n if (onResize && !isNil(width) && !isNil(height)) {\n onResize(width, height)\n }\n }, [float, width, height, onResize])\n\n // Dynamic styles\n const useDynamicStyles = makeStyles((theme) => {\n // Calculate the fullscreen size\n const actionsHeight = 52.5 // Size of the actions element that is shown when floating\n const padding = 20 // Padding arount the floating object\n const maxWidth = 1280 // Maximum width for the floating window\n const margin = 0.1 * (window.innerHeight) + actionsHeight\n const windowHeight = window.innerHeight - margin\n const windowWidth = Math.min(window.innerWidth, maxWidth) - margin\n const windowRatio = windowWidth / windowHeight\n const ratio = dim.current.width / dim.current.height\n let width\n let height\n if (windowRatio > ratio) {\n width = (windowHeight) * ratio + 2 * padding + 'px'\n height = windowHeight + actionsHeight + 2 * padding\n } else {\n width = windowWidth + 2 * padding\n height = (windowWidth) / ratio + actionsHeight + 2 * padding + 'px'\n }\n\n return {\n dialogRoot: {\n width: width,\n height: height,\n margin: 0,\n padding: 0,\n maxWidth: 'none',\n maxHeight: 'none',\n boxSizing: 'border-box'\n }\n }\n })\n const styles = useStyles({classes: classes})\n const dynamicStyles = useDynamicStyles({classes: classes})\n\n return
\n {float\n ?
\n : children\n }\n \n \n {float ? children : ''}\n \n \n \n \n \n
\n}\n\nFloatable.propTypes = {\n /**\n * Whether this component should be in floating mode or not.\n */\n float: PropTypes.bool.isRequired,\n /**\n * Callback that is called whenever this component requests a change in the\n * float property. The callback accepts one parameter: 'float' that is a\n * boolean indicating the current float status.\n */\n onFloat: PropTypes.func,\n onResize: PropTypes.func,\n children: PropTypes.node,\n className: PropTypes.string,\n classes: PropTypes.object,\n style: PropTypes.object\n}\nFloatable.defaultProps = {\n float: false\n}\n\n/**\n * Component that wraps it's children in a container that can be 'floated', i.e.\n * is positioned relative to the viewport and is above all other elements.\n */\nconst actionsHeight = 52.5 // Size of the actions element that is shown when floating\nconst useNoReparentStyles = makeStyles((theme) => {\n return {\n root: {\n top: '50%',\n left: '50%',\n margin: 0,\n padding: 0,\n maxWidth: 'none',\n maxHeight: 'none',\n boxSizing: 'border-box'\n },\n paper: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n boxSizing: 'border-box'\n },\n full: {\n width: '100%',\n height: '100%',\n boxSizing: 'border-box'\n },\n dialogActions: {\n height: actionsHeight,\n boxSizing: 'border-box'\n }\n }\n})\nexport const FloatableNoReparent = React.memo(({\n className,\n float,\n children,\n onFloat,\n onResize,\n maxWidth,\n margin\n}) => {\n // The ratio is calculated dynamically from the final size\n const styles = useNoReparentStyles()\n const { height, width, ref } = useResizeDetector()\n const dim = useRef({width: 800, height: 600})\n const windowSize = useWindowSize()\n\n // This fixes the aspect ratio of the component based on the non-floating\n // size.\n useEffect(() => {\n if (!float) {\n dim.current = {\n width: width,\n height: height\n }\n }\n if (onResize && !isNil(width) && !isNil(height)) {\n onResize(width, height)\n }\n }, [float, width, height, onResize])\n\n const handleFloat = useCallback(() => {\n onFloat && onFloat()\n }, [onFloat])\n\n // Calculate the final floated size\n const size = useMemo(() => {\n // Calculate the fullscreen size\n const marginAbsolute = margin * (windowSize.windowHeight)\n const windowHeight = windowSize.windowHeight - marginAbsolute\n const windowWidth = Math.min(windowSize.windowWidth, maxWidth) - marginAbsolute\n const windowRatio = windowWidth / windowHeight\n const ratio = dim.current.width / dim.current.height\n let width\n let height\n if (windowRatio > ratio) {\n width = (windowHeight) * ratio\n height = windowHeight + actionsHeight\n } else {\n width = windowWidth\n height = (windowWidth) / ratio + actionsHeight\n }\n return {width, height}\n }, [windowSize, maxWidth, margin])\n\n return \n \n \n
\n {children}\n
\n {float &&\n \n \n \n }\n
\n \n
\n})\n\nFloatableNoReparent.propTypes = {\n float: PropTypes.bool,\n onFloat: PropTypes.func,\n onResize: PropTypes.func,\n children: PropTypes.node,\n className: PropTypes.string,\n maxWidth: PropTypes.number,\n margin: PropTypes.number\n}\n\nFloatableNoReparent.defaultProps = {\n float: false,\n maxWidth: 1920,\n margin: 0.1\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nt* See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { useHistory } from 'react-router-dom'\nimport {\n Checkbox,\n Button,\n Menu,\n MenuItem,\n Typography,\n FormControlLabel\n} from '@material-ui/core'\nimport { Alert } from '@material-ui/lab'\nimport {\n MoreVert,\n Fullscreen,\n FullscreenExit,\n CameraAlt,\n Replay,\n ViewList,\n GetApp\n} from '@material-ui/icons'\nimport { DownloadSystemMenu, WrapModeRadio } from '../buttons/DownloadSystemButton'\nimport Floatable from './Floatable'\nimport NoData from './NoData'\nimport Placeholder from './Placeholder'\nimport { Actions, Action } from '../Actions'\nimport { withErrorHandler, withWebGLErrorHandler } from '../ErrorHandler'\nimport { isNil } from 'lodash'\nimport { Quantity } from '../units/Quantity'\n\n/**\n * Used to control a 3D system visualization that is implemented in the\n * 'children' prop. This allows for an easier change of visualization\n * implementation without changing the control layout.\n */\nconst useStyles = makeStyles((theme) => {\n return {\n root: {},\n container: {\n position: 'relative',\n width: '100%',\n height: '100%'\n },\n content: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n display: 'flex',\n flexDirection: 'column'\n },\n header: {\n display: 'flex',\n flexDirection: 'row',\n zIndex: 1\n },\n legend: {\n zIndex: 10,\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0\n },\n title: {\n marginBottom: theme.spacing(1)\n },\n menuItem: {\n margin: theme.spacing(2),\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1)\n },\n canvas: {\n position: 'relative',\n flex: 1,\n zIndex: 0,\n minHeight: 0, // added min-height: 0 to allow the item to shrink to fit inside the container.\n marginBottom: theme.spacing(1)\n }\n }\n})\nconst StructureBase = React.memo(({\n wrapMode,\n onWrapModeChange,\n disableWrapMode,\n showLatticeConstants,\n onShowLatticeConstants,\n disableShowLatticeConstants,\n showBonds,\n onShowBonds,\n disableShowBonds,\n showCell,\n onShowCell,\n disableShowCell,\n onAccept,\n onReset,\n onTakeScreenshot,\n onFullscreen,\n float,\n species,\n loading,\n prompt,\n noData,\n className,\n classes,\n captureName,\n disableLegend,\n disableFileDownload,\n entryId,\n path,\n m_path,\n 'data-testid': testID,\n children}\n) => {\n const [anchorEl, setAnchorEl] = React.useState(null)\n const [systemAnchorEl, setSystemAnchorEl] = React.useState(null)\n const history = useHistory()\n const open = Boolean(anchorEl)\n const styles = useStyles(classes)\n const downloadDisabled = isNil(entryId) || isNil(path) || disableFileDownload\n\n const setShowBonds = useCallback((value, render = false) => {\n onShowBonds && onShowBonds(value, render)\n }, [onShowBonds])\n\n const handleWrapModeChange = useCallback((value, showBonds, render = false) => {\n onWrapModeChange && onWrapModeChange(value, showBonds, render)\n }, [onWrapModeChange])\n\n const handleShowLatticeConstants = useCallback((value, render = false) => {\n onShowLatticeConstants && onShowLatticeConstants(value, render)\n }, [onShowLatticeConstants])\n\n const setShowCell = useCallback((value, render = false) => {\n onShowCell && onShowCell(value, render)\n }, [onShowCell])\n\n const handleFullscreen = useCallback(() => {\n onFullscreen && onFullscreen()\n }, [onFullscreen])\n\n const handleReset = useCallback(() => {\n onReset && onReset()\n }, [onReset])\n\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n\n const openSystemMenu = useCallback((event) => {\n setSystemAnchorEl(event.currentTarget)\n }, [])\n\n const closeMenu = useCallback(() => {\n setAnchorEl(null)\n }, [])\n\n const takeScreencapture = useCallback(() => {\n onTakeScreenshot && onTakeScreenshot(captureName)\n }, [onTakeScreenshot, captureName])\n\n // Decides the possible overlay to display\n const overlay = useMemo(() => {\n if (prompt) {\n return onAccept()}>\n YES\n \n }\n >\n {prompt}\n \n } else if (loading) {\n return \n } else if (noData) {\n return \n }\n }, [loading, prompt, noData, onAccept])\n\n return \n
\n
\n {overlay}\n
\n {/* This contains the actual visualization. Needs to be always in the DOM so we can\n load the structure into it properly. */}\n \n {float && Structure}\n
\n {children}\n {!disableLegend &&\n \n }\n
\n
\n \n \n \n \n \n {float ? : }\n \n \n \n \n \n \n \n {m_path &&\n { history.push(m_path) }}>\n \n \n }\n \n \n \n \n setSystemAnchorEl(null)}\n />\n \n \n { setShowBonds(!showBonds, true) }}\n color='primary'\n />\n }\n label='Show bonds'\n />\n \n \n { handleShowLatticeConstants(!showLatticeConstants, true) }}\n color='primary'\n />\n }\n label='Show lattice constants'\n />\n \n \n { setShowCell(!showCell, true) }}\n color='primary'\n />\n }\n label='Show simulation cell'\n />\n \n \n \n
\n
\n
\n \n})\n\nStructureBase.propTypes = {\n wrapMode: PropTypes.string,\n onWrapModeChange: PropTypes.func,\n disableWrapMode: PropTypes.bool,\n showLatticeConstants: PropTypes.bool,\n onShowLatticeConstants: PropTypes.func,\n disableShowLatticeConstants: PropTypes.bool,\n showBonds: PropTypes.bool,\n onShowBonds: PropTypes.func,\n disableShowBonds: PropTypes.bool,\n showCell: PropTypes.bool,\n onShowCell: PropTypes.func,\n disableShowCell: PropTypes.bool,\n prompt: PropTypes.string, // Prompt shown before showing the visualization\n onAccept: PropTypes.func, // Callback for answering yes to the prompt\n onReset: PropTypes.func,\n onTakeScreenshot: PropTypes.func,\n onFullscreen: PropTypes.func,\n species: PropTypes.array,\n loading: PropTypes.bool,\n float: PropTypes.bool,\n className: PropTypes.string,\n classes: PropTypes.object,\n noData: PropTypes.bool,\n canvasID: PropTypes.string,\n disableFileDownload: PropTypes.bool, // Used to disable the file download button\n entryId: PropTypes.string,\n path: PropTypes.string,\n m_path: PropTypes.string, // Path of the structure data in the metainfo\n captureName: PropTypes.string, // Name of the file that the user can download\n disableLegend: PropTypes.bool, // Disable the legend showing the species list\n 'data-testid': PropTypes.string,\n children: PropTypes.node\n}\nStructureBase.defaultProps = {\n captureName: 'system'\n}\n\nexport default withWebGLErrorHandler(withErrorHandler('Could not load structure.')(StructureBase))\n\nfunction getRadius(radius) {\n return `${Math.sqrt(radius) * 12}px`\n}\n\n/**\n * Shows a list of atomic species.\n */\nconst useSpeciesStyles = makeStyles((theme) => {\n return {\n root: {\n padding: theme.spacing(0.5),\n overflowY: 'auto',\n overflowX: 'hidden',\n direction: 'rtl'\n },\n grid: {\n display: 'grid',\n gridTemplateColumns: 'min-content auto',\n gridGap: `${theme.spacing(0.1)}px ${theme.spacing(0.5)}px`,\n direction: 'ltr'\n },\n label: {\n justifySelf: 'start',\n alignSelf: 'center',\n textShadow: '0px 0px 5px #ffffff'\n },\n circle: {\n borderRadius: '100%',\n border: '1px solid #555',\n justifySelf: 'center',\n alignSelf: 'center'\n }\n }\n})\nexport const Species = React.memo(({species, className}) => {\n const styles = useSpeciesStyles()\n const normalized = useMemo(() => {\n let normalized\n try {\n normalized = species\n .map(x => ({...x, radius: (x.radius)}))\n .sort((a, b) => (a.atomicNumber - b.atomicNumber))\n } catch {}\n return normalized\n }, [species])\n\n return normalized\n ?
\n
\n {species && normalized.map(item => {\n const radius = getRadius(item.radius)\n return \n \n {item.label}\n \n })}\n
\n
\n : null\n})\n\nSpecies.propTypes = {\n species: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.string.isRequired, // The label to show\n radius: PropTypes.number.isRequired, // Radius in Ã…ngstrom\n color: PropTypes.string.isRequired, // CSS color\n atomicNumber: PropTypes.number.isRequired // Atomic number for sorting\n })),\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\n/**\n * Converts the given structure in the format used by 'results' into the format\n * used by the materia-library.\n *\n * @param {object} structure.\n *\n * @return {undefined|object} If the given structure cannot be converted,\n * returns an empty object.\n */\nexport function toMateriaStructure(structure) {\n if (!structure) {\n return undefined\n }\n\n try {\n // Resolve atomic species using the labels and their mapping to chemical\n // elements.\n const speciesMap = new Map(structure.species.map(s => [s.name, s.chemical_symbols[0]]))\n\n const structMateria = {\n species: structure.species_at_sites.map(x => speciesMap.get(x)),\n cell: structure.lattice_vectors\n ? new Quantity(structure.lattice_vectors, 'meter').to('angstrom').value()\n : undefined,\n positions: new Quantity(structure.cartesian_site_positions, 'meter').to('angstrom').value(),\n fractional: false,\n pbc: structure.dimension_types ? structure.dimension_types.map((x) => !!x) : undefined\n }\n return structMateria\n } catch (error) {\n return {}\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useMemo, useEffect, useRef, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles, alpha } from '@material-ui/core/styles'\nimport {\n Checkbox,\n Button,\n Menu,\n MenuItem,\n Typography,\n FormControlLabel\n} from '@material-ui/core'\nimport { Alert } from '@material-ui/lab'\nimport {\n MoreVert,\n Fullscreen,\n FullscreenExit,\n CameraAlt,\n Replay,\n ViewList\n} from '@material-ui/icons'\nimport { StructureViewer } from '@lauri-codes/materia'\nimport { Species } from './StructureBase'\nimport Floatable from './Floatable'\nimport NoData from './NoData'\nimport Placeholder from '../visualization/Placeholder'\nimport { Actions, Action } from '../Actions'\nimport { withErrorHandler, withWebGLErrorHandler } from '../ErrorHandler'\nimport { useHistory } from 'react-router-dom'\nimport { isEmpty, flattenDeep } from 'lodash'\nimport { Quantity } from '../units/Quantity'\nimport { delay } from '../../utils'\nimport { useAsyncError } from '../../hooks'\nimport clsx from 'clsx'\n\n/**\n * Used to show atomistic systems in an interactive 3D viewer based on the\n * 'materia'-library.\n */\nconst fitMargin = 0.5\nconst useStyles = makeStyles((theme) => {\n return {\n root: {},\n container: {\n position: 'relative',\n width: '100%',\n height: '100%'\n },\n content: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n display: 'flex',\n flexDirection: 'column'\n },\n header: {\n display: 'flex',\n flexDirection: 'row',\n zIndex: 1\n },\n legend: {\n zIndex: 10,\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0\n },\n selected: {\n '&$selected': {\n color: alpha(theme.palette.action.active, 0.87)\n }\n },\n title: {\n marginBottom: theme.spacing(1)\n },\n canvas: {\n position: 'relative',\n flex: 1,\n zIndex: 0,\n minHeight: 0, // added min-height: 0 to allow the item to shrink to fit inside the container.\n marginBottom: theme.spacing(1)\n }\n }\n})\nconst Structure = React.memo(({\n className,\n classes,\n data,\n structuralType,\n cellType,\n m_path,\n captureName,\n sizeLimit,\n bondLimit,\n disableLegend,\n selection,\n 'data-testid': testID\n}) => {\n // States\n const [anchorEl, setAnchorEl] = React.useState(null)\n const [fullscreen, setFullscreen] = useState(false)\n const [showLatticeConstants, setShowLatticeConstantsState] = useState(true)\n const [showCell, setShowCellState] = useState(true)\n const [center, setCenter] = useState('COP')\n const [fit, setFit] = useState('full')\n const [wrap, setWrapState] = useState(true)\n const [showPrompt, setShowPrompt] = useState(false)\n const [accepted, setAccepted] = useState(false)\n const [showBonds, setShowBondsState] = useState(true)\n const [species, setSpecies] = useState()\n const [loading, setLoading] = useState(true)\n const [ready, setReady] = useState(false)\n const throwError = useAsyncError()\n const noData = data === false\n\n const setShowBonds = useCallback((value, render = false) => {\n setShowBondsState(value)\n if (refViewer?.current) {\n try {\n refViewer.current.bonds({enabled: value})\n if (render) refViewer.current.render()\n } catch (e) {\n }\n }\n }, [])\n\n const setWrap = useCallback((value, showBonds, render = false) => {\n setWrapState(value)\n if (refViewer?.current) {\n try {\n refViewer.current.wrap(value)\n refViewer.current.bonds({enabled: showBonds})\n if (render) refViewer.current.render()\n } catch (e) {\n }\n }\n }, [])\n\n const setShowLatticeConstants = useCallback((value, render = false) => {\n setShowLatticeConstantsState(value)\n if (refViewer?.current) {\n try {\n refViewer.current.latticeConstants({enabled: value})\n if (render) refViewer.current.render()\n } catch (e) {\n }\n }\n }, [])\n\n const setShowCell = useCallback((value, render = false) => {\n setShowCellState(value)\n if (refViewer?.current) {\n try {\n refViewer.current.cell({enabled: value})\n if (render) refViewer.current.render()\n } catch (e) {\n }\n }\n }, [])\n\n // Variables\n const history = useHistory()\n const open = Boolean(anchorEl)\n const readyRef = useRef(true)\n const refViewer = useRef(null)\n const refCanvasDiv = useRef(null)\n const styles = useStyles(classes)\n const hasSelection = !isEmpty(selection?.selection)\n const nAtoms = useMemo(() => data?.positions?.length, [data])\n const hasCell = useMemo(() => {\n const hasCell = !data?.cell\n ? false\n : !flattenDeep(data.cell).every(v => v === 0)\n // If there is no valid cell, the property is set as undefined\n if (!hasCell && data) {\n data.cell = undefined\n }\n return hasCell\n }, [data])\n\n // In order to properly detect changes in a reference, a reference callback is\n // used. This is the recommended way to monitor reference changes as a simple\n // useRef is not guaranteed to update:\n // https://reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-dom-node\n const refCanvas = useCallback(node => {\n // Dependency on 'fit' will make this function run every time it changes\n // (useCallback should not really run the function when the dependency\n // changes, but something weird is going on here.). An extra check is made\n // to check for node change before setting up the canvas to the new div.\n if (node !== null && refViewer.current !== null && node !== refCanvasDiv.current) {\n refViewer.current.changeHostElement(node, true)\n refViewer.current.fit(fit, fitMargin)\n refViewer.current.render()\n }\n refCanvasDiv.current = node\n }, [fit])\n\n /**\n * Used to asynchronously load a new viewer and system. Since loading the\n * structure is a long-taking operation, running this function later in the\n * event queue allows the component to perform state updates (e.g. loading\n * placeholder) while the viewer is loading.\n */\n const loadSystem = useCallback(async (system, refViewer) => {\n await delay(() => {\n // Initialize the viewer. A new viewer is used for each system as the\n // render settings may differ.\n const nAtoms = system?.positions?.length\n const isHighQuality = nAtoms <= 3000\n const options = {\n renderer: {\n backgroundColor: ['#ffffff', 1],\n antialias: {enabled: isHighQuality},\n pixelRatioScale: 1,\n shadows: {enabled: false}\n },\n atoms: {\n smoothness: isHighQuality ? 165 : 150,\n outline: {enabled: isHighQuality}\n },\n bonds: {\n enabled: false,\n smoothness: isHighQuality ? 145 : 130,\n outline: {enabled: isHighQuality}\n }\n }\n refViewer.current = new StructureViewer(refCanvasDiv.current, options)\n refViewer.current.load(system)\n refViewer.current.controls({resetOnDoubleClick: false})\n\n // Get a list of all species ordered by atomic number\n const species = Object.entries(refViewer.current.elements)\n .map(([label, info]) => ({\n label: label,\n color: info[0],\n radius: info[1],\n atomicNumber: refViewer.current.elementNumbers[label]\n }))\n setSpecies(species)\n })\n }, [])\n\n // Called whenever the system changes. Loads the structure asynchronously.\n useEffect(() => {\n if (!data) return\n readyRef.current = false\n setReady(false)\n setLoading(true)\n\n // If the system is very large, ask the user first for permission to attempt\n // to visualize it.\n if (!accepted) {\n if (nAtoms > sizeLimit) {\n setShowPrompt(true)\n return\n }\n }\n\n // Remember to catch since react error boundaries do not automatically catch\n // from async calls.\n loadSystem(data, refViewer)\n .catch(throwError)\n .finally(() => {\n setReady(true)\n readyRef.current = true\n })\n }, [data, nAtoms, accepted, sizeLimit, throwError, loadSystem])\n\n // Once the system is loaded, this effect will determine the final visual\n // layout. By monitoring the ready-state, the selections are updated correctly\n // once the system is loaded. By also monitoring the readyRef-reference, this\n // effect can know the status within the same render cycle as well.\n useEffect(() => {\n if (!ready || !readyRef.current) {\n return\n }\n\n // Reset camera and system rotations\n refViewer.current.resetCamera()\n refViewer.current.setRotation([1, 0, 0, 0])\n\n // Determine the orientation and view centering based on material type and\n // the structure type.\n let center = 'COP'\n let fit = 'full'\n let showBondsValue = nAtoms < bondLimit\n let rotations = [\n [0, 1, 0, 60],\n [1, 0, 0, 30]\n ]\n let alignments = hasCell\n ? [\n ['up', 'c'],\n ['right', 'b']\n ]\n : undefined\n if (cellType === 'conventional' || cellType === 'primitive') {\n if (structuralType === 'bulk') {\n center = 'COC'\n alignments = [\n ['up', 'c'],\n ['right', 'b']\n ]\n } else if (structuralType === '2D') {\n center = 'COC'\n alignments = [\n ['right', 'a'],\n ['up', 'b']\n ]\n rotations = [\n [1, 0, 0, -60]\n ]\n } else if (structuralType === '1D') {\n center = 'COC'\n alignments = [\n ['right', 'a']\n ]\n rotations = [\n [1, 0, 0, -60],\n [0, 1, 0, 30],\n [1, 0, 0, 30]\n ]\n }\n }\n\n // No selection: show all\n if (isEmpty(selection?.selection)) {\n refViewer.current.atoms()\n showBondsValue = nAtoms < bondLimit\n setShowBonds(showBondsValue, false)\n if (hasCell) {\n setShowCell(true)\n setShowLatticeConstants(true)\n }\n // Focused selection: show only selected atoms\n } else {\n center = selection.isSubsystem ? selection.focus : center\n fit = selection.isSubsystem ? selection.focus : 'full'\n refViewer.current.atoms([\n {opacity: 0},\n {opacity: 0.1, include: selection.transparent},\n {opacity: 1, include: selection.selection}\n ])\n // Bonds are not shown for selections\n if (!selection.isSubsystem) {\n showBondsValue = false\n setShowBonds(showBondsValue, false)\n }\n if (hasCell) {\n setShowCell(!selection.isSubsystem)\n setShowLatticeConstants(!selection.isSubsystem)\n }\n }\n if (hasCell) {\n setWrap(true, showBondsValue, false)\n refViewer.current.align(alignments)\n }\n refViewer.current.rotate(rotations)\n refViewer.current.center(center)\n refViewer.current.fit(fit, fitMargin)\n refViewer.current.render()\n refViewer.current.saveCameraReset()\n setFit(fit)\n setCenter(center)\n setLoading(false)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selection, ready])\n\n // Memoized callbacks\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n\n const closeMenu = useCallback(() => {\n setAnchorEl(null)\n }, [])\n\n const toggleFullscreen = useCallback(() => {\n setFullscreen(!fullscreen)\n }, [fullscreen])\n\n const takeScreencapture = useCallback(() => {\n refViewer.current.takeScreenShot(captureName)\n }, [captureName])\n\n const handleReset = useCallback(() => {\n refViewer.current.resetCamera()\n refViewer.current.center(center)\n refViewer.current.fit(fit, fitMargin)\n refViewer.current.render()\n }, [center, fit])\n\n // Decides the possible overlay to display\n const overlay = useMemo(() => {\n if (showPrompt) {\n return {\n setShowPrompt(false)\n setAccepted(true)\n }}>\n YES\n \n }\n >\n {`Visualization is by default disabled for systems with more than ${sizeLimit} atoms. Do you wish to enable visualization for this system with ${nAtoms} atoms?`}\n \n } else if (loading) {\n return \n } else if (noData) {\n return \n }\n return null\n }, [loading, nAtoms, noData, showPrompt, sizeLimit])\n\n return \n
\n {/* Overlay that is displayed on top of the viewer */}\n
\n {overlay}\n
\n {/* This contains the actual visualization. Needs to be always in the DOM so we can\n load the structure into it properly. */}\n \n {fullscreen && Structure}\n
\n {!disableLegend &&\n \n }\n
\n
\n \n \n \n \n \n {fullscreen ? : }\n \n \n \n \n {m_path &&\n { history.push(m_path) }}>\n \n \n }\n \n \n \n \n \n \n { setShowBonds(!showBonds, true) }}\n color='primary'\n />\n }\n label='Show bonds'\n />\n \n \n { setShowLatticeConstants(!showLatticeConstants, true) }}\n color='primary'\n />\n }\n label='Show lattice constants'\n />\n \n \n { setShowCell(!showCell, true) }}\n color='primary'\n />\n }\n label='Show simulation cell'\n />\n \n \n { setWrap(!wrap, showBonds, true) }}\n color='primary'\n />\n }\n label='Wrap positions'\n />\n \n \n
\n
\n \n \n})\n\nStructure.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n data: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.object\n ]),\n structuralType: PropTypes.oneOf(['bulk', 'surface', '2D', '1D', 'molecule / cluster', 'unavailable']),\n cellType: PropTypes.oneOf(['original', 'conventional', 'primitive']),\n m_path: PropTypes.string, // Path of the structure data in the metainfo\n captureName: PropTypes.string, // Name of the file that the user can download\n sizeLimit: PropTypes.number, // Maximum system size before a prompt is shown\n bondLimit: PropTypes.number, // The size at which bonds are turned off\n disableLegend: PropTypes.bool, // Disable the legend showing the species list\n selection: PropTypes.shape({\n /**\n * The atom indices to show.\n */\n selection: PropTypes.arrayOf(PropTypes.number),\n /**\n * The atom indices to which the view is focused on.\n */\n focus: PropTypes.arrayOf(PropTypes.number),\n /**\n * The atom indices to display transparently.\n */\n transparent: PropTypes.arrayOf(PropTypes.number),\n /**\n * Is the selection visualizing a subsystem, e.g. a single molecule?\n */\n isSubsystem: PropTypes.bool\n }),\n 'data-testid': PropTypes.string\n}\nStructure.defaultProps = {\n captureName: 'structure',\n sizeLimit: 500,\n bondLimit: 50\n}\n\nexport default withWebGLErrorHandler(withErrorHandler('Could not load structure.')(Structure))\n\n/**\n * Converts the given structure in the format used by 'results' into the format\n * used by the materia-library.\n *\n * @param {object} structure.\n *\n * @return {undefined|object} If the given structure cannot be converted,\n * returns an empty object.\n */\nexport function toMateriaStructure(structure) {\n if (!structure) {\n return undefined\n }\n\n try {\n // Resolve atomic species using the labels and their mapping to chemical\n // elements.\n const speciesMap = new Map(structure.species.map(s => [s.name, s.chemical_symbols[0]]))\n\n const structMateria = {\n species: structure.species_at_sites.map(x => speciesMap.get(x)),\n cell: structure.lattice_vectors\n ? new Quantity(structure.lattice_vectors, 'meter').to('angstrom').value()\n : undefined,\n positions: new Quantity(structure.cartesian_site_positions, 'meter').to('angstrom').value(),\n fractional: false,\n pbc: structure.dimension_types ? structure.dimension_types.map((x) => !!x) : undefined\n }\n return structMateria\n } catch (error) {\n return {}\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useRef, useCallback, useEffect, useLayoutEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { Typography, makeStyles, Button, Box } from '@material-ui/core'\nimport { useErrors } from '../errors'\nimport ReactJson from 'react-json-view'\nimport { Document, Page, pdfjs } from 'react-pdf'\nimport InfiniteScroll from 'react-infinite-scroller'\nimport { useApi } from '../api'\nimport { apiBase } from '../../config'\nimport { parseCifStructures } from 'crystcif-parse'\nimport H5Web from '../visualization/H5Web'\nimport Structure from '../visualization/Structure'\nimport { isWaitingForUpdateTestId } from '../../utils'\nimport { useLane } from './Browser'\n\npdfjs.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`\n\nconst useFilePreviewStyles = makeStyles(theme => ({\n scrollableContainer: {\n width: '100%',\n height: '100%',\n display: 'inline-block',\n overflow: 'auto'\n },\n img: {\n maxHeight: '100%',\n maxWidth: '100%'\n }\n}))\n\n/* Viewer definitions */\nconst viewerText = {\n name: 'text',\n fileExtensions: ['txt', 'yaml', 'yml', 'csv', 'xml', 'dat'],\n maxSizePreview: 1e10, // Effectively infinite\n maxSizeAutoPreview: 1e10, // Effectively infinite\n width: 700,\n render: ({ uploadId, path }) => {\n return \n }\n}\nconst viewerImg = {\n name: 'image',\n fileExtensions: ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'],\n maxSizeAutoPreview: 10e6,\n render: ({ classes, url, setFailedToPreview }) => {\n return setFailedToPreview(true)}\n />\n }\n}\nconst viewerJSON = {\n name: 'json',\n fileExtensions: ['json'],\n maxSizeAutoPreview: 10e6,\n requiresLoadedData: true,\n width: 'fit-content',\n render: ({ classes, data }) => {\n if (typeof data.current === 'string') {\n data.current = JSON.parse(data.current)\n }\n return (\n \n \n \n )\n }\n}\nconst viewerPDF = {\n name: 'pdf',\n fileExtensions: ['pdf'],\n maxSizeAutoPreview: 10e6,\n width: 700,\n render: ({ url, setFailedToPreview }) => {\n return {\n console.log(error)\n setFailedToPreview(true)\n }}\n />\n }\n}\n\nconst viewerHdfFive = {\n name: 'hdf5',\n fileExtensions: ['h4', 'hd4', 'hdf4', 'hdf', 'h5', 'hd5', 'hdf5', 'hd5', 'nxs', 'h5oina', 'edaxh5', 'emd', 'dream3d'],\n maxSizeAutoPreview: 10e6,\n width: 'fit-content',\n render: ({ uploadId, path }) => \n}\nconst viewerCif = {\n name: 'cif',\n fileExtensions: ['cif'],\n maxSizeAutoPreview: 1e5,\n requiresLoadedData: true,\n width: 500,\n render: ({ data }) => {\n if (typeof data.current === 'string') {\n const cifData = parseCifStructures(data.current)\n const cifStructure = cifData[Object.keys(cifData)[0]]\n const structureData = {\n cell: cifStructure.get_cell(),\n pbc: cifStructure.get_pbc(),\n positions: cifStructure.get_positions(),\n species: cifStructure.get_chemical_symbols()\n }\n data.current = structureData\n }\n return (\n
\n \n
\n )\n }\n}\n\nexport const viewers = [viewerText, viewerImg, viewerJSON, viewerPDF, viewerHdfFive, viewerCif]\n\nconst FilePreview = React.memo(({ uploadId, path, size }) => {\n const classes = useFilePreviewStyles()\n const { api, user } = useApi()\n const { raiseError } = useErrors()\n\n // Determine viewer to use and if we should preview automatically, based on extension and size\n const fileExtension = path.split('.').pop().toLowerCase()\n let autoPreview = true\n let selectedViewer = viewerText\n for (const viewer of viewers) {\n if (viewer.fileExtensions.includes(fileExtension)) {\n if (size < (selectedViewer.maxSizePreview || 50e6)) {\n selectedViewer = viewer\n autoPreview = size < viewer.maxSizeAutoPreview\n break\n }\n }\n }\n\n const [preview, setPreview] = useState(autoPreview)\n const [failedToPreview, setFailedToPreview] = useState(false)\n const [useFallbackViewer, setUseFallbackViewer] = useState(false)\n\n const data = useRef()\n const [dataLoaded, setDataLoaded] = useState(false)\n\n const encodedPath = path.split('/').map(segment => encodeURIComponent(segment)).join('/')\n let url = `${apiBase}/v1/uploads/${uploadId}/raw/${encodedPath}`\n if (url.startsWith('/')) {\n url = `${window.location.origin}${url}`\n }\n\n useEffect(() => {\n if (preview && !failedToPreview && selectedViewer.requiresLoadedData && data.current === undefined) {\n // Need to load the file data content for the viewer\n data.current = null\n api.get(url)\n .then(response => {\n data.current = response\n setDataLoaded(true)\n })\n .catch(error => {\n setFailedToPreview(true)\n raiseError(error)\n })\n }\n }, [preview, failedToPreview, selectedViewer, user, url, data, dataLoaded, setDataLoaded, api, raiseError])\n\n if (!preview) {\n return (\n \n \n \n )\n }\n\n let content\n if (selectedViewer.requiresLoadedData && !dataLoaded) {\n // Not ready to invoke the viewer yet\n content = Loading...\n } else if (!failedToPreview) {\n try {\n content = selectedViewer.render({ uploadId, path, url, data, setFailedToPreview, classes })\n } catch (error) {\n // TODO\n }\n } else if (!useFallbackViewer) {\n // Selected viewer failed\n content = (\n \n Failed to open with {selectedViewer.name} viewer. Bad file format?\n \n \n )\n } else {\n // Use the text viewer as last resort\n content = viewerText.render({ uploadId, path, url, data, setFailedToPreview, classes })\n }\n return \n {content}\n \n})\nFilePreview.propTypes = {\n uploadId: PropTypes.string.isRequired,\n path: PropTypes.string.isRequired,\n size: PropTypes.number.isRequired\n}\nexport default FilePreview\n\nconst useFilePreviewTextStyles = makeStyles(theme => ({\n containerDiv: {\n height: '100%',\n overflowX: 'auto',\n backgroundColor: theme.palette.primary.dark\n },\n fileContents: {\n margin: theme.spacing(1),\n padding: 0,\n display: 'inline-block',\n color: theme.palette.primary.contrastText,\n fontFamily: 'Consolas, \"Liberation Mono\", Menlo, Courier, monospace',\n fontSize: 12,\n minWidth: '100%'\n }\n}))\nfunction FilePreviewText({ uploadId, path }) {\n const classes = useFilePreviewTextStyles()\n const { api } = useApi()\n const { raiseError } = useErrors()\n const [contents, setContents] = useState(null)\n const [hasMore, setHasMore] = useState(true)\n const loading = useRef(false)\n const [loadFailed, setLoadFailed] = useState(false)\n const lane = useLane()\n\n const encodedPath = path.split('/').map(segment => encodeURIComponent(segment)).join('/')\n\n const loadMore = useCallback(async () => {\n // The infinite scroll component normally calls the loadMore hook whenever it\n // gets updates, therefore calling this infinitely before it gets any chances of\n // receiving the results (https://github.com/CassetteRocks/react-infinite-scroller/issues/163).\n // Therefore, we use `loading` to keep track of if we are already running a load request.\n if (hasMore && !loading.current && !loadFailed) {\n loading.current = true\n api.get(\n `/uploads/${uploadId}/raw/${encodedPath}`,\n {\n offset: contents?.length || 0,\n length: 16 * 1024,\n decompress: true,\n ignore_mime_type: true\n },\n {\n transformResponse: [],\n responseType: 'blob'\n })\n .then(content => {\n // Note that the length of the string is not necessarily the number of\n // bytes that were transferred. This is why we need to request a blob,\n // get it's size, and then in a second step decode it as string for\n // displaying.\n const nBytes = content.size\n setHasMore(nBytes === 16 * 1024)\n return content.text()\n })\n .then(text => {\n setContents(old => (old || '') + (text || ''))\n })\n .catch(error => {\n setLoadFailed(true)\n setContents(old => (old || '') + '\\n\\nERROR - COULD NOT READ FILE!')\n raiseError(error)\n })\n .finally(() => { loading.current = false })\n }\n }, [uploadId, encodedPath, loading, loadFailed, setLoadFailed, hasMore, setHasMore, setContents, api, raiseError, contents])\n\n useEffect(() => {\n // Trigger loading the first chunk\n if (contents === null && !loading.current) {\n loadMore()\n }\n }, [contents, loading, loadMore])\n\n return (\n
\n lane.containerRef.current}\n {...(contents === null ? { 'data-testid': isWaitingForUpdateTestId } : {})}\n >\n
\n          {contents || ''}\n           \n        
\n \n
\n )\n}\nFilePreviewText.propTypes = {\n uploadId: PropTypes.string.isRequired,\n path: PropTypes.string.isRequired\n}\n\nconst useFilePreviewPdfStyles = makeStyles(theme => ({\n containerDiv: {\n height: '100%',\n overflowX: 'hidden',\n overflowY: 'scroll',\n border: '1px solid rgba(0, 0, 0, 0.42)',\n boxSizing: 'border-box'\n },\n pageDiv: {\n border: '5px solid gray'\n }\n}))\nconst FilePreviewPdf = React.memo(props => {\n const classes = useFilePreviewPdfStyles()\n const containerRef = useRef()\n const [numPages, setNumPages] = useState(null)\n const [pageWidth, setPageWidth] = useState()\n\n useLayoutEffect(() => {\n if (containerRef.current) {\n setPageWidth(containerRef.current.clientWidth - 10) // The -10 is because of the borders\n }\n }, [])\n\n function onDocumentLoadSuccess({ numPages }) {\n setNumPages(numPages)\n }\n\n return (\n
\n \n {numPages && pageWidth &&\n Array(numPages).fill().map((_, i) =>\n
\n \n
)\n }\n
\n
)\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState, useMemo, useEffect, useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { useApi } from '../api'\nimport { useDataStore, useEntryStoreObj } from '../DataStore'\nimport { ui, apiBase} from '../../config'\n\n/**\n * Hook for retrieving read-only archive information for the entry present in\n * the active EntryContext.\n */\nexport const useArchive = (required) => {\n const { entryId } = useEntryContext()\n const { api } = useApi()\n const [response, setResponse] = useState({})\n\n // When entryId changes, resets the currently held response and updates it\n // once new data arrives\n useEffect(() => {\n setResponse({})\n if (!entryId) return\n api\n .post(`entries/${entryId}/archive/query`, {required}, {returnRequest: true})\n .then(response => setResponse({data: response?.response?.data?.archive, response: response}))\n }, [api, required, entryId])\n\n return response\n}\n\n/**\n * Hook for retrieving read-only index information for the entry present in the\n * active EntryContext.\n */\nexport const useIndex = () => {\n const { entryId } = useEntryContext()\n const { api } = useApi()\n const [response, setResponse] = useState({})\n\n // When entryId changes, resets the currently held response and updates it\n // once new data arrives\n useEffect(() => {\n setResponse({})\n api\n .get(`entries/${entryId}`, null, {returnRequest: true})\n .then(response => setResponse({data: response?.response?.data, response: response}))\n }, [api, entryId])\n\n return response\n}\n\n/**\n * Hook for fetching the \"full\" entry data. If the entry is editable, the user\n * can also mutate the archive through this hook.\n *\n * @param {*} requireArchive Optional query filter\n */\nexport const useEntryStore = (requireArchive) => {\n const {entryId} = useContext(entryContext) || {}\n const entryStoreObj = useEntryStoreObj(apiBase, entryId, true, requireArchive)\n return entryStoreObj\n}\n\n/**\n * Hook for fetching the current entry context.\n */\nexport const useEntryContext = () => {\n return useContext(entryContext)\n}\n\n/**\n * Context that manages information about a specific entry that will be targeted\n * by different components.\n */\nconst entryContext = React.createContext()\nexport const EntryContext = React.memo(({entryId, cards, children}) => {\n const dataStore = useDataStore()\n dataStore.resetIfNeeded(entryId)\n\n // Inform the Store of the selected entry\n useEffect(() => {\n dataStore.selectedEntry.current = `${apiBase}:${entryId}`\n return () => { dataStore.selectedEntry.current = undefined }\n }, [dataStore, entryId])\n\n // Get the overview config\n const finalCards = useMemo(() => {\n const finalCards = cards || ui?.entry?.cards\n return finalCards || undefined\n }, [cards])\n\n const value = useMemo(() => ({entryId, cards: finalCards}), [entryId, finalCards])\n return \n {children}\n \n})\nEntryContext.propTypes = {\n entryId: PropTypes.string,\n cards: PropTypes.object,\n children: PropTypes.node\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useContext, useEffect, useMemo, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@material-ui/core/styles'\nimport {\n Box,\n Typography,\n Button\n} from '@material-ui/core'\nimport AssessmentIcon from '@material-ui/icons/Assessment'\nimport Icon from '@material-ui/core/Icon'\nimport {useApi} from '../api.js'\nimport { useErrors } from '../errors'\nimport { northBase } from '../../config'\n\nconst northToolContext = React.createContext()\n\nexport function useNorthTool() {\n return useContext(northToolContext)\n}\n\nconst launchButtonLabels = {\n 'stopped': 'Launch',\n 'starting': 'Launching...',\n 'running': 'Open',\n 'stopping': 'Launch'\n}\n\nconst stoppButtonLabels = {\n 'stopping': 'Stopping...',\n 'running': 'Stop'\n}\n\nconst LaunchButton = React.memo(function LaunchButton(props) {\n return \n \n \n \n \n \n browser.invalidateLanesFromIndex(lane.index)}>\n \n \n \n \n \n \n \n \n \n \n {\n editable &&\n \n
\n \n \n \n \n \n \n
\n
\n }\n {\n editable &&\n \n setOpenCreateDirDialog(true)}>\n \n \n \n \n setOpenCreateDirDialog(false)}\n >\n \n Name of new directory:\n {\n if (event.key === 'Enter') {\n handleCreateDir()\n }\n }}/>\n \n \n \n \n \n \n \n }\n {\n editable &&\n setOpenCopyMoveDialog(false)}\n >\n \n Copy/move {fileName}:\n \n \n \n \n \n \n \n \n }\n {\n editable &&\n \n setOpenConfirmDeleteDirDialog(true)}>\n \n \n \n \n setOpenConfirmDeleteDirDialog(false)}\n >\n \n Really delete the directory {path}?\n \n \n \n \n \n \n \n }\n \n }\n />\n \n {\n lane.adaptor.data.directory_metadata.map(element => (\n setFileName(element.name)}>\n \n {element.name}\n \n \n ))\n }\n \n \n \n )\n }\n}\nRawDirectoryContent.propTypes = {\n deploymentUrl: PropTypes.string.isRequired,\n uploadId: PropTypes.string.isRequired,\n path: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n highlightedItem: PropTypes.string,\n editable: PropTypes.bool.isRequired\n}\n\nexport class RawFileAdaptor extends Adaptor {\n /**\n * Constructs an adaptor for a file lane. Note, data is optional, if not provided it will\n * be fetched in initialize.\n */\n constructor(uploadUrl, data, editable) {\n super()\n const parsedUrl = parseNomadUrl(uploadUrl)\n if (parsedUrl.type !== refType.upload) throw new Error(`Expected an upload url, got ${uploadUrl}`)\n if (!parsedUrl.isResolved) throw new Error(`Absolute url required, got ${uploadUrl}`)\n this.deploymentUrl = parsedUrl.deploymentUrl\n this.uploadId = parsedUrl.uploadId\n this.path = parsedUrl.path\n this.data = data\n this.editable = editable\n this.dependencies = new Set([this.uploadId])\n }\n depends() {\n return this.dependencies\n }\n async initialize(api, dataStore) {\n this.dataStore = dataStore\n if (!this.data) {\n const response = await api.get(`uploads/${this.uploadId}/rawdir/${this.path}`)\n this.data = response.file_metadata\n }\n }\n async itemAdaptor(key) {\n if (key === 'archive') {\n const archiveUrl = createEntryUrl(this.deploymentUrl, this.uploadId, this.data.entry_id)\n const {archive} = await this.dataStore.getEntryAsync(this.deploymentUrl, this.data.entry_id, false, '*')\n const metainfo = await this.dataStore.getMetainfoAsync(systemMetainfoUrl)\n const rootSectionDef = metainfo.getEntryArchiveDefinition()\n return archiveAdaptorFactory(archiveUrl, archive, rootSectionDef)\n } else if (key === 'preview') {\n return new FilePreviewAdaptor(this.uploadId, this.path, this.data)\n }\n }\n render() {\n return \n }\n}\n\nclass FilePreviewAdaptor extends Adaptor {\n constructor(uploadId, path, data) {\n super()\n this.uploadId = uploadId\n this.path = path\n this.data = data\n }\n render() {\n return \n \n \n }\n}\n\nfunction RawFileContent({deploymentUrl, uploadId, path, data, editable}) {\n const entryPageMainFile = useEntryStore()?.metadata?.mainfile // Will be set if we're on an entry page\n const browser = useContext(browserContext)\n const lane = useContext(laneContext)\n const history = useHistory()\n const dataStore = useDataStore()\n const { api } = useApi()\n const { raiseError } = useErrors()\n const [openConfirmDeleteFileDialog, setOpenConfirmDeleteFileDialog] = useState(false)\n const encodedPath = urlEncodePath(path)\n const downloadUrl = `uploads/${uploadId}/raw/${encodedPath}?ignore_mime_type=true` // TODO: deploymentUrl need to be considered for external uploads\n const allNorthTools = useTools()\n const applicableNorthTools = useMemo(() => {\n if (!allNorthTools || typeof allNorthTools !== 'object' || Object.keys(allNorthTools).length < 1) {\n return []\n }\n const fileExtension = path.split('.').pop().toLowerCase()\n return Object.keys(allNorthTools)\n .filter(key => {\n const tool = allNorthTools[key]\n return tool?.file_extensions && tool.file_extensions.includes(fileExtension)\n })\n }, [allNorthTools, path])\n\n // If we are stepping into an archive, subscribe to the store for updates on this archive\n const archiveSelected = data.entry_id && lane.next?.key === 'archive'\n const entryStoreObj = useEntryStoreObj(archiveSelected ? deploymentUrl : null, data.entry_id, false, '*')\n\n // Invalidate subsequent lanes if the archive is updated\n useEffect(() => {\n if (entryStoreObj?.archive && lane.next?.adaptor?.obj) {\n if (entryStoreObj.archive !== lane.next.adaptor?.obj) {\n browser.invalidateLanesFromIndex(lane.index)\n }\n }\n }, [browser, lane, entryStoreObj])\n\n const handleDeleteFile = () => {\n setOpenConfirmDeleteFileDialog(false)\n api.delete(`/uploads/${uploadId}/raw/${encodedPath}`)\n .then(response => {\n if (path === entryPageMainFile) {\n // Deleting the main entry - go to upload overview page\n history.push(`/user/uploads/upload/id/${uploadId}`)\n } else {\n const gotoLane = lane.index > 0 ? lane.index - 1 : 0\n history.push(browser.lanes.current[gotoLane].path)\n }\n dataStore.updateUpload(deploymentUrl, uploadId, {upload: response.data})\n })\n .catch(raiseError)\n }\n\n // A nicer, human-readable size string\n let niceSize, unit, factor\n if (data.size > 1e9) {\n [unit, factor] = ['GB', 1e9]\n } else if (data.size > 1e6) {\n [unit, factor] = ['MB', 1e6]\n } else if (data.size > 1e3) {\n [unit, factor] = ['kB', 1e3]\n }\n if (unit) {\n if (data.size / factor > 100) {\n // No decimals\n niceSize = `${Math.round(data.size / factor)} ${unit} (${data.size} bytes)`\n } else {\n // One decimal\n niceSize = `${Math.round(data.size * 10 / factor) / 10} ${unit} (${data.size} bytes)`\n }\n } else {\n // Unit = bytes\n niceSize = `${data.size} bytes`\n }\n\n return (\n \n \n {data.entry_id && (\n \n \n \n \n \n )}\n \n \n \n \n \n {\n editable &&\n \n setOpenConfirmDeleteFileDialog(true)}>\n \n \n \n \n setOpenConfirmDeleteFileDialog(false)}\n >\n \n Really delete the file {data.name}?\n \n \n \n \n \n \n \n }\n \n }\n />\n \n \n {data.parser_name && (\n \n )}\n {data.entry_id && (\n \n )}\n \n \n {data.entry_id && (\n \n processed data\n \n )}\n \n preview\n \n {applicableNorthTools.length > 0 && (\n \n )}\n \n )\n}\nRawFileContent.propTypes = {\n deploymentUrl: PropTypes.string.isRequired,\n uploadId: PropTypes.string.isRequired,\n path: PropTypes.string.isRequired,\n data: PropTypes.object.isRequired,\n editable: PropTypes.bool.isRequired\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useRef, useLayoutEffect, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { FixedSizeGrid as Grid } from 'react-window'\nimport { Typography, makeStyles, Button, Grid as MuiGrid, Box } from '@material-ui/core'\nimport AutoSizer from 'react-virtualized-auto-sizer'\n\nexport function Number({value, exp, variant, unit, ...props}) {\n variant = variant || 'body2'\n exp = exp || 2\n const fixed = 5\n let html = '-'\n if (value !== undefined && value !== null) {\n if (typeof value === 'number') {\n const str = value.toExponential(exp)\n const [f, e] = str.split('e')\n if (e <= fixed && e >= -fixed) {\n html = value.toFixed(fixed).replace(/[.,]0*$/, '')\n } else {\n html = {f.toString().replace(/0*$/, '')}·10{e}\n }\n } else {\n html = value.toString()\n }\n }\n return {html}{unit &&  {unit}}\n}\nNumber.propTypes = ({\n value: PropTypes.any,\n variant: PropTypes.string,\n exp: PropTypes.number,\n unit: PropTypes.string\n})\n\nfunction MatrixPagination({length, page, onChange}) {\n return \n \n \n \n \n {page}\n \n \n \n \n \n}\nMatrixPagination.propTypes = ({\n length: PropTypes.number.isRequired,\n page: PropTypes.number.isRequired,\n onChange: PropTypes.func.isRequired\n})\n\nconst useMatrixStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'stretch',\n minWidth: 300,\n justifyContent: 'center'\n },\n leftBracket: {\n width: theme.spacing(1),\n border: 'solid 2px black',\n borderRight: 'none',\n marginRight: -theme.spacing(1)\n },\n matrix: {\n width: '100%'\n },\n rightBracket: {\n width: theme.spacing(1),\n border: 'solid 2px black',\n borderLeft: 'none',\n marginLeft: -theme.spacing(1)\n }\n}))\nexport function Matrix({values, shape, invert, type}) {\n const rootRef = useRef()\n const matrixRef = useRef()\n const [pages, setPages] = useState(new Array(Math.max(0, shape.length - 2)).fill(0))\n const pageLengths = []\n const classes = useMatrixStyles()\n\n let ii = 0\n for (let i = shape.length; i > 2; i--) {\n pageLengths.push(values.length)\n values = values[pages[ii++]]\n }\n\n const columnWidth = useRef(92)\n const rowHeight = 24\n const rowCount = invert ? values.length : shape.length > 1 ? values[0].length : 1\n const columnCount = invert ? shape.length > 1 ? values[0].length : 1 : values.length\n const height = Math.min(300, (rowCount - 1) * rowHeight + 24)\n\n useLayoutEffect(() => {\n if (type === 'str') {\n matrixRef.current.style.width = '100%'\n } else {\n matrixRef.current.style.width = `${rootRef.current.clientWidth - 4}px`\n }\n columnWidth.current = Math.max(92, (rootRef.current.clientWidth - 4) / columnCount)\n })\n\n let value = shape.length > 1 ? ({rowIndex, columnIndex}) => values[columnIndex][rowIndex] : ({columnIndex}) => values[columnIndex]\n if (invert) {\n value = shape.length > 1 ? ({rowIndex, columnIndex}) => values[rowIndex][columnIndex] : ({rowIndex}) => values[rowIndex]\n }\n\n return \n
\n
 
\n
\n \n {({width}) => (\n \n {({style, ...props}) => }\n \n )}\n \n
\n
 
\n
\n {pages.map((page, index) => \n setPages([...pages.slice(0, index), page, ...pages.slice(index + 1)])}\n />\n )}\n
\n}\nMatrix.propTypes = ({\n values: PropTypes.array.isRequired,\n shape: PropTypes.arrayOf(PropTypes.any).isRequired,\n invert: PropTypes.bool,\n type: PropTypes.string\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useEffect, useRef, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport { Typography } from '@material-ui/core'\nimport {\n Fullscreen,\n FullscreenExit,\n CameraAlt,\n Replay\n} from '@material-ui/icons'\nimport { BrillouinZoneViewer } from '@lauri-codes/materia'\nimport Floatable from './Floatable'\nimport NoData from './NoData'\nimport Placeholder from '../visualization/Placeholder'\nimport { scale, distance } from '../../utils'\nimport { withErrorHandler, withWebGLErrorHandler } from '../ErrorHandler'\nimport { Actions, Action } from '../Actions'\n\n/**\n * Interactive 3D Brillouin zone viewer based on the 'materia'-library.\n */\nexport const bzError = 'Could not load Brillouin zone.'\nconst fitMargin = 0.06\nconst useStyles = makeStyles((theme) => {\n return {\n root: {},\n column: {\n display: 'flex',\n width: '100%',\n height: '100%',\n flexDirection: 'column'\n },\n header: {\n paddingRight: theme.spacing(1),\n display: 'flex',\n flexDirection: 'row',\n zIndex: 1\n },\n canvas: {\n flex: 1,\n zIndex: 0,\n minHeight: 0, // added min-height: 0 to allow the item to shrink to fit inside the container.\n marginBottom: theme.spacing(2)\n }\n }\n})\nconst BrillouinZone = React.memo(({\n className,\n classes,\n data,\n captureName,\n 'data-testid': testID\n}) => {\n const [fullscreen, setFullscreen] = useState(false)\n const [loading, setLoading] = useState(true)\n const refViewer = useRef(null)\n const styles = useStyles(classes)\n\n // In order to properly detect changes in a reference, a reference callback is\n // used. This is the recommended way to monitor reference changes as a simple\n // useRef is not guaranteed to update:\n // https://reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-dom-node\n const refCanvas = useCallback(node => {\n if (node === null) {\n return\n }\n if (refViewer.current === null) {\n return\n }\n refViewer.current.changeHostElement(node)\n refViewer.current.fit(fitMargin)\n refViewer.current.render()\n }, [])\n\n // Run only on first render to initialize the viewer.\n const theme = useTheme()\n useEffect(() => {\n if (!data || refViewer.current) {\n return\n }\n refViewer.current = new BrillouinZoneViewer(undefined)\n }, [data])\n\n // Called only on first render to load the given structure.\n useEffect(() => {\n if (!data) {\n return\n }\n\n // Format data from section_k_band into the form used by the viewer\n const basis = scale(data.reciprocal_cell, 1E-10)\n const kpoints = []\n const segments = []\n const finalData = {\n basis: basis,\n kpoints: kpoints,\n segments: segments\n }\n let previousPoint\n let segment = []\n for (const seg of data.segment) {\n const labels = seg.endpoints_labels\n const start = seg.kpoints[0]\n const end = seg.kpoints.slice(-1)[0]\n if (!previousPoint || (previousPoint && distance(start, previousPoint) >= 1e-8)) {\n // Push old segment\n if (segment.length > 0) {\n segments.push(segment)\n }\n // Start new segment\n segment = []\n segment.push(start)\n if (labels !== undefined) {\n kpoints.push([labels[0], start])\n }\n }\n segment.push(end)\n if (labels !== undefined) {\n kpoints.push([labels[1], end])\n }\n previousPoint = end\n }\n // Push last segment\n segments.push(segment)\n\n const options = {\n basis: {\n font: 'Titillium Web,sans-serif',\n offset: 0.025,\n size: 0.04,\n a: { color: '#f44336' },\n b: { color: '#4caf50' },\n c: { color: '#5c6bc0' }\n },\n segments: {\n color: theme.palette.primary.main\n },\n faces: {\n outline: {\n width: 0.002\n }\n },\n kpoints: {\n label: {\n color: theme.palette.primary.main,\n font: 'Titillium Web,sans-serif',\n size: 0.035\n },\n point: {\n color: theme.palette.primary.main,\n size: 0.01\n }\n }\n }\n\n // Load data into viewer\n refViewer.current.load(finalData, options)\n refViewer.current.setRotation([1, 0, 0, 0])\n refViewer.current.align([\n ['up', 'a'],\n ['front', 'segments']\n ])\n refViewer.current.rotate([\n [0, 1, 0, 45],\n [1, 0, 0, 25]\n ])\n refViewer.current.controls({resetOnDoubleClick: false, pan: {enabled: false}})\n refViewer.current.fit(fitMargin)\n refViewer.current.render()\n refViewer.current.saveCameraReset()\n setLoading(false)\n }, [data, theme])\n\n const toggleFullscreen = useCallback(() => {\n setFullscreen(!fullscreen)\n }, [fullscreen])\n\n const takeScreencapture = useCallback(() => {\n refViewer.current.takeScreenShot(captureName)\n }, [captureName])\n\n const handleReset = useCallback(() => {\n refViewer.current.resetCamera()\n refViewer.current.fit(fitMargin)\n refViewer.current.render()\n }, [])\n\n // If data is set explicitly to false, we show the NoData component.\n if (data === false) {\n return \n }\n\n if (loading) {\n return \n }\n\n return \n
\n {fullscreen && Brillouin zone}\n
\n
\n \n \n \n \n \n {fullscreen ? : }\n \n \n \n \n \n
\n
\n \n})\n\nBrillouinZone.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.shape({\n reciprocal_cell: PropTypes.array.isRequired, // Reciprocal cell in SI units\n segment: PropTypes.array.isRequired // Array of section_k_band_segments in SI units\n }),\n PropTypes.oneOf([false, undefined]) // False for NoData, undefined for Placeholder\n ]),\n captureName: PropTypes.string, // Name of the file that the user can download\n classes: PropTypes.object,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\nBrillouinZone.defaultProps = {\n captureName: 'brillouin_zone'\n}\n\nexport default withWebGLErrorHandler(withErrorHandler(bzError)(BrillouinZone))\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useLayoutEffect, useMemo, useRef, useCallback, forwardRef, useImperativeHandle, useEffect} from 'react'\nimport PropTypes from 'prop-types'\nimport { useResizeDetector } from 'react-resize-detector'\nimport { isNil, isEmpty, cloneDeep } from 'lodash'\nimport { useHistory } from 'react-router-dom'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport {\n Typography,\n Box,\n Tooltip\n} from '@material-ui/core'\nimport {\n CameraAlt,\n Fullscreen,\n FullscreenExit,\n Replay,\n ViewList,\n Warning\n} from '@material-ui/icons'\nimport Floatable from '../visualization/Floatable'\nimport Placeholder from '../visualization/Placeholder'\nimport NoData from '../visualization/NoData'\nimport { Actions, Action } from '../Actions'\nimport Plotly from 'plotly.js-dist-min'\nimport clsx from 'clsx'\nimport { mergeObjects } from '../../utils'\n\n/**\n * Component that produces a highly customized Plotly.js graph. We are using the\n * vanilla JS Plotly library to achieve the most customizability.\n */\nconst useStyles = makeStyles((theme) => {\n return {\n root: {\n width: '100%',\n height: '100%',\n position: 'relative'\n },\n footer: {\n paddingRight: theme.spacing(1),\n display: 'flex',\n flexDirection: 'row',\n zIndex: 1\n },\n container: {\n position: 'relative',\n width: '100%',\n height: '100%'\n },\n content: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n display: 'flex',\n flexDirection: 'column'\n },\n canvasContainer: {\n flex: 1,\n minHeight: 0 // added min-height: 0 to allow the item to shrink to fit inside the container.\n },\n placeholderRoot: {\n left: 0,\n right: 0,\n position: 'absolute'\n },\n floatable: {\n width: '100%',\n height: '100%'\n },\n spacer: {\n flex: 1\n },\n warning: {\n color: theme.palette.warning.main,\n position: 'absolute',\n zIndex: 1,\n left: '2px',\n top: '20px'\n }\n }\n})\nconst Plot = React.memo(forwardRef(({\n data,\n layout,\n config,\n floatTitle,\n metaInfoLink,\n capture,\n fixedMargins,\n className,\n classes,\n placeHolderStyle,\n noDataStyle,\n warning,\n onRelayout,\n onRedraw,\n onRelayouting,\n onHover,\n onReset,\n onSelected,\n onSelecting,\n onDeselect,\n onClick,\n onWebglContextLost,\n layoutSubject,\n disableDefaultActions,\n actions,\n throttleResize,\n 'data-testid': testID\n}, canvas) => {\n const [float, setFloat] = useState(false)\n const theme = useTheme()\n const firstRender = useRef(true)\n const [ratio, setRatio] = useState(1)\n const [canvasNode, setCanvasNode] = useState()\n const attach = useRef()\n const [sizeReady, setSizeReady] = useState(false)\n const [loading, setLoading] = useState(true)\n const margins = useRef()\n const history = useHistory()\n const { height, width, ref } = useResizeDetector()\n const canvasSize = useRef({})\n const layoutRecoverRef = useRef()\n const resetInfo = useRef()\n\n // The image capture settings\n const captureSettings = useMemo(() => {\n const maxSize = 1280\n let width, height\n if (ratio > 1) {\n width = maxSize\n height = maxSize / ratio\n } else {\n width = maxSize * ratio\n height = maxSize\n }\n const defaultCapture = {\n format: 'png',\n width: width,\n height: height,\n filename: 'plot'\n }\n const settings = mergeObjects(capture, defaultCapture)\n return settings\n }, [capture, ratio])\n\n const styles = useStyles({classes: classes})\n if (noDataStyle) {\n styles.nodata = noDataStyle\n }\n if (placeHolderStyle) {\n styles.placeholder = placeHolderStyle\n }\n\n // This callback redraws the plot whenever the canvas element changes. In\n // order to properly detect changes in a reference, a reference callback is\n // used. This is the recommended way to monitor reference changes as a simple\n // useRef is not guaranteed to update:\n // https://reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-dom-node\n const canvasRef = useCallback(node => {\n if (node) {\n if (!firstRender.current) {\n attach.current = true\n // We use a dummy state to request a redraw on the new canvas\n setCanvasNode(node)\n }\n // We add a NATIVE wheel event handler that prevents the wheel events sent\n // by Plotly from bubbling up. Notice that the SyntheticEvents added by\n // React cannot be used, since they do not play well with the original\n // native events created by Plotly (in particular: SyntheticEvents are all\n // passive, so calling preventDefault on them will cause problems on\n // browsers that support passive events.)\n node.addEventListener('wheel', (e) => {\n e.preventDefault()\n e.stopPropagation()\n })\n }\n canvasRef.current = node\n }, [])\n\n // Set the final layout. It is a combination of a default layout, the layout\n // set by the user and some properties of the curretly used layout.\n const finalLayout = useMemo(() => {\n const withTitle = layout?.title?.text || layout?.template?.title?.text || layout?.annotations?.some(item => item?.text)\n const defaultLayout = {\n dragmode: 'pan',\n hovermode: false,\n showlegend: false,\n autosize: false,\n template: 'plotly_white',\n // There is extra space reserved for the top and bottom margins so that\n // automargin does not make the plot jump around too much.\n margin: {\n l: theme.spacing(4),\n r: theme.spacing(1.5),\n t: theme.spacing(withTitle ? 5 : 1),\n b: theme.spacing(6)\n },\n title: {\n font: {\n family: theme.typography.fontFamily\n },\n yanchor: 'middle'\n },\n legend: {\n bgcolor: 'rgba(255, 255, 255, 0.9)',\n font: {\n family: theme.typography.fontFamily,\n size: 14\n }\n },\n xaxis: {\n automargin: false,\n autorange: true,\n linecolor: '#333',\n linewidth: 1,\n mirror: true,\n ticks: 'outside',\n showline: true,\n fixedrange: true,\n title: {\n standoff: 10,\n font: {\n family: theme.typography.fontFamily,\n size: 16,\n color: '#333'\n },\n tickfont: {\n family: theme.typography.fontFamily,\n size: 14,\n color: '#333'\n }\n }\n },\n yaxis: {\n automargin: true,\n autorange: true,\n linecolor: '#333',\n linewidth: 1,\n mirror: true,\n ticks: 'outside',\n showline: true,\n title: {\n standoff: 10,\n font: {\n family: theme.typography.fontFamily,\n size: 16,\n color: '#333'\n }\n },\n tickfont: {\n family: 'Titillium Web,sans-serif',\n size: 14,\n color: '#333'\n }\n },\n yaxis2: {\n automargin: true,\n autorange: true,\n linecolor: '#333',\n linewidth: 1,\n mirror: true,\n ticks: 'outside',\n showline: true,\n title: {\n standoff: 8,\n font: {\n family: 'Titillium Web,sans-serif',\n size: 16,\n color: '#333'\n }\n },\n tickfont: {\n family: 'Titillium Web,sans-serif',\n size: 14,\n color: '#333'\n }\n }\n }\n const newLayout = mergeObjects(layout, defaultLayout)\n return newLayout\n }, [layout, theme])\n\n // Set the final config\n const finalConfig = useMemo(() => {\n const defaultConfig = {\n scrollZoom: true,\n displayModeBar: false,\n showTips: false,\n responsive: true\n }\n return mergeObjects(config, defaultConfig)\n }, [config])\n\n // Saves reset options according to the given layout.\n useEffect(() => {\n resetInfo.current = {\n rangeX: finalLayout?.xaxis?.range,\n rangeY: finalLayout?.yaxis?.range,\n rangeY2: finalLayout?.yaxis2?.range,\n margin: finalLayout?.margin\n }\n }, [finalLayout])\n\n // Used to get the currently active layout. Because of Floatable, the plot\n // layout is lost upon the plot being put on another div. This is why we need\n // a backup that is stored when the final plot config is ready. Notice that we\n // have to keep parts of the old layout, as it stores e.g. range etc. that\n // need to be persistent.\n const getLayout = useCallback((update) => {\n const oldLayout = cloneDeep(canvasRef.current.layout || layoutRecoverRef.current || {})\n if (!oldLayout.xaxis) oldLayout.xaxis = {}\n if (!oldLayout.yaxis) oldLayout.yaxis = {}\n if (!oldLayout.yaxis2) oldLayout.yaxis2 = {}\n const newLayout = mergeObjects(update, oldLayout)\n // When fixed margins are set, the margins should be automatically set and\n // then fixed in a secondary update.\n if (fixedMargins) {\n newLayout.xaxis.automargin = true\n newLayout.yaxis.automargin = true\n newLayout.yaxis2.automargin = true\n newLayout.margin = resetInfo.current.margin\n }\n // The current size overrides any size that is set\n newLayout.width = canvasSize.current?.width || newLayout.width\n newLayout.height = canvasSize.current?.height || newLayout.height\n // The range from updated layout should be used if it's set, otherwise use\n // old range.\n if (isEmpty(newLayout.xaxis.range)) newLayout.xaxis.range = oldLayout.xaxis.range\n if (isEmpty(newLayout.yaxis.range)) newLayout.yaxis.range = oldLayout.yaxis.range\n if (isEmpty(newLayout.yaxis2.range)) newLayout.yaxis2.range = oldLayout.yaxis2.range\n return newLayout\n }, [canvasRef, fixedMargins])\n\n // If fixedMargins = true, captures the automatically set margin value from\n // the plot and performs a layout update that fixes them.\n const fixMargins = useCallback(() => {\n if (fixedMargins && canvasRef.current) {\n try {\n // Get the element which explicitly stores the computed margin and\n // perform a relayout with these values.\n const currentLayout = cloneDeep(canvasRef.current.layout)\n currentLayout.xaxis.automargin = false\n currentLayout.yaxis.automargin = false\n currentLayout.yaxis2.automargin = false\n if (!currentLayout.margin) currentLayout.margin = {}\n const subPlots = canvasRef.current.children[0].children[0].children[0].children[2].children\n let [xMin, xMax] = [undefined, undefined]\n for (const subPlot of subPlots) {\n const canvas = subPlot.children[0]\n const left = parseInt(canvas.getAttribute('x'))\n const right = left + parseInt(canvas.getAttribute('width'))\n xMin = !xMin || left < xMin ? left : xMin\n xMax = !xMax || right > xMax ? right : xMax\n }\n const totalWidth = canvasRef.current.clientWidth\n currentLayout.margin.l = xMin\n currentLayout.margin.r = totalWidth - xMax\n margins.current = cloneDeep(currentLayout.margin)\n Plotly.relayout(canvasRef.current, currentLayout)\n } catch (e) {\n console.log('Could not determine the margin values.', e)\n }\n }\n }, [canvasRef, fixedMargins])\n\n // Handle canvas resize\n useLayoutEffect(() => {\n if (width && height) {\n setRatio(width / height)\n canvasSize.current = {width, height}\n if (firstRender.current) {\n setSizeReady(true)\n } else {\n // The updates are throttled by using requestAnimationFrame: there is no\n // sense in trying to update beyond what the browser can render TODO:\n // Ideally we would not need to call fixMargins here, as a simple resize\n // should not trigger any change in the margins. The call is curently\n // necesary due to the way the plot updates when going fullscreen:\n // without fixmargins the view is jumbled.\n const layout = getLayout()\n if (throttleResize) {\n window.requestAnimationFrame(() => {\n // Notice that fixMargins has to be done within this callback\n // together with the relayout\n Plotly.relayout(canvasRef.current, layout)\n fixMargins()\n })\n } else {\n Plotly.relayout(canvasRef.current, layout)\n fixMargins()\n }\n }\n }\n }, [canvasRef, width, height, throttleResize, fixMargins, getLayout])\n\n // Update plots when data, config or rendering canvas is updated.\n // useLayoutEffect is used so that React rendering and Plotly rendering are\n // synced.\n useLayoutEffect(() => {\n if (!data || !sizeReady) {\n if (data === false) setLoading(false)\n return\n }\n // The plot is created on the first render\n const layout = getLayout(finalLayout)\n if (firstRender.current) {\n Plotly.newPlot(canvasRef.current, data, layout, finalConfig)\n attach.current = true\n firstRender.current = false\n\n // Subscribe to the layout change publisher if one is given\n if (layoutSubject) {\n layoutSubject.subscribe(layout => {\n // The updates are throttled by using requestAnimationFrame: there is\n // no sense in trying to update beyond what the browser can render\n const newLayout = mergeObjects(layout, canvasRef.current.layout)\n window.requestAnimationFrame(() => {\n Plotly.relayout(canvasRef.current, newLayout)\n })\n })\n }\n setLoading(false)\n // On subsequent updates to data or layout, we call Plotly.react to update\n // the plot.\n } else {\n Plotly.react(canvasRef.current, data, layout, finalConfig)\n }\n\n fixMargins()\n\n // Upon first render or changing the plot DOM element the events are (re-)attached.\n if (attach.current === true) {\n if (onRelayouting) {\n canvasRef.current.on('plotly_relayouting', onRelayouting)\n }\n if (onRedraw) {\n canvasRef.current.on('plotly_redraw', onRedraw)\n }\n if (onRelayout) {\n canvasRef.current.on('plotly_relayout', onRelayout)\n }\n if (onHover) {\n canvasRef.current.on('plotly_hover', onHover)\n }\n if (onSelected) {\n canvasRef.current.on('plotly_selected', onSelected)\n }\n if (onSelecting) {\n canvasRef.current.on('plotly_selecting', onSelecting)\n }\n if (onDeselect) {\n canvasRef.current.on('plotly_deselect', onDeselect)\n }\n if (onClick) {\n canvasRef.current.on('plotly_click', onClick)\n }\n if (onWebglContextLost) {\n canvasRef.current.on('plotly_webglcontextlost', onWebglContextLost)\n }\n attach.current = false\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [layoutSubject, fixedMargins, canvasNode, firstRender, data, finalConfig, finalLayout, sizeReady, canvasRef, onRelayout, onRelayouting, fixMargins, getLayout])\n\n // If the callbacks change, we need to update them in the canvas as well.\n // TODO: Do this for other callbacks as well.\n useEffect(() => {\n if (onSelected && canvasRef?.current?.on) {\n canvasRef.current.on('plotly_selected', onSelected)\n }\n }, [onSelected, canvasRef])\n\n // For resetting the view.\n const handleReset = useCallback(() => {\n if (canvasRef?.current) {\n // If a fixed range was set in the original layout, use it. Otherwise\n // autorange the view.\n const hasX = !isNil(resetInfo.current.rangeX)\n const hasY = !isNil(resetInfo.current.rangeY)\n const hasY2 = !isNil(resetInfo.current.rangeY2)\n const oldLayout = getLayout()\n const layout = {\n ...oldLayout,\n xaxis: {...oldLayout.xaxis, autorange: !hasX, range: hasX ? [...resetInfo.current.rangeX] : oldLayout.xaxis.range},\n yaxis: {...oldLayout.yaxis, autorange: !hasY, range: hasY ? [...resetInfo.current.rangeY] : oldLayout.yaxis.range},\n yaxis2: {...oldLayout.yaxis2, autorange: !hasY2, range: hasY2 ? [...resetInfo.current.rangeY2] : oldLayout.yaxis2.range}\n }\n Plotly.relayout(canvasRef.current, layout)\n fixMargins()\n onReset && onReset()\n }\n }, [canvasRef, onReset, fixMargins, getLayout])\n\n // Saves the current layout for recovering the plot\n const saveLayout = useCallback(() => {\n layoutRecoverRef.current = cloneDeep(canvasRef?.current?.layout)\n }, [canvasRef])\n\n // Handles float change\n const handleFloat = useCallback(() => {\n saveLayout()\n setFloat(!float)\n }, [float, saveLayout])\n\n // Handles plot capturing\n const handleCapture = useCallback(() => {\n Plotly.downloadImage(canvasRef.current, captureSettings)\n }, [canvasRef, captureSettings])\n\n // Listen to keyboard events to deselect.\n useEffect(() => {\n function handleDeselect(event) {\n if (['Escape', 'Delete'].includes(event.key)) {\n const layout = canvasRef.current.layout\n delete layout.selections\n const data = canvasRef.current.data\n data.forEach(element => {\n delete element.selectedpoints\n })\n Plotly.react(canvasRef.current, data, layout)\n onDeselect && onDeselect()\n }\n }\n window.addEventListener('keydown', handleDeselect)\n return () => window.removeEventListener('keydown', handleDeselect)\n }, [canvasRef, onDeselect])\n\n useImperativeHandle(canvas, () => ({\n reset() {\n handleReset()\n },\n toggleFullscreen() {\n handleFloat()\n },\n capture() {\n handleCapture()\n },\n saveLayout() {\n saveLayout()\n },\n relayout(callback) {\n if (canvasRef.current?.layout) {\n const newLayout = callback(canvasRef.current.layout)\n Plotly.relayout(canvasRef.current, newLayout)\n }\n }\n }))\n\n // Decides the possible overlay to display\n const overlay = useMemo(() => {\n if (loading) {\n return \n } else if (data === false) {\n return \n }\n return null\n }, [loading, data, styles, placeHolderStyle, testID])\n\n // Determine the final list of actions to show\n const allActions = useMemo(() => {\n const defaultActions = disableDefaultActions\n ? null\n : <>\n \n \n \n \n {float ? : }\n \n \n \n \n {metaInfoLink && { history.push(metaInfoLink) }}>\n \n }\n \n return (defaultActions || actions)\n ?
\n {defaultActions}{actions}\n
\n : null\n }, [actions, disableDefaultActions, float, handleCapture, handleFloat, handleReset, history, metaInfoLink, styles])\n\n // Even if the plots are still loading, all the html elements need to be\n // placed in the DOM. During loading, they are placed underneath the\n // placeholder with visibility=hidden. This way Plotly still has access to\n // these HTML nodes and their sizes when the plots are loading.\n return \n \n
\n {/* Overlay that is displayed on top of the viewer */}\n
\n {overlay}\n
\n {/* This contains the actual visualization. Needs to be always in the DOM so we can\n load the structure into it properly. */}\n \n {float && {floatTitle}}\n
\n {/* Note that we need to apply \"style\" to the canvas instead of \"className\" */}\n
\n {warning && \n \n }\n
\n
\n {allActions}\n
\n
\n \n \n}))\n\nPlot.propTypes = {\n data: PropTypes.any, // Plotly.js data object: Set to null to show Placeholder, set to false to show NoData.\n layout: PropTypes.object, // Plotly.js layout object. Notice that all the fields that are set in this object will be updated.\n config: PropTypes.object, // Plotly.js config object\n capture: PropTypes.object, // Capture settings\n fixedMargins: PropTypes.bool, // When enabled, the margins are not updated upon pan/scroll. This makes the interaction smoother.\n className: PropTypes.string,\n classes: PropTypes.object,\n placeHolderStyle: PropTypes.string, // The CSS class to apply for the Placeholder component.\n noDataStyle: PropTypes.string, // The CSS class to apply for the NoData component.\n floatTitle: PropTypes.string, // The title of the plot shown in floating mode\n metaInfoLink: PropTypes.string, // A link to the metainfo definition\n warning: PropTypes.string, // Optional message displayed under a warning icon on the top-left corner of the element.\n onRelayout: PropTypes.func,\n onRedraw: PropTypes.func,\n onRelayouting: PropTypes.func,\n onHover: PropTypes.func,\n onReset: PropTypes.func,\n onSelected: PropTypes.func,\n onSelecting: PropTypes.func,\n onDeselect: PropTypes.func,\n onClick: PropTypes.func,\n disableDefaultActions: PropTypes.bool, // Whether to show the default plot actions.\n actions: PropTypes.node, // Additional actions.\n onWebglContextLost: PropTypes.func,\n throttleResize: PropTypes.bool, // Whether to throttle resize using requestAnimationFrame\n /**\n * A RxJS Subject for efficient, non-persistent, layout changes that bypass\n * rendering of the component. Should send messages that contain the new\n * layout object.\n */\n layoutSubject: PropTypes.any,\n 'data-testid': PropTypes.string,\n showOptions: PropTypes.bool,\n onClickOptions: PropTypes.func\n}\nPlot.defaultProps = {\n floatTitle: '',\n fixedMargins: true, // If set to true, the margins will be fixed after first render.\n throttleResize: false\n}\n\nexport default Plot\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useEffect, useMemo} from 'react'\nimport PropTypes from 'prop-types'\nimport { isFinite } from 'lodash'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { add, distance, mergeObjects } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { withErrorHandler } from '../ErrorHandler'\nimport { msgNormalizationWarning } from '../../config'\nimport { getLineStyles } from '../plotting/common'\n\nconst BandStructure = React.memo(({\n data,\n layout,\n className,\n units,\n type,\n ...other\n}) => {\n const [finalData, setFinalData] = useState(!data ? data : undefined)\n const [pathSegments, setPathSegments] = useState(undefined)\n const energyUnit = useMemo(() => new Unit('joule'), [])\n const theme = useTheme()\n\n // Determine the energy reference and normalization\n const energyHighestOccupiedNormalized = useMemo(() => {\n if (!data) {\n return [[undefined, undefined]]\n }\n if (type === 'vibrational') {\n return [[0, true]]\n } else {\n return data.map(d => {\n if (!isFinite(d.energy_highest_occupied)) {\n return [0, false]\n } else {\n return [new Quantity(d.energy_highest_occupied, energyUnit).toSystem(units).value(), true]\n }\n })\n }\n }, [data, energyUnit, units, type])\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff as a side effect, the first render containing\n // the placeholders etc. can be done as fast as possible.\n useEffect(() => {\n if (!data) {\n setFinalData(data)\n return\n }\n\n const energyName = 'energies'\n const kpointName = 'kpoints'\n const plotData = []\n const channels = data.map(d => d.segment[0][energyName].length)\n const lines = getLineStyles(channels.reduce((a, b) => a + b, 0), null, channels.length > 0 ? channels[0] : null).values()\n data.forEach((d, n) => {\n const nChannels = d.segment[0][energyName].length\n const nBands = d.segment[0][energyName][0][0].length\n\n // Calculate distances in k-space if missing. These distances in k-space\n // define the plot x-axis spacing.\n const tempSegments = []\n if (d.segment[0].k_path_distances === undefined) {\n let length = 0\n for (const segment of d.segment) {\n const k_path_distances = []\n const nKPoints = segment[energyName][0].length\n const start = segment[kpointName][0]\n const end = segment[kpointName].slice(-1)[0]\n const segmentLength = distance(start, end)\n for (let iKPoint = 0; iKPoint < nKPoints; ++iKPoint) {\n const kPoint = segment[kpointName][iKPoint]\n const dist = distance(start, kPoint)\n k_path_distances.push(length + dist)\n }\n length += segmentLength\n segment.k_path_distances = k_path_distances\n tempSegments.push(k_path_distances)\n }\n } else {\n for (const segment of d.segment) {\n tempSegments.push(segment.k_path_distances)\n }\n }\n setPathSegments(tempSegments)\n\n // Path\n let path = []\n for (const segment of d.segment) {\n path = path.concat(segment.k_path_distances)\n tempSegments.push(segment.k_path_distances)\n }\n\n // we assign first for spin up\n const lineUp = lines.next().value\n // Second spin channel\n if (nChannels === 2) {\n const line = lines.next().value\n const bands = []\n for (let iBand = 0; iBand < nBands; ++iBand) {\n bands.push([])\n }\n for (const segment of d.segment) {\n for (let iBand = 0; iBand < nBands; ++iBand) {\n const nKPoints = segment[energyName][1].length\n for (let iKPoint = 0; iKPoint < nKPoints; ++iKPoint) {\n bands[iBand].push(segment[energyName][1][iKPoint][iBand])\n }\n }\n }\n\n // Create plot data entry for each band\n for (let band of bands) {\n band = new Quantity(band, energyUnit).toSystem(units).value()\n if (energyHighestOccupiedNormalized[n][0] !== 0) {\n band = add(band, -energyHighestOccupiedNormalized[n][0])\n }\n plotData.push(\n {\n x: path,\n y: band,\n type: 'scatter',\n mode: 'lines',\n showlegend: false,\n legendgroup: d.name,\n line: line\n }\n )\n }\n }\n\n // First spin channel\n const bands = []\n for (let iBand = 0; iBand < nBands; ++iBand) {\n bands.push([])\n }\n for (const segment of d.segment) {\n for (let iBand = 0; iBand < nBands; ++iBand) {\n const nKPoints = segment[energyName][0].length\n for (let iKPoint = 0; iKPoint < nKPoints; ++iKPoint) {\n bands[iBand].push(segment[energyName][0][iKPoint][iBand])\n }\n }\n path = path.concat(segment.k_path_distances)\n }\n\n // Create plot data entry for each band\n for (let [nBand, band] of bands.entries()) {\n band = new Quantity(band, energyUnit).toSystem(units).value()\n if (energyHighestOccupiedNormalized[n][0] !== 0) {\n band = add(band, -energyHighestOccupiedNormalized[n][0])\n }\n plotData.push(\n {\n x: path,\n y: band,\n name: d.name,\n type: 'scatter',\n mode: 'lines',\n showlegend: nBand === 0 && d.name !== undefined,\n legendgroup: d.name,\n line: lineUp\n }\n )\n }\n\n // Normalization line\n if (type !== 'vibrational' && energyHighestOccupiedNormalized[0][1] && n === data.length - 1) {\n plotData.push({\n x: [path[0], path[path.length - 1]],\n y: [0, 0],\n name: 'Highest occupied',\n showlegend: true,\n type: 'line',\n mode: 'lines',\n line: {\n color: '#000',\n width: 1\n }\n })\n }\n })\n\n setFinalData(plotData)\n }, [data, theme, units, energyUnit, type, energyHighestOccupiedNormalized])\n\n // Merge custom layout with default layout\n const tmpLayout = useMemo(() => {\n const defaultLayout = {\n xaxis: {\n tickangle: 0,\n tickfont: {\n size: 14\n },\n zeroline: false\n },\n yaxis: {\n title: {\n text: `Energy (${energyUnit.toSystem(units).label()})`\n },\n zeroline: type === 'vibrational'\n },\n title: {\n text: {\n text: 'Band structure'\n }\n },\n showlegend: true,\n legend: {\n x: 1,\n y: 0,\n xanchor: 'right',\n yanchor: 'bottom',\n font: {\n size: 13\n }\n }\n }\n return mergeObjects(layout, defaultLayout)\n }, [layout, type, energyUnit, units])\n\n // Compute layout that depends on data.\n const computedLayout = useMemo(() => {\n if (data === undefined || data === false || pathSegments === undefined) {\n return {}\n }\n // Set new layout that contains the segment labels\n const labels = []\n const labelKPoints = []\n for (let iSegment = 0; iSegment < data[0].segment.length; ++iSegment) {\n const segment = data[0].segment[iSegment]\n const startLabel = segment.endpoints_labels\n ? segment.endpoints_labels[0]\n : ''\n if (iSegment === 0) {\n labels.push(startLabel)\n labelKPoints.push(pathSegments[iSegment][0])\n } else {\n const prevLabel = labels[labels.length - 1]\n if (prevLabel !== startLabel) {\n labels[labels.length - 1] = `${prevLabel}|${startLabel}`\n }\n }\n const endLabel = segment.endpoints_labels\n ? segment.endpoints_labels[1]\n : ''\n labels.push(endLabel)\n labelKPoints.push(pathSegments[iSegment].slice(-1)[0])\n }\n\n const shapes = []\n for (let iShape = 1; iShape < labelKPoints.length - 1; ++iShape) {\n const labelKPoint = labelKPoints[iShape]\n shapes.push({\n type: 'line',\n x0: labelKPoint,\n y0: 0,\n x1: labelKPoint,\n y1: 1,\n yref: 'paper',\n line: {\n color: '#999',\n width: 1,\n dash: '10px,10px'\n }\n })\n }\n const ticks = {\n shapes: shapes,\n xaxis: {\n tickmode: 'array',\n tickvals: labelKPoints,\n ticktext: labels\n }\n }\n return ticks\n }, [data, pathSegments])\n\n // Merge the given layout and layout computed from data\n const finalLayout = useMemo(() => {\n return mergeObjects(computedLayout, tmpLayout)\n }, [computedLayout, tmpLayout])\n\n return \n \n})\n\nBandStructure.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.bool, // Set to False to show NoData component\n PropTypes.arrayOf(PropTypes.shape({\n segment: PropTypes.array.isRequired, // Array of segments in SI units\n energy_highest_occupied: PropTypes.number, // Highest occupied energy.\n m_path: PropTypes.string // Path of the section containing the data in the Archive\n }))\n ]),\n layout: PropTypes.object,\n className: PropTypes.string,\n units: PropTypes.object, // Contains the unit configuration\n type: PropTypes.string // Type of band structure: electronic or vibrational\n}\nBandStructure.defaultProps = {\n type: 'electronic'\n}\n\nexport default withErrorHandler('Could not load band structure.')(BandStructure)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useEffect, useMemo, useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme } from '@material-ui/core/styles'\nimport { Box, Checkbox, Menu, MenuItem, FormControlLabel } from '@material-ui/core'\nimport { MoreVert } from '@material-ui/icons'\nimport Plot from '../plotting/Plot'\nimport { mergeObjects } from '../../utils'\nimport { getLineStyles } from '../plotting/common'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport { withErrorHandler } from '../ErrorHandler'\nimport { Action } from '../Actions'\n\nconst energyUnit = new Unit('joule')\n\n/**\n * Graph for Spectra data.\n */\nexport const spectraError = 'Could not load Spectra.'\nconst Spectra = React.memo(({\n data,\n layout,\n className,\n 'data-testid': testID,\n ...other\n}) => {\n const [finalData, setFinalData] = useState(!data ? data : undefined)\n const theme = useTheme()\n const {units} = useUnitContext()\n const [anchorEl, setAnchorEl] = React.useState(null)\n const [spectraNormalize, setSpectraNormalize] = useState(true)\n\n // Merge custom layout with default layout\n const tmpLayout = useMemo(() => {\n if (data === undefined) {\n return\n }\n const defaultLayout = {\n showlegend: true,\n legend: {\n x: 1,\n y: 1,\n xanchor: 'right',\n yanchor: 'top'\n },\n yaxis: {\n title: {\n text: 'Intensities (a.u.)'\n }\n },\n xaxis: {\n title: {\n text: `Excitation energies (${energyUnit.toSystem(units).label()})`\n }\n }\n }\n return mergeObjects(layout, defaultLayout)\n }, [layout, units, data])\n\n // Get the maximum intensity to normalize in the checkbox\n const maximumIntensity = useMemo(() => {\n if (!data) return undefined\n const maxes = data.map(trace => Math.max(...trace.intensities))\n return Math.max(...maxes)\n }, [data])\n\n // The plotted data is loaded only after the first render as a side effect to\n // avoid freezing the UI\n useEffect(() => {\n if (!data) {\n setFinalData(data)\n return\n }\n\n // Normalizing spectra\n const plotData = []\n const lineStyles = getLineStyles(data.length, theme)\n if (maximumIntensity !== undefined) {\n for (let i = 0; i < data.length; ++i) {\n const trace = data[i]\n const energies = new Quantity(trace.energies, energyUnit).toSystem(units).value()\n const intensities = spectraNormalize\n ? trace.intensities.map((intensity) => intensity / maximumIntensity)\n : trace.intensities\n plotData.push(\n {\n x: energies,\n y: intensities,\n name: `${data[i].label} ${i}`,\n type: 'scatter',\n mode: 'lines',\n line: lineStyles[i]\n }\n )\n }\n }\n setFinalData(plotData)\n }, [data, theme, units, spectraNormalize, maximumIntensity])\n\n const open = Boolean(anchorEl)\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n const closeMenu = useCallback(() => {\n setAnchorEl(null)\n }, [])\n\n return \n \n \n \n \n }\n {...other}\n >\n \n \n \n {\n setSpectraNormalize(!spectraNormalize)\n }}\n color=\"primary\"\n checked={spectraNormalize}\n />\n }\n label='Normalize intensities'\n />\n \n \n \n \n})\n\nSpectra.propTypes = {\n data: PropTypes.arrayOf(PropTypes.shape({\n type: PropTypes.string,\n label: PropTypes.string,\n intensities: PropTypes.arrayOf(PropTypes.number),\n energies: PropTypes.arrayOf(PropTypes.number)\n })),\n layout: PropTypes.object,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\nSpectra.defaultProps = {\n 'data-testid': 'spectra'\n}\n\nexport default withErrorHandler(spectraError)(Spectra)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useEffect, useState, useMemo, useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme } from '@material-ui/core/styles'\nimport { MoreVert } from '@material-ui/icons'\nimport Plot from '../plotting/Plot'\nimport { add, mergeObjects, resolveInternalRef } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport { withErrorHandler } from '../ErrorHandler'\nimport { Action } from '../Actions'\nimport { msgNormalizationWarning } from '../../config'\nimport { getLineStyles } from '../plotting/common'\nimport { Checkbox, Menu, MenuItem, FormControlLabel } from '@material-ui/core'\n\nconst energyUnit = new Unit('joule')\nconst valueUnit = new Unit('1/joule')\n\nconst DOS = React.memo(({\n data,\n layout,\n className,\n type,\n 'data-testid': testID,\n ...other\n}) => {\n const {units} = useUnitContext()\n\n // Merge custom layout with default layout\n const initialLayout = useMemo(() => {\n const defaultLayout = {\n xaxis: {\n showexponent: 'first',\n autorange: false,\n zeroline: type === 'vibrational'\n },\n showlegend: true,\n legend: {\n x: 1,\n xanchor: 'right',\n yanchor: 'bottom',\n y: 0\n }\n }\n return mergeObjects(layout, defaultLayout)\n }, [layout, type])\n\n const [finalData, setFinalData] = useState(!data ? data : undefined)\n const [finalLayout, setFinalLayout] = useState(initialLayout)\n const [normalizedToHOE, setNormalizedToHOE] = useState(true)\n const theme = useTheme()\n const [dosNormalize, setDosNormalize] = useState(false)\n const [anchorEl, setAnchorEl] = React.useState(null)\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n if (!data) {\n setFinalData(data)\n return\n }\n\n // Create the final data that will be plotted.\n const version = data.length > 0 ? data[0].version : undefined\n const processedData = version === 'new'\n ? processNewDosData(data, units, initialLayout, normalizedToHOE, theme, type, dosNormalize)\n : processOldDosData(data, units, initialLayout, normalizedToHOE, theme, type, dosNormalize)\n\n if (processedData) {\n setFinalData(processedData.finalData)\n setFinalLayout(processedData.finalLayout)\n setNormalizedToHOE(processedData.normalized)\n }\n }, [data, units, initialLayout, normalizedToHOE, theme, type, dosNormalize])\n\n const open = Boolean(anchorEl)\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n const closeMenu = useCallback(() => {\n setAnchorEl(null)\n }, [])\n\n return <>\n \n \n \n }\n {...other}\n >\n \n \n \n {\n setDosNormalize(data[0].normalization_factors ? (dosNormalize) => !dosNormalize : false)\n }}\n color=\"primary\"\n checked={dosNormalize}\n disabled={!data?.[0]?.normalization_factors || data[0].normalization_factors.every(value => value === undefined)}\n />\n }\n label='Normalize intensities'\n />\n \n \n \n})\n\nDOS.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.bool, // Set to False to show NoData component\n PropTypes.arrayOf(PropTypes.shape({\n energies: PropTypes.array.isRequired, // DOS energies array\n densities: PropTypes.array.isRequired, // DOS values array\n energy_highest_occupied: PropTypes.number, // Highest occupied energy.\n m_path: PropTypes.string, // Path of the section containing the data in the Archive\n label: PropTypes.string // Label of the data\n }))\n ]),\n layout: PropTypes.object,\n className: PropTypes.string,\n type: PropTypes.string, // Type of band structure: electronic or vibrational\n 'data-testid': PropTypes.string\n}\n\nDOS.defaultProps = {\n type: 'electronic'\n}\n\nexport default withErrorHandler('Could not load density of states.')(DOS)\n\n/**\n * Given index and archive, resolves the data for plotting the DOS.\n */\nexport function resolveDosNew(properties, archive, pattern) {\n // Return undefined if property not available\n if (!properties.has('dos_electronic_new')) return false\n\n // Resolve the final data once archive is here\n let dosReferences = archive?.results?.properties?.electronic?.dos_electronic_new || []\n if (!Array.isArray(dosReferences)) dosReferences = [dosReferences]\n const dos = []\n for (const reference of dosReferences) {\n if (reference.spin_polarized && reference.data.length !== 2) break\n const d = {\n energies: [],\n densities: [],\n normalization_factors: [],\n energy_highest_occupied: [],\n version: 'new'\n }\n d.name = reference.label\n d.spin_polarized = reference.spin_polarized\n for (const data of reference.data) {\n const match = data.energies.match(pattern)\n const path = match ? match[2] : data.energies\n const totalMatch = data.total.match(pattern)\n const totalPath = match ? totalMatch[2] : data.total\n const sourceArchive = match ? (archive.m_ref_archives[match[1]] || archive.m_ref_archives[data.energies.split('#')[0]]) : archive\n if (sourceArchive) {\n d.energies.push(resolveInternalRef(path, sourceArchive))\n const internalRef = resolveInternalRef(totalPath, sourceArchive)\n d.densities.push(internalRef.value)\n d.normalization_factors.push(internalRef.normalization_factor)\n }\n if (data.energy_ref) {\n d.energy_highest_occupied.push(data.energy_ref)\n }\n d.m_path = `${archive?.metadata?.entry_id}/data/results/properties/electronic/dos_electronic_new`\n }\n if (d.energies && d.densities) dos.push(d)\n }\n return dos.length === 0 ? false : dos\n}\n\n/**\n * Given index and archive, resolves the data for plotting the old DOS. This will eventually\n * be deprecated and fully replaced with resolveDosNew().\n */\nexport function resolveDosOld(properties, archive, pattern) {\n // Return undefined if property not available\n if (!properties.has('dos_electronic')) return false\n\n // Resolve the final data once archive is here\n let dosReferences = archive?.results?.properties?.electronic?.dos_electronic || []\n if (!Array.isArray(dosReferences)) dosReferences = [dosReferences]\n const dos = []\n for (const reference of dosReferences) {\n const d = {version: 'old'}\n const match = reference.energies.match(pattern)\n const path = match ? match[2] : reference.energies\n const totalPath = match ? reference.total.map(ref => ref.match(pattern)[2]) : reference.total\n const sourceArchive = match ? (archive.m_ref_archives[match[1]] || archive.m_ref_archives[reference.energies.split('#')[0]]) : archive\n if (sourceArchive) {\n d.energies = resolveInternalRef(path, sourceArchive)\n const internalRef = resolveInternalRef(totalPath, sourceArchive)\n d.densities = internalRef.map(dos => dos.value)\n d.normalization_factors = internalRef.map(dos => dos.normalization_factor)\n }\n d.name = reference.label\n if (reference.band_gap) {\n d.energy_highest_occupied = Math.max(...reference.band_gap.map(x => x.energy_highest_occupied))\n }\n d.m_path = `${archive?.metadata?.entry_id}/data/results/properties/electronic/dos_electronic`\n if (d.energies && d.densities) dos.push(d)\n }\n return dos.length === 0 ? false : dos\n}\n\n/**\n * Processed the old DOS data plotting.\n */\nfunction processOldDosData(data, units, initialLayout, normalizedToHOE, theme, type, dosNormalize) {\n const plotData = []\n let normalized\n const mins = []\n const maxes = []\n const dosRenormalized = data.map(d => {\n const densities = dosNormalize\n ? d.densities.map((density, index) => {\n return density.map(density_intensity => density_intensity * d.normalization_factors[index])\n })\n : d.densities\n return {...d, densities: densities}\n })\n const channels = dosRenormalized.map(d => d.densities.length)\n const lines = getLineStyles(channels.reduce((a, b) => a + b, 0), null, channels.length > 0 ? channels[0] : null).values()\n dosRenormalized.forEach(d => {\n // Determine the energy reference.\n let energyHighestOccupied\n if (type === 'vibrational') {\n energyHighestOccupied = 0\n normalized = true\n } else {\n if (d.energy_highest_occupied === undefined) {\n energyHighestOccupied = 0\n normalized = false\n } else {\n energyHighestOccupied = new Quantity(d.energy_highest_occupied, energyUnit).toSystem(units).value()\n normalized = true\n }\n }\n\n // Convert units and determine range\n const nChannels = d.densities.length\n let energies = new Quantity(d.energies, energyUnit).toSystem(units).value()\n const values1 = new Quantity(d.densities[0], valueUnit).toSystem(units).value()\n let values2\n mins.push(Math.min(...values1))\n maxes.push(Math.max(...values1))\n if (nChannels === 2) {\n values2 = new Quantity(d.densities[1], valueUnit).toSystem(units).value()\n mins.push(Math.min(...values2))\n maxes.push(Math.max(...values2))\n }\n if (energyHighestOccupied !== 0) {\n energies = add(energies, -energyHighestOccupied)\n }\n\n const line = lines.next().value\n if (nChannels === 2) {\n plotData.push(\n {\n x: values2,\n y: energies,\n type: 'scatter',\n mode: 'lines',\n showlegend: false,\n line: lines.next().value\n }\n )\n }\n plotData.push(\n {\n x: values1,\n y: energies,\n name: d.name,\n type: 'scatter',\n mode: 'lines',\n showlegend: d.name !== undefined,\n line: line\n }\n )\n })\n\n const range = [Math.min(...mins), Math.max(...maxes)]\n // Normalization line\n if (type !== 'vibrational' && normalizedToHOE) {\n plotData.push({\n x: range,\n y: [0, 0],\n name: 'Highest occupied',\n showlegend: true,\n type: 'line',\n mode: 'lines',\n line: {\n color: '#000',\n width: 1\n }\n })\n }\n\n // Compute the final layout\n const computedLayout = mergeObjects(\n {\n yaxis: {\n title: {\n text: `Energy (${energyUnit.toSystem(units).label()})`\n }\n },\n xaxis: {\n title: {\n text: dosNormalize ? `${valueUnit.toSystem(units).label()}` : `states ${valueUnit.toSystem(units).label()}`\n },\n range: range,\n zeroline: true\n },\n legend: {\n font: {\n size: 13\n }\n }\n },\n initialLayout\n )\n\n return {\n finalData: plotData,\n finalLayout: computedLayout,\n normalized: normalized\n }\n}\n/*\n * Processed the new DOS data plotting.\n */\nfunction processNewDosData(data, units, initialLayout, normalizedToHOE, theme, type, dosNormalize) {\n // Plotting styles: lineStyles differentiates spin channels, while lineColors changes\n // for different methodologies\n // @TODO use getLineStyles instead\n const lineStyles = ['solid', 'dot']\n const lineColors = ['#005271', '#f57c00']\n\n const plotData = []\n let normalized\n const isSpinPolarized = []\n const mins = []\n const maxes = []\n for (const [iMethod, dos_method] of data.entries()) {\n const methodName = dos_method.name ? dos_method.name : ''\n const spinChannels = dos_method.spin_polarized ? 2 : 1\n isSpinPolarized.push(spinChannels === 2)\n const spinName = spinChannels === 2 ? ['+', '-'] : ['']\n // Looping over different spin channels\n for (let iSpin = 0; iSpin < spinChannels; iSpin++) {\n // Setting state for renormalizing densities by the normalization factor\n const densities = dos_method.densities[iSpin]\n const normalization_factor = dos_method.normalization_factors[iSpin]\n let dosRenormalized\n if (normalization_factor !== undefined && dosNormalize) {\n dosRenormalized = densities.map(d => d * normalization_factor)\n } else {\n dosRenormalized = densities\n }\n\n // Setting the energy reference using the energy_highest_occupied\n let energyHighestOccupied\n if (type === 'vibrational') {\n energyHighestOccupied = 0\n normalized = true\n } else {\n if (dos_method.energy_highest_occupied[iSpin] === undefined) {\n energyHighestOccupied = 0\n normalized = false\n } else {\n energyHighestOccupied = new Quantity(dos_method.energy_highest_occupied[iSpin], energyUnit).toSystem(units).value()\n normalized = true\n }\n }\n\n // Convert units and determine range\n let energies = new Quantity(dos_method.energies[iSpin], energyUnit).toSystem(units).value()\n if (energyHighestOccupied !== 0) {\n energies = add(energies, -energyHighestOccupied)\n }\n const densitiesUnits = new Quantity(dosRenormalized, valueUnit).toSystem(units).value()\n mins.push(Math.min(...densitiesUnits))\n maxes.push(Math.max(...densitiesUnits))\n const line = {\n width: 2,\n dash: lineStyles[iSpin],\n color: lineColors[iMethod]\n }\n plotData.push(\n {\n x: densitiesUnits,\n y: energies,\n name: `${methodName}${spinName[iSpin]}`,\n type: 'scatter',\n mode: 'lines',\n showlegend: (methodName !== '' || spinChannels === 2),\n line: line\n }\n )\n }\n }\n\n // Zero energy line in case Fermi energy (EF) is stored\n const range = [Math.min(...mins), Math.max(...maxes)]\n let referencedLayout\n if (normalized) {\n referencedLayout = {\n yaxis: {\n title: {\n text: `Energy - EF (${energyUnit.toSystem(units).label()})`\n },\n zeroline: true\n }\n }\n } else {\n referencedLayout = {\n yaxis: {\n title: {\n text: `Energy (${energyUnit.toSystem(units).label()})`\n }\n }\n }\n }\n const zeroEnergyRefLayout = mergeObjects(initialLayout, referencedLayout)\n\n // Compute the final layout\n const computedLayout = mergeObjects(\n {\n xaxis: {\n title: {\n text: dosNormalize ? `${valueUnit.toSystem(units).label()}` : `states ${valueUnit.toSystem(units).label()}`\n },\n range: range\n },\n legend: {\n font: {\n size: 13\n }\n }\n },\n zeroEnergyRefLayout\n )\n\n return {\n finalData: plotData,\n finalLayout: computedLayout,\n normalized: normalized\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useMemo, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { withErrorHandler } from '../ErrorHandler'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { getLineStyles } from '../plotting/common'\n\n/**\n * A thin wrapper for the Plot-component that is used for plotting energy-volume\n * curves.\n */\nconst energyUnit = new Unit('joule')\nconst volumeUnit = new Unit('meter**3')\n\nconst EnergyVolumeCurve = React.memo(({\n data,\n className,\n units,\n 'data-testid': testID\n}) => {\n const [finalData, setFinalData] = useState(!data ? data : undefined)\n const theme = useTheme()\n\n // Calculate indices that sort the data\n const indices = useMemo(() => {\n if (!data) {\n return [undefined, undefined, undefined]\n }\n\n // Get indices that sort the data by volume\n const volumes = data.data[0].volumes\n const nPoints = data.data[0].volumes.length\n const indices = new Array(nPoints)\n for (let i = 0; i < nPoints; ++i) indices[i] = i\n indices.sort((a, b) => {\n return volumes[a] < volumes[b] ? -1 : volumes[a] > volumes[b] ? 1 : 0\n })\n return indices\n }, [data])\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n if (!data) {\n setFinalData(data)\n return\n }\n\n const traces = []\n let i = 0\n const lineStyles = getLineStyles(data.data.length, theme)\n for (const curve of data.data) {\n const trace = {\n x: new Quantity(indices.map(i => curve.volumes[i]), volumeUnit).toSystem(units).value(),\n y: new Quantity(indices.map(i => curve.energies[i]), energyUnit).toSystem(units).value(),\n name: curve.name,\n visible: i === 0 || 'legendonly',\n type: 'scatter',\n line: lineStyles[i]\n }\n traces.push(trace)\n ++i\n }\n setFinalData(traces)\n }, [data, units, theme, indices])\n\n const plotLayout = useMemo(() => {\n if (!data) {\n return null\n }\n\n return {\n showlegend: true,\n legend: {\n x: 0.5,\n y: 1,\n xanchor: 'center'\n },\n xaxis: {\n title: {\n text: `Volume/atom (${volumeUnit.toSystem(units).label()})`\n },\n zeroline: false\n },\n yaxis: {\n title: {\n text: `Energy (${energyUnit.toSystem(units).label()})`\n },\n zeroline: false\n }\n }\n }, [data, units])\n\n return \n})\n\nEnergyVolumeCurve.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.bool, // Set to False to show NoData component\n PropTypes.shape({\n data: PropTypes.arrayOf(PropTypes.shape({\n volumes: PropTypes.arrayOf(PropTypes.number).isRequired,\n energies: PropTypes.arrayOf(PropTypes.number).isRequired,\n name: PropTypes.string.isRequired\n })).isRequired,\n m_path: PropTypes.string // Path of the section containing the data in the Archive\n })\n ]),\n className: PropTypes.string,\n units: PropTypes.object, // Contains the unit configuration\n 'data-testid': PropTypes.string\n}\n\nexport default withErrorHandler('Could not load energy volume curve.')(EnergyVolumeCurve)\n","import React, { useState, useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport {\n FormControlLabel,\n FormControl,\n RadioGroup,\n Radio\n} from '@material-ui/core'\nimport { makeStyles } from '@material-ui/core/styles'\nimport Structure from '../visualization/Structure'\nimport BrillouinZone from '../visualization/BrillouinZone'\nimport BandStructure from '../visualization/BandStructure'\nimport Spectra from '../visualization/Spectra'\nimport DOS from '../visualization/DOS'\nimport { Quantity } from '../units/Quantity'\nimport { useUnitContext } from '../units/UnitContext'\nimport { electronicRange } from '../../config'\nimport EnergyVolumeCurve from '../visualization/EnergyVolumeCurve'\n\nconst useOverviewAtomsStyles = makeStyles({\n root: {\n width: '30rem',\n height: '20rem',\n margin: 'auto'\n }\n})\nexport const OverviewAtoms = React.memo(({def, section}) => {\n const style = useOverviewAtomsStyles()\n const system = useMemo(() => ({\n 'species': section.species,\n 'cell': section.lattice_vectors\n ? new Quantity(section.lattice_vectors, 'meter').to('angstrom').value()\n : undefined,\n 'positions': new Quantity(section.positions, 'meter').to('angstrom').value(),\n 'pbc': section.periodic\n }), [section])\n\n return \n})\nOverviewAtoms.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object,\n units: PropTypes.object\n})\n\nconst useOverviewDOSStyles = makeStyles({\n root: {\n width: '20rem',\n height: '40rem',\n margin: 'auto'\n }\n})\nexport const OverviewDOSElectronic = React.memo(({def, section, units}) => {\n const style = useOverviewDOSStyles()\n const data = useMemo(() => ([{\n version: 'old',\n energies: section.energies,\n densities: section.total.map(dos => dos.value),\n energy_highest_occupied: section.band_gap\n ? Math.max(...section.band_gap.map(x => x.energy_highest_occupied))\n : undefined\n }]), [section])\n\n return \n})\nOverviewDOSElectronic.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object,\n units: PropTypes.object\n})\n\nexport const OverviewDOSPhonon = React.memo(({def, section, units}) => {\n const style = useOverviewDOSStyles()\n const data = useMemo(() => ([{\n energies: section.energies,\n densities: section.total.map(dos => dos.value)\n }]), [section])\n\n return \n})\nOverviewDOSPhonon.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object,\n units: PropTypes.object\n})\n\nconst useOverviewBandstructurePhononStyles = makeStyles({\n root: {\n width: '30rem',\n height: '30rem',\n margin: 'auto'\n }\n})\nexport const OverviewBandstructurePhonon = React.memo(({def, section, units}) => {\n const style = useOverviewBandstructurePhononStyles()\n const data = useMemo(() => ([{\n segment: section.segment,\n reciprocal_cell: section.reciprocal_cell\n }]), [section])\n\n return \n})\nOverviewBandstructurePhonon.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object,\n units: PropTypes.object\n})\n\nconst useOverviewBandstructureElectronicStyles = makeStyles({\n root: {\n width: '30rem',\n height: '30rem',\n margin: 'auto'\n },\n radio: {\n display: 'flex',\n justifyContent: 'center'\n }\n})\nexport const OverviewBandstructureElectronic = React.memo(({def, section, units}) => {\n const [mode, setMode] = useState('bs')\n const toggleMode = useCallback((event) => {\n setMode(event.target.value)\n }, [setMode])\n\n const style = useOverviewBandstructureElectronicStyles()\n const data = useMemo(() => ([{\n segment: section.segment,\n reciprocal_cell: section.reciprocal_cell,\n energy_highest_occupied: section.band_gap\n ? Math.max(...section.band_gap.map(x => x.energy_highest_occupied))\n : undefined\n }]), [section])\n const layout = useMemo(() => ({\n yaxis: {\n autorange: false,\n range: new Quantity(electronicRange, 'electron_volt').toSystem(units).value()\n }\n }), [units])\n\n const bs = \n\n return data[0].reciprocal_cell\n ? <>\n {mode === 'bs'\n ? bs\n : \n }\n \n \n }\n label=\"Band structure\"\n labelPlacement=\"end\"\n />\n }\n label=\"Brillouin zone\"\n labelPlacement=\"end\"\n />\n \n \n \n : bs\n})\nOverviewBandstructureElectronic.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object,\n units: PropTypes.object\n})\n\nconst useOverviewSpectraStyles = makeStyles({\n root: {\n width: '30rem',\n height: '15rem',\n margin: 'auto'\n }\n})\nexport const OverviewSpectra = React.memo(({def, section, units}) => {\n const style = useOverviewSpectraStyles()\n\n return \n})\nOverviewSpectra.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object,\n units: PropTypes.object\n})\n\nconst useOverviewEquationOfStateStyles = makeStyles({\n root: {\n width: '30rem',\n height: '25rem',\n margin: 'auto'\n }\n})\nexport const OverviewEquationOfState = React.memo(({def, section, units}) => {\n const style = useOverviewEquationOfStateStyles()\n const data = [{\n volumes: section.volumes,\n energies: section.energies,\n name: 'raw'\n }]\n section.eos_fit.forEach(fit => {\n data.push({\n volumes: section.volumes,\n energies: fit.fitted_energies,\n name: fit.function_name\n })\n })\n\n return \n})\nOverviewEquationOfState.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object,\n units: PropTypes.object\n})\n\nexport const Overview = React.memo((props) => {\n const {def} = props\n const {units} = useUnitContext()\n const path = window.location.href.split('/').pop().split(':')[0]\n\n if (def.name === 'BandStructure' && path === 'band_structure_electronic') {\n return \n } else if (def.name === 'BandStructure' && path === 'band_structure_phonon') {\n return \n } else if (def.name === 'Atoms' && path === 'atoms') {\n return \n } else if (def.name === 'Dos' && path === 'dos_electronic') {\n return \n } else if (def.name === 'Dos' && path === 'dos_phonon') {\n return \n } else if (def.name === 'Spectrum') {\n return \n } else if (def.name === 'EquationOfState') {\n return \n }\n return null\n})\nOverview.propTypes = ({\n def: PropTypes.object,\n section: PropTypes.object\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo, useState, useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, Divider, IconButton, makeStyles, Tooltip, Typography } from '@material-ui/core'\nimport CodeIcon from '@material-ui/icons/Code'\nimport ReactJson from 'react-json-view'\nimport { CopyToClipboard } from 'react-copy-to-clipboard'\nimport ClipboardIcon from '@material-ui/icons/Assignment'\nimport Markdown from '../Markdown'\nimport { apiBase, appBase } from '../../config'\n\nexport const ApiDataContext = React.createContext()\n\nconst useCodeStyles = makeStyles(theme => ({\n codeContainer: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-start'\n },\n code: {\n flexGrow: 1,\n overflow: 'auto',\n padding: '12px 18px',\n borderRadius: 4,\n backgroundColor: theme.palette.primary.veryLight,\n fontSize: 16,\n fontFamily: 'monospace',\n whiteSpace: 'pre'\n },\n codeActions: {\n marginTop: theme.spacing(3)\n }\n}))\nexport const Code = React.memo(function Code({code}) {\n const classes = useCodeStyles()\n return \n
\n
\n {code}\n
\n
\n null}>\n \n \n \n \n \n \n
\n
\n
\n})\nCode.propTypes = {\n code: PropTypes.string\n}\n\n/**\n * Button that can display content outside the button DOM. This is important to\n * not trigger any button hover/click events on the child component.\n */\nexport const ContentButton = React.memo(function ContentButton(props) {\n const {tooltip, children, buttonContent, ButtonComponent, ButtonProps} = props\n\n const button = useMemo(() => {\n return React.createElement(\n ButtonComponent,\n {...ButtonProps},\n buttonContent\n )\n }, [ButtonComponent, buttonContent, ButtonProps])\n\n return \n {children}\n {tooltip\n ? {button}\n : button\n }\n \n})\nContentButton.propTypes = {\n tooltip: PropTypes.string,\n buttonContent: PropTypes.node,\n ButtonComponent: PropTypes.elementType,\n ButtonProps: PropTypes.object,\n children: PropTypes.node\n}\n\nContentButton.defaultProps = {\n ButtonComponent: IconButton\n}\n\n/**\n * Button that displays a simple dialog.\n */\nexport const DialogButton = React.memo(function DialogButton(props) {\n const {tooltip, buttonComponent, icon, label, title, children, buttonProps, ...DialogProps} = props\n const [open, setOpen] = useState(false)\n\n return setOpen(true)}}\n buttonContent={label || icon || }\n >\n \n {title && {title}}\n \n {children}\n \n \n \n \n \n \n})\nDialogButton.propTypes = {\n tooltip: PropTypes.string,\n icon: PropTypes.node,\n title: PropTypes.string,\n label: PropTypes.string,\n buttonComponent: PropTypes.elementType,\n buttonProps: PropTypes.object,\n children: PropTypes.node\n}\n\nexport const SourceApiDialogButton = React.memo(function SourceApiDialogButton({description, children, buttonProps, ...props}) {\n const help = `The information on this page was loaded from the NOMAD API. You can also use\n the API to retrieve this information. Visit also our [API documentation](${appBase}/docs/api.html)\n or [API dashboard](${apiBase}).`\n\n return \n \n \n {children}\n \n})\nSourceApiDialogButton.propTypes = {\n description: PropTypes.string,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]),\n buttonProps: PropTypes.object\n}\n\nconst CopyToClipboardButton = React.memo(function CopyToClipboardButton({code}) {\n return null}>\n \n \n \n \n \n \n})\nCopyToClipboardButton.propTypes = {\n code: PropTypes.string\n}\n\nconst useSourceApiCallStyles = makeStyles(theme => ({\n root: {},\n request: {\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n fontSize: 16,\n fontFamily: 'monospace',\n alignItems: 'center'\n },\n method: {\n minWidth: 60,\n fontWeight: 'bold'\n },\n code: {\n flexGrow: 1,\n padding: '12px 18px',\n overflow: 'auto',\n borderRadius: 4,\n backgroundColor: theme.palette.primary.veryLight,\n whiteSpace: 'pre'\n },\n heading: {\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(1),\n display: 'block'\n }\n}))\nexport const SourceApiCall = React.memo(function ApiCall(props) {\n const apiData = useContext(ApiDataContext)\n const {method, url, description, body, response} = {...apiData, ...props}\n const classes = useSourceApiCallStyles()\n let formatedBody\n if (body) {\n // serialized json has \"private\" values that might contain circles removed\n formatedBody = JSON.stringify(\n body,\n (name, value) => name.startsWith('_') ? undefined : value,\n 2\n )\n }\n\n return
\n \n Request\n
\n {method}\n {url}\n \n
\n {formatedBody &&
\n  \n {formatedBody}\n \n
}\n Response\n \n
\n})\nSourceApiCall.propTypes = {\n description: PropTypes.string,\n method: PropTypes.string,\n url: PropTypes.string,\n body: PropTypes.any,\n response: PropTypes.any\n}\n\nexport const SourceJsonDialogButton = React.memo(function SourceJsonDialogButton({description, data, ...props}) {\n return \n {description && \n \n \n }\n \n \n})\nSourceJsonDialogButton.propTypes = {\n description: PropTypes.string,\n data: PropTypes.any\n}\n\nconst useSourceJsonStyles = makeStyles(theme => ({\n stickyContainer: {\n zIndex: 1,\n width: '100%',\n height: 0,\n position: 'sticky',\n left: 0\n },\n actionContainer: {\n position: 'relative'\n },\n action: {\n position: 'absolute',\n right: 0,\n top: \"1rem\",\n transform: 'translate(0, -50%)'\n }\n}))\nexport const SourceJson = React.memo(({data, ...props}) => {\n const styles = useSourceJsonStyles()\n const dataToRender = typeof data === 'object' ? data : {data: data}\n // serialized json has \"private\" values that might contain circles removed\n // might still have circles and fail\n let code = null\n try {\n code = JSON.stringify(data, (name, value) => name.startsWith('_') ? undefined : value, 2)\n } catch {}\n\n return <>\n {code &&
\n
\n
\n \n
\n
\n
}\n \n \n \n \n})\nSourceJson.propTypes = {\n data: PropTypes.any\n}\n\nexport const SourceJsonCode = React.memo(function SourceJsonCode({data}) {\n // serialized json has \"private\" values that might contain circles removed\n const code = JSON.stringify(data, (name, value) => name.startsWith('_') ? undefined : value, 2)\n return \n})\nSourceJsonCode.propTypes = {\n data: PropTypes.object\n}\n\nexport const SourceDialogDivider = (props) => \n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Box, Button, Tooltip } from '@material-ui/core'\nimport ArrowDownIcon from '@material-ui/icons/ArrowDropDown'\nimport ArrowUpIcon from '@material-ui/icons/ArrowDropUp'\nimport LoadingButton from '../buttons/LoadingButton'\n\n/**\n * Displays simple pagination controls.\n */\nconst Pagination = React.memo(({\n showMore,\n showLess,\n disableMore,\n disableLess,\n loadingMore,\n onMore,\n onLess,\n variant,\n 'data-testid': testID,\n ...rest\n}) => {\n const moreIcon = {\n 'standard': null,\n 'down': ,\n 'up': \n }[variant]\n const lessIcon = {\n 'standard': null,\n 'down': ,\n 'up': \n }[variant]\n return \n {showMore && \n \n {moreIcon}Show more\n \n \n }\n {showLess && }\n \n})\n\nPagination.propTypes = {\n showMore: PropTypes.bool, // Show 'More' button\n showLess: PropTypes.bool, // Show 'Less' button\n disableMore: PropTypes.bool, // Disable more button\n disableLess: PropTypes.bool, // Disable less button\n loadingMore: PropTypes.bool, // Show loading indicator in 'More' button\n onMore: PropTypes.func, // 'More' button handler\n onLess: PropTypes.func, // 'Less' button handler\n /*\n * Visualization variant. 'standard' means no directional hints, 'up' and\n * 'down' will display directional hint icons in the buttons.\n */\n variant: PropTypes.oneOf(['standard', 'up', 'down']),\n 'data-testid': PropTypes.string\n}\n\nPagination.defaultProps = {\n variant: 'standard'\n}\n\nexport default Pagination\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {Box, makeStyles} from '@material-ui/core'\nimport {configState, FoldableList} from '../archive/ArchiveBrowser'\nimport grey from \"@material-ui/core/colors/grey\"\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\n\nconst useListEditQuantityStyles = makeStyles(theme => ({\n root: {\n margin: `0 -${theme.spacing(1)}px`,\n padding: `0 ${theme.spacing(1)}px`,\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n wrap: 'nowrap',\n alignItems: 'center'\n },\n title: {\n flexGrow: 1,\n color: grey[600],\n textDecoration: 'none',\n margin: `0 -${theme.spacing(1)}px`,\n whiteSpace: 'nowrap',\n display: 'flex',\n fontWeight: 'bold'\n },\n selected: {\n whiteSpace: 'nowrap'\n },\n unSelected: {\n '&:hover': {\n backgroundColor: grey[300]\n }\n },\n actions: {}\n}))\n\nconst ListEditQuantity = React.memo(function ListEditQuantity({value, onChange, component, quantityDef, ...props}) {\n const classes = useListEditQuantityStyles()\n const [open, setOpen] = useState(true)\n const fixedLength = Number(quantityDef.shape?.[0])\n const hasFixedLength = !isNaN(fixedLength)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n let renderValue\n if (hasFixedLength) {\n renderValue = (value && [...value]) || Array(fixedLength).fill(undefined)\n } else {\n renderValue = (value && [...value]) || []\n renderValue.push(undefined)\n }\n\n const handleChange = useCallback((item, index) => {\n if (onChange) {\n let newValue = Array.isArray(item) ? [\n ...(renderValue.slice(0, index)),\n ...item,\n ...(renderValue.slice(index + 1))\n ] : [\n ...(renderValue.slice(0, index)),\n item,\n ...(renderValue.slice(index + 1))\n ]\n\n if (!hasFixedLength) {\n newValue = newValue.filter(value => value !== undefined && value !== null && value !== '')\n } else {\n for (let i = newValue.length - 1; i >= fixedLength; i--) {\n newValue = newValue.slice(0, i)\n }\n }\n onChange(newValue)\n }\n }, [onChange, renderValue, fixedLength, hasFixedLength])\n\n const handleClick = useCallback(() => {\n setOpen(open => !open)\n }, [])\n\n return \n \n {renderValue.map((item, index) => (\n {React.createElement(component, {\n value: item,\n onChange: value => handleChange(value, index),\n quantityDef: quantityDef,\n index: index,\n ...props\n })}\n ))}\n \n \n})\nListEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.array,\n onChange: PropTypes.func,\n component: PropTypes.elementType.isRequired\n}\n\nexport default ListEditQuantity\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {dateFormat} from '../../config'\nimport {KeyboardDatePicker, KeyboardTimePicker} from '@material-ui/pickers'\nimport AccessTimeIcon from '@material-ui/icons/AccessTime'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const DateTimeEditQuantity = React.memo((props) => {\n const {quantityDef, value, onChange, format, time, ...otherProps} = props\n const [dateValue, setDateValue] = useState(value || null)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n useEffect(() => {\n setDateValue(date => value\n ? (date?.toJSON?.() || date) === value ? date : value\n : null\n )\n }, [value])\n\n const handleChange = useCallback((date) => {\n setDateValue(date)\n if (onChange) {\n if (date === null) {\n onChange(undefined)\n } else {\n const jsonValue = date?.toJSON()\n if (jsonValue) {\n onChange(jsonValue)\n }\n }\n }\n }, [onChange, setDateValue])\n\n const renderProps = {\n size: 'small',\n variant: 'inline',\n inputVariant: 'filled',\n fullWidth: true,\n label: label,\n value: dateValue,\n onChange: handleChange,\n ...otherProps\n }\n\n if (time) {\n return }\n />\n } else {\n return \n }\n})\nDateTimeEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func,\n format: PropTypes.string,\n time: PropTypes.bool\n}\n\nexport const DateEditQuantity = React.memo((props) => {\n return \n})\nDateEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func\n}\n\nexport const TimeEditQuantity = React.memo((props) => {\n return \n})\nTimeEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useState} from 'react'\nimport {\n Box,\n Dialog,\n DialogContent,\n DialogTitle,\n IconButton,\n InputAdornment,\n makeStyles,\n TextField\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport HelpOutlineIcon from '@material-ui/icons/HelpOutline'\nimport Markdown from '../Markdown'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport Button from '@material-ui/core/Button'\nimport LaunchIcon from '@material-ui/icons/Launch'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nconst HelpDialog = React.memo(({title, description}) => {\n const [open, setOpen] = useState(false)\n\n return \n {description && setOpen(true)}>\n {}\n }\n {open && \n \n {title}\n \n \n {description}\n \n \n \n \n \n\n }\n \n})\nHelpDialog.propTypes = {\n title: PropTypes.string,\n description: PropTypes.string\n}\n\nconst useHelpAdornmentStyles = makeStyles(theme => ({\n root: {},\n withOtherAdornment: {\n marginRight: theme.spacing(3)\n }\n}))\n\nexport const HelpAdornment = React.memo(({title, description, withOtherAdornment}) => {\n const classes = useHelpAdornmentStyles()\n return \n \n \n})\nHelpAdornment.propTypes = {\n withOtherAdornment: PropTypes.bool,\n title: PropTypes.string,\n description: PropTypes.string\n}\n\nconst useWithHelpStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n '&:not(:hover)': {\n '& #help': {\n display: 'none'\n }\n }\n }\n}))\n\nexport const WithHelp = React.memo((props) => {\n const {label, helpDescription, ...otherProps} = props\n const classes = useWithHelpStyles()\n return \n \n {helpDescription && (\n \n
\n \n
\n
\n )}\n
\n})\nWithHelp.propTypes = {\n label: PropTypes.string,\n helpDescription: PropTypes.string\n}\n\nexport function getFieldProps(quantityDef) {\n const eln = quantityDef?.m_annotations?.eln\n const {component, ...elnProps} = eln?.[0] || {}\n elnProps.unit = elnProps.unit || quantityDef.unit\n return {\n helpDescription: quantityDef.description,\n ...elnProps\n }\n}\n\nexport const TextFieldWithHelp = React.memo(React.forwardRef((props, ref) => {\n const {withOtherAdornment, label, helpDescription, 'data-testid': TestId, ...otherProps} = props\n const classes = useWithHelpStyles()\n return \n \n \n )})}\n label={label}\n data-testid={TestId}\n {...otherProps}\n value={otherProps.value || ''}\n />\n}))\nTextFieldWithHelp.propTypes = {\n withOtherAdornment: PropTypes.bool,\n label: PropTypes.string,\n value: PropTypes.string,\n helpDescription: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nexport const StringEditQuantity = React.memo((props) => {\n const {quantityDef, onChange, ...otherProps} = props\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleChange = useCallback((value) => {\n if (onChange) {\n onChange(value === '' ? undefined : value)\n }\n }, [onChange])\n return handleChange(event.target.value)}\n {...getFieldProps(quantityDef)}\n {...otherProps}\n label={label}\n />\n})\nStringEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func\n}\n\nexport const StringField = React.memo((props) => {\n const {onChange, ...otherProps} = props\n\n const handleChange = useCallback(event => {\n const value = event.target.value\n if (onChange) {\n onChange(value === '' ? undefined : value)\n }\n }, [onChange])\n\n return \n})\nStringField.propTypes = {\n onChange: PropTypes.func\n}\n\nexport const TextFieldWithLinkButton = React.memo(React.forwardRef((props, ref) => {\n const {withOtherAdornment, label, value, helpDescription, 'data-testid': TestId, ...otherProps} = props\n const classes = useWithHelpStyles()\n\n const validateURL = useCallback((value) => {\n try {\n return Boolean(new URL(value))\n } catch (e) {\n return false\n }\n }, [])\n\n return \n { helpDescription &&\n
\n \n
\n }\n {\n validateURL(value) &&\n window.open(value, '_blank')}>\n \n \n }\n \n }}\n label={label}\n data-testid={'URLEditQuantity'}\n {...otherProps}\n />\n}))\nTextFieldWithLinkButton.propTypes = {\n withOtherAdornment: PropTypes.bool,\n label: PropTypes.string,\n value: PropTypes.string,\n helpDescription: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nexport const URLEditQuantity = React.memo((props) => {\n const {quantityDef, onChange, ...otherProps} = props\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleChange = useCallback((value) => {\n if (onChange) {\n onChange(value === '' ? undefined : value)\n }\n }, [onChange])\n\n return handleChange(event.target.value)}\n {...getFieldProps(quantityDef)}\n {...otherProps}\n label={label}\n />\n})\nURLEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func\n}\n","import {useErrors} from \"../errors\"\nimport {useMemo} from \"react\"\nimport {Unit} from \"./Unit\"\nimport {useUnitContext} from \"./UnitContext\"\nimport {getFieldProps} from \"../editQuantity/StringEditQuantity\"\n\nexport function useDisplayUnit(quantityDef) {\n const {units} = useUnitContext()\n const {raiseError} = useErrors()\n const defaultUnit = useMemo(() => quantityDef.unit && new Unit(quantityDef.unit), [quantityDef])\n const dimension = defaultUnit && defaultUnit.dimension(false)\n const {defaultDisplayUnit: deprecatedDefaultDisplayUnit} = getFieldProps(quantityDef)\n const defaultDisplayUnit = quantityDef?.m_annotations?.display?.[0]?.unit || deprecatedDefaultDisplayUnit\n\n const displayUnitObj = useMemo(() => {\n if (!dimension) return\n let defaultDisplayUnitObj\n\n // TODO: If we enable the new 'Schema' scope in the unit context, we should\n // prioritize those values there. But for now we just read unit info from\n // the schema.\n\n // If a default display unit has been defined, use it instead\n if (defaultDisplayUnit) {\n try {\n defaultDisplayUnitObj = new Unit(defaultDisplayUnit)\n } catch (e) {\n raiseError(`The provided defaultDisplayUnit for ${quantityDef.name} field is not valid.`)\n }\n if (defaultDisplayUnitObj.dimension(true) !== defaultUnit.dimension(true)) {\n raiseError(`The provided defaultDisplayUnit for ${quantityDef.name} has incorrect dimensionality for this field.`)\n }\n // Use the global unit system defined in the schema\n } else {\n defaultDisplayUnitObj = new Unit(defaultUnit).toSystem(units)\n }\n\n return defaultDisplayUnitObj\n }, [defaultDisplayUnit, defaultUnit, dimension, quantityDef, raiseError, units])\n\n return displayUnitObj\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {TextField, makeStyles, Box, Checkbox, Tooltip} from '@material-ui/core'\nimport Autocomplete from '@material-ui/lab/Autocomplete'\nimport PropTypes from 'prop-types'\nimport {Quantity} from '../units/Quantity'\nimport {parse} from '../units/common'\nimport {Unit} from '../units/Unit'\nimport {getUnits} from '../units/UnitContext'\nimport {debounce, isNil} from 'lodash'\nimport {TextFieldWithHelp, getFieldProps} from './StringEditQuantity'\nimport {useDisplayUnit} from \"../units/useDisplayUnit\"\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const NumberField = React.memo((props) => {\n const {onChange, onInputChange, dimension, value, dataType, minValue, unit, maxValue, displayUnit, convertInPlace, debounceTime, ...otherProps} = props\n const [error, setError] = useState('')\n const previousValue = useRef('')\n const previousNumber = useRef()\n const previousUnitLabel = useRef(displayUnit?.label())\n const previousNumberPart = useRef('')\n const [inputValue, setInputValue] = useState('')\n\n const fixDigits = useCallback((value) => {\n return value.toPrecision(15)\n .replace(/0+(e|$)/, '$1')\n .replace(/\\.$/, '')\n .replace(/\\.e/, 'e')\n }, [])\n\n const getStoredValue = useCallback((value, displayUnit) => {\n const valueInBaseUnit = (isNil(value) || isNil(unit))\n ? value\n : new Quantity(value, displayUnit).to(unit).value()\n return valueInBaseUnit && fixDigits(Number(valueInBaseUnit))\n }, [fixDigits, unit])\n\n // Whenever a new value arrives or the units change, change the text\n // accordingly. If the field is associated with a unit and the same numerical\n // value as set previously comes back with the same unit, preserve the\n // formatting by reusing the saved input text. Fields that do not have a unit\n // simply take in the new value.\n useEffect(() => {\n if (!isNil(unit)) {\n if (convertInPlace) {\n let newVal\n if (!isNil(value) && value === previousNumber.current && displayUnit?.label() === previousUnitLabel.current) {\n newVal = previousNumberPart.current\n } else if (isNil(value) || isNaN(value)) {\n newVal = ''\n } else if (unit && displayUnit) {\n newVal = new Quantity(value, unit).to(displayUnit).value()\n }\n previousUnitLabel.current = displayUnit?.label()\n previousNumber.current = value\n previousNumberPart.current = newVal\n const inputValue = newVal && fixDigits(Number(newVal))\n previousValue.current = inputValue\n setInputValue(inputValue)\n onInputChange(inputValue)\n }\n } else {\n const inputValue = (isNil(value) || isNaN(value)) ? '' : String(value)\n previousValue.current = inputValue\n setInputValue(inputValue)\n }\n }, [value, displayUnit, unit, convertInPlace, onInputChange, fixDigits])\n\n // Given the text input, returns a the extracted number, unit and possible\n // errors.\n const parseInput = useCallback((input) => {\n if (isNil(input) || input === '') {\n previousNumberPart.current = ''\n return {}\n }\n\n // Try to parse the quantity. Value is required, unit is optional.\n const {unit: parsedUnit, value, valueString, error} = parse(input, {dimension, requireValue: true})\n previousNumberPart.current = valueString\n if (parsedUnit) {\n previousUnitLabel.current = parsedUnit.label()\n }\n if (error) {\n return {error}\n }\n\n // Validate number datatype\n let isValid = true\n if (['int64', 'int32', 'int'].includes(dataType)) {\n isValid = Number.isInteger(value)\n } else if (['uint64', 'uint32', 'uint'].includes(dataType)) {\n isValid = Number.isInteger(value) && value >= 0\n } else if (['float64', 'float32', 'float'].includes(dataType)) {\n isValid = !isNaN(value)\n }\n if (!isValid) {\n return {error: `Enter a valid numerical value with datatype '${dataType}'`}\n }\n\n // Validate number range\n const storingValue = Number(getStoredValue(value, parsedUnit || displayUnit))\n if (!isNaN(storingValue)) {\n if (!isNaN(maxValue) && maxValue < storingValue) {\n return {error: `Enter a value that is equal or smaller than ${maxValue}` + (unit ? ` (${unit})` : '')}\n }\n if (!isNaN(minValue) && minValue > storingValue) {\n return {error: `Enter a value that is equal or larger than ${minValue}` + (unit ? ` (${unit})` : '')}\n }\n }\n\n return {value: value, unit: parsedUnit}\n }, [dataType, dimension, displayUnit, getStoredValue, maxValue, minValue, unit])\n\n // The final handler for text input change\n const handleChange = useCallback((inputValue) => {\n // If the input has not been changed meaningfully, do nothing.\n const trimmed = inputValue?.trim()\n if (trimmed === previousValue.current) {\n return\n }\n\n // Store the new value in a ref, reset errors\n previousValue.current = trimmed\n setError('')\n\n // Try to interpret the value, if a meaningful value was returned, send the\n // new value in a normalized form to the handler.\n const parsedInput = parseInput(trimmed)\n const {value: number, error} = parsedInput\n const newUnit = parsedInput.unit || displayUnit\n\n if (error) {\n setError(error)\n } else {\n if (!convertInPlace) {\n setInputValue(previousNumberPart.current)\n onInputChange(previousNumberPart.current)\n }\n if (onChange) {\n const storedValue = getStoredValue(number, newUnit)\n previousNumber.current = storedValue\n const numberedStoredValue = Number(storedValue)\n onChange(!isNaN(numberedStoredValue) ? numberedStoredValue : undefined, newUnit)\n onInputChange(number)\n }\n }\n }, [parseInput, displayUnit, convertInPlace, onChange, onInputChange, getStoredValue])\n\n // Routes text field changes to a handler after a debounce time\n const debouncedHandleChange = useMemo(() => debounce(handleChange, 500), [handleChange])\n\n // When input changes, saves the entered text into a state and queues a\n // processing event with debounce time.\n const handleInputChange = useCallback(event => {\n setInputValue(event.target.value)\n if (debounceTime) {\n debouncedHandleChange(event.target.value)\n }\n }, [debounceTime, debouncedHandleChange])\n\n // Request immediate validation on blur\n const handleBlur = useCallback(() => {\n handleChange(inputValue)\n }, [handleChange, inputValue])\n\n return { if (event.key === 'Enter') handleChange(inputValue) }}\n data-testid='number-edit-quantity-value'\n {...otherProps}\n />\n})\nNumberField.propTypes = {\n onChange: PropTypes.func.isRequired,\n onInputChange: PropTypes.func.isRequired,\n maxValue: PropTypes.number,\n minValue: PropTypes.number,\n dataType: PropTypes.string,\n value: PropTypes.number,\n unit: PropTypes.string,\n displayUnit: PropTypes.object,\n dimension: PropTypes.string,\n convertInPlace: PropTypes.bool,\n debounceTime: PropTypes.number\n}\n\nexport const NumberEditQuantity = React.memo((props) => {\n const {quantityDef, value, onChange, ...otherProps} = props\n const defaultUnit = useMemo(() => quantityDef.unit && new Unit(quantityDef.unit), [quantityDef])\n const dimension = defaultUnit && defaultUnit.dimension(false)\n const dimensionBase = defaultUnit && defaultUnit.dimension(true)\n const [checked, setChecked] = useState(true)\n const [displayedValue, setDisplayedValue] = useState(true)\n const {defaultDisplayUnit: deprecatedDefaultDisplayUnit, ...fieldProps} = getFieldProps(quantityDef)\n const displayUnit = useDisplayUnit(quantityDef)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n const [unit, setUnit] = useState(displayUnit)\n\n // Set the unit if display unit changes\n useEffect(() => {\n setUnit(displayUnit)\n }, [displayUnit])\n\n // Get a list of unit options for this field\n const options = useMemo(() => {\n const units = [...getUnits(dimension)].map(x => new Unit(x).label())\n unit && units.push(unit.label())\n defaultUnit && units.push(defaultUnit.label())\n displayUnit && units.push(displayUnit.label())\n return [...new Set(units)]\n }, [displayUnit, defaultUnit, dimension, unit])\n\n // Handle a change in NumberField input\n const handleChange = useCallback((value, unit) => {\n onChange(value)\n setUnit(unit)\n }, [onChange])\n\n // Handle a change in NumberField input\n const handleInputChange = useCallback((displayedValue) => {\n setDisplayedValue(displayedValue)\n }, [])\n\n // Handle a change in the unit dialog\n const handleUnitChange = useCallback((newUnit) => {\n if (!checked && quantityDef.unit && newUnit && !isNil(value)) {\n const storedValue = new Quantity(Number(displayedValue), newUnit).to(quantityDef.unit).value()\n onChange(storedValue)\n }\n setUnit(new Unit(newUnit))\n }, [checked, displayedValue, onChange, quantityDef.unit, value])\n\n return \n \n {unit && (\n \n \n setChecked(event.target.checked)}\n color=\"primary\"\n checked={checked}\n />\n \n \n \n )}\n \n})\nNumberEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.number,\n onChange: PropTypes.func\n}\n\nexport const useUnitSelectStyles = makeStyles(theme => ({\n root: {\n width: '150px'\n }\n}))\n\nexport const UnitSelect = React.memo(({options, unit, onChange, dimension, disabled}) => {\n const classes = useUnitSelectStyles()\n const [error, setError] = useState()\n const [value, setValue] = useState(unit.label())\n const [open, setOpen] = useState(false)\n\n // Set the input value when unit changes\n useEffect(() => {\n unit && setValue(unit.label())\n }, [unit])\n\n // Validate input and submit unit if valid\n const submit = useCallback((val) => {\n const {unit, error} = parse(val, {dimension, requireUnit: true})\n if (error) {\n setError(error)\n } else {\n onChange(unit)\n }\n }, [dimension, onChange])\n\n const handleInputChange = useCallback((event, value) => {\n setError()\n setValue(value)\n }, [])\n\n const handleOptionChange = useCallback((event, value) => {\n setError()\n submit(value)\n }, [submit])\n\n const finalOptions = useMemo(() => {\n return options\n }, [options])\n\n // Submit on enter\n const handleEnter = useCallback((event) => {\n if (event.key === 'Enter') {\n setOpen(false)\n submit(value)\n event.stopPropagation()\n event.preventDefault()\n }\n }, [submit, value])\n\n return option}\n filterOptions={(options) => options}\n onInputChange={handleInputChange}\n onChange={handleOptionChange}\n open={open}\n onOpen={() => { if (value.trim() !== '') { setOpen(true) } }}\n onClose={() => setOpen(false)}\n onBlur={() => submit(value)}\n renderInput={(params) => \n }}\n />}\n />\n})\nUnitSelect.propTypes = {\n options: PropTypes.arrayOf(PropTypes.string),\n unit: PropTypes.object.isRequired,\n dimension: PropTypes.string.isRequired,\n onChange: PropTypes.func,\n disabled: PropTypes.bool\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback} from 'react'\nimport {MenuItem} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport {getFieldProps, TextFieldWithHelp} from './StringEditQuantity'\nimport AutoComplete from '@material-ui/lab/Autocomplete'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const EnumEditQuantity = React.memo((props) => {\n const {quantityDef, value, onChange, suggestions, ...otherProps} = props\n const fieldProps = getFieldProps(quantityDef)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleChange = useCallback(value => {\n if (onChange) {\n onChange(value === '' ? undefined : value)\n }\n }, [onChange])\n\n if ((quantityDef.type?.type_kind === 'python' && quantityDef.type?.type_data === 'str') || quantityDef.type === undefined) {\n return handleChange(value)}\n onBlur={(event) => handleChange(event.target.value)}\n ListboxProps={{style: {maxHeight: '150px'}}}\n value={value || null}\n renderInput={params => (\n \n )}\n />\n }\n\n return handleChange(event.target.value)}\n {...fieldProps}\n {...otherProps}\n label={label}\n >\n {quantityDef.type?.type_data.map(item => (\n \n {item}\n \n ))}\n \n})\nEnumEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func,\n suggestions: PropTypes.arrayOf(PropTypes.string)\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport AutoComplete from '@material-ui/lab/Autocomplete'\nimport {getFieldProps, TextFieldWithHelp} from './StringEditQuantity'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const AutocompleteEditQuantity = React.memo((props) => {\n const {quantityDef, value, onChange, ...otherProps} = props\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleChange = useCallback((event, value) => {\n value = value || event.target.value\n if (onChange) {\n onChange((value === null || value === '') ? undefined : value)\n }\n }, [onChange])\n\n return (\n \n )}\n />\n})\nAutocompleteEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback} from 'react'\nimport {\n FormControlLabel,\n Checkbox, FormLabel, RadioGroup, Radio, FormControl\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport {getFieldProps, WithHelp} from './StringEditQuantity'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const BoolEditQuantity = React.memo(function BoolEditQuantity(props) {\n const {quantityDef, value, onChange, booleanLabels, ...otherProps} = props\n const fieldProps = getFieldProps(quantityDef)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleCheckboxChange = useCallback(e => {\n const value = e.target.checked\n if (onChange) {\n onChange(value)\n }\n }, [onChange])\n\n const handleRadioChange = useCallback(e => {\n const value = e.target.value === 'true' ? true : (e.target.value === 'false' ? false : undefined)\n if (onChange) {\n onChange(value)\n }\n }, [onChange])\n\n return (\n \n {booleanLabels ? (\n \n {label}\n \n {Object.keys(booleanLabels).map(key => (\n }\n label={booleanLabels[key]}\n />\n ))}\n \n \n ) : (\n \n }\n label={label}\n />\n )}\n \n )\n})\n\nBoolEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.oneOf([true, false, undefined]),\n onChange: PropTypes.func,\n booleanLabels: (props, propName, componentName) => {\n const labels = props[propName]\n if (!labels) return null\n if (typeof labels !== 'object') {\n return new Error(`Invalid prop \\`${propName}\\` supplied to \\`${componentName}\\`. Expected an object.`)\n }\n const validKeys = ['true', 'false', 'undefined']\n if (!Object.keys(labels).every(key => validKeys.includes(key))) {\n return new Error(`Invalid prop \\`${propName}\\` supplied to \\`${componentName}\\`. Expected keys \"true\", \"false\", \"undefined\".`)\n }\n return null\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback} from 'react'\nimport {\n Button,\n Tooltip\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport {getFieldProps} from './StringEditQuantity'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useErrors } from '../errors'\nimport {useEntryStore } from '../entry/EntryContext'\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const ActionEditQuantity = React.memo(function ButtonEditQuantity(props) {\n const {quantityDef, value, onChange, ...otherProps} = props\n const fieldProps = getFieldProps(quantityDef)\n const {saveArchive} = useEntryStore()\n const {raiseError} = useErrors()\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleClick = useCallback(() => {\n onChange?.(true)\n saveArchive().catch(raiseError)\n }, [onChange, saveArchive, raiseError])\n\n return \n {label}\n \n})\nActionEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.bool,\n onChange: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport {Button, Dialog, DialogActions, DialogContent, DialogTitle, makeStyles} from '@material-ui/core'\nimport DialogContentText from '@material-ui/core/DialogContentText'\n\nconst useStyles = makeStyles(theme => ({\n dialog: {\n width: '100%',\n minWidth: 400\n }\n}))\n\nconst OverwriteExistingFileDialog = React.memo(({open, data, message, onOverwrite, onCancel}) => {\n const classes = useStyles()\n\n return \n \n Overwrite file\n \n \n {message || `There is already a file with the same name in this path. Do you want to overwrite the file?`}\n \n \n \n \n \n \n \n \n \n})\nOverwriteExistingFileDialog.propTypes = {\n open: PropTypes.bool,\n data: PropTypes.any,\n message: PropTypes.string,\n onOverwrite: PropTypes.func,\n onCancel: PropTypes.func\n}\n\nexport default OverwriteExistingFileDialog\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Typography, Box, DialogTitle, DialogContent, Dialog, LinearProgress} from '@material-ui/core'\n\nfunction LinearProgressWithLabel(props) {\n return (\n \n \n \n \n {`${Math.round(\n props.value\n )}%`}\n \n )\n}\nLinearProgressWithLabel.propTypes = {\n value: PropTypes.number.isRequired\n}\n\nexport default function UploadProgressDialog({uploading}) {\n if (uploading || uploading === 0) {\n return (\n Uploading file ...\n \n \n \n \n \n )\n }\n return null\n}\n\nUploadProgressDialog.propTypes = {\n uploading: PropTypes.number\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useRef, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {\n makeStyles, IconButton, Tooltip, TextField\n} from '@material-ui/core'\nimport UploadIcon from '@material-ui/icons/CloudUpload'\nimport { useDropzone } from 'react-dropzone'\nimport { useApi } from '../api'\nimport {ItemButton, useLane} from '../archive/Browser'\nimport { useEntryStore } from '../entry/EntryContext'\nimport OverwriteExistingFileDialog from './OverwriteExistingFileDialog'\nimport UploadProgressDialog from '../uploads/UploadProgressDialog'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nconst useFileEditQuantityStyles = makeStyles(theme => ({\n dropzone: {\n border: 0\n },\n dropzoneActive: {\n backgroundColor: theme.palette.primary.main,\n borderTopLeftRadius: 4,\n borderTopRightRadius: 4,\n '& input, & button, & label, & a': {\n color: theme.palette.primary.contrastText\n }\n }\n}))\nconst FileEditQuantity = React.memo(props => {\n const classes = useFileEditQuantityStyles()\n const {onChange, onFailed, quantityDef, value, ...otherProps} = props\n const {index} = otherProps\n const {uploadId, metadata} = useEntryStore() || {}\n const {api} = useApi()\n const [askForOverwrite, setAskForOverwrite] = useState(false)\n const dropedFiles = useRef([])\n const [uploading, setUploading] = useState(null)\n const lane = useLane()\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const uploadFile = useCallback((files, overwrite = false) => {\n const mainfilePathSegments = metadata.mainfile.split('/')\n const mainfileDir = mainfilePathSegments.slice(0, mainfilePathSegments.length - 1).join('/')\n const mainfileDirEncoded = mainfileDir.split('/').map(segment => encodeURIComponent(segment)).join('/')\n let fullPaths = files.map((file) => mainfileDir ? mainfileDir + '/' + file.name : file.name)\n\n const formData = new FormData() // eslint-disable-line no-undef\n if (quantityDef.shape.length > 0) {\n files.forEach((file) => {\n formData.append('file', file)\n })\n } else {\n formData.append('file', files[0])\n fullPaths = fullPaths[0]\n }\n\n return new Promise((resolve, reject) => {\n api.put(\n `/uploads/${uploadId}/raw/${mainfileDirEncoded}?overwrite_if_exists=${overwrite}`,\n formData, {\n onUploadProgress: (progressEvent) => {\n const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)\n setUploading(percentCompleted)\n }\n }\n )\n .then(response => resolve({response, fullPaths}))\n .catch(error => reject(error))\n .finally(() => {\n setUploading(null)\n })\n })\n }, [api, uploadId, metadata, quantityDef])\n\n const handleDropFiles = useCallback(files => {\n if (!files?.[0]?.name) {\n return // Not dropping a file, but something else. Ignore.\n }\n\n dropedFiles.current = files\n uploadFile(files).then(({response, fullPaths}) => {\n if (onChange) {\n onChange(fullPaths)\n }\n }).catch(error => {\n if (error.apiMessage === \"The provided path already exists and overwrite_if_exists is set to False.\") {\n setAskForOverwrite(true)\n } else {\n onFailed(new Error(error))\n }\n })\n }, [uploadFile, onChange, onFailed])\n\n const handleChange = useCallback(event => {\n const value = event.target.value\n if (onChange) {\n onChange(value)\n }\n }, [onChange])\n\n const {getRootProps, getInputProps, open, isDragAccept} = useDropzone({onDrop: handleDropFiles, noClick: true})\n const dropzoneClassName = isDragAccept ? classes.dropzoneActive : classes.dropzone\n\n const handleOverwrite = useCallback((files) => {\n if (!files?.[0]?.name) {\n return\n }\n\n uploadFile(files, true)\n .then(({response, fullPaths}) => {\n if (onChange) {\n onChange(fullPaths)\n }\n })\n .catch(error => {\n onFailed(new Error(error))\n })\n setAskForOverwrite(false)\n }, [onChange, onFailed, uploadFile])\n\n return (\n
\n \n \n \n \n \n \n \n \n {lane && value && (\n \n )}\n \n )\n }}\n />\n setAskForOverwrite(false)}\n />\n
\n )\n})\nFileEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func,\n onFailed: PropTypes.func\n}\nexport default FileEditQuantity\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useState, useRef } from 'react'\nimport { Editor } from '@tinymce/tinymce-react'\nimport PropTypes from 'prop-types'\nimport { Box, FormControl, FormLabel, makeStyles } from '@material-ui/core'\nimport DOMPurify from 'dompurify'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nconst useStyle = makeStyles(theme => ({\n root: {\n borderBottom: '1px solid rgba(0, 0, 0, 0.42)',\n marginBottom: 1\n },\n focused: {\n transition: 'border-bottom-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',\n transitionProperty: 'border-bottom-color',\n transitionDuration: '200ms',\n transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',\n transitionDelay: '0ms',\n borderBottom: `2px solid ${theme.palette.primary.main}`\n }\n}))\n\nconst RichTextEditQuantity = React.memo((props) => {\n const classes = useStyle()\n const {quantityDef, value, onChange, height} = props\n const initialHeight = height || 500\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n const initialValue = useRef(value)\n const editedValue = useRef(value)\n const [focus, setFocus] = useState(false)\n const [initialized, setInitialized] = useState(false)\n\n if (editedValue.current !== value) {\n // Means that the value has been changed elsewhere, for example edited in a different tab\n // In this case we need to force an update to the provided value\n editedValue.current = value\n initialValue.current = value\n }\n\n const handleChange = useCallback((value) => {\n editedValue.current = value\n if (onChange) {\n onChange(value === '' ? undefined : value)\n }\n }, [onChange])\n\n const handleImageUpload = useCallback((blobInfo, success, failure, progress) => {\n success('data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64())\n }, [])\n\n const handleEditorInit = useCallback(editor => {\n setInitialized(true)\n }, [setInitialized])\n\n return (\n \n \n {label}\n \n \n handleEditorInit(editor)}\n init={{\n resize: true,\n height: initialHeight,\n menubar: false,\n plugins: [\n 'advlist autolink lists link image charmap print preview anchor',\n 'searchreplace visualblocks code',\n 'insertdatetime media table paste code help wordcount'\n ],\n toolbar: 'undo redo | formatselect | ' +\n 'bold italic backcolor editimage | alignleft aligncenter ' +\n 'alignright alignjustify | bullist numlist outdent indent | image table | ' +\n 'removeformat',\n skin: 'nomad',\n images_upload_handler: handleImageUpload,\n paste_data_images: true\n }}\n onEditorChange={handleChange}\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n initialValue={DOMPurify.sanitize(initialValue.current || '')}\n />\n \n \n )\n})\nRichTextEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func,\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n}\n\nexport default RichTextEditQuantity\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Contains definitions for the different search bar syntaxes. This mapping is\n// used for performing the parsing, creating an info dialog and for\n// including/excluding certain syntaxes with the app config.\n\nconst opMap = {\n '<=': 'lte',\n '>=': 'gte',\n '>': 'gt',\n '<': 'lt'\n}\nconst opMapReverse = {\n '<=': 'gte',\n '>=': 'lte',\n '>': 'lt',\n '<': 'gt'\n}\n\nconst reString = '[^\\\\s=<>](?:[^=<>]*[^\\\\s=<>])?'\nconst reOp = '(?:<|>)=?'\nconst reEquality = new RegExp(`^(${reString})\\\\s*=\\\\s*(${reString})$`)\nconst reLte = RegExp(`^(${reString})\\\\s*(${reOp})\\\\s*(${reString})$`)\nconst reLteGte = new RegExp(`^(${reString})\\\\s*(${reOp})\\\\s*(${reString})\\\\s*(${reOp})\\\\s*(${reString})$`)\nconst reExists = new RegExp(`^(${reString})\\\\s*=\\\\s*\\\\*$`)\n\nexport const SearchSyntaxes = {\n existence: {\n regex: reExists,\n parse: (input) => {\n const exists = input.match(reExists)\n return {\n inputNormalized: `${exists[1]} = *`,\n target: 'quantities',\n value: exists[1]\n }\n },\n readme: 'Used to query for the existence of a specific metainfo field in the data.',\n examples: ['authors.name = *'],\n label: 'Value existence',\n labelShort: 'existence'\n },\n equality: {\n regex: reEquality,\n parse: (input) => {\n const equals = input.match(reEquality)\n const target = equals[1]\n return {\n inputNormalized: `${equals[1]} = ${equals[2]}`,\n target,\n value: equals[2]\n }\n },\n readme: 'Used to query for a specific value with exact match.',\n examples: ['author.name = John Doe'],\n label: 'Value equality',\n labelShort: 'equality'\n },\n range_bounded: {\n regex: reLteGte,\n parse: (input) => {\n const ltegteSandwich = input.match(reLteGte)\n const a = ltegteSandwich[1]\n const op1 = ltegteSandwich[2]\n const b = ltegteSandwich[3]\n const op2 = ltegteSandwich[4]\n const c = ltegteSandwich[5]\n const target = b\n const value = {\n [opMapReverse[op1]]: a,\n [opMap[op2]]: c\n }\n return {\n inputNormalized: `${ltegteSandwich[1]} ${ltegteSandwich[2]} ${ltegteSandwich[3]} ${ltegteSandwich[4]} ${ltegteSandwich[5]}`,\n target,\n value\n }\n },\n readme: 'Queries values that are between two numerical limits, inclusive or exclusive. You can also specify a unit if the target has a certain dimensionality.',\n examples: [\n '0 <= results.material.n_elements <= 2',\n '0 eV < results.properties.geometry_optimization.final_energy_difference < 1e-3 eV'\n ],\n label: 'Range query (bounded)',\n labelShort: 'range'\n },\n range_half_bounded: {\n regex: reLte,\n parse: (input) => {\n const ltegte = input.match(reLte)\n const a = ltegte[1]\n const op = ltegte[2]\n const b = ltegte[3]\n const aNumber = /\\d/.test(a)\n const target = aNumber ? b : a\n const query = aNumber ? a : b\n const value = {[opMap[op]]: query}\nreturn {\n inputNormalized: `${ltegte[1]} ${ltegte[2]} ${ltegte[3]}`,\n target,\n value\n }\n },\n readme: 'Queries values that are above/below a numerical limit, inclusive or exclusive. You can also specify a unit if the target has a certain dimensionality.',\n examples: [\n 'results.material.n_elements > 2',\n 'results.properties.geometry_optimization.final_energy_difference <= 1e-3 eV'\n ],\n label: 'Range query (half-bounded)',\n labelShort: 'range'\n },\n free_text: {\n regex: /[^]*/,\n parse: (input) => {\n return {\n inputNormalized: input,\n target: 'text_search_contents',\n value: input\n }\n },\n readme: 'Free-form text query across keywords associated with an entry. Requires that a set of text search contents has been filled in the entry.',\n examples: ['type anything there'],\n label: 'Free-text query',\n labelShort: 'free-text'\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n useCallback,\n useMemo,\n useEffect,\n useContext,\n createContext,\n useRef\n} from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport { Tooltip, List, ListItemText, ListSubheader } from '@material-ui/core'\nimport HelpOutlineIcon from '@material-ui/icons/HelpOutline'\nimport { getSchemaAbbreviation, getSuggestions, parseJMESPath } from '../../../utils'\nimport { useSearchContext } from '../SearchContext'\nimport { VariableSizeList } from 'react-window'\nimport { InputText } from './InputText'\n\n/**\n * Wrapper around InputText that is specialized in showing metainfo options. The\n * allowed options are controlled.\n */\nexport const InputMetainfoControlled = React.memo(({\n label,\n value,\n options,\n error,\n validate,\n onChange,\n onSelect,\n onAccept,\n onBlur,\n onError,\n optional,\n TextFieldProps,\n InputProps,\n PaperComponent,\n group,\n loading,\n disableValidation,\n disableValidateOnSelect\n}) => {\n // Predefine all option objects, all option paths and also pre-tokenize the\n // options for faster matching.\n const { keys, keysSet, filter } = useMemo(() => {\n const keys = Object.keys(options)\n const keysSet = new Set(keys)\n const { filter } = getSuggestions(keys, 0)\n return { keys, keysSet, filter }\n }, [options])\n\n const textProps = useMemo(() => {\n return {\n label,\n ...TextFieldProps\n }\n }, [label, TextFieldProps])\n\n // Used to validate the input and raise errors\n const validateFinal = useCallback((value) => {\n if (disableValidation) {\n return {valid: true, error: undefined}\n }\n const empty = !value || value.length === 0\n if (optional && empty) {\n return {valid: true, error: undefined}\n } else if (empty) {\n return {valid: false, error: 'Please specify a value.'}\n }\n if (validate) {\n return validate(value)\n } else if (!(keysSet.has(value))) {\n return {valid: false, error: `The quantity \"${value}\" is not available.`}\n }\n return {valid: true, error: undefined}\n }, [validate, keysSet, optional, disableValidation])\n\n // Handles the selectance of a suggested value\n const handleSelect = useCallback((key) => {\n onSelect?.(key, options[key])\n }, [onSelect, options])\n\n // Used to filter the shown options based on input\n const filterOptions = useCallback((opt, { inputValue }) => {\n let filtered = filter(inputValue)\n if (group) filtered = filtered.sort((a, b) => options[a].group > options[b].group ? 1 : -1)\n return filtered\n }, [options, filter, group])\n\n return options?.[key]?.group)}\n renderGroup={group && renderGroup}\n getOptionLabel={option => option}\n filterOptions={filterOptions}\n loading={loading}\n renderOption={(id) => }\n validate={validateFinal}\n disableValidateOnSelect={disableValidateOnSelect}\n />\n})\n\nInputMetainfoControlled.propTypes = {\n label: PropTypes.string,\n value: PropTypes.string,\n options: PropTypes.objectOf(PropTypes.shape({\n key: PropTypes.string.isRequired, // The value used for matching\n definition: PropTypes.object, // The definition for the metainfo.\n primary: PropTypes.string, // The value shown as primary text, defaults to key.\n secondary: PropTypes.string, // Optional secondary text. Defaults to data type + schema read from definition.\n description: PropTypes.string, // Optional description shown as hover. Defaults to desription read from definition.\n schema: PropTypes.string, // Schema name. Defaults to schema read from searchQuantities.\n dtype: PropTypes.string, // Data type. Defaults to data type read from definition.\n group: PropTypes.string // Optional group information\n })),\n error: PropTypes.string,\n validate: PropTypes.func, // Optional custom validation function\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onAccept: PropTypes.func,\n onError: PropTypes.func,\n onBlur: PropTypes.func,\n optional: PropTypes.bool, // Set to true if field can be empty\n group: PropTypes.bool, // Set to true if group should be shown\n TextFieldProps: PropTypes.object,\n InputProps: PropTypes.object,\n PaperComponent: PropTypes.any,\n loading: PropTypes.bool,\n disableValidation: PropTypes.bool,\n disableValidateOnSelect: PropTypes.bool\n}\n\nInputMetainfoControlled.defaultProps = {\n label: \"quantity\"\n}\n\n/**\n * Wrapper around InputText that is specialized in showing metainfo options. The\n * allowed options are uncontrolled: they are specified by the current\n * SearchContext.\n */\nexport const InputMetainfo = React.memo(({\n dtypes,\n dtypesRepeatable,\n disableNonAggregatable,\n ...rest\n}) => {\n const { filterData } = useSearchContext()\n\n // Fetch the available metainfo names and create options that are compatible\n // with InputMetainfo.\n const options = useMemo(() => {\n return getMetainfoOptions(filterData, dtypes, dtypesRepeatable, disableNonAggregatable)\n }, [filterData, dtypes, dtypesRepeatable, disableNonAggregatable])\n\n return \n})\n\nInputMetainfo.propTypes = {\n /* List of allowed data types for non-repeatable quantities. */\n dtypes: PropTypes.object,\n /* List of allowed data types for repeatable quantities. */\n dtypesRepeatable: PropTypes.object,\n /* Whether non-aggregatable values are excluded */\n disableNonAggregatable: PropTypes.bool\n}\n\n/**\n * Wrapper around InputText which accepts JMESPath syntax for quantities. The\n * allowed quantities are uncontrolled: they are specified by the current\n * SearchContext.\n */\nexport const InputJMESPath = React.memo(React.forwardRef(({\n dtypes,\n dtypesRepeatable,\n disableNonAggregatable,\n ...rest\n}, ref) => {\n const { filterData } = useSearchContext()\n\n // Fetch the available metainfo names and create options that are compatible\n // with InputMetainfo.\n const [options, keysSet] = useMemo(() => {\n const options = getMetainfoOptions(filterData, dtypes, dtypesRepeatable, disableNonAggregatable)\n const keysSet = new Set(Object.keys(options))\n return [options, keysSet]\n }, [filterData, dtypes, dtypesRepeatable, disableNonAggregatable])\n\n // Used to validate the JMESPath input\n const validate = useCallback((value) => {\n const {quantity, path, extras, error: errorParse, schema} = parseJMESPath(value)\n if (errorParse) {\n return {valid: false, error: 'Invalid JMESPath query, please check your syntax.'}\n }\n if (!(keysSet.has(quantity))) {\n return {valid: false, error: `The quantity \"${quantity}\" is not available.`}\n }\n for (const extra of extras) {\n if (!filterData[extra]) {\n return {valid: false, error: `The quantity \"${extra}\" is not available.`}\n }\n }\n if (filterData[quantity].repeats_section && quantity === path + schema) {\n return {valid: false, error: `The quantity \"${quantity}\" is contained in at least one repeatable section. Please use JMESPath syntax to select one or more target sections.`}\n }\n return {valid: true, error: undefined}\n }, [keysSet, filterData])\n\n return \n}))\n\nInputJMESPath.propTypes = {\n /* List of allowed data types for non-repeatable quantities. */\n dtypes: PropTypes.object,\n /* List of allowed data types for repeatable quantities. */\n dtypesRepeatable: PropTypes.object,\n /* Whether non-aggregatable values are excluded */\n disableNonAggregatable: PropTypes.bool\n}\n\n/**\n * Custom virtualized list component for displaying metainfo values.\n */\nexport const ListboxMetainfo = React.forwardRef((props, ref) => {\n const { children, ...other } = props\n const itemSize = 64\n const headerSize = 40\n const itemData = React.Children.toArray(children)\n const itemCount = itemData.length\n\n // Calculate size of child element.\n const getChildSize = (child) => {\n return React.isValidElement(child) && child.type === ListSubheader\n ? headerSize\n : itemSize\n }\n\n // Calculates the height of the suggestion box\n const getHeight = () => {\n return itemCount > 8\n ? 8 * itemSize\n : itemData.map(getChildSize).reduce((a, b) => a + b, 0)\n }\n\n const gridRef = useResetCache(itemCount)\n\n return
\n \n \n getChildSize(itemData[index])}\n overscanCount={5}\n itemCount={itemCount}\n >\n {renderRow}\n \n \n \n
\n})\n\nListboxMetainfo.propTypes = {\n children: PropTypes.node\n}\n\nexport const LISTBOX_PADDING = 8\nconst OuterElementContext = createContext({})\n\nexport const OuterElementType = React.forwardRef((props, ref) => {\n const outerProps = useContext(OuterElementContext)\n return
\n})\n\nexport const renderGroup = (params) => [\n \n {`${params.group} suggestions`}\n ,\n params.children\n]\n\nexport function useResetCache(data) {\n const ref = useRef(null)\n useEffect(() => {\n if (ref.current != null) {\n ref.current.resetAfterIndex(0, true)\n }\n }, [data])\n return ref\n}\n\nexport function renderRow({ data, index, style }) {\n return React.cloneElement(data[index], {\n style: {\n ...style,\n top: style.top + LISTBOX_PADDING\n }\n })\n}\n\n/* A metainfo option shown as a suggestion.\n */\nexport const useMetainfoOptionStyles = makeStyles(theme => ({\n optionText: {\n flexGrow: 1,\n overflowX: 'scroll',\n '&::-webkit-scrollbar': {\n display: 'none'\n },\n '-ms-overflow-style': 'none',\n scrollbarWidth: 'none'\n },\n noWrap: {\n whiteSpace: 'nowrap'\n },\n option: {\n width: '100%',\n display: 'flex',\n alignItems: 'stretch',\n // The description icon is hidden until the item is hovered. It is not\n // removed from the document with \"display: none\" in order for the hover to\n // not change the layout which may cause other elements to shift around.\n '& .description': {\n visibility: \"hidden\",\n marginRight: theme.spacing(-0.5),\n display: 'flex',\n width: theme.spacing(5),\n marginLeft: theme.spacing(1),\n alignItems: 'center',\n justifyContent: 'center'\n },\n '&:hover .description': {\n visibility: \"visible\"\n }\n }\n}))\nexport const MetainfoOption = ({id, options}) => {\n const styles = useMetainfoOptionStyles()\n const option = options[id]\n const primary = option.primary || option.definition?.quantity || option.key\n const dtype = option.dtype || option.definition?.dtype\n const schema = getSchemaAbbreviation(option.schema || option.definition?.schema)\n const secondary = option.secondary || ((dtype || schema)\n ? `${dtype} ${schema ? `| ${schema}` : ''}`\n : null)\n const description = option.description || option.definition?.description\n\n return
\n \n {description &&\n \n
\n \n
\n
\n }\n
\n}\n\nMetainfoOption.propTypes = {\n id: PropTypes.string,\n options: PropTypes.object\n}\n\n/**\n * Used to filter a set of filterData according to the given filtering options.\n *\n * @param {*} filterData The filterData to filter\n * @param {*} dtypes Included data types as a set\n * @param {*} dtypesRepeatable Included repeatabel data types as a set\n * @param {*} disableNonAggregatable Whether to filter out non-aggregatable filters\n * @returns Object containing the filtered filters\n */\nfunction getMetainfoOptions(filterData, dtypes, dtypesRepeatable, disableNonAggregatable) {\n return Object.fromEntries(\n Object.entries(filterData)\n .filter(([key, data]) => {\n if (disableNonAggregatable && !data.aggregatable) return false\n const dtype = data?.dtype\n const passed = data?.repeats\n ? dtypesRepeatable?.has(dtype)\n : dtypes?.has(dtype)\n return passed\n })\n .map(([key, data]) => [key, {\n key: key,\n definition: data\n }])\n )\n}\n","/* eslint-disable no-unused-vars */\n/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useState, useMemo, createContext, useContext, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport assert from 'assert'\nimport { isNil, has } from 'lodash'\nimport { makeStyles } from '@material-ui/core/styles'\nimport SearchIcon from '@material-ui/icons/Search'\nimport HistoryIcon from '@material-ui/icons/History'\nimport CloseIcon from '@material-ui/icons/Close'\nimport { HelpButton } from '../../components/Help'\nimport { Paper, Tooltip, Chip, List, ListSubheader, Typography, IconButton, Box } from '@material-ui/core'\nimport { parseQuantityName, getSchemaAbbreviation } from '../../utils'\nimport { useSuggestions } from '../../hooks'\nimport { useSearchContext } from './SearchContext'\nimport { quantityNameSearch } from './FilterRegistry'\nimport { VariableSizeList } from 'react-window'\nimport { InputText } from './input/InputText'\nimport { SearchSuggestion, SuggestionType } from './SearchSuggestion'\nimport { SearchSyntaxes } from './SearchSyntaxes'\nimport { renderRow, useResetCache, LISTBOX_PADDING } from './input/InputMetainfo'\n\n/**\n * Displays a suggestion in the search bar.\n */\nexport const useSuggestionStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n '& > *': {\n marginRight: theme.spacing(1)\n },\n '& > *:last-child': {\n marginRight: 0\n },\n // The delete icon is hidden until the item is hovered. It is not removed\n // from the document with \"display: none\" in order for the hover to not\n // change the layout which may cause other elements to shift around.\n '& .delete': {\n visibility: \"hidden\"\n },\n '&:hover .delete': {\n visibility: \"visible\"\n }\n },\n primary: {\n flexGrow: 1,\n whiteSpace: 'nowrap',\n overflowX: 'scroll',\n '&::-webkit-scrollbar': {\n display: 'none'\n },\n '-ms-overflow-style': 'none',\n scrollbarWidth: 'none'\n }\n}))\nconst Suggestion = ({suggestion, onDelete, tooltip}) => {\n const typeTooltip = (suggestion.type === SuggestionType.Name\n ? 'Suggested name for an available filter in this app'\n : SearchSyntaxes[suggestion.type]?.readme) || ''\n const label = (suggestion.type === SuggestionType.Name\n ? 'name'\n : SearchSyntaxes[suggestion.type]?.labelShort) || ''\n const styles = useSuggestionStyles()\n let schema, primary\n if (suggestion.type === SuggestionType.Name) {\n const {path, schema: schemaTmp} = parseQuantityName(suggestion.input)\n primary = path\n schema = schemaTmp\n } else {\n primary = suggestion.input\n }\n\n return
\n \n \n {primary}\n \n \n {suggestion.history\n ? \n {\n event.preventDefault()\n event.stopPropagation()\n onDelete?.()\n }}>\n \n \n \n : null\n }\n {suggestion.history\n ? \n \n \n : null\n }\n {schema\n ? \n {getSchemaAbbreviation(schema)}\n \n : null\n }\n \n \n \n
\n}\n\nSuggestion.propTypes = {\n suggestion: PropTypes.object,\n onDelete: PropTypes.func,\n tooltip: PropTypes.string\n}\n\nconst queryControlsHeight = 5.5\nexport const useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n paper: {\n width: '100%'\n },\n offset: {\n height: theme.spacing(queryControlsHeight),\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center'\n },\n queryContainer: {\n minHeight: theme.spacing(queryControlsHeight),\n marginTop: theme.spacing(0.5),\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-start'\n },\n iconButton: {\n padding: 10\n }\n}))\n\n/**\n * This component shows a search bar with autocomplete functionality.\n */\nconst SearchBar = React.memo(({\n quantities,\n className\n}) => {\n const styles = useStyles()\n const {\n filters,\n filterData,\n filterFullnames,\n useUpdateFilter,\n useParseQuery,\n useSearchSuggestions,\n usePushSearchSuggestion,\n useRemoveSearchSuggestion,\n useSetPagination,\n searchSyntaxes,\n useResetFilters,\n useRefresh,\n useApiData\n } = useSearchContext()\n\n const includedFormats = Object\n .keys(SearchSyntaxes)\n .filter((key) => !searchSyntaxes?.exclude?.includes(key))\n const formatReadmeList = includedFormats\n .map((key) => {\n const examples = SearchSyntaxes[key]?.examples?.map((example) => ` ${example}`).join('\\n')\n return ` - **${SearchSyntaxes[key]?.label}**: ${SearchSyntaxes[key]?.readme} For example:\\n\\n \\`\\`\\`\\n${examples}\\n \\`\\`\\`\\n`\n })\n .join('\\n')\n const [inputValue, setInputValue] = useState('')\n const [suggestionInput, setSuggestionInput] = useState('')\n const [error, setError] = useState(false)\n const setPagination = useSetPagination()\n const updateFilter = useUpdateFilter()\n const parseQuery = useParseQuery()\n const inputRef = useRef()\n\n const [quantitiesAll, quantitiesAllSet, quantitiesSuggestable] = useMemo(() => {\n let quantitySetSuggestable, quantityList\n // Custom list of quantities. They are validated against the current search\n // context.\n if (quantities) {\n for (const quantity of quantities) {\n assert(\n quantity.name === quantityNameSearch || has(filterData, quantity.name),\n `Quantity ${quantity.name} does not exist in the current search context.`\n )\n }\n quantityList = [...quantities]\n quantitySetSuggestable = new Set(\n quantityList\n .map(q => q.name)\n .filter(name => name === quantityNameSearch || filterData[name]?.suggestion)\n )\n // Default quantities to use. Certain quantities are prioritized, others\n // come in alphabetical order.\n } else {\n quantitySetSuggestable = new Set([\n 'results.material.elements',\n 'results.material.chemical_formula_hill',\n 'results.material.chemical_formula_anonymous',\n 'results.material.structural_type',\n 'results.material.symmetry.structure_name',\n 'results.method.simulation.program_name',\n 'authors.name'\n ])\n const filterList = [...filters]\n filterList.forEach(q => quantitySetSuggestable.add(q))\n quantityList = filterList.map((name) => ({name, size: 5}))\n // The list of available quantity names is provided at the very\n // bottom.\n quantitySetSuggestable.add(quantityNameSearch)\n quantityList.push({name: quantityNameSearch})\n }\n const quantitySet = new Set(quantityList.map((q) => q.name))\n return [quantityList, quantitySet, quantitySetSuggestable]\n }, [quantities, filterData, filters])\n\n const [suggestionNames, setSuggestionNames] = useState(quantitiesSuggestable)\n const suggestionQuantities = useMemo(() => {\n return quantitiesAll.filter((q) => suggestionNames.has(q.name))\n }, [quantitiesAll, suggestionNames])\n\n const [suggestionsMatch, setSuggestionsMatch] = useState([])\n const pushSuggestion = usePushSearchSuggestion()\n const removeSuggestion = useRemoveSearchSuggestion()\n const suggestionsHistory = useSearchSuggestions(inputValue)\n const [suggestionsMetainfo, loading] = useSuggestions(suggestionQuantities, quantitiesAllSet, suggestionInput, filterData)\n\n // Contains the final set of suggestions\n const [suggestions, keys] = useMemo(() => {\n const suggestions = {}\n\n for (const suggestion of suggestionsMatch) {\n suggestions[suggestion.key] = suggestion\n }\n\n for (const suggestion of suggestionsHistory) {\n suggestions[suggestion.key] = suggestion\n }\n\n for (const suggestion of suggestionsMetainfo) {\n let input, type\n if (suggestion.category === quantityNameSearch) {\n type = SuggestionType.Name\n input = suggestion.value\n } else {\n type = SuggestionType.Equality\n input = `${suggestion.category} = ${suggestion.value}`\n }\n const suggestionObject = new SearchSuggestion({input, type})\n const key = suggestionObject.key\n if (!has(suggestions, key)) {\n suggestions[key] = suggestionObject\n }\n }\n return [suggestions, Object.keys(suggestions)]\n }, [suggestionsMatch, suggestionsHistory, suggestionsMetainfo])\n\n const clearSuggestions = useCallback(() => {\n setSuggestionInput('')\n setSuggestionsMatch([])\n }, [])\n\n const clearInput = useCallback(() => {\n setError(error => error ? undefined : null)\n setInputValue('')\n setSuggestionInput('')\n }, [])\n\n // Used to check the validity of the given quantity name\n const checkMetainfo = useCallback((name) => {\n const fullName = filterFullnames[name] || name\n if (!quantitiesAllSet.has(fullName)) {\n return [undefined, `The quantity '${name}' is not supported`]\n }\n if (filterData[fullName].section) {\n return [fullName, `Cannot target metainfo sections`]\n }\n return [fullName, undefined]\n }, [quantitiesAllSet, filterData, filterFullnames])\n\n // Get suggestions based on the current input and the supported query syntaxes\n const getSuggestionsMatch = useCallback((input) => {\n input = input?.trim()\n if (!input?.length) {\n return []\n }\n const suggestions = []\n for (const key of includedFormats) {\n // regex.test() is significantly faster than string.match()\n const match = SearchSyntaxes[key].regex.test(input)\n if (match) {\n suggestions.push(new SearchSuggestion({input, type: key}))\n }\n }\n return suggestions\n }, [includedFormats])\n\n // Triggered when the user selects a highlighted item with mouse or with\n // keyboard.\n const handleAccept = useCallback((key) => {\n let suggestion = suggestions[key]\n if (!suggestion) {\n const bestSuggestion = suggestions[keys[0]]\n if (bestSuggestion?.input?.trim() === key?.trim()) {\n suggestion = bestSuggestion\n } else {\n setError('Unsupported query')\n return\n }\n }\n if (suggestion.type === SuggestionType.Name) {\n setInputValue(suggestion.input)\n return\n }\n\n // Parse the suggestion using the matched format\n const format = SearchSyntaxes[suggestion.type]\n const {target: targetTmp, value: valueTmp, inputNormalized} = format.parse(suggestion.input)\n\n // Check that targeted metainfo is ok, and attempt to parse the query\n const [target, errorMeta] = checkMetainfo(targetTmp)\n let value, errorQuery\n if (!errorMeta) {\n try {\n value = parseQuery(target, valueTmp)\n } catch (err) {\n errorQuery = `Invalid value for the metainfo ${target}. Please check your syntax.`\n }\n }\n\n // Catch any errors and raise them\n const error = errorMeta || errorQuery\n if (error) {\n setError(error)\n return\n }\n\n // The pagination is explicitly set to be done by descending relevance\n // score if a free-text query is performed\n if (suggestion.type === SuggestionType.Freetext) {\n setPagination(old => {\n return {...old, order_by: '_score', order: 'desc'}\n })\n }\n\n // Update the search filter\n updateFilter([target, old => {\n const multiple = filterData[target].multiple\n return (format?.label === SuggestionType.RangeHalfBounded || suggestion.type === SuggestionType.RangeBounded || isNil(old) || !multiple)\n ? value\n : new Set([...old, ...value])\n }])\n\n // We need to create a copy here, since Recoil won't allow mutating object\n // stored in a state.\n const normalizedSuggestion = new SearchSuggestion(suggestion)\n normalizedSuggestion.input = inputNormalized\n\n pushSuggestion(normalizedSuggestion)\n clearSuggestions()\n clearInput()\n }, [checkMetainfo, clearInput, clearSuggestions, filterData, keys, parseQuery, pushSuggestion, suggestions, updateFilter, setPagination])\n\n // When a suggestion is highlighted with keyboard (not mouse), the text field\n // is changed to that suggestion value. Note that this should not trigger the\n // suggestions etc. and this is why we don't set inputValue.\n const handleHighlight = useCallback((key, reason) => {\n if (reason === 'keyboard') {\n const suggestion = suggestions[key]?.input\n if (suggestion) {\n inputRef.current.value = suggestion\n }\n }\n }, [suggestions])\n\n // Handle typing events\n const handleInputChange = useCallback((input) => {\n setError(error => error ? undefined : null)\n setInputValue(input)\n input = input?.trim()\n if (!input) {\n clearSuggestions()\n return\n }\n\n // Get suggestions for making specific queries\n setSuggestionsMatch(getSuggestionsMatch(input))\n\n // Start getting suggestions from ES\n const split = input.split('=', 2)\n let quantitySet = quantitiesSuggestable\n if (split.length === 2) {\n const quantityName = split[0].trim()\n const quantityFullname = filterFullnames[quantityName]\n if (quantitiesSuggestable.has(quantityName)) {\n quantitySet = new Set([quantityName])\n input = split[1].trim()\n } else if (quantitiesSuggestable.has(quantityFullname)) {\n quantitySet = new Set([quantityFullname])\n input = split[1].trim()\n }\n }\n setSuggestionNames(quantitySet)\n setSuggestionInput(input)\n }, [quantitiesSuggestable, filterFullnames, getSuggestionsMatch, clearSuggestions])\n\n return \n \n ,\n endAdornment: \n \n ,\n inputRef: inputRef\n }}\n getOptionLabel={option => option}\n filterOptions={(options) => options}\n loading={loading}\n renderOption={(id) => removeSuggestion(suggestions[id].key)}\n tooltip={suggestions[id].type === SuggestionType.Name ? filterData[suggestions[id].input]?.description : undefined}\n />}\n />\n \n \n})\n\nSearchBar.propTypes = {\n // List of quantities that the search targets. The suggestions are returned in\n // the same order.\n quantities: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string,\n size: PropTypes.number\n })),\n className: PropTypes.string\n}\n\n/**\n * Custom virtualized list component for displaying searchbar suggestions.\n */\nconst OuterElementContext = createContext({})\nexport const ListboxSuggestion = React.forwardRef((props, ref) => {\n const { children, ...other } = props\n const itemSize = 48\n const headerSize = 40\n const itemData = React.Children.toArray(children)\n const itemCount = itemData.length\n\n // Calculate size of child element.\n const getChildSize = (child) => {\n return React.isValidElement(child) && child.type === ListSubheader\n ? headerSize\n : itemSize\n }\n\n // Calculates the height of the suggestion box\n const getHeight = () => {\n return itemCount > 8\n ? 8 * itemSize\n : itemData.map(getChildSize).reduce((a, b) => a + b, 0)\n }\n\n const gridRef = useResetCache(itemCount)\n\n return
\n \n \n getChildSize(itemData[index])}\n overscanCount={5}\n itemCount={itemCount}\n >\n {renderRow}\n \n \n \n
\n})\n\nListboxSuggestion.propTypes = {\n children: PropTypes.node\n}\n\nconst OuterElementType = React.forwardRef((props, ref) => {\n const outerProps = useContext(OuterElementContext)\n return
\n})\n\nexport default SearchBar\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useContext, useEffect, useState, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport { DoesNotExist } from '../api'\nimport { useDataStore } from '../DataStore'\nimport { useHistory } from 'react-router-dom'\nimport { getUrl } from '../nav/Routes'\nimport { apiBase } from '../../config'\n\nexport const uploadPageContext = React.createContext()\n\nexport function useUploadPageContext() {\n return useContext(uploadPageContext)\n}\n\nconst UploadPageContext = React.memo(function UploadPageContext({uploadId, children}) {\n const dataStore = useDataStore()\n dataStore.resetIfNeeded(uploadId)\n const [uploadStoreObj, setUploadStoreObj] = useState(dataStore.getUpload(apiBase, uploadId))\n\n const onUploadStoreUpdated = useCallback((oldStoreObj, newStoreObj) => {\n setUploadStoreObj(newStoreObj)\n }, [setUploadStoreObj])\n\n useEffect(() => {\n return dataStore.subscribeToUpload(apiBase, uploadId, onUploadStoreUpdated, true, true)\n }, [dataStore, uploadId, onUploadStoreUpdated])\n\n const history = useHistory()\n\n useEffect(() => {\n if (uploadStoreObj.error && uploadStoreObj.error instanceof DoesNotExist && uploadStoreObj.deletionRequested) {\n history.push(getUrl('user/uploads', new URL(window.location.href).pathname))\n }\n })\n\n return \n {children}\n \n})\nUploadPageContext.propTypes = {\n uploadId: PropTypes.string.isRequired,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nexport default UploadPageContext\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { apiBase } from '../../config'\nimport { Tooltip, IconButton, Menu, MenuItem } from '@material-ui/core'\nimport DownloadIcon from '@material-ui/icons/CloudDownload'\n\nconst EntryDownloadButton = React.memo(function EntryDownloadButton(props) {\n const {tooltip, disabled, buttonProps, dark, query} = props\n const [anchorEl, setAnchorEl] = useState(null)\n\n const handleClick = event => {\n event.stopPropagation()\n setAnchorEl(event.currentTarget)\n }\n\n const handleSelect = (urlSuffix) => {\n setAnchorEl(null)\n const queryStringData = query\n const owner = query.visibility || 'visible'\n const url = `${apiBase}/v1/entries/${urlSuffix}?owner=${owner}&json_query=${JSON.stringify(queryStringData)}`\n window.location.assign(url)\n }\n\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n return \n \n \n \n \n \n \n handleSelect('raw')}>Raw uploaded files\n handleSelect('archive/download')}>Processed data\n \n \n})\nEntryDownloadButton.propTypes = {\n /**\n * The query that defines what to download.\n */\n query: PropTypes.object.isRequired,\n /**\n * A tooltip for the button\n */\n tooltip: PropTypes.string,\n /**\n * Whether the button is disabled\n */\n disabled: PropTypes.bool,\n /**\n * Properties forwarded to the button.\n */\n buttonProps: PropTypes.object,\n dark: PropTypes.bool\n}\n\nexport default EntryDownloadButton\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport { QuantityCell, QuantityRow, QuantityTable } from '../../Quantity'\nimport { isNil, chunk } from 'lodash'\nimport {\n Accordion as MuiAccordion,\n AccordionDetails as MuiAccordionDetails,\n AccordionSummary as MuiAccordionSummary,\n Card,\n CardContent,\n CardHeader,\n CardActions,\n Grid,\n Typography,\n makeStyles,\n withStyles\n} from '@material-ui/core'\nimport { traverseDeep } from '../../../utils'\n\n/**\n * Contains components for displaying properties. The main idea is:\n * - Each main property category should be placed inside a PropertyCard.\n * - A property card should have PropertyGrid as a direct descendant.\n * - PropertyItems are used to display individual properties inside a PropertyGrid.\n * - If you wish to subdivide a single PropertyItem into smaller subitems, use a\n * PropertySubGrid with the set of wanted PropertyItems inside it.\n */\n\nconst gridSpacing = 2\n\n/**\n * Card for displaying a set of related properties.\n */\nconst usePropertyCardStyles = makeStyles(theme => ({\n header: {\n paddingBottom: theme.spacing(1),\n minHeight: 0,\n flexGrow: '0'\n },\n content: {\n height: '100%',\n width: '100%',\n boxSizing: 'border-box',\n minHeight: 0\n },\n action: {\n marginRight: theme.spacing(0),\n marginTop: theme.spacing(0)\n },\n container: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n width: '100%'\n }\n}))\nexport function PropertyCard({className, children, ...headerProps}) {\n const styles = usePropertyCardStyles()\n\n return \n
\n \n \n {children}\n \n
\n
\n}\nPropertyCard.propTypes = {\n className: PropTypes.string,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\n/**\n * For displaying actions at the bottom of a PropertyCard.\n */\nconst usePropertyCardActionsStyles = makeStyles(theme => ({\n root: {\n marginLeft: 'auto'\n }\n}))\nexport function PropertyCardActions({children}) {\n const styles = usePropertyCardActionsStyles()\n return \n
\n {children}\n
\n
\n}\n\nPropertyCardActions.propTypes = {\n children: PropTypes.any\n}\n\n/**\n * For displaying actions at the bottom of a PropertyCard.\n */\nconst usePropertyTitleStyles = makeStyles(theme => ({\n root: {\n textTransform: 'none',\n fontSize: '0.9rem'\n }\n}))\nexport function PropertyTitle({title, align, className}) {\n const styles = usePropertyTitleStyles()\n return title\n ? {title}\n : null\n}\n\nPropertyTitle.propTypes = {\n title: PropTypes.string,\n align: PropTypes.string,\n className: PropTypes.string\n}\n\n/**\n * For displaying a row of properties, typically within a PropertyCard.\n */\nexport function PropertyGrid({className, children}) {\n return \n {children}\n \n}\n\nPropertyGrid.propTypes = {\n className: PropTypes.string,\n children: PropTypes.any\n}\n\n/**\n * For displaying a grid of PropertyItems inside another PropertyItem.\n */\nconst usePropertySubGridStyles = makeStyles(theme => ({\n root: {\n height: `calc(100% + ${theme.spacing(gridSpacing)}px)`\n }\n}))\nexport function PropertySubGrid({children}) {\n const styles = usePropertySubGridStyles()\n return \n {children}\n \n}\n\nPropertySubGrid.propTypes = {\n className: PropTypes.string,\n children: PropTypes.any\n}\n\n/**\n * For displaying an individual property, typically within a PropertyRow.\n */\nconst usePropertyItemStyles = makeStyles(theme => ({\n title: {\n marginBottom: theme.spacing(1)\n },\n column: {\n width: '100%',\n height: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n content: {\n flex: 1,\n minHeight: 0 // min-height: 0 to allow the item to shrink to fit inside the container.\n }\n}))\nexport function PropertyItem({\n title,\n align,\n className,\n classes,\n children,\n height,\n minHeight,\n ...other\n}) {\n const styles = usePropertyItemStyles({classes: classes})\n return \n
\n \n
\n {children}\n
\n
\n \n}\n\nPropertyItem.propTypes = {\n title: PropTypes.string,\n align: PropTypes.string,\n height: PropTypes.string.isRequired,\n minHeight: PropTypes.string,\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.any\n}\n\nPropertyItem.defaultProps = {\n height: '400px'\n}\n\n/**\n * For displaying the provenance for a property.\n */\nconst usePropertyProvenanceListStyle = makeStyles(theme => ({\n column: {\n width: '100%',\n height: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n content: {\n flex: 1,\n minHeight: 0 // min-height: 0 to allow the item to shrink to fit inside the container.\n }\n}))\nexport function PropertyProvenanceList({className, classes, children, ...other}) {\n const styles = usePropertyProvenanceListStyle({classes: classes})\n return \n
\n
\n {children}\n
\n
\n
\n}\n\nPropertyProvenanceList.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.any\n}\n\nconst Accordion = withStyles((theme) => ({\n expanded: {\n margin: theme.spacing(1)\n }\n}))(MuiAccordion)\n\nconst AccordionSummary = withStyles((theme) => ({\n root: {\n padding: `0 ${theme.spacing(1)}px`,\n minHeight: theme.spacing(4),\n '&$expanded': {\n minHeight: theme.spacing(4)\n }\n },\n content: {\n margin: 0,\n '&$expanded': {\n margin: 0\n }\n },\n expanded: {}\n}))(MuiAccordionSummary)\n\nconst AccordionDetails = withStyles((theme) => ({\n root: {\n margin: 0,\n padding: `0 ${theme.spacing(1)}px`\n }\n}))(MuiAccordionDetails)\n\n/**\n * For displaying provenance steps.\n */\nexport const PropertyProvenanceItem = React.memo(({title, data, path, columns}) => {\n // Recursively extract items from the data and split the items into equal sized rows\n const rows = useMemo(() => {\n if (!data) return undefined\n\n const quantities = []\n for (const [key, value] of traverseDeep(data, true)) {\n quantities.push({\n quantity: `${path === '' ? '' : `${path}.`}${key.join('.')}`,\n value: value\n })\n }\n\n return chunk(quantities, columns)\n }, [data, path, columns])\n\n if (!data) {\n return null\n }\n\n return \n }>\n \n \n \n \n {rows.map((row) =>\n \n {row.map((column) => )}\n \n )}\n \n \n \n})\n\nPropertyProvenanceItem.propTypes = {\n title: PropTypes.string,\n data: PropTypes.object,\n path: PropTypes.string,\n columns: PropTypes.number\n}\n\nPropertyProvenanceItem.defaultProps = {\n columns: 4\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { capitalize, isEmpty } from 'lodash'\nimport { Select, FormControl, MenuItem } from '@material-ui/core'\nimport { PropertyCard, PropertyGrid, PropertyItem, PropertyCardActions } from './PropertyCard'\nimport Quantity, { QuantityTable, QuantityRow, QuantityCell } from '../../Quantity'\nimport { MaterialButton } from '../../nav/Routes'\nimport Structure, { toMateriaStructure } from '../../visualization/Structure'\nimport NoData from '../../visualization/NoData'\nimport { encyclopediaBase, guiBase } from '../../../config'\n\n/**\n * For displaying the most descriptive chemical formula that is present in an\n * entry.\n*/\nexport function Formula({data}) {\n const formula = (data) => {\n const material = data?.results?.material\n if (!material) {\n return null\n }\n\n return material.chemical_formula_hill || material.chemical_formula_reduced || material.chemical_formula_descriptive\n }\n\n return \n}\n\nFormula.propTypes = {\n data: PropTypes.object\n}\n\n/**\n * Displays a summary of material related properties for an entry.\n */\nconst MaterialCard = React.memo(({index, properties, archive}) => {\n // Find out which properties are present\n const structures = index?.results?.properties?.structures\n const hasStructures = structures?.structure_original ||\n structures?.structure_conventional ||\n structures?.structure_primitive\n const hasLatticeParameters = structures?.structure_original?.lattice_parameters ||\n structures?.structure_conventional?.lattice_parameters ||\n structures?.structure_primitive?.lattice_parameters\n const hasSymmetry = index?.results?.material?.symmetry\n\n // Get all structure types that are present\n const structureTypes = {}\n if (structures) {\n Object.keys(structures).forEach((key) => {\n const name = capitalize(key.split('_').pop())\n structureTypes[key] = name\n })\n }\n\n // Determine the structure to show by default\n let defaultStructure\n if (structures && !isEmpty(structures)) {\n if ('structure_original' in structures) {\n defaultStructure = 'structure_original'\n } else if ('structure_conventional' in structures) {\n defaultStructure = 'structure_conventional'\n } else if (!isEmpty(structures)) {\n defaultStructure = Object.keys(structures)[0]\n }\n }\n const [structureType, setStructureType] = useState(defaultStructure)\n\n const handleStructureChange = useCallback((event) => {\n setStructureType(event.target.value)\n }, [])\n\n if (!index?.results?.material) {\n return null\n }\n\n // Prepare the data for the visualizer\n const urlPrefix = `${window.location.pathname.slice(guiBase.length)}/data/results/properties/structures`\n const materialId = index.results?.material?.material_id\n const structurePath = `results.properties.structures.${structureType}`\n const structureSection = archive?.results?.properties?.structures?.[structureType]\n const m_path = `${urlPrefix}/${structureType}`\n const structure = structureSection && toMateriaStructure(structureSection)\n\n // Dropdown for selecting a specific structure\n const select = hasStructures && \n \n {Object.entries(structureTypes).map(([type, name]) =>\n {name}\n )}\n \n \n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {hasStructures\n ? \n : }\n \n \n {hasSymmetry\n ? \n \n \n \n \n \n \n \n \n \n \n \n \n \n : \n }\n \n \n {hasLatticeParameters\n ? \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n : }\n \n \n {encyclopediaBase && materialId &&\n \n \n View in Encyclopedia\n \n \n }\n \n})\n\nMaterialCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default MaterialCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport Quantity from '../Quantity'\nimport { Formula } from './properties/MaterialCard'\nimport { Tooltip, IconButton, Box } from '@material-ui/core'\nimport { EntryButton } from '../nav/Routes'\nimport DetailsIcon from '@material-ui/icons/ArrowForward'\nimport { makeStyles } from '@material-ui/core/styles'\n\nexport const MethodMetadata = React.memo(({data}) => {\n const methodQuantities = []\n const addMethodQuantities = (obj, parentKey, hidden = []) => {\n const children = {}\n Object.keys(obj).forEach(key => {\n if (hidden.includes(key)) {\n return\n }\n const value = obj[key]\n if (Array.isArray(value) || typeof value === 'string') {\n if (value.length > 0) {\n methodQuantities.push({quantity: `${parentKey}.${key}`})\n }\n } else if (value instanceof Object) {\n children[key] = value\n }\n })\n Object.keys(children).forEach(key => addMethodQuantities(children[key], `${parentKey}.${key}`))\n }\n if (data?.results?.method) {\n addMethodQuantities(data.results.method, 'results.method')\n }\n if (data?.results?.eln) {\n addMethodQuantities(data.results.eln, 'results.eln', ['names', 'sections', 'descriptions'])\n }\n\n methodQuantities.push({quantity: 'entry_type'})\n methodQuantities.push({quantity: 'entry_name'})\n\n return \n {methodQuantities.map(({...quantityProps}) => (\n \n ))}\n \n})\nMethodMetadata.propTypes = {\n data: PropTypes.object\n}\n\nexport const DomainMetadata = React.memo(({data}) => {\n return <>\n \n \n \n \n \n})\nDomainMetadata.propTypes = {\n data: PropTypes.object\n}\n\nexport const UserMetadata = React.memo(({data}) => {\n return (\n
\n \n \n \n \n
\n )\n})\nUserMetadata.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nexport const EntryIds = React.memo(({data}) => {\n return (\n
\n \n {/* */}\n \n \n \n \n \n \n
\n )\n})\nEntryIds.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nexport const VisitEntryAction = React.memo(({data, ...props}) => {\n // The visit button is hidden if the entry is still processing.\n if (data.process_running) {\n return null\n }\n\n // The exit transition is disabled for this tooltip because this button causes\n // a navigation that does not fully remove the button from the DOM (the page\n // is cached and a new page is shown immediately). If the exit transition is\n // left on, the button can flicker on the new page.\n return \n \n \n})\nVisitEntryAction.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nexport const EntryRowActions = React.memo((props) => {\n return \n \n \n})\n\nconst useEntryDetailsStyles = makeStyles(theme => ({\n entryDetails: {\n paddingTop: theme.spacing(2),\n paddingLeft: theme.spacing(4),\n paddingRight: theme.spacing(4)\n },\n entryDetailsContents: {\n display: 'flex',\n width: '100%',\n margin: '0'\n },\n entryDetailsRow: {\n paddingRight: theme.spacing(3)\n },\n entryDetailsActions: {\n display: 'flex',\n flexBasis: 'auto',\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: 'flex-end',\n marginBottom: theme.spacing(1),\n marginTop: theme.spacing(2)\n }\n}))\n\nexport const EntryDetails = React.memo(({data}) => {\n const classes = useEntryDetailsStyles()\n\n return (\n
\n
\n
\n \n
\n\n
\n \n \n \n \n \n \n
\n\n
\n \n \n \n \n \n \n \n
\n
\n\n
\n \n Go to the entry page\n \n
\n
\n )\n})\nEntryDetails.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nexport default EntryDetails\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { IconButton } from '@material-ui/core'\nimport { MaterialButton } from '../nav/Routes'\nimport DetailsIcon from '@material-ui/icons/ArrowForward'\n\nexport const MaterialRowActions = React.memo(({data, ...rest}) => {\n return \n \n \n})\n\nMaterialRowActions.propTypes = {\n data: PropTypes.object.isRequired\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useMemo, useEffect, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport jmespath from 'jmespath'\nimport { Paper, Typography, Tooltip, IconButton } from '@material-ui/core'\nimport { Alert } from '@material-ui/lab'\nimport LaunchIcon from '@material-ui/icons/Launch'\nimport {\n Datatable,\n DatatableLoadMorePagination,\n DatatableTable,\n DatatableToolbar,\n DatatableToolbarActions\n} from '../datatable/Datatable'\nimport EntryDownloadButton from '../entry/EntryDownloadButton'\nimport EntryDetails, { EntryRowActions } from '../entry/EntryDetails'\nimport { MaterialRowActions } from '../material/MaterialDetails'\nimport { pluralize, formatInteger, parseJMESPath, filterOptions } from '../../utils'\nimport { isEmpty, isArray } from 'lodash'\nimport { useSearchContext } from './SearchContext'\n\n/**\n * Used to retrieve an URL link from the row metadata and display a link icon to\n * that resource.\n */\nexport const ActionURL = React.memo(({action, data}) => {\n const {path} = parseJMESPath(action.path)\n let href = jmespath.search(data, path)\n href = isArray(href) ? href[0] : href\n return \n \n \n})\nActionURL.propTypes = {\n action: PropTypes.object.isRequired, // Action configuration from app config\n data: PropTypes.object.isRequired // ES index data\n}\n\n/**\n * Displays the list of search results.\n */\nexport const SearchResults = React.memo(({\n noAction,\n onSelectedChanged,\n defaultUncollapsedEntryID,\n title,\n 'data-testid': testID,\n PaperProps,\n ...otherProps\n}) => {\n const {columns, resource, rows, useResults, useApiQuery} = useSearchContext()\n const {data, pagination, setPagination} = useResults()\n const apiQuery = useApiQuery()\n const [selected, setSelected] = useState(new Set())\n const shownColumns = columns\n ? columns\n .filter((column) => column.selected)\n .map((column) => column.quantity)\n : []\n\n useEffect(() => {\n if (onSelectedChanged) {\n onSelectedChanged(selected)\n }\n }, [onSelectedChanged, selected])\n\n const query = useMemo(() => {\n if (selected === 'all') {\n return apiQuery\n }\n return {entry_id: [...selected]}\n }, [selected, apiQuery])\n\n const actions = useCallback((data) => {\n const actionComponents = []\n for (const [key, value] of Object.entries(filterOptions(rows.actions))) {\n const component = {\n 'url': \n }[value.type]\n if (component) {\n actionComponents.push(component)\n }\n }\n if (resource === \"entries\") {\n actionComponents.push()\n } else if (resource === \"materials\") {\n actionComponents.push()\n }\n return actionComponents\n }, [rows, resource])\n\n if (isEmpty(columns)) {\n return \n No search columns defined within this search context. Ensure that all GUI artifacts are created.\n \n }\n\n if (pagination.total === 0) {\n return no results\n }\n\n if (!pagination.total) {\n return searching ...\n }\n\n // Select components based on the targeted resource\n let details\n let buttons\n if (resource === \"entries\") {\n details = rows?.details?.render || EntryDetails\n if (!noAction) buttons = \n }\n\n return \n option.entry_id}\n onSelectedChanged={rows?.selection?.enabled ? setSelected : undefined}\n {...otherProps}\n >\n \n {rows?.selection?.enabled &&\n \n {buttons}\n \n }\n \n row.entry_id === defaultUncollapsedEntryID)}\n >\n load more\n \n \n \n})\n\nSearchResults.propTypes = {\n noAction: PropTypes.bool,\n PaperProps: PropTypes.object,\n onSelectedChanged: PropTypes.func,\n defaultUncollapsedEntryID: PropTypes.string,\n title: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nSearchResults.defaultProps = {\n 'data-testid': 'search-results'\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useContext, useEffect, useMemo, useState} from 'react'\nimport {\n makeStyles, DialogContent, Dialog, Typography, FormControlLabel,\n Box, MenuItem, ListItemIcon, ListItemText, MenuList, Chip, RadioGroup, Radio, FormControl, Checkbox\n} from '@material-ui/core'\nimport Button from '@material-ui/core/Button'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport PropTypes from 'prop-types'\nimport {FreeformSearchContext, useSearchContext} from \"../search/SearchContext\"\nimport {ui, searchQuantities, apiBase} from \"../../config\"\nimport SearchBar from '../search/SearchBar'\nimport {useApi} from '../api'\nimport {useUploadPageContext} from './UploadPageContext'\nimport {useEntryStore} from '../entry/EntryContext'\nimport {traverse, useGlobalMetainfo} from '../archive/metainfo'\nimport { defaultFilterGroups, quantityNameSearch } from '../search/FilterRegistry'\nimport { SearchResults } from '../search/SearchResults'\nimport {useDataStore} from '../DataStore'\nimport {pluralize, resolveNomadUrlNoThrow} from \"../../utils\"\nimport {Check} from '@material-ui/icons'\nimport { cloneDeep } from 'lodash'\nimport {getItemLabelKey} from '../archive/ArchiveBrowser'\n\n// Use the same context as in the global entries search, but with free-text\n// query enabled\nconst searchDialogContext = React.createContext()\nconst context = cloneDeep(ui?.apps?.options?.entries)\ncontext.search_syntaxes.exclude = undefined\n\nconst allFilters = new Set(defaultFilterGroups && (Object.keys(context?.filter_menus?.options))\n .map(filter => {\n const group = defaultFilterGroups?.[filter]\n return group ? Array.from(group) : []\n }).flat())\n\nconst useStyles = makeStyles(theme => ({\n dialog: {\n width: '100%',\n minWidth: 1100,\n minHeight: 400\n },\n dialogContent: {\n overflowY: 'hidden'\n },\n resultsTable: {\n overflowY: 'scroll',\n maxHeight: 700\n },\n searchBar: {\n display: 'flex',\n flexGrow: 0,\n zIndex: 1,\n backgroundColor: 'rgba(0, 0, 0, 0.09)'\n },\n filters: {\n marginTop: 10\n }\n}))\n\nconst shownColumns = [\n 'entry_name',\n 'entry_type',\n 'authors',\n 'upload_name'\n]\n\nexport async function getSectionsInfo(api, dataStore, reference, entry_id) {\n let response\n try {\n response = await api.post(`entries/archive/query`, {\n owner: 'visible',\n query: {\n entry_id: entry_id,\n processed: true\n }\n })\n } catch (e) {\n return []\n }\n const dataArchive = response?.data?.[0]?.archive\n if (!dataArchive) return\n const sections = Object.keys(dataArchive).filter((key) => 'm_def' in dataArchive[key])\n const referencedSubSections = []\n if (sections.length > 0) {\n for (const section of sections) {\n const m_def = dataArchive[section].m_def\n const url = dataArchive.metadata.upload_id ? `${apiBase}/uploads/${dataArchive.metadata.upload_id}/archive/${entry_id}` : undefined\n const dataMetainfoDefUrl = resolveNomadUrlNoThrow(m_def, url)\n const sectionDef = await dataStore.getMetainfoDefAsync(dataMetainfoDefUrl)\n traverse(dataArchive[section], sectionDef, section, (section, sectionDef, path) => {\n const ref = reference && [...reference][0]\n if (ref &&\n (sectionDef._qualifiedName === ref || sectionDef._allBaseSections?.map(section => section._qualifiedName).includes(ref))) {\n const itemLabelKey = getItemLabelKey(sectionDef)\n const name = itemLabelKey && section[itemLabelKey]\n referencedSubSections.push({name: name, upload_id: response?.data?.[0]?.upload_id, entry_id: response?.data?.[0]?.entry_id, path: path})\n }\n })\n }\n }\n const references = referencedSubSections || []\n return references.map(reference => {\n const fullPath = reference?.path && reference.path !== '/data' && reference.path !== 'data' ? `${dataArchive?.metadata?.mainfile}#${reference.path}` : dataArchive?.metadata?.mainfile\n return {\n label: reference.name ? `${reference.name} (./${reference?.path})` : `./${reference?.path}`,\n fullPath: fullPath,\n mainfile: dataArchive?.metadata?.mainfile,\n entry_name: dataArchive?.metadata?.entry_name,\n entry_id: reference.entry_id,\n upload_id: reference.upload_id,\n shownValue: reference.name || fullPath,\n value: reference.path,\n data: reference\n }\n })\n}\n\nexport async function getSchemaInfo(globalMetainfo, entry_id) {\n const customMetainfo = await globalMetainfo.fetchAllCustomMetainfos(true, {entry_id: entry_id})\n const schemaArchive = customMetainfo[0]?._data\n const sectionDefs = schemaArchive?.definitions?.section_definitions\n return sectionDefs.map(sectionDef => {\n const fullPath = `${schemaArchive?.metadata?.mainfile}#${sectionDef.name}`\n return {\n label: sectionDef.name,\n fullPath: fullPath,\n mainfile: schemaArchive?.metadata?.mainfile,\n entry_name: schemaArchive?.metadata?.entry_name,\n entry_id: schemaArchive.metadata.entry_id,\n value: sectionDef.name,\n shownValue: sectionDef.name || fullPath,\n data: {sectionDef: sectionDef, archive: schemaArchive}\n }\n })\n}\n\nconst Details = React.memo(({data}) => {\n const {api} = useApi()\n const entry_id = data?.entry_id\n const globalMetainfo = useGlobalMetainfo()\n const dataStore = useDataStore()\n const {useFiltersLockedState} = useSearchContext()\n const filtersLocked = useFiltersLockedState(['section_defs.definition_qualified_name'])\n const [sections, setSections] = useState()\n\n const {selected, onSelectedChanged} = useContext(searchDialogContext)\n\n useEffect(() => {\n if (entry_id && globalMetainfo) {\n fetch()\n }\n async function fetch() {\n if (filtersLocked['section_defs.definition_qualified_name']?.has('nomad.metainfo.metainfo.Definition')) {\n const schemas = await getSchemaInfo(globalMetainfo, entry_id)\n setSections(schemas)\n } else {\n const references = await getSectionsInfo(api, dataStore, filtersLocked['section_defs.definition_qualified_name'], entry_id)\n setSections(references)\n }\n }\n }, [api, dataStore, entry_id, filtersLocked, globalMetainfo])\n\n if (!sections) {\n return ''\n }\n\n return (\n \n {sections.map((section, index) => {\n const isSelected = selected && section.entry_id === selected.entry_id && section.value === selected.value\n return (\n onSelectedChanged(section)}>\n {isSelected && \n \n }\n \n {section.label}\n \n \n )\n })}\n \n )\n})\nDetails.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nconst columns = (context?.columns || [])\n .map((column) => ({...column, selected: shownColumns.includes(column.quantity)}))\nconst rows = context?.rows\nrows.details = {enabled: true, render: Details}\nrows.actions = {enabled: false}\n\nfunction SearchBox({open, onCancel, onSelectedChanged, selected}) {\n const classes = useStyles()\n const {user} = useApi()\n const [filter, setFilter] = useState('visible')\n const [unpublished, setUnpublished] = useState(true)\n const [published, setPublished] = useState(true)\n const {\n useSetFilter,\n useFilters,\n useFiltersLocked,\n useUpdateFilter,\n filters: filterList\n } = useSearchContext()\n const filtersLocked = useFiltersLocked()\n const filters = useFilters([...allFilters]\n .filter(\n filter => filter !== 'visibility' &&\n filter !== 'processed' &&\n filter !== 'upload_id' &&\n filter !== 'published' &&\n filter !== 'main_author.user_id' &&\n !filtersLocked[filter]\n ))\n const updateFilter = useUpdateFilter()\n const uploadContext = useUploadPageContext()\n const entryContext = useEntryStore()\n const {uploadId} = uploadContext || entryContext\n const setVisibilityFilter = useSetFilter('visibility')\n const setUploadIdFilter = useSetFilter('upload_id')\n const setProcessedFilter = useSetFilter('processed')\n const setPublishedFilter = useSetFilter('published')\n const setMainAuthorFilter = useSetFilter('main_author.user_id')\n\n const handleCancel = useCallback(() => {\n onCancel()\n }, [onCancel])\n\n useEffect(() => {\n setProcessedFilter(true)\n setPublishedFilter(published === unpublished ? undefined : published)\n if (filter === 'visible') {\n setVisibilityFilter(undefined)\n setMainAuthorFilter(undefined)\n setUploadIdFilter(undefined)\n } else if (filter === 'mine') {\n setVisibilityFilter('user')\n setMainAuthorFilter(undefined)\n setUploadIdFilter(undefined)\n } else if (filter === 'coauthors') {\n setVisibilityFilter(undefined)\n setMainAuthorFilter([user.sub], {queryMode: 'none'})\n setUploadIdFilter(undefined)\n } else if (filter === 'upload') {\n setVisibilityFilter(undefined)\n setMainAuthorFilter(undefined)\n setUploadIdFilter(uploadId)\n }\n }, [filter, published, unpublished, setUploadIdFilter, setMainAuthorFilter, setVisibilityFilter, setPublishedFilter, setProcessedFilter, uploadId, user])\n\n const contextValue = useMemo(() => ({\n selected: selected,\n onSelectedChanged: onSelectedChanged\n }), [onSelectedChanged, selected])\n\n const definedFilters = useMemo(() => {\n return Object.values(filters).filter(value => {\n return value !== undefined\n })\n }, [filters])\n\n const handleResetSearch = () => {\n return Object.keys(filters).forEach(key => {\n updateFilter([key, undefined])\n })\n }\n\n // Customize the search bar suggestions priority.\n const quantities = useMemo(() => {\n let quantities = new Set([\n 'entry_name',\n 'mainfile',\n 'text_search_contents',\n 'results.material.elements',\n 'results.material.chemical_formula_hill',\n 'results.material.chemical_formula_anonymous',\n 'results.material.structural_type',\n 'results.material.symmetry.structure_name',\n 'results.method.simulation.program_name',\n 'authors.name'\n ])\n const allQuantities = [...filterList]\n allQuantities\n .filter(q => !quantities.has(q) && searchQuantities[q]?.suggestion)\n .forEach(q => quantities.add(q))\n quantities = [...quantities].map((name) => ({name, size: 5}))\n quantities.push({name: quantityNameSearch})\n return quantities\n }, [filterList])\n\n return \n \n \n \n \n Filters\n \n \n \n \n setFilter('visible')}\n />\n )}\n label='All'\n />\n setFilter('mine')}\n />\n )}\n label='Only mine'\n />\n setFilter('coauthors')}\n />\n )}\n label='Only from others'\n />\n setFilter('upload')}\n />\n )}\n label='Only this upload'\n />\n \n \n \n setPublished(event.target.checked)}\n color='primary'\n checked={published}\n name='Published'\n />}\n label='Published'\n />\n setUnpublished(event.target.checked)}\n color='primary'\n checked={unpublished}\n name='Unpublished'\n />}\n label='Unpublished'\n />\n \n {definedFilters.length > 0 && handleResetSearch()}/>}\n \n
\n \n
\n
\n \n \n \n \n
\n
\n}\nSearchBox.propTypes = {\n open: PropTypes.bool,\n onCancel: PropTypes.func,\n onSelectedChanged: PropTypes.func,\n selected: PropTypes.object\n}\n\nfunction SectionSelectDialog(props) {\n const {open, onSelectedChanged, selected, onCancel, filtersLocked} = props\n\n if (!open) return null\n\n return \n \n \n}\nSectionSelectDialog.propTypes = {\n open: PropTypes.bool,\n onSelectedChanged: PropTypes.func,\n selected: PropTypes.object,\n onCancel: PropTypes.func,\n filtersLocked: PropTypes.object\n}\n\nexport default SectionSelectDialog\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useMemo, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {useApi} from '../api'\nimport {Autocomplete} from '@material-ui/lab'\nimport {useGlobalMetainfo} from '../archive/metainfo'\nimport {useDataStore} from '../DataStore'\nimport {getSchemaInfo, getSectionsInfo} from './SectionSelectDialog'\nimport {ListItemText} from '@material-ui/core'\nimport {useSuggestions} from \"../../hooks\"\nimport {useErrors} from \"../errors\"\nimport {debounce} from 'lodash'\nimport {defaultFilterData} from '../search/FilterRegistry'\n\nconst getOptionSelected = (option, value) => {\n return value ? option.entry_id === value.entry_id && option.value === value.value : false\n}\n\nconst suggestionQuantities = [{'name': 'entry_name', 'size': 10}, {'name': 'mainfile', 'size': 10}]\nconst quantitiesAllSet = new Set(['entry_name', 'mainfile'])\n\nconst entryFilterOptions = (option) => {\n return `${option.mainfile}|${option.entry_name}|${option.upload_name || option.upload_id}|${option.entry_id}|${option.shownValue}`\n}\n\nconst pathFilterOptions = (option) => {\n return `${option.mainfile}#${option.value}|${option.mainfile}#/${option.value}|${option.mainfile}#${option.label}`\n}\n\nconst filterOptions = (options, state) => {\n const inputValue = state?.inputValue\n if (inputValue) {\n const parts = inputValue.split(\"#\")\n const entryName = parts?.[0] || ''\n const path = parts?.[1] || ''\n const shownEntries = []\n return options?.filter(option => {\n if (option.menuType === 'entry') {\n const found = entryFilterOptions(option).match(new RegExp(entryName.toLowerCase(), \"gi\"))\n if (option?.entry_id && found) {\n shownEntries.push(option.entry_id)\n }\n return found\n } else {\n if (option?.entry_id && shownEntries.includes(option.entry_id)) {\n return pathFilterOptions(option).match(new RegExp(path.toLowerCase(), \"gi\"))\n } else {\n return false\n }\n }\n })\n } else {\n return []\n }\n}\n\nfunction SectionSelectAutocomplete(props) {\n const {renderInput, onValueChanged, value, showSectionLabel, filtersLocked, onError} = props\n const {api} = useApi()\n const {raiseError} = useErrors()\n const globalMetainfo = useGlobalMetainfo()\n const dataStore = useDataStore()\n const [suggestionInput, setSuggestionInput] = useState('')\n const [entries, setEntries] = useState([])\n const [selectedEntry, setSelectedEntry] = useState(undefined)\n const [suggestions] = useSuggestions(suggestionQuantities, quantitiesAllSet, suggestionInput, defaultFilterData)\n const [inputValue, setInputValue] = useState({primary: '', secondary: ''})\n const [lastInputValue, setLastInputValue] = useState({primary: '', secondary: ''})\n const [options, setOptions] = useState([])\n const [internalError, setInternalError] = useState('')\n const [showPrimary, setShowPrimary] = useState(!showSectionLabel)\n\n useEffect(() => {\n setInternalError('')\n const entryNames = suggestions.filter(suggestion => suggestion.category === 'entry_name').map(suggestion => suggestion.value)\n const mainfiles = suggestions.filter(suggestion => suggestion.category === 'mainfile').map(suggestion => suggestion.value)\n const queries = []\n if (entryNames?.length > 0) {\n queries.push({'entry_name:any': entryNames})\n }\n if (mainfiles?.length > 0) {\n queries.push({'mainfile:any': mainfiles})\n }\n if (value?.entry_id) {\n queries.push({'entry_id': value.entry_id})\n }\n if (queries.length === 0) return\n const requestBody = {\n owner: 'visible',\n exclude: ['quantities', 'sections', 'files'],\n query: {\n and: [\n filtersLocked,\n {or: queries}\n ]\n }\n }\n api.post(`entries/query`, requestBody).then(response => {\n const data = response?.data?.map(entry => {\n return {\n upload_id: entry.upload_id,\n upload_name: entry.upload_name,\n entry_id: entry.entry_id,\n mainfile: entry.mainfile,\n entry_name: entry.entry_name,\n shownValue: '',\n menuType: 'entry'}\n })\n let notFoundEntries = new Set()\n entryNames.forEach(entryName => {\n if (!data.map(entry => entry.entry_name).includes(entryName)) {\n notFoundEntries.add(entryName)\n }\n })\n mainfiles.forEach(mainfile => {\n if (!data.map(entry => entry.mainfile).includes(mainfile)) {\n notFoundEntries.add(mainfile)\n }\n })\n data?.sort((a, b) => (a.entry_name || a.mainfile) >= (b.entry_name || b.mainfile) ? 1 : -1)\n notFoundEntries = [...notFoundEntries].sort((a, b) => a >= b ? 1 : -1)\n setEntries(data.concat(notFoundEntries.map(entryName => {\n return {mainfile: entryName, entry_name: entryName, menuType: 'entry'}\n })))\n }).catch(error => {\n raiseError(error)\n })\n }, [api, filtersLocked, raiseError, suggestions, value])\n\n const handleInputValueChange = useCallback((value) => {\n setSuggestionInput(value.toLowerCase())\n }, [])\n\n const debouncedHandleInputChange = useMemo(() => {\n return debounce(handleInputValueChange, 700)\n }, [handleInputValueChange])\n\n const handleInputChange = useCallback((event, value) => {\n if (event?.type === 'change') {\n setInputValue({primary: value, secondary: value})\n debouncedHandleInputChange(value)\n }\n }, [debouncedHandleInputChange])\n\n useEffect(() => {\n const newOptions = []\n entries.forEach(entry => {\n newOptions.push(entry)\n if (selectedEntry && entry.entry_id === selectedEntry.entryId) {\n selectedEntry.sections.forEach(section => {\n newOptions.push(section)\n })\n }\n })\n if (options.length !== newOptions.length || !options.every((option, index) => option === newOptions[index])) {\n setOptions(newOptions)\n }\n }, [entries, options, selectedEntry])\n\n const handleChange = useCallback((_, value) => {\n setInputValue({primary: value?.fullPath, secondary: value?.shownValue})\n setLastInputValue({primary: value?.fullPath, secondary: value?.shownValue})\n onValueChanged(value)\n }, [onValueChanged])\n\n const setSection = useCallback((sections, value, updateInputValue) => {\n setSelectedEntry({entryId: value.entry_id, sections: sections})\n if (updateInputValue) {\n setInputValue({primary: `${value.mainfile}#`, secondary: `${value.mainfile}#`})\n } else {\n const section = sections?.find(section => section.value === value?.value)\n if (!section) {\n onError('The provided path does not exist')\n const path = value?.archive?.mainfile ? (value?.value && value.value !== '/data' && value.value !== 'data' ? `${value.archive.mainfile}#${value?.value}` : value.archive.mainfile) : ''\n setInputValue({primary: path, secondary: path})\n setLastInputValue({primary: path, secondary: path})\n } else {\n setInputValue({primary: section?.fullPath, secondary: section?.shownValue})\n setLastInputValue({primary: section?.fullPath, secondary: section?.shownValue})\n }\n }\n }, [onError])\n\n const loadSections = useCallback((value, updateInputValue = false) => {\n if (filtersLocked['section_defs.definition_qualified_name']?.includes('nomad.metainfo.metainfo.Definition')) {\n getSchemaInfo(globalMetainfo, value.entry_id)\n .then(sections => setSection(sections, value, updateInputValue))\n } else {\n getSectionsInfo(api, dataStore, filtersLocked['section_defs.definition_qualified_name'], value?.entry_id)\n .then(sections => setSection(sections, value, updateInputValue))\n }\n }, [api, dataStore, filtersLocked, globalMetainfo, setSection])\n\n useEffect(() => {\n if (!internalError) {\n if (value?.entry_id && value?.value) {\n loadSections(value)\n } else {\n setInputValue({primary: '', secondary: ''})\n setLastInputValue({primary: '', secondary: ''})\n }\n }\n }, [internalError, loadSections, onError, value])\n\n const handleEntryClicked = useCallback((event, option) => {\n event.stopPropagation()\n if (selectedEntry !== undefined && option.entry_id === selectedEntry.entryId) {\n setSelectedEntry(undefined)\n } else {\n loadSections(option, true)\n }\n }, [loadSections, selectedEntry])\n\n const handleBlur = useCallback((event) => {\n if (showSectionLabel) {\n setShowPrimary(false)\n }\n setInputValue(lastInputValue)\n }, [lastInputValue, showSectionLabel])\n\n if (options === undefined) {\n return null\n }\n\n const renderOption = (option, props) => {\n if (option.menuType === 'entry') {\n if (option?.entry_id) {\n return handleEntryClicked(event, option)}\n data-testid={'section-select-entry-activated'}/>\n } else {\n return event.stopPropagation()}\n data-testid={'section-select-entry-deactivate'}/>\n }\n } else {\n return \n }\n }\n\n return setShowPrimary(true)}\n onBlur={handleBlur}\n getOptionLabel={(option) => option.shownValue || ''}\n filterOptions={filterOptions}\n renderInput={renderInput}\n renderOption={renderOption}\n inputValue={(showPrimary ? inputValue.primary : inputValue.secondary) || ''}\n freeSolo\n />\n}\nSectionSelectAutocomplete.propTypes = {\n // The standard autocomplete renderInput\n renderInput: PropTypes.func,\n // The event when the selected section is changed\n onValueChanged: PropTypes.func,\n // The default selected section\n value: PropTypes.object,\n // True if the section label should be shown when the focus is lost\n showSectionLabel: PropTypes.bool,\n // Determines the fixed search filters to find the corresponding references or the desired sections.\n filtersLocked: PropTypes.object,\n // Fires and passes the error message when an error occurs during fetching the data or resolving the value\n onError: PropTypes.func\n}\n\nexport default SectionSelectAutocomplete\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useContext, useEffect, useMemo, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport {\n Box, Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton, makeStyles,\n TextField,\n Tooltip\n} from '@material-ui/core'\nimport { useEntryStore } from '../entry/EntryContext'\nimport {ItemButton, useLane} from '../archive/Browser'\nimport { getFieldProps } from './StringEditQuantity'\nimport { refType, resolveNomadUrl, getDisplayLabel } from '../../utils'\nimport AddIcon from '@material-ui/icons/AddCircle'\nimport { getUrlFromDefinition, QuantityMDef } from '../archive/metainfo'\nimport EditIcon from '@material-ui/icons/Edit'\nimport SectionSelectDialog from '../uploads/SectionSelectDialog'\nimport DialogContentText from '@material-ui/core/DialogContentText'\nimport AutoComplete from '@material-ui/lab/Autocomplete'\nimport {useDataStore} from '../DataStore'\nimport SectionSelectAutocomplete from '../uploads/SectionSelectAutocomplete'\nimport {Link} from \"react-router-dom\"\nimport DetailsIcon from '@material-ui/icons/ArrowForward'\nimport OverwriteExistingFileDialog from './OverwriteExistingFileDialog'\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nconst referenceEditQuantityContext = React.createContext(undefined)\n\nfunction useReferenceEditQuantityContext() {\n return useContext(referenceEditQuantityContext)\n}\n\nconst useStyles = makeStyles(theme => ({\n dialog: {\n width: '100%',\n minWidth: 400\n }\n}))\n\nfunction useReferecedSectionDef(quantityDef) {\n return useMemo(() => {\n const referencedDefinition = quantityDef.type._referencedDefinition\n return referencedDefinition.m_def === QuantityMDef ? referencedDefinition._section : referencedDefinition\n }, [quantityDef])\n}\n\nconst CreateNewReferenceDialog = React.memo(({allEntryDataSections, open, onSuccess, onFailed, onCanceled}) => {\n const classes = useStyles()\n const {deploymentUrl, uploadId} = useEntryStore('*') || {}\n const {user, api} = useApi()\n const {raiseError} = useErrors()\n const [value, setValue] = useState('')\n const [suggestions, setSuggestions] = useState([])\n const [selectedUpload, setSelectedUpload] = useState(null)\n const [askForOverwrite, setAskForOverwrite] = useState(false)\n const [selectedSection, setSelectedSection] = useState()\n\n useEffect(() => {\n setSelectedSection(allEntryDataSections?.[0])\n const prepareUploads = async () => {\n const response = await api.get(`/uploads?is_published=false&page_size=10000`)\n const uploads = response.data.map(upload => {\n const uploadName = uploadId === upload.upload_id\n ? (upload.upload_name ? `${upload.upload_name} (This upload)` : 'This upload')\n : (upload.upload_name ? upload.upload_name : `upload-id: ${upload.upload_id}`)\n if (user.sub === upload.main_author) {\n return {label: uploadName, upload_id: upload.upload_id, main_author: upload.main_author, group: 'My uploads'}\n } else {\n return {label: uploadName, upload_id: upload.upload_id, main_author: upload.main_author}\n }\n })\n const myUploads = uploads.filter(upload => upload.group !== undefined)\n const othersUploads = uploads.filter(upload => upload.group === undefined)\n if (othersUploads.length > 0) {\n const authorsID = new Set(othersUploads.map(upload => upload.main_author))\n const response = await api.get(`users?user_id=${Array.from(authorsID).join('&user_id=')}`)\n const users = response['data']\n const usersInfo = {}\n users.forEach(user => (usersInfo[user.user_id] = {name: user.name, affiliation: user.affiliation}))\n othersUploads.forEach(upload => {\n upload['group'] = `Owned by ${(usersInfo[upload.main_author]?.affiliation ? `${usersInfo[upload.main_author]?.name} (${usersInfo[upload.main_author]?.affiliation})` : usersInfo[upload.main_author]?.name)}`\n })\n setSuggestions(myUploads.concat(othersUploads))\n } else {\n setSuggestions(uploads)\n }\n }\n if (user?.sub && open) {\n prepareUploads()\n }\n }, [api, raiseError, uploadId, user?.sub, open, allEntryDataSections])\n\n const createNewEntry = useCallback((fileName, overwrite = false) => {\n const archive = {\n data: {\n m_def: getUrlFromDefinition(selectedSection, {deploymentUrl, uploadId: selectedUpload.upload_id}, true)\n }\n }\n return new Promise((resolve, reject) => {\n api.put(`uploads/${selectedUpload.upload_id}/raw/?file_name=${fileName}.archive.json&wait_for_processing=true&overwrite_if_exists=${overwrite}`, archive)\n .then(response => {\n // TODO handle processing errors\n if (response?.processing?.entry?.process_status !== 'SUCCESS') {\n let error = 'Failed to create the reference.'\n if (response?.processing?.entry?.errors) {\n error = `${error} Details: ${response?.processing?.entry?.errors}`\n }\n reject(new Error(error))\n } else {\n resolve(response)\n }\n })\n .catch(error => {\n reject(error)\n })\n })\n }, [selectedSection, deploymentUrl, selectedUpload?.upload_id, api])\n\n const handleOverwrite = useCallback((data) => {\n createNewEntry(data, true)\n .then(response => {\n onSuccess(response.processing)\n })\n .catch(error => {\n onFailed(new Error(error))\n })\n setAskForOverwrite(false)\n }, [createNewEntry, onFailed, onSuccess])\n\n const handleCreateClick = useCallback(() => {\n createNewEntry(value)\n .then(response => {\n onSuccess(response.processing)\n })\n .catch(error => {\n if (error.apiMessage === \"The provided path already exists and overwrite_if_exists is set to False.\") {\n setAskForOverwrite(true)\n } else {\n onFailed(new Error(error))\n }\n })\n }, [createNewEntry, onFailed, onSuccess, value])\n\n useEffect(() => {\n if (suggestions.length > 0) {\n const thisUpload = suggestions.find(upload => uploadId === upload.upload_id)\n setSelectedUpload(thisUpload)\n }\n }, [suggestions, uploadId])\n\n return \n \n {selectedSection?.name ? `Create new reference of type ${selectedSection.name}` : `Create new reference`}\n \n setSelectedUpload(value)}\n value={selectedUpload}\n getOptionSelected={(option, value) => option.upload_id === value.upload_id}\n groupBy={(option) => option.group}\n getOptionLabel={(option) => option.label}\n renderInput={(params) => }\n />\n {allEntryDataSections?.length > 1 ? setSelectedSection(value)}\n value={selectedSection}\n getOptionSelected={(option, value) => option._qualifiedName === value._qualifiedName}\n getOptionLabel={(option) => option.name}\n renderInput={(params) => }\n /> : ''}\n setValue(event.target.value)}\n data-testid='new-reference-name'\n />\n \n {value ? `File name: ${value}.archive.json` : ''}\n \n \n \n \n \n \n \n \n setAskForOverwrite(false)}\n />\n \n})\nCreateNewReferenceDialog.propTypes = {\n allEntryDataSections: PropTypes.object.isRequired,\n open: PropTypes.bool,\n onSuccess: PropTypes.func,\n onFailed: PropTypes.func,\n onCanceled: PropTypes.func\n}\n\nexport const ItemLink = React.forwardRef(function ItemLink({itemKey, ...props}, ref) {\n const reference = useReferenceEditQuantityContext()\n const path = reference?.value\n return \n})\nItemLink.propTypes = {\n itemKey: PropTypes.string.isRequired\n}\n\nconst ReferenceEditQuantity = React.memo(function ReferenceEditQuantity(props) {\n const {url} = useEntryStore('*') || {}\n const {quantityDef, value, onChange, index} = props\n const [entry, setEntry] = useState(null)\n const [open, setOpen] = useState(false)\n const [createEntryDialogOpen, setCreateEntryDialogOpen] = useState(false)\n const {user, api} = useApi()\n const {raiseError} = useErrors()\n const [error, setError] = useState({error: undefined, processingError: undefined})\n const lane = useLane()\n const dataStore = useDataStore()\n const referencedSectionDef = useReferecedSectionDef(quantityDef)\n const referencedSectionQualifiedName = useMemo(() => referencedSectionDef?._qualifiedName, [referencedSectionDef])\n\n useEffect(() => {\n if (!value || value === '') {\n setError({error: null, processingError: null})\n setEntry(null)\n return\n }\n const resolveValue = async () => {\n if (!url) {\n return\n }\n const resolvedUrl = resolveNomadUrl(value, url)\n if (resolvedUrl.type !== refType.archive && resolvedUrl.type !== refType.metainfo) {\n throw new Error(`Expected archive or metainfo reference, got ${resolvedUrl.type} type for ${value}`)\n }\n let query = {\n entry_id: resolvedUrl.entryId\n }\n if (resolvedUrl?.uploadId) {\n query = {upload_id: resolvedUrl.uploadId, ...query}\n }\n const response = await api.post(`entries/archive/query`, {\n owner: 'visible',\n query: query,\n 'required': {\n 'metadata': {\n 'upload_id': '*',\n 'entry_id': '*',\n 'mainfile': '*',\n 'processing_errors': '*'\n }\n }\n }, {\n noLoading: true\n })\n const data = response.data\n if (data.length > 0) {\n const archive = data[0].archive.metadata\n if (archive.processing_errors.length === 0) {\n setEntry({value: value, archive: archive})\n setError({error: null, processingError: null})\n } else {\n setEntry(null)\n setError({error: null, processingError: 'There are some processing errors in the referenced value'})\n }\n } else {\n setEntry(null)\n setError({error: 'The referenced value does not exist anymore', processingError: null})\n }\n }\n resolveValue()\n }, [api, url, value])\n\n const getReferencePath = useCallback((value) => {\n if (value?.entry_id && value?.upload_id && value?.path) {\n return `../uploads/${value.upload_id}/archive/${value.entry_id}#${value.path}`\n } else if (value?.entry_id && value?.upload_id) {\n return `../uploads/${value.upload_id}/archive/${value.entry_id}#data`\n } else if (value?.entry_id) {\n return `../upload/archive/${value.entry_id}#data`\n } else {\n return undefined\n }\n }, [])\n\n const changeValue = useCallback((value) => {\n if (onChange) {\n onChange(value)\n }\n }, [onChange])\n\n const handleValueChange = useCallback((value) => {\n const referencePath = getReferencePath(value?.data)\n changeValue(referencePath)\n setOpen(false)\n }, [changeValue, getReferencePath])\n\n const itemKey = useMemo(() => {\n if (!isNaN(index)) {\n return `${quantityDef.name}:${index}`\n } else {\n return quantityDef.name\n }\n }, [quantityDef, index])\n\n const {helpDescription, showSectionLabel, ...otherProps} = getFieldProps(quantityDef)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleSuccess = useCallback((value) => {\n setCreateEntryDialogOpen(false)\n const referencePath = getReferencePath({\n entry_name: value.entry.mainfile,\n upload_id: value.upload_id,\n entry_id: value.entry_id\n })\n changeValue(referencePath)\n setEntry({value: referencePath.split('#')[1], archive: value.entry})\n }, [changeValue, getReferencePath])\n\n const handleFailed = useCallback((error) => {\n setCreateEntryDialogOpen(false)\n raiseError(error)\n }, [raiseError])\n\n const handleCanceled = useCallback(() => {\n setCreateEntryDialogOpen(false)\n }, [])\n\n const filtersLocked = useMemo(() => ({'section_defs.definition_qualified_name': [referencedSectionQualifiedName]}), [referencedSectionQualifiedName])\n\n const addIconButtonToEndAdornment = useCallback((endAdornment, actions) => {\n const children = React.Children.toArray(endAdornment.props.children)\n actions.forEach(iconButton => {\n children.push(iconButton)\n })\n return React.cloneElement(endAdornment, {}, children)\n }, [])\n\n const allEntryDataSections = useMemo(() => {\n const inheritingSections = dataStore.getAllInheritingSections(referencedSectionDef)\n const allSections = [referencedSectionDef].concat(inheritingSections)\n return allSections.filter(section => !!section._allBaseSections.find(baseSection => baseSection._qualifiedName === 'nomad.datamodel.data.EntryData'))\n }, [dataStore, referencedSectionDef])\n\n const actions = useMemo(() => {\n const actions = []\n if (!value && allEntryDataSections?.length > 0) {\n actions.push( setCreateEntryDialogOpen(true)}>\n \n \n \n )\n }\n actions.push( setOpen(true)}>\n \n \n \n )\n if (lane && value && !error.error) {\n actions.push(\n // TODO Disabled this button, because the browser does not correctly update after\n // the navigation. This needs to be fixed first.\n \n }\n />\n \n )\n actions.push()\n }\n return actions\n }, [value, lane, itemKey, user, error.error, allEntryDataSections])\n\n const referencedValue = useMemo(() => {\n const value = entry?.value?.split('#')[1] || ''\n return entry ? {entry_id: entry?.archive?.entry_id, value: value.replace(/^(\\/*)(.*)/gi, '$2'), archive: entry?.archive} : null\n }, [entry])\n\n const handleError = useCallback((error) => {\n setError(previousError => ({...previousError, error: error}))\n }, [])\n\n if (value && referencedValue === undefined) {\n return null\n }\n\n return \n \n \n {\n return (\n \n )\n }}\n />\n \n \n setOpen(false)}\n onSelectedChanged={handleValueChange}\n selected={entry && {entry_id: entry?.archive?.entry_id, value: entry?.value?.split('#')[1]}}\n filtersLocked={filtersLocked}\n />\n \n \n})\nReferenceEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func,\n index: PropTypes.number // additional index used for navigation of higher shaped references\n}\n\nexport default ReferenceEditQuantity\n","// Returns groups in arbitrary order without duplicates with the given IDs\nexport async function fetchGroupsByIds(api, groupIds) {\n if (groupIds.length === 0) {\n return []\n }\n\n const uniqueIds = [...new Set(groupIds)]\n return new Promise((resolve, reject) => {\n api.getGroups({group_id: uniqueIds})\n .then(resolve)\n .catch(error => reject(new Error(`Unable to fetch the groups by IDs (${error})`)))\n })\n}\n\n// Returns users in arbitrary order without duplicates with the given IDs\nexport async function fetchUsersByIds(api, userIds) {\n if (userIds.length === 0) {\n return []\n }\n\n const uniqueIds = [...new Set(userIds)]\n return new Promise((resolve, reject) => {\n api.getUsers({user_id: uniqueIds})\n .then(resolve)\n .catch(error => reject(new Error(`Unable to fetch the users by IDs (${error})`)))\n })\n}\n\n/**\n * Returns groups in arbitrary order without duplicates whose names contain the search terms\n * {string} search_terms - space-separated substrings, all must be present in the group name (no case)\n */\nexport async function fetchGroupsByNameSearch(api, search_terms) {\n if (search_terms.length === 0) {\n return []\n }\n\n return new Promise((resolve, reject) => {\n api.getGroups({search_terms})\n .then(resolve)\n .catch(error =>\n reject(new Error(`Unable to fetch the groups by search terms (${error})`))\n )\n })\n}\n\nexport async function fetchUsersByNamePrefix(api, prefix) {\n if (prefix.length === 0) {\n return []\n }\n\n return new Promise((resolve, reject) => {\n api.getUsers({ prefix })\n .then(users => {\n const lowerPrefix = prefix.toLowerCase()\n const withQueryInName = users.filter(\n user => user.name.toLowerCase().indexOf(lowerPrefix) !== -1\n )\n withQueryInName.sort((a, b) => {\n const aValue = a.name.toLowerCase()\n const bValue = b.name.toLowerCase()\n if (aValue.startsWith(lowerPrefix)) {\n return -1\n } else if (bValue.startsWith(lowerPrefix)) {\n return 1\n } else {\n return 0\n }\n })\n resolve(withQueryInName.slice(0, 5))\n })\n .catch(reject)\n })\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useMemo, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {getFieldProps, TextFieldWithHelp} from './StringEditQuantity'\nimport {Box, CircularProgress, FormLabel, InputAdornment, makeStyles, Typography} from '@material-ui/core'\nimport AutoComplete from '@material-ui/lab/Autocomplete'\nimport {debounce} from 'lodash'\nimport {fetchUsersByNamePrefix} from '../utils/apiUtils'\nimport {useApi} from '../api'\nimport {useErrors} from '../errors'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nconst useStyles = makeStyles(theme => ({\n label: {\n marginLeft: theme.spacing(1)\n },\n fields: {\n width: '100%',\n marginTop: theme.spacing(1)\n }\n}))\n\nexport const AuthorEditQuantity = React.memo((props) => {\n const {quantityDef, onChange, ...otherProps} = props\n const {helpDescription, ...otherFieldProps} = otherProps\n const classes = useStyles()\n const {api} = useApi()\n const {raiseError} = useErrors()\n const [author, setAuthor] = useState(undefined)\n const [user, setUser] = useState(undefined)\n const [email, setEmail] = useState(otherProps?.value?.email)\n const [query, setQuery] = useState('')\n const [suggestions, setSuggestions] = useState([])\n const [searching, setSearching] = useState(false)\n const userOnly = useMemo(() => quantityDef.type?.type_kind === 'User', [quantityDef])\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const searchUsers = useCallback((value) => {\n const newQuery = value.toLowerCase()\n const oldQuery = query\n\n if (oldQuery !== '' && newQuery.startsWith(oldQuery) && suggestions.length === 0) {\n setQuery(newQuery)\n return\n }\n\n fetchUsersByNamePrefix(api, newQuery)\n .then(setSuggestions)\n .catch(err => {\n raiseError(err)\n setSuggestions([])\n })\n\n setQuery(newQuery)\n setSearching(false)\n }, [api, raiseError, query, suggestions])\n\n const handleChange = useCallback((key, value) => {\n if (onChange) {\n let newValue = {...author}\n if (key === 'user') {\n setSuggestions(value ? [value] : [])\n if (value) {\n newValue['user_id'] = value?.user_id\n newValue['first_name'] = value?.first_name\n newValue['last_name'] = value?.last_name\n newValue['affiliation'] = value?.affiliation\n newValue['affiliation_address'] = value?.affiliation_address\n delete newValue['email']\n setEmail(undefined)\n setAuthor(newValue)\n } else {\n newValue = undefined\n }\n } else {\n if (value) {\n newValue[key] = value\n } else {\n delete newValue[key]\n }\n }\n onChange(newValue && Object.keys(newValue).length !== 0 ? newValue : undefined)\n }\n }, [author, onChange])\n\n useEffect(() => {\n const initUser = async (user_id) => {\n if (user_id) {\n const users = await api.getUsers({user_id: user_id})\n if (users.length > 0) {\n setSuggestions(users)\n setUser(users[0])\n } else {\n setSuggestions([])\n setUser(undefined)\n }\n } else {\n setUser(undefined)\n setSuggestions([])\n }\n }\n\n initUser(otherFieldProps.value?.user_id)\n\n if (typeof otherProps?.value === 'string' && otherProps.value.includes('@')) {\n api.getUsers({email: otherProps.value})\n .then(users => {\n if (users.length > 0) {\n handleChange('user', users[0])\n setSuggestions([users[0]])\n } else {\n setSuggestions([])\n }\n })\n } else {\n setAuthor(otherProps?.value)\n }\n }, [api, handleChange, otherFieldProps.value, otherProps.value, quantityDef.default])\n\n const isValidEmail = useCallback((value) => value ? value.match(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/) : true, [])\n\n const handleEmailChange = useCallback((value) => {\n setEmail(value)\n if (isValidEmail(value)) {\n handleChange('email', value)\n }\n }, [handleChange, isValidEmail])\n\n const debouncedSearchUsers = useMemo(() => debounce(searchUsers, 700), [searchUsers])\n\n const handleUserInputChange = useCallback((event, value) => {\n if (!(event && event.type && event.type === 'change')) {\n return\n }\n setSearching(true)\n debouncedSearchUsers(value)\n }, [debouncedSearchUsers])\n\n const userField = (\n option ? (option.affiliation ? `${option.name} (${option.affiliation})` : option.name) : ''}\n getOptionSelected={(option, value) => suggestions && value && value.user_id && option.user_id === value.user_id}\n onInputChange={handleUserInputChange}\n onChange={(event, value) => handleChange('user', value)}\n value={user && suggestions.some(option => option.user_id === user.user_id) ? user : null}\n renderInput={params => (\n \n \n )\n } : params.InputProps)}\n variant='filled'\n size='small'\n placeholder=\"Search member's name\"\n margin='normal'\n fullWidth\n {...getFieldProps(quantityDef)}\n label={(userOnly ? label : 'User account')}\n />\n )}\n data-testid='user-edit-quantity'\n />\n )\n\n return \n {userOnly ? userField : (\n \n \n {label}\n \n {userField}\n \n {'Or provide author information'}\n \n handleChange('first_name', event.target.value)}\n fullWidth\n />\n handleChange('last_name', event.target.value)}\n fullWidth\n />\n handleChange('affiliation', event.target.value)}\n fullWidth\n />\n handleEmailChange(event.target.value)}\n error={!isValidEmail(email)}\n helperText={!isValidEmail(email) && 'The email is not valid!'}\n fullWidth\n />\n handleChange('affiliation_address', event.target.value)}\n fullWidth\n />\n \n )}\n \n})\nAuthorEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.object,\n onChange: PropTypes.func\n}\n\nexport default AuthorEditQuantity\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback} from 'react'\nimport {\n FormControlLabel,\n FormControl,\n FormLabel, RadioGroup, Radio\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport {getFieldProps, WithHelp} from './StringEditQuantity'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const RadioEnumEditQuantity = React.memo((props) => {\n const {quantityDef, value, onChange, ...otherProps} = props\n const fieldProps = getFieldProps(quantityDef)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleChange = useCallback((value) => {\n if (onChange) {\n onChange(value === '' ? undefined : value)\n }\n }, [onChange])\n\n return (\n \n \n {label}\n \n {quantityDef.type?.type_data.map(item => (\n handleChange(item)}\n {...otherProps}\n />\n )}\n label={item}\n />))}\n \n \n \n )\n})\nRadioEnumEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useRef, useState } from 'react'\nimport { makeStyles, alpha } from '@material-ui/core/styles'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport ExpandLessIcon from '@material-ui/icons/ExpandLess'\nimport { useResizeDetector } from 'react-resize-detector'\nimport { useWindowSize } from '../../hooks'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\n\n/**\n * Component for displaying a scrollable view.\n */\nconst useStyles = makeStyles(theme => {\n const startColor = alpha(theme.palette.grey[100], 0.0)\n const endColor = alpha(theme.palette.grey[300], 0.4)\n return {\n root: {\n width: '100%',\n height: '100%'\n },\n containerOuter: {\n width: '100%',\n height: '100%',\n position: 'relative'\n },\n containerInner: {\n width: '100%',\n height: '100%',\n overflowY: 'scroll',\n boxSizing: 'border-box'\n },\n scrollHint: {\n zIndex: 3,\n position: 'absolute',\n width: '100%',\n height: '1.5rem',\n background: alpha(theme.palette.background.default, 0.8),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n pointerEvents: 'none'\n },\n scrollUp: {\n background: `linear-gradient(0deg, ${endColor} 0%, ${startColor} 100%)`,\n bottom: 0\n },\n scrollDown: {\n borderTop: `1px solid ${theme.palette.grey[300]}`,\n background: `linear-gradient(0deg, ${startColor} 0%, ${endColor} 100%)`,\n top: 0\n }\n }\n})\nconst useScrollStyles = makeStyles((theme) => ({\n scrollBar: {\n overflowY: 'scroll',\n '&::-webkit-scrollbar': {\n display: 'none'\n },\n '-ms-overflow-style': 'none',\n scrollbarWidth: 'none'\n }\n}))\n\nconst Scrollable = React.memo(({\n onBottom,\n scrollBar,\n hints,\n footer,\n className,\n classes,\n children,\n 'data-testid': testID\n}) => {\n const refRoot = useRef()\n const { height, ref } = useResizeDetector()\n const { windowHeight } = useWindowSize()\n const [isOverflowing, setIsOverflowing] = useState(false)\n const [isTop, setIsTop] = useState(true)\n const [isBottom, setIsBottom] = useState(false)\n const styles = useStyles({classes: classes})\n const scrollStyles = useScrollStyles({classes: {scrollBar: classes?.scrollBar}})\n\n // When the height of children changes or the window size changes, redetermine\n // whether to show scrollhints\n useEffect(() => {\n const element = refRoot?.current\n if (element) {\n const scrollHeight = element.scrollHeight - element.offsetHeight\n const overflowing = scrollHeight > 0\n setIsOverflowing(overflowing)\n }\n }, [height, windowHeight])\n\n // Attach event listener for checking if scrolled to top or bottom\n useEffect(() => {\n const element = refRoot?.current\n\n function updateScrollPosition() {\n const scrollHeight = element.scrollHeight - element.offsetHeight\n const bottom = Math.round(element.scrollTop) >= scrollHeight\n const top = Math.round(element.scrollTop) <= 0\n setIsTop(top || null)\n setIsBottom(bottom || null)\n if (bottom && onBottom) {\n onBottom()\n }\n }\n\n if (element) {\n element.addEventListener('scroll', updateScrollPosition, false)\n return function cleanup() {\n element.removeEventListener('scroll', updateScrollPosition, false)\n }\n }\n }, [onBottom])\n\n return
\n
\n {(hints && isOverflowing && !isTop) &&
\n \n
}\n
\n
\n {children}\n {footer}\n
\n
\n {(hints && isOverflowing && !isBottom) &&
\n \n
}\n
\n
\n})\n\nScrollable.propTypes = {\n onBottom: PropTypes.func, // Callback that is fired when bottom reached\n scrollBar: PropTypes.bool, // Whether to show native scrollbar\n hints: PropTypes.bool, // Whether to show scroll hints\n fixed: PropTypes.bool, // Whether to show scroll hints\n footer: PropTypes.object, // A fixed component that is shown at the bottom\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.any,\n 'data-testid': PropTypes.string\n}\nScrollable.defaultProps = {\n scrollBar: false,\n hints: true\n}\n\nexport default Scrollable\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback } from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport {\n Checkbox,\n MenuItem,\n FormControlLabel\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { useSearchContext } from '../SearchContext'\n\n/**\n * Menu showing the Filter settings.\n */\nconst useStyles = makeStyles((theme) => {\n return {\n root: {\n },\n menuItem: {\n width: '10rem'\n },\n systems: {\n margin: theme.spacing(2),\n marginTop: theme.spacing(1)\n }\n }\n})\nconst FilterSettings = React.memo(({\n className,\n classes,\n 'data-testid': testID\n}) => {\n const styles = useStyles(classes)\n const {\n useIsStatisticsEnabled,\n useSetIsStatisticsEnabled\n } = useSearchContext()\n const [isStatisticsEnabled, setIsStatisticsEnabled] = [useIsStatisticsEnabled(), useSetIsStatisticsEnabled()]\n\n const handleStatsChange = useCallback((event, value) => {\n setIsStatisticsEnabled(value)\n }, [setIsStatisticsEnabled])\n\n return
\n \n }\n label=\"Show advanced statistics\"\n />\n \n
\n})\n\nFilterSettings.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nexport default FilterSettings\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useCallback, useContext, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport {\n List,\n ListItem,\n ListItemText,\n ListItemIcon,\n Divider,\n Paper,\n Menu,\n Typography\n} from '@material-ui/core'\nimport ArrowForwardIcon from '@material-ui/icons/ArrowForward'\nimport ArrowBackIcon from '@material-ui/icons/ArrowBack'\nimport NavigateNextIcon from '@material-ui/icons/NavigateNext'\nimport MoreVert from '@material-ui/icons/MoreVert'\nimport Scrollable from '../../visualization/Scrollable'\nimport FilterSettings from './FilterSettings'\nimport { Actions, ActionHeader, Action } from '../../Actions'\nimport { useSearchContext } from '../SearchContext'\nimport { pluralize } from '../../../utils'\nimport { isNil } from 'lodash'\n\n// The menu animations use a transition on the 'transform' property. Notice that\n// animating 'transform' instead of e.g. the 'left' property is much more\n// performant. We also hint the browser that the transform property will be\n// animated using the 'will-change' property: this will pre-optimize the element\n// for animation when possible (the recommendation is to remove/add it when\n// needed, but in this case we keep it on constantly).\n//\n// The menu widths are hardcoded. We need the widths to perform the close\n// animation. Another option would be to use useLayoutEffect to determine the\n// sizes of the components dynamically, but this seems to be quite a bit less\n// responsive compared to hardcoding the values.\n\nexport const filterMenuContext = React.createContext()\nconst paddingHorizontal = 1.5\nexport const collapsedMenuWidth = 3.3\n\n// Topmost header for filter menus. Contains menu actions and an overline text\nconst useFilterMenuTopHeaderStyles = makeStyles(theme => {\n return {\n root: {\n paddingTop: theme.spacing(1.2),\n paddingRight: theme.spacing(paddingHorizontal),\n paddingLeft: theme.spacing(paddingHorizontal)\n },\n title: {\n display: 'flex',\n alignItems: 'center',\n fontSize: '0.75rem',\n marginTop: -3,\n marginBottom: -3\n }\n }\n})\nexport const FilterMenuTopHeader = React.memo(({\n title,\n actions,\n className\n}) => {\n const styles = useFilterMenuTopHeaderStyles()\n return
\n \n \n {title}\n \n {actions}\n \n
\n})\nFilterMenuTopHeader.propTypes = {\n overlineTitle: PropTypes.string,\n title: PropTypes.string,\n topAction: PropTypes.node,\n actions: PropTypes.node,\n className: PropTypes.string\n}\n\n// Header for filter menus. Contains panel actions and an overline text.\nconst useFilterMenuHeaderStyles = makeStyles(theme => {\n return {\n root: {\n height: theme.spacing(3),\n paddingBottom: theme.spacing(1.1),\n paddingTop: theme.spacing(0.3),\n paddingLeft: theme.spacing(paddingHorizontal),\n paddingRight: theme.spacing(paddingHorizontal),\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center'\n },\n title: {\n display: 'flex',\n alignItems: 'center',\n fontSize: '0.90rem'\n }\n }\n})\nexport const FilterMenuHeader = React.memo(({\n title,\n actions,\n className,\n 'data-testid': testID\n}) => {\n const styles = useFilterMenuHeaderStyles()\n return
\n \n \n {title}\n \n {actions}\n \n
\n})\n\nFilterMenuHeader.propTypes = {\n overlineTitle: PropTypes.string,\n title: PropTypes.string,\n topAction: PropTypes.node,\n actions: PropTypes.node,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nconst useFilterMenuStyles = makeStyles(theme => {\n const width = 22\n return {\n root: {\n boxSizing: 'border-box',\n display: 'flex',\n position: 'relative',\n flexDirection: 'column',\n width: `${width}rem`,\n height: '100%',\n '-webkit-transform': 'none',\n transform: 'none',\n transition: 'transform 250ms',\n willChange: 'transform'\n },\n collapsed: {\n '-webkit-transform': `translateX(-${width - collapsedMenuWidth}rem)`,\n transform: `translateX(-${width - collapsedMenuWidth}rem)`\n }\n }\n})\n\nexport const FilterMenu = React.memo(({\n selected,\n onSelectedChange,\n open,\n onOpenChange,\n collapsed,\n onCollapsedChange,\n className,\n children\n}) => {\n const styles = useFilterMenuStyles()\n const [size, setSize] = useState('m')\n\n const handleChange = useCallback((newValue) => {\n if (newValue !== selected) {\n onOpenChange(true)\n } else {\n onOpenChange(old => !old)\n }\n onSelectedChange && onSelectedChange(newValue)\n }, [selected, onSelectedChange, onOpenChange])\n\n return
\n \n {children}\n \n
\n})\nFilterMenu.propTypes = {\n selected: PropTypes.string,\n onSelectedChange: PropTypes.func,\n open: PropTypes.bool,\n onOpenChange: PropTypes.func,\n collapsed: PropTypes.bool,\n onCollapsedChange: PropTypes.func,\n className: PropTypes.string,\n children: PropTypes.node\n}\n\nconst useFilterMenuItemsStyles = makeStyles(theme => {\n return {\n root: {\n boxSizing: 'border-box',\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n backgroundColor: theme.palette.background.paper,\n zIndex: 3\n },\n headerTextVertical: {\n display: 'flex',\n alignItems: 'center',\n position: 'absolute',\n right: '0.07rem',\n top: '2.5rem',\n height: `${collapsedMenuWidth}rem`,\n transform: 'rotate(90deg)'\n },\n menu: {\n position: 'absolute',\n right: 0,\n top: 0,\n bottom: 0,\n left: 0,\n boxSizing: 'border-box'\n },\n menuBorder: {\n boxShadow: `1px 0px 0px 0px ${theme.palette.action.selected}`\n },\n padding: {\n paddingBottom: `${theme.spacing(1.5)}px`\n },\n button: {\n marginRight: 0,\n '-webkit-transform': 'none',\n transform: 'none',\n transition: 'transform 250ms',\n willChange: 'transform'\n },\n hidden: {\n display: 'none'\n },\n overflow: {\n overflow: 'visible'\n },\n list: {\n paddingTop: 0\n },\n container: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%'\n },\n content: {\n flex: 1,\n minHeight: 0\n },\n collapsedActions: {\n paddingTop: theme.spacing(0.7),\n paddingLeft: theme.spacing(paddingHorizontal),\n paddingRight: theme.spacing(paddingHorizontal)\n }\n }\n})\nexport const FilterMenuItems = React.memo(({\n className,\n children\n}) => {\n // const { useResetFilters, useRefresh, useApiData } = useSearchContext()\n const styles = useFilterMenuItemsStyles()\n const { open, onOpenChange, collapsed, onCollapsedChange } = useContext(filterMenuContext)\n const [anchorEl, setAnchorEl] = React.useState(null)\n const isSettingsOpen = Boolean(anchorEl)\n\n // Callbacks\n const openMenu = useCallback((event) => {\n setAnchorEl(event.currentTarget)\n }, [])\n const closeMenu = useCallback(() => {\n setAnchorEl(null)\n }, [])\n\n // Unfortunately the ClickAwayListener does not play nicely together with\n // Menus/Select/Popper. When using Portals, the clicks are registered wrong.\n // When Portals are disabled (disablePortal), their positioning goes haywire.\n // The clicks outside are thus detected by individual event listeners that\n // toggle the menu state.\n return
\n
\n
\n \n \n {\n onCollapsedChange(old => !old)\n onOpenChange(false)\n }}\n // className={styles.button}\n >\n \n \n \n \n \n \n
\n \n
\n \n }\n />\n
\n \n
\n \n \n {children}\n \n
\n
\n
\n
\n
\n
\n \n {collapsed && {\n onCollapsedChange(false)\n }}\n className={styles.button}\n >\n \n }\n \n Filters\n \n
\n
\n})\nFilterMenuItems.propTypes = {\n className: PropTypes.string,\n children: PropTypes.node\n}\n\nconst levelIndent = 1.8\nconst leftGutter = 3.0\nconst rightGutter = 2.35\nconst itemHeight = 2.6\nconst useFilterMenuItemStyles = makeStyles(theme => {\n return {\n root: {\n minHeight: `${itemHeight}rem`\n },\n label: {\n textTransform: 'capitalize'\n },\n listIcon: {\n fontsize: '1rem',\n minWidth: '1.5rem'\n },\n arrow: {\n marginLeft: theme.spacing(1),\n fontSize: '1.5rem'\n },\n gutters: {\n paddingLeft: theme.spacing(leftGutter),\n paddingRight: theme.spacing(rightGutter)\n },\n listItem: {\n position: 'relative',\n height: `${itemHeight}rem`\n },\n actions: {\n display: 'flex',\n flexDirection: 'column',\n paddingLeft: theme.spacing(leftGutter),\n paddingRight: theme.spacing(rightGutter)\n },\n divider: {\n width: '100%',\n backgroundColor: theme.palette.grey[300]\n }\n }\n})\nexport const FilterMenuItem = React.memo(({\n id,\n label,\n onClick,\n actions,\n disableButton,\n level\n}) => {\n const styles = useFilterMenuItemStyles()\n const theme = useTheme()\n const { selected, open, onChange } = useContext(filterMenuContext)\n const handleClick = disableButton ? undefined : (onClick || onChange)\n const opened = open && id === selected\n\n return
\n {(label || handleClick) &&\n handleClick(id))}\n >\n {label && }\n {handleClick && \n \n }\n }\n {actions && \n {actions}\n
}\n \n
\n})\n\nFilterMenuItem.propTypes = {\n id: PropTypes.string,\n label: PropTypes.string,\n onClick: PropTypes.func,\n actions: PropTypes.node,\n disableButton: PropTypes.bool,\n level: PropTypes.number\n}\nFilterMenuItem.defaultProps = {\n level: 0\n}\n\nconst useFilterSubMenusStyles = makeStyles(theme => {\n const widthS = 25\n const widthM = 32\n const widthL = 40\n const widthXL = 48\n return {\n root: {\n zIndex: 2,\n display: 'flex',\n flexDirection: 'column',\n position: 'absolute',\n right: 0,\n top: 0,\n bottom: 0,\n width: `${widthXL}rem`,\n backgroundColor: theme.palette.background.paper,\n '-webkit-transform': 'none',\n transform: 'none',\n transition: 'transform 250ms',\n flexGrow: 1,\n boxSizing: 'border-box',\n willChange: 'transform'\n },\n collapsed: {\n display: 'none'\n },\n containerS: {\n '-webkit-transform': `translateX(${widthS}rem)`,\n transform: `translateX(${widthS}rem)`\n },\n containerM: {\n '-webkit-transform': `translateX(${widthM}rem)`,\n transform: `translateX(${widthM}rem)`\n },\n containerL: {\n '-webkit-transform': `translateX(${widthL}rem)`,\n transform: `translateX(${widthL}rem)`\n },\n containerXL: {\n '-webkit-transform': `translateX(${widthXL}rem)`,\n transform: `translateX(${widthXL}rem)`\n },\n menu: {\n position: 'absolute',\n right: 0,\n top: 0,\n bottom: 0,\n boxSizing: 'border-box',\n display: 'flex',\n flexDirection: 'column'\n },\n content: {\n flex: 1,\n minHeight: 0\n },\n menuS: {\n width: `${widthS}rem`\n },\n menuM: {\n width: `${widthM}rem`\n },\n menuL: {\n width: `${widthL}rem`\n },\n menuXL: {\n width: `${widthXL}rem`\n },\n button: {\n marginRight: 0\n }\n }\n})\n\nexport const FilterSubMenus = React.memo(({\n children\n}) => {\n const { useResults } = useSearchContext()\n const nResults = useResults()?.pagination?.total\n const styles = useFilterSubMenusStyles()\n const { open, onOpenChange, size, collapsed } = useContext(filterMenuContext)\n const [menuStyle, containerStyle] = {\n s: [styles.menuS, styles.containerS],\n m: [styles.menuM, styles.containerM],\n l: [styles.menuL, styles.containerL],\n xl: [styles.menuXL, styles.containerXL]\n }[size]\n\n return \n
\n { onOpenChange(false) }}\n className={styles.button}\n >\n \n }\n />\n
\n {children}\n
\n
\n \n})\nFilterSubMenus.propTypes = {\n sizes: PropTypes.object,\n children: PropTypes.node\n}\n\nconst useFilterSubMenuStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n hidden: {\n display: 'none'\n },\n padding: {\n paddingBottom: theme.spacing(1.5),\n paddingLeft: theme.spacing(paddingHorizontal),\n paddingRight: theme.spacing(paddingHorizontal)\n },\n content: {\n flex: 1,\n minHeight: 0\n }\n}))\n\nexport const FilterSubMenu = React.memo(({\n id,\n label,\n size,\n actions,\n children\n}) => {\n const styles = useFilterSubMenuStyles()\n const { selected, onSizeChange } = useContext(filterMenuContext)\n const visible = id === selected\n useEffect(() => {\n if (visible) {\n onSizeChange(size)\n }\n }, [size, visible, onSizeChange])\n\n return
\n \n
\n \n {children}\n \n
\n
\n})\nFilterSubMenu.propTypes = {\n id: PropTypes.string,\n label: PropTypes.string,\n size: PropTypes.oneOf(['s', 'm', 'l', 'xl']),\n actions: PropTypes.node,\n children: PropTypes.node\n}\nFilterSubMenu.defaultProps = {\n size: 's'\n}\n\nexport default FilterSubMenu\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport {\n Grid,\n Divider,\n makeStyles\n} from '@material-ui/core'\n\n/**\n * For displaying a grid of input properties.\n *\n * Notice that we have to use a workaround for the MUI grid item in order to\n * prevent horizontal overflow. A padding is applied to the parent element as\n * described in https://v4.mui.com/components/grid/#negative-margin\n */\nconst inputGridSpacing = 2\nconst useInputGridStyles = makeStyles(theme => ({\n root: {\n paddingLeft: theme.spacing(inputGridSpacing / 2),\n paddingRight: theme.spacing(inputGridSpacing / 2)\n }\n}))\nexport function InputGrid({children}) {\n const styles = useInputGridStyles()\n return
\n \n {children}\n \n
\n}\n\nInputGrid.propTypes = {\n children: PropTypes.any\n}\n\n/**\n * For displaying an individual input filter, typically within a InputGrid.\n */\nconst useInputGridItemStyles = makeStyles(theme => ({\n root: {\n marginBottom: theme.spacing(inputGridSpacing / 2)\n },\n content: {\n paddingLeft: theme.spacing(inputGridSpacing / 4),\n paddingRight: theme.spacing(inputGridSpacing / 4)\n },\n divider: {\n marginLeft: theme.spacing(-inputGridSpacing / 2),\n marginRight: theme.spacing(-inputGridSpacing / 2),\n marginTop: theme.spacing(-inputGridSpacing / 2),\n marginBottom: theme.spacing(inputGridSpacing / 4),\n backgroundColor: theme.palette.grey[300]\n }\n}))\nexport function InputGridItem({classes, children, ...other}) {\n const styles = useInputGridItemStyles({classes: classes})\n return \n \n
\n {children}\n
\n
\n}\n\nInputGridItem.propTypes = {\n classes: PropTypes.object,\n children: PropTypes.any\n}\n\nInputGridItem.defaultProps = {\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback } from 'react'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport {\n FormControlLabel,\n Checkbox,\n Tooltip,\n Typography\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport { isNil } from 'lodash'\nimport clsx from 'clsx'\nimport { useSearchContext, getValue } from '../SearchContext'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'center',\n flexDirection: 'column',\n boxSizing: 'border-box'\n }\n}))\n\n/**\n * A checkbox where the selection controls a true/false value within a quantity.\n */\nconst InputCheckbox = React.memo(({\n quantity,\n label,\n description,\n initialValue,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const styles = useStyles({classes: classes, theme: theme})\n const {filterData, useFilterState, useFilterLocked} = useSearchContext()\n const [filter, setFilter] = useFilterState(quantity)\n const filterLocked = useFilterLocked(quantity)\n\n // Determine the description and units\n const def = filterData[quantity]\n const descFinal = description || def?.description || ''\n const labelFinal = label || def?.label\n const locked = !isNil(filterLocked) && def.global\n const val = getValue(def, filter, filterLocked, initialValue)\n\n const handleChange = useCallback((event, value) => {\n setFilter(value)\n }, [setFilter])\n\n return
\n \n }\n label={{labelFinal}}\n />\n \n
\n})\n\nInputCheckbox.propTypes = {\n quantity: PropTypes.string.isRequired,\n label: PropTypes.string,\n description: PropTypes.string,\n initialValue: PropTypes.bool,\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nexport default InputCheckbox\n\n/**\n * A checkbox where the selection activates a specific value within a quantity.\n */\nconst useInputCheckboxValueStyles = makeStyles(theme => ({\n root: {\n '& > :last-child': {\n marginRight: -3\n }\n },\n control: {\n padding: 6\n }\n}))\nexport const InputCheckboxValue = React.memo(({\n quantity,\n description,\n value,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const styles = useInputCheckboxValueStyles({classes: classes, theme: theme})\n const {filterData, useFilterState} = useSearchContext()\n const [filter, setFilter] = useFilterState(quantity)\n\n // Determine the description and units\n const def = filterData[quantity]\n const descFinal = description || def?.description || ''\n\n const handleChange = useCallback(() => {\n setFilter(old => {\n const newValue = old ? new Set(old) : new Set()\n newValue.has(value) ? newValue.delete(value) : newValue.add(value)\n return newValue\n })\n }, [setFilter, value])\n\n return
\n \n \n \n
\n})\n\nInputCheckboxValue.propTypes = {\n quantity: PropTypes.string.isRequired,\n description: PropTypes.string,\n value: PropTypes.any,\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo, useCallback, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { isNil } from 'lodash'\nimport elementData from '../../../elementData'\nimport { useResizeDetector } from 'react-resize-detector'\nimport { Tooltip } from '@material-ui/core'\nimport InputHeader from './InputHeader'\nimport InputCheckbox from './InputCheckbox'\nimport { makeStyles, useTheme, lighten } from '@material-ui/core/styles'\nimport { useSearchContext } from '../SearchContext'\nimport { approxInteger } from '../../../utils'\nimport { getScaler } from '../../plotting/common'\n\n/**\n * A single element in the periodic table.\n*/\nconst useElementStyles = makeStyles(theme => ({\n text: {\n fontFamily: theme.typography.fontFamily,\n fill: theme.palette.text.default,\n userSelect: 'none',\n pointerEvents: 'none'\n },\n rect: {\n transition: 'fill .15s ease',\n cursor: 'pointer',\n '&:hover': {\n filter: 'drop-shadow(0px 0px 2px rgb(0 0 0 / 0.4))'\n }\n },\n rectDisabled: {\n cursor: 'auto',\n '&:hover': {\n filter: 'unset'\n }\n },\n label: {\n fontSize: '1rem',\n fontWeight: 600\n },\n number: {\n fontSize: '0.58rem'\n },\n count: {\n fontSize: '0.58rem'\n }\n}))\n\nconst Element = React.memo(({\n x,\n y,\n width,\n height,\n element,\n selected,\n disabled,\n onClick,\n disableStatistics,\n max,\n count,\n scale\n}) => {\n const styles = useElementStyles()\n const theme = useTheme()\n const scaler = useMemo(() => getScaler(scale, [0, max], [0.2, 1]), [scale, max])\n const finalCount = useMemo(() => approxInteger(count || 0), [count])\n const finalScale = useMemo(() => scaler(count), [count, scaler])\n const disabledFinal = disabled && !selected\n const color = selected\n ? theme.palette.secondary.main\n : disabled\n ? '#eee'\n : disableStatistics\n ? theme.palette.primary.light\n : lighten(theme.palette.primary.light, 1 - finalScale)\n const strokeColor = disabledFinal\n ? theme.palette.text.disabled\n : '#555'\n const textColor = selected\n ? 'white'\n : disabled\n ? theme.palette.text.disabled\n : theme.palette.text.default\n\n const handleClick = useCallback(() => {\n if (disabledFinal) return\n onClick && onClick()\n }, [onClick, disabledFinal])\n\n return \n \n \n {element.symbol}\n \n {element.number}\n \n {!disableStatistics && {finalCount}\n }\n \n \n})\n\nElement.propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n element: PropTypes.object.isRequired,\n max: PropTypes.number,\n count: PropTypes.number,\n scale: PropTypes.string,\n selected: PropTypes.bool,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n disableStatistics: PropTypes.bool\n}\n\n/**\n * Displays an interactive periodic table.\n*/\nconst usePeriodicTableStyles = makeStyles(theme => ({\n root: {\n minHeight: 0, // added min-height: 0 to prevent relayouting when within flexbox\n flexGrow: 1,\n width: '100%',\n height: '100%',\n position: 'relative'\n },\n container: {\n position: 'absolute',\n top: theme.spacing(-0.2),\n left: '10%',\n textAlign: 'center'\n }\n}))\nexport const PeriodicTable = React.memo(({\n quantity,\n visible,\n scale,\n anchored,\n disableStatistics,\n aggId,\n className,\n 'data-testid': testID\n}) => {\n const styles = usePeriodicTableStyles()\n const { height, width, ref } = useResizeDetector()\n const {useFilterState, useAgg, useIsStatisticsEnabled} = useSearchContext()\n const isStatisticsEnabled = useIsStatisticsEnabled()\n const [filter, setFilter] = useFilterState(quantity)\n const aggConfig = useMemo(() => ({type: 'terms'}), [])\n const agg = useAgg(quantity, visible, aggId, aggConfig)\n const availableValues = useMemo(() => {\n const elementCountMap = {}\n agg?.data && agg.data.forEach((value) => { elementCountMap[value.value] = value.count })\n return elementCountMap\n }, [agg])\n disableStatistics = anchored\n ? false\n : isNil(disableStatistics) ? !isStatisticsEnabled : disableStatistics\n\n const onElementClicked = useCallback((element) => {\n setFilter(old => {\n let newValues\n if (old) {\n const isSelected = old?.has(element)\n isSelected ? old.delete(element) : old.add(element)\n newValues = new Set(old)\n } else {\n newValues = new Set([element])\n }\n return newValues\n })\n }, [setFilter])\n\n const max = useMemo(() => {\n return agg\n ? Math.max(...agg.data\n .filter(option => !filter?.has(option.value))\n .map(option => option.count))\n : 0\n }, [agg, filter])\n\n const padding = 1\n const margin = 3\n const cellWidth = (width - 2 * padding - 17 * margin) / 18\n const cellHeight = (height - 2 * padding - 9 * margin) / 10\n\n return
\n \n {(width && height) &&\n elementData.elements.map((element) => (\n onElementClicked(element.symbol)}\n selected={filter?.has(element.symbol)}\n max={max}\n count={availableValues[element.symbol]}\n scale={scale}\n x={padding + (element.xpos - 1) * (cellWidth + margin)}\n y={padding + (element.ypos - 1) * (cellHeight + margin)}\n width={cellWidth}\n height={cellHeight}\n disableStatistics={disableStatistics}\n />\n ))\n }\n \n
\n \n
\n
\n})\n\nPeriodicTable.propTypes = {\n quantity: PropTypes.string,\n label: PropTypes.string,\n description: PropTypes.string,\n visible: PropTypes.bool,\n scale: PropTypes.string,\n anchored: PropTypes.bool,\n disableStatistics: PropTypes.bool,\n aggId: PropTypes.string,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nPeriodicTable.defaultProps = {\n aggId: 'default',\n 'data-testid': 'periodictable'\n}\n\n/**\n * Periodic table that directly shows the targeted quantity along with some\n * extra controls.\n */\nconst useInputPeriodicTableStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n flexDirection: 'column'\n }\n}))\nconst InputPeriodicTable = React.memo(({\n quantity,\n label,\n description,\n visible,\n initialScale,\n anchored,\n disableStatistics,\n aggId,\n className\n }) => {\n const styles = useInputPeriodicTableStyles()\n const [scale, setScale] = useState(initialScale)\n const {filterData} = useSearchContext()\n\n // Determine the description and title\n const def = filterData[quantity]\n const descFinal = description || def?.description || ''\n const labelFinal = label || def?.label\n\n return
\n \n \n
\n})\n\nInputPeriodicTable.propTypes = {\n quantity: PropTypes.string,\n label: PropTypes.string,\n description: PropTypes.string,\n visible: PropTypes.bool,\n initialScale: PropTypes.string,\n anchored: PropTypes.bool,\n disableStatistics: PropTypes.bool,\n aggId: PropTypes.string,\n className: PropTypes.string\n}\n\nInputPeriodicTable.defaultProps = {\n initialScale: 'linear'\n}\n\nexport default InputPeriodicTable\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo } from 'react'\nimport clsx from 'clsx'\nimport { Typography, Tooltip } from '@material-ui/core/'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport { approxInteger } from '../../../utils'\nimport { getScaler } from '../../plotting/common'\n\n/**\n * A rectangular bar displaying the relative occurence of a specific value. Uses\n * an animated CSS transform to react to changes in the bar size. Notice that\n * using a transform is much more performant than animating the width.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n },\n container: {\n position: 'relative',\n width: '100%',\n height: '100%'\n },\n rectangle: {\n backgroundColor: theme.palette.primary.light,\n width: '100%',\n height: '100%',\n '-webkit-transform': 'none',\n transform: 'none',\n transition: 'transform 250ms',\n transformOrigin: 'bottom left',\n willChange: 'transform'\n },\n value: {\n position: 'absolute',\n right: theme.spacing(1),\n top: 0,\n bottom: 0\n }\n}))\nconst StatisticsBar = React.memo(({\n max,\n value,\n scale,\n selected,\n vertical,\n disabled,\n disableValue,\n tooltip,\n onClick,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const styles = useStyles(classes)\n const theme = useTheme()\n\n // Calculate the approximated count and the final scaled value\n const scaler = useMemo(() => scale ? getScaler(scale, [0, max]) : (value) => value, [scale, max])\n const finalCount = useMemo(() => approxInteger(value || 0), [value])\n const finalScale = useMemo(() => scaler(value), [value, scaler])\n\n return
\n \n
\n
\n {!disableValue && {finalCount}}\n
\n
\n
\n})\n\nStatisticsBar.propTypes = {\n max: PropTypes.number,\n value: PropTypes.number,\n scale: PropTypes.string,\n selected: PropTypes.bool,\n disabled: PropTypes.bool,\n disableValue: PropTypes.bool,\n tooltip: PropTypes.string,\n vertical: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nexport default StatisticsBar\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback } from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport {\n Checkbox,\n Radio,\n Tooltip,\n Typography,\n FormControlLabel\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport StatisticsBar from '../widgets/StatisticsBar'\n\n/**\n * Represents a selectable item for a filter value.\n*/\nexport const inputItemHeight = 34\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: inputItemHeight,\n position: 'relative'\n },\n controlLabel: {\n width: '100%',\n height: '100%',\n margin: 0\n },\n labelContainer: {\n height: '100%',\n width: '100%'\n },\n labelPlacementStart: {\n margin: 0\n },\n container: {\n position: 'relative',\n height: '100%',\n width: '100%'\n },\n label: {\n position: 'absolute',\n top: 0,\n left: theme.spacing(0.5),\n right: 0,\n bottom: 0,\n lineHeight: '100%',\n textAlign: 'center',\n display: 'flex',\n alignItems: 'center'\n },\n bar: {\n position: 'absolute',\n top: theme.spacing(0.8),\n left: 0,\n right: 0,\n bottom: theme.spacing(0.8)\n }\n}))\nconst InputItem = React.memo(({\n value,\n label,\n selected,\n onChange,\n disabled,\n tooltip,\n variant,\n max,\n count,\n scale,\n disableStatistics,\n labelPlacement,\n disableLabelClick,\n disableSelect,\n className,\n classes,\n 'data-testid': testID,\n ...moreProps\n}) => {\n const styles = useStyles(classes)\n\n const finalLabel = label || `${value}`\n const handleChange = useCallback((event) => {\n if (!disabled && onChange) onChange(event, value, !selected)\n }, [value, disabled, onChange, selected])\n\n let Control\n if (variant === 'radio') {\n Control = Radio\n } else if (variant === 'checkbox') {\n Control = Checkbox\n }\n\n // Component that contains the label and the statistics\n const labelComponent =
\n {!disableStatistics && }\n
\n \n {finalLabel}\n \n
\n
\n\n return
\n {disableSelect\n ? labelComponent\n : }\n label={labelComponent}\n />\n }\n
\n})\n\nInputItem.propTypes = {\n value: PropTypes.any, // The actual value\n label: PropTypes.string, // The name to show\n selected: PropTypes.bool, // Whether the option is selected or not\n onChange: PropTypes.func, // Callback when selecting\n disabled: PropTypes.bool, // Whether the option should be disabled\n tooltip: PropTypes.string, // Tooltip that is shown for label\n variant: PropTypes.oneOf(['radio', 'checkbox']), // The type of item to display\n max: PropTypes.number, // Maximum for statistics\n count: PropTypes.number, // Count of these values for statistics\n scale: PropTypes.string, // Scaling of the statistics\n disableStatistics: PropTypes.bool, // Use to disable statistics for this item\n labelPlacement: PropTypes.oneOf(['start', 'end']), // Controls the label placement\n disableLabelClick: PropTypes.bool, // Whether clicking the label is enabled\n disableSelect: PropTypes.bool, // Whether the checkbox is shown\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nInputItem.defaultProps = {\n labelPlacement: 'end'\n}\n\nexport default InputItem\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { Typography, makeStyles } from '@material-ui/core'\n\n/**\n * Indicates that no input options are available with the current query\n * settings.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n fontStyle: 'italic',\n color: theme.palette.text.disabled\n }\n}))\nexport default function InputUnavailable({className}) {\n const styles = useStyles()\n return \n No options available with current query.\n \n}\n\nInputUnavailable.propTypes = {\n className: PropTypes.string\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useEffect, useState, useMemo } from 'react'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { useRecoilValue } from 'recoil'\nimport InputHeader from './InputHeader'\nimport InputTooltip from './InputTooltip'\nimport InputItem, { inputItemHeight } from './InputItem'\nimport InputUnavailable from './InputUnavailable'\nimport Placeholder from '../../visualization/Placeholder'\nimport { formatLabel } from '../../../utils'\nimport { useSearchContext } from '../SearchContext'\nimport { isNil } from 'lodash'\nimport Pagination from '../../visualization/Pagination'\nimport { guiState } from '../../GUIMenu'\nimport { InputTextQuantity } from './InputText'\n\n/**\n * Generic input component that can be configured to fit several use cases. The\n * most typical configufations are:\n * - Smallish, fixed number of options: do not show search field, use\n * metainfo/explicit options to always show the options.\n * - Large amount of options which are not unique to entries: show search field\n * and a subset of options sorted by their occurrence.\n * - Large amount of options which are unique for each entry: only show search field.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'center',\n flexDirection: 'column',\n boxSizing: 'border-box'\n },\n container: {\n width: '100%'\n },\n grid: {\n width: '100%',\n display: 'grid',\n gridAutoFlow: 'column'\n },\n progress: {\n marginLeft: theme.spacing(0.5)\n },\n textField: {\n marginBottom: theme.spacing(1)\n }\n}))\nconst InputField = React.memo(({\n quantity,\n label,\n description,\n visible,\n xs,\n initialScale,\n initialSize,\n increment,\n disableStatistics,\n disableSearch,\n disableOptions,\n disableSuggestions,\n formatLabels,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const {\n filterData,\n useAgg,\n useAggCall,\n useFilterState,\n useIsStatisticsEnabled\n } = useSearchContext()\n const isStatisticsEnabled = useIsStatisticsEnabled()\n const styles = useStyles({classes: classes, theme: theme})\n const [visibleOptions, setVisibleOptions] = useState()\n const aggIndicator = useRecoilValue(guiState('aggIndicator'))\n const aggCollapse = useRecoilValue(guiState('aggCollapse'))\n const [scale, setScale] = useState(initialScale || filterData[quantity]?.scale || 'linear')\n disableStatistics = isNil(disableStatistics) ? !isStatisticsEnabled : disableStatistics\n\n // See if the filter has a fixed amount of options. These may have been\n // explicitly provided or defined in the metainfo. If you explicitly specify\n // an initialSize, any fixed options are ignored and the data is retrieved\n // through an aggregation (this is done because the top aggregations may not\n // match the list of explicit options).\n const fixedOptions = useMemo(() => {\n return isNil(initialSize)\n ? filterData[quantity]?.options\n : undefined\n }, [initialSize, filterData, quantity])\n const nFixedOptions = fixedOptions && Object.keys(fixedOptions).length\n const minSize = disableOptions ? 0 : initialSize || nFixedOptions || filterData[quantity]?.aggs?.terms?.size\n const placeholder = filterData[quantity]?.placeholder || \"Type here\"\n const [requestedAggSize, setRequestedAggSize] = useState(minSize)\n const incr = useState(increment || minSize)[0]\n const [loading, setLoading] = useState(false)\n const aggConfig = useMemo(() => {\n const config = {type: 'terms', size: minSize}\n // If a fixed list of options is used, we must restrict the aggregation\n // return values with 'include'. Otherwise the returned results may not\n // contain the correct values.\n const options = filterData[quantity]?.options\n if (options) config.include = Object.keys(options)\n return config\n }, [minSize, filterData, quantity])\n const agg = useAgg(quantity, visible && !disableOptions && !(disableStatistics && fixedOptions), 'scroll', aggConfig)\n const aggCall = useAggCall(quantity, 'scroll')\n const receivedAggSize = agg?.data?.length\n const [filter, setFilter] = useFilterState(quantity)\n const unavailable = disableOptions ? false : !(agg?.data && agg.data.length > 0)\n const disabled = unavailable\n\n // Form the final list of options. If no fixed options are available, the\n // options are gathered from the aggregation.\n const finalOptions = useMemo(() => {\n if (fixedOptions) {\n return fixedOptions\n }\n if (agg?.data) {\n const opt = {}\n const maxSize = Math.min(requestedAggSize, agg.data.length)\n for (let i = 0; i < maxSize; ++i) {\n const value = agg.data[i]\n opt[value.value] = {label: value.value}\n }\n return opt\n }\n return {}\n }, [fixedOptions, agg, requestedAggSize])\n\n // Modify the checkboxes according to changing filters, changing aggregation\n // results or change in the available options.\n useEffect(() => {\n const opt = {}\n for (const [key, value] of Object.entries(finalOptions)) {\n opt[key] = {\n checked: filter ? filter.has(key) : false,\n label: formatLabels ? formatLabel(value.label) : value.label,\n disabled: !disableStatistics\n }\n }\n if (agg?.data) {\n for (const value of agg.data) {\n const key = value.value\n const selected = filter ? filter.has(key) : false\n const oldState = opt[key]\n const disabled = selected ? false : value.count === 0\n if (oldState) {\n oldState.count = value.count\n oldState.disabled = disabled\n }\n }\n }\n setVisibleOptions(opt)\n }, [agg, filter, finalOptions, disableStatistics, formatLabels])\n\n // Show more values\n const handleShowMore = useCallback(() => {\n setLoading(true)\n let newSize = requestedAggSize + incr\n aggCall({type: 'terms', size: newSize}, (response) => {\n if (response?.data?.length === requestedAggSize) {\n newSize = requestedAggSize\n }\n setLoading(false)\n setRequestedAggSize(newSize)\n })\n }, [aggCall, incr, requestedAggSize])\n\n // Show less values\n const handleShowLess = useCallback(() => {\n setRequestedAggSize(old => {\n const newSize = Math.max(old - incr, minSize)\n aggCall({type: 'terms', size: newSize}, () => {})\n return newSize\n })\n }, [aggCall, incr, minSize])\n\n // Handle changes in the selected values\n const handleChange = useCallback((event, key, selected) => {\n const newOptions = {...visibleOptions}\n newOptions[key].checked = selected\n const checked = Object.entries(newOptions)\n .filter(([key, value]) => value.checked)\n .map(([key, value]) => key)\n setFilter(new Set(checked))\n }, [setFilter, visibleOptions])\n\n // Create the search component\n const searchComponent = useMemo(() => {\n return disableSearch\n ? null\n : \n
\n \n
\n
\n }, [disableSearch, unavailable, styles, quantity, disabled, disableSuggestions, placeholder])\n\n // Create the options component\n const optionsComponent = useMemo(() => {\n if (disableOptions) {\n return\n }\n\n const nItems = agg ? Object.keys(finalOptions).length : minSize\n const didNotReceiveMore = isNil(receivedAggSize) ? false : receivedAggSize < requestedAggSize\n const noMoreAvailable = isNil(nFixedOptions) ? false : requestedAggSize >= nFixedOptions\n const hide = didNotReceiveMore || noMoreAvailable\n const showMore = fixedOptions\n ? false\n : !hide\n const showLess = fixedOptions\n ? false\n : (requestedAggSize - incr >= minSize)\n\n const nRows = Math.ceil(nItems * xs / 12)\n const actionsHeight = 34\n let reservedHeight\n if (aggCollapse === 'on') {\n const itemHeight = nRows * inputItemHeight\n const actionHeight = (showMore || showLess) ? actionsHeight : 0\n reservedHeight = nItems > 0 ? (itemHeight + actionHeight) : undefined\n } else if (aggCollapse === 'off') {\n const itemHeight = Math.max(minSize * xs / 12, nRows) * inputItemHeight\n const allLoaded = !isNil(nFixedOptions) && initialSize >= nFixedOptions\n const actionHeight = (fixedOptions || allLoaded) ? 0 : actionsHeight\n reservedHeight = itemHeight + actionHeight\n }\n\n const max = agg ? Math.max(...agg.data.map(option => option.count)) : 0\n const items = visibleOptions && \n {Object.entries(visibleOptions).map(([key, value]) => (\n \n ))}\n
\n\n const noMore = agg?.exhausted && receivedAggSize === requestedAggSize\n let aggComp\n if (fixedOptions) {\n aggComp = items\n } else if (receivedAggSize === 0) {\n aggComp = \n } else if (!agg && aggIndicator === 'on') {\n aggComp = \n } else {\n aggComp = <>\n {items}\n \n \n }\n return
\n {aggComp}\n
\n }, [\n disableOptions,\n disableStatistics,\n agg,\n finalOptions,\n minSize,\n fixedOptions,\n receivedAggSize,\n requestedAggSize,\n incr,\n xs,\n aggCollapse,\n visibleOptions,\n styles,\n aggIndicator,\n initialSize,\n handleChange,\n scale,\n handleShowMore,\n handleShowLess,\n loading,\n nFixedOptions,\n testID\n ]\n )\n\n return
\n \n {searchComponent}\n {optionsComponent}\n
\n})\n\nInputField.propTypes = {\n quantity: PropTypes.string.isRequired,\n label: PropTypes.string,\n description: PropTypes.string,\n visible: PropTypes.bool,\n xs: PropTypes.number,\n initialScale: PropTypes.number, // The initial statistics scaling\n initialSize: PropTypes.number, // The initial maximum number of items to load\n increment: PropTypes.number, // The amount of new items to load on 'show more'\n disableStatistics: PropTypes.bool, // Whether to disable statistics\n disableSearch: PropTypes.bool, // Whether to show the search field\n disableOptions: PropTypes.bool, // Whether to show the options gathered through aggregations\n disableSuggestions: PropTypes.bool, // Whether to disable the text field suggestions\n formatLabels: PropTypes.bool, // Whether to reformat the options labels\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nInputField.defaultProps = {\n xs: 12\n}\n\nexport default InputField\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport clsx from 'clsx'\nimport { makeStyles } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\n\n/**\n * Tick used in plots.\n */\nconst usePlotTickStyles = makeStyles(theme => ({\n root: {\n backgroundColor: theme.palette.grey[500]\n }\n}))\nconst PlotTick = React.memo(({\n length,\n thickness,\n orientation,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const styles = usePlotTickStyles(classes)\n return \n})\n\nPlotTick.propTypes = {\n length: PropTypes.number,\n thickness: PropTypes.number,\n orientation: PropTypes.oneOf(['horizontal', 'vertical']),\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nPlotTick.defaultProps = {\n length: 6,\n thickness: 1\n}\n\nexport default PlotTick\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport clsx from 'clsx'\nimport { Typography } from '@material-ui/core'\nimport { makeStyles } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport PlotTick from './PlotTick'\n\n/**\n * Label used in plots.\n */\nconst usePlotLabelStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n alignItems: 'center'\n },\n horizontal: {\n justifyContent: 'flex-start',\n alignItems: 'center',\n flexDirection: 'column-reverse',\n transform: 'translateX(-50%)'\n },\n vertical: {\n flexDirection: 'row',\n justifyContent: 'flex-end',\n transform: 'translateY(50%)'\n },\n label: {\n lineHeight: 1,\n flexShrink: 0,\n flexGrow: 0\n },\n tick: {\n flexShrink: 0,\n flexGrow: 0\n }\n}))\n\nconst PlotLabel = React.memo(({\n label,\n size,\n labelPadding,\n tickLength,\n orientation,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const styles = usePlotLabelStyles(classes)\n return
\n {label}\n \n
\n \n
\n})\n\nPlotLabel.propTypes = {\n label: PropTypes.string,\n size: PropTypes.number,\n labelPadding: PropTypes.number,\n tickLength: PropTypes.number,\n orientation: PropTypes.oneOf(['horizontal', 'vertical']),\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nPlotLabel.defaultProps = {\n size: 6,\n labelPadding: 3,\n orientation: 'horizontal'\n}\n\nexport default PlotLabel\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo } from 'react'\nimport clsx from 'clsx'\nimport { format } from 'date-fns'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { isArray, isNil } from 'lodash'\nimport { useResizeDetector } from 'react-resize-detector'\nimport { getScaler, getTicks } from './common'\nimport { formatNumber, DType } from '../../utils'\nimport PlotLabel from './PlotLabel'\nimport PlotTick from './PlotTick'\nimport PropTypes from 'prop-types'\n\n/**\n * Represents a plot axis. Can be oriented to fit different sides of a plot\n * using the placement argument.\n */\nconst usePlotAxisStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n position: 'relative',\n overflow: 'hidden'\n },\n left: {\n flexDirection: 'row',\n height: '100%'\n },\n bottom: {\n flexDirection: 'column-reverse',\n width: '100%'\n },\n labelContainer: {\n position: 'relative'\n },\n labelPositioner: {\n position: 'absolute'\n },\n topTick: {\n position: 'absolute',\n top: 0,\n right: 0\n },\n verticalAxis: {\n position: 'absolute',\n width: 1,\n right: 0,\n backgroundColor: theme.palette.grey[500]\n },\n horizontalAxis: {\n position: 'absolute',\n height: 1,\n top: 0,\n backgroundColor: theme.palette.grey[500]\n }\n}))\n\nconst PlotAxis = React.memo(({\n min,\n max,\n dtype,\n mode,\n decimals,\n scale,\n labels,\n labelHeight,\n labelWidth,\n placement,\n tickLength,\n labelPadding,\n overflowLeft,\n overflowRight,\n overflowTop,\n overflowBottom,\n className,\n classes,\n 'data-testid': testID}) => {\n const styles = usePlotAxisStyles(classes)\n const {height, width, ref} = useResizeDetector()\n const orientation = {\n left: 'vertical',\n bottom: 'horizontal'\n }[placement]\n const axisSize = orientation === 'vertical'\n ? height\n : width\n const labelSize = (orientation === 'vertical'\n ? labelHeight\n : labelWidth)\n\n // Determine the correct scaler\n const scaler = useMemo(\n () => getScaler(scale, [min, max], [0, axisSize])\n , [scale, min, max, axisSize])\n\n // Determine styles that depend on overflow values\n overflowBottom = isNil(overflowBottom) ? 8 : overflowBottom\n overflowTop = isNil(overflowTop) ? (placement === 'bottom' ? 0 : 8) : overflowTop\n overflowLeft = isNil(overflowLeft) ? (placement === 'bottom' ? 0 : 8) : overflowLeft\n overflowRight = isNil(overflowRight) ? (placement === 'left' ? 0 : 8) : overflowRight\n const rootStyle = useMemo(() => {\n return {\n marginTop: -overflowTop,\n paddingTop: overflowTop,\n marginBottom: -overflowBottom,\n paddingBottom: overflowBottom,\n marginRight: -overflowRight,\n paddingRight: overflowRight,\n marginLeft: -overflowLeft,\n paddingLeft: overflowLeft\n }\n }, [overflowBottom, overflowLeft, overflowRight, overflowTop])\n const axisStyle = useMemo(() => {\n let axisStyle\n if (placement === 'left') {\n axisStyle = {\n top: overflowTop,\n bottom: overflowBottom - 1\n }\n } else if (placement === 'bottom') {\n axisStyle = {\n left: overflowLeft - 1,\n right: overflowRight - 1\n }\n }\n return axisStyle\n }, [overflowBottom, overflowLeft, overflowRight, overflowTop, placement])\n\n const labelList = useMemo(() => {\n if (!axisSize) {\n return []\n }\n\n // Function for formatting ticks\n const formatTick = (value) => {\n return dtype === DType.Timestamp\n ? format(value, 'MMM d')\n : formatNumber(value, dtype, mode, decimals)\n }\n\n // Manual ticks\n if (isArray(labels)) {\n return labels.map((tick) => ({...tick, label: formatTick(tick.label), pos: scaler(tick.pos) / axisSize}))\n }\n\n // On linear and log axes, the labels are spaced evenly, and the number of\n // labels is calculated from the available space. On non-linearly spaced\n // axes, we calculate the number of labels with formula:\n // axisSize - scaler(max - (max-min) / nLabels) = labelSize\n // -> nLabels = (max-min) / (max - scaler.invert(axisSize - labelSize)\n const padding = 10\n let nItems = (scale === 'linear' || scale === 'log')\n ? Math.floor(axisSize / (labelSize + padding))\n : Math.floor((max - min) / (max - scaler.invert(axisSize - (labelSize + padding))))\n\n // At least two labels should be attempted to be shown\n nItems = Math.max(2, nItems)\n\n // If the scale length is zero, show only one tick\n if (min === max) {\n return [{\n label: formatTick(min),\n pos: 0\n }]\n }\n\n // Get reasonable, human-readable ticks. the .ticks function from d3-scale\n // does not guarantee an upper limit to the number of ticks, so it cannot be\n // directly used.\n return getTicks(min, max, nItems, scale, dtype, mode, decimals)\n .map(({tick, value}) => {\n return {\n label: tick,\n pos: scaler(value) / axisSize\n }\n })\n }, [axisSize, dtype, labelSize, labels, max, min, scaler, mode, decimals, scale])\n\n // Here we estimate the maximum label width. This is a relatively simple\n // approximattion calculated using the font size. A more reliable way would to\n // to actually render to label and measure it's size on the DOM, but this is\n // more expensive.\n const finalLabelWidth = useMemo(() => {\n if (labelWidth) {\n return labelWidth\n }\n const maxCharacters = labelList?.length\n ? Math.max(...labelList.map(label => label.label.length))\n : 0\n const width = tickLength + labelPadding + maxCharacters * 0.56 * labelHeight\n return width\n }, [labelWidth, labelList, tickLength, labelPadding, labelHeight])\n\n return \n \n {labelList.map(({pos, label}, i) => \n \n
)}\n {orientation === 'vertical' &&
\n \n
}\n \n
\n
\n})\n\nPlotAxis.propTypes = {\n min: PropTypes.number,\n max: PropTypes.number,\n scale: PropTypes.string,\n mode: PropTypes.oneOf(['scientific', 'SI', 'standard']),\n decimals: PropTypes.number,\n labels: PropTypes.array,\n placement: PropTypes.oneOf(['left', 'bottom']),\n labelHeight: PropTypes.number,\n labelWidth: PropTypes.number,\n labelPadding: PropTypes.number,\n overflowTop: PropTypes.number,\n overflowBottom: PropTypes.number,\n overflowLeft: PropTypes.number,\n overflowRight: PropTypes.number,\n tickLength: PropTypes.number,\n dtype: PropTypes.string,\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nPlotAxis.defaultProps = {\n labelHeight: 12,\n tickLength: 6,\n labelPadding: 3,\n scale: 'linear',\n scientific: true, // Whether to use scientific notation, e.g. 1e+3\n siPostfix: false, // Whether to use SI postfixes, e.g. K, M, B\n decimals: 3 // How many decimals to show for custom labels\n}\n\nexport default PlotAxis\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useMemo } from 'react'\nimport clsx from 'clsx'\nimport { clamp } from 'lodash'\nimport { Tooltip } from '@material-ui/core/'\nimport { makeStyles } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\n\n/**\n * Bar within a plot.\n */\nconst usePlotAxisStyles = makeStyles(theme => ({\n root: {\n position: 'absolute',\n cursor: 'pointer',\n height: '100%',\n paddingLeft: '1px',\n paddingRight: '1px'\n },\n container: {\n position: 'relative',\n width: '100%',\n height: '100%'\n },\n rectangle: {\n width: '100%',\n height: '100%',\n '-webkit-transform': 'none',\n transform: 'none',\n transition: 'transform 250ms',\n transformOrigin: 'bottom left',\n willChange: 'transform',\n backgroundColor: theme.palette.primary.veryLight,\n position: 'relatives'\n },\n highlight: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n backgroundColor: theme.palette.secondary.veryLight\n }\n}))\n\nconst PlotBar = React.memo(({\n startX,\n endX,\n startY,\n endY,\n selected,\n tooltip,\n onClick,\n className,\n classes,\n 'data-testid': testID}) => {\n const styles = usePlotAxisStyles(classes)\n\n const handleClick = useCallback((event) => {\n onClick && onClick(event)\n }, [onClick])\n\n const highlightStyle = useMemo(() => {\n if (selected === false) {\n return {visibility: 'hidden'}\n }\n if (selected === true) {\n return {\n left: '0%',\n right: '0%'\n }\n }\n return {\n left: `${clamp(selected[0] * 100, 0, 100)}%`,\n right: `${clamp((1 - selected[1]) * 100, 0, 100)}%`\n }\n }, [selected])\n\n return \n \n
\n
\n \n
\n
\n
\n \n})\n\nPlotBar.propTypes = {\n startX: PropTypes.number,\n endX: PropTypes.number,\n startY: PropTypes.number,\n endY: PropTypes.number,\n /* The selection as a boolean, or as a range. The range is given as two\n * percentages indicate the start and end of the selection. */\n selected: PropTypes.oneOfType([PropTypes.bool, PropTypes.arrayOf(PropTypes.number)]),\n tooltip: PropTypes.string,\n onClick: PropTypes.func,\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nPlotBar.defaultProps = {\n}\n\nexport default PlotBar\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useRef, useMemo, useCallback } from 'react'\nimport clsx from 'clsx'\nimport { range as rangeLodash, isNil, clamp } from 'lodash'\nimport { useRecoilValue } from 'recoil'\nimport { Slider, InputAdornment } from '@material-ui/core'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { KeyboardDateTimePicker } from '@material-ui/pickers'\nimport { pluralize, formatInteger, DType } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport InputUnavailable from '../search/input/InputUnavailable'\nimport { InputTextField } from '../search/input/InputText'\nimport Placeholder from '../visualization/Placeholder'\nimport PlotAxis from './PlotAxis'\nimport PlotBar from './PlotBar'\nimport FilterTitle from '../search/FilterTitle'\nimport { guiState } from '../GUIMenu'\nimport PropTypes from 'prop-types'\nimport { getScaler } from './common'\nimport { dateFormat } from '../../config'\n\n/**\n * An interactive histogram for numeric values.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%',\n boxSizing: 'border-box'\n },\n container: {\n width: '100%',\n height: '100%',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center'\n },\n histogram: {\n width: '100%',\n height: '100%'\n },\n overflow: {\n flex: '1 1 auto',\n width: '100%',\n height: '100%'\n },\n grid: {\n width: '100%',\n height: '100%',\n boxSizing: 'border-box',\n display: 'grid',\n gridTemplateColumns: 'auto 1fr',\n gridTemplateRows: '1fr auto',\n paddingRight: theme.spacing(0.75),\n paddingBottom: theme.spacing(0.25)\n },\n plot: {\n gridColumn: 2,\n gridRow: 1,\n position: 'relative'\n },\n canvas: {\n width: '100%',\n height: '100%',\n position: 'relative',\n overflow: 'hidden'\n },\n slider: {\n zIndex: 10,\n position: 'absolute',\n bottom: -14,\n left: 0,\n right: 0\n },\n yaxis: {\n gridColumn: 1,\n gridRow: 1,\n height: '100%'\n },\n square: {\n gridColumn: 1,\n gridRow: 2\n },\n xaxis: {\n gridColumn: 2,\n gridRow: 2\n },\n inputField: {\n marginTop: 0,\n marginBottom: 0,\n flexGrow: 1,\n minWidth: '6.1rem',\n maxWidth: '8.5rem'\n },\n inputFieldDate: {\n maxWidth: '15rem'\n },\n thumb: {\n '&:active': {\n boxShadow: '0px 0px 0px 12px rgb(0, 141, 195, 16%)'\n },\n '&:focusVisible': {\n boxShadow: '0px 0px 0px 6px rgb(0, 141, 195, 16%)'\n }\n },\n title: {\n flexGrow: 1,\n marginLeft: theme.spacing(0.5),\n marginRight: theme.spacing(0.5)\n },\n // The following two styles are needed in order for the TextInput to\n // transition from having a label to not having a label. The MUI component\n // does not otherwise transition correctly.\n inputMargin: {\n paddingTop: 10,\n paddingBottom: 11\n },\n adornment: {\n marginTop: '0px !important'\n },\n spacer: {\n height: '3rem',\n flex: '1 1 100%',\n paddingLeft: '18px',\n paddingRight: '18px',\n display: 'flex',\n alignItems: 'center'\n },\n row: {\n marginTop: theme.spacing(0.25),\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'flex-start'\n }\n}))\nconst PlotHistogram = React.memo(({\n xAxis,\n yAxis,\n bins,\n range,\n step,\n nBins,\n discretization,\n dtypeY,\n disabled,\n tooltipLabel,\n highlight,\n disableSlider,\n onRangeChange,\n onRangeCommit,\n onMinChange,\n onMaxChange,\n onMinBlur,\n onMaxBlur,\n onMinSubmit,\n onMaxSubmit,\n onClick,\n minXInclusive,\n maxXInclusive,\n className,\n classes,\n showinput,\n minError,\n maxError,\n minInput,\n maxInput,\n minLocal,\n maxLocal,\n stepSlider,\n disableHistogram,\n disableXTitle,\n 'data-testid': testID\n}) => {\n const styles = useStyles(classes)\n const useDynamicStyles = makeStyles((theme) => {\n const color = highlight ? theme.palette.secondary.main : theme.palette.primary.main\n return {\n thumb: {\n 'border': `2px solid ${color}`,\n '&[data-index=\"0\"]': {\n backgroundColor: minXInclusive ? color : 'white'\n },\n '&[data-index=\"1\"]': {\n backgroundColor: maxXInclusive ? color : 'white'\n }\n }\n }\n })\n const dynamicStyles = useDynamicStyles()\n\n const aggIndicator = useRecoilValue(guiState('aggIndicator'))\n const oldRangeRef = useRef()\n const artificialRange = 1\n const isArtificial = !step && bins?.length === 1\n const isTime = xAxis.dtype === DType.Timestamp\n step = isArtificial ? artificialRange / nBins : step\n\n // Determine the final maximum of x-axis. If the values are discrete, the\n // maximum x value needs to be increased.\n let maxX = isArtificial ? xAxis.min + artificialRange : xAxis.max\n if (discretization) {\n if (!isNil(maxX)) {\n maxX += step\n }\n }\n\n // Determine the final bin data and the y axis limits.\n const [finalBins, minY, maxY] = useMemo(() => {\n if (isNil(bins)) {\n return [null, null, null]\n }\n const minY = 0\n const maxY = Math.max(...bins.map(item => item.count))\n const scaler = getScaler(yAxis.scale, [minY, maxY])\n const finalBins = bins.map((bucket) => {\n return {\n ...bucket,\n start: bucket.value,\n end: bucket.value + step,\n scale: scaler(bucket.count)\n }\n })\n return [finalBins, minY, maxY]\n }, [bins, step, yAxis.scale])\n\n // Transforms the original range into an internal range used for\n // visualization.\n const toInternalRange = useCallback((range) => {\n return (discretization && !isNil(range?.[1]))\n ? [range[0], range[1] + step]\n : range\n }, [discretization, step])\n\n // Transforms the internal range into the original range.\n const toExternalRange = useCallback((range) => {\n return (discretization && !isNil(range?.[1]))\n ? [range[0], range[1] - step]\n : range\n }, [discretization, step])\n\n const rangeInternal = useMemo(() => {\n return toInternalRange([range?.gte, range?.lte])\n }, [range, toInternalRange])\n\n // Turns the internal range values back to the external counterparts before\n // sending the event.\n const handleRangeCommit = useCallback((event, range) => {\n onRangeCommit && onRangeCommit(event, toExternalRange(range))\n }, [onRangeCommit, toExternalRange])\n\n // Handle clicks on the histogram bins\n const handleClick = useCallback((event, item) => {\n onClick && onClick(event, isArtificial\n ? [item.start, item.start]\n : [item.start, discretization ? item.start : item.end])\n }, [isArtificial, onClick, discretization])\n\n // Turns the internal range values back to the external counterparts before\n // sending the event.\n const handleRangeChange = useCallback((event, range) => {\n if (!onRangeChange) {\n return\n }\n range = toExternalRange(range)\n // Check if the value has actually changed: MUI Slider does not do this\n // automatically.\n if (oldRangeRef.current &&\n oldRangeRef.current[0] === range[0] &&\n oldRangeRef.current[1] === range[1]) {\n return\n }\n oldRangeRef.current = range\n onRangeChange(event, range)\n }, [onRangeChange, toExternalRange])\n\n // Calculates the selection value for a bin.\n const calculateSelection = useCallback((bin, range) => {\n if (!highlight) {\n return false\n }\n if (isArtificial) {\n return bin.start === rangeInternal[0]\n }\n const interval = bin.end - bin.start\n const min = clamp((range[0] - bin.start) / interval, 0, 1)\n const max = clamp((range[1] - bin.start) / interval, 0, 1)\n const size = max - min\n if (size <= 0) {\n return false\n }\n if (min <= 0 && max >= 1) {\n return true\n }\n return [min, max]\n }, [highlight, isArtificial, rangeInternal])\n\n // Create the plot once items are ready\n const plot = useMemo(() => {\n if (isNil(finalBins) || isNil(xAxis.min) || isNil(maxX)) {\n return null\n }\n return
\n {Object.values(finalBins).map((item, i) => {\n return handleClick(event, item)}\n />\n })}\n
\n }, [finalBins, xAxis.min, maxX, styles.canvas, calculateSelection, rangeInternal, handleClick, tooltipLabel])\n\n // Create x-axis once axis range is ready\n const xaxis = useMemo(() => {\n if (isNil(finalBins) || isNil(xAxis.min) || isNil(maxX)) {\n return null\n }\n let labels\n\n // One bin is shown for the artificial values\n if (isArtificial) {\n const offset = discretization ? 0.5 * step : 0\n labels = [{\n label: finalBins[0].start,\n pos: finalBins[0].start + offset\n }]\n // Discrete values get label at the center of the bin.\n } else if (discretization) {\n const start = step * Math.ceil(xAxis.min / step)\n const end = step * Math.floor(maxX / step)\n labels = rangeLodash(start, end).map(x => ({\n label: x,\n pos: x + 0.5 * step\n }))\n }\n\n const min = new Quantity(xAxis.min, xAxis.unitStorage).to(xAxis.unit).value()\n const max = new Quantity(maxX, xAxis.unitStorage).to(xAxis.unit).value()\n\n return \n }, [finalBins, xAxis.min, xAxis.unitStorage, maxX, discretization, isArtificial, xAxis.dtype, styles.xaxis, xAxis.unit, step])\n\n const [minAdornment, maxAdornment] = useMemo(() => {\n return disableHistogram\n ? [undefined, undefined]\n : [\n {\n startAdornment: min:,\n classes: {inputMarginDense: styles.inputMargin}\n },\n {\n startAdornment: max:,\n classes: {inputMarginDense: styles.inputMargin}\n }\n ]\n }, [disableHistogram, styles])\n\n // Determine the min input component\n let inputMinField\n if (xAxis.dtype === DType.Timestamp) {\n inputMinField = {\n onMinChange(date)\n onMinSubmit(date)\n }}\n onChange={onMinChange}\n onBlur={onMinBlur}\n onKeyDown={(event) => { if (event.key === 'Enter') { onMinSubmit(minInput) } }}\n />\n } else {\n inputMinField = { if (event.key === 'Enter') { onMinSubmit(minInput) } }}\n />\n }\n\n // Determine the max input component\n let inputMaxField\n if (xAxis.dtype === DType.Timestamp) {\n inputMaxField = {\n onMaxChange(date)\n onMaxSubmit(date)\n }}\n onChange={onMaxChange}\n onBlur={onMaxBlur}\n onKeyDown={(event) => { if (event.key === 'Enter') { onMaxSubmit(maxInput) } }}\n />\n } else {\n inputMaxField = { if (event.key === 'Enter') { onMaxSubmit(maxInput) } }}\n />\n }\n\n // Create y-axis once axis range is ready.\n const yaxis = useMemo(() => {\n if (isNil(minY) || isNil(maxY)) {\n return null\n }\n return \n }, [dtypeY, maxY, minY, yAxis.scale, styles.yaxis])\n\n // Determine the final component to show.\n let histComp\n if (bins?.length === 0) {\n histComp = \n } else if (isNil(bins) && aggIndicator === 'on') {\n histComp = \n } else {\n histComp =
\n
\n {yaxis}\n
\n {plot}\n {!disableSlider &&\n \n }\n
\n
\n {xaxis}\n
\n
\n }\n\n const titleComp =
\n \n
\n\n return
\n
\n {!disableHistogram &&
{histComp}
}\n {!disableXTitle && titleComp}\n
\n {showinput\n ? <>\n {inputMinField}\n {(disableHistogram && !isTime)\n ?
\n \n
\n :
\n }\n {inputMaxField}\n \n : null\n }\n
\n
\n
\n})\n\nPlotHistogram.propTypes = {\n xAxis: PropTypes.object,\n yAxis: PropTypes.object,\n /* The bins data to show. */\n bins: PropTypes.arrayOf(PropTypes.shape({\n value: PropTypes.number,\n count: PropTypes.number\n })),\n range: PropTypes.object,\n step: PropTypes.number,\n /* The number of bins: required only when showing a dummy bin for histograms\n * that have no width. */\n nBins: PropTypes.number,\n /* Discretization of the values. */\n discretization: PropTypes.number,\n dtypeY: PropTypes.string,\n disabled: PropTypes.bool,\n /* The label to show for the tooltips */\n tooltipLabel: PropTypes.string,\n /* Whether the selected region should be highlighted */\n highlight: PropTypes.bool,\n /* Disable the intervative slider shown on top of the plot */\n disableSlider: PropTypes.bool,\n /* Function to call when a histogram bar has been clicked */\n onClick: PropTypes.func,\n /* Whether the min slider is inclusive (=min value is included) */\n minXInclusive: PropTypes.bool,\n /* Whether the max slider is inclusive (=max value is included) */\n maxXInclusive: PropTypes.bool,\n showInput: PropTypes.bool,\n onRangeChange: PropTypes.func,\n onRangeCommit: PropTypes.func,\n onMinChange: PropTypes.func,\n onMaxChange: PropTypes.func,\n onMinSubmit: PropTypes.func,\n onMaxSubmit: PropTypes.func,\n showinput: PropTypes.bool,\n maxError: PropTypes.any,\n minError: PropTypes.any,\n maxInput: PropTypes.any,\n minInput: PropTypes.any,\n maxLocal: PropTypes.any,\n minLocal: PropTypes.any,\n stepSlider: PropTypes.any,\n disableHistogram: PropTypes.bool,\n disableXTitle: PropTypes.bool,\n onMinBlur: PropTypes.func,\n onMaxBlur: PropTypes.func,\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nexport default PlotHistogram\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useSearchContext } from '../SearchContext'\nimport { Widget } from './Widget'\nimport { ActionCheckbox, ActionSelect } from '../../Actions'\nimport { Range } from '../input/InputRange'\nimport { scales } from '../../plotting/common'\nimport {getDisplayLabel} from '../../../utils'\nimport { Unit } from '../../units/Unit'\nimport { useUnitContext } from '../../units/UnitContext'\n\n/**\n * Displays a histogram widget.\n */\nexport const autorangeDescription = 'Automatically center the view on the data'\nexport const WidgetHistogram = React.memo((\n{\n id,\n title,\n description,\n x,\n y,\n nbins,\n autorange,\n showinput,\n className\n}) => {\n const { filterData, useSetWidget } = useSearchContext()\n const {units} = useUnitContext()\n const setWidget = useSetWidget(id)\n\n // Create final axis config for the plot\n const xAxis = useMemo(() => {\n const xFilter = filterData[x.quantity]\n const xTitle = x.title || getDisplayLabel(xFilter)\n const xType = xFilter?.dtype\n const xUnit = x.unit\n ? new Unit(x.unit)\n : new Unit(xFilter.unit || 'dimensionless').toSystem(units)\n\n return {\n ...x,\n title: xTitle,\n unit: xUnit,\n dtype: xType\n }\n }, [filterData, x, units])\n\n const handleEdit = useCallback(() => {\n setWidget(old => { return {...old, editing: true } })\n }, [setWidget])\n\n const handleChangeScale = useCallback((value) => {\n setWidget(old => { return {...old, y: {...old.y, scale: value}} })\n }, [setWidget])\n\n return \n setWidget(old => ({...old, autorange: value}))}\n />\n \n }\n >\n \n \n})\n\nWidgetHistogram.propTypes = {\n id: PropTypes.string.isRequired,\n title: PropTypes.string,\n description: PropTypes.string,\n x: PropTypes.object,\n y: PropTypes.object,\n nbins: PropTypes.number,\n autorange: PropTypes.bool,\n showinput: PropTypes.bool,\n className: PropTypes.string\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useMemo, useCallback, useEffect, useRef, useContext } from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { isNil } from 'lodash'\nimport InputHeader from './InputHeader'\nimport { inputSectionContext } from './InputSection'\nimport { Quantity } from '../../units/Quantity'\nimport { Unit } from '../../units/Unit'\nimport { useUnitContext } from '../../units/UnitContext'\nimport { DType, formatNumber } from '../../../utils'\nimport { getInterval } from '../../plotting/common'\nimport { useSearchContext } from '../SearchContext'\nimport PlotHistogram from '../../plotting/PlotHistogram'\nimport { isValid, getTime } from 'date-fns'\nimport { ActionCheckbox } from '../../Actions'\nimport { autorangeDescription } from '../widgets/WidgetHistogram'\n\n/*\n * Component for displaying a numerical range as a slider/histogram together\n * with query input possibility.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%'\n },\n histogram: {\n }\n}))\nexport const Range = React.memo(({\n xAxis,\n yAxis,\n nSteps,\n visible,\n nBins,\n disableHistogram,\n disableXTitle,\n autorange,\n showinput,\n aggId,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const {filterData, useAgg, useFilterState, useIsStatisticsEnabled} = useSearchContext()\n const sectionContext = useContext(inputSectionContext)\n const repeats = sectionContext?.repeats\n const isStatisticsEnabled = useIsStatisticsEnabled()\n const styles = useStyles({classes})\n const [filter, setFilter] = useFilterState(xAxis.quantity)\n const [minLocal, setMinLocal] = useState()\n const [maxLocal, setMaxLocal] = useState()\n const [plotData, setPlotData] = useState({xAxis, yAxis})\n const loading = useRef(false)\n const firstRender = useRef(true)\n const validRange = useRef()\n const rangeChanged = useRef(false)\n const minInputChanged = useRef(false)\n const maxInputChanged = useRef(false)\n const [range, setRange] = useState({gte: undefined, lte: undefined})\n const [minError, setMinError] = useState(false)\n const [maxError, setMaxError] = useState(false)\n const [minInclusive, setMinInclusive] = useState(true)\n const [maxInclusive, setMaxInclusive] = useState(true)\n const highlight = Boolean(filter)\n disableHistogram = isNil(disableHistogram) ? !isStatisticsEnabled : disableHistogram\n\n // Determine the description and units\n const def = filterData[xAxis.quantity]\n const unitStorage = useMemo(() => { return new Unit(def?.unit || 'dimensionless') }, [def])\n const discretization = xAxis.dtype === DType.Int ? 1 : undefined\n const isTime = xAxis.dtype === DType.Timestamp\n const firstLoad = useRef(true)\n\n // We need to set a valid initial input state: otherwise the component thinks\n // it is uncontrolled.\n const [minInput, setMinInput] = useState(isTime ? new Date() : '')\n const [maxInput, setMaxInput] = useState(isTime ? new Date() : '')\n\n // Function for converting filter values into storage units used by the API.\n const fromDisplayUnit = useCallback(filter => {\n return filter instanceof Quantity\n ? filter.to(unitStorage).value()\n : filter\n }, [unitStorage])\n\n // Function for converting filter values from storage unit to display unit\n const fromStorageUnit = useCallback(filter => {\n return (isTime)\n ? filter\n : filter instanceof Quantity\n ? filter.to(unitStorage)\n : new Quantity(filter, unitStorage)\n }, [unitStorage, isTime])\n\n // Function for converting filter values from display unit to storage unit\n const toStorageUnit = useCallback(filter => {\n return (isTime)\n ? filter\n : filter instanceof Quantity\n ? filter.to(unitStorage)\n : new Quantity(filter, xAxis.unit).to(unitStorage)\n }, [isTime, xAxis.unit, unitStorage])\n\n // Aggregation when the statistics are enabled: a histogram aggregation with\n // extended bounds based on the currently set filter range. Note: the config\n // should be memoed in order to prevent re-renders.\n const minRef = useRef(fromDisplayUnit(isNil(filter?.gte) ? filter?.gt : filter?.gte))\n const maxRef = useRef(fromDisplayUnit(isNil(filter?.lte) ? filter?.lt : filter?.lte))\n const aggHistogramConfig = useMemo(() => {\n const filterBounds = (filter) ? {\n min: fromDisplayUnit(isNil(filter.gte) ? filter.gt : filter.gte),\n max: fromDisplayUnit(isNil(filter.lte) ? filter.lt : filter.lte)\n } : undefined\n let exclude_from_search\n let extended_bounds\n // Extended bounds are always applied on the first load but with no\n // filtering.\n if (firstLoad.current) {\n extended_bounds = filterBounds\n exclude_from_search = true\n } else {\n // Is zoom is not disabled, the current filter defines the histogram\n // boundary.\n if (autorange) {\n extended_bounds = filterBounds\n exclude_from_search = false\n } else {\n // Is zoom is disabled and filter is outside the old boundary, the\n // filter defines the new boundary and filter is active.\n const outOfBounds = filter ? (filterBounds.min < minRef.current || filterBounds.max > maxRef.current) : false\n if (outOfBounds) {\n extended_bounds = filterBounds\n exclude_from_search = false\n } else {\n // Is zoom is disabled and filter is within the old boundary, and the\n // global boundary, the old boundary is kept.\n extended_bounds = filter\n ? (isNil(minRef.current) ? undefined : {min: minRef.current, max: maxRef.current})\n : undefined\n exclude_from_search = true\n }\n }\n }\n return (isTime || !discretization)\n ? {type: 'histogram', buckets: nBins, exclude_from_search, extended_bounds}\n : {type: 'histogram', interval: discretization, exclude_from_search, extended_bounds}\n }, [filter, fromDisplayUnit, isTime, discretization, nBins, autorange])\n const agg = useAgg(xAxis.quantity, visible && !disableHistogram, `${aggId}_histogram`, aggHistogramConfig)\n useEffect(() => {\n if (!isNil(agg)) {\n firstLoad.current = false\n }\n }, [agg])\n\n // Aggregation when the statistics are disabled: a simple min_max aggregation\n // is enough in order to get the slider range.\n const aggSliderConfig = useMemo(() => ({type: 'min_max', exclude_from_search: true}), [])\n const aggSlider = useAgg(xAxis.quantity, visible && disableHistogram, `${aggId}_slider`, aggSliderConfig)\n\n // Determine the global minimum and maximum values\n const [minGlobal, maxGlobal] = useMemo(() => {\n let minGlobal\n let maxGlobal\n if (disableHistogram) {\n minGlobal = aggSlider?.data?.[0]\n maxGlobal = aggSlider?.data?.[1]\n } else {\n const nBuckets = agg?.data?.length || 0\n if (nBuckets === 1) {\n minGlobal = agg.data[0].value\n maxGlobal = minGlobal\n } else if (nBuckets > 1) {\n for (const bucket of agg.data) {\n if (isNil(minGlobal)) {\n minGlobal = bucket.value\n }\n maxGlobal = bucket.value + (discretization ? 0 : agg.interval)\n }\n if (isNil(minGlobal)) {\n minGlobal = agg.data[0].value\n }\n if (isNil(maxGlobal)) {\n maxGlobal = agg.data[agg.data.length - 1].value + (discretization ? 0 : agg.interval)\n }\n }\n }\n firstRender.current = false\n return [minGlobal, maxGlobal]\n }, [agg, aggSlider, disableHistogram, discretization])\n\n const stepHistogram = agg?.interval\n const unavailable = isNil(minGlobal) || isNil(maxGlobal) || isNil(range)\n const disabled = unavailable\n\n // Determine the step value for sliders. Notice that this does not have to\n // match with the histogram binning, and that we want to do call the\n // getInterval function on the display unit range.\n const stepSlider = useMemo(() => {\n if (discretization) {\n return discretization\n }\n if (isNil(maxLocal) || isNil(minLocal)) {\n return undefined\n }\n const rangeSI = maxLocal - minLocal\n const range = new Quantity(rangeSI, unitStorage.toDelta()).to(xAxis.unit).value()\n const intervalCustom = getInterval(range, nSteps, xAxis.dtype)\n return new Quantity(intervalCustom, xAxis.unit).to(unitStorage).value()\n }, [maxLocal, minLocal, discretization, nSteps, xAxis.dtype, xAxis.unit, unitStorage])\n\n // When filter changes, the plot data should not be updated.\n useEffect(() => {\n if (autorange) loading.current = true\n }, [filter, autorange])\n\n // Once the aggregation data arrives, the plot data can be updated.\n useEffect(() => {\n if (!isNil(agg)) {\n loading.current = false\n }\n }, [agg])\n\n // We refresh the plot information only when all of the data is updated.\n // Essentially this syncs the axis limits and data so that they are updated\n // simultaneously.\n useEffect(() => {\n if (loading.current || isNil(agg?.data)) {\n return\n }\n\n setPlotData({\n xAxis: {\n quantity: xAxis.quantity,\n unit: xAxis.unit,\n unitStorage: unitStorage,\n dtype: xAxis.dtype,\n title: xAxis.title,\n min: minLocal,\n max: maxLocal\n },\n yAxis,\n step: stepHistogram,\n data: agg.data\n })\n }, [loading, nBins, agg, minLocal, maxLocal, stepHistogram, unitStorage, xAxis.quantity, xAxis.unit, xAxis.dtype, xAxis.title, xAxis.scale, yAxis])\n\n // Function for converting search values into the currently selected unit\n // system.\n const toInternal = useCallback(filter => {\n return (!isTime && unitStorage)\n ? formatNumber(new Quantity(filter, unitStorage).to(xAxis.unit).value())\n : filter\n }, [unitStorage, isTime, xAxis.unit])\n\n // If no filter has been specified by the user, the range is automatically\n // adjusted according to global min/max of the field. If filter is set, the\n // slider value is set according to it.\n useEffect(() => {\n let lte\n let gte\n let min\n let max\n let minInc = true\n let maxInc = true\n\n // Helper functions for determining the min/max boundaries.\n const limit = (global, filter, min) => {\n const func = min ? Math.min : Math.max\n if (autorange) {\n return filter\n } else {\n return func(global, filter)\n }\n }\n const limitMin = (global, filter) => limit(global, filter, true)\n const limitMax = (global, filter) => limit(global, filter, false)\n\n if (!isNil(minGlobal) && !isNil(maxGlobal)) {\n // When no filter is set, use the whole available range\n if (isNil(filter)) {\n gte = minGlobal\n lte = maxGlobal\n min = minGlobal\n max = maxGlobal\n // A single specific value is given\n } else if (filter instanceof Quantity) {\n gte = filter.to(unitStorage).value()\n lte = filter.to(unitStorage).value()\n min = limitMin(minGlobal, gte)\n max = limitMax(maxGlobal, lte)\n // A range is given. For visualization purposes open-ended queries are\n // displayed as well, although making such queries is currently not\n // supported.\n } else {\n minInc = isNil(filter.gt)\n maxInc = isNil(filter.lt)\n gte = filter.gte || filter.gt\n lte = filter.lte || filter.lt\n gte = gte instanceof Quantity ? gte.to(unitStorage).value() : gte\n lte = lte instanceof Quantity ? lte.to(unitStorage).value() : lte\n\n if (isNil(gte)) {\n min = limitMin(minGlobal, lte)\n gte = min\n } else {\n min = limitMin(minGlobal, gte)\n }\n if (isNil(lte)) {\n max = limitMax(maxGlobal, gte)\n lte = max\n } else {\n max = limitMax(maxGlobal, lte)\n }\n }\n minRef.current = min\n maxRef.current = max\n setMinInclusive(minInc)\n setMaxInclusive(maxInc)\n setMinLocal(min)\n setMaxLocal(max)\n setRange({gte: gte, lte: lte})\n setMinInput(toInternal(gte))\n setMaxInput(toInternal(lte))\n setMaxError()\n setMinError()\n }\n }, [minGlobal, maxGlobal, filter, unitStorage, toInternal, def, isTime, autorange])\n\n // Returns whether the given range is an acceptable value to be queried and\n // displayed.\n const validateRange = useCallback((range) => {\n if (isTime) {\n return range[1] - range[0] >= 60000\n }\n return true\n }, [isTime])\n\n // Handles changes in the min input\n const handleMinChange = useCallback((value) => {\n if (autorange) loading.current = true\n let val\n if (isTime) {\n value.setSeconds(0, 0)\n val = getTime(value)\n } else {\n val = value.target?.value\n }\n minInputChanged.current = true\n setMinInput(val)\n setMaxError()\n setMinError()\n }, [isTime, autorange])\n\n // Handles changes in the max input\n const handleMaxChange = useCallback((value) => {\n if (autorange) loading.current = true\n loading.current = true\n let val\n if (isTime) {\n value.setSeconds(0, 0)\n val = getTime(value)\n } else {\n val = value.target?.value\n }\n maxInputChanged.current = true\n setMaxInput(val)\n setMaxError()\n setMinError()\n }, [isTime, autorange])\n\n // Called when min values are submitted through the input field\n const handleMinSubmit = useCallback((value) => {\n let error\n if (isTime) {\n if (!isValid(value)) {\n error = 'Invalid start date.'\n } else {\n value = getTime(value)\n }\n } else {\n const number = Number.parseFloat(value)\n if (isNaN(number)) {\n error = 'Invalid minimum value.'\n } else {\n value = toStorageUnit(number)\n }\n }\n if ((isTime ? value : value.value) > range.lte) {\n error = 'Cannot be larger than maximum value.'\n }\n if (error) {\n setMinError(error)\n } else {\n minInputChanged.current = false\n setFilter(old => {\n return {\n gte: value,\n lte: fromStorageUnit(isNil(old?.lte) ? maxLocal : old.lte)\n }\n })\n }\n }, [isTime, setFilter, fromStorageUnit, toStorageUnit, maxLocal, range])\n\n // Called when max values are submitted through the input field\n const handleMaxSubmit = useCallback((value) => {\n let error\n if (isTime) {\n if (!isValid(value)) {\n error = 'Invalid end date.'\n } else {\n value = getTime(value)\n }\n } else {\n const number = Number.parseFloat(value)\n if (isNaN(number)) {\n error = 'Invalid maximum value.'\n } else {\n value = toStorageUnit(number)\n }\n }\n if ((isTime ? value : value.value) < range.gte) {\n error = 'Cannot be smaller than minimum value.'\n }\n if (error) {\n setMaxError(error)\n } else {\n maxInputChanged.current = false\n setFilter(old => {\n return {\n gte: fromStorageUnit(isNil(old?.gte) ? minLocal : old.gte),\n lte: value\n }\n })\n }\n }, [isTime, setFilter, fromStorageUnit, toStorageUnit, minLocal, range])\n\n // Handle range commit: Set the filter when mouse is released on a slider.\n // Notice that we cannot rely on the value given by the slider event: it may\n // correspond to a non-valid range. Instead we need to use the latest valid\n // value saved when the value has changed.\n const handleRangeCommit = useCallback((event) => {\n const value = validRange.current\n if (!isNil(value) && rangeChanged.current) {\n setFilter({\n gte: fromStorageUnit(value[0]),\n lte: fromStorageUnit(value[1])\n })\n rangeChanged.current = false\n }\n }, [setFilter, fromStorageUnit])\n\n // Handle range change: only change the rendered values, filter is send with\n // handleRangeCommit.\n const handleRangeChange = useCallback((event, value, validate = true) => {\n if (autorange) loading.current = true\n const valid = !validate || validateRange(value)\n if (valid) {\n rangeChanged.current = true\n validRange.current = value\n setRange({gte: value[0], lte: value[1]})\n setMinInput(toInternal(value[0]))\n setMaxInput(toInternal(value[1]))\n setMinInclusive(true)\n setMaxInclusive(true)\n setMaxError()\n setMinError()\n }\n }, [validateRange, validRange, toInternal, autorange])\n\n // Handle min input field blur: only if the input has changed, the filter will\n // be submitted.\n const handleMinBlur = useCallback(() => {\n minInputChanged.current && handleMinSubmit(minInput)\n }, [minInput, handleMinSubmit, minInputChanged])\n\n // Handle max input field blur: only if the input has changed, the filter will\n // be submitted.\n const handleMaxBlur = useCallback(() => {\n maxInputChanged.current && handleMaxSubmit(maxInput)\n }, [maxInput, handleMaxSubmit, maxInputChanged])\n\n return
\n {\n handleRangeChange(event, value, false)\n handleRangeCommit(event, value)\n }}\n minError={minError}\n maxError={maxError}\n minInput={minInput}\n maxInput={maxInput}\n minLocal={minLocal}\n maxLocal={maxLocal}\n showinput={showinput}\n stepSlider={stepSlider}\n disableHistogram={disableHistogram}\n disableXTitle={disableXTitle}\n data-testid={`${testID}-histogram`}\n />\n
\n})\n\nRange.propTypes = {\n xAxis: PropTypes.object,\n yAxis: PropTypes.object,\n /* Target number of steps for the slider that is shown when statistics are\n * disabled. The actual number may vary, as the step is chosen to be a\n * human-readable value that depends on the range and the unit. */\n nSteps: PropTypes.number,\n /* Number of bins for the histogram (and the slider) when statistics are\n * enabled. */\n nBins: PropTypes.number,\n visible: PropTypes.bool,\n /* Whether the histogram is disabled */\n disableHistogram: PropTypes.bool,\n /* Whether the x title is disabled */\n disableXTitle: PropTypes.bool,\n /* Set the range automatically according to data. */\n autorange: PropTypes.bool,\n /* Show the input fields for min and max value */\n showinput: PropTypes.bool,\n aggId: PropTypes.string,\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nRange.defaultProps = {\n nSteps: 20,\n nBins: 30,\n aggId: 'default',\n 'data-testid': 'inputrange'\n}\n\n/**\n * A small wrapper around Range for use in the filter menus.\n */\nconst useInputRangeStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n flexDirection: 'column'\n },\n histogram: {\n height: '8rem'\n }\n}))\nconst InputRange = React.memo(({\n label,\n quantity,\n description,\n nSteps,\n visible,\n initialScale,\n nBins,\n disableHistogram,\n initialAutorange,\n aggId,\n className,\n 'data-testid': testID\n}) => {\n const {filterData} = useSearchContext()\n const {units} = useUnitContext()\n const styles = useInputRangeStyles()\n const [scale, setScale] = useState(initialScale || filterData[quantity].scale)\n const dtype = filterData[quantity].dtype\n const isTime = dtype === DType.Timestamp\n const [autorange, setAutorange] = useState(isNil(initialAutorange) ? isTime : initialAutorange)\n const x = useMemo(() => (\n {\n quantity,\n dtype,\n unit: new Unit(filterData[quantity]?.unit || 'dimensionless').toSystem(units)\n }\n ), [quantity, filterData, dtype, units])\n const y = useMemo(() => ({scale: scale}), [scale])\n\n // Determine the description and title\n const def = filterData[quantity]\n const descFinal = description || def?.description || ''\n const labelFinal = label || def?.label\n\n // Component for enabling/disabling autorange\n const actions = setAutorange(value)}\n />\n\n return
\n \n \n
\n})\n\nInputRange.propTypes = {\n label: PropTypes.string,\n quantity: PropTypes.string.isRequired,\n description: PropTypes.string,\n nSteps: PropTypes.number,\n nBins: PropTypes.number,\n visible: PropTypes.bool,\n initialScale: PropTypes.string,\n disableHistogram: PropTypes.bool,\n initialAutorange: PropTypes.bool,\n aggId: PropTypes.string,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nInputRange.defaultProps = {\n nSteps: 20,\n nBins: 30,\n aggId: 'default',\n 'data-testid': 'inputrange'\n}\n\nexport default InputRange\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputPeriodicTable from '../input/InputPeriodicTable'\nimport InputField from '../input/InputField'\nimport InputRange from '../input/InputRange'\n\nconst useStyles = makeStyles(theme => ({\n grid: {\n marginTop: theme.spacing(2)\n },\n periodicTable: {\n height: '30rem'\n }\n}))\n\nconst FilterSubMenuElements = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n const styles = useStyles()\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuElements.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuElements\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\n\nconst FilterSubMenuStructure = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuStructure.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuStructure\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\n\nconst FilterSubMenuMethod = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuMethod.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuMethod\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport InputRange from '../input/InputRange'\n\nconst FilterSubMenuPrecision = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuPrecision.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuPrecision\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport InputRange from '../input/InputRange'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\n\nconst FilterSubMenuDFT = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuDFT.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuDFT\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\n\nconst FilterSubMenuTB = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}>\n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuTB.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuTB\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\n\nconst FilterSubMenuGW = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}>\n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuGW.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuGW\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\n\nconst FilterSubMenuBSE = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuBSE.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuBSE\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport InputRange from '../input/InputRange'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\n\nconst FilterSubMenuDMFT = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuDMFT.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuDMFT\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport InputRange from '../input/InputRange'\nimport InputSection from '../input/InputSection'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\n\nconst FilterSubMenuEELS = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}>\n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuEELS.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuEELS\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputSection from '../input/InputSection'\nimport InputRange from '../input/InputRange'\nimport InputField from '../input/InputField'\n\nconst FilterSubMenuElectronic = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuElectronic.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuElectronic\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputRange from '../input/InputRange'\nimport InputField from '../input/InputField'\n\nconst FilterSubMenuSolarCell = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuSolarCell.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuSolarCell\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputSection from '../input/InputSection'\nimport InputRange from '../input/InputRange'\nimport InputField from '../input/InputField'\n\nconst FilterSubMenuCatalyst = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuCatalyst.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuCatalyst\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\n\nconst FilterSubMenuElectronic = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n})\nFilterSubMenuElectronic.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuElectronic\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport InputRange from '../input/InputRange'\nimport InputField from '../input/InputField'\nimport InputSection from '../input/InputSection'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\n\nconst FilterSubMenuMechanical = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuMechanical.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuMechanical\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport InputRange from '../input/InputRange'\nimport InputField from '../input/InputField'\nimport InputSection from '../input/InputSection'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\n\nconst FilterSubMenuMolecularDynamics = React.memo(({\n id,\n ...rest\n}) => {\n const {selected} = useContext(filterMenuContext)\n const visible = id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuMolecularDynamics.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuMolecularDynamics\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\n\nconst FilterSubMenuELN = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuELN.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuELN\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport InputField from '../input/InputField'\nimport InputRange from '../input/InputRange'\n\nconst FilterSubMenuAuthor = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuAuthor.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuAuthor\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback } from 'react'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { isNil } from 'lodash'\nimport InputHeader from './InputHeader'\nimport InputItem from './InputItem'\nimport { useSearchContext, getValue } from '../SearchContext'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'center',\n flexDirection: 'column',\n boxSizing: 'border-box'\n }\n}))\nconst InputRadio = React.memo(({\n quantity,\n label,\n description,\n initialValue,\n options,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const { filterData, useFilterState, useFilterLocked } = useSearchContext()\n const styles = useStyles({classes: classes, theme: theme})\n const [filter, setFilter] = useFilterState(quantity)\n const filterLocked = useFilterLocked(quantity)\n\n // Determine the description and units\n const def = filterData[quantity]\n const locked = !isNil(filterLocked) && filterData[quantity].global\n const descFinal = description || def?.description || ''\n const labelFinal = label || def?.label\n const val = getValue(def, filter, filterLocked, initialValue)\n\n const handleChange = useCallback((event, key, selected) => {\n setFilter(key)\n }, [setFilter])\n\n return
\n \n {options && Object.entries(options).map(([key, value]) =>\n \n )}\n
\n})\n\nInputRadio.propTypes = {\n quantity: PropTypes.string.isRequired,\n label: PropTypes.string,\n description: PropTypes.string,\n initialValue: PropTypes.string,\n options: PropTypes.object, // Mapping from option name to show label and tooltip\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nexport default InputRadio\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useEffect, useMemo, useState, useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport { Box, Collapse, makeStyles } from '@material-ui/core'\nimport { SectionMDef, SubSectionMDef, useGlobalMetainfo } from '../../archive/metainfo'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight'\nimport { useSearchContext } from '../SearchContext'\nimport InputItem from '../input/InputItem'\nimport { InputTextQuantity } from '../input/InputText'\nimport { useErrors } from '../../errors'\nimport { useDataStore } from '../../DataStore'\nimport InputField from '../input/InputField'\nimport InputRadio from '../input/InputRadio'\nimport { useApi } from '../../api'\nimport InputHeader from '../input/InputHeader'\n\nconst filterProperties = def => !(def.name.startsWith('x_') || def.virtual)\n\nconst useDefinitionStyles = makeStyles(theme => ({\n root: {},\n item: {\n '&:hover': {\n backgroundColor: theme.palette.grey[100]\n },\n cursor: 'pointer',\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n flexWrap: 'nowrap',\n paddingRight: theme.spacing(1),\n boxSizing: 'border-box'\n },\n icon: {\n },\n name: {\n flexGrow: 1\n },\n actions: {\n marginLeft: theme.spacing(1)\n },\n children: {\n marginLeft: theme.spacing(3)\n }\n}))\n\nconst Definition = React.memo(function Definition({node, name, path, className}) {\n const classes = useDefinitionStyles()\n const [open, setOpen] = useState(!path)\n const { useFilterState } = useSearchContext()\n const [filter, setFilter] = useFilterState('quantities')\n\n const handleSelect = useCallback((event) => {\n event.stopPropagation()\n setFilter(old => {\n let newValues\n if (old) {\n const isSelected = old?.has(path)\n isSelected ? old.delete(path) : old.add(path)\n newValues = new Set(old)\n } else {\n newValues = new Set([path])\n }\n return newValues\n })\n }, [path, setFilter])\n\n const handleToggle = useCallback(event => {\n event.stopPropagation()\n setOpen(open => !open)\n }, [setOpen])\n\n const children = Object.keys(node)\n const hasChildren = children.length > 0\n\n const icon = useMemo(() => {\n const iconProps = {\n className: classes.icon,\n fontSize: 'small'\n }\n return hasChildren\n ? (open ? : )\n :
\n }, [hasChildren, open, classes.icon])\n\n const childPathPrefix = path + '.'\n const indeterminate = useMemo(() => {\n if (!filter) {\n return false\n }\n return hasChildren && Array.from(filter).find(fullPath => fullPath.startsWith(childPathPrefix)) !== undefined\n }, [filter, hasChildren, childPathPrefix])\n\n return
\n
\n {icon}\n \n
\n {hasChildren && (\n \n {open && children.map((name, index) => (\n \n ))}\n \n )}\n
\n})\nDefinition.propTypes = {\n node: PropTypes.object.isRequired,\n name: PropTypes.string,\n path: PropTypes.string,\n className: PropTypes.string\n}\n\nconst FilterSubMenuMetadata = React.memo(({\n id,\n ...rest\n}) => {\n const {api} = useApi()\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n const authenticated = api?.keycloak?.authenticated\n const dataStore = useDataStore()\n const globalMetainfo = useGlobalMetainfo()\n const [[options, tree], setOptions] = useState([[], {}])\n const {raiseError} = useErrors()\n useEffect(() => {\n if (!globalMetainfo || !visible) {\n return\n }\n const root = globalMetainfo.getEntryArchiveDefinition()\n const subSections = root?.sub_sections\n const tree = {}\n if (!subSections) {\n return []\n }\n const options = []\n const defsSet = new Set()\n function addDef(def, prefix, node) {\n const fullName = prefix ? `${prefix}.${def.name}` : def.name\n node[def.name] = node[def.name] || {}\n node = node[def.name]\n if (defsSet.has(def)) {\n return\n }\n defsSet.add(def)\n options.push({value: fullName})\n if (def.m_def === SubSectionMDef && def.sub_section) {\n def = def.sub_section\n }\n if (def.m_def === SectionMDef) {\n def._allProperties.filter(filterProperties).forEach(def => addDef(def, fullName, node))\n dataStore.getAllInheritingSections(def).forEach(def => {\n def._allProperties.filter(filterProperties).forEach(def => addDef(def, fullName, node))\n })\n }\n }\n subSections.forEach(def => addDef(def, null, tree))\n setOptions([options, tree])\n }, [raiseError, dataStore, globalMetainfo, setOptions, visible])\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {Object.keys(tree).map((name, index) => (\n \n ))}\n \n \n \n})\nFilterSubMenuMetadata.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuMetadata\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport { Box, TextField } from \"@material-ui/core\"\nimport { useSearchContext } from \"../SearchContext\"\nimport AutoComplete from \"@material-ui/lab/Autocomplete\"\nimport { useApi } from '../../api'\nimport { debounce, isArray, isEmpty } from 'lodash'\nimport { searchQuantities } from '../../../config'\n\n// List of optimade identifiers. We get these from the metainfo.\nconst prefix = 'optimade.'\nconst identifiers = Object.keys(searchQuantities)\n .filter(key => key.startsWith(prefix))\n .map(key => key.slice(prefix.length))\n .sort()\n\nconst FilterSubMenuOptimade = React.memo(({\n id,\n ...rest\n}) => {\n const [suggestions, setSuggestions] = useState([['']])\n const [values, setValues] = useState([{value: '', valid: true, msg: ''}])\n const {selected, open} = useContext(filterMenuContext)\n const {useFilterState} = useSearchContext()\n const {api} = useApi()\n const visible = open && id === selected\n const [optimadeFilters, setOptimadeFilters] = useFilterState(\"optimade_filter\")\n\n const renderSuggestion = useCallback((command, options, suggestions) => {\n options.filter((item, pos) => options.indexOf(item) === pos).forEach(option => {\n if (option === 'IDENTIFIER') {\n identifiers.forEach(identifier => {\n suggestions.push([command, identifier].join(' '))\n })\n } else if (['OPERATOR', 'ESCAPED_STRING', 'SIGNED_FLOAT', 'SIGNED_INT'].includes(option)) {\n suggestions.push(command.concat(' <', option, '>'))\n } else {\n suggestions.push([command, option].join(' '))\n }\n })\n }, [])\n\n const getSuggestions = useCallback(async (filter, index) => {\n const requestBody = {\n exclude: ['atoms', 'only_atoms', 'files', 'quantities', 'dft.quantities', 'optimade', 'dft.labels', 'dft.geometries'],\n verify_only: true,\n owner: 'public',\n query: {\n optimade_filter: filter\n }\n }\n try {\n await api.post(`entries/query`, requestBody)\n setValues(oldValues => {\n const newValues = [...oldValues]\n newValues[index] = {value: oldValues[index].value, valid: true, msg: ''}\n return newValues\n })\n return {valid: true, suggestions: []}\n } catch (error) {\n if (isArray(error?.apiMessage)) {\n const suggestions = []\n error?.apiMessage.forEach((err) => {\n const errorLocations = err?.loc\n errorLocations.forEach(location => {\n if (location?.[0] === 'optimade_filter') {\n let errorIndex = Number(err.msg.match(/col \\d+/i)?.[0].match(/\\d+/)?.[0]) - 1\n if (err.msg.match(/Unexpected end-of-input/i)) {\n errorIndex = filter.length\n }\n const commands = identifiers.filter(identifier => identifier.startsWith(filter))\n if (commands.length > 0) {\n commands.forEach(command => suggestions.push(command))\n }\n const options = Array.from(err.msg.matchAll(/\\t\\* \\w+\\n/g), m => m[0].slice(3, -1))\n const command = filter.slice(0, errorIndex).trim()\n renderSuggestion(command, options, suggestions)\n const semanticError = err.msg.match(/Semantic error.*\\n\\n(.*)/i)\n if (semanticError) {\n setValues(oldValues => {\n const newValues = [...oldValues]\n newValues[index] = {value: oldValues[index].value, valid: oldValues[index].valid, msg: semanticError?.[1]}\n return newValues\n })\n }\n }\n })\n })\n return {valid: false, suggestions: suggestions}\n }\n return {valid: false, suggestions: []}\n }\n }, [api, renderSuggestion])\n\n useEffect(() => {\n if (!visible || isEmpty(optimadeFilters)) return\n const newOptimadeFilters = optimadeFilters ? [...optimadeFilters, ''] : ['']\n const newValues = newOptimadeFilters.map(value => ({value: value, valid: !!value, msg: ''}))\n setValues(newValues)\n const prepareOptions = async () => {\n const allSuggestions = await Promise.all(newOptimadeFilters.map(async (optimadeFilter, index) => {\n const command = optimadeFilter && optimadeFilter.trim()\n const validation = await getSuggestions(command || '.', index)\n return [optimadeFilter].concat(validation.suggestions)\n }))\n setSuggestions(allSuggestions)\n }\n prepareOptions()\n }, [optimadeFilters, getSuggestions, visible])\n\n const validate = useCallback(async (value, index) => {\n const validation = await getSuggestions((value && value.trim()) || '.', index)\n setSuggestions(suggestions => {\n const newSuggestions = [...suggestions]\n newSuggestions[index] = [value].concat(validation.suggestions)\n return newSuggestions\n })\n return validation\n }, [getSuggestions])\n\n const debouncedPrepareSuggestions = useMemo(() => (\n debounce(validate, 500)\n ), [validate])\n\n const setFilter = useCallback((value, index) => {\n setValues(oldValue => {\n const newValues = [...oldValue]\n if (!value) {\n index !== newValues.length - 1 && newValues.splice(index, 1)\n } else {\n newValues[index] = {value: value, valid: false, msg: ''}\n }\n return newValues\n })\n const newSuggestions = [...suggestions]\n if (!value) {\n index !== newSuggestions.length - 1 && newSuggestions.splice(index, 1)\n } else {\n newSuggestions[index] = [value]\n }\n setSuggestions(newSuggestions)\n }, [suggestions])\n\n const handleInputChange = useCallback((value, index) => {\n setFilter(value, index)\n debouncedPrepareSuggestions(value, index)\n }, [debouncedPrepareSuggestions, setFilter])\n\n const setOptimadeFilter = useCallback((index, value, valid = false) => {\n const newFilters = [...values].filter(value => !!value.value)\n if (newFilters.length === 0 || (!newFilters.every(value => !!value.valid) && !valid)) return\n const newOptimadeFilters = [...newFilters].map(value => value.value)\n if (!value) {\n newOptimadeFilters.splice(index, 1)\n } else {\n newOptimadeFilters[index] = value\n }\n setOptimadeFilters(new Set(newOptimadeFilters))\n }, [setOptimadeFilters, values])\n\n const handleChange = useCallback(async (event, value, index) => {\n if (values[index].value !== value) {\n setFilter(value, index)\n if (!values[index].value) return\n }\n if (!values[index].valid) {\n const validation = await validate(value, index)\n if (!validation.valid) return\n setOptimadeFilter(index, value, true)\n } else {\n setOptimadeFilter(index, value)\n }\n }, [setFilter, setOptimadeFilter, validate, values])\n\n return \n {visible && values && values.length === suggestions.length && values.map((value, index) => {\n return \n handleChange(event, value, index)}\n onKeyDown={(event) => (event.key === 'Enter' && handleChange(event, value.value, index))}\n value={value.value}\n getOptionSelected={(option, value) => option === value}\n getOptionLabel={option => (option && String(option)) || ''}\n renderInput={params => (\n handleInputChange(event.target.value, index)}\n error={!!value.msg}\n helperText={!!value.msg && value.msg}\n />\n )}\n />\n \n })}\n \n})\nFilterSubMenuOptimade.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuOptimade\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport InputRange from '../input/InputRange'\nimport InputSection from '../input/InputSection'\nimport { InputCheckboxValue } from '../input/InputCheckbox'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\n\nconst FilterSubMenuGeometryOptimization = React.memo(({\n id,\n ...rest\n}) => {\n const {selected, open} = useContext(filterMenuContext)\n const visible = open && id === selected\n\n return }\n {...rest}>\n \n \n \n \n \n \n \n \n \n \n})\nFilterSubMenuGeometryOptimization.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuGeometryOptimization\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { isNil } from 'lodash'\nimport { FilterSubMenu, filterMenuContext } from './FilterMenu'\nimport {\n Box,\n Button,\n FormControl,\n InputLabel,\n LinearProgress,\n MenuItem,\n Select,\n Typography\n} from '@material-ui/core'\nimport { InputGrid, InputGridItem } from '../input/InputGrid'\nimport { useApi } from '../../api'\nimport { useErrors } from '../../errors'\nimport { useSearchContext } from '../SearchContext'\nimport { useGlobalMetainfo } from '../../archive/metainfo'\nimport { NumberEditQuantity } from '../../editQuantity/NumberEditQuantity'\nimport { StringEditQuantity } from '../../editQuantity/StringEditQuantity'\nimport { EnumEditQuantity } from '../../editQuantity/EnumEditQuantity'\nimport { DateTimeEditQuantity, DateEditQuantity } from '../../editQuantity/DateTimeEditQuantity'\nimport { editQuantityComponents } from '../../editQuantity/EditQuantity'\nimport { InputMetainfoControlled } from '../../search/input/InputMetainfo'\nimport { DType, getDatatype, rsplit, parseQuantityName } from '../../../utils'\nimport { InputTextField } from '../input/InputText'\n\nconst types = {\n [DType.Int]: 'Integer',\n [DType.Float]: 'Float',\n [DType.Timestamp]: 'Datetime',\n [DType.String]: 'String',\n [DType.Enum]: 'Enum'\n}\n\nconst operators = {\n 'search': '=',\n 'lt': '<',\n 'lte': '<=',\n 'gte': '=>',\n 'gt': '>'\n}\n\nconst typeOperators = {\n [DType.Int]: Object.keys(operators),\n [DType.Float]: Object.keys(operators),\n [DType.Timestamp]: Object.keys(operators),\n [DType.String]: ['search'],\n [DType.Enum]: ['search'],\n [DType.Boolean]: ['search']\n}\n\nconst valueKeys = {\n [DType.Int]: 'int_value',\n [DType.Float]: 'float_value',\n [DType.Timestamp]: 'datetime_value',\n [DType.String]: 'str_value',\n [DType.Enum]: 'str_value',\n [DType.Boolean]: 'bool_value'\n}\n\nconst componentMap = {\n [DType.Int]: NumberEditQuantity,\n [DType.Float]: NumberEditQuantity,\n [DType.Timestamp]: DateEditQuantity,\n [DType.String]: StringEditQuantity,\n [DType.Enum]: EnumEditQuantity,\n [DType.Boolean]: StringEditQuantity\n}\n\nconst getValueKey = (quantityDef) => {\n const dtype = getDatatype(quantityDef)\n const result = valueKeys[dtype]\n\n if (!result) {\n throw Error('Unsupported quantity type')\n }\n return result\n}\n\nconst getOperators = (quantityDef) => {\n const dtype = getDatatype(quantityDef)\n const result = typeOperators[dtype]\n if (!result) {\n throw Error('Unsupported quantity type')\n }\n return result\n}\n\nconst EditQuantity = React.memo(({quantityDef, value, onChange}) => {\n const [component, componentProps] = useMemo(() => {\n const elnAnnotation = quantityDef.m_annotations?.eln[0] || {}\n let {component, props, ...otherProps} = elnAnnotation\n component = component && editQuantityComponents[component]\n const usesCompatibleComponent = [StringEditQuantity, EnumEditQuantity, NumberEditQuantity, DateTimeEditQuantity].indexOf(component) !== -1\n\n if (!(component && usesCompatibleComponent)) {\n const type = getDatatype(quantityDef)\n // fall back on StringEditQuantity if type ends up being unknown\n component = type === DType.Unknown ? StringEditQuantity : componentMap[type]\n props = {}\n otherProps = {}\n }\n\n return [component, {\n ...props,\n ...otherProps,\n label: 'value',\n quantityDef: quantityDef\n }]\n }, [quantityDef])\n\n return React.createElement(\n component, {\n ...componentProps,\n value: value,\n onChange: onChange\n })\n})\nEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.any,\n onChange: PropTypes.func.isRequired\n}\n\nconst QuantityFilter = React.memo(({quantities, filter, onChange}) => {\n const {id, value} = filter\n const operator = filter.operator || 'search'\n const quantityDef = useMemo(() => {\n return quantities.find(q => q.id === id)?._quantityDef\n }, [id, quantities])\n\n const options = useMemo(() => {\n return Object.fromEntries(quantities.map(quantity => {\n const {path, schema} = parseQuantityName(quantity.id)\n return [\n quantity.id, {\n key: quantity.id,\n primary: path,\n schema: schema,\n description: quantity?._quantityDef?.description,\n dtype: getDatatype(quantity?._quantityDef)\n }\n ]\n }\n ))\n }, [quantities])\n\n const handleValueChange = useCallback((value) => {\n onChange({\n operator: 'search',\n ...filter,\n value: value\n })\n }, [filter, onChange])\n\n const handleIdChange = useCallback((value) => {\n onChange({\n operator: 'search',\n id: value\n })\n }, [onChange])\n\n const handleOperatorChange = useCallback((e) => {\n onChange({\n ...filter,\n operator: e.target.value\n })\n }, [filter, onChange])\n\n const availableOperators = quantityDef ? getOperators(quantityDef) : ['search']\n\n return (\n \n \n error && handleIdChange(\"\")}\n optional\n />\n \n \n \n op\n {operators[value]}}\n >\n {availableOperators.map((operator, index) => (\n {operators[operator]}\n ))}\n \n \n \n \n {\n quantityDef ? (\n \n ) : (\n handleValueChange(e.target.value)}\n />\n )\n }\n \n \n )\n})\nQuantityFilter.propTypes = {\n quantities: PropTypes.arrayOf(PropTypes.object).isRequired,\n filter: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired\n}\n\nconst FilterSubMenuCustomQuantities = React.memo(({\n id,\n ...rest\n}) => {\n const metainfo = useGlobalMetainfo()\n const {selected, open} = useContext(filterMenuContext)\n const {useFilterState} = useSearchContext()\n const [loaded, setLoaded] = useState(false)\n const visible = open && id === selected\n const {api} = useApi()\n const {raiseError} = useErrors()\n const [query, setQuery] = useFilterState('custom_quantities')\n const [quantities, setQuantities] = useState(null)\n\n const [andFilters, setAndFilters] = useState([{}])\n\n useEffect(() => {\n if (!metainfo || loaded || !visible) {\n return\n }\n const retrieve = async () => {\n const response = await api.post('entries/query', {\n 'owner': 'visible',\n 'query': {\n 'quantities:any': ['data', 'nexus']\n },\n 'pagination': {\n 'page_size': 0\n },\n 'aggregations': {\n 'paths': {\n 'terms': {\n 'quantity': 'search_quantities.id',\n 'size': 1000,\n 'entries': {\n 'size': 1,\n 'required': {\n 'include': [\n 'search_quantities.id',\n 'search_quantities.definition'\n ]\n }\n }\n }\n }\n }\n }, {\n noLoading: true\n })\n const quantities = []\n for (const path of response.aggregations.paths.terms.data) {\n const searchableQuantity = path.entries[0].search_quantities\n const [section_path, quantity_path] = rsplit(searchableQuantity.definition, '.', 1)\n\n // The definition may not exist in the installation if e.g. the\n // definition is removed, or access rights to YAML files are changed.\n // In this case the value is not shown.\n let quantityDef\n try {\n const sectionDef = await metainfo.resolveDefinition(section_path, false)\n quantityDef = sectionDef?._properties?.[quantity_path]\n } catch (error) {\n }\n if (!quantityDef) continue\n\n const type = getDatatype(quantityDef)\n let description = types[type] || 'unknown type'\n if (quantityDef.unit) {\n description += ` in ${quantityDef.unit}`\n }\n quantities.push({\n ...searchableQuantity,\n _quantityDef: quantityDef,\n _description: description\n })\n }\n setQuantities(quantities)\n setLoaded(true)\n }\n retrieve().catch(raiseError)\n }, [loaded, visible, api, raiseError, setQuantities, metainfo])\n\n const handleFilterChange = useCallback((filter, index) => {\n setAndFilters(filters => {\n const newFilters = [...filters]\n newFilters[index] = filter\n return newFilters\n })\n }, [setAndFilters])\n\n const handleAndClicked = useCallback(() => {\n setAndFilters(filters => [...filters, {}])\n }, [setAndFilters])\n\n const handleClearClicked = useCallback(() => {\n setAndFilters([{}])\n setQuery([])\n }, [setAndFilters, setQuery])\n\n const searchEnabled = useMemo(() => {\n return andFilters.every(f => f.id && !isNil(f.value))\n }, [andFilters])\n\n const handleSearchClicked = useCallback(() => {\n const query = {\n and: andFilters.map(filter => {\n const {id, value, operator} = filter\n const quantityDef = id && quantities.find(q => q.id === id)._quantityDef\n const valueKey = getValueKey(quantityDef)\n const valueKeyWithOperator = operator === 'search' ? valueKey : `${valueKey}:${operator}`\n return {\n search_quantities: {\n id: id,\n [valueKeyWithOperator]: value\n }\n }\n })\n }\n setQuery(query)\n }, [andFilters, setQuery, quantities])\n\n useEffect(() => {\n const andFilters = query?.and?.map(filter => {\n const searchQuantity = filter.search_quantities\n const valueKey = Object.keys(searchQuantity)[1]\n const valueKeyWithOperator = valueKey.split(':')\n const operator = valueKeyWithOperator.length === 2 ? valueKeyWithOperator[1] : 'search'\n return {\n id: searchQuantity.id,\n value: searchQuantity[Object.keys(searchQuantity)[1]],\n operator: operator\n }\n })\n setAndFilters(andFilters || [{}])\n }, [query, setAndFilters])\n\n if (!quantities) {\n return (\n \n \n \n \n \n \n \n )\n }\n\n if (quantities.length === 0) {\n return (\n \n \n \n \n Could not find valid quantities to search for. Make sure that you have access to the data and that the metainfo associated with the quantities can be loaded correctly.\n \n \n \n \n )\n }\n\n return \n \n \n \n {andFilters.map((filter, index) => (\n \n handleFilterChange(filter, index)}\n />\n \n ))}\n \n And\n \n Clear\n \n \n \n \n \n \n Update search\n \n \n \n \n})\nFilterSubMenuCustomQuantities.propTypes = {\n id: PropTypes.string\n}\n\nexport default FilterSubMenuCustomQuantities\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Alert } from '@material-ui/lab'\nimport { has } from 'lodash'\nimport {\n FilterMenu,\n FilterMenuItem,\n FilterMenuItems,\n FilterSubMenus\n} from './FilterMenu'\nimport { makeStyles } from '@material-ui/core/styles'\nimport FilterSubMenuElements from './FilterSubMenuElements'\nimport FilterSubMenuStructure from './FilterSubMenuStructure'\nimport FilterSubMenuMethod from './FilterSubMenuMethod'\nimport FilterSubMenuPrecision from './FilterSubMenuPrecision'\nimport FilterSubMenuDFT from './FilterSubMenuDFT'\nimport FilterSubMenuTB from './FilterSubMenuTB'\nimport FilterSubMenuGW from './FilterSubMenuGW'\nimport FilterSubMenuBSE from './FilterSubMenuBSE'\nimport FilterSubMenuDMFT from './FilterSubMenuDMFT'\nimport FilterSubMenuEELS from './FilterSubMenuEELS'\nimport FilterSubMenuElectronic from './FilterSubMenuElectronic'\nimport FilterSubMenuSolarCell from './FilterSubMenuSolarCell'\nimport FilterSubMenuCatalyst from './FilterSubMenuCatalystProperties'\nimport FilterSubMenuVibrational from './FilterSubMenuVibrational'\nimport FilterSubMenuMechanical from './FilterSubMenuMechanical'\nimport FilterSubMenuMolecularDynamics from './FilterSubMenuMolecularDynamics'\nimport FilterSubMenuELN from './FilterSubMenuELN'\nimport FilterSubMenuAuthor from './FilterSubMenuAuthor'\nimport FilterSubMenuMetadata from './FilterSubMenuMetadata'\nimport FilterSubMenuOptimade from './FilterSubMenuOptimade'\nimport { useSearchContext } from '../SearchContext'\nimport { delay } from '../../../utils'\nimport FilterSubMenuGeometryOptimization from './FilterSubMenuGeometryOptimization'\nimport InputCheckbox from '../input/InputCheckbox'\nimport FilterSubMenuCustomQuantities from './FilterSubMenuCustomQuantities'\n\nexport const menuMap = {\n elements: FilterSubMenuElements,\n structure: FilterSubMenuStructure,\n method: FilterSubMenuMethod,\n precision: FilterSubMenuPrecision,\n dft: FilterSubMenuDFT,\n tb: FilterSubMenuTB,\n gw: FilterSubMenuGW,\n bse: FilterSubMenuBSE,\n dmft: FilterSubMenuDMFT,\n eels: FilterSubMenuEELS,\n electronic: FilterSubMenuElectronic,\n solarcell: FilterSubMenuSolarCell,\n heterogeneouscatalyst: FilterSubMenuCatalyst,\n vibrational: FilterSubMenuVibrational,\n mechanical: FilterSubMenuMechanical,\n molecular_dynamics: FilterSubMenuMolecularDynamics,\n geometry_optimization: FilterSubMenuGeometryOptimization,\n eln: FilterSubMenuELN,\n custom_quantities: FilterSubMenuCustomQuantities,\n author: FilterSubMenuAuthor,\n metadata: FilterSubMenuMetadata,\n optimade: FilterSubMenuOptimade\n}\n\nconst useFilterMainMenuStyles = makeStyles(theme => ({\n combine: {\n }\n}))\n\n/**\n * Swipable menu that shows the available filters on the left side of the\n * screen.\n */\nconst FilterMainMenu = React.memo(({\n open,\n onOpenChange,\n collapsed,\n onCollapsedChange\n}) => {\n const [value, setValue] = React.useState()\n const {filterMenus} = useSearchContext()\n const [loaded, setLoaded] = useState(false)\n const styles = useFilterMainMenuStyles()\n\n // Rendering the submenus is delayed on the event queue: this makes loading\n // the search page more responsive by first loading everything else.\n useEffect(() => {\n delay(() => { setLoaded(true) })\n }, [])\n\n // The shown menu items\n const menuItems = useMemo(() => {\n return filterMenus?.options\n ? Object.values(filterMenus.options).map(option => {\n return {\n const content = action.type === 'checkbox'\n ? \n : null\n return content\n })}\n />\n })\n : \n No search menus defined within this search context. Ensure that all GUI artifacts are created.\n \n }, [filterMenus, styles])\n\n // The shown submenus\n const subMenus = useMemo(() => {\n return filterMenus?.options\n ? Object.values(filterMenus.options)\n .filter(option => menuMap[option.key])\n .map(option => {\n const Comp = menuMap[option.key]\n return \n })\n : null\n }, [filterMenus])\n\n return \n \n {menuItems}\n \n \n {loaded && subMenus}\n \n \n})\nFilterMainMenu.propTypes = {\n open: PropTypes.bool,\n onOpenChange: PropTypes.func,\n collapsed: PropTypes.bool,\n onCollapsedChange: PropTypes.func\n}\n\nexport default FilterMainMenu\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo } from 'react'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { isNil, isEmpty, isPlainObject } from 'lodash'\nimport { useSearchContext } from './SearchContext'\nimport { useUnitContext } from '../units/UnitContext'\nimport { Typography, Box, Chip, Tooltip } from '@material-ui/core'\nimport FilterTitle from './FilterTitle'\nimport Ellipsis from '../visualization/Ellipsis'\nimport ClearIcon from '@material-ui/icons/Clear'\nimport ReplayIcon from '@material-ui/icons/Replay'\nimport LockIcon from '@material-ui/icons/Lock'\nimport CodeIcon from '@material-ui/icons/Code'\nimport { Actions, Action } from '../Actions'\nimport { SourceApiCall, SourceApiDialogButton, SourceDialogDivider, SourceJsonCode } from '../buttons/SourceDialogButton'\n\n/**\n * Thin wrapper for MUI Chip that is used for displaying (and possibly removing)\n * query values.\n */\nconst useQueryChipStyles = makeStyles(theme => ({\n root: {\n maxWidth: '100%'\n },\n chipRoot: {\n width: '100%',\n maxWidth: '100%'\n },\n chipLabel: {\n minWidth: '1rem',\n maxWidth: '25rem'\n }\n}))\nexport const QueryChip = React.memo(({\n label,\n onDelete,\n color,\n className,\n locked\n}) => {\n const styles = useQueryChipStyles()\n\n return
\n {label}}\n onDelete={locked ? undefined : onDelete}\n color={locked ? undefined : color}\n icon={locked ? : undefined}\n classes={{root: styles.chipRoot, label: styles.chipLabel}}\n />\n
\n})\n\nQueryChip.propTypes = {\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onDelete: PropTypes.func,\n color: PropTypes.string,\n className: PropTypes.string,\n locked: PropTypes.bool\n}\nQueryChip.defaultProps = {\n color: 'primary'\n}\n\n/**\n * Used to group several related query chips inside one container.\n */\nexport const queryTitleHeight = 2.2\nexport const queryGroupHeight = 4.1 + queryTitleHeight\nexport const queryGroupSpacing = 0.5\nconst useQueryChipGroupStyles = makeStyles(theme => ({\n root: {\n position: 'relative',\n minHeight: theme.spacing(queryGroupHeight),\n marginLeft: theme.spacing(queryGroupSpacing),\n marginRight: theme.spacing(queryGroupSpacing)\n },\n chips: {\n marginTop: theme.spacing(queryTitleHeight),\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.palette.primary.main,\n borderRadius: theme.spacing(2)\n },\n titleRoot: {\n position: 'absolute',\n left: theme.spacing(0.4),\n right: 0,\n top: 0,\n height: theme.spacing(queryTitleHeight)\n },\n title: {\n color: theme.palette.grey[600]\n }\n}))\nexport const QueryChipGroup = React.memo(({\n quantity,\n className,\n children\n}) => {\n const styles = useQueryChipGroupStyles()\n return
\n \n
\n {children}\n
\n
\n})\n\nQueryChipGroup.propTypes = {\n quantity: PropTypes.string,\n color: PropTypes.string,\n className: PropTypes.string,\n children: PropTypes.node\n}\nQueryChipGroup.defaultProps = {\n color: 'primary'\n}\n\n/**\n * Operators between query chips.\n */\nconst useQueryOpStyles = makeStyles(theme => ({\n root: {\n cursor: 'default'\n },\n inside: {\n fontSize: '0.6rem',\n marginLeft: theme.spacing(0.2),\n marginRight: theme.spacing(0),\n color: 'white'\n },\n outside: {\n fontSize: '1.5rem',\n marginLeft: theme.spacing(0.1),\n marginRight: theme.spacing(0.1),\n marginBottom: theme.spacing(-0.4)\n }\n}))\nexport const QueryOp = React.memo(({className, children, tooltip, variant}) => {\n const styles = useQueryOpStyles()\n return \n {children}\n \n \n})\n\nQueryOp.propTypes = {\n className: PropTypes.string,\n tooltip: PropTypes.string,\n children: PropTypes.node,\n variant: PropTypes.string\n}\nQueryOp.defaultProps = {\n variant: 'inside'\n}\n\nexport const QueryAnd = React.memo(() => {\n return AND\n})\nexport const QueryOr = React.memo(() => {\n return OR\n})\nexport const QueryCurlyBracketLeft = React.memo((props) => {\n return {'{'}\n})\nexport const QueryCurlyBracketRight = React.memo((props) => {\n return {'}'}\n})\n\n// Custom function for chip creation\nconst createChips = (name, filterValue, onDelete, filterData, units) => {\n if (isNil(filterValue)) return []\n\n const { serializerPretty: serializer, customSerialization, queryMode } = filterData[name]\n const isArray = Array.isArray(filterValue)\n const isSet = filterValue instanceof Set\n const isObj = isPlainObject(filterValue)\n const op = queryMode === \"any\" ? : \n const chips = []\n\n const createChip = (label, onDelete, single = false) => (\n \n )\n\n if (customSerialization) {\n chips.push({ comp: createChip(serializer(filterValue), () => onDelete(undefined)), op })\n } else if (isArray || isSet) {\n Array.from(filterValue).forEach((value, index) => {\n chips.push({\n comp: createChip(serializer(value, units), () => {\n const newValue = isSet ? new Set(filterValue) : [...filterValue]\n isSet ? newValue.delete(value) : newValue.splice(index, 1)\n onDelete(newValue)\n }),\n op\n })\n })\n } else if (isObj) {\n const createRangeChip = (label, comparison) => {\n const content = `${comparison} ${serializer(filterValue[label], units)}`\n if (!isNil(filterValue[label])) {\n let newValue = {...filterValue}\n delete newValue[label]\n newValue = isEmpty(newValue) ? undefined : newValue\n chips.push({ comp: createChip(content, () => onDelete(newValue)), op })\n }\n }\n\n createRangeChip('lte', '<=')\n createRangeChip('lt', '<')\n createRangeChip('gte', '>=')\n createRangeChip('gt', '>')\n } else {\n chips.push({ comp: createChip(serializer(filterValue), () => onDelete(undefined)), op })\n }\n\n return chips.length ? (\n \n {chips.map((chip, index) => (\n \n {chip.comp}\n {index < chips.length - 1 && chip.op}\n \n ))}\n \n ) : null\n}\n\n/*\n * Displays chips for the current query.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n boxSizing: 'border-box',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'flex-end',\n marginLeft: theme.spacing(-queryGroupSpacing),\n marginRight: theme.spacing(-queryGroupSpacing)\n },\n empty: {\n marginTop: theme.spacing(1.8)\n },\n chip: {\n padding: theme.spacing(0.5)\n }\n}))\nconst QueryChips = React.memo(({ className, classes }) => {\n const { filterData, useQuery, useUpdateFilter } = useSearchContext()\n const query = useQuery()\n const updateFilter = useUpdateFilter()\n const theme = useTheme()\n const { units } = useUnitContext()\n const styles = useStyles({ classes, theme })\n\n const chips = useMemo(() => {\n const chips = []\n // The query chips are created in alphabetical order\n const keys = Object.keys(query)\n keys.sort()\n for (const quantity of keys) {\n const filterValue = query[quantity]\n // Each key in a section is mapped into a group\n const isSection = filterData[quantity].section\n if (isSection) {\n const addChipsForSection = (data) => {\n const newChips = []\n Object.entries(data).forEach(([key, value], index) => {\n // Empty filters are skipped\n if (isEmpty(value)) return\n const onDelete = (newValue) => {\n const newSection = { ...data, [key]: newValue }\n if (newValue === undefined) delete newSection[key]\n updateFilter([quantity, newSection])\n }\n newChips.push(\n \n {createChips(`${quantity}.${key}`, value, onDelete, filterData, units)}\n \n )\n })\n return newChips\n }\n const newChips = addChipsForSection(filterValue)\n if (newChips.length) {\n chips.push()\n chips.push(newChips)\n chips.push()\n }\n // Regular chips get their own group\n } else {\n const onDelete = (newValue) => updateFilter([quantity, newValue])\n chips.push(createChips(quantity, filterValue, onDelete, filterData, units))\n }\n }\n\n return chips\n }, [query, filterData, units, updateFilter])\n\n return (\n
\n {chips.length\n ? chips\n : Your query will be shown here\n }\n
\n )\n})\n\nQueryChips.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object\n}\n\nconst useQueryStyles = makeStyles(theme => ({\n root: {\n minHeight: theme.spacing(queryGroupHeight),\n margin: theme.spacing(1, 0.25),\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-start'\n },\n offset: {\n height: theme.spacing(queryGroupHeight),\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n width: 'unset'\n }\n}))\n\n/**\n * Displays the current query and actions for it.\n */\nconst Query = React.memo(() => {\n const {useResetFilters, useRefresh, useApiData} = useSearchContext()\n const styles = useQueryStyles()\n const resetFilters = useResetFilters()\n const refresh = useRefresh()\n const apiData = useApiData()\n\n return \n \n \n resetFilters()}\n >\n \n \n refresh()}\n >\n \n \n ,\n buttonProps: {\n size: \"small\"\n }\n }}\n >\n \n NOMAD uses the same query format throughout its API. This is the query\n based on the current filters:\n \n \n \n \n One application of the above query is this API call. This is what is currently\n used to render this page and includes all displayed statistics data\n (aggregations).\n \n \n \n \n \n})\nQuery.propTypes = {}\n\nexport default Query\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useEffect, useMemo, useCallback, forwardRef} from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles, useTheme } from '@material-ui/core'\nimport { hasWebGLSupport } from '../../utils'\nimport * as d3 from 'd3'\nimport FilterTitle from '../search/FilterTitle'\nimport Plot from './Plot'\nimport { useHistory } from 'react-router-dom'\nimport { getUrl } from '../nav/Routes'\n\n/**\n * A Plotly-based interactive scatter plot.\n */\nconst hasWebGL = hasWebGLSupport()\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n height: '100%',\n boxSizing: 'border-box',\n display: 'grid',\n gridTemplateColumns: 'auto 1fr',\n gridTemplateRows: '1fr auto',\n marginBottom: theme.spacing(0.5)\n },\n plot: {\n gridColumn: 2,\n gridRow: 1,\n position: 'relative'\n },\n xaxis: {\n gridColumn: 2,\n gridRow: 2,\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n height: '1rem',\n marginTop: theme.spacing(0.5)\n },\n yaxis: {\n gridColumn: 1,\n gridRow: 1,\n height: '100%',\n marginRight: theme.spacing(0.5),\n width: '1rem',\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center'\n },\n square: {\n gridColumn: 1,\n gridRow: 2\n },\n color: {\n gridColumn: 3,\n gridRow: 1,\n height: '100%',\n marginLeft: theme.spacing(0.5),\n width: '1rem',\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center'\n },\n colorlabel: {\n transform: 'rotate(90deg)'\n }\n}))\nconst PlotScatter = React.memo(forwardRef((\n{\n data,\n title,\n xAxis,\n yAxis,\n colorAxis,\n discrete,\n autorange,\n dragmode,\n onSelected,\n onDeselect,\n onNavigateToEntry,\n 'data-testid': testID\n}, canvas) => {\n const styles = useStyles()\n const theme = useTheme()\n const [finalData, setFinalData] = useState(!data ? data : undefined)\n const history = useHistory()\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n if (!data) {\n setFinalData(data)\n return\n }\n\n const hoverTemplate = (xLabel, yLabel, colorLabel, xUnit, yUnit, colorUnit) => {\n let template = `Click to go to entry page` +\n `
` +\n `${xLabel || ''}: %{x} ${xUnit === 'dimensionless' ? '' : xUnit}
` +\n `${yLabel || ''}: %{y} ${yUnit === 'dimensionless' ? '' : yUnit}
`\n if (colorLabel) {\n template = template +\n `${colorLabel || ''}: %{${discrete ? 'text' : 'text:.3'}} ${colorUnit === 'dimensionless' ? '' : colorUnit}
`\n }\n template = template + ``\n return template\n }\n const scatterType = hasWebGL ? 'scattergl' : 'scatter'\n\n // If dealing with a quantized color, each group is separated into it's own\n // trace which has a legend as well.\n const traces = []\n if (colorAxis?.quantity && discrete) {\n const options = [...new Set(data.color)]\n const nOptions = options.length\n const scale = d3.scaleSequential([0, 1], d3.interpolateTurbo)\n const offset = 0.1\n for (const option of options) {\n const xArray = []\n const yArray = []\n const colorArray = []\n const entryIdArray = []\n for (let i = 0; i < data.color.length; ++i) {\n if (data.color[i] === option) {\n xArray.push(data.x[i])\n yArray.push(data.y[i])\n colorArray.push(data.color[i])\n entryIdArray.push(data.id[i])\n }\n }\n traces.push({\n x: xArray,\n y: yArray,\n entry_id: entryIdArray,\n name: option,\n text: colorArray,\n mode: 'markers',\n type: scatterType,\n textposition: 'top center',\n showlegend: true,\n hovertemplate: hoverTemplate(\n xAxis.title,\n yAxis.title,\n colorAxis.title,\n xAxis.unit,\n yAxis.unit,\n ''\n ),\n marker: {\n size: 8,\n color: scale(offset + (1 - 2 * offset) * options.indexOf(option) / (nOptions - 1)),\n line: {\n color: theme.palette.grey[800],\n width: 1\n }\n }\n })\n }\n // When dealing with a continuous color, display a colormap\n } else if (colorAxis?.quantity && !discrete) {\n traces.push({\n x: data.x,\n y: data.y,\n color: data.color,\n text: data.color,\n entry_id: data.id,\n mode: 'markers',\n type: scatterType,\n textposition: 'top center',\n showlegend: false,\n hoverinfo: \"text\",\n hovertemplate: hoverTemplate(\n xAxis.title,\n yAxis.title,\n colorAxis.title,\n xAxis.unit,\n yAxis.unit,\n colorAxis.unit\n ),\n marker: {\n size: 8,\n color: data.color,\n colorscale: 'YlGnBu',\n line: {\n color: theme.palette.grey[800],\n width: 1\n },\n colorbar: {\n thickness: 20,\n ypad: 0,\n xpad: 5,\n tickfont: {\n family: theme.typography.fontFamily\n }\n }\n }\n })\n // When color is not set, all points are displayed in a single plot with\n // primary theme color.\n } else {\n traces.push({\n x: data.x,\n y: data.y,\n entry_id: data.id,\n mode: 'markers',\n type: scatterType,\n textposition: 'top center',\n showlegend: false,\n hoverinfo: \"text\",\n hovertemplate: hoverTemplate(\n xAxis.title,\n yAxis.title,\n '',\n xAxis.unit,\n yAxis.unit,\n ''\n ),\n marker: {\n size: 8,\n color: theme.palette.secondary.main,\n line: {\n color: theme.palette.grey[800],\n width: 1\n }\n }\n })\n }\n setFinalData(traces)\n }, [colorAxis?.quantity, colorAxis?.title, colorAxis?.unit, data, discrete, theme, xAxis.title, xAxis.unit, yAxis.title, yAxis.unit])\n\n const layout = useMemo(() => {\n return {\n dragmode: dragmode,\n hovermode: 'closest',\n hoverlabel: {\n bgcolor: theme.palette.grey[100],\n bordercolor: theme.palette.grey[100],\n font: {\n color: theme.palette.grey[800],\n family: theme.typography.fontFamily\n }\n },\n showlegend: true,\n legend: {\n x: 1,\n xanchor: 'right',\n y: 1\n },\n xaxis: {\n type: xAxis.scale,\n fixedrange: false,\n autorange: autorange\n },\n yaxis: {\n type: yAxis.scale,\n fixedrange: false,\n autorange: autorange\n },\n margin: {\n l: 8,\n r: 0,\n t: 8,\n b: 24\n }\n }\n // Any further changes to dragmode need to be handled through callbacks in\n // order to do the layout updates correctly. TODO: The plot component should\n // have a consistent way for handling layout changes: they should either\n // happen through a property or through some update function, but not through\n // both. This is a general problem in trying to 'reactify' a non-react library\n // like Plotly.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [autorange, xAxis.scale, yAxis.scale])\n\n // Change dragmode\n useEffect(() => {\n canvas.current?.relayout && canvas.current.relayout((layout) => {\n return {\n ...layout,\n dragmode\n }\n })\n }, [dragmode, canvas])\n\n const handleClick = useCallback(d => {\n const pointIndex = d.points[0].pointIndex\n const entryId = d.points[0].data.entry_id[pointIndex]\n const path = `entry/id/${entryId}`\n onNavigateToEntry()\n history.push(getUrl(path))\n }, [history, onNavigateToEntry])\n\n return
\n
\n \n
\n
\n \n
\n
\n
\n \n
\n {!discrete && colorAxis &&\n
\n \n
\n }\n
\n}))\n\nPlotScatter.propTypes = {\n data: PropTypes.object,\n title: PropTypes.string,\n xAxis: PropTypes.object, // Contains x-axis settings\n yAxis: PropTypes.object, // Contains y-axis settings\n colorAxis: PropTypes.object, // Contains colorbar settings\n discrete: PropTypes.bool,\n autorange: PropTypes.bool,\n dragmode: PropTypes.string,\n onSelected: PropTypes.func,\n onDeselect: PropTypes.func,\n onNavigateToEntry: PropTypes.func,\n 'data-testid': PropTypes.string\n}\n\nPlotScatter.defaultProps = {\n unitX: 'dimensionless',\n unitY: 'dimensionless',\n unitColor: 'dimensionless'\n}\n\nexport default PlotScatter\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport { number, bool } from 'yup'\nimport jmespath from 'jmespath'\nimport { isEmpty, isArray, isEqual, range, isNil, flattenDeep } from 'lodash'\nimport {\n Divider,\n Tooltip,\n makeStyles\n} from '@material-ui/core'\nimport { ToggleButton, ToggleButtonGroup, Alert } from '@material-ui/lab'\nimport { Widget, schemaWidget, schemaAxis, schemaMarkers } from './Widget'\nimport { useSearchContext } from '../SearchContext'\nimport Floatable from '../../visualization/Floatable'\nimport PlotScatter from '../../plotting/PlotScatter'\nimport { Action, ActionCheckbox } from '../../Actions'\nimport { CropFree, PanTool, Fullscreen, Replay } from '@material-ui/icons'\nimport { autorangeDescription } from './WidgetHistogram'\nimport { styled } from '@material-ui/core/styles'\nimport {DType, parseJMESPath, getDisplayLabel} from '../../../utils'\nimport { Quantity } from '../../units/Quantity'\nimport { Unit } from '../../units/Unit'\nimport { useUnitContext } from '../../units/UnitContext'\n\nconst StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }) => ({\n '& .MuiToggleButtonGroup-grouped': {\n margin: theme.spacing(0, 0.25),\n border: 0,\n '&.Mui-disabled': {\n border: 0\n },\n '&:not(:first-of-type)': {\n borderRadius: theme.shape.borderRadius\n },\n '&:first-of-type': {\n borderRadius: theme.shape.borderRadius\n }\n }\n}))\n\n/**\n * A thin wrapper for displaying a Plotly scatter plot as a widget.\n */\nconst useStyles = makeStyles((theme) => ({\n widget: {\n width: '100%',\n height: '100%'\n },\n divider: {\n margin: theme.spacing(0.5, 0.5)\n },\n alert: {\n overflow: 'auto'\n }\n}))\n\nexport const WidgetScatterPlot = React.memo((\n{\n id,\n title,\n description,\n x,\n y,\n markers,\n size,\n autorange,\n dragmode,\n className,\n onSelected\n}) => {\n const styles = useStyles()\n const {units} = useUnitContext()\n const canvas = useRef()\n const [float, setFloat] = useState(false)\n const [loading, setLoading] = useState(true)\n const { useSetWidget, useHits, filterData, useSetFilter } = useSearchContext()\n\n // Parse additional JMESPath config\n const [xParsed, yParsed, colorParsed, error] = useMemo(() => {\n const xParsed = parseJMESPath(x?.quantity)\n const yParsed = parseJMESPath(y?.quantity)\n const colorParsed = markers?.color?.quantity ? parseJMESPath(markers.color.quantity) : {}\n if (xParsed.error || yParsed.error || colorParsed.error) {\n return [{}, {}, {}, 'Invalid JMESPath query, please check your syntax.']\n }\n return [xParsed, yParsed, colorParsed, undefined]\n }, [markers?.color?.quantity, x?.quantity, y?.quantity])\n\n // Parse units\n const {unitXObj, unitYObj, unitColorObj, displayUnitX, displayUnitY, displayUnitColor, discrete} = useMemo(() => {\n if (error) return {}\n const unitXObj = new Unit(filterData[xParsed.quantity].unit || 'dimensionless')\n const unitYObj = new Unit(filterData[yParsed.quantity].unit || 'dimensionless')\n const unitColorObj = new Unit(filterData[colorParsed?.quantity]?.unit || 'dimensionless')\n const displayUnitX = x.unit ? new Unit(x.unit) : unitXObj.toSystem(units)\n const displayUnitY = y.unit ? new Unit(y.unit) : unitYObj.toSystem(units)\n const displayUnitColor = markers?.color?.unit ? new Unit(markers?.color?.unit) : unitColorObj.toSystem(units)\n const discrete = colorParsed?.quantity && new Set([DType.String, DType.Enum]).has(filterData[colorParsed.quantity]?.dtype)\n return {unitXObj, unitYObj, unitColorObj, displayUnitX, displayUnitY, displayUnitColor, discrete}\n }, [filterData, x.unit, xParsed.quantity, y.unit, yParsed.quantity, markers?.color?.unit, colorParsed?.quantity, units, error])\n\n // Create final axis config for the plot\n const {xAxis, yAxis, colorAxis} = useMemo(() => {\n if (error) return {}\n const xFilter = filterData[xParsed.quantity]\n const yFilter = filterData[yParsed.quantity]\n const colorFilter = filterData[colorParsed.quantity]\n const xTitle = x.title || xFilter?.label || getDisplayLabel(xFilter)\n const yTitle = y.title || yFilter?.label || getDisplayLabel(yFilter)\n const xType = xFilter?.dtype\n const yType = yFilter?.dtype\n const colorTitle = markers?.color?.title || colorFilter?.label || getDisplayLabel(colorFilter)\n const unitLabelX = displayUnitX.label()\n const unitLabelY = displayUnitY.label()\n const unitLabelColor = displayUnitColor.label()\n return {\n xAxis: {...x, ...xParsed, title: xTitle, unit: unitLabelX, type: xType},\n yAxis: {...y, ...yParsed, title: yTitle, unit: unitLabelY, type: yType},\n colorAxis: markers?.color ? {...markers.color, ...colorParsed, title: colorTitle, unit: unitLabelColor} : {}\n }\n }, [colorParsed, displayUnitColor, displayUnitX, displayUnitY, filterData, markers?.color, x, xParsed, y, yParsed, error])\n\n const setXFilter = useSetFilter(xParsed.quantity)\n const setYFilter = useSetFilter(yParsed.quantity)\n\n const setWidget = useSetWidget(id)\n const pagination = useMemo(() => ({\n page_size: size,\n order: 'asc'\n }), [size])\n const required = useMemo(() => {\n const include = new Set(['entry_id'])\n for (const config of [xParsed, yParsed, colorParsed]) {\n if (!isEmpty(config)) {\n include.add(config.quantity)\n for (const extra of config.extras) {\n include.add(extra)\n }\n }\n }\n return {include: [...include]}\n }, [xParsed, yParsed, colorParsed])\n\n useEffect(() => {\n setLoading(true)\n }, [required, pagination])\n\n const hitsCallback = useCallback(() => {\n setLoading(false)\n }, [])\n\n // Fetch the data using the useHits hook that automatically applies the\n // existing filters. We filter out data that is invalid (e.g. no values or\n // incompatible sizes between x/y/color). TODO: The API should support an\n // \"exists\" query that could be used to return hits that actually have the\n // requested values. This way we would get a better match for the query size\n // and we would not need to manually validate and check the results.\n const hits = useHits(id, required, pagination, hitsCallback)\n const dataRaw = useMemo(() => {\n if (!hits || error) return\n function getData(hit) {\n const hitData = {}\n\n // Get each property using JMESPath. Errors at this stage will simply\n // cause the entry to be ignored.\n for (const [name, path] of [['x', xParsed.path], ['y', yParsed.path], ['color', colorParsed.path]]) {\n if (isEmpty(path)) continue\n let value\n try {\n value = jmespath.search(hit, path)\n } catch (e) {\n return {error: 'Invalid JMESPATH'}\n }\n // Missing x/y/color value will cause an error unless dealing with\n // discretized colors\n if (isNil(value)) {\n if (name === 'color' && discrete) {\n value = 'undefined'\n } else {\n return {error: 'Empty value'}\n }\n }\n hitData[name] = value\n }\n\n // Get the shapes\n const xShape = getShape(hitData.x)\n const yShape = getShape(hitData.y)\n\n // Check if x/y leaf shapes match\n if (xShape[xShape.length - 1] !== yShape[yShape.length - 1]) {\n return {error: 'Incompatible size for x/y'}\n }\n\n // If x/y shapes do not match, extend accordingly\n const biggestShape = [xShape, yShape].reduce((prev, current) => {\n return (prev.length > current.length)\n ? prev\n : current\n })\n hitData.x = extendFront(hitData.x, xShape, biggestShape)\n hitData.y = extendFront(hitData.y, yShape, biggestShape)\n\n // Modify color dimensions\n let colorShape = colorParsed.path && getShape(hitData.color)\n if (colorShape && !isEqual(colorShape, biggestShape)) {\n // If color has one more dimension than other arrays and it is discrete,\n // we reduce the last dimension to a single string\n if (discrete && colorShape.length === biggestShape.length + 1) {\n hitData.color = reduceInner(hitData.color)\n colorShape = colorShape.slice(0, -1)\n }\n // Scalar color values are extended\n if (colorShape.length === 0 || (colorShape.length === 1 && colorShape[0] === 1)) {\n hitData.color = fill(\n biggestShape,\n colorShape.length === 0\n ? hitData.color\n : hitData.color[0]\n )\n // Colors are extended according to traces\n } else if ((colorShape.length < biggestShape.length) && colorShape[0] === biggestShape[0]) {\n hitData.color = extendBack(hitData.color, colorShape, biggestShape)\n } else {\n return {error: 'Incompatible size for color'}\n }\n }\n\n // Flatten arrays\n hitData.x = flatten(hitData.x)\n hitData.y = flatten(hitData.y)\n hitData.color = colorParsed.path && flatten(hitData.color)\n\n // If shapes still don't match, skip entry. TODO: This check is not ideal,\n // since we may be accepting accidentally mathing sizes. A proper shape\n // check that would also allow \"ragged arrays\" would be better.\n if (hitData.x.length !== hitData.y.length || (colorParsed.path && hitData.x.length !== hitData.color.length)) {\n return {error: 'Incompatible number of elements'}\n }\n\n return {hitData, nPoints: hitData.x.length}\n }\n const x = []\n const y = []\n const color = colorParsed.path ? [] : undefined\n const id = []\n for (const hit of hits) {\n const {hitData, error, nPoints} = getData(hit)\n if (error || !nPoints) continue\n for (const i of range(nPoints)) {\n x.push(hitData.x[i])\n y.push(hitData.y[i])\n colorParsed.path && color.push(hitData.color?.[i])\n id.push(hit.entry_id)\n }\n }\n return {x, y, color, id}\n }, [discrete, hits, xParsed.path, yParsed.path, colorParsed.path, error])\n\n // Perform unit conversion, report errors\n const data = useMemo(() => {\n if (!dataRaw) return\n const x = xAxis.type === DType.Timestamp\n ? dataRaw.x\n : new Quantity(dataRaw.x, unitXObj).to(displayUnitX).value()\n const y = yAxis.type === DType.Timestamp\n ? dataRaw.y\n : new Quantity(dataRaw.y, unitYObj).to(displayUnitY).value()\n const color = dataRaw.color && (discrete\n ? dataRaw.color\n : new Quantity(dataRaw.color, unitColorObj).to(displayUnitColor).value()\n )\n return {x, y, color, id: dataRaw.id}\n }, [dataRaw, displayUnitColor, displayUnitX, displayUnitY, unitColorObj, unitXObj, unitYObj, discrete, xAxis, yAxis])\n\n const handleEdit = useCallback(() => {\n setWidget(old => { return {...old, editing: true } })\n }, [setWidget])\n\n const handleDragModeChanged = useCallback((event, value) => {\n if (value !== null) {\n setWidget(old => ({...old, dragmode: value}))\n }\n }, [setWidget])\n\n const handleResetClick = useCallback(() => {\n canvas.current.reset()\n }, [])\n\n const handleFloat = useCallback(() => {\n // The current layout needs to be saved, because the DOM change will\n // cause it to be lost.\n canvas.current?.saveLayout()\n setFloat(old => !old)\n }, [])\n\n const handleSelected = useCallback((data) => {\n const range = data?.range\n if (!range) return\n setXFilter({\n gte: new Quantity(range.x[0], displayUnitX),\n lte: new Quantity(range.x[1], displayUnitX)\n })\n setYFilter({\n gte: new Quantity(range.y[0], displayUnitY),\n lte: new Quantity(range.y[1], displayUnitY)\n })\n onSelected?.(data)\n }, [onSelected, setXFilter, setYFilter, displayUnitX, displayUnitY])\n\n const handleDeselect = useCallback(() => {\n onSelected?.(undefined)\n }, [onSelected])\n\n const actions = useMemo(() => {\n return <>\n setWidget(old => ({...old, autorange: value}))}\n />\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n }, [dragmode, handleDragModeChanged, handleResetClick, handleFloat, autorange, setWidget, styles])\n\n const handleNavigated = useCallback(() => {\n setFloat(false)\n }, [])\n\n return \n \n {error\n ? \n {error}\n \n : \n }\n \n \n})\n\nWidgetScatterPlot.propTypes = {\n id: PropTypes.string.isRequired,\n title: PropTypes.string,\n description: PropTypes.string,\n x: PropTypes.object,\n y: PropTypes.object,\n markers: PropTypes.object,\n size: PropTypes.number,\n autorange: PropTypes.bool,\n dragmode: PropTypes.string,\n className: PropTypes.string,\n onSelected: PropTypes.func\n}\n\nexport const schemaWidgetScatterPlot = schemaWidget.shape({\n x: schemaAxis.required('Quantity for the x axis is required.'),\n y: schemaAxis.required('Quantity for the y axis is required.'),\n markers: schemaMarkers,\n size: number().integer().required('Size is required.'),\n autorange: bool()\n})\n\n/**\n * Used to flatten the input into a single array of values.\n */\nfunction flatten(input) {\n return isArray(input)\n ? flattenDeep(input)\n : [input]\n}\n\n/**\n * Gets the shape of an abitrarily nested array.\n */\nfunction getShape(input) {\n if (!isArray(input)) {\n return []\n }\n\n const shape = []\n let inner = input\n\n while (isArray(inner)) {\n shape.push(inner.length)\n inner = inner[0]\n }\n\n return shape\n}\n\n/**\n * Reduces the innermost dimension into a single value.\n */\nfunction reduceInner(input) {\n function reduceRec(inp) {\n if (isArray(inp)) {\n if (isArray(inp[0])) {\n for (let i = 0; i < inp.length; ++i) {\n inp[i] = reduceRec(inp[i])\n }\n } else {\n return inp.sort().join(\", \")\n }\n }\n return inp\n }\n return reduceRec(input)\n}\n\n/**\n * Resizes the given array to a new size by extending the data to fit the front\n * dimensions (similar to array = array[None, :] in NumPy).\n */\nfunction extendFront(array, oldShape, newShape) {\n // If shape is already correct, return the input array\n const diff = newShape.length - oldShape.length\n if (diff === 0) return array\n\n // Extend the array\n const extendedArray = []\n function extendRec(depth) {\n const dim = newShape[depth]\n const hasData = depth === diff\n if (hasData) {\n return array\n } else {\n for (let j = 0; j < dim; ++j) {\n extendedArray.push(extendRec(depth + 1))\n }\n }\n return extendedArray\n }\n extendRec(0)\n return extendedArray\n}\n\n/**\n * Resizes the given array to a new size by extending the data to fit the last\n * dimensions dimensions (similar to array = array[:, None] in NumPy).\n */\nfunction extendBack(array, oldShape, newShape) {\n // If shape is already correct, return the input array\n const diff = newShape.length - oldShape.length\n if (diff === 0) return array\n\n // Extend the array\n const extendedArray = []\n const nTraces = newShape[0]\n for (let i = 0; i < nTraces; ++i) {\n const traceArray = []\n for (let j = 0; j < newShape[1]; ++j) {\n traceArray.push([array[i]])\n }\n extendedArray.push(traceArray)\n }\n return extendedArray\n}\n\n/**\n * Creates a new array with the given shape, filled with the given value.\n */\nfunction fill(shape, fillValue) {\n if (shape.length === 0) {\n return fillValue\n } else {\n const innerShape = shape.slice(1)\n const innerArray = []\n for (let i = 0; i < shape[0]; i++) {\n innerArray.push(fill(innerShape, fillValue))\n }\n return innerArray\n }\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport {\n List,\n ListItem,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n makeStyles,\n MenuItem,\n TextField,\n Typography\n} from '@material-ui/core'\nimport { useSearchContext } from '../SearchContext'\n\n/**\n * A dialog that is used to configure a widget.\n */\nexport const useStyles = makeStyles(theme => ({\n width: {\n maxWidth: \"700px\"\n }\n}))\nexport const WidgetEditDialog = React.memo(({id, title, open, visible, onAccept, onClose, error, children}) => {\n const styles = useStyles()\n const { useRemoveWidget } = useSearchContext()\n const removeWidget = useRemoveWidget()\n\n const handleClose = useCallback((event, reason) => {\n // Do not close dialog on backdrop click: user may lose lot of filled info\n // accidentally\n if (reason === 'backdropClick') {\n return\n }\n\n // If the widget has not bee visualized, then closing the dialog deletes\n // the widget completely.\n onClose && onClose()\n if (!visible) {\n removeWidget(id)\n }\n }, [id, onClose, removeWidget, visible])\n\n const handleAccept = useCallback(() => {\n onAccept && onAccept()\n }, [onAccept])\n\n return \n {title || ''}\n \n {children}\n \n \n \n \n \n \n})\n\nWidgetEditDialog.propTypes = {\n id: PropTypes.string,\n title: PropTypes.string,\n open: PropTypes.bool,\n visible: PropTypes.bool,\n onClose: PropTypes.func,\n onAccept: PropTypes.func,\n error: PropTypes.bool,\n children: PropTypes.node\n\n}\n\n/**\n * A group of options in an edit dialog.\n */\nconst useEditGroupStyles = makeStyles((theme) => ({\n heading: {\n color: theme.palette.primary.main\n },\n list: {\n width: '100%'\n }\n}))\nexport const WidgetEditGroup = React.memo(({title, children}) => {\n const styles = useEditGroupStyles()\n\n return <>\n {title}\n \n {children}\n \n \n})\n\nWidgetEditGroup.propTypes = {\n title: PropTypes.string,\n children: PropTypes.node\n}\n\n/**\n * An option in an edit dialog.\n */\nexport const WidgetEditOption = React.memo(({children}) => {\n return \n {children}\n \n})\n\nWidgetEditOption.propTypes = {\n children: PropTypes.node\n}\n\n/**\n * Select (=dropdown) component for widget edit.\n */\nexport const WidgetEditSelect = React.memo(({label, disabled, options, value, onChange}) => {\n return \n {Object.entries(options).map(([key, value]) =>\n {key}\n )}\n \n})\n\nWidgetEditSelect.propTypes = {\n label: PropTypes.string,\n disabled: PropTypes.bool,\n options: PropTypes.object,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onChange: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { string } from 'yup'\nimport { TextField, MenuItem } from '@material-ui/core'\nimport { useSearchContext } from '../SearchContext'\nimport { Widget, schemaWidget } from './Widget'\nimport { ActionSelect } from '../../Actions'\nimport { WidgetEditDialog, WidgetEditGroup, WidgetEditOption } from './WidgetEdit'\nimport { InputTextField } from '../input/InputText'\nimport { PeriodicTable } from '../input/InputPeriodicTable'\nimport { scales } from '../../plotting/common'\n\n/**\n * Displays a periodic table as a widget.\n */\nexport const WidgetPeriodicTable = React.memo((\n{\n id,\n title,\n description,\n quantity,\n scale,\n className\n}) => {\n const { useSetWidget } = useSearchContext()\n const setWidget = useSetWidget(id)\n\n const handleEdit = useCallback(() => {\n setWidget(old => { return {...old, editing: true } })\n }, [setWidget])\n\n const handleChangeScale = useCallback((value) => {\n setWidget(old => { return {...old, scale: value} })\n }, [setWidget])\n\n return \n }\n >\n \n \n})\n\nWidgetPeriodicTable.propTypes = {\n id: PropTypes.string.isRequired,\n title: PropTypes.string,\n description: PropTypes.string,\n quantity: PropTypes.string,\n scale: PropTypes.string,\n className: PropTypes.string\n}\n\n/**\n * A dialog that is used to configure a scatter plot widget.\n */\nexport const WidgetPeriodicTableEdit = React.memo((props) => {\n const {id, editing, visible} = props\n const { useSetWidget } = useSearchContext()\n const [settings, setSettings] = useState(props)\n const [errors, setErrors] = useState({})\n const setWidget = useSetWidget(id)\n const hasError = useMemo(() => {\n return Object.values(errors).some((d) => !!d) || !schemaWidgetPeriodicTable.isValidSync(settings)\n }, [errors, settings])\n\n const handleSubmit = useCallback((settings) => {\n setWidget(old => ({...old, ...settings}))\n }, [setWidget])\n\n const handleChange = useCallback((key, value) => {\n setSettings(old => ({...old, [key]: value}))\n }, [setSettings])\n\n const handleClose = useCallback(() => {\n setWidget(old => ({...old, editing: false}))\n }, [setWidget])\n\n const handleError = useCallback((key, value) => {\n setErrors(old => ({...old, [key]: value}))\n }, [setErrors])\n\n const handleAccept = useCallback((key, value) => {\n try {\n schemaWidgetPeriodicTable.validateSyncAt(key, {[key]: value})\n } catch (e) {\n handleError(key, e.message)\n return\n }\n setErrors(old => ({...old, [key]: undefined}))\n setSettings(old => ({...old, [key]: value}))\n }, [handleError, setSettings])\n\n const handleEditAccept = useCallback(() => {\n handleSubmit({...settings, editing: false, visible: true})\n }, [handleSubmit, settings])\n\n return \n \n \n {\n handleChange('scale', event.target.value)\n handleAccept('scale', event.target.value)\n }}\n >\n {Object.keys(scales).map((key) =>\n {key}\n )}\n \n \n \n \n \n handleChange('title', event.target.value)}\n />\n \n \n \n})\n\nWidgetPeriodicTableEdit.propTypes = {\n id: PropTypes.string.isRequired,\n editing: PropTypes.bool,\n visible: PropTypes.bool,\n quantity: PropTypes.string,\n scale: PropTypes.string,\n onClose: PropTypes.func\n}\n\nexport const schemaWidgetPeriodicTable = schemaWidget.shape({\n quantity: string().required('Quantity is required.'),\n scale: string().required('Scale is required.')\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { string, bool } from 'yup'\nimport clsx from 'clsx'\nimport { isNil } from 'lodash'\nimport {\n TextField,\n Typography,\n MenuItem,\n FormControlLabel,\n Checkbox,\n makeStyles\n} from '@material-ui/core'\nimport { useResizeDetector } from 'react-resize-detector'\nimport { useSearchContext } from '../SearchContext'\nimport { InputMetainfo } from '../input/InputMetainfo'\nimport { InputTextQuantity, InputTextField } from '../input/InputText'\nimport InputItem, { inputItemHeight } from '../input/InputItem'\nimport InputUnavailable from '../input/InputUnavailable'\nimport InputTooltip from '../input/InputTooltip'\nimport Placeholder from '../../visualization/Placeholder'\nimport { Widget, schemaWidget } from './Widget'\nimport { ActionSelect } from '../../Actions'\nimport { WidgetEditDialog, WidgetEditGroup, WidgetEditOption } from './WidgetEdit'\nimport { DType, pluralize } from '../../../utils'\nimport { scales } from '../../plotting/common'\n\n// Predefined in order to not break memoization\nconst dtypes = new Set([DType.String, DType.Enum])\n\n/**\n * Displays a terms widget.\n */\nconst useStyles = makeStyles(theme => ({\n root: {\n },\n outerContainer: {\n position: 'relative',\n width: '100%',\n height: '100%'\n },\n innerContainer: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n right: 0,\n left: 0,\n display: 'flex',\n flexDirection: 'column'\n },\n menuItem: {\n height: inputItemHeight\n },\n menuItemSelected: {\n '&.Mui-selected': {\n backgroundColor: 'transparent'\n }\n },\n chips: {\n display: 'flex',\n flexWrap: 'wrap'\n },\n icon: {\n right: theme.spacing(1)\n },\n spacer: {\n flex: 1,\n minHeight: 0\n },\n textField: {\n marginBottom: theme.spacing(1)\n },\n count: {\n height: '1.2rem',\n marginTop: theme.spacing(0.25),\n marginRight: theme.spacing(1),\n display: 'flex',\n justifyContent: 'flex-end',\n alignItems: 'center',\n color: theme.palette.text.disabled\n }\n}))\nexport const WidgetTerms = React.memo((\n{\n id,\n title,\n description,\n quantity,\n scale,\n showinput,\n className,\n 'data-testid': testID\n}) => {\n const {useAgg, useFilterState, filterData} = useSearchContext()\n const styles = useStyles()\n const [filter, setFilter] = useFilterState(quantity)\n const { height, ref } = useResizeDetector()\n const { useSetWidget } = useSearchContext()\n const setWidget = useSetWidget(id)\n\n // The terms aggregations need to request at least 1 item or an API error is thrown\n const aggSize = useMemo(() => Math.max(Math.floor(height / inputItemHeight), 1), [height])\n const aggConfig = useMemo(() => {\n const config = {type: 'terms', size: aggSize}\n // If a fixed list of options is used, we must restrict the aggregation\n // return values with 'include'. Otherwise the returned results may not\n // contain the correct values.\n const options = filterData[quantity]?.options\n if (options) config.include = Object.keys(options)\n return config\n }, [aggSize, filterData, quantity])\n const agg = useAgg(quantity, !isNil(height), id, aggConfig)\n const max = agg ? Math.max(...agg.data.map(option => option.nested_count)) : 0\n\n const handleChange = useCallback((event, key, selected) => {\n setFilter(old => {\n if (!old) return new Set([key])\n const newValue = new Set(old)\n selected ? newValue.add(key) : newValue.delete(key)\n return newValue\n })\n }, [setFilter])\n\n const handleEdit = useCallback(() => {\n setWidget(old => { return {...old, editing: true } })\n }, [setWidget])\n\n const handleChangeScale = useCallback((value) => {\n setWidget(old => { return {...old, scale: value} })\n }, [setWidget])\n\n const [aggComp, nShown] = useMemo(() => {\n let aggComp\n let nShown = 0\n if (!agg) {\n aggComp = \n nShown = 0\n } else {\n if (agg?.data && agg.data.length > 0) {\n aggComp = []\n const maxSize = Math.min(aggConfig.size, agg.data.length)\n for (let i = 0; i < maxSize; ++i) {\n const option = agg.data[i]\n if (option.nested_count > 0 && nShown < maxSize) {\n aggComp.push()\n ++nShown\n }\n }\n } else {\n aggComp = \n nShown = 0\n }\n }\n return [aggComp, nShown]\n }, [agg, aggConfig, filter, handleChange, max, scale, testID])\n\n const count = pluralize('item', nShown, true)\n\n return \n }\n >\n \n
\n
\n {showinput\n ? \n : null\n }\n
\n {aggComp}\n
\n {nShown !== 0 &&
\n \n {nShown < aggConfig.size\n ? nShown === 1\n ? 'Showing the only item'\n : `Showing all ${count}`\n : `Showing top ${count}`\n }\n \n
}\n
\n
\n
\n \n})\n\nWidgetTerms.propTypes = {\n id: PropTypes.string.isRequired,\n title: PropTypes.string,\n description: PropTypes.string,\n quantity: PropTypes.string,\n nbins: PropTypes.number,\n scale: PropTypes.string,\n autorange: PropTypes.bool,\n showinput: PropTypes.bool,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nWidgetTerms.defaultProps = {\n 'data-testid': 'widgetterms'\n}\n\n/**\n * A dialog that is used to configure a scatter plot widget.\n */\nexport const WidgetTermsEdit = React.memo((props) => {\n const {id, editing, visible} = props\n const { useSetWidget } = useSearchContext()\n const [settings, setSettings] = useState(props)\n const [errors, setErrors] = useState({})\n const setWidget = useSetWidget(id)\n const hasError = useMemo(() => {\n return Object.values(errors).some((d) => !!d) || !schemaWidgetTerms.isValidSync(settings)\n }, [errors, settings])\n\n const handleSubmit = useCallback((settings) => {\n setWidget(old => ({...old, ...settings}))\n }, [setWidget])\n\n const handleChange = useCallback((key, value) => {\n setSettings(old => ({...old, [key]: value}))\n }, [setSettings])\n\n const handleError = useCallback((key, value) => {\n setErrors(old => ({...old, [key]: value}))\n }, [setErrors])\n\n const handleClose = useCallback(() => {\n setWidget(old => ({...old, editing: false}))\n }, [setWidget])\n\n const handleAccept = useCallback((key, value) => {\n try {\n schemaWidgetTerms.validateSyncAt(key, {[key]: value})\n } catch (e) {\n handleError(key, e.message)\n return\n }\n setErrors(old => ({...old, [key]: undefined}))\n setSettings(old => ({...old, [key]: value}))\n }, [handleError, setSettings])\n\n const handleEditAccept = useCallback(() => {\n handleSubmit({...settings, editing: false, visible: true})\n }, [handleSubmit, settings])\n\n return \n \n \n handleChange('quantity', value)}\n onSelect={(value) => handleAccept('quantity', value)}\n onError={(value) => handleError('quantity', value)}\n dtypes={dtypes}\n dtypesRepeatable={dtypes}\n disableNonAggregatable\n />\n \n \n { handleChange('scale', event.target.value) }}\n >\n {Object.keys(scales).map((key) =>\n {key}\n )}\n \n \n \n \n \n handleChange('title', event.target.value)}\n />\n \n \n handleChange('showinput', value)}/>}\n label='Show input field'\n />\n \n \n \n})\n\nWidgetTermsEdit.propTypes = {\n id: PropTypes.string.isRequired,\n editing: PropTypes.bool,\n visible: PropTypes.bool,\n quantity: PropTypes.string,\n scale: PropTypes.string,\n nbins: PropTypes.number,\n autorange: PropTypes.bool,\n showinput: PropTypes.bool,\n onClose: PropTypes.func\n}\n\nexport const schemaWidgetTerms = schemaWidget.shape({\n quantity: string().required('Quantity is required.'),\n scale: string().required('Scale is required.'),\n showinput: bool()\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useLayoutEffect, useMemo, useCallback, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { cloneDeep, isNil, range } from 'lodash'\nimport { Responsive as ResponsiveGridLayout } from \"react-grid-layout\"\nimport { useResizeDetector } from 'react-resize-detector'\nimport { Paper } from '@material-ui/core'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { WidgetScatterPlot } from './WidgetScatterPlot'\nimport { WidgetPeriodicTable } from './WidgetPeriodicTable'\nimport { WidgetHistogram } from './WidgetHistogram'\nimport { WidgetTerms } from './WidgetTerms'\nimport { useSearchContext } from '../SearchContext'\n\n// Breakpoints are designed so that the periodic table is always properly\n// visible for each breakpoint/column combination\nconst periodicTableMinWidth = 710\nconst periodicTableCols = 12\nconst cols = {xxl: 36, xl: 30, lg: 24, md: 18, sm: 12}\nconst breakpoints = Object.fromEntries(Object.entries(cols).map(([size, nCols]) => {\n return [size, periodicTableMinWidth / periodicTableCols * nCols]\n}))\nconst sizes = Object.entries(breakpoints)\nconst margin = [0, 0]\n\n/**\n * Used for calculating the number of columns based on the current width.\n * @param {number} width The grid width\n * @returns The number of columns.\n */\nfunction getNCols(width) {\n let breakpoint\n for (const [key, size] of sizes) {\n breakpoint = key\n if (width >= size) break\n }\n return cols[breakpoint]\n}\n\n/**\n * This class is used to build a layout where items are added one by one and\n * adding a new item does not modify the existing layout. Used to replace the\n * initial layout created by 'react-grid-layout'.\n */\nclass Layout {\n constructor(items, nCols) {\n this.items = []\n this.nCols = nCols\n for (const item of items) {\n this.add(item)\n }\n }\n\n /**\n * Used to add an item to the layout. Notice that the order in which the items\n * are added matters.\n * @param {object} item Object containing at least a width and a height\n */\n add(item) {\n // If the item already has a location, skip the automatization.\n if (!isNil(item.x) && !isNil(item.y)) {\n this.items.push(item)\n // If no location specified, place it in the best available location.\n } else {\n // Get all suitable locations. A location is suitable if the item fits in\n // there.\n const locations = this.getAvailableLocations()\n const locationsFit = locations\n .filter((loc) => item.w <= loc.w && item.h <= loc.h)\n\n // Choose the best one. Currently the topmost location is the best.\n locationsFit.sort((a, b) => a.y - b.y)\n const bestLocation = locationsFit[0]\n\n // Add item to best location\n this.items.push({...item, x: bestLocation.x, y: bestLocation.y})\n }\n }\n\n /**\n * Updates the list of available locations. Available locations are\n * represented by a rectangle that has a top-left coordinate, width and\n * height. Notice that this implementation is not very optimal as it tries out\n * every point in the grid.\n */\n getAvailableLocations() {\n const locations = []\n if (this.items.length > 0) {\n const bottom = Math.max(...this.items.map((item) => item.y + item.h))\n const epsilon = 1e-4\n for (const i of range(this.nCols - 1)) {\n for (const j of range(bottom - 1)) {\n const point = {x: i, y: j}\n // See how much horizontal space there is\n let xMax = point.x\n while (!this.withinItem({x: xMax + epsilon, y: point.y + epsilon}) && xMax < this.nCols) {\n xMax += 1\n }\n // See how much vertical space there is\n let yMax = point.y\n while (!this.withinItem({x: point.x + epsilon, y: yMax + epsilon}) && yMax < bottom) {\n yMax += 1\n }\n if (yMax === bottom) yMax = Infinity\n const width = xMax - point.x\n const height = yMax - point.y\n if (width && height) {\n locations.push({...point, w: width, h: height})\n }\n }\n }\n // Add a location at the bottom row that can be used for items that take up\n // all columns.\n locations.push({x: 0, y: bottom, w: this.nCols, h: Infinity})\n } else {\n locations.push({x: 0, y: 0, w: this.nCols, h: Infinity})\n }\n return locations\n }\n\n /**\n * Checks if the given coordinate is within any of the items. Idea from:\n * https://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle\n *\n * @param {object} point Object containin an x and a y coordinate.\n * @returns Whether the coordinate is within an item.\n */\n withinItem(point) {\n function dot(a, b) {\n return a.x * b.x + a.y * b.y\n }\n for (const item of this.items) {\n const AB = {x: item.w, y: 0}\n const AM = {x: point.x - item.x, y: point.y - item.y}\n const BC = {x: 0, y: item.h}\n const BM = {x: point.x - (item.x + item.w), y: point.y - item.y}\n const ABAB = dot(AB, AB)\n const ABAM = dot(AB, AM)\n const BCBC = dot(BC, BC)\n const BCBM = dot(BC, BM)\n const within = (ABAB >= ABAM) && (ABAM >= 0) && (BCBC >= BCBM) && (BCBM >= 0)\n if (within) return true\n }\n return false\n }\n\n /**\n * Returns the calculated layout.\n * @returns Object containing a list of items.\n */\n getLayout() {\n return this.items\n }\n}\n\n/**\n * A component that is used to display all of the widgets in an interactive\n * grid. The items can be moved around and resized.\n */\nconst useStyles = makeStyles(theme => {\n return {\n root: {\n position: 'relative',\n marginLeft: theme.spacing(-0.75),\n marginRight: theme.spacing(-0.75)\n },\n component: {\n position: 'absolute',\n top: theme.spacing(0.5),\n bottom: theme.spacing(1.25),\n left: theme.spacing(1.5),\n right: theme.spacing(1.5),\n height: 'unset',\n width: 'unset'\n },\n containerOuter: {\n position: 'relative'\n },\n containerInner: {\n position: 'absolute',\n top: theme.spacing(0.75),\n bottom: theme.spacing(0.75),\n left: theme.spacing(0.75),\n right: theme.spacing(0.75),\n height: 'unset',\n width: 'unset'\n }\n }\n})\nconst WidgetGrid = React.memo(({\n className,\n classes\n}) => {\n const styles = useStyles(classes)\n const { useWidgetsState } = useSearchContext()\n const { ref, width } = useResizeDetector()\n const [widgets, setWidgets] = useWidgetsState()\n const [validWidth, setValidWidth] = useState()\n const nCols = getNCols(validWidth)\n const firstLayout = useRef(true)\n\n // Create the layouts\n const layout = useMemo(() => {\n if (!nCols) return {}\n\n // If layouts are not provided for all different breakpoints, duplicate the\n // closest layout that is found. We need to work on copies as the widgets\n // information is immutable.\n const widgetCopies = {}\n for (const [id, widget] of Object.entries(widgets)) {\n if (!widget.visible) continue\n if (!widget.layout) {\n widgetCopies[id] = widget\n continue\n }\n const widgetCopy = cloneDeep(widget)\n const breakpointNames = Object.keys(breakpoints)\n for (const i of range(0, breakpointNames.length)) {\n const breakpoint = breakpointNames[i]\n if (!widgetCopy.layout[breakpoint]) {\n for (const j of range(1, breakpointNames.length - 1)) {\n const breakpointSmaller = widgetCopy.layout[breakpointNames[i - j]]\n const breakpointBigger = widgetCopy.layout[breakpointNames[i + j]]\n if (breakpointSmaller) {\n widgetCopy.layout[breakpoint] = breakpointSmaller\n break\n } else if (breakpointBigger) {\n widgetCopy.layout[breakpoint] = breakpointBigger\n break\n }\n }\n }\n }\n widgetCopies[id] = widgetCopy\n }\n\n const layouts = {}\n for (const breakpoint of Object.keys(breakpoints)) {\n // This is the layout in the format as react-grid-layout would read it. x:\n // Infinity means that we want to place the item at the very end.\n // Add widgets\n let i = 0\n let layout = Object.entries(widgetCopies)\n .map(([id, value]) => {\n const layout = value.layout?.[breakpoint]\n const config = {\n i: id,\n x: isNil(layout?.x) ? Infinity : layout?.x,\n y: isNil(layout?.y) ? 0 : layout?.y,\n w: isNil(layout?.w) ? 3 : layout?.w,\n h: isNil(layout?.h) ? 3 : layout?.h,\n minW: isNil(layout?.minW) ? 3 : layout?.minW,\n minH: isNil(layout?.minH) ? 3 : layout?.minH,\n index: i\n }\n ++i\n return config\n })\n\n // Calculate a sane initial layout using the custom Layout class. The\n // initial layout as calculated by react-grid-layout is not always very\n // great.\n if (firstLayout.current) {\n layout = new Layout(layout.sort((a, b) => a.index - b.index), nCols).getLayout()\n firstLayout.current = false\n }\n layouts[breakpoint] = layout\n }\n return layouts\n }, [widgets, nCols])\n\n // The grid children are memoized as instructed in the docs of\n // 'react-grid-layout' for performance.\n const children = useMemo(() => {\n return Object.entries(widgets)\n .filter(([id, value]) => value?.visible)\n .sort((a, b) => b[1].index - a[1].index)\n .map(([id, value]) => {\n const Comp = {\n scatterplot: WidgetScatterPlot,\n periodictable: WidgetPeriodicTable,\n histogram: WidgetHistogram,\n terms: WidgetTerms\n }[value.type]\n return
\n \n \n \n
\n })\n }, [widgets, styles])\n\n // Mount the grid only after the width has been succesfully calculated. Also\n // the latest valid width is stored and used for the actual grid, since upon\n // the changing route, the width of the component goes to zero causing\n // unwanted flickering.\n useLayoutEffect(() => {\n if (width) {\n setValidWidth(width)\n }\n }, [width])\n\n // The layouts are stored when they are changed. This allows retaining the\n // layout for each breakpoint individually. Notice that we need to feed in the\n // changed layout back to the component so that it works in a controlled\n // manner.\n const handleLayoutChange = useCallback((layout, allLayouts) => {\n setWidgets(old => {\n const newLayout = cloneDeep(old)\n for (const [breakpoint, value] of Object.entries(allLayouts)) {\n for (const layout of value) {\n newLayout[layout.i].layout[breakpoint] = cloneDeep(layout)\n }\n }\n return newLayout\n })\n }, [setWidgets])\n\n return
\n { validWidth\n ? }\n width={validWidth}\n >\n {children}\n \n : null }\n
\n})\n\nWidgetGrid.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object\n}\n\nexport default WidgetGrid\n\n/**\n * A custom resize handle component for the grid items.\n */\nconst useHandleStyles = makeStyles(theme => {\n return {\n root: {\n margin: theme.spacing(1),\n width: '25px',\n height: '25px'\n }\n }\n})\nconst ResizeHandle = React.forwardRef((props, ref) => {\n const {handleAxis, ...restProps} = props\n const styles = useHandleStyles()\n return \n
\n})\nResizeHandle.propTypes = {\n handleAxis: PropTypes.string\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport { number, bool, reach } from 'yup'\nimport { cloneDeep } from 'lodash'\nimport {\n Checkbox,\n FormControlLabel,\n MenuItem,\n TextField\n} from '@material-ui/core'\nimport { InputJMESPath } from '../input/InputMetainfo'\nimport { schemaWidget, schemaAxis, schemaMarkers } from './Widget'\nimport { WidgetEditDialog, WidgetEditGroup, WidgetEditOption, WidgetEditSelect } from './WidgetEdit'\nimport { useSearchContext } from '../SearchContext'\nimport { autorangeDescription } from './WidgetHistogram'\nimport { DType, setDeep, parseJMESPath, isEmptyString } from '../../../utils'\nimport { InputTextField } from '../input/InputText'\nimport { scalesLimited } from '../../plotting/common'\nimport UnitInput from '../../units/UnitInput'\n\n// Predefined in order to not break memoization\nconst dtypesNumeric = new Set([DType.Int, DType.Float, DType.Timestamp])\nconst dtypesColor = new Set([DType.String, DType.Enum, DType.Float, DType.Int])\nconst nPointsOptions = {\n 100: 100,\n 1000: 1000,\n 10000: 10000\n}\n/**\n * A dialog that is used to configure a scatter plot widget.\n */\nexport const WidgetScatterPlotEdit = React.memo(({widget}) => {\n const { filterData, useSetWidget } = useSearchContext()\n const [settings, setSettings] = useState(cloneDeep(widget))\n const [errors, setErrors] = useState({})\n const [dimensions, setDimensions] = useState({})\n const setWidget = useSetWidget(widget.id)\n\n const handleError = useCallback((key, value) => {\n setErrors(old => ({...old, [key]: value}))\n }, [setErrors])\n\n const handleErrorQuantity = useCallback((key, value) => {\n handleError(key, value)\n setDimensions((old) => ({...old, [key]: null}))\n }, [handleError])\n\n const handleChange = useCallback((key, value) => {\n setSettings(old => {\n const newValue = {...old}\n setDeep(newValue, key, value)\n return newValue\n })\n }, [setSettings])\n\n const handleClose = useCallback(() => {\n setWidget(old => ({...old, editing: false}))\n }, [setWidget])\n\n const handleAccept = useCallback((key, value) => {\n try {\n reach(schemaWidgetScatterPlot, key).validateSync(value)\n } catch (e) {\n handleError(key, e.message)\n return\n }\n setErrors(old => ({...old, [key]: undefined}))\n handleChange(key, value)\n }, [handleError, handleChange])\n\n const handleAcceptQuantity = useCallback((key, value) => {\n handleAccept(key, value)\n const { quantity } = parseJMESPath(value)\n const dimension = filterData[quantity]?.dimension\n setDimensions((old) => ({...old, [key]: dimension}))\n }, [handleAccept, filterData])\n\n // Upon accepting the entire form, we perform final validation that also\n // takes into account cross-field incompatibilities\n const handleEditAccept = useCallback(() => {\n // Check for independent errors from components\n const independentErrors = Object.values(errors).some(x => !!x)\n if (independentErrors) return\n\n // Check for missing values. This check is required because there is no\n // value set when a new widget is created, and pressing the done button\n // without filling a value should raise an error.\n const xEmpty = isEmptyString(settings?.x?.quantity)\n if (xEmpty) {\n handleErrorQuantity('x.quantity', 'Please specify a value.')\n }\n const yEmpty = isEmptyString(settings?.y?.quantity)\n if (yEmpty) {\n handleErrorQuantity('y.quantity', 'Please specify a value.')\n }\n\n if (!independentErrors && !xEmpty && !yEmpty) {\n setWidget(old => ({...old, ...{...settings, editing: false, visible: true}}))\n }\n }, [settings, setWidget, errors, handleErrorQuantity])\n\n return \n \n \n handleChange('x.quantity', value)}\n onSelect={(value) => handleAcceptQuantity('x.quantity', value)}\n onAccept={(value) => handleAcceptQuantity('x.quantity', value)}\n error={errors['x.quantity']}\n onError={(value) => handleErrorQuantity('x.quantity', value)}\n dtypes={dtypesNumeric}\n dtypesRepeatable={dtypesNumeric}\n />\n \n \n handleChange('x.title', event.target.value)}\n />\n \n \n handleChange('x.unit', value)}\n onSelect={(value) => handleAccept('x.unit', value)}\n onAccept={(value) => handleAccept('x.unit', value)}\n error={errors['x.unit']}\n onError={(value) => handleError('x.unit', value)}\n dimension={dimensions['x.quantity'] || null}\n optional\n disableGroup\n />\n \n \n { handleChange('x.scale', event.target.value) }}\n >\n {Object.keys(scalesLimited).map((key) =>\n {key}\n )}\n \n \n \n \n \n handleChange('y.quantity', value)}\n onSelect={(value) => handleAcceptQuantity('y.quantity', value)}\n onAccept={(value) => handleAcceptQuantity('y.quantity', value)}\n error={errors['y.quantity']}\n onError={(value) => handleErrorQuantity('y.quantity', value)}\n dtypes={dtypesNumeric}\n dtypesRepeatable={dtypesNumeric}\n />\n \n \n handleChange('y.title', event.target.value)}\n />\n \n \n handleChange('y.unit', value)}\n onSelect={(value) => handleAccept('y.unit', value)}\n onAccept={(value) => handleAccept('y.unit', value)}\n error={errors['y.unit']}\n onError={(value) => handleError('y.unit', value)}\n dimension={dimensions['y.quantity'] || null}\n optional\n disableGroup\n />\n \n \n { handleChange('y.scale', event.target.value) }}\n >\n {Object.keys(scalesLimited).map((key) =>\n {key}\n )}\n \n \n \n \n \n handleChange('markers.color.quantity', value)}\n onSelect={(value) => handleAcceptQuantity('markers.color.quantity', value)}\n onAccept={(value) => handleAcceptQuantity('markers.color.quantity', value)}\n error={errors['markers.color.quantity']}\n onError={(value) => handleErrorQuantity('markers.color.quantity', value)}\n dtypes={dtypesColor}\n dtypesRepeatable={dtypesColor}\n optional\n />\n \n \n handleChange('markers.color.title', event.target.value)}\n />\n \n \n handleChange('markers.color.unit', value)}\n onSelect={(value) => handleAccept('markers.color.unit', value)}\n onAccept={(value) => handleAccept('markers.color.unit', value)}\n error={errors['markers.color.unit']}\n onError={(value) => handleError('markers.color.unit', value)}\n dimension={dimensions['markers.color.quantity'] || null}\n optional\n disableGroup\n />\n \n \n \n \n handleChange('title', event.target.value)}\n />\n \n \n { handleChange('size', event.target.value) }}\n />\n \n \n handleChange('autorange', value)}/>}\n label={autorangeDescription}\n />\n \n \n \n})\n\nWidgetScatterPlotEdit.propTypes = {\n widget: PropTypes.object\n}\n\nexport const schemaWidgetScatterPlot = schemaWidget.shape({\n x: schemaAxis.required('Quantity for the x axis is required.'),\n y: schemaAxis.required('Quantity for the y axis is required.'),\n markers: schemaMarkers,\n size: number().integer().required('Size is required.'),\n autorange: bool()\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport { number, bool, reach } from 'yup'\nimport { cloneDeep } from 'lodash'\nimport {\n TextField,\n MenuItem,\n Checkbox,\n FormControlLabel\n} from '@material-ui/core'\nimport { useSearchContext } from '../SearchContext'\nimport { InputMetainfo } from '../input/InputMetainfo'\nimport { InputTextField } from '../input/InputText'\nimport UnitInput from '../../units/UnitInput'\nimport { schemaWidget, schemaAxis, schemaAxisBase } from './Widget'\nimport { WidgetEditDialog, WidgetEditGroup, WidgetEditOption } from './WidgetEdit'\nimport { DType, parseJMESPath, setDeep, isEmptyString } from '../../../utils'\nimport { scales } from '../../plotting/common'\nimport { autorangeDescription } from './WidgetHistogram'\n\n// Predefined in order to not break memoization\nconst dtypes = new Set([DType.Float, DType.Int, DType.Timestamp])\n\n/**\n * A dialog that is used to configure a scatter plot widget.\n */\nexport const WidgetHistogramEdit = React.memo(({widget}) => {\n const { filterData, useSetWidget } = useSearchContext()\n const [settings, setSettings] = useState(cloneDeep(widget))\n const [errors, setErrors] = useState({})\n const [dimensions, setDimensions] = useState({})\n const setWidget = useSetWidget(widget.id)\n\n const handleChange = useCallback((key, value) => {\n setSettings(old => {\n const newValue = {...old}\n setDeep(newValue, key, value)\n return newValue\n })\n }, [setSettings])\n\n const handleError = useCallback((key, value) => {\n setErrors(old => ({...old, [key]: value}))\n }, [setErrors])\n\n const handleErrorQuantity = useCallback((key, value) => {\n handleError(key, value)\n setDimensions((old) => ({...old, [key]: null}))\n }, [handleError])\n\n const handleAccept = useCallback((key, value) => {\n try {\n reach(schemaWidgetHistogram, key).validateSync(value)\n } catch (e) {\n handleError(key, e.message)\n return\n }\n setErrors(old => ({...old, [key]: undefined}))\n handleChange(key, value)\n }, [handleError, handleChange])\n\n const handleAcceptQuantity = useCallback((key, value) => {\n handleAccept(key, value)\n const { quantity } = parseJMESPath(value)\n const dimension = filterData[quantity]?.dimension\n setDimensions((old) => ({...old, [key]: dimension}))\n }, [handleAccept, filterData])\n\n const handleClose = useCallback(() => {\n setWidget(old => ({...old, editing: false}))\n }, [setWidget])\n\n // Upon accepting the entire form, we perform final validation.\n const handleEditAccept = useCallback(() => {\n const independentErrors = Object.values(errors).some(x => !!x)\n if (independentErrors) return\n\n // Check for missing values. This check is required because there is no\n // value set when a new widget is created, and pressing the done button\n // without filling a value should raise an error.\n const xEmpty = isEmptyString(settings?.x?.quantity)\n if (xEmpty) {\n handleErrorQuantity('x.quantity', 'Please specify a value.')\n }\n\n if (!independentErrors && !xEmpty) {\n setWidget(old => ({...old, ...{...settings, editing: false, visible: true}}))\n }\n }, [settings, setWidget, errors, handleErrorQuantity])\n\n return \n \n \n handleChange('x.quantity', value)}\n onAccept={(value) => handleAcceptQuantity('x.quantity', value)}\n onSelect={(value) => handleAcceptQuantity('x.quantity', value)}\n onError={(value) => handleErrorQuantity('x.quantity', value)}\n dtypes={dtypes}\n dtypesRepeatable={dtypes}\n />\n \n \n handleChange('x.title', event.target.value)}\n />\n \n \n handleChange('x.unit', value)}\n onSelect={(value) => handleAccept('x.unit', value)}\n onAccept={(value) => handleAccept('x.unit', value)}\n error={errors['x.unit']}\n onError={(value) => handleError('x.unit', value)}\n dimension={dimensions['x.quantity'] || null}\n optional\n disableGroup\n />\n \n \n \n \n { handleChange('y.scale', event.target.value) }}\n >\n {Object.keys(scales).map((key) =>\n {key}\n )}\n \n \n \n \n \n handleChange('title', event.target.value)}\n />\n \n \n { handleChange('nbins', event.target.value) }}\n >\n 10\n 20\n 30\n 40\n 50\n \n \n\n \n handleChange('autorange', value)}/>}\n label={autorangeDescription}\n />\n \n \n handleChange('showinput', value)}/>}\n label='Show input fields'\n />\n \n \n \n})\n\nWidgetHistogramEdit.propTypes = {\n widget: PropTypes.object,\n onClose: PropTypes.func\n}\n\nexport const schemaWidgetHistogram = schemaWidget.shape({\n x: schemaAxis.required('X-axis configuration is required.'),\n y: schemaAxisBase.required('Y-axis configuration is required.'),\n nbins: number().integer().required(),\n autorange: bool(),\n showinput: bool()\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useState, useEffect} from 'react'\nimport PropTypes from 'prop-types'\nimport {\n Accordion,\n AccordionSummary,\n AccordionDetails,\n Typography,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n withStyles\n} from '@material-ui/core'\nimport { isArray, cloneDeep } from 'lodash'\nimport CodeIcon from '@material-ui/icons/Code'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport ExpandLessIcon from '@material-ui/icons/ExpandLess'\nimport AddCircleIcon from '@material-ui/icons/AddCircle'\nimport ReplayIcon from '@material-ui/icons/Replay'\nimport WidgetGrid from './WidgetGrid'\nimport { Actions, Action } from '../../Actions'\nimport { useSearchContext } from '../SearchContext'\nimport { WidgetScatterPlotEdit, schemaWidgetScatterPlot } from './WidgetScatterPlotEdit'\nimport { WidgetHistogramEdit, schemaWidgetHistogram } from './WidgetHistogramEdit'\nimport { WidgetTermsEdit, schemaWidgetTerms } from './WidgetTerms'\nimport { WidgetPeriodicTableEdit, schemaWidgetPeriodicTable } from './WidgetPeriodicTable'\nimport InputConfig from '../input/InputConfig'\nimport { cleanse } from '../../../utils'\nimport Markdown from '../../Markdown'\nimport { getWidgetsObject } from './Widget'\nimport { ContentButton } from '../../buttons/SourceDialogButton'\n\nconst DashboardAccordion = withStyles({\n root: {\n backgroundColor: 'transparent'\n },\n expanded: {}\n})(Accordion)\n\nconst summaryMinHeight = 40\nconst DashboardAccordionSummary = withStyles({\n root: {\n padding: 0,\n margin: 0,\n minHeight: summaryMinHeight,\n '&$expanded': {\n minHeight: summaryMinHeight\n }\n },\n content: {\n margin: 0,\n '&$expanded': {\n margin: '0'\n }\n },\n expanded: {}\n})(AccordionSummary)\n\nconst DashboardAccordionDetails = withStyles((theme) => ({\n root: {\n padding: 0,\n display: 'block'\n }\n}))(AccordionDetails)\n\n/**\n * A collapsible area that shows the currently active widgets in a grid.\n */\nconst Dashboard = React.memo(() => {\n const [expanded, setExpanded] = useState(true)\n const { useWidgetsValue, useAddWidget, useResetWidgets } = useSearchContext()\n const resetWidgets = useResetWidgets()\n const widgets = useWidgetsValue()\n const addWidget = useAddWidget()\n\n // Adds a new scatter plot widget\n const handleScatterplot = useCallback(() => {\n const index = Date.now()\n const id = index.toString()\n const layout = {x: Infinity, y: 0, w: 9, h: 6}\n const value = {\n id: id,\n editing: true,\n visible: false,\n layout: {\n sm: {...layout},\n md: {...layout},\n lg: {...layout},\n xl: {...layout},\n xxl: {...layout}\n },\n // x: {scale: 'linear'},\n // y: {scale: 'linear'},\n size: 1000,\n autorange: true,\n type: 'scatterplot'\n }\n addWidget(id, value)\n }, [addWidget])\n\n // Adds a new periodic table widget\n const handlePeriodicTable = useCallback(() => {\n const index = Date.now()\n const id = index.toString()\n const layout = {x: Infinity, y: 0, w: 12, h: 9}\n const value = {\n id: id,\n editing: true,\n visible: false,\n layout: {\n sm: {...layout},\n md: {...layout},\n lg: {...layout},\n xl: {...layout},\n xxl: {...layout}\n },\n scale: 'linear',\n quantity: 'results.material.elements',\n type: 'periodictable'\n }\n addWidget(id, value)\n }, [addWidget])\n\n // Adds a new histogram widget\n const handleHistogram = useCallback(() => {\n const index = Date.now()\n const id = index.toString()\n const layout = {x: Infinity, y: 0, w: 8, h: 3}\n const value = {\n id: id,\n editing: true,\n visible: false,\n layout: {\n sm: {...layout},\n md: {...layout},\n lg: {...layout},\n xl: {...layout},\n xxl: {...layout}\n },\n autorange: false,\n nbins: 30,\n y: {scale: 'linear'},\n type: 'histogram'\n }\n addWidget(id, value)\n }, [addWidget])\n\n // Adds a new histogram widget\n const handleTerms = useCallback(() => {\n const index = Date.now()\n const id = index.toString()\n const layout = {x: Infinity, y: 0, w: 6, h: 9}\n const value = {\n id: id,\n editing: true,\n visible: false,\n layout: {\n sm: {...layout},\n md: {...layout},\n lg: {...layout},\n xl: {...layout},\n xxl: {...layout}\n },\n scale: 'linear',\n type: 'terms'\n }\n addWidget(id, value)\n }, [addWidget])\n\n const handleExpand = useCallback(() => {\n setExpanded(old => !old)\n }, [])\n\n const handleReset = useCallback(() => {\n resetWidgets()\n }, [resetWidgets])\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n {expanded ? : }\n \n \n \n \n \n \n {widgets && Object.entries(widgets).map(([id, value]) => {\n if (!value.editing) return null\n const comp = {\n scatterplot: ,\n periodictable: ,\n histogram: ,\n terms: \n }[value.type]\n return comp || null\n })}\n \n})\n\nDashboard.propTypes = {\n}\n\nconst buttonProps = {\n variant: 'outlined',\n startIcon: \n}\nconst DashboardAction = React.memo(({title, ...rest}) => {\n return \n {title}\n \n})\nDashboardAction.propTypes = {\n title: PropTypes.string,\n children: PropTypes.node\n}\n\nconst schemas = {\n scatterplot: schemaWidgetScatterPlot,\n periodictable: schemaWidgetPeriodicTable,\n histogram: schemaWidgetHistogram,\n terms: schemaWidgetTerms\n}\n\n/**\n * A button that displays a dialog that can be used to modify the current\n * dashboard setup.\n */\nexport const DashboardExportButton = React.memo(({tooltip, title, DialogProps, ButtonProps}) => {\n const {useWidgetsState} = useSearchContext()\n const [widgets, setWidgets] = useWidgetsState()\n const [widgetExport, setWidgetExport] = useState()\n const [widgetImport, setWidgetImport] = useState()\n const [widgetImportError, setWidgetImportError] = useState(null)\n const [open, setOpen] = useState(false)\n\n // The widget export data. Only reacts if the menu is open.\n useEffect(() => {\n if (!open) return\n // Work on a copy: data in Recoil is unmutable\n const widgetsExport = cloneDeep(widgets)\n\n const exp = Object\n .values(widgetsExport)\n .map((widget) => {\n const schema = schemas[widget.type]\n const casted = schema?.cast(widget, {stripUnknown: true})\n\n // Remove undefined values. YUP cannot do this, and the YAML\n // serialization will otherwise include these.\n cleanse(casted)\n\n // Perform custom sort: type first, layout last\n const sorted = {}\n if (casted['type']) sorted['type'] = casted['type']\n const fields = new Set(['type', 'layout'])\n for (const [key, value] of Object.entries(casted)) {\n if (!fields.has(key)) {\n sorted[key] = value\n }\n }\n if (casted['layout']) sorted['layout'] = casted['layout']\n return sorted\n })\n setWidgetExport(exp)\n }, [open, widgets])\n\n // Validate new widget config\n const handleChange = useCallback((data) => {\n if (!isArray(data)) return\n let error\n for (const widget of data) {\n const type = widget.type\n const schema = schemas[type]\n if (!schema) return\n try {\n schema.validateSync(widget)\n } catch (e) {\n setWidgetImportError(e.message)\n error = e\n break\n }\n }\n if (!error) {\n setWidgetImport(data)\n setWidgetImportError(null)\n }\n }, [])\n\n // Save the dashboard setup\n const handleSave = useCallback(() => {\n if (widgetImport) {\n if (widgetImportError) return\n const widgetsInternal = getWidgetsObject(widgetImport)\n setWidgets(widgetsInternal)\n }\n setOpen(false)\n }, [widgetImportError, widgetImport, setWidgets])\n\n return }\n ButtonProps={{...ButtonProps, onClick: () => { setOpen(true) }}}\n >\n \n {title && {title}}\n \n \n \n \n \n \n \n \n \n \n})\nDashboardExportButton.propTypes = {\n label: PropTypes.string,\n title: PropTypes.string,\n tooltip: PropTypes.string,\n DialogProps: PropTypes.object,\n ButtonProps: PropTypes.object,\n children: PropTypes.node\n}\n\nexport default Dashboard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { Box } from '@material-ui/core'\nimport { makeStyles } from '@material-ui/core/styles'\nimport FilterMainMenu from './menus/FilterMainMenu'\nimport { collapsedMenuWidth } from './menus/FilterMenu'\nimport SearchBar from './SearchBar'\nimport Query from './Query.js'\nimport { SearchResults } from './SearchResults'\nimport Dashboard from './widgets/Dashboard'\nimport { useSearchContext } from './SearchContext'\n\n/**\n * The primary search interface that is reused throughout the application in\n * different contexts. Displays a menu of filters, a search bar, a list of\n * results and optionally a customizable header above the search bar.\n */\nconst useStyles = makeStyles(theme => {\n return {\n root: {\n display: 'flex',\n flexDirection: 'row',\n height: '100%',\n width: '100%'\n },\n leftColumn: {\n flexShrink: 0,\n flexGrow: 0,\n height: '100%',\n zIndex: 2\n },\n leftColumnCollapsed: {\n maxWidth: `${collapsedMenuWidth}rem`\n },\n center: {\n flexGrow: 1,\n height: '100%',\n overflowY: 'scroll'\n },\n searchBar: {\n display: 'flex',\n flexGrow: 0,\n zIndex: 1,\n marginBottom: theme.spacing(0.3)\n },\n shadow: {\n pointerEvents: 'none',\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n height: '100%',\n width: '100%',\n backgroundColor: 'black',\n transition: 'opacity 200ms',\n willChange: 'opacity',\n zIndex: 1,\n opacity: 0\n },\n shadowVisible: {\n opacity: 0.1\n }\n }\n})\n\nconst SearchPage = React.memo(({\n header\n}) => {\n const styles = useStyles()\n const {\n useIsMenuOpen,\n useSetIsMenuOpen,\n useIsCollapsed,\n useSetIsCollapsed\n } = useSearchContext()\n const [isMenuOpen, setIsMenuOpen] = [useIsMenuOpen(), useSetIsMenuOpen()]\n const [isCollapsed, setIsCollapsed] = [useIsCollapsed(), useSetIsCollapsed()]\n\n return
\n
\n \n
\n
setIsMenuOpen(false)}>\n \n \n {header}\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n})\nSearchPage.propTypes = {\n header: PropTypes.node\n}\n\nexport default SearchPage\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useMemo, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {cloneDeep} from 'lodash'\nimport {\n Chip,\n Dialog, DialogContent, IconButton, TextField, Tooltip\n} from \"@material-ui/core\"\nimport {FreeformSearchContext, useSearchContext} from \"../search/SearchContext\"\nimport {ui} from \"../../config\"\nimport DialogActions from \"@material-ui/core/DialogActions\"\nimport Button from \"@material-ui/core/Button\"\nimport SearchPage from \"../search/SearchPage\"\nimport SearchIcon from \"@material-ui/icons/Search\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\nimport {getDisplayLabel, pluralize} from \"../../utils\"\nimport Autocomplete from \"@material-ui/lab/Autocomplete\"\nimport {ItemButton, useLane} from \"../archive/Browser\"\nimport ClearIcon from \"@material-ui/icons/Clear\"\n\nconst context = cloneDeep(ui?.apps?.options?.eln)\nconst shownColumns = [\n 'entry_name',\n 'entry_type',\n 'authors',\n 'upload_name'\n]\nconst rows = context?.rows\nconst columns = (context?.columns || [])\n .map((column) => ({...column, selected: shownColumns.includes(column.quantity)}))\nrows.details = {enabled: false}\nrows.actions = {enabled: false}\n\nfunction SearchDialog({open, filters, pageSize, onCancel, onQueryChanged}) {\n const {filters: queryFilters, useFilters, useSetFilters, useResults, useApiData} = useSearchContext()\n const setFilters = useSetFilters()\n const filterValues = useFilters(queryFilters)\n const {data, setPagination} = useResults()\n const apiData = useApiData()\n\n const updateFilters = useCallback(() => {\n const newValue = {}\n for (const key in filters) {\n if (Object.hasOwnProperty.call(filters, key)) {\n newValue[key] = Array.isArray(filters[key]) || filters[key] instanceof Set ? new Set(filters[key]) : filters[key]\n }\n }\n if (setPagination && pageSize) {\n setPagination(old => {\n return {...old, page_size: pageSize}\n })\n }\n setFilters(newValue)\n }, [pageSize, setFilters, filters, setPagination])\n\n useEffect(() => {\n if (open) {\n updateFilters()\n }\n }, [updateFilters, open])\n\n const newFilters = useMemo(() => {\n const filters = {...filterValues}\n for (const key in filters) {\n if (key in filters && filters[key] === undefined) {\n delete filters[key]\n }\n }\n return filters\n }, [filterValues])\n\n const results = useMemo(() => {\n if (!data) {\n return undefined\n }\n return data.map(entry => ({entry_id: entry.entry_id, upload_id: entry.upload_id, mainfile: entry.mainfile}))\n }, [data])\n\n const handleQueryChanged = useCallback(() => {\n if (onQueryChanged) {\n onQueryChanged(newFilters, apiData, results)\n }\n }, [onQueryChanged, newFilters, apiData, results])\n\n return \n \n \n \n \n \n \n \n \n \n}\nSearchDialog.propTypes = {\n open: PropTypes.bool,\n filters: PropTypes.object,\n pageSize: PropTypes.number,\n onCancel: PropTypes.func,\n onQueryChanged: PropTypes.func\n}\n\nfunction QueryEditQuantity({quantityDef, onChange, value, storeInArchive, index, maxData}) {\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n const [open, setOpen] = useState(false)\n const lane = useLane()\n\n const filters = useMemo(() => value?.filters || {}, [value])\n\n const handleCancel = useCallback(() => {\n setOpen(false)\n }, [])\n\n const handleQueryChanged = useCallback((filters, query, results) => {\n if (onChange) {\n const newFilters = {}\n for (const key in filters) {\n if (Object.hasOwnProperty.call(filters, key)) {\n newFilters[key] = Array.isArray(filters[key]) || filters[key] instanceof Set ? [...filters[key]] : filters[key]\n }\n }\n const newValue = {\n owner: query.response.owner,\n query: query.response.query,\n pagination: query.response.pagination,\n filters: newFilters\n }\n if (storeInArchive) {\n newValue.data = results\n }\n onChange(newValue)\n }\n setOpen(false)\n }, [onChange, storeInArchive])\n\n const tags = useMemo(() => {\n let tags = []\n for (const key in filters) {\n const filterValue = filters[key]\n if (filterValue) {\n if (Array.isArray(filterValue[key])) {\n tags = tags.concat([...filterValue].map(value => ({key: key, value: value, tag: `${key}:${value}`})))\n } else {\n tags = tags.concat({key: key, value: filterValue, tag: `${key}:${filterValue}`})\n }\n }\n }\n return tags\n }, [filters])\n\n const itemKey = useMemo(() => {\n if (!isNaN(index)) {\n return `${quantityDef.name}:${index}`\n } else {\n return quantityDef.name\n }\n }, [quantityDef, index])\n\n const handleClearResults = useCallback(() => {\n if (onChange) {\n onChange(undefined)\n }\n }, [onChange])\n\n const actions = useMemo(() => {\n const actions = []\n if (value) {\n actions.push(\n \n \n \n \n \n )\n }\n actions.push( setOpen(true)}\n >\n \n \n \n )\n if (lane && value) {\n actions.push()\n }\n return actions\n }, [value, lane, handleClearResults, itemKey])\n\n return \n option.tag}\n limitTags={1}\n value={tags}\n inputValue={''}\n renderTags={(value, getTagProps) => {\n return value.map((option, index) => {\n return \n })\n }}\n renderInput={(params) => (\n 0\n ? pluralize('result', value.results.length, true)\n : \"no results\"}\n InputProps={{\n ...params.InputProps,\n endAdornment: React.cloneElement(params.InputProps.endAdornment, {}, actions)\n }}\n />\n )}\n />\n \n \n \n \n}\nQueryEditQuantity.propTypes = {\n // The quantity definition\n quantityDef: PropTypes.object,\n // The event when the searched results have been changed\n onChange: PropTypes.func,\n // The searched value\n value: PropTypes.string,\n // To store the search results in the value\n storeInArchive: PropTypes.bool,\n // The index of the quantity which repeats\n index: PropTypes.number,\n // The maximum number of searched data\n maxData: PropTypes.number\n}\n\nexport default QueryEditQuantity\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {DateEditQuantity, DateTimeEditQuantity, TimeEditQuantity} from './DateTimeEditQuantity'\nimport { StringEditQuantity, URLEditQuantity } from './StringEditQuantity'\nimport {NumberEditQuantity} from './NumberEditQuantity'\nimport {EnumEditQuantity} from './EnumEditQuantity'\nimport {AutocompleteEditQuantity} from './AutocompleteEditQuantity'\nimport {BoolEditQuantity} from './BoolEditQuantity'\nimport {ActionEditQuantity} from './ActionEditQuantity'\nimport FileEditQuantity from './FileEditQuantity'\nimport RichTextEditQuantity from './RichTextEditQuantity'\nimport ReferenceEditQuantity from './ReferenceEditQuantity'\nimport AuthorEditQuantity from './AuthorEditQuantity'\nimport { RadioEnumEditQuantity } from './RadioEnumEditQuantity'\nimport QueryEditQuantity from \"./QueryEditQuantity\"\n\nexport const editQuantityComponents = {\n NumberEditQuantity: NumberEditQuantity,\n StringEditQuantity: StringEditQuantity,\n URLEditQuantity: URLEditQuantity,\n EnumEditQuantity: EnumEditQuantity,\n SelectEnumEditQuantity: EnumEditQuantity,\n RadioEnumEditQuantity: RadioEnumEditQuantity,\n AutocompleteEditQuantity: AutocompleteEditQuantity,\n BoolEditQuantity: BoolEditQuantity,\n ActionEditQuantity: ActionEditQuantity,\n FileEditQuantity: FileEditQuantity,\n DateTimeEditQuantity: DateTimeEditQuantity,\n DateEditQuantity: DateEditQuantity,\n TimeEditQuantity: TimeEditQuantity,\n RichTextEditQuantity: RichTextEditQuantity,\n ReferenceEditQuantity: ReferenceEditQuantity,\n AuthorEditQuantity: AuthorEditQuantity,\n QueryEditQuantity: QueryEditQuantity\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useMemo, useRef, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {PropertyCard} from './PropertyCard'\nimport SectionEditor from '../../archive/SectionEditor'\nimport { useEntryStore } from '../EntryContext'\nimport {Box, IconButton, Typography, makeStyles} from '@material-ui/core'\nimport CodeIcon from '@material-ui/icons/Code'\nimport MoreIcon from '@material-ui/icons/MoreVert'\nimport { ArchiveButton } from '../../nav/Routes'\nimport {getAllVisibleProperties, SectionPlots} from '../../archive/ArchiveBrowser'\nimport Quantity, {QuantityCell, QuantityRow, QuantityTable} from '../../Quantity'\nimport {Editor} from '@tinymce/tinymce-react'\nimport { pluralize } from '../../../utils'\nimport {Matrix} from '../../archive/visualizations'\nimport { isEditable } from '../../archive/metainfo'\n\nconst useStyles = makeStyles(theme => ({\n subSection: {\n width: '100%',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center'\n },\n arrayAction: {\n padding: 0\n },\n subSectionAction: {\n },\n row: {\n display: 'flex',\n justifyContent: 'space-between'\n }\n}))\n\nexport const PropertyPreview = React.memo(({quantityDef, section}) => {\n const classes = useStyles()\n const {entryId, uploadId} = useEntryStore()\n const maxPreviewLength = 5\n if (!quantityDef.type) {\n return null\n }\n\n const shape = quantityDef.shape || []\n if (shape.length === 0) {\n if (quantityDef.m_annotations?.eln?.[0]?.component === 'RichTextEditQuantity') {\n return \n \n \n \n \n }\n return \n \n \n } else if (shape.length === 1) {\n const values = section[quantityDef.name] || []\n return \n \n \n {values.slice(0, maxPreviewLength).map((value, index) =>\n \n )}\n {values.length >= maxPreviewLength &&\n \n \n {`and ${values.length - maxPreviewLength} more ${pluralize('item', values.length - maxPreviewLength, false)}`}\n \n \n \n \n \n }\n \n \n \n } else {\n return \n \n \n \n \n ({quantityDef.shape.map((dimension, index) => \n {index > 0 &&  × }{String(dimension)}\n )} )\n \n \n \n \n }\n})\nPropertyPreview.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n section: PropTypes.object.isRequired\n}\n\nconst SectionPreview = React.memo(({sectionDef, section}) => {\n const rootRef = useRef()\n\n const allVisibleProperties = useMemo(() => getAllVisibleProperties(sectionDef), [sectionDef])\n\n return (\n
\n {\n {allVisibleProperties.map(property => (\n \n \n \n ))}\n }\n
\n )\n})\nSectionPreview.propTypes = {\n sectionDef: PropTypes.object.isRequired,\n section: PropTypes.object\n}\n\nconst SectionCard = React.memo(({archivePath, sectionDef, section, readOnly, ...props}) => {\n const {entryId, uploadId} = useEntryStore()\n const [showJson, setShowJson] = useState(false)\n\n const actions = \n setShowJson(value => !value)}>\n \n \n \n \n \n \n\n if (!sectionDef) {\n console.error('SectionCard: section definition is not available')\n return null\n }\n\n return \n {sectionDef._qualifiedName === 'nomad.parsing.tabular.Table' && (\n \n Data from a table with {section.row_refs?.length || '...'} rows.\n \n )}\n \n {(readOnly || !isEditable(sectionDef))\n ? (\n \n ) : (\n \n )}\n {(sectionDef.m_annotations?.plot || sectionDef._allBaseSections.map(section => section.name).includes('PlotSection')) && }\n \n \n})\n\nSectionCard.propTypes = {\n archivePath: PropTypes.string.isRequired,\n sectionDef: PropTypes.object.isRequired,\n section: PropTypes.object.isRequired,\n readOnly: PropTypes.bool\n}\n\nexport default SectionCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useMemo, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { Box, makeStyles } from '@material-ui/core'\nimport { useEntryStore } from '../entry/EntryContext'\nimport { extend } from 'lodash'\nimport ListEditQuantity from '../editQuantity/ListEditQuantity'\nimport InputConfig from '../search/input/InputConfig'\nimport { editQuantityComponents } from '../editQuantity/EditQuantity'\nimport { QuantityMDef } from './metainfo'\nimport {getAllVisibleProperties} from './ArchiveBrowser'\nimport {QuantityRow, QuantityTable} from '../Quantity'\nimport {PropertyPreview} from '../entry/properties/SectionCard'\n\nconst PropertyEditor = React.memo(function PropertyEditor({quantityDef, value, onChange}) {\n const editAnnotations = quantityDef.m_annotations?.eln || []\n const editAnnotation = editAnnotations[0] || {}\n const {component, props, ...moreProps} = editAnnotation\n const editComponent = component && editQuantityComponents[component]\n if (!editComponent) {\n return null\n }\n const editComponentProps = {\n quantityDef: quantityDef,\n value: value === undefined ? quantityDef.default : value,\n onChange: onChange,\n ...moreProps,\n ...(props || {})\n }\n\n const shape = quantityDef.shape || []\n if (shape.length === 0) {\n return \n {React.createElement(editComponent, editComponentProps)}\n \n } else if (shape.length === 1) {\n return \n \n \n } else {\n console.log('Unsupported quantity shape ', shape)\n return null\n }\n})\nPropertyEditor.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.any,\n onChange: PropTypes.func.isRequired\n}\n\nconst useSectionEditorStyles = makeStyles(theme => ({\n root: {\n minWidth: 600\n },\n quantityTable: {\n marginBottom: 5\n }\n}))\nconst SectionEditor = React.memo(function SectionEditor({sectionDef, section, onChange, showJson}) {\n const classes = useSectionEditorStyles()\n const {handleArchiveChanged} = useEntryStore() || {}\n const rootRef = useRef()\n\n const handleChange = useCallback((property, value) => {\n if (section[property.name] === value) {\n return\n }\n section[property.name] = value\n if (onChange) {\n onChange(section)\n }\n handleArchiveChanged()\n }, [section, onChange, handleArchiveChanged])\n\n const handleJsonChange = useCallback((data) => {\n extend(section, data)\n if (onChange) {\n onChange(section)\n }\n handleArchiveChanged()\n }, [handleArchiveChanged, onChange, section])\n\n const allVisibleProperties = useMemo(() => getAllVisibleProperties(sectionDef), [sectionDef])\n const allVisibleQuantities = useMemo(() => allVisibleProperties.filter(property => property.m_def === QuantityMDef && property.m_annotations?.eln), [allVisibleProperties])\n\n const jsonData = useMemo(() => {\n if (!showJson) {\n return null\n }\n const jsonData = {}\n allVisibleQuantities\n .filter(property => {\n // TODO this is just a hack to avoid large values, e.g. rich text with images\n const value = section[property.name]\n return !value || typeof value !== 'string' || value.length <= 1e3\n })\n .forEach(property => {\n jsonData[property.name] = section[property.name]\n })\n return jsonData\n }, [showJson, allVisibleQuantities, section])\n\n return (\n
\n {showJson\n ? (\n \n \n \n ) : (\n allVisibleQuantities.map(quantity => (\n quantity._isEditable\n ? \n handleChange(quantity, value)}\n />\n \n : \n \n \n \n \n \n \n ))\n )\n }\n
\n )\n})\nSectionEditor.propTypes = {\n sectionDef: PropTypes.object.isRequired,\n section: PropTypes.object,\n onChange: PropTypes.func,\n showJson: PropTypes.bool,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nexport default SectionEditor\n","import React, {useMemo} from 'react'\nimport {Box} from '@material-ui/core'\nimport {Quantity as Q} from '../units/Quantity'\nimport {useUnitContext} from '../units/UnitContext'\nimport {titleCase, resolveInternalRef} from '../../utils'\nimport {cloneDeep, merge} from 'lodash'\nimport Plot from '../plotting/Plot'\nimport PropTypes from 'prop-types'\nimport {withErrorHandler} from '../ErrorHandler'\n\nclass XYPlotError extends Error {\n constructor(message) {\n super(message)\n this.name = 'XYPlotError'\n }\n}\n\nconst traverse = (value, callback, parent = null, key = null) => {\n if (value && typeof value === 'object') {\n Object.entries(value).forEach(([k, v]) => {\n traverse(v, callback, value, k)\n })\n } else if (value && Array.isArray(value)) {\n value.forEach((item, index) => {\n traverse(item, callback, value, index)\n })\n } else {\n callback(parent, key, value)\n }\n}\n\nconst PlotlyFigure = React.memo(function PlotlyFigure({plot, section, sectionDef, title, metaInfoLink}) {\n const {units} = useUnitContext()\n\n const plotlyGraphObj = useMemo(() => {\n if (!sectionDef?._properties) {\n return [undefined, undefined]\n }\n\n const toUnit = path => {\n const relativePath = '/' + path.replace('./', '')\n const resolvedQuantityDef = resolveInternalRef(relativePath, sectionDef)\n if (resolvedQuantityDef === undefined || resolvedQuantityDef === null) {\n throw new XYPlotError(`Could not resolve the path ${path}`)\n }\n let value\n try {\n value = resolveInternalRef(relativePath, section)\n } catch (err) {\n if (!err.message.startsWith('Path does not exist:')) {\n throw new XYPlotError(err.message)\n }\n }\n if (value === undefined || value === null) {\n // there is not data yet\n return [undefined, undefined]\n }\n const unit = resolvedQuantityDef?.unit\n if (unit) {\n const displayUnit = resolvedQuantityDef?.m_annotations?.eln?.[0]?.defaultDisplayUnit\n const quantity = displayUnit ? new Q(value, unit).to(displayUnit) : new Q(value, unit).toSystem(units)\n return [quantity.value(), quantity.label()]\n } else {\n return [value, unit]\n }\n }\n\n /**\n * Recursively splits a path containing slice notation (`start:stop`)\n * @param {String} path The path which should be split at repeating sections\n * @param {Boolean} isScalar Whether the quantity at the end of the path is scalar\n * @returns {Array} The paths and names of the new paths\n */\n function resolveSlice(path, isScalar) {\n const pathArr = path.split('/')\n for (let i = 0; i < pathArr.length; i++) {\n const pathSection = pathArr[i]\n if (pathSection.includes(':')) {\n const repeatPath = pathArr.slice(0, i).join('/')\n const repeat = resolveInternalRef('/' + repeatPath.replace('./', ''), section)\n if (repeat === undefined) { return [[], []] }\n // Get start and stop from python slice notation\n let [start, stop, rest] = pathSection.split(':').map((x) => x === '' ? undefined : parseInt(x))\n if (Number.isNaN(start) || Number.isNaN(stop) || rest !== undefined) {\n throw new XYPlotError(`Invalid slice notation: \"${pathSection}\"`)\n }\n start = start === undefined || start < -repeat.length ? 0 : (start < 0 ? start + repeat.length : start)\n stop = stop === undefined || stop > repeat.length ? repeat.length : (stop < 0 ? stop + repeat.length : stop)\n // If there are initialized sections in this range\n if (stop > start) {\n const remainPath = pathArr.slice(i + 1).join('/')\n const allPaths = []\n const allNames = []\n for (let j = start; j < stop; j++) {\n const repeatDef = resolveInternalRef('/' + repeatPath.replace('./', '') + `/${j}/sub_section`, sectionDef)\n const label = isScalar ? undefined : (repeat[j][repeatDef?.more?.label_quantity] ?? repeat[j].name)\n const [paths, names] = resolveSlice(`${repeatPath}/${j}/${remainPath}`, isScalar)\n const subSectionName = label ?? `${titleCase(pathArr[i - 1])}${isScalar ? '' : ` ${j}`}`\n names.forEach((name) => { allNames.push(`${subSectionName}, ${name}`) })\n allPaths.push(...paths)\n }\n return [allPaths, allNames]\n }\n return [[], []]\n }\n }\n return [[path], [titleCase(pathArr[pathArr.length - 1])]]\n }\n\n /**\n * Function for getting all the paths for an array of paths that may contain slice\n * notation. The function also returns names to be used as labels if withNames is true.\n * @param {Array} slicedPaths The array of paths that may contatin slice notation\n * @param {Boolean} withNames Whether or not the functiion should return names\n * @returns Array of paths or Array of Array of paths and names\n */\n function getSlicedPaths(path, withNames) {\n const slicedPaths = Array.isArray(path) ? path : [path]\n const allPaths = []\n const Names = []\n slicedPaths.forEach((slicedPath) => {\n const pathRelative = '/' + slicedPath.replace('./', '')\n // Removes the index in the path and resolve the shape of the quantity\n const isScalar = resolveInternalRef(pathRelative.replace(/\\/-?\\d*:-?\\d*/gm, '/0') + '/shape', sectionDef)?.length === 0\n const [paths, names] = resolveSlice(pathRelative, isScalar)\n // If the quanitity is a scalar an Array of paths is added otherwise the paths are added one by one\n allPaths.push(...(isScalar ? [paths] : paths))\n if (withNames) {\n // For scalar quantities the name is taken as the first one\n Names.push(...(isScalar ? [names[0]] : names))\n }\n })\n return withNames ? [allPaths, Names] : allPaths\n }\n\n /**\n * Gets the value array, unit and split path for:\n * 1. A path to an array quanitity\n * or\n * 2. An array of paths to a scalar quantity\n * @param {*} path String path or Array of string paths\n * @returns Array of [value, unit, split path]\n */\n function getValues(path) {\n let Values = []\n let Unit = ''\n let pathArray = ''\n if (Array.isArray(path)) {\n // If path is an Array of paths the quantity is scalar and Values is build from all of them\n path.forEach((Point) => {\n const [Value, PointUnit] = toUnit(Point)\n Values.push(Value)\n Unit = PointUnit\n pathArray = Point.split('/')\n })\n } else {\n [Values, Unit] = toUnit(path)\n pathArray = path.split('/')\n }\n return [Values, Unit, pathArray]\n }\n\n const xUnits = []\n const xLabels = []\n const yUnits = []\n const yLabels = []\n const zUnits = []\n const zLabels = []\n\n const resolveReferences = (data, key, units, labels) => {\n const value = data?.[key]\n if (value && (typeof value === 'string' || value instanceof String)) {\n if (value.startsWith(\"#\")) {\n const [paths, names] = getSlicedPaths(value.slice(1), true)\n const [values, unit, path] = getValues(paths[0])\n const label = names[0] || titleCase(path[path.length - 1])\n data[key] = values\n units.push(unit)\n labels.push(label)\n }\n }\n }\n\n const plotlyGraphObj = cloneDeep(plot)\n const isDataArray = plotlyGraphObj?.data && Array.isArray(plotlyGraphObj.data)\n const dataArray = isDataArray ? plotlyGraphObj.data : [plotlyGraphObj.data]\n dataArray.forEach((data, index) => {\n resolveReferences(data, 'x', xUnits, xLabels)\n resolveReferences(data, 'y', yUnits, yLabels)\n resolveReferences(data, 'z', zUnits, zLabels)\n })\n\n traverse(plotlyGraphObj.data, (data, key, value) => {\n if (key === 'color') {\n if (typeof value === 'string' || value instanceof String) {\n if (value.startsWith(\"#\")) {\n let paths, values\n try {\n [paths] = getSlicedPaths(value.slice(1), true);\n [values] = getValues(paths[0])\n } catch (error) {\n if (value && /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(value)) {\n values = value\n } else {\n throw new XYPlotError(error)\n }\n }\n data[key] = values\n }\n }\n }\n })\n\n const layout = {}\n if (xLabels.length > 0) {\n layout.xaxis = {\n title: xUnits[0] ? `${xLabels[0]} (${xUnits[0]})` : xLabels[0]\n }\n }\n yLabels.forEach((yLabel, index) => {\n layout[index === 0 ? 'yaxis' : `yaxis${index + 1}`] = {\n title: yUnits[index] ? `${yLabel} (${yUnits[index]})` : yLabel\n }\n })\n zLabels.forEach((zLabel, index) => {\n layout[index === 0 ? 'zaxis' : `zaxis${index + 1}`] = {\n title: zUnits[index] ? `${zLabel} (${zUnits[index]})` : zLabel\n }\n })\n\n plotlyGraphObj.layout = merge({}, layout, plotlyGraphObj.layout)\n return plotlyGraphObj\n }, [plot, section, sectionDef, units])\n\n return \n \n \n})\nPlotlyFigure.propTypes = {\n plot: PropTypes.object.isRequired,\n sectionDef: PropTypes.object.isRequired,\n section: PropTypes.object,\n title: PropTypes.string,\n metaInfoLink: PropTypes.string\n}\n\nexport default withErrorHandler(\n (error) => error.name === 'XYPlotError'\n ? error.message\n : 'Could not load plot due to an unexpected error.'\n)(PlotlyFigure)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { Paper, Tooltip, IconButton } from '@material-ui/core'\nimport SearchIcon from '@material-ui/icons/Search'\nimport { useStyles } from '../search/SearchBar'\nimport { InputMetainfoControlled } from '../search/input/InputMetainfo'\n\n/**\n * This component shows a search bar with autocomplete functionality.\n */\nconst ArchiveSearchBar = React.memo(({options, group, onChange, className}) => {\n const [value, setValue] = useState(null)\n const styles = useStyles()\n\n const handleSelect = useCallback((key) => {\n const obj = options[key]\n setValue(obj?.primary)\n onChange && onChange(obj.url)\n }, [options, onChange])\n\n const handleAccept = useCallback((key) => {\n const obj = options[key]\n if (obj && onChange) onChange(obj.url)\n }, [options, onChange])\n\n return \n \n handleAccept(value)} aria-label=\"search\">\n \n \n \n }}\n />\n \n})\n\nArchiveSearchBar.propTypes = {\n options: PropTypes.objectOf(PropTypes.shape({\n primary: PropTypes.string,\n secondary: PropTypes.string,\n group: PropTypes.string,\n key: PropTypes.string,\n url: PropTypes.string\n })),\n group: PropTypes.bool,\n onChange: PropTypes.func,\n className: PropTypes.string\n}\n\nexport default ArchiveSearchBar\n","import React, {useMemo} from 'react'\nimport {Box, useTheme} from '@material-ui/core'\nimport {Quantity as Q} from '../units/Quantity'\nimport { useUnitContext } from '../units/UnitContext'\nimport {titleCase, resolveInternalRef} from '../../utils'\nimport {getLineStyles} from '../plotting/common'\nimport { merge } from 'lodash'\nimport Plot from '../plotting/Plot'\nimport PropTypes from 'prop-types'\nimport {withErrorHandler} from '../ErrorHandler'\n\nclass XYPlotError extends Error {\n constructor(message) {\n super(message)\n this.name = 'XYPlotError'\n }\n}\n\nconst XYPlot = React.memo(function XYPlot({plot, section, sectionDef, title}) {\n const theme = useTheme()\n const {units} = useUnitContext()\n const xAxis = plot.x || plot['x_axis'] || plot['xAxis']\n const yAxis = plot.y || plot['y_axis'] || plot['yAxis']\n\n const [data, layout] = useMemo(() => {\n if (!sectionDef?._properties) {\n return [undefined, undefined]\n }\n const XPrime = Array.isArray(xAxis) ? xAxis : [xAxis]\n const YPrime = Array.isArray(yAxis) ? yAxis : [yAxis]\n const toUnit = path => {\n const relativePath = '/' + path.replace('./', '')\n const resolvedQuantityDef = resolveInternalRef(relativePath, sectionDef)\n if (resolvedQuantityDef === undefined || resolvedQuantityDef === null) {\n throw new XYPlotError(`Could not resolve the path ${path}`)\n }\n let value\n try {\n value = resolveInternalRef(relativePath, section)\n } catch (err) {\n if (!err.message.startsWith('Path does not exist:')) {\n throw new XYPlotError(err.message)\n }\n }\n if (value === undefined || value === null) {\n // there is not data yet\n return [undefined, undefined]\n }\n const unit = resolvedQuantityDef?.unit\n if (unit) {\n const displayUnit = resolvedQuantityDef?.m_annotations?.eln?.[0]?.defaultDisplayUnit\n const quantity = displayUnit ? new Q(value, unit).to(displayUnit) : new Q(value, unit).toSystem(units)\n return [quantity.value(), quantity.label()]\n } else {\n return [value, unit]\n }\n }\n\n /**\n * Recursively splits a path containing slice notation (`start:stop`)\n * @param {String} path The path which should be split at repeating sections\n * @param {Boolean} isScalar Whether the quantity at the end of the path is scalar\n * @returns {Array} The paths and names of the new paths\n */\n function resolveSlice(path, isScalar) {\n const pathArr = path.split('/')\n for (let i = 0; i < pathArr.length; i++) {\n const pathSection = pathArr[i]\n if (pathSection.includes(':')) {\n const repeatPath = pathArr.slice(0, i).join('/')\n const repeat = resolveInternalRef('/' + repeatPath.replace('./', ''), section)\n if (repeat === undefined) { return [[], []] }\n // Get start and stop from python slice notation\n let [start, stop, rest] = pathSection.split(':').map((x) => x === '' ? undefined : parseInt(x))\n if (Number.isNaN(start) || Number.isNaN(stop) || rest !== undefined) {\n throw new XYPlotError(`Invalid slice notation: \"${pathSection}\"`)\n }\n start = start === undefined || start < -repeat.length ? 0 : (start < 0 ? start + repeat.length : start)\n stop = stop === undefined || stop > repeat.length ? repeat.length : (stop < 0 ? stop + repeat.length : stop)\n // If there are initialized sections in this range\n if (stop > start) {\n const remainPath = pathArr.slice(i + 1).join('/')\n const allPaths = []\n const allNames = []\n for (let j = start; j < stop; j++) {\n const repeatDef = resolveInternalRef('/' + repeatPath.replace('./', '') + `/${j}/sub_section`, sectionDef)\n const label = isScalar ? undefined : (repeat[j][repeatDef?.more?.label_quantity] ?? repeat[j].name)\n const [paths, names] = resolveSlice(`${repeatPath}/${j}/${remainPath}`, isScalar)\n const subSectionName = label ?? `${titleCase(pathArr[i - 1])}${isScalar ? '' : ` ${j}`}`\n names.forEach((name) => { allNames.push(`${subSectionName}, ${name}`) })\n allPaths.push(...paths)\n }\n return [allPaths, allNames]\n }\n return [[], []]\n }\n }\n return [[path], [titleCase(pathArr[pathArr.length - 1])]]\n }\n\n /**\n * Function for getting all the paths for an array of paths that may contain slice\n * notation. The function also returns names to be used as labels if withNames is true.\n * @param {Array} slicedPaths The array of paths that may contatin slice notation\n * @param {Boolean} withNames Whether or not the functiion should return names\n * @returns Array of paths or Array of Array of paths and names\n */\n function getSlicedPaths(slicedPaths, withNames) {\n const allPaths = []\n const Names = []\n slicedPaths.forEach((slicedPath) => {\n const pathRelative = '/' + slicedPath.replace('./', '')\n // Removes the index in the path and resolve the shape of the quantity\n const isScalar = resolveInternalRef(pathRelative.replace(/\\/-?\\d*:-?\\d*/gm, '/0') + '/shape', sectionDef)?.length === 0\n const [paths, names] = resolveSlice(pathRelative, isScalar)\n // If the quanitity is a scalar an Array of paths is added otherwise the paths are added one by one\n allPaths.push(...(isScalar ? [paths] : paths))\n if (withNames) {\n // For scalar quantities the name is taken as the first one\n Names.push(...(isScalar ? [names[0]] : names))\n }\n })\n return withNames ? [allPaths, Names] : allPaths\n }\n\n const [Y, Names] = getSlicedPaths(YPrime, true)\n const X = getSlicedPaths(XPrime, false)\n const nLines = Y.length\n\n /**\n * Gets the value array, unit and split path for:\n * 1. A path to an array quanitity\n * or\n * 2. An array of paths to a scalar quantity\n * @param {*} path String path or Array of string paths\n * @returns Array of [value, unit, split path]\n */\n function getValues(path) {\n let Values = []\n let Unit = ''\n let pathArray = ''\n if (Array.isArray(path)) {\n // If path is an Array of paths the quantity is scalar and Values is build from all of them\n path.forEach((Point) => {\n const [Value, PointUnit] = toUnit(Point)\n Values.push(Value)\n Unit = PointUnit\n pathArray = Point.split('/')\n })\n } else {\n [Values, Unit] = toUnit(path)\n pathArray = path.split('/')\n }\n return [Values, Unit, pathArray]\n }\n\n const xUnits = []\n const xLabels = []\n const xValuesArray = []\n X.forEach((x) => {\n const [xValues, xUnit, xPath] = getValues(x)\n const xLabel = titleCase(xPath[xPath.length - 1])\n xUnits.push(xUnit)\n xLabels.push(xLabel)\n xValuesArray.push(xValues)\n })\n\n const isMultiX = X.length > 1\n\n const lines = getLineStyles(nLines, theme).map(line => {\n return {type: 'scatter',\n line: line}\n })\n if (plot.lines) {\n Y.forEach((y, index) => {\n merge(lines[index], plot.lines[index])\n })\n }\n\n if (isMultiX) {\n if (X.length !== Y.length) {\n throw new XYPlotError('The length of provided x axes and y axes do not match!')\n }\n if (xUnits.some(unit => unit !== xUnits[0])) {\n throw new XYPlotError('Different units are provided for x data. Multi xAxis plot is not supported!')\n }\n }\n\n const data = []\n const yUnits = []\n const yLabels = []\n Y.forEach((y, index) => {\n const [yValues, yUnit, yPath] = getValues(y)\n // For scalar quantities the default mode is set to 'markers'\n lines[index].mode = lines[index].mode ?? (Array.isArray(y) ? 'markers' : 'lines')\n const yLabel = titleCase(yPath[yPath.length - 1])\n const line = {\n name: Names[index],\n x: isMultiX ? xValuesArray[index] : xValuesArray[0],\n y: yValues,\n ...lines[index]\n }\n data.push(line)\n yUnits.push(yUnit)\n yLabels.push(yLabel)\n })\n\n const getColor = index => {\n const line = lines[index]\n if ('mode' in line) {\n if (line.mode === 'lines') {\n return {color: line.line?.color}\n } else if (line.mode === 'markers') {\n return {color: line.marker?.color}\n }\n }\n return {color: '#000000'}\n }\n\n const sameUnit = !yUnits.some(unit => unit !== yUnits[0])\n\n const layout = {\n xaxis: {\n title: xUnits[0] ? `${xLabels[0]} (${xUnits[0]})` : xLabels[0],\n fixedrange: false\n },\n yaxis: {\n title: sameUnit ? (yUnits[0] ? `${titleCase(title)} (${yUnits[0]})` : titleCase(title)) : (yUnits[0] ? `${yLabels[0]} (${yUnits[0]})` : yLabels[0]),\n titlefont: !sameUnit && nLines > 1 ? getColor(0) : undefined,\n tickfont: !sameUnit && nLines > 1 ? getColor(0) : undefined\n },\n showlegend: sameUnit && nLines > 1,\n legend: {\n x: 1,\n y: 1,\n xanchor: 'right'\n }\n }\n\n if (!sameUnit) {\n Y.forEach((y, index) => {\n const color = getColor(index)\n if (index > 0) {\n layout[`yaxis${index + 1}`] = {\n title: yUnits[index] ? `${yLabels[index]} (${yUnits[index]})` : yLabels[index],\n anchor: index === 1 ? 'x' : 'free',\n overlaying: 'y',\n side: index % 2 === 0 ? 'left' : 'right',\n titlefont: nLines > 1 ? color : undefined,\n tickfont: nLines > 1 ? color : undefined,\n position: index % 2 === 0 ? 0.1 * index : 1.0 - 0.1 * (index - 1)\n }\n data[index]['yaxis'] = `y${index + 1}`\n }\n })\n }\n\n if (plot.layout) {\n merge(layout, plot.layout)\n }\n return [data, layout]\n }, [plot.layout, plot.lines, xAxis, yAxis, section, sectionDef, theme, title, units])\n\n return \n \n \n})\nXYPlot.propTypes = {\n plot: PropTypes.object.isRequired,\n sectionDef: PropTypes.object.isRequired,\n section: PropTypes.object,\n title: PropTypes.string\n}\n\nexport default withErrorHandler(\n (error) => error.name === 'XYPlotError'\n ? error.message\n : 'Could not load plot due to an unexpected error.'\n)(XYPlot)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport { atom, useRecoilState, useRecoilValue } from 'recoil'\nimport {\n Box, Button, Checkbox, Dialog, DialogActions, DialogContent, DialogContentText, FormControl, FormControlLabel,\n FormGroup, FormHelperText, Grid, IconButton, makeStyles, MenuItem, TextField, Tooltip, Typography\n} from '@material-ui/core'\nimport {useHistory, useRouteMatch} from 'react-router-dom'\nimport Browser, {\n Adaptor, browserContext, Compartment, Content, Item, ItemChip, laneContext, useLane\n} from './Browser'\nimport { RawFileAdaptor } from './FileBrowser'\nimport {\n AttributeMDef, getUrlFromDefinition, isEditable, isReference, PackageMDef, QuantityMDef, quantityUsesFullStorage,\n removeSubSection, SectionMDef, SubSectionMDef, useMetainfo\n} from './metainfo'\nimport { ArchiveTitle, DefinitionLabel, metainfoAdaptorFactory } from './MetainfoBrowser'\nimport { Matrix, Number } from './visualizations'\nimport Markdown from '../Markdown'\nimport { Overview } from './Overview'\nimport { Quantity as Q } from '../units/Quantity'\nimport ArrowRightIcon from '@material-ui/icons/ArrowRight'\nimport ArrowDownIcon from '@material-ui/icons/ArrowDropDown'\nimport DownloadIcon from '@material-ui/icons/CloudDownload'\nimport SaveIcon from '@material-ui/icons/Save'\nimport AddIcon from '@material-ui/icons/AddCircle'\nimport CodeIcon from '@material-ui/icons/Code'\nimport DeleteIcon from '@material-ui/icons/Delete'\nimport grey from '@material-ui/core/colors/grey'\nimport classNames from 'classnames'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport { SourceApiCall, SourceApiDialogButton, SourceJsonDialogButton } from '../buttons/SourceDialogButton'\nimport { Download } from '../entry/Download'\nimport Pagination from '../visualization/Pagination'\nimport SectionEditor from './SectionEditor'\nimport PlotlyFigure from './PlotlyFigure'\nimport {\n appendDataUrl, createEntryUrl, createUploadUrl, formatTimestamp, parseNomadUrl, refType, resolveInternalRef,\n resolveNomadUrl, systemMetainfoUrl, titleCase, isWaitingForUpdateTestId, resolveNomadUrlNoThrow, getOptions,\n getDisplayLabel\n} from '../../utils'\nimport { EntryButton } from '../nav/Routes'\nimport NavigateIcon from '@material-ui/icons/ArrowForward'\nimport ReloadIcon from '@material-ui/icons/Replay'\nimport UploadIcon from '@material-ui/icons/CloudUpload'\nimport {apiBase} from '../../config'\nimport { Alert } from '@material-ui/lab'\nimport { complex, format } from 'mathjs'\nimport ReactJson from 'react-json-view'\nimport { range, isNaN, partition, isArray } from 'lodash'\nimport { useDataStore, useEntryStoreObj } from '../DataStore'\nimport { useEntryStore } from '../entry/EntryContext'\nimport ArchiveSearchBar from './ArchiveSearchBar'\nimport DOMPurify from 'dompurify'\nimport XYPlot from \"./XYPlot\"\nimport { useDisplayUnit } from '../units/useDisplayUnit'\nimport H5Web from '../visualization/H5Web'\n\nexport const configState = atom({\n key: 'config',\n default: {\n 'showMeta': false,\n 'showCodeSpecific': false,\n 'showAllDefined': false\n }\n})\n\nconst ArchiveBrowser = React.memo(function ArchiveBrowser({url}) {\n const parsedUrl = useMemo(() => parseNomadUrl(url), [url])\n const {archive, metadata} = useEntryStoreObj(parsedUrl.deploymentUrl, parsedUrl.entryId, false, '*')\n const metainfo = useMetainfo(systemMetainfoUrl)\n const dataStore = useDataStore()\n const [searchOptions, setSearchOptions] = useState({})\n const rootSectionDef = metainfo ? metainfo.getEntryArchiveDefinition() : null\n\n useEffect(() => {\n if (!metainfo) return\n let isSubscribed = true\n archiveSearchOptions(archive, metainfo, metadata, dataStore).then((options) => {\n isSubscribed && setSearchOptions(options)\n })\n return () => {\n isSubscribed = false\n }\n }, [archive, metainfo, metadata, dataStore])\n\n const adaptor = useMemo(() => {\n if (!archive || !rootSectionDef) {\n return null\n }\n return archiveAdaptorFactory(url, archive, rootSectionDef)\n }, [url, archive, rootSectionDef])\n\n if (!adaptor) {\n return null\n }\n\n // For some reason, this hook does not work in all of the components used in\n // the Browser (notably: Quantity, QuantityItemPreview). In order to pass the\n // up-to-date unit information, we pass the hook value down the component\n // hierarchy.\n return (\n }\n />\n )\n})\nArchiveBrowser.propTypes = ({\n url: PropTypes.string.isRequired\n})\nexport default ArchiveBrowser\n\nexport const ArchiveSaveButton = React.memo(function ArchiveSaveButton(props) {\n const {editable, archiveHasChanges, saveArchive, reload} = useEntryStore()\n const [openErrorDialog, setOpenErrorDialog] = useState(false)\n const [disabled, setDisabled] = useState(false)\n\n const handleClick = useCallback(() => {\n saveArchive().catch(error => {\n if (error?.status === 409) {\n setOpenErrorDialog(true)\n setDisabled(true)\n }\n })\n }, [saveArchive])\n\n const handleReload = useCallback(() => {\n reload()\n setOpenErrorDialog(false)\n setDisabled(false)\n }, [reload])\n\n return \n {editable &&\n \n \n \n \n \n }\n \n \n \n The changes cannot be saved. The content has been modified by someone else.\n \n \n \n \n \n \n \n \n})\n\nexport const ArchiveReloadButton = React.memo(function ArchiveReloadButton(props) {\n const {reload} = useEntryStore()\n\n return \n \n \n \n \n \n \n})\n\nconst useStyles = makeStyles(theme => {\n return {\n container: {\n alignItems: 'center',\n flexWrap: 'nowrap'\n },\n searchBar: {\n width: 750,\n marginRight: theme.spacing(1)\n }\n }\n})\n\nconst ArchiveConfigForm = React.memo(function ArchiveConfigForm({searchOptions, data}) {\n const styles = useStyles()\n const [config, setConfig] = useRecoilState(configState)\n const history = useHistory()\n const { url } = useRouteMatch()\n\n const handleConfigChange = event => {\n const changes = {[event.target.name]: event.target.checked}\n if (changes.showCodeSpecific) {\n changes.showAllDefined = !changes.showCodeSpecific\n } else if (changes.showAllDefined) {\n changes.showCodeSpecific = !changes.showAllDefined\n }\n setConfig({...config, ...changes})\n }\n\n const entryId = data?.metadata?.entry_id\n\n const handleChange = useCallback((path) => {\n if (path) {\n history.push(url + path)\n }\n }, [history, url])\n\n return (\n \n \n \n \n \n \n }\n label=\"code specific\"\n />\n \n \n \n }\n label=\"all defined\"\n />\n \n \n \n }\n label=\"technical view\"\n />\n \n {entryId && \n \n }\n \n \n \n \n \n \n \n )\n})\nArchiveConfigForm.propTypes = ({\n data: PropTypes.object.isRequired,\n searchOptions: PropTypes.object.isRequired\n})\n\nexport const ArchiveReUploadButton = React.memo((props) => {\n const {uploadId, metadata, reload} = useEntryStore()\n const {api} = useApi()\n const {raiseError} = useErrors()\n\n const handleClick = useCallback((files) => {\n const input = document.createElement('input')\n input.type = 'file'\n input.onchange = (event) => {\n const file = event.target.files[0]\n if (!file) {\n return\n }\n const formData = new FormData() // eslint-disable-line no-undef\n formData.set('file', file, metadata.entry_name)\n api.put(`uploads/${uploadId}/raw/?wait_for_processing=true`, formData)\n .then(() => {\n reload()\n })\n .catch(raiseError)\n }\n\n input.click()\n }, [api, metadata?.entry_name, raiseError, reload, uploadId])\n\n return \n \n \n \n \n})\n\nexport function archiveAdaptorFactory(archiveRootUrl, archiveRootObj, rootSectionDef) {\n return new SectionAdaptor(archiveRootUrl, archiveRootObj, rootSectionDef)\n}\n\nasync function archiveSearchOptions(data, metainfo, metadata, dataStore) {\n const options = {}\n\n async function traverse(data, sectionDef, parentName, parentPath) {\n let def = sectionDef\n if (data?.m_def) {\n const m_def = data.m_def\n if (def._qualifiedName === 'nomad.datamodel.data.EntryData' || def._qualifiedName === 'nomad.datamodel.datamodel.EntryArchiveReference') {\n const url = metadata.upload_id && metadata.entry_id ? `${apiBase}/uploads/${metadata.upload_id}/archive/${metadata.entry_id}` : undefined\n const sectionDefUrl = resolveNomadUrlNoThrow(m_def, url)\n def = await dataStore.getMetainfoDefAsync(sectionDefUrl)\n }\n }\n\n for (const key in data) {\n const childDef = def?._properties?.[key]\n if (!childDef) {\n continue\n }\n\n if (key === \"quantities\" || key === \"base_sections\" || key === \"sub_sections\" || key === 'processing_logs') {\n continue\n }\n\n if (!(key in data)) {\n continue\n }\n\n const child = data[key]\n\n if (child === undefined) {\n continue\n }\n\n const isSectionDefinitions = key === 'section_definitions'\n const path = parentPath ? (isSectionDefinitions ? parentPath : `${parentPath}/${key}`) : `/${key}`\n const name = parentName ? `${parentName}.${childDef.name}` : childDef.name\n\n const value = child\n let secondary = childDef?.m_def || ''\n if (typeof value !== 'object' && !Array.isArray(value) && value !== null) {\n secondary = `${value}`\n }\n const pathSections = path.split('/')\n const group = pathSections[0] || pathSections[1]\n options[name] = {\n key: name,\n primary: name,\n secondary: secondary,\n group: group,\n data: data,\n def: childDef,\n url: path\n }\n\n if (childDef.m_def === SubSectionMDef) {\n const sectionDef = childDef.sub_section\n if (Array.isArray(child) && child.length > 0 && child[0]) {\n if (child.length > 1) {\n for (const [index, value] of child.entries()) {\n await traverse(value, sectionDef, isSectionDefinitions ? `${name}.${value.name}` : name, isSectionDefinitions ? `${path}/${value.name}` : `${path}/${index}`)\n }\n } else {\n await traverse(child[0], sectionDef, name, path)\n }\n } else {\n await traverse(child, sectionDef, name, path)\n }\n }\n }\n }\n\n await traverse(data, metainfo.getEntryArchiveDefinition(), null, null)\n return new Promise((resolve, reject) => {\n resolve(options)\n })\n}\n\nclass ArchiveAdaptor extends Adaptor {\n /**\n * @param {*} objUrl An absolute url (string or a parsed url object), identifying a location in some archive.\n * @param {*} obj The data that objUrl points to = a location in some archive.\n * @param {*} def The metainfo definition of obj\n */\n constructor(objUrl, obj, def, property, isInEln) {\n super()\n this.objUrl = objUrl\n this.parsedObjUrl = parseNomadUrl(objUrl)\n if (!this.parsedObjUrl.isResolved) throw new Error(`Resolved url is required, got ${objUrl}`)\n if (this.parsedObjUrl.type !== refType.archive) throw new Error(`Bad url type, expected entry url, got ${objUrl}`)\n // Will be set when initializing the adaptor\n this.api = undefined\n this.dataStore = undefined\n this.entryIsEditable = undefined\n this.isInEln = isInEln === undefined && def.m_def === SectionMDef ? isEditable(def) : isInEln\n this.obj = obj // The data in the archive tree to display\n this.def = def\n this.property = property\n this.external_refs = {}\n }\n\n async initialize(api, dataStore) {\n this.api = api\n this.dataStore = dataStore\n const {editable} = await dataStore.getEntryAsync(\n this.parsedObjUrl.deploymentUrl, this.parsedObjUrl.entryId, false, '*')\n this.entryIsEditable = editable\n }\n\n async adaptorFactory(objUrl, obj, property) {\n let def = property\n if (property.m_def === SubSectionMDef) {\n def = property.sub_section\n }\n\n if (obj.m_def === PackageMDef) {\n // We're viewing an archive which contains metainfo definitions, and open the definitions node\n const metainfo = await this.dataStore.getMetainfoAsync(objUrl)\n return metainfoAdaptorFactory(metainfo._data.definitions)\n }\n\n if (def.m_def === SectionMDef) {\n if (obj.m_def) {\n // Override the def given by the schema with the potentially more specific\n // def given by the data\n const ref = obj.m_def_id ? `${obj.m_def}@${obj.m_def_id}` : obj.m_def\n const newDefUrl = resolveNomadUrl(ref, objUrl)\n def = await this.dataStore.getMetainfoDefAsync(newDefUrl)\n }\n const isInEln = this.isInEln || isEditable(def)\n return new SectionAdaptor(objUrl, obj, def, property, isInEln)\n }\n\n if (def.m_def === QuantityMDef) {\n if (def.type.type_kind === 'reference') {\n // Should only happen if the reference encountered has not been resolved, which can\n // happen if the reference is invalid or if it is of a type which we have no handler for.\n return new UnresolvedReferenceAdaptor(objUrl, obj, def)\n }\n\n return new QuantityAdaptor(objUrl, obj, def)\n }\n\n if (def.m_def === AttributeMDef) {\n return new AttributeAdaptor(objUrl, obj, def)\n }\n\n throw new Error('not implemented')\n }\n\n async itemAdaptor(key) {\n if (key === '_metainfo') {\n return metainfoAdaptorFactory(this.def)\n }\n\n if (key === '_subsectionmetainfo') {\n return metainfoAdaptorFactory(this.property)\n }\n\n if (key.startsWith('_external_ref')) {\n const ref = this.external_refs[key]\n if (!ref) return null\n\n const refUrl = createEntryUrl(apiBase, ref.upload_id, ref.entry_id)\n const {archive} = await this.dataStore.getEntryAsync(apiBase, ref.entry_id, false, '*')\n const metainfo = await this.dataStore.getMetainfoAsync(systemMetainfoUrl)\n const rootSectionDef = metainfo.getEntryArchiveDefinition()\n return this.adaptorFactory(refUrl, archive, rootSectionDef)\n }\n\n throw new Error('Unknown item key')\n }\n}\n\nclass SectionAdaptor extends ArchiveAdaptor {\n async itemAdaptor(key) {\n let [name, index] = key.split(':')\n let urlSuffix = index ? `${name}/${index}` : name\n const property = this.def._properties[name] || (name === 'm_attributes' && this.def.attributes.find(attr => attr.name === index))\n let value = this.obj[name] === undefined || this.obj[name] === null ? property?.default : this.obj[name]\n const text_index = index\n index = parseInt(index)\n index = isNaN(index) ? text_index : index\n if (index < 0) index = index + value.length\n if (property.m_def === QuantityMDef && quantityUsesFullStorage(property)) {\n value = value[index]\n }\n if (!property) {\n return super.itemAdaptor(key)\n } else if (property.m_def === SubSectionMDef) {\n let subSectionAdaptor\n let subSectionIndex = -1\n if (property.repeats) {\n subSectionIndex = index || 0\n subSectionAdaptor = await this.adaptorFactory(\n appendDataUrl(this.parsedObjUrl, `${name}/${subSectionIndex}`), value[subSectionIndex], property)\n } else {\n subSectionAdaptor = await this.adaptorFactory(\n appendDataUrl(this.parsedObjUrl, name), value, property)\n }\n subSectionAdaptor.parentRelation = {\n parent: this.obj,\n subSectionDef: property,\n subSectionIndex: subSectionIndex\n }\n return subSectionAdaptor\n } else if (property.m_def === QuantityMDef) {\n // References: sections and quantities\n if (isReference(property)) {\n let reference = null\n if (property.shape.length === 0) {\n reference = value\n urlSuffix = name\n } else if (property.shape.length === 1) {\n const indexStr = key.split(':')[1]\n const index = parseInt(indexStr)\n reference = value[index]\n urlSuffix = `${name}/${index}`\n }\n if (!reference) {\n return this.adaptorFactory(\n appendDataUrl(this.parsedObjUrl, urlSuffix), value, property)\n }\n try {\n const resolvedUrl = resolveNomadUrl(reference, this.parsedObjUrl)\n if (resolvedUrl.type === refType.archive) {\n const {archive} = await this.dataStore.getEntryAsync(resolvedUrl.deploymentUrl, resolvedUrl.entryId, false, '*')\n const resolvedObj = resolveInternalRef('/' + (resolvedUrl.path || ''), archive)\n let resolvedDef\n if (resolvedObj.m_def) {\n // the custom definition is present anyway\n resolvedDef = property.type._referencedDefinition\n } else {\n // We need to traverse the data and primarily use definition from\n // the data (m_def), or alternatively load the definition from the\n // metainfo\n let iData = archive\n const metainfo = await this.dataStore.getMetainfoAsync(systemMetainfoUrl)\n let iDef = metainfo.getEntryArchiveDefinition()\n let iSection = 0\n try {\n for (const item of resolvedUrl.path.split('/')) {\n // Section numbers are stored\n if (item.match(/^-?\\d+$/) || item === '') {\n iSection = parseInt(item)\n continue\n }\n // If the archive has an m_def, use it\n iData = iData[isArray(iData) ? iSection : item]\n if (iData?.m_def) {\n iDef = await metainfo.resolveDefinition(iData.m_def)\n // Otherwise use the definition loaded from the parent section\n } else {\n iDef = iDef._properties[item]\n if (iDef.sub_section) iDef = iDef.sub_section\n }\n }\n resolvedDef = iDef\n // If something goes wrong with the definition resolution, fall\n // back to the type specified in the reference definition.\n } catch {\n resolvedDef = property.type._referencedDefinition\n }\n }\n return this.adaptorFactory(resolvedUrl, resolvedObj, resolvedDef)\n }\n throw new Error('Unhandled reference type')\n } catch (error) {\n // some sections cannot be resolved, because they are not part of the archive\n // user_id->user is one example\n return this.adaptorFactory(\n appendDataUrl(this.parsedObjUrl, urlSuffix), reference, property)\n }\n }\n // Regular quantities\n if (property.m_annotations?.browser) {\n if (property.m_annotations.browser[0].adaptor === 'RawFileAdaptor') {\n const deploymentUrl = this.parsedObjUrl.deploymentUrl\n const uploadId = this.parsedObjUrl.uploadId\n const path = this.obj[property.name]\n const uploadUrl = createUploadUrl(deploymentUrl, uploadId, path, index)\n return new RawFileAdaptor(uploadUrl, null, false)\n }\n }\n return this.adaptorFactory(appendDataUrl(this.parsedObjUrl, urlSuffix), value, property)\n } else if (property.m_def === AttributeMDef) {\n return this.adaptorFactory(\n appendDataUrl(this.parsedObjUrl, `m_attributes/${index}`),\n this.obj?.m_attributes[index],\n property)\n } else {\n throw new Error('Unknown metainfo meta definition')\n }\n }\n\n render() {\n return \n }\n}\n\nclass UnresolvedReferenceAdaptor extends ArchiveAdaptor {\n render() {\n return \n }\n}\n\nclass QuantityAdaptor extends ArchiveAdaptor {\n async itemAdaptor(key) {\n const attribute = this.def?.attributes?.find(attr => attr.name === key)\n if (attribute) {\n const value = this.obj?.m_attributes?.[key]\n return await this.adaptorFactory(\n appendDataUrl(this.parsedObjUrl, `m_attributes/${key}`),\n value,\n attribute)\n }\n\n return super.itemAdaptor(key)\n }\n\n render() {\n if (quantityUsesFullStorage(this.def)) {\n return \n } else {\n return \n }\n }\n}\n\nclass AttributeAdaptor extends ArchiveAdaptor {\n render() {\n return \n }\n}\n\nconst convertComplexArray = (real, imag) => {\n return Array.isArray(real)\n ? real.map((r, i) => convertComplexArray(r, imag[i]))\n : format(complex(real, imag), {notation: 'auto', precision: 4, lowerExp: -999, upperExp: 999})\n}\n\nexport function QuantityItemPreview({value, def}) {\n const displayUnit = useDisplayUnit(def)\n\n if (isReference(def)) {\n return \n reference ...\n \n }\n if (def.m_annotations?.browser?.[0]?.render_value === 'HtmlValue' || def.m_annotations?.eln?.[0]?.component === 'RichTextEditQuantity') {\n return \n rich text\n \n }\n if (def.type.type_data === 'nomad.metainfo.metainfo._JSON' || def.type.type_data === 'nomad.metainfo.data_type.JSON') {\n return \n JSON data\n \n }\n if (def.type.type_data === 'nomad.datamodel.hdf5.HDF5Dataset' || def.type.type_data === 'nomad.datamodel.hdf5.HDF5Reference') {\n return \n HDF5 array\n \n }\n if (def.shape.length > 0) {\n const dimensions = []\n let typeLabel = 'unknown'\n try {\n let current = value.re || value.im || value\n for (let i = 0; i < def.shape.length; i++) {\n dimensions.push(current.length)\n current = current[0]\n }\n if (def.type.type_kind === 'python') {\n typeLabel = 'list'\n } else if (typeof value === 'string') {\n typeLabel = 'HDF5 array'\n dimensions.length = 0\n } else {\n if (dimensions.length === 1) {\n typeLabel = 'vector'\n } else if (dimensions.length === 2) {\n typeLabel = 'matrix'\n } else {\n typeLabel = 'tensor'\n }\n }\n } catch (e) {\n console.error('Quantity shape did not fit quantity value.', e)\n }\n return \n \n {dimensions.map((dimension, index) => (\n \n {index > 0 &&  × }{String(dimension)}\n \n ))} {typeLabel}\n \n \n } else {\n let finalValue\n if (def.type.type_data === 'nomad.metainfo.metainfo._Datetime' || def.type.type_data === 'nomad.metainfo.data_type.Datetime') {\n finalValue = formatTimestamp(value)\n } else if (def.type.type_data.startsWith?.('complex')) {\n finalValue = convertComplexArray(value.re, value.im)\n } else {\n finalValue = value\n }\n\n if (displayUnit) {\n finalValue = new Q(finalValue, def.unit).to(displayUnit).value()\n }\n return \n \n {displayUnit &&  {displayUnit.label()}}\n \n }\n}\n\nQuantityItemPreview.propTypes = ({\n value: PropTypes.any,\n def: PropTypes.object.isRequired\n})\n\nexport const QuantityValue = React.memo(function QuantityValue({value, def}) {\n const {uploadId} = useEntryStore() || {}\n const displayUnit = useDisplayUnit(def)\n\n const getRenderValue = useCallback(value => {\n let finalValue\n if (def.type.type_data === 'nomad.metainfo.metainfo._Datetime' || def.type.type_data === 'nomad.metainfo.data_type.Datetime') {\n finalValue = formatTimestamp(value)\n } else if (def.type.type_data.startsWith?.('complex')) {\n finalValue = convertComplexArray(value.re, value.im)\n } else {\n finalValue = value\n }\n let finalUnit\n if (def.unit && typeof finalValue !== 'string') {\n const systemUnitQ = new Q(finalValue, def.unit).to(displayUnit)\n finalValue = systemUnitQ.value()\n finalUnit = systemUnitQ.label()\n }\n return [finalValue, finalUnit]\n }, [def, displayUnit])\n\n const isMathValue = (def.type.type_kind === 'numpy' || def.type.type_kind === 'python') && typeof value !== 'string'\n if (isMathValue) {\n const [finalValue, finalUnit] = getRenderValue(value)\n if (def.shape.length > 0) {\n return \n \n \n ({def.shape.map((dimension, index) => \n {index > 0 &&  × }{String(dimension)}\n )})\n \n {finalUnit && {finalUnit}}\n \n } else {\n return \n }\n } else if (def.m_annotations?.browser?.[0]?.render_value === 'HtmlValue' || def.m_annotations?.eln?.[0]?.component === 'RichTextEditQuantity') {\n const html = DOMPurify.sanitize(value)\n return
\n } else if (def.type?.type_data === 'nomad.metainfo.metainfo._JSON' || def.type?.type_data === 'nomad.metainfo.data_type.JSON') {\n return \n } else {\n if (def.type.type_data.startsWith?.('complex')) {\n value = convertComplexArray(value.re, value.im)\n\n return Array.isArray(value)\n ?
    \n {value.map((value, index) =>
  • {value}
  • )}\n
\n : {value}\n } else if (Array.isArray(value)) {\n return
    \n {value.map((value, index) => {\n const [finalValue] = getRenderValue(value)\n return
  • \n {typeof finalValue === 'object' ? JSON.stringify(finalValue) : finalValue?.toString()}\n
  • \n })}\n
\n } else if (def.type?.type_data === 'nomad.datamodel.hdf5.HDF5Dataset' || def.type?.type_data === 'nomad.datamodel.hdf5.HDF5Reference') {\n const h5Path = value.match(/(?:\\/uploads\\/(?.+?)\\/(?.+?)\\/)*(?.+?)#(?.+)/)\n const h5UploadId = h5Path.groups.uploadId || uploadId\n const h5File = h5Path.groups.filename\n const h5Source = h5Path.groups.source || ((h5File.endsWith('.h5') || h5File.endsWith('.nxs')) ? 'raw' : 'archive')\n return \n \n \n } else if (def?.type?.type_kind === 'custom' && def?.type?.type_data === 'nomad.datamodel.data.Query') {\n return \n } else {\n const [finalValue] = getRenderValue(value)\n return {typeof finalValue === 'object' ? JSON.stringify(finalValue) : finalValue?.toString()}\n }\n }\n})\nQuantityValue.propTypes = ({\n value: PropTypes.any,\n def: PropTypes.object.isRequired,\n unit: PropTypes.string\n})\n\nconst InheritingSections = React.memo(function InheritingSections({def, section, lane}) {\n const dataStore = useDataStore()\n const browser = useContext(browserContext)\n const originalInheritingSectionsRef = useRef([def, ...dataStore.getAllInheritingSections(def)])\n\n const currentInheritingSections = useMemo(() => {\n return [def, ...dataStore.getAllInheritingSections(def)]\n }, [dataStore, def])\n\n const getSelectionValue = useCallback((def) => {\n return getUrlFromDefinition(def, {deploymentUrl: apiBase}, true)\n }, [])\n\n const validSections = useMemo(() => {\n const sectionsToSort = section.m_def\n ? currentInheritingSections\n : originalInheritingSectionsRef.current\n return [...sectionsToSort]\n .sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }))\n }, [currentInheritingSections, section.m_def])\n const showSelection = validSections.length > 1\n\n const handleInheritingSectionsChange = useCallback((e) => {\n if (Object.keys(section).filter(key => key !== 'm_def').length !== 0) {\n if (!currentInheritingSections.includes(e.target.value)) {\n // TODO show alert dialog\n return\n }\n }\n section.m_def = e.target.value\n browser.invalidateLanesFromIndex(lane.index)\n }, [section, browser, lane, currentInheritingSections])\n\n if (!showSelection) {\n return null\n }\n\n return (\n \n \n Multiple specific sections are available\n \n {validSections.map((inheritingSection, i) => {\n const sectionValue = getSelectionValue(inheritingSection)\n return (\n \n {inheritingSection.name}\n \n )\n })}\n \n \n \n )\n})\nInheritingSections.propTypes = ({\n section: PropTypes.object.isRequired,\n def: PropTypes.object.isRequired,\n lane: PropTypes.object\n})\n\nexport function getAllVisibleProperties(sectionDef) {\n const properties = sectionDef?.m_annotations?.eln?.[0]?.properties\n const hide = sectionDef?.m_annotations?.eln?.[0]?.hide || []\n const allProperties = sectionDef._allProperties?.map(property => property.name)\n const visible = getOptions(properties?.visible, allProperties)\n const editable = getOptions(properties?.editable, allProperties)\n let filteredProperties = sectionDef._allProperties\n filteredProperties = filteredProperties.filter(property => visible.includes(property.name))\n filteredProperties = filteredProperties.filter(property => !hide.includes(property.name))\n const order = properties?.order || []\n const visibleProperties = filteredProperties.map(property => ({...property, _isEditable: editable.includes(property.name)}))\n const reversedOrder = [...order].reverse()\n visibleProperties.sort((a, b) => reversedOrder.indexOf(b.name) - reversedOrder.indexOf(a.name) || a.m_parent_index - b.m_parent_index)\n const quantities = visibleProperties.filter(property => property.m_parent_sub_section === \"quantities\")\n const sub_sections = visibleProperties.filter(property => property.m_parent_sub_section === \"sub_sections\")\n return [...quantities, ...sub_sections]\n}\n\nexport function Section({section, def, property, parentRelation, sectionIsEditable, sectionIsInEln}) {\n const {handleArchiveChanged, uploadId, entryId} = useEntryStore() || {}\n const config = useRecoilValue(configState)\n const [showJson, setShowJson] = useState(false)\n const lane = useContext(laneContext)\n const history = useHistory()\n\n const isEditable = useMemo(() => {\n let editableExcluded = false\n let parent = def?._parent\n let name = def?.name\n while (!editableExcluded && parent) {\n const properties = parent.m_annotations?.eln?.[0]?.properties\n if (properties && parent._allProperties) {\n const allProperties = parent._allProperties.map(property => property.name)\n const editable = getOptions(properties?.editable, allProperties)\n const excluded = allProperties.filter(propertyName => !editable.includes(propertyName))\n editableExcluded = excluded.some(item => item.toLowerCase() === name.toLowerCase())\n }\n name = parent.name\n parent = parent._parent\n }\n return sectionIsEditable && !editableExcluded\n }, [def, sectionIsEditable])\n\n const navEntryId = useMemo(() => {\n return lane?.adaptor?.parsedObjUrl?.entryId\n }, [lane])\n\n const actions = useMemo(() => {\n const navButton = navEntryId && (\n \n \n \n \n \n )\n\n const jsonButton = !isEditable ? (\n \n \n \n ) : (\n \n setShowJson(value => !value)} size=\"small\">\n \n \n \n )\n\n const handleDelete = () => {\n removeSubSection(\n parentRelation.parent,\n parentRelation.subSectionDef,\n parentRelation.subSectionIndex)\n handleArchiveChanged()\n history.push(lane.prev.path)\n }\n\n const deleteButton = isEditable && (\n \n \n \n \n \n )\n\n return \n {navButton}{jsonButton}{deleteButton}\n \n }, [navEntryId, setShowJson, isEditable, parentRelation, lane, history, handleArchiveChanged, section])\n\n const renderQuantityItem = useCallback((key, quantityName, quantityDef, value, disabled) => {\n const itemKey = quantityName ? `${key}:${quantityName}` : key\n const isDefault = value !== undefined && value !== null && (section[key] === undefined || section[key] === null)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n return (\n \n \n \n \n \n {quantityName || label}\n \n {!disabled &&\n  = \n \n \n }\n \n {isDefault && }\n \n \n )\n }, [config?.showMeta, section])\n\n const renderQuantity = useCallback(quantityDef => {\n const key = quantityDef.name\n const value = section[key] === undefined || section[key] === null ? quantityDef.default : section[key]\n const disabled = value === undefined\n if (!disabled && quantityDef.type.type_kind === 'reference' && quantityDef.shape.length === 1) {\n return \n }\n if (quantityUsesFullStorage(quantityDef)) {\n const storage = section[quantityDef.name] || {}\n return \n {Object.keys(storage).map(quantityName =>\n renderQuantityItem(key, quantityName, quantityDef, storage[quantityName]?.m_value, disabled)\n )}\n \n } else {\n return renderQuantityItem(key, null, quantityDef, value, disabled)\n }\n }, [section, renderQuantityItem])\n\n const allVisibleProperties = useMemo(() => getAllVisibleProperties(def), [def])\n\n if (!section) {\n console.error('section is not available')\n return null\n }\n\n const filter = config.showCodeSpecific ? def => !def.virtual : def => !def.virtual && !def.name.startsWith('x_')\n let sub_sections = allVisibleProperties.filter(prop => prop.m_def === SubSectionMDef)\n if (def.name === 'EntryArchive') {\n // put the most abstract data (last added data) first, e.g. results, metadata, workflow, run\n sub_sections = [...def.sub_sections]\n sub_sections.reverse()\n }\n const quantities = allVisibleProperties.filter(prop => prop.m_def === QuantityMDef)\n\n const subSectionsToRender = sub_sections\n .filter(subSectionDef => section[subSectionDef.name] || config.showAllDefined || isEditable)\n .filter(filter)\n const subSectionCompartment = (\n \n {subSectionsToRender\n .map(subSectionDef => {\n return \n })\n }\n \n )\n\n let contents\n if (isEditable) {\n contents = \n {quantities.length > 0 && (\n \n \n \n {quantities\n .filter(filter)\n .filter(quantityDef => !quantityDef.m_annotations?.eln?.[0]?.component)\n .map(renderQuantity)\n }\n \n \n )}\n {subSectionCompartment}\n {(def.m_annotations?.plot || def._allBaseSections.map(section => section.name).includes('PlotSection')) && }\n \n } else {\n const attributes = section?.m_attributes || {}\n contents = \n \n {quantities\n .filter(quantityDef => section[quantityDef.name] !== undefined || config.showAllDefined || sectionIsInEln)\n .filter(filter)\n .map(renderQuantity)\n }\n \n {subSectionCompartment}\n {Object.keys(attributes).length > 0 && \n {Object.keys(attributes).map(key => (\n {key}\n ))}\n }\n {(def.m_annotations?.plot || def._allBaseSections.map(section => section.name).includes('PlotSection')) && }\n \n }\n const eln = def?.m_annotations?.eln\n const laneWidth = (eln && eln.length > 0 ? eln[0].lane_width : undefined)\n const otherProps = (laneWidth ? {minWidth: laneWidth, maxWidth: laneWidth} : undefined)\n return (\n \n {isEditable && sectionIsInEln && (\n \n )}\n \n \n {contents}\n \n \n )\n}\n\nSection.propTypes = ({\n section: PropTypes.object.isRequired,\n def: PropTypes.object.isRequired,\n property: PropTypes.object,\n parentRelation: PropTypes.object,\n sectionIsEditable: PropTypes.bool,\n sectionIsInEln: PropTypes.bool\n})\n\nexport function getItemLabelKey(sectionDef) {\n let itemLabelKey = sectionDef.more?.label_quantity\n if (!itemLabelKey) {\n itemLabelKey = ['name', 'type', 'id'].find(key => (\n sectionDef._properties[key] && sectionDef._properties[key].m_def === QuantityMDef\n ))\n }\n return itemLabelKey\n}\n\nfunction SubSection({subSectionDef, section, editable}) {\n const {handleArchiveChanged} = useEntryStore() || {}\n const lane = useLane()\n const history = useHistory()\n const [open, setOpen] = useState(false)\n const config = useRecoilValue(configState)\n\n const {itemKey, label, getItemLabel} = useMemo(() => {\n const sectionDef = subSectionDef.sub_section\n let itemLabelKey = getItemLabelKey(sectionDef)\n let labelQuantity = itemLabelKey && sectionDef._properties[itemLabelKey]\n if (labelQuantity && quantityUsesFullStorage(labelQuantity)) {\n // We do not yet support label quantities that use full storage\n labelQuantity = undefined\n itemLabelKey = undefined\n }\n const getItemLabel = item => {\n if (labelQuantity) {\n const value = item[itemLabelKey]\n if (value) {\n return \n }\n } else if (itemLabelKey) {\n return item[itemLabelKey]\n }\n return null\n }\n return {\n itemKey: subSectionDef.name,\n label: getDisplayLabel(subSectionDef, true, config?.showMeta),\n getItemLabel: getItemLabel\n }\n }, [subSectionDef, config?.showMeta])\n\n const handleAdd = useCallback(() => {\n let subSectionKey = subSectionDef.name\n if (subSectionDef.repeats) {\n let values = section[subSectionDef.name]\n if (!values) {\n values = []\n section[subSectionDef.name] = values\n }\n values.push({})\n if (values.length > 1) {\n subSectionKey += `:${values.length - 1}`\n }\n setOpen(true)\n } else {\n section[subSectionDef.name] = {}\n }\n handleArchiveChanged()\n history.push(`${lane.path}/${subSectionKey}`)\n }, [subSectionDef, section, lane, history, handleArchiveChanged])\n\n const values = section[subSectionDef.name] || []\n const showList = subSectionDef.repeats && values.length > 1\n const actions = editable && (subSectionDef.repeats || !section[subSectionDef.name]) && (\n \n \n \n \n \n )\n\n const handleClick = useCallback(() => {\n setOpen(open => !open)\n }, [])\n\n if (showList) {\n return \n } else {\n return (\n \n \n \n \n {label}\n \n \n \n \n )\n }\n}\n\nSubSection.propTypes = ({\n subSectionDef: PropTypes.object.isRequired,\n section: PropTypes.object.isRequired,\n editable: PropTypes.bool\n})\n\nfunction ReferenceValuesList({quantityDef}) {\n const lane = useContext(laneContext)\n const values = useMemo(() => lane.adaptor.obj[quantityDef.name].map(() => null), [lane.adaptor.obj, quantityDef.name])\n const [open, setOpen] = useState(false)\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const handleClick = useCallback(() => {\n setOpen(open => !open)\n }, [])\n\n return \n}\n\nReferenceValuesList.propTypes = ({\n quantityDef: PropTypes.object.isRequired\n})\n\nconst usePropertyValuesListStyles = makeStyles(theme => ({\n root: {\n margin: `0 -${theme.spacing(1)}px`,\n padding: `0 ${theme.spacing(1)}px`,\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n wrap: 'nowrap',\n alignItems: 'center'\n },\n title: {\n flexGrow: 1,\n color: theme.palette.text.primary,\n textDecoration: 'none',\n margin: `0 -${theme.spacing(1)}px`,\n whiteSpace: 'nowrap',\n display: 'flex',\n fontWeight: 'bold'\n },\n selected: {\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.primary.contrastText,\n whiteSpace: 'nowrap'\n },\n unSelected: {\n '&:hover': {\n backgroundColor: grey[300]\n }\n },\n actions: {}\n}))\n\n/**\n * Displays a list of values that can be collapsed. Long lists are paginated in\n * order to prevent issues with rendering.\n */\nexport function PropertyValuesList(props) {\n const {label, itemKey, values, ...otherProps} = props\n return \n {values.map((value, index) => {\n return \n \n \n {value && typeof value === 'object'\n ? value // item should be a react component\n : {value || index}\n }\n \n \n \n })}\n \n}\n\nPropertyValuesList.propTypes = ({\n itemKey: PropTypes.string.isRequired,\n label: PropTypes.string,\n values: PropTypes.arrayOf(PropTypes.object).isRequired,\n actions: PropTypes.node,\n /**\n * Initial number of items to be shown from top of the list.\n */\n nTop: PropTypes.number,\n /**\n * Initial number of items to be shown from bottom of the list.\n */\n nBottom: PropTypes.number,\n /**\n * Initial number of items to be added or removed by show more and show less buttons.\n */\n pageSize: PropTypes.number,\n /**\n * To control the collapse state from outside the component.\n */\n open: PropTypes.bool,\n /**\n * An event firing when the item is clicked.\n */\n onClick: PropTypes.func,\n /**\n * To customize the label style in different places.\n */\n className: PropTypes.object,\n /**\n * Get item as children.\n */\n children: PropTypes.node\n})\n\nPropertyValuesList.defaultProps = ({\n nTop: 50,\n nBottom: 5,\n pageSize: 25\n})\n\n/**\n * Displays a list of values that can be collapsed. Long lists are paginated in\n * order to prevent issues with rendering.\n */\nexport function FoldableList({label, children, actions, nTop, nBottom, pageSize, open, onClick, className}) {\n const classes = {...usePropertyValuesListStyles(), ...className}\n const [nShownTop, setNShownTop] = useState(0)\n const [nShownBottom, setNShownBottom] = useState(0)\n const lane = useContext(laneContext)\n const selected = lane?.next?.key\n const showSelected = !open && (selected === label || selected?.startsWith(label + ':'))\n\n const topStart = 0\n const topEnd = Math.min(children.length, nTop + nShownTop)\n const bottomStart = Math.max(topEnd, children.length - nBottom - nShownBottom)\n const bottomEnd = children.length\n\n return \n
\n \n {open ? : }\n {label}\n \n {actions &&
\n {actions}\n
}\n
\n {open &&\n
\n {range(topStart, topEnd).map((index) => children[index])}\n {topEnd < bottomStart && \n {nTop > 0 && 0}\n onMore={() => setNShownTop(x => Math.min(bottomStart, x + pageSize))}\n onLess={() => setNShownTop(x => Math.max(0, x - pageSize))}\n variant=\"down\"\n data-testid=\"propertyvalueslist-pagination-down\"\n />}\n {nBottom > 0 && 0}\n onMore={() => setNShownBottom(x => Math.min(children.length - nShownTop - nBottom, x + pageSize))}\n onLess={() => setNShownBottom(x => Math.max(0, x - pageSize))}\n variant=\"up\"\n data-testid=\"propertyvalueslist-pagination-up\"\n />}\n }\n {range(bottomStart, bottomEnd).map((index) => children[index])}\n
\n }\n
\n}\n\nFoldableList.propTypes = ({\n label: PropTypes.string.isRequired,\n /**\n * Get item as children.\n */\n children: PropTypes.arrayOf(PropTypes.node).isRequired,\n actions: PropTypes.node,\n /**\n * Initial number of items to be shown from top of the list.\n */\n nTop: PropTypes.number,\n /**\n * Initial number of items to be shown from bottom of the list.\n */\n nBottom: PropTypes.number,\n /**\n * Initial number of items to be added or removed by show more and show less buttons.\n */\n pageSize: PropTypes.number,\n /**\n * To control the collapse state from outside the component.\n */\n open: PropTypes.bool,\n /**\n * An event firing when the item is clicked.\n */\n onClick: PropTypes.func,\n /**\n * To customize the label style in different places.\n */\n className: PropTypes.object\n})\n\nFoldableList.defaultProps = ({\n nTop: 50,\n nBottom: 5,\n pageSize: 25\n})\n\nexport const SectionPlots = React.memo(function SectionPlots({section, sectionDef, uploadId, entryId}) {\n const [selected, setSelected] = useState([])\n const annotationPlot = sectionDef?.m_annotations?.plot && sectionDef.m_annotations?.plot\n\n const sortedFigures = useMemo(() => {\n let sortedFigures\n if (section?.figures) {\n section?.figures.forEach((figure, index) => {\n figure.pathIndex = index\n })\n const [indexedFigures, otherFigures] = section.figures && partition(section.figures, figure => figure?.index !== undefined)\n sortedFigures = indexedFigures.sort((a, b) => a.index - b.index)\n sortedFigures = [...sortedFigures, ...otherFigures]\n }\n return sortedFigures\n }, [section.figures])\n\n const plots = useMemo(() => {\n const validPlots = []\n let key = 0\n sortedFigures?.forEach(plot => {\n if (plot?.figure) {\n plot.figure.data = (Array.isArray(plot?.figure?.data) ? [...plot?.figure?.data] : [{...plot?.figure?.data}])\n validPlots.push({pathIndex: plot.pathIndex, plot: plot.figure, key: key, label: plot.label || plot?.layout?.title?.text || 'Untitled', type: 'PlotSection'})\n }\n })\n const annotationPlots = annotationPlot\n ? Array.isArray(annotationPlot) ? [...annotationPlot] : [{...annotationPlot}]\n : undefined\n annotationPlots?.forEach(plot => {\n if (!('label' in plot)) {\n const yAxis = plot.y || plot['y_axis'] || plot['yAxis']\n const pathParts = Array.isArray(yAxis) ? ['unnamed'] : yAxis.split('/')\n plot.label = pathParts[pathParts.length - 1]\n }\n validPlots.push({plot: plot, key: key, label: plot.label || 'Untitled', type: 'PlotAnnotation'})\n key = key + 1\n })\n return validPlots\n }, [annotationPlot, sortedFigures])\n\n useEffect(() => {\n setSelected(sortedFigures && Array.isArray(sortedFigures) ? sortedFigures.reduce((indices, figure, index) => {\n if (figure?.open === undefined || figure?.open) {\n indices.push(index)\n }\n return indices\n }, []) : [0])\n }, [plots.length, sortedFigures])\n\n if (plots.length < 1 || selected.find(index => index >= plots.length)) {\n return null\n }\n\n return \n \n {plots.length > 1 && setSelected(event.target.value),\n renderValue: newSelected => newSelected.map(index => {\n return titleCase(plots?.[index]?.label)\n })?.join(', ')\n }}\n >\n {plots.map((plot, index) => (\n \n selectedIndex === index) >= 0}\n />\n {titleCase(plots?.[index]?.label)}\n \n ))}\n }\n {selected.map(index => plots?.[index])\n ?.map((plot) => {\n return plot.type === 'PlotSection'\n ? \n : \n })}\n \n \n})\nSectionPlots.propTypes = {\n sectionDef: PropTypes.object.isRequired,\n section: PropTypes.object,\n uploadId: PropTypes.string,\n entryId: PropTypes.string\n}\n\nfunction FullStorageQuantity({value, def}) {\n const attributes = value.m_attributes || {}\n return \n {Object.keys(attributes).length > 0 && \n {Object.keys(attributes).map(key => (\n {key}\n ))}\n }\n \n}\n\nFullStorageQuantity.propTypes = ({\n value: PropTypes.any,\n def: PropTypes.object.isRequired\n})\n\nfunction Quantity({value, def, unit, children}) {\n const {prev} = useLane()\n return \n \n {def.m_annotations?.plot && (\n \n \n \n )}\n \n \n \n {children}\n \n \n}\n\nQuantity.propTypes = ({\n value: PropTypes.any,\n def: PropTypes.object.isRequired,\n unit: PropTypes.string,\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n})\n\nfunction Query({value, def}) {\n return \n \n `${key}: ${value}`) : []}\n def={def}\n />\n \n {value?.data && \n entry.mainfile || entry.entry_id) : []}\n def={def}\n />\n }\n \n \n \n \n}\n\nQuery.propTypes = ({\n value: PropTypes.any,\n def: PropTypes.object.isRequired\n})\n\nfunction Attribute({value, def}) {\n return \n \n \n \n \n \n \n}\n\nAttribute.propTypes = ({\n value: PropTypes.any,\n def: PropTypes.object.isRequired\n})\n\nfunction UnresolvedReference({value, def}) {\n const refTypeName = def?.type?._referencedDefinition?.name\n const refTypeQualifiedName = def?.type?._referencedDefinition?._qualifiedName\n const isOk = ['nomad.metainfo.metainfo.User'].includes(refTypeQualifiedName) // expected to not be resolvable\n return \n \n \n {!isOk && Cannot resolve reference.}\n Reference type:\n {refTypeName || 'unknown'}\n Reference value:\n {value}\n \n \n \n}\n\nUnresolvedReference.propTypes = ({\n value: PropTypes.any,\n def: PropTypes.object.isRequired\n})\n\nconst useMetaStyles = makeStyles(theme => ({\n description: {\n marginTop: theme.spacing(1)\n },\n graph: {\n marginTop: theme.spacing(3)\n },\n metainfo: {\n marginBottom: theme.spacing(2)\n },\n metainfoItem: {\n fontWeight: 'bold'\n }\n}))\n\nexport function Meta({def}) {\n const classes = useMetaStyles()\n const config = useRecoilValue(configState)\n if (!config.showMeta) {\n return null\n }\n return \n
\n \n \n \n
\n {def.description}\n
\n}\n\nMeta.propTypes = ({\n def: PropTypes.object\n})\n\nconst baseQuery = {\n 'exclude': [\n 'atoms',\n 'only_atoms',\n 'files',\n 'quantities',\n 'dft.quantities',\n 'optimade',\n 'dft.labels',\n 'dft.geometries'\n ],\n 'required': {\n 'metadata': '*'\n },\n 'owner': 'visible',\n 'pagination': {\n 'order_by': 'upload_create_time', 'order': 'desc', 'page_size': 20\n }\n}\n\nfunction ExternalReferences() {\n const lane = useLane()\n const [searchResults, setSearchResults] = useState(null)\n\n const {api} = useApi()\n const {raiseError} = useErrors()\n\n const source = lane.adaptor\n\n const entryId = source.parsedObjUrl.entryId\n const dataPath = source.parsedObjUrl.path || '/'\n\n const performSearch = () => {\n if (searchResults) return\n const referencing_query = Object.assign({}, baseQuery, {\n 'query': {\n 'entry_references.target_entry_id': entryId,\n 'entry_references.target_path': dataPath\n }\n })\n api.query('entries', referencing_query, {noLoading: true}).then((data) => {\n source.external_refs = Object.fromEntries(data.data.map((entry, index) => {\n entry.entry_references = entry.entry_references.filter(ref => ref.target_entry_id === entryId && ref.target_path === dataPath)\n return ['_external_ref_' + index, entry]\n }))\n setSearchResults(Object.values(source.external_refs))\n }).catch(raiseError)\n }\n\n const entry_list = (list) => {\n return list.map((ref, index) => (\n \n {ref.mainfile}\n  = \n entry ...\n {ref.entry_references?.map(\n (ref, index) => {ref.source_path}\n )}\n \n ))\n }\n\n return \n {searchResults\n ? searchResults.length > 0\n ? searchResults.length === 20\n ? \n {entry_list(searchResults)}\n \n : entry_list(searchResults)\n : not referenced by other entries\n : loading...}\n \n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useRef, useState, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { Select, MenuItem, Card, CardContent, CardHeader, makeStyles, Tooltip } from '@material-ui/core'\nimport * as d3 from 'd3'\nimport { scaleBand, scalePow } from 'd3-scale'\nimport { formatQuantity, nomadPrimaryColor, nomadSecondaryColor, nomadFontFamily, nomadTheme } from '../config.js'\n\nfunction split(array, cols) {\n if (cols === 1) {\n return [array]\n }\n const size = Math.ceil(array.length / cols)\n return [array.slice(0, size), ...split(array.slice(size), cols - 1)]\n}\n\nfunction isSelected(d, selected, multiple) {\n // Determine if the value has been selected\n let isSelected\n if (multiple) {\n if (selected === undefined) {\n isSelected = false\n } else {\n if (Array.isArray(selected)) {\n const selections = new Set(selected)\n isSelected = selections.has(d.key)\n } else {\n isSelected = selected === d.key\n }\n }\n } else {\n isSelected = selected === d.key\n }\n return isSelected\n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n marginTop: theme.spacing(2)\n },\n content: {\n paddingTop: 0,\n position: 'relative'\n },\n tooltip: {\n width: '100%',\n height: '100%'\n },\n tooltipContent: {\n position: 'absolute',\n fontSize: nomadTheme.overrides.MuiTooltip.tooltip.fontSize,\n fontWeight: nomadTheme.overrides.MuiTooltip.tooltip.fontWeight,\n // backgroundColor: '#ffbb00' // Uncomment for debugging tooltips\n display: 'none',\n zIndex: 1,\n cursor: 'pointer'\n },\n canvas: {\n zIndex: 2\n }\n}))\nexport default function Histogram({\n initialScale = 1, getValueLabel, numberOfValues, title, data, columns = 1, tooltips,\n onClick, selected, card, multiple\n}) {\n onClick = onClick || (() => null)\n data = data || []\n numberOfValues = numberOfValues || data.length\n getValueLabel = getValueLabel || (value => value.name)\n title = title || 'Histogram'\n\n const [tooltipHTML, setTooltipHTML] = useState('')\n const [item, setItem] = useState()\n const [scale, setScale] = useState(initialScale)\n const classes = useStyles()\n const containerRef = useRef()\n\n const handleItemClicked = item => {\n if (item.value !== 0) {\n onClick(item)\n }\n }\n\n useEffect(() => {\n // TODO add proper treatment of not processed on server side and processing\n const numberOfValuesToRender = numberOfValues\n // if (data[data.length - 1] && data[data.length - 1].key === 'not processed') {\n // if (data[data.length - 2].key === 'unavailable') {\n // data[data.length - 2].value += data[data.length - 1].value\n // data.pop()\n // numberOfValuesToRender -= 1\n // }\n // }\n\n for (let i = data.length; i < numberOfValuesToRender; i++) {\n data.push({key: `empty${i}`, name: '', value: 0})\n }\n\n const columnSize = Math.ceil(data.length / columns)\n for (let i = data.length; i < columnSize * columns; i++) {\n data.push({key: `empty${i}`, name: '', value: 0})\n }\n const columnsData = split(data, columns)\n\n const containerWidth = containerRef.current.offsetWidth\n const width = containerWidth / columns - (12 * (columns - 1))\n const height = columnSize * 32\n const padding = 16\n\n const x = scalePow().range([0, width]).exponent(scale)\n\n // we use at least the domain 0..1, because an empty domain causes a weird layout\n const max = d3.max(data, d => d.value) || 1\n x.domain([0, max])\n\n const rectColor = d => isSelected(d, selected, multiple) ? nomadSecondaryColor.main : nomadPrimaryColor.light\n const textColor = d => {\n if (d.value === 0) {\n return '#999'\n }\n return isSelected(d, selected, multiple) ? '#FFF' : '#000'\n }\n\n const container = d3.select(containerRef.current)\n const tooltipContent = container.select('.' + classes.tooltipContent)\n const svg = container.select('svg')\n .attr('width', containerWidth)\n .attr('height', height)\n tooltipContent\n .style('width', width + 'px')\n .style('height', 27 + 'px')\n\n const columnsG = svg\n .selectAll('.column')\n .data(columnsData.map((_, i) => `column${i}`))\n\n columnsG.exit().remove()\n columnsG\n .enter()\n .append('g')\n .attr('id', d => d)\n .attr('class', 'column')\n .attr('transform', (d, i) => `translate(${i * (width + 12)}, 0)`)\n\n columnsData.forEach((data, i) => {\n const y = scaleBand().rangeRound([0, height]).padding(0.1)\n y.domain(data.map(d => d.key))\n\n const items = svg.select('#column' + i)\n .selectAll('.item')\n .data(data, d => d.key)\n\n items.exit().remove()\n\n items\n .on('click', handleItemClicked)\n\n let item = items.enter()\n .append('g')\n .attr('class', 'item')\n .attr('display', d => getValueLabel(d) === '' ? 'none' : 'show')\n .style('cursor', 'pointer')\n .on('click', handleItemClicked)\n\n item\n .append('rect')\n .attr('x', x(0))\n .attr('y', d => y(d.key))\n .attr('width', width)\n .attr('class', 'background')\n .style('opacity', 0)\n .attr('height', y.bandwidth())\n\n item\n .append('rect')\n .attr('class', 'bar')\n .attr('x', x(0))\n .attr('y', d => y(d.key))\n .attr('width', d => x(d.value) - x(0))\n .attr('height', y.bandwidth())\n .style('fill', rectColor)\n // .style('stroke', '#000')\n // .style('stroke-width', '1px')\n .style('shape-rendering', 'geometricPrecision')\n\n item\n .append('text')\n .attr('class', 'name')\n .attr('dy', '.75em')\n .attr('x', x(0) + 4)\n .attr('y', d => y(d.key) + 4)\n .attr('text-anchor', 'start')\n .style('fill', textColor)\n .style('font-family', nomadFontFamily)\n .text(d => getValueLabel(d))\n\n item\n .append('text')\n .attr('class', 'value')\n .attr('dy', y.bandwidth())\n .attr('y', d => y(d.key) - 4)\n .attr('x', d => width - 4)\n .attr('text-anchor', 'end')\n .style('fill', textColor)\n .style('font-family', nomadFontFamily)\n .text(d => formatQuantity(d.value))\n\n item\n .on('mouseenter', function(d) {\n setItem(d)\n if (tooltips) {\n if (d.tooltip) {\n tooltipContent\n .style('left', i * (width) + padding + 'px')\n .style('top', (y(d.key)) + 'px')\n .style('display', 'block')\n setTooltipHTML(d.tooltip)\n }\n }\n })\n .on('mouseleave', function(d) {\n })\n\n item = items.transition(d3.transition().duration(500))\n\n item\n .select('.bar')\n .attr('y', d => y(d.key))\n .attr('width', d => x(d.value) - x(0))\n .attr('height', y.bandwidth())\n .style('fill', rectColor)\n\n item\n .select('.name')\n .text(d => getValueLabel(d))\n .attr('y', d => y(d.key) + 4)\n .style('fill', textColor)\n\n item\n .select('.value')\n .text(d => formatQuantity(d.value))\n .attr('y', d => y(d.key) - 4)\n .attr('x', width - 4)\n .style('fill', textColor)\n })\n })\n\n const chart =
\n
\n \n
{ handleItemClicked(item) }}>\n
\n \n \n
\n
\n\n if (card) {\n return \n \n setScale(event.target.value)}\n displayEmpty\n name=\"scale power\"\n >\n linear\n 1/2\n 1/4\n 1/8\n \n \n )}\n />\n \n {chart}\n \n \n } else {\n return chart\n }\n}\nHistogram.propTypes = {\n /**\n * An optional title for the chart. If no title is given, the Histogram is used.\n */\n title: PropTypes.string,\n /**\n * An optional scale power that is used as the initial scale before the user\n * changes it. Default is 1 (linear scale).\n */\n initialScale: PropTypes.number,\n /**\n * The data. Must be an array of object with keys key (unique key), value (number),\n * and name. Name is only necessary if no getValueLabel is given.\n */\n data: PropTypes.arrayOf(PropTypes.object),\n /**\n * The maximum number of values. This is used to fix the histograms size. Otherwise,\n * the size is determined by the required space to render the existing values.\n */\n numberOfValues: PropTypes.number,\n /**\n * The number of columns that the values should be rendered in. Default is one.\n */\n columns: PropTypes.number,\n /**\n * Set to true to enable tooltips for each value.\n */\n tooltips: PropTypes.bool,\n /**\n * This callback is called if a value is clicked.\n */\n onClick: PropTypes.func,\n /**\n * The given value will be highlighted as selected.\n */\n selected: PropTypes.any,\n /**\n * A function that determined the label of a value.\n */\n getValueLabel: PropTypes.func,\n /**\n * If true the chart is wrapped in a MUI paper card with title and form.\n */\n card: PropTypes.bool,\n /**\n * If true, multiple values may be selected.\n */\n multiple: PropTypes.bool\n}\n\nHistogram.defaultProps = {\n multiple: false\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useMemo, useEffect, useRef, useLayoutEffect, useContext, useState, useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport { useRecoilValue, useRecoilState, atom } from 'recoil'\nimport { configState } from './ArchiveBrowser'\nimport Browser, { Item, Content, Compartment, Adaptor, laneContext, Title, ItemChip } from './Browser'\nimport { Typography, Box, makeStyles, FormGroup, TextField, Button, Link } from '@material-ui/core'\nimport { vicinityGraph, SubSectionMDef, SectionMDef, QuantityMDef, CategoryMDef, useGlobalMetainfo, PackageMDef, AttributeMDef, getMetainfoFromDefinition } from './metainfo'\nimport * as d3 from 'd3'\nimport blue from '@material-ui/core/colors/blue'\nimport teal from '@material-ui/core/colors/teal'\nimport lime from '@material-ui/core/colors/lime'\nimport purple from '@material-ui/core/colors/purple'\nimport grey from '@material-ui/core/colors/grey'\nimport Markdown from '../Markdown'\nimport Histogram from '../Histogram'\nimport { appBase } from '../../config'\nimport { useHistory, useRouteMatch } from 'react-router-dom'\nimport Autocomplete from '@material-ui/lab/Autocomplete'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport { SourceJsonDialogButton } from '../buttons/SourceDialogButton'\nimport ReactJson from 'react-json-view'\nimport ArchiveSearchBar from './ArchiveSearchBar'\nimport {getDisplayLabel} from \"../../utils\"\n\nexport const help = `\nThe NOMAD *metainfo* defines all quantities used to represent archive data in\nNOMAD. You could say it is the archive *schema*. You can browse this schema and\nall its definitions here.\n\nThe NOMAD metainfo contains three different *kinds* of definitions:\n\n- **sections**: A section is a nested groups of quantities that allow a hierarchical data structure\n- **values**: Actual quantities that contain data\n- **references**: References that allow to connect related sections.\n\nAll definitions have a name that you can search for. Furthermore, all definitions\nare organized in packages. There is a *common* pkg with definitions that are\nused by all codes and there are packages for each code with code specific definitions.\nYou can select the pkg to browse below.\n\nDepending on the selected pkg, there are quite a large number of definitions.\nYou can use the *definition* field to search based on definition names.\n\nAll definitions are represented as *cards* below. Click on the various card items\nto expand sub-sections, open values or references, hide and show compartments, or\ncollapse cards again. The highlighted *main* card cannot be collapsed. The\nshapes in the background represent section containment (grey) and\nreference (blue) relations.\n\nIf you bookmark this page, you can save the definition represented by the highlighted\n*main* card.\n\nTo learn more about the metainfo, visit the [metainfo documentation](${appBase}/docs/metainfo.html).\n`\n\nconst showInnerSectionDefinitions = false\n\nfunction defCompare(a, b) {\n return a.name.localeCompare(b.name)\n}\n\nexport const metainfoConfigState = atom({\n key: 'metainfoConfig',\n default: {\n 'packagePrefix': 'all'\n }\n})\n\nexport function MetainfoPage() {\n return \n \n \n}\n\nexport default function MetainfoBrowser() {\n const globalMetainfo = useGlobalMetainfo()\n const adaptor = useMemo(() => {\n return globalMetainfo ? new MetainfoRootAdaptor(globalMetainfo.getEntryArchiveDefinition()) : null\n }, [globalMetainfo])\n if (!adaptor) {\n return null\n }\n return }\n />\n}\n\nconst useStyles = makeStyles(theme => {\n return {\n container: {\n alignItems: 'center',\n flexWrap: 'nowrap'\n },\n searchBar: {\n width: 850,\n marginRight: theme.spacing(1.5)\n },\n sourceBar: {\n width: 350\n },\n textInput: {\n margin: 0\n }\n }\n})\n\nconst MetainfoConfigForm = React.memo(function MetainfoConfigForm(props) {\n const styles = useStyles()\n const [config, setConfig] = useRecoilState(metainfoConfigState)\n const globalMetainfo = useGlobalMetainfo()\n const history = useHistory()\n const { url } = useRouteMatch()\n\n const searchOptions = useMemo(() => {\n const defsByName = globalMetainfo.getDefsByName()\n const searchOptions = {}\n globalMetainfo && Object.keys(defsByName).forEach((name) => {\n const defsForName = defsByName[name].filter(def => (\n !def.extends_base_section && def.m_def !== SubSectionMDef && (\n def._package.name.startsWith(config.packagePrefix) || def._package.name.startsWith('nomad'))\n ))\n defsForName.forEach(def => {\n const path = globalMetainfo.path(def)\n const prefix = 'nomad.datamodel.datamodel.EntryArchive/'\n const instance = path.startsWith(prefix)\n let info, label\n if (instance) {\n info = path.slice(prefix.length, path.length)?.replace(/\\//g, \".\")\n label = info.split(\".\").slice(-1)[0] || info\n } else {\n info = def?._qualifiedName?.split('/')[0]\n label = def.more?.label || def.name\n }\n const key = info || label\n const option = {\n url: url + '/' + path,\n primary: label,\n secondary: info,\n key: key\n }\n searchOptions[key] = option\n })\n })\n return searchOptions\n }, [config.packagePrefix, url, globalMetainfo])\n\n const handleChange = useCallback((path) => {\n if (path) {\n history.push(path)\n }\n }, [history])\n\n return (\n \n \n \n option.replace(/parser/g, '')}\n onChange={(_, value) => setConfig({...config, packagePrefix: value})}\n renderInput={(params) => }\n />\n \n \n )\n})\n\nexport async function metainfoAdaptorFactory(def) {\n if (def.m_def === SectionMDef) {\n return new SectionDefAdaptor(def)\n } else if (def.m_def === SubSectionMDef) {\n return new SubSectionDefAdaptor(def)\n } else if (def.m_def === QuantityMDef) {\n return new QuantityDefAdaptor(def)\n } else if (def.m_def === CategoryMDef) {\n return new CategoryDefAdaptor(def)\n } else if (def.m_def === PackageMDef) {\n return new PackageDefAdaptor(def)\n } else if (def.m_def === AttributeMDef) {\n return new AttributeDefAdaptor(def)\n } else {\n throw new Error('Unknown metainfo definition type')\n }\n}\n\nclass MetainfoAdaptor extends Adaptor {\n constructor(def) {\n super()\n this.def = def\n }\n\n async itemAdaptor(key) {\n if (key === '_reference') {\n return metainfoAdaptorFactory(this.def.type._referencedDefinition)\n } else if (key.startsWith('_category:')) {\n const categoryName = key.split(':')[1]\n return metainfoAdaptorFactory(this.def.categories.find(categoryDef => categoryDef.name === categoryName))\n } else if (key === '_metainfo') {\n return metainfoAdaptorFactory(await getMetainfoFromDefinition(this.def).resolveDefinition(this.def.m_def))\n } else {\n throw new Error('Unknown item key')\n }\n }\n\n async initialize(api, dataStore) {\n if (this.def.m_def === SectionMDef || this.def.m_def === SubSectionMDef) {\n this.inheritingSections = dataStore.getAllInheritingSections(this.def.sub_section || this.def)\n }\n }\n}\n\nexport class MetainfoRootAdaptor extends MetainfoAdaptor {\n async itemAdaptor(key) {\n const rootSection = getMetainfoFromDefinition(this.def).getRootSectionDefinitions().find(def => def._qualifiedName === key)\n if (rootSection) {\n return metainfoAdaptorFactory(rootSection)\n } else {\n const packagePrefixes = getMetainfoFromDefinition(this.def).getPackagePrefixes()\n if (packagePrefixes[key]) {\n return new PackagePrefixAdaptor(packagePrefixes[key])\n }\n }\n\n return super.itemAdaptor(key)\n }\n render() {\n return \n }\n}\n\nexport class PackageDefAdaptor extends MetainfoAdaptor {\n async itemAdaptor(key) {\n const sectionDef = this.def.section_definitions.find(sectionDef => sectionDef.name === key)\n if (sectionDef) {\n return metainfoAdaptorFactory(sectionDef)\n }\n return super.itemAdaptor(key)\n }\n render() {\n return \n \n \n \n {this.def.section_definitions.map(sectionDef => (\n \n {sectionDef.name}\n \n ))}\n \n \n }\n}\n\nexport class PackagePrefixAdaptor extends MetainfoAdaptor {\n async itemAdaptor(key) {\n const [type, name] = key.split('@')\n const def = Object.keys(this.def)\n .map(key => this.def[key])\n .reduce((value, pkg) => value || pkg[type].find(def => def._qualifiedName === name), null)\n return metainfoAdaptorFactory(def)\n }\n render() {\n const sectionDefs = Object.keys(this.def)\n .map(key => this.def[key])\n .reduce((defs, pkg) => {\n pkg.section_definitions.forEach(def => defs.push(def))\n return defs\n }, [])\n const categoryDefs = Object.keys(this.def)\n .map(key => this.def[key])\n .reduce((defs, pkg) => {\n pkg.category_definitions.forEach(def => defs.push(def))\n return defs\n }, [])\n\n return \n \n {sectionDefs.filter(def => !def.extends_base_section).sort(defCompare).map(def => {\n const key = `section_definitions@${def._qualifiedName}`\n return \n {def.more?.label || def.name}\n \n })}\n \n \n {sectionDefs.filter(def => def.extends_base_section).sort(defCompare).map(def => {\n const key = `section_definitions@${def._qualifiedName}`\n return \n {def.more?.label || def.name}\n \n })}\n \n \n {categoryDefs.sort(defCompare).map(def => {\n const key = `category_definitions@${def._qualifiedName}`\n return \n {def.more?.label || def.name}\n \n })}\n \n \n }\n}\n\nconst Metainfo = function Metainfo(props) {\n const globalMetainfo = useGlobalMetainfo()\n return \n \n \n Entry\n \n \n \n {Object.keys(globalMetainfo.getPackagePrefixes()).map(key => \n {key.replace(/parser$/, '')}\n )}\n \n \n {globalMetainfo.getRootSectionDefinitions().filter(def => def.name !== 'EntryArchive').map((def, i) => (\n \n \n {def.more?.label || def.name}\n \n \n ))}\n \n \n}\n\nexport class SectionDefAdaptor extends MetainfoAdaptor {\n itemAdaptor(key) {\n if (key.includes('@')) {\n const [type, name] = key.split('@')\n if (type === '_innerSectionDef') {\n const innerSectionDef = this.def.inner_section_definitions.find(def => def.name === name)\n if (innerSectionDef) {\n return metainfoAdaptorFactory(innerSectionDef)\n }\n } else if (type === '_inheritingSectionDef') {\n const inheritingSectionDef = this.inheritingSections.find(inheritingSection => inheritingSection._qualifiedName === name)\n if (inheritingSectionDef) {\n return metainfoAdaptorFactory(inheritingSectionDef)\n }\n } else if (type === '_baseSectionDef') {\n const baseSectionDef = this.def.base_sections[parseInt(name)]\n if (baseSectionDef) {\n return metainfoAdaptorFactory(baseSectionDef)\n }\n }\n }\n\n const property = this.def._properties[key]\n if (property) {\n return metainfoAdaptorFactory(property)\n }\n\n const attribute = this.def._allAttributes?.find(attr => attr.name === key)\n if (attribute) {\n return metainfoAdaptorFactory(attribute)\n }\n\n return super.itemAdaptor(key)\n }\n render() {\n return \n }\n}\n\nclass SubSectionDefAdaptor extends MetainfoAdaptor {\n constructor(def) {\n super(def)\n this.sectionDefAdaptor = new SectionDefAdaptor(this.def.sub_section)\n }\n async initialize(api, dataStore) {\n await this.sectionDefAdaptor.initialize(api, dataStore)\n }\n cleanup() {\n this.sectionDefAdaptor.cleanup()\n }\n async itemAdaptor(key) {\n const attributeDef = this.def._allAttributes?.find(def => def.name === key)\n if (attributeDef) {\n return metainfoAdaptorFactory(attributeDef)\n }\n return this.sectionDefAdaptor.itemAdaptor(key)\n }\n render() {\n return \n }\n}\n\nclass QuantityDefAdaptor extends MetainfoAdaptor {\n itemAdaptor(key) {\n const attributeDef = this.def._allAttributes?.find(def => def.name === key)\n if (attributeDef) {\n return metainfoAdaptorFactory(attributeDef)\n }\n\n return super.itemAdaptor(key)\n }\n\n render() {\n return \n }\n}\n\nclass CategoryDefAdaptor extends MetainfoAdaptor {\n render() {\n return \n \n \n \n }\n}\n\nclass AttributeDefAdaptor extends MetainfoAdaptor {\n render() {\n return \n }\n}\n\nfunction SectionDefContent({def, inheritingSections}) {\n const config = useRecoilValue(configState)\n const metainfoConfig = useRecoilValue(metainfoConfigState)\n const filter = def.extends_base_section ? () => true : def => {\n if (def?._package?._unique_id?.startsWith('entry_id:')) {\n // dynamically loaded custom schema\n return true\n }\n if (def._package.name.startsWith('nomad')) {\n return true\n }\n if (def._package.name.startsWith('nexus')) {\n return true\n }\n if (metainfoConfig.packagePrefix !== 'all') {\n return def._package.name.startsWith(metainfoConfig.packagePrefix)\n }\n if (def.name.startsWith('x_')) {\n return config.showCodeSpecific\n }\n return true\n }\n\n return \n \n {def.base_sections.length > 0 &&\n \n {def.base_sections.map((baseSection, index) => {\n const key = `_baseSectionDef@${index}`\n const categories = baseSection.categories\n const unused = categories?.find(c => c.name === 'Unused')\n return \n \n \n \n {baseSection.name}\n \n \n \n \n })}\n \n }\n {inheritingSections.length > 0 &&\n \n {inheritingSections.map((inheritingSection, index) => {\n const key = `_inheritingSectionDef@${inheritingSection._qualifiedName}`\n const categories = inheritingSection.categories\n const unused = categories?.find(c => c.name === 'Unused')\n return \n \n \n \n {inheritingSection.name}\n \n \n \n \n })}\n \n }\n \n {def._allProperties.filter(prop => prop.m_def === SubSectionMDef).filter(filter)\n .map(subSectionDef => {\n const key = subSectionDef.name\n const categories = subSectionDef.categories\n const unused = categories?.find(c => c.name === 'Unused')\n const inherited = subSectionDef._parent !== def\n return \n \n \n {subSectionDef.name}\n \n {subSectionDef.repeats && }\n {subSectionDef._overwritten && }\n {inherited && }\n \n \n })\n }\n \n \n {def._allProperties.filter(prop => prop.m_def === QuantityMDef).filter(filter)\n .map(quantityDef => {\n const key = quantityDef.name\n const categories = quantityDef.categories\n const unused = categories?.find(c => c.name === 'Unused')\n const inherited = quantityDef._parent !== def\n return \n \n \n \n {quantityDef.name}\n \n \n {quantityDef._overwritten && }\n {inherited && }\n \n \n })\n }\n \n {showInnerSectionDefinitions && \n {def.inner_section_definitions.filter(filter)\n .map(innerSectionDef => {\n const key = `_innerSectionDef@${innerSectionDef.name}`\n const categories = innerSectionDef.categories\n const unused = categories?.find(c => c.name === 'Unused')\n return \n \n \n \n {getDisplayLabel(innerSectionDef, true)}\n \n \n \n \n })\n }\n }\n \n \n \n \n}\nSectionDefContent.propTypes = ({\n def: PropTypes.object,\n inheritingSections: PropTypes.array\n})\n\nfunction SectionDef({def, inheritingSections}) {\n const label = getDisplayLabel(def, true)\n return \n \n \n \n label: \n {label}\n \n \n \n \n}\nSectionDef.propTypes = ({\n def: PropTypes.object,\n inheritingSections: PropTypes.array\n})\n\nfunction SubSectionDef({def, inheritingSections}) {\n const sectionDef = def.sub_section\n const label = getDisplayLabel(def, true)\n return \n \n \n \n \n label: \n {label}\n \n \n repeats: \n {def.repeats ? 'True' : 'False'}\n \n \n \n \n \n \n \n \n}\nSubSectionDef.propTypes = ({\n def: PropTypes.object,\n inheritingSections: PropTypes.array\n})\n\nfunction DefinitionProperties({def, children}) {\n const searchAnnotations = def.m_annotations && Object.keys(def.m_annotations)\n .filter(key => key === 'elasticsearch')\n .map(key => def.m_annotations[key].filter(\n value => !(value.endsWith('.suggestion') || value.endsWith('__suggestion')))\n )\n const hasSearchAnnotations = searchAnnotations && searchAnnotations.length > 0\n\n if (!(children || def.aliases?.length || def.deprecated || (def.more && Object.keys(def.more).length) || hasSearchAnnotations)) {\n return null\n }\n\n return \n {children}\n {def.aliases?.length && aliases: {def.aliases.map(a => `\"${a}\"`).join(', ')}}\n {def.deprecated && deprecated: {def.deprecated}}\n {Object.keys(def.more || {}).map((moreKey, i) => (\n {moreKey}: {String(def.more[moreKey])}\n ))}\n {hasSearchAnnotations > 0 && search keys: {\n searchAnnotations.join(', ')}}\n \n}\nDefinitionProperties.propTypes = ({\n def: PropTypes.object,\n children: PropTypes.any\n})\n\nfunction QuantityDef({def}) {\n const label = getDisplayLabel(def, true)\n return \n \n \n \n label: \n {label}\n \n {def.type.type_kind !== 'reference'\n ? \n type: \n {Array.isArray(def.type.type_data) ? def.type.type_data.join(', ') : def.type.type_data} \n {def.type.type_kind !== 'data' && `(${def.type.type_kind})`}\n \n : \n \n referenced section\n \n }\n \n shape: \n [{def.shape.join(', ')}]\n \n {def.derived && repeats: true}\n {def.unit &&\n unit: {def.unit}}\n {def.dimensionality &&\n dimensionality: {def.dimensionality}}\n {def.default &&\n default: {String(def.default)}}\n {def.derived && derived: true}\n {def.variable && variable: true}\n \n \n \n \n}\nQuantityDef.propTypes = ({\n def: PropTypes.object\n})\n\nfunction AttributeDef({def}) {\n return \n \n \n \n type: \n {Array.isArray(def.type.type_data) ? def.type.type_data.join(', ') : def.type.type_data} \n {def.type.type_kind !== 'data' && `(${def.type.type_kind})`}\n \n {def.shape && \n shape: \n [{def.shape.join(', ')}]\n }\n {def.default &&\n default: {String(def.default)}}\n \n \n \n \n}\nAttributeDef.propTypes = ({\n def: PropTypes.object\n})\n\nfunction Attributes({def}) {\n if (!def._allAttributes?.length) {\n return null\n }\n\n return \n {def._allAttributes.map((attributeDef) => {\n const key = attributeDef.name\n const inherited = attributeDef._parent !== def\n return \n \n \n {attributeDef.more?.label || attributeDef.name}\n \n {attributeDef._overwritten && }\n {inherited && }\n \n \n })}\n \n}\nAttributes.propTypes = ({\n def: PropTypes.object\n})\n\nfunction DefinitionDocs({def}) {\n return \n {def.description && !def.extends_base_section &&\n \n \n {def?._qualifiedName?.startsWith('nexus')\n ? {def.description}\n : {def.description}}\n \n \n }\n {def.links?.length &&\n \n {def.links.map((link, i) =>
\n {link.includes('manual.nexusformat.org') ? 'nexus manual' : link}\n
)}\n
\n }\n
\n}\nDefinitionDocs.propTypes = {\n def: PropTypes.object.isRequired\n}\n\nfunction Definition({def, ...props}) {\n return \n \n \n \n}\nDefinition.propTypes = {\n def: PropTypes.object.isRequired\n}\n\nfunction DefinitionDetails({def, ...props}) {\n const {api} = useApi()\n const {raiseError} = useErrors()\n const lane = useContext(laneContext)\n const [usage, setUsage] = useState(null)\n const [showUsage, setShowUsage] = useState(false)\n\n const quantityPath = useMemo(() => {\n const path = lane.path.split('/')\n const index = path.indexOf('EntryArchive')\n if (index >= 0) {\n return path.slice(index + 1).join('.')\n }\n return null\n }, [lane])\n\n useEffect(() => {\n if (showUsage) {\n api.post('/entries/query', {\n owner: 'visible',\n query: {\n 'quantities:any': [quantityPath]\n },\n aggregations: {\n program_names: {\n terms: {\n quantity: 'results.method.simulation.program_name',\n pagination: {\n page_size: 100 // make sure we get all codes\n }\n }\n }\n }\n }).then(response => {\n const aggData = response.aggregations.program_names.terms.data\n setUsage(aggData)\n }).catch(raiseError)\n }\n }, [api, raiseError, showUsage, quantityPath, setUsage])\n\n return \n {def.categories && def.categories.length > 0 && \n {def.categories.map((categoryDef, index) => (\n \n {categoryDef.more?.label || categoryDef.name}\n \n ))}\n }\n {/* {!lane.next && !def.extends_base_section && def.name !== 'EntryArchive' &&\n \n \n \n } */}\n {quantityPath &&\n \n {!showUsage && }\n {showUsage && !usage && loading ...}\n {usage && usage.length > 0 && (\n ({\n key: use.value,\n name: use.value,\n value: use.count\n }))}\n initialScale={0.5}\n title=\"Metadata use per code\"\n />\n )}\n {usage && usage.length === 0 && (\n This metadata is not used at all.\n )}\n \n }\n \n}\nDefinitionDetails.propTypes = {\n def: PropTypes.object.isRequired\n}\n\nconst definitionLabels = {\n [PackageMDef]: 'package',\n [SectionMDef]: 'section',\n [QuantityMDef]: 'quantity',\n [SubSectionMDef]: 'sub section',\n [CategoryMDef]: 'category',\n [AttributeMDef]: 'attribute'\n}\n\nexport function ArchiveTitle({def, property, isDefinition, data, kindLabel, useName, actions}) {\n const color = isDefinition ? 'primary' : 'initial'\n let label = definitionLabels[def.m_def]\n if (def.extends_base_section) {\n label += ' extension'\n }\n const title = isDefinition || useName ? def.name : getDisplayLabel(def)\n return \n }\n />\n}\nArchiveTitle.propTypes = ({\n def: PropTypes.object.isRequired,\n property: PropTypes.object,\n data: PropTypes.any,\n isDefinition: PropTypes.bool,\n kindLabel: PropTypes.string,\n useName: PropTypes.bool,\n actions: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n})\n\nexport function DefinitionLabel({def, isDefinition, ...props}) {\n let label = definitionLabels[def.m_def]\n if (def.extends_base_section) {\n label += ' extension'\n }\n return \n {label}{isDefinition ? ' definition' : ''}\n \n}\nDefinitionLabel.propTypes = ({\n def: PropTypes.object.isRequired,\n isDefinition: PropTypes.bool\n})\n\nconst Annotations = React.memo(function Annotations({def}) {\n if (!def.m_annotations) {\n return null\n }\n\n return (\n \n \n \n )\n})\nAnnotations.propTypes = {\n def: PropTypes.object.isRequired\n}\n\nconst useVicinityGraphStyles = makeStyles(theme => ({\n root: {\n with: '100%',\n minWidth: 300,\n '& .links line': {\n // stroke: '#000'\n strokeWidth: 3\n },\n '& text': {\n fontFamily: 'Titillium Web, sans',\n fontSize: 12,\n fontWeight: 'bold'\n }\n }\n}))\n\nconst linkColors = {\n [QuantityMDef]: purple[500],\n '_none': grey[700]\n}\nconst nodeColors = {\n [QuantityMDef]: lime[500],\n [SectionMDef]: blue[500],\n [CategoryMDef]: teal[500]\n}\n\nexport function VicinityGraph({def}) {\n const globalMetainfo = useGlobalMetainfo()\n\n const graph = useMemo(() => {\n const graph = vicinityGraph(def)\n let x1 = Math.min(...graph.nodes.map(n => n.x)) - 32\n const y1 = Math.min(...graph.nodes.map(n => n.y)) - 24\n let x2 = Math.max(...graph.nodes.map(n => n.x)) + 32\n const y2 = Math.max(...graph.nodes.map(n => n.y)) + 24\n const w = Math.max(200, Math.abs(x2 - x1))\n const px = w < 400 ? (400 - w) / 2 : 0\n x1 -= px; x2 += px\n graph.viewBox = `${x1} ${y1} ${x2 - x1} ${y2 - y1}`\n graph.aspectRatio = Math.abs((x2 - x1) / (y2 - y1))\n\n return graph\n }, [def])\n\n const classes = useVicinityGraphStyles()\n const svgRef = useRef()\n const history = useHistory()\n\n useEffect(() => {\n const svg = d3.select(svgRef.current)\n\n const link = svg.select('.links')\n .selectAll('line')\n .data(graph.links)\n .enter().append('line')\n .attr('marker-end', d => `url(#arrowhead-${d.def.m_def || '_none'})`)\n .attr('stroke', d => linkColors[d.def.m_def || '_none'])\n .on('click', d => {\n if (d.def.m_def === QuantityMDef) {\n const path = globalMetainfo.path(d.def)\n if (path) {\n history.push(`/metainfo/${path}`)\n }\n }\n })\n\n const node = svg.select('.nodes')\n .selectAll('g')\n .data(graph.nodes)\n .enter().append('g')\n\n node.append('circle')\n .attr('r', 10)\n .attr('fill', d => nodeColors[d.def.m_def] || '#000')\n .on('click', d => {\n const path = globalMetainfo.path(d.def)\n if (path) {\n history.push(`/metainfo/${path}`)\n }\n })\n .call(d3.drag()\n .on('drag', d => {\n d.x = d3.event.x\n d.y = d3.event.y\n ticked()\n }))\n\n node.append('text')\n .text(d => d.def.more?.label || d.def.name)\n .attr('text-anchor', 'middle')\n .attr('y', d => ((d.i % 2) === 0) ? 20 : -14)\n\n function ticked() {\n link\n .attr('x1', d => d.source.x)\n .attr('y1', d => d.source.y)\n .attr('x2', d => d.target.x)\n .attr('y2', d => d.target.y)\n\n node\n .attr('transform', d => 'translate(' + d.x + ',' + d.y + ')')\n }\n ticked()\n }, [graph, history, svgRef, globalMetainfo])\n\n useLayoutEffect(() => {\n svgRef.current.style.height = svgRef.current.clientWidth / graph.aspectRatio\n }, [graph, svgRef])\n\n return \n \n \n {Object.keys(linkColors).map(colorKey => {\n const color = linkColors[colorKey]\n return \n \n \n })}\n \n}\nVicinityGraph.propTypes = ({\n def: PropTypes.object.isRequired\n})\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { } from 'react'\nimport PropTypes from 'prop-types'\nimport { SectionTable } from '../Quantity'\nimport { useUnitContext } from '../units/UnitContext'\nimport { withErrorHandler } from '../ErrorHandler'\nimport NoData from './NoData'\nimport Placeholder from './Placeholder'\n\nexport const bandGapError = \"Could not load band gap.\"\n\n// Band gap quantities to show. Saved as const object to prevent re-renders\nconst columns = {\n index: {label: 'Ch.', align: 'left'},\n value: {label: 'Value'},\n type: {label: 'Type', placeholder: '-'}\n}\n\n/**\n * Shows a summary of all band gap values, each displayed in a separate row of a\n * table.\n */\nconst BandGap = React.memo(({data, section, 'data-testid': testID}) => {\n const {units} = useUnitContext()\n const extendedColumns = {}\n if (data && data[0].label) {\n extendedColumns.label = {label: '', align: 'left'}\n }\n\n return data !== false\n ? data\n ? \n : \n : \n})\n\nBandGap.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.shape({\n index: PropTypes.number,\n value: PropTypes.number,\n type: PropTypes.string,\n label: PropTypes.string\n })),\n PropTypes.oneOf([false, undefined]) // False for NoData, undefined for Placeholder,\n ]),\n section: PropTypes.string,\n 'data-testid': PropTypes.string\n}\nBandGap.defaultProps = {\n 'data-testid': 'band-gap'\n}\n\nexport default withErrorHandler(bandGapError)(BandGap)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useEffect} from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme, makeStyles} from '@material-ui/core/styles'\nimport { Box } from '@material-ui/core'\nimport Plot from '../plotting/Plot'\nimport {\n PropertyProvenanceItem,\n PropertyProvenanceList\n} from '../entry/properties/PropertyCard'\nimport { withErrorHandler } from '../ErrorHandler'\nimport { mergeObjects, alphabet, resolveInternalRef } from '../../utils'\n\nexport const gfError = 'Could not load Greens functions.'\nconst types = {\n greens_function_iw_im: {\n xLabel: 'i\\u03c9n',\n yLabel: 'Im G(i\\u03c9n)',\n axis: 'matsubara_freq'\n },\n self_energy_iw_im: {\n xLabel: 'i\\u03c9n',\n yLabel: 'Im \\u03A3(i\\u03c9n)',\n axis: 'matsubara_freq'\n },\n greens_function_tau_re: {\n xLabel: '\\u03c4n',\n yLabel: 'Re G(\\u03c4n)',\n axis: 'tau'\n },\n greens_function_freq_im: {\n xLabel: '\\u03c9',\n yLabel: 'Im G(\\u03c9)',\n axis: 'frequencies'\n },\n self_energy_freq_im: {\n xLabel: '\\u03c9',\n yLabel: 'Im \\u03A3(\\u03c9)',\n axis: 'frequencies'\n }\n}\n\nconst useStyles = makeStyles(theme => ({\n plot: {height: '250px'}\n}))\n\n/**\n * Displays Greens functions data together with the provenance information.\n */\nconst GreensFunctions = React.memo(({\n data,\n provenance,\n className,\n 'data-testid': testID,\n ...other\n}) => {\n const theme = useTheme()\n const styles = useStyles()\n const [finalData, setFinalData] = useState(\n data || Object.fromEntries(Object.keys(types).map(type => [type, [data]]))\n )\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff as a side effect, the first render containing\n // the placeholders etc. can be done as fast as possible.\n useEffect(() => {\n if (!data) {\n setFinalData(Object.fromEntries(Object.keys(types).map(type => [type, [data]])))\n return\n }\n\n const finalData = {}\n for (const [key, plotArray] of Object.entries(data)) {\n if (!plotArray) {\n finalData[key] = [plotArray]\n continue\n }\n const plots = plotArray.map(plot => {\n const {plotData, legendTitle, legendWidth} = plotDegeneracy(plot.x, plot.y, provenance)\n\n // Defining the plot\n const layout = {\n xaxis: {\n fixedrange: false,\n zeroline: true,\n title: {\n text: types[key].xLabel\n }\n },\n yaxis: {\n fixedrange: false,\n zeroline: true,\n title: {\n text: types[key].yLabel\n }\n },\n showlegend: true,\n legend: {\n x: 1,\n y: 1,\n title: {\n text: legendTitle,\n font: {\n size: 12\n }\n },\n xanchor: 'right',\n itemwidth: legendWidth\n }\n }\n return {\n type: key,\n plotData,\n layout,\n title: plot?.label || ''\n }\n })\n finalData[key] = plots\n }\n setFinalData(finalData)\n }, [data, provenance, theme])\n\n return \n {Object.entries(finalData).map(([key, plotArray]) => {\n if (!plotArray) plotArray = [plotArray]\n return plotArray.map((value, index) =>\n \n )\n })}\n {(provenance && !Array.isArray(provenance)) && \n \n \n \n }\n \n})\n\nconst plotType = PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.oneOf([false, undefined])])\nGreensFunctions.propTypes = {\n data: PropTypes.shape({\n greens_function_iw_im: plotType, // Real part of Green's functions in matsubara_freq\n self_energy_iw_im: plotType, // Imaginary part of self-energy in matsubara_freq\n greens_function_tau_re: plotType, // Real part of Green's functions in tau\n greens_function_freq_im: plotType, // Real part of Green's functions in frequencies\n self_energy_freq_im: plotType // Imaginary part of self-energy in frequencies\n }),\n provenance: PropTypes.object, // DMFT provenance\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\nGreensFunctions.defaultProps = {\n 'data-testid': 'gfs'\n}\n\n/**\n * Given index and archive, resolves the data for plotting Green's functions.\n */\nexport function resolveGreensFunctions(properties, archive, pattern) {\n // Return undefined if property not available\n if (!properties.has('greens_functions_electronic')) return false\n\n // With the current metainfo for Green's functions, we cannot tell just with\n // the index data what type of plots will be available. Because of this, we\n // don't show anything until the archive is loaded.\n // TODO: This could be fixed by refactoring the greens functions data so that\n // each section would contain an indexed list of what plots it contains.\n if (!archive) return false\n\n // Resolve the final data once archive is here\n let gfReferences = archive?.results?.properties?.electronic?.greens_functions_electronic || []\n if (!Array.isArray(gfReferences)) gfReferences = [gfReferences]\n const greensFunctions = []\n for (const reference of gfReferences) {\n // Resolving Green's function quantities in tau\n const gfTau = {}\n const matchTau = reference.tau ? reference.tau.match(pattern) : undefined\n const pathTau = matchTau ? matchTau[2] : reference.tau\n const matchGreensFunctionTau = reference.greens_function_tau ? reference.greens_function_tau.match(pattern) : undefined\n const pathGreensFunctionTau = matchGreensFunctionTau ? matchGreensFunctionTau[2] : reference.greens_function_tau\n const sourceArchiveTau = matchTau\n ? (archive.m_ref_archives[matchTau[1]] || archive.m_ref_archives[reference.tau.split('#')[0]])\n : archive\n if (sourceArchiveTau && pathTau) {\n // @TODO ask why I have to flatten the axes (tau, matsubara_freq, frequencies) arrays\n gfTau.tau = resolveInternalRef(pathTau, sourceArchiveTau).flat()\n const greensFunctionTau = resolveInternalRef(pathGreensFunctionTau, sourceArchiveTau)\n gfTau.greens_function_tau_re = greensFunctionTau ? greensFunctionTau.re : undefined\n }\n\n // Resolving Green's function quantities in Matsubara frequencies\n const gfMatsFreq = {}\n const matchMatsFreq = reference.matsubara_freq ? reference.matsubara_freq.match(pattern) : undefined\n const pathMatsFreq = matchMatsFreq ? matchMatsFreq[2] : reference.matsubara_freq\n const matchGreensFunctionMatsFreq = reference.greens_function_iw ? reference.greens_function_iw.match(pattern) : undefined\n const pathGreensFunctionMatsFreq = matchGreensFunctionMatsFreq ? matchGreensFunctionMatsFreq[2] : reference.greens_function_iw\n const matchSelfEnergyMatsFreq = reference.self_energy_iw ? reference.self_energy_iw.match(pattern) : undefined\n const pathSelfEnergyMatsFreq = matchSelfEnergyMatsFreq ? matchSelfEnergyMatsFreq[2] : reference.self_energy_iw\n const sourceArchiveMatsFreq = matchMatsFreq\n ? (archive.m_ref_archives[matchMatsFreq[1]] || archive.m_ref_archives[reference.matsubara_freq.split('#')[0]])\n : archive\n if (sourceArchiveMatsFreq && pathMatsFreq) {\n gfMatsFreq.matsubara_freq = resolveInternalRef(pathMatsFreq, sourceArchiveMatsFreq).flat()\n const greensFunctionMatsFreq = resolveInternalRef(pathGreensFunctionMatsFreq, sourceArchiveMatsFreq)\n gfMatsFreq.greens_function_iw_im = greensFunctionMatsFreq ? greensFunctionMatsFreq.im : undefined\n const selfEnergyMatsFreq = resolveInternalRef(pathSelfEnergyMatsFreq, sourceArchiveMatsFreq)\n gfMatsFreq.self_energy_iw_im = selfEnergyMatsFreq ? selfEnergyMatsFreq.im : undefined\n }\n const gfImAxis = mergeObjects(gfTau, gfMatsFreq)\n\n // Resolving Green's function quantities in Matsubara frequencies\n const gfFreq = {}\n const matchFreq = reference.frequencies ? reference.frequencies.match(pattern) : undefined\n const pathFreq = matchFreq ? matchFreq[2] : reference.frequencies\n const matchGreensFunctionFreq = reference.greens_function_freq ? reference.greens_function_freq.match(pattern) : undefined\n const pathGreensFunctionFreq = matchGreensFunctionFreq ? matchGreensFunctionFreq[2] : reference.greens_function_freq\n const matchSelfEnergyFreq = reference.self_energy_freq ? reference.self_energy_freq.match(pattern) : undefined\n const pathSelfEnergyFreq = matchSelfEnergyFreq ? matchSelfEnergyFreq[2] : reference.self_energy_freq\n const sourceArchiveFreq = matchFreq\n ? (archive.m_ref_archives[matchFreq[1]] || archive.m_ref_archives[reference.frequencies.split('#')[0]])\n : archive\n if (sourceArchiveFreq && pathFreq) {\n gfFreq.frequencies = resolveInternalRef(pathFreq, sourceArchiveFreq).flat()\n const greensFunctionFreq = resolveInternalRef(pathGreensFunctionFreq, sourceArchiveFreq)\n gfFreq.greens_function_freq_im = greensFunctionFreq ? greensFunctionFreq.im : undefined\n const selfEnergyFreq = resolveInternalRef(pathSelfEnergyFreq, sourceArchiveFreq)\n gfFreq.self_energy_freq_im = selfEnergyFreq ? selfEnergyFreq.im : undefined\n }\n\n // Merging all resolved data into gf.\n const gf = mergeObjects(gfImAxis, gfFreq)\n gf.type = reference.type || undefined\n gf.label = reference.label || undefined\n gf.m_path = `${archive?.metadata?.entry_id}/data/results/properties/electronic/greens_functions_electronic`\n if (Object.keys(gf).length !== 0 && gf.type !== 'impurity') greensFunctions.push(gf)\n }\n\n // Store all data under one dictionary for plotting\n const data = {}\n for (const gf of greensFunctions) {\n for (const [type, value] of Object.entries(types)) {\n if (gf[type] && gf[value.axis]) {\n const oldData = data[type]\n if (!oldData) {\n data[type] = []\n }\n data[type].push({x: gf[value.axis], y: gf[type]})\n }\n }\n }\n return data\n}\n\n/**\n * Plots data in atom, orbital and spin space, taking into account degeneracies for the\n * labeling and titles.\n */\nfunction plotDegeneracy(axisData, data, provenance) {\n const oneSpecies = data.length === 1\n const oneSpin = provenance.magnetic_state === 'paramagnetic'\n const atomLabels = alphabet\n let legendTitle = ''\n let legendWidth = 30\n const plotData = []\n for (let iAtom = 0; iAtom < data.length; ++iAtom) {\n const atomData = data[iAtom]\n if (oneSpin) { // We only show one spin data\n const spinData = atomData[0]\n for (let iOrb = 0; iOrb < spinData.length; ++iOrb) {\n plotData.push({\n x: axisData,\n y: spinData[iOrb],\n name: `${oneSpecies ? '' : `${atomLabels[iAtom]}`}d${iOrb}`,\n type: 'scatter'\n })\n }\n legendTitle = `${oneSpecies ? '[orbital]' : '[atom][orbital]'}`\n legendWidth = oneSpecies ? 30 : 40\n } else {\n for (let iSpin = 0; iSpin < atomData.length; ++iSpin) {\n const spinData = atomData[iSpin]\n for (let iOrb = 0; iOrb < spinData.length; ++iOrb) {\n plotData.push({\n x: axisData,\n y: spinData[iOrb],\n name: `${oneSpecies ? '' : `${atomLabels[iAtom]}`}d${iOrb}${oneSpin ? '' : iSpin ? '+' : '-'}`,\n type: 'scatter'\n })\n }\n }\n legendTitle = `${oneSpecies ? '[orbital][spin]' : '[atom][orbital][spin]'}`\n legendWidth = oneSpecies ? 40 : 60\n }\n }\n return {plotData, legendTitle, legendWidth}\n}\n\nexport default withErrorHandler(gfError)(GreensFunctions)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useMemo } from 'react'\nimport { Subject } from 'rxjs'\nimport PropTypes from 'prop-types'\nimport { Quantity } from '../units/Quantity'\nimport { useUnitContext } from '../units/UnitContext'\nimport DOS from './DOS'\nimport BandStructure from './BandStructure'\nimport BrillouinZone from './BrillouinZone'\nimport BandGap from './BandGap'\nimport GreensFunctions from './GreensFunctions'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { electronicRange } from '../../config'\nimport { PropertyGrid, PropertyItem } from '../entry/properties/PropertyCard'\n\n// Styles\nconst useStyles = makeStyles((theme) => {\n return {\n nodata: {\n top: theme.spacing(0.7),\n bottom: '3.55rem'\n },\n placeholder: {\n top: theme.spacing(0.7),\n bottom: theme.spacing(2)\n }\n }\n})\n\nconst ElectronicProperties = React.memo(({\n bs,\n dos,\n brillouin_zone,\n band_gap,\n gf,\n index,\n classes\n}) => {\n // We resolve the DMFT methodology from results.method\n const dmftprovenance = index?.results?.method?.simulation?.dmft || []\n\n const {units} = useUnitContext()\n const range = useMemo(() => new Quantity(electronicRange, 'electron_volt').toSystem(units).value(), [units])\n const bsLayout = useMemo(() => ({yaxis: {autorange: false, range: range}}), [range])\n const dosLayout = useMemo(() => ({yaxis: {autorange: false, range: range}}), [range])\n\n // RxJS subject for efficiently propagating y axis changes between DOS and BS\n const bsYSubject = useMemo(() => new Subject(), [])\n const dosYSubject = useMemo(() => new Subject(), [])\n\n // Styles\n const styles = useStyles({classes: classes})\n\n // Synchronize panning between BS/DOS plots\n const handleBSRelayouting = useCallback((event) => {\n const update = {yaxis: {range: [event['yaxis.range[0]'], event['yaxis.range[1]']]}}\n bsYSubject.next(update)\n }, [bsYSubject])\n const handleDOSRelayouting = useCallback((event) => {\n const update = {yaxis: {range: [event['yaxis.range[0]'], event['yaxis.range[1]']]}}\n dosYSubject.next(update)\n }, [dosYSubject])\n\n // Custom layout if only band gaps are available\n if (bs === false && dos === false && brillouin_zone === false && gf === false) {\n return \n \n \n \n \n // Custom layout if only DOS is available\n } else if (bs === false && band_gap === false && brillouin_zone === false && gf === false) {\n return \n \n { bsYSubject.next({yaxis: {range: range}}) }}\n layoutSubject={dosYSubject}\n data-testid=\"bs-electronic\"\n />\n \n \n { dosYSubject.next({yaxis: {range: range}}) }}\n units={units}\n layoutSubject={bsYSubject}\n data-testid=\"dos-electronic\"\n />\n \n \n // Custom layout if only Greens functions are available\n } else if (bs === false && dos === false && band_gap === false && brillouin_zone === false) {\n return \n \n \n \n \n // Layout when all properties can be present\n } else {\n return \n \n { bsYSubject.next({yaxis: {range: range}}) }}\n layoutSubject={dosYSubject}\n data-testid=\"bs-electronic\"\n />\n \n \n { dosYSubject.next({yaxis: {range: range}}) }}\n units={units}\n layoutSubject={bsYSubject}\n data-testid=\"dos-electronic\"\n />\n \n \n \n \n \n \n \n {gf !== false &&\n \n \n \n }\n \n }\n})\n\nElectronicProperties.propTypes = {\n dos: PropTypes.any,\n bs: PropTypes.any,\n brillouin_zone: PropTypes.any,\n band_gap: PropTypes.any,\n gf: PropTypes.any,\n classes: PropTypes.object,\n index: PropTypes.object\n}\n\nexport default ElectronicProperties\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { resolveInternalRef } from '../../../utils'\nimport { PropertyCard } from './PropertyCard'\nimport ElectronicProperties from '../../visualization/ElectronicProperties'\nimport { resolveGreensFunctions } from '../../visualization/GreensFunctions'\nimport { resolveDosNew, resolveDosOld } from '../../visualization/DOS'\n\nconst ElectronicPropertiesCard = React.memo(({index, properties, archive}) => {\n // Find out which properties are present\n const hasDosNew = properties.has('dos_electronic_new')\n const hasDosOld = properties.has('dos_electronic')\n const hasBs = properties.has('band_structure_electronic')\n const hasBandGap = properties.has('electronic.band_structure_electronic.band_gap')\n const hasGf = properties.has('greens_functions_electronic')\n\n // Do not show the card if none of the properties are available\n if (!hasDosNew && !hasDosOld && !hasBs && !hasBandGap && !hasGf) return null\n\n let bsReferences = archive?.results?.properties?.electronic?.band_structure_electronic || []\n const pattern = '\\\\.\\\\./(?:entries|upload/archive|uploads.+?archive)/(.+?)(?:/archive#|#)(.+)'\n if (!Array.isArray(bsReferences)) bsReferences = [bsReferences]\n\n // Resolve the new DOS schema data. For older entries, resolve the old DOS schema data\n let dos = (hasDosOld || hasDosNew) ? undefined : false\n if (archive) {\n if (hasDosNew) dos = resolveDosNew(properties, archive, pattern)\n if (!hasDosNew && hasDosOld) dos = resolveDosOld(properties, archive, pattern)\n }\n\n // Resolve band structure data\n let bs = hasBs ? undefined : false\n let bz = hasBs ? undefined : false\n if (archive) {\n bs = []\n try {\n for (const reference of bsReferences) {\n const d = {}\n const match = reference.reciprocal_cell?.match(pattern)\n const path = match ? match[2] : reference.reciprocal_cell\n const segmentPath = match ? reference.segment.map(ref => ref.match(pattern)[2]) : reference.segment\n const sourceArchive = match ? (archive.m_ref_archives[match[1]] || archive.m_ref_archives[reference.reciprocal_cell.split('#')[0]]) : archive\n d.segment = sourceArchive ? resolveInternalRef(segmentPath, sourceArchive) : null\n d.name = reference.label\n d.m_path = `${archive?.metadata?.entry_id}/data/results/properties/electronic/band_structure_electronic`\n if (reference.band_gap) {\n d.energy_highest_occupied = Math.max(...reference.band_gap.map(x => x.energy_highest_occupied))\n d.band_gap = reference.band_gap\n }\n if (d.segment) bs.push(d)\n const reciprocal_cell = sourceArchive ? resolveInternalRef(path, sourceArchive) : null\n if (reciprocal_cell) {\n bz = {\n reciprocal_cell: reciprocal_cell,\n segment: d.segment\n }\n }\n }\n } catch (e) {\n }\n bs = bs.length === 0 ? false : bs\n bz = bz || false\n }\n\n // Resolve band gap data. TODO: The API is not returning band gap\n // information when using electronic: 'include-resolved' and there is\n // nothing to resolve. This is why we alternatively also look for the band\n // gap data in the index data.\n let bg\n if (hasBandGap) {\n bg = []\n function addBandGaps(sections) {\n for (const section of sections || []) {\n if (!section.band_gap) continue\n bg.push(...section.band_gap)\n }\n }\n addBandGaps(bsReferences)\n if (bg.length === 0) {\n let bsReferencesIndex = index?.results?.properties?.electronic?.band_structure_electronic || []\n if (!Array.isArray(bsReferencesIndex)) bsReferencesIndex = [bsReferencesIndex]\n addBandGaps(bsReferencesIndex)\n }\n bg = bg.length === 0 ? false : bg\n } else {\n bg = false\n }\n\n // Resolve Greens functions data\n const gf = resolveGreensFunctions(properties, archive, pattern)\n\n return \n \n \n})\n\nElectronicPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default ElectronicPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { } from 'react'\nimport PropTypes from 'prop-types'\nimport { QuantityTable, QuantityRow, QuantityCell } from '../Quantity'\nimport NoData from './NoData'\nimport Placeholder from './Placeholder'\n\n/**\n * Shows a summary of solar cell properties.\n */\nconst SolarCell = React.memo(({data}) => {\n const prefix = 'results.properties.optoelectronic.solar_cell'\n return data !== false\n ? data\n ? \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n : \n : \n})\n\nSolarCell.propTypes = {\n data: PropTypes.any\n}\n\nexport default SolarCell\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyGrid, PropertyItem } from '../entry/properties/PropertyCard'\nimport SolarCell from './SolarCell'\n\n// Displays the set of optoelectronic properties.\nconst OptoelectronicProperties = React.memo(({\n bandGap,\n solarCell\n}) => {\n return \n \n \n \n \n})\n\nOptoelectronicProperties.propTypes = {\n bandGap: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n solarCell: PropTypes.any // Set to false if not available, set to other falsy value to show placeholder.\n}\n\nexport default OptoelectronicProperties\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport OptoelectronicProperties from '../../visualization/OptoelectronicProperties'\n\nconst SolarCellPropertiesCard = React.memo(({index, properties, archive}) => {\n // Find out which properties are present\n const hasSc = properties.has('solar_cell')\n\n // Do not show the card if none of the properties are available\n if (!hasSc) {\n return null\n }\n\n // Resolve solar cell data\n const solarCell = index?.results?.properties?.optoelectronic?.solar_cell || false\n\n return \n \n \n})\n\nSolarCellPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default SolarCellPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {\n useCallback,\n useEffect,\n useLayoutEffect,\n useState,\n useRef,\n useMemo\n} from 'react'\nimport { useResizeDetector } from 'react-resize-detector'\nimport { makeStyles } from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport { isNil, isEqual, range } from 'lodash'\nimport { Stage, Vector3 } from 'ngl'\nimport StructureBase from './StructureBase'\nimport { wrapModes } from '../buttons/DownloadSystemButton'\nimport * as THREE from 'three'\nimport { withErrorHandler } from '../ErrorHandler'\nimport { useAsyncError } from '../../hooks'\nimport { useApi } from '../api'\nimport { download, parseNomadUrl } from '../../utils'\n\nconst useStyles = makeStyles((theme) => ({\n canvas: {\n width: '100%',\n height: '100%'\n },\n canvasParent: {\n height: '100%',\n width: '100%',\n boxSizing: 'border-box'\n }\n}))\nconst StructureNGL = React.memo(({\n topologyMap,\n entryId,\n selected,\n sizeLimit,\n onFullscreen,\n ...rest\n}) => {\n const styles = useStyles()\n const {height, width, ref: canvasParentRef} = useResizeDetector()\n const [species, setSpecies] = useState()\n const [loading, setLoading] = useState(true)\n const [prompt, setPrompt] = useState()\n const [accepted, setAccepted] = useState(false)\n const [noData, setNoData] = useState(false)\n const [ready, setReady] = useState(false)\n const [showBonds, setShowBonds] = useState(false)\n const [showCell, setShowCell] = useState(true)\n const [showLatticeConstants, setShowLatticeConstants] = useState(true)\n const [disableShowLatticeConstants, setDisableShowLatticeContants] = useState(true)\n const [wrapMode, setWrapMode] = useState(wrapModes.wrap.key)\n const [disableWrapMode, setDisableWrapMode] = useState(false)\n const [disableShowCell, setDisableShowCell] = useState(false)\n const [disableShowBonds, setDisableShowBonds] = useState(false)\n const stageRef = useRef()\n const viewerRef = useRef()\n const componentsRef = useRef({})\n const componentRef = useRef()\n const canvasRef = useRef()\n const readyRef = useRef(true)\n const alignmentRef = useRef()\n const rotationsRef = useRef()\n const representationMap = useRef({})\n const representationRef = useRef()\n const selectionRef = useRef()\n const { api } = useApi()\n const asyncError = useAsyncError()\n const {entryId: newEntryId, path} = getSystemAPIQuery(selected, entryId, topologyMap)\n const system = topologyMap?.[selected]\n const nAtomsAccepted = useRef(0)\n\n // Fetch the number of atoms\n const nAtoms = useMemo(() => {\n const nAtoms = topologyMap?.[selected]?.n_atoms\n if (nAtoms > 500) {\n setShowBonds(false)\n setDisableShowBonds(true)\n }\n if (nAtoms > sizeLimit && nAtoms > nAtomsAccepted.current) {\n setPrompt(\n `Visualization is by default disabled for systems with more than ${sizeLimit} ` +\n `atoms. Do you wish to enable visualization for this system with ${nAtoms} atoms?`\n )\n setAccepted(false)\n } else {\n setPrompt()\n setAccepted(true)\n }\n return nAtoms\n }, [sizeLimit, topologyMap, selected])\n\n // Updated the list of the species for the currently shown system\n useEffect(() => {\n const elements = system?.elements\n let species\n if (elements) {\n try {\n species = elements.map(symbol => {\n const symbolUpperCase = symbol.toUpperCase()\n const atomicNumber = atomicNumbers[symbolUpperCase]\n const color = elementColors[symbolUpperCase]\n return {\n label: symbol,\n color: color ? `#${color.toString(16).padStart(6, 0)}` : '#ff1493',\n radius: vdwRadii[atomicNumber] || 0.1,\n atomicNumber: atomicNumber || 0\n }\n })\n } catch {\n }\n }\n setSpecies(species)\n }, [system])\n\n // Forces a three.js render\n const render = useCallback(() => {\n viewerRef.current.render()\n }, [])\n\n // Toggles bond visiblity on all representations\n const handleAccept = useCallback(() => {\n nAtomsAccepted.current = nAtoms\n setAccepted(true)\n setPrompt()\n }, [nAtoms])\n\n // Toggles bond visiblity on all representations\n const handleShowBonds = useCallback((value) => {\n setShowBonds(value)\n for (const repr of Object.values(representationMap.current)) {\n repr.bonds.setVisibility(value)\n }\n }, [])\n\n // Toggles cell visibility on all components\n const handleShowCell = useCallback((value, updateState) => {\n if (updateState) setShowCell(value)\n for (const component of Object.values(componentsRef.current)) {\n const unitCell = component.unitCell\n if (unitCell) unitCell.visible = value\n }\n render()\n }, [render])\n\n // Toggles latticeConstant visibility on all components\n const handleShowLatticeConstants = useCallback((value, updateState) => {\n if (updateState) setShowLatticeConstants(value)\n for (const component of Object.values(componentsRef.current)) {\n const latticeConstants = component.latticeConstants\n if (latticeConstants) latticeConstants.visible = value\n }\n render()\n }, [render])\n\n // Toggles position wrapping on all components\n const handleWrapModeChange = useCallback((event) => {\n setWrapMode(event.target.value)\n representationRef.current.wrapMode = event.target.value\n wrapRepresentation(componentRef.current, representationRef.current)\n componentRef.current.autoView(selectionRef.current)\n }, [])\n\n /**\n * Apply the given alignment and rotation to the component.\n *\n * @param {*} alignment The alignment to apply.\n * @param {THREE.Euler} rotation The rotation to apply.\n * @param {Vector3[]} basis The basis vectors.\n * @param {*} component The component to which the view is applied to.\n */\n const view = useCallback(() => {\n const rotations = rotationsRef.current\n const alignment = alignmentRef.current\n const component = componentRef.current\n const basis = component.basis\n\n // Reset the control orientation\n component.stage.viewerControls.orient(new THREE.Matrix4())\n\n // Get quaternion that aligns the lattice vectors\n const quaternion = basis\n ? getAlignment(alignment, {a: basis[0], b: basis[1], c: basis[2]})\n : new THREE.Quaternion()\n\n // Apply additional rotations to quaternion\n for (const rotation of rotations) {\n const quaternionRotate = new THREE.Quaternion()\n quaternionRotate.setFromEuler(new THREE.Euler(...rotation.map(r => -r / 180 * Math.PI)))\n quaternion.premultiply(quaternionRotate)\n }\n\n component.setRotation(quaternion)\n }, [])\n\n // Resets the zoom and alignment\n const handleReset = useCallback(() => {\n view()\n componentRef.current.autoView(selectionRef.current)\n // Autoview does not work nicely for single atoms: here we zoom back manually\n if (representationRef?.current?.indices?.length === 1) {\n componentRef.current.stage.viewerControls.zoom(-35)\n }\n }, [view])\n\n // Resizes the canvas to fit current parent\n const handleResize = useCallback((width, height) => {\n if (!componentRef.current) return\n canvasRef.current.style.width = `${width}px`\n canvasRef.current.style.height = `${height}px`\n stageRef.current.handleResize()\n componentRef.current.autoView(selectionRef.current)\n }, [])\n\n // Whenever the canvas parent size changes, resize the WebGL canvas.\n useLayoutEffect(() => {\n handleResize(width, height)\n }, [width, height, handleResize])\n\n const handleFullscreen = useCallback(() => {\n onFullscreen && onFullscreen()\n }, [onFullscreen])\n\n const handleTakeScreenshot = useCallback(async (name) => {\n if (!stageRef.current) return\n const imgData = await stageRef.current.makeImage()\n try {\n download(name + \".png\", imgData)\n } catch (e) {\n }\n }, [])\n\n // Initialize the viewer\n useEffect(() => {\n const drawDistance = 1000\n const stage = new Stage(\n canvasRef.current,\n {\n backgroundColor: \"white\",\n cameraType: \"orthographic\",\n clipNear: 0,\n clipFar: drawDistance,\n clipDist: 0,\n zoomSpeed: 5,\n fogNear: 0,\n fogFar: drawDistance\n }\n )\n stageRef.current = stage\n viewerRef.current = stage.viewer\n }, [])\n\n /**\n * Used to asynchronously load a new component to the NGL viewer. Since\n * loading the structure is a long-taking operation, running this function\n * later in the event queue allows the component to perform state updates\n * (e.g. loading placeholder) while the viewer is loading.\n */\n const loadComponent = useCallback(async (system, entryId, path, componentKey, topologyMap) => {\n // Load the structure if not already cached\n const format = 'pdb'\n let component = componentsRef.current[componentKey]\n let root\n if (!component) {\n const systemResponse = await api.get(\n `systems/${entryId}`,\n {path: path, format},\n {responseType: 'blob'}\n )\n\n // PDB files (or any other file formats supported by NGL) cannot contain\n // both the full lattice vectors and the PBC. These are, however, needed\n // for the proper visualization of the system. To work around this, they\n // are stored as a REMARK 285 and read here.\n const header = await systemResponse.slice([0], [280]).text()\n let pbc = [true, true, true]\n let a, b, c\n const regexFloat = /[+-]?\\d+(\\.\\d+)?/g\n for (const value of header.split('\\n')) {\n const aPrefix = 'REMARK 285 A:'\n const bPrefix = 'REMARK 285 B:'\n const cPrefix = 'REMARK 285 C:'\n const pbcPrefix = 'REMARK 285 PBC'\n if (value.startsWith(aPrefix)) {\n a = value.slice(aPrefix.length).match(regexFloat).map((v) => parseFloat(v))\n } else if (value.startsWith(bPrefix)) {\n b = value.slice(bPrefix.length).match(regexFloat).map((v) => parseFloat(v))\n } else if (value.startsWith(cPrefix)) {\n c = value.slice(cPrefix.length).match(regexFloat).map((v) => parseFloat(v))\n } else if (value.startsWith(pbcPrefix)) {\n const regex = /TRUE|FALSE/g\n pbc = value.match(regex)?.map((v) => v === 'TRUE')\n }\n }\n\n // Load file\n component = await stageRef.current.loadFile(\n systemResponse,\n {ext: format, defaultRepresentation: false}\n )\n\n // Find the 'root' system for the selected item. The root system contains\n // information about the cell and periodic boundary conditions.\n function getRoot(top) {\n return ((top.atoms_ref || top.atoms) && isNil(top.indices))\n ? top\n : getRoot(topologyMap[top.parent_system])\n }\n root = getRoot(system)\n\n // Recursively add a new representation for each child that does not have\n // it's own component\n function addRepresentation(top) {\n const structuralType = top.structural_type\n const isMonomer = structuralType === 'monomer'\n const isMolecule = structuralType === 'molecule'\n const indices = top.indices\n ? ((isMolecule || isMonomer)\n ? top.indices[0]\n : top.indices).flat()\n : range(top.n_atoms)\n const sele = top.indices\n ? `@${indices.join(',')}`\n : 'all'\n\n // Add representation for the bonds\n const bondRepr = component.addRepresentation(\n 'licorice',\n {\n colorScheme: 'uniform',\n colorValue: 'white',\n bondScale: 0.1,\n sele\n }\n )\n // Add representation for the atoms\n const atomRepr = component.addRepresentation('spacefill', {radiusScale: 0.3, sele})\n representationMap.current[top.system_id] = {\n bonds: bondRepr,\n atoms: atomRepr,\n sele: sele,\n indices: indices,\n wrapMode: (isMonomer || isMolecule) ? wrapModes.unwrap.key : wrapModes.wrap.key\n }\n for (const child of top.child_systems || []) {\n if (!child.atoms) addRepresentation(child)\n }\n }\n addRepresentation(root)\n\n // The file formats supported by NGL don't include the true lattice\n // vectors, only the shape of the cell. If the lattive vectors aren't\n // aligned with the cartesian coordinates, the visualization will be\n // incorrect. This is why we need to fetch the true lattice vectors from\n // the archive. Also none of the file formats store the full periodicity\n // of the system, which is also needed for correct wrapping.\n\n // Add a completely custom unit cell and lattice parameter visualization.\n // The objects are added to a dummy 'unitcell' representation that is\n // supported by NGL.\n if (a && b && c) {\n a = new THREE.Vector3().fromArray(a)\n b = new THREE.Vector3().fromArray(b)\n c = new THREE.Vector3().fromArray(c)\n const metaCell = root?.cell\n component.addRepresentation('unitcell', {opacity: 0})\n\n // If some of the basis vectors are collapsed, we need to create\n // artificial ones for the wrapping\n const collapsed = [a.length() === 0, b.length() === 0, c.length() === 0]\n const valid = [metaCell.a !== undefined, metaCell.b !== undefined, metaCell.c !== undefined]\n const basis = [a, b, c]\n const validBases = []\n const invalidBases = []\n for (let i = 0; i < collapsed.length; ++i) {\n const isCollapsed = collapsed[i]\n if (!isCollapsed) validBases.push(basis[i])\n else invalidBases.push(i)\n }\n if (validBases.length === 2) {\n const newBasis = new THREE.Vector3().crossVectors(\n validBases[0],\n validBases[1]\n ).normalize()\n basis[invalidBases[0]] = newBasis\n }\n const fracToCart = new THREE.Matrix4().makeBasis(basis[0], basis[1], basis[2])\n const cartToFrac = fracToCart.clone().invert()\n\n const cell = createCell(\n new THREE.Vector3(),\n basis,\n collapsed,\n '#000',\n 1,\n 0,\n 0\n )\n addObject3DToStage(cell, stageRef.current)\n const latticeConstants = createLatticeConstants(\n basis,\n pbc,\n collapsed,\n valid,\n {\n font: 'Titillium Web,sans-serif',\n size: 0.7,\n stroke: {width: 0.06, color: \"#000\"},\n a: {enabled: true, color: \"#C52929\", label: \"a\"},\n b: {enabled: true, color: \"#47A823\", label: \"b\"},\n c: {enabled: true, color: \"#3B5796\", label: \"c\"},\n alpha: {enabled: true, color: \"#ffffff\", label: \"α\"},\n beta: {enabled: true, color: \"#ffffff\", label: \"β\"},\n gamma: {enabled: true, color: \"#ffffff\", label: \"γ\"}\n }\n )\n addObject3DToStage(latticeConstants, stageRef.current)\n component.unitCell = cell\n component.cartToFrac = cartToFrac\n component.fracToCart = fracToCart\n component.basis = basis\n component.pbc = pbc\n component.latticeConstants = latticeConstants\n }\n }\n componentRef.current = component\n componentsRef.current[componentKey] = component\n\n // We dont want this effect to react to 'wrap'\n }, [api])\n\n // Called whenever the system changes. Loads the structure asynchronously.\n useEffect(() => {\n // No structure to show\n if (isNil(path)) {\n setNoData(true)\n setReady(true)\n readyRef.current = true\n return\n }\n\n // Start loading component\n const componentKey = `${newEntryId}/${path}`\n if (isNil(componentsRef.current[componentKey])) {\n setLoading(true)\n }\n setReady(false)\n readyRef.current = false\n setNoData(false)\n\n // For large systems we ask the user for permission\n if (!accepted) return\n\n // Remember to catch since react error boundaries do not automatically catch\n // from async calls.\n loadComponent(system, newEntryId, path, componentKey, topologyMap)\n .catch(asyncError)\n .finally(() => {\n // Hide other components that have been loaded\n for (const [key, component] of Object.entries(componentsRef.current)) {\n component.setVisibility(key === componentKey)\n }\n setReady(true)\n readyRef.current = true\n })\n }, [system, newEntryId, path, topologyMap, api, asyncError, loadComponent, accepted])\n\n // React to selection\n useEffect(() => {\n if (!ready || !readyRef.current || !system) return\n\n // Resolve how the selected topology should be visualized.\n const topSelection = system\n const topParent = system.parent_system\n const structuralType = topSelection.structural_type\n const isMonomer = structuralType === 'monomer'\n const isMolecule = structuralType === 'molecule'\n const isGroup = structuralType === 'group' || topSelection.label === 'subsystem'\n const independent = topSelection.atoms || (topSelection.atoms_ref && isNil(topSelection.indices)) || isMolecule || isMonomer\n const child_types = topSelection.child_systems\n ? new Set(topSelection.child_systems.map(x => x.structural_type))\n : new Set()\n const isMonomerGroup = isGroup && isEqual(child_types, new Set(['monomer']))\n\n // Determine the selection to center on.\n const representation = representationMap.current[independent ? selected : topParent]\n if (representation) {\n representationRef.current = representation\n selectionRef.current = representation?.sele\n\n // Determine the selections to show opaque, i.e. as a solid color\n const opaque = new Set([selected])\n\n // Determine the selections to show transparent\n const transparent = new Set((isGroup || structuralType === 'active orbitals') ? [topParent] : [])\n\n // Determine whether to show cell\n const cellVisible = !(isMolecule || isMonomer || isMonomerGroup)\n if (cellVisible) {\n handleShowCell(showCell)\n handleShowLatticeConstants(showCell)\n } else {\n handleShowCell(false, false)\n handleShowLatticeConstants(false, false)\n }\n setDisableShowCell(!cellVisible)\n setDisableWrapMode(!independent)\n setWrapMode(representation.wrapMode)\n setDisableShowLatticeContants(!cellVisible)\n\n // Loop through representations and set the correct visualization\n for (const [key, value] of Object.entries(representationMap.current)) {\n const transparency = opaque.has(key) ? 1 : transparent.has(key) ? 0.1 : 0\n if (transparency) {\n value.atoms.setParameters({opacity: transparency})\n value.bonds.setParameters({opacity: transparency})\n value.atoms.setVisibility(true)\n value.bonds.setVisibility(showBonds)\n } else {\n value.atoms.setParameters({opacity: 0})\n value.atoms.setVisibility(false)\n value.bonds.setVisibility(false)\n }\n }\n wrapRepresentation(componentRef.current, representation)\n\n // Configure and reset the view based on the basis vectors.\n const nBasis = 3\n if (nBasis === 3) {\n alignmentRef.current = [['up', 'c'], ['right', 'a']]\n rotationsRef.current = [[0, 30, 0], [30, 0, 0]]\n }\n handleReset()\n }\n setLoading(false)\n // We don't want this effect to react to 'showCell', 'showBonds',\n // 'showLatticeParameters', or 'wrapMode'\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selected, system, ready, handleShowCell, handleShowLatticeConstants, handleReset])\n\n return \n
\n
\n
\n \n})\n\nStructureNGL.propTypes = {\n entryId: PropTypes.string,\n data: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.string\n ]),\n topologyMap: PropTypes.object,\n selected: PropTypes.string,\n sizeLimit: PropTypes.number, // Maximum number of atoms before a prompt is shown.\n onFullscreen: PropTypes.func\n}\n\nStructureNGL.defaultProps = {\n sizeLimit: 40000\n}\n\nexport default withErrorHandler('Could not load structure.')(StructureNGL)\n\n/**\n * Used to resolve the API parameters for fetching a structure that is required\n * to visualize the current selection.\n *\n * @param {string} selected The selected system\n * @param {string} entryId Entry id\n * @param {object} topologyMap Object containing a mapping from system ids to the data.\n * @returns The final entry_id and path for fetching the system file through the API.\n */\nexport function getSystemAPIQuery(selected, entryId, topologyMap) {\n if (isNil(selected) || isNil(entryId) || isNil(topologyMap)) {\n return {entryId: undefined, path: undefined}\n }\n\n // Get path to the first system which stores a reference or actual data for\n // the structure and does not specify indices. This way the visualizer is a\n // bit more optimal compared to doing API calls for every subsystem.\n function getPath(top) {\n let path\n if ((top.atoms_ref || top.atoms) && isNil(top.indices)) {\n path = top.system_id\n } else if (!isNil(top.indices)) {\n path = getPath(topologyMap[top.parent_system])\n }\n return path\n }\n let path = getPath(topologyMap[selected])\n\n // The path may be a reference that points to some other entry as well,\n // here it is resolved\n if (path && !path.startsWith('results')) {\n const nomadUrl = parseNomadUrl(path)\n entryId = nomadUrl.entryId || entryId\n path = nomadUrl.path\n }\n return {entryId, path}\n}\n\n/**\n * Returns a quaternion that aligns the view according to the given input\n * options.\n *\n * @param {*} alignments: List of at most two alignments to set. E.g. [['up',\n * 'c'], ['right', 'b']] will align the c-vector (see 'directions') to point\n * up, and the b-vector to point right. These are applied sequentially.\n * @param {*} directions: Object containing a mapping between direction names\n * and the unit vectors that the correspond to.\n * @returns\n */\nfunction getAlignment(alignments, directions) {\n // Check alignment validity\n if (alignments === undefined) return\n if (alignments.length > 2) throw Error('At most two alignments can be performed.')\n\n const finalQuaternion = new THREE.Quaternion()\n finalQuaternion.identity()\n const alignedDirections = []\n const rotate = (alignment) => {\n const direction = alignment[0]\n const target = alignment[1]\n const targetMap = {\n up: new THREE.Vector3(0, 1, 0),\n down: new THREE.Vector3(0, -1, 0),\n right: new THREE.Vector3(-1, 0, 0),\n left: new THREE.Vector3(1, 0, 0),\n front: new THREE.Vector3(0, 0, -1),\n back: new THREE.Vector3(0, 0, 1)\n }\n const targetVector = targetMap[direction]\n\n // Determine the top direction\n const finalVector = directions[target]\n for (const alignedDirection of alignedDirections) {\n finalVector[alignedDirection] = 0\n }\n\n // Rotate the scene according to the selected top direction\n if (finalVector.length() > 1e-8) {\n const quaternion = new THREE.Quaternion().setFromUnitVectors(\n finalVector.clone().normalize(),\n targetVector.clone().normalize()\n )\n finalQuaternion.premultiply(quaternion)\n\n // Rotate the given directions so that their direction will be correct\n // for the next aligment\n for (const dir in directions) {\n directions[dir].clone().applyQuaternion(quaternion)\n }\n\n if (direction === \"right\" || direction === \"left\") {\n alignedDirections.push(\"x\")\n } else if (direction === \"up\" || direction === \"down\") {\n alignedDirections.push(\"y\")\n } else if (direction === \"front\" || direction === \"back\") {\n alignedDirections.push(\"z\")\n }\n }\n }\n\n // Apply the alignments\n for (const alignment of alignments) {\n rotate(alignment)\n }\n return finalQuaternion\n}\n\n/**\n * Creates outlines for a cell specified by the given basis vectors.\n *\n * @param origin - The origin position for the cell\n * @param basis - The cell basis vectors\n * @param collapsed - Whether a basis vector is collapsed (length = 0)\n * @param color - Color for the cell wireframe\n * @param linewidth - Cell wireframe line width\n * @param dashSize - Cell wireframe dash size. Defaults to 0. Provide a value >\n * 0 for a dashed line.\n * @param gapSize - Cell wireframe dash size. Defaults to 0. Provide a value >\n * 0 for a dashed line.\n */\nfunction createCell(origin, basis, collapsed, color, linewidth, dashSize, gapSize) {\n const cell = new THREE.Object3D()\n let lineMaterial\n if (!(dashSize === 0 && gapSize === 0)) {\n lineMaterial = new THREE.LineDashedMaterial({\n color: color,\n linewidth: linewidth,\n dashSize: dashSize,\n gapSize: gapSize\n })\n } else {\n lineMaterial = new THREE.LineBasicMaterial({\n color: color,\n linewidth: linewidth\n })\n }\n\n function addEdge(points) {\n const lineGeometry = new THREE.BufferGeometry().setFromPoints(points)\n const line = new THREE.Line(lineGeometry, lineMaterial)\n cell.add(line)\n line.computeLineDistances()\n }\n\n for (let len = basis.length, i = 0; i < len; ++i) {\n const isFirstCollapsed = collapsed[i]\n if (isFirstCollapsed) continue\n const basisVector = basis[i]\n\n // First edge\n const points1 = [origin, basisVector.clone().add(origin)]\n addEdge(points1)\n\n // Second edge\n const secondIndex = (i + 1) % len\n const isSecondCollapsed = collapsed[secondIndex]\n const secondAddition = basis[secondIndex].clone()\n if (!isSecondCollapsed) {\n const points2 = [secondAddition.clone().add(origin), basisVector.clone().add(secondAddition).add(origin)]\n addEdge(points2)\n }\n\n // Third edge\n const thirdIndex = (i + 2) % len\n const isThirdCollapsed = collapsed[thirdIndex]\n const thirdAddition = basis[thirdIndex].clone()\n if (!isThirdCollapsed) {\n const points3 = [thirdAddition.clone().add(origin), basisVector.clone().add(thirdAddition).add(origin)]\n addEdge(points3)\n }\n\n // Fourth edge\n if (!isSecondCollapsed && !isThirdCollapsed) {\n const points4 = [secondAddition.clone().add(thirdAddition).add(origin), basisVector.clone().add(secondAddition).add(thirdAddition).add(origin)]\n addEdge(points4)\n }\n }\n return cell\n}\n\n/**\n * Visualizes the lattice constants using the given visualization options.\n *\n * @param {string} options.font Font size for lattice constants. Defaults to 0.7.\n * constants. Applied as default to all labels, can be overridden\n * individually for each lattice constant.\n * @param {string} options.color Font color for lattice constants. Applied\n * as default to all labels, can be overridden individually for each lattice\n * constant. Defaults to\n * @param {string} options.stroke.color Font stroke color\n * for lattice constants. Defaults to \"#000\". Applied as default to all\n * labels, can be overridden individually for each lattice constant.\n * @param {string} options.stroke.width Font stroke width\n * for lattice constants. Defaults to \"#000\". Applied as default to all\n * labels, can be overridden individually for each lattice constant.\n * @param {string} options.a.enabled Whether to display this lattice\n * contant. Defaults to true.\n * @param {string} options.a.color Font color. Defaults to \"#C52929\".\n * @param {string} options.a.font Font family. Defaults to \"Arial\".\n * @param {number} options.a.size Font size. Defaults to 0.7.\n * @param {number} options.a.label The label to display. Defaults to \"a\".\n * @param {number} options.a.stroke.width Font stroke width. Defaults to 0.06.\n * @param {string} options.a.stroke.color Font stroke color. Defaults to \"#000\".\n * @param {string} options.b.enabled Whether to display this lattice\n * contant. Defaults to true.\n * @param {string} options.b.color Font color. Defaults to \"#47A823\".\n * @param {string} options.b.font Font family. Defaults to \"Arial\".\n * @param {number} options.b.size Font size. Defaults to 0.7.\n * @param {number} options.b.label The label to display. Defaults to \"b\".\n * @param {number} options.b.stroke.width Font stroke width. Defaults to 0.06.\n * @param {string} options.b.stroke.color Font stroke color. Defaults to \"#000\".\n * @param {string} options.c.enabled Whether to display this lattice\n * contant. Defaults to true.\n * @param {string} options.c.color Font color. Defaults to \"#3B5796\".\n * @param {string} options.c.font Font family. Defaults to \"Arial\".\n * @param {number} options.c.size Font size. Defaults to 0.7.\n * @param {number} options.c.label The label to display. Defaults to \"c\".\n * @param {number} options.c.stroke.width Font stroke width. Defaults to 0.06.\n * @param {string} options.c.stroke.color Font stroke color. Defaults to \"#000\".\n * @param {string} options.alpha.enabled Whether to display this lattice\n * contant. Defaults to true.\n * @param {string} options.alpha.color Font color. Defaults to \"#ffffff\".\n * @param {string} options.alpha.font Font family. Defaults to \"Arial\".\n * @param {number} options.alpha.size Font size. Defaults to 0.7.\n * @param {number} options.alpha.label The label to display. Defaults to \"α\".\n * @param {number} options.alpha.stroke.width Font stroke width. Defaults to 0.06.\n * @param {string} options.alpha.stroke.color Font stroke color. Defaults to \"#000\".\n * @param {string} options.beta.enabled Whether to display this lattice\n * contant. Defaults to true.\n * @param {string} options.beta.color Font color. Defaults to \"#ffffff\".\n * @param {string} options.beta.font Font family. Defaults to \"Arial\".\n * @param {number} options.beta.size Font size. Defaults to 0.7.\n * @param {number} options.beta.label The label to display. Defaults to \"β\".\n * @param {number} options.beta.stroke.width Font stroke width. Defaults to 0.06.\n * @param {string} options.beta.stroke.color Font stroke color. Defaults to \"#000\".\n * @param {string} options.gamma.enabled Whether to display this lattice\n * contant. Defaults to true.\n * @param {string} options.gamma.color Font color. Defaults to \"#ffffff\".\n * @param {string} options.gamma.font Font family. Defaults to \"Arial\".\n * @param {number} options.gamma.size Font size. Defaults to 0.7.\n * @param {number} options.gamma.label The label to display. Defaults to \"γ\".\n * @param {number} options.gamma.stroke.width Font stroke width. Defaults to 0.06.\n * @param {string} options.gamma.stroke.color Font stroke color. Defaults to \"#000\".\n */\nfunction createLatticeConstants(basis, periodicity, collapsed, valid, options) {\n // Delete old instance\n const latticeConstants = new THREE.Group()\n const opt = options\n\n // Determine the periodicity and setup the visualization accordingly\n const periodicIndices = []\n for (let dim = 0; dim < 3; ++dim) {\n const p1 = periodicity[dim]\n const p2 = periodicity[(dim + 1) % 3]\n const p3 = periodicity[(dim + 2) % 3]\n if (p1 && !p2 && !p3) {\n periodicIndices.push(dim)\n break\n } else if (p1 && p2 && !p3) {\n periodicIndices.push(dim)\n periodicIndices.push((dim + 1) % 3)\n break\n }\n }\n\n // Create new instances\n const infoColor = 0x000000\n const axisOffset = 1.3\n\n let iBasis = -1\n const cellBasisColors = []\n cellBasisColors.push(opt.a.color)\n cellBasisColors.push(opt.b.color)\n cellBasisColors.push(opt.c.color)\n const angleColors = []\n angleColors.push(opt.alpha.color)\n angleColors.push(opt.beta.color)\n angleColors.push(opt.gamma.color)\n const angleStrokeColors = []\n angleStrokeColors.push(opt.alpha?.stroke?.color === undefined ? opt.stroke.color : opt.alpha.stroke.color)\n angleStrokeColors.push(opt.beta?.stroke?.color === undefined ? opt.stroke.color : opt.beta.stroke.color)\n angleStrokeColors.push(opt.gamma?.stroke?.color === undefined ? opt.stroke.color : opt.gamma.stroke.color)\n const angleStrokeWidths = []\n angleStrokeWidths.push(opt.alpha?.stroke?.width === undefined ? opt.stroke.width : opt.alpha.stroke.width)\n angleStrokeWidths.push(opt.beta?.stroke?.width === undefined ? opt.stroke.width : opt.beta.stroke.width)\n angleStrokeWidths.push(opt.gamma?.stroke?.width === undefined ? opt.stroke.width : opt.gamma.stroke.width)\n const angleLabels = [opt.gamma.label, opt.alpha.label, opt.beta.label]\n const axisLabels = [opt.a.label, opt.b.label, opt.c.label]\n const angleEnableds = [opt.gamma.enabled, opt.alpha.enabled, opt.beta.enabled]\n const axisEnableds = [opt.a.enabled, opt.b.enabled, opt.c.enabled]\n const axisFonts = []\n axisFonts.push(opt.a.font === undefined ? opt.font : opt.a.font)\n axisFonts.push(opt.b.font === undefined ? opt.font : opt.b.font)\n axisFonts.push(opt.c.font === undefined ? opt.font : opt.c.font)\n const axisFontSizes = []\n axisFontSizes.push(opt.a.size === undefined ? opt.size : opt.a.size)\n axisFontSizes.push(opt.b.size === undefined ? opt.size : opt.b.size)\n axisFontSizes.push(opt.c.size === undefined ? opt.size : opt.c.size)\n const strokeColors = []\n strokeColors.push(opt.a?.stroke?.color === undefined ? opt.stroke.color : opt.a.stroke.color)\n strokeColors.push(opt.b?.stroke?.color === undefined ? opt.stroke.color : opt.b.stroke.color)\n strokeColors.push(opt.c?.stroke?.color === undefined ? opt.stroke.color : opt.c.stroke.color)\n const strokeWidths = []\n strokeWidths.push(opt.a?.stroke?.width === undefined ? opt.stroke.width : opt.a.stroke.width)\n strokeWidths.push(opt.b?.stroke?.width === undefined ? opt.stroke.width : opt.b.stroke.width)\n strokeWidths.push(opt.c?.stroke?.width === undefined ? opt.stroke.width : opt.c.stroke.width)\n const angleFonts = []\n angleFonts.push(opt.alpha.font === undefined ? opt.font : opt.alpha.font)\n angleFonts.push(opt.beta.font === undefined ? opt.font : opt.beta.font)\n angleFonts.push(opt.gamma.font === undefined ? opt.font : opt.gamma.font)\n const angleFontSizes = []\n angleFontSizes.push(opt.alpha.size === undefined ? opt.size : opt.alpha.size)\n angleFontSizes.push(opt.beta.size === undefined ? opt.size : opt.beta.size)\n angleFontSizes.push(opt.gamma.size === undefined ? opt.size : opt.gamma.size)\n\n // If 2D periodic, we save the periodic indices, and ensure a right\n // handed coordinate system.\n for (let iTrueBasis = 0; iTrueBasis < 3; ++iTrueBasis) {\n iBasis += 1\n const axisLabel = axisLabels[iBasis]\n const axisColor = cellBasisColors[iBasis]\n const axisFont = axisFonts[iBasis]\n const axisFontSize = axisFontSizes[iBasis]\n const angleFontSize = angleFontSizes[iBasis]\n const strokeWidth = strokeWidths[iBasis]\n const strokeColor = strokeColors[iBasis]\n const angleFont = angleFonts[iBasis]\n const angleColor = angleColors[iBasis]\n const angleLabel = angleLabels[iBasis]\n const angleStrokeColor = angleStrokeColors[iBasis]\n const angleStrokeWidth = angleStrokeWidths[iBasis]\n const axisEnabled = axisEnableds[iBasis]\n const angleEnabled = angleEnableds[iBasis]\n\n const collapsed1 = collapsed[iTrueBasis]\n const collapsed2 = collapsed[(iTrueBasis + 1) % 3]\n const collapsed3 = collapsed[(iTrueBasis + 2) % 3]\n const valid1 = valid[iTrueBasis]\n const valid2 = valid[(iTrueBasis + 1) % 3]\n const basisVec1 = basis[iTrueBasis]\n const basisVec2 = basis[(iTrueBasis + 1) % 3].clone()\n const basisVec3 = basis[(iTrueBasis + 2) % 3].clone()\n\n // Basis and angle label selection, same for all systems\n if (axisEnabled && !collapsed1 && valid1) {\n const origin = new THREE.Vector3(0, 0, 0)\n const dir = basisVec1.clone()\n\n // Add an axis label\n const textPos = dir.clone()\n .multiplyScalar(0.5)\n let labelOffset\n let newBasis\n if (collapsed2 && collapsed3) {\n newBasis = new THREE.Vector3(0, 0, 1)\n labelOffset = new THREE.Vector3().crossVectors(basisVec1, newBasis)\n } else if (collapsed2) {\n newBasis = new THREE.Vector3().crossVectors(basisVec1, basisVec3)\n labelOffset = new THREE.Vector3().crossVectors(basisVec1, newBasis)\n } else if (collapsed3) {\n newBasis = new THREE.Vector3().crossVectors(basisVec1, basisVec2)\n labelOffset = new THREE.Vector3().crossVectors(basisVec1, newBasis)\n } else {\n const labelOffset1 = new THREE.Vector3().crossVectors(basisVec1, basisVec2)\n const labelOffset2 = new THREE.Vector3().crossVectors(basisVec1, basisVec3)\n labelOffset = new THREE.Vector3().sub(labelOffset1).add(labelOffset2)\n }\n labelOffset.normalize()\n labelOffset.multiplyScalar(0.8)\n textPos.add(labelOffset)\n\n const axisLabelSprite = createLabel(\n textPos,\n axisLabel,\n axisColor,\n axisFont,\n axisFontSize,\n new THREE.Vector2(0.0, 0.0),\n strokeWidth,\n strokeColor\n )\n latticeConstants.add(axisLabelSprite)\n axisLabels.push(axisLabelSprite)\n\n // Add basis vector colored line\n const cellVectorMaterial = new THREE.MeshBasicMaterial({\n color: axisColor,\n transparent: true,\n opacity: 0.75\n })\n const cellVector = basisVec1.clone()\n const cellVectorLine = createCylinder(origin.clone(), cellVector.clone().add(origin), 0.09, 10, cellVectorMaterial)\n latticeConstants.add(cellVectorLine)\n\n // Add basis vector axis line\n const cellAxisMaterial = new THREE.MeshBasicMaterial({\n color: \"#000000\"\n })\n const axisStart = basis[iTrueBasis].clone()\n const axisEnd = axisStart.clone().multiplyScalar(1 + axisOffset / axisStart.length())\n const cellAxisVectorLine = createCylinder(origin.clone(), axisEnd, 0.02, 10, cellAxisMaterial)\n latticeConstants.add(cellAxisVectorLine)\n\n // Add axis arrow\n const arrowGeometry = new THREE.CylinderGeometry(0, 0.10, 0.5, 12)\n const arrowMaterial = new THREE.MeshBasicMaterial({\n color: infoColor\n })\n const arrow = new THREE.Mesh(arrowGeometry, arrowMaterial)\n arrow.position.copy(dir)\n .multiplyScalar(1 + axisOffset / dir.length())\n arrow.lookAt(new THREE.Vector3())\n arrow.rotateX(-Math.PI / 2)\n latticeConstants.add(arrow)\n }\n\n // Add angle label and curve\n if (angleEnabled && !collapsed1 && !collapsed2 && valid1 && valid2) {\n const arcMaterial = new THREE.LineDashedMaterial({\n color: infoColor,\n linewidth: 2,\n dashSize: 0.2,\n gapSize: 0.1\n })\n\n const normal = new THREE.Vector3().crossVectors(basisVec1, basisVec2)\n const angle = basisVec1.angleTo(basisVec2)\n const maxRadius = 5\n const minRadius = 1\n const radius = Math.max(\n Math.min(1 / 6 * basisVec1.length(), 1 / 6 * basisVec2.length(), maxRadius),\n minRadius\n )\n const curve = new THREE.EllipseCurve(\n 0, 0, // ax, aY\n radius, radius, // xRadius, yRadius\n 0, angle, // aStartAngle, aEndAngle\n false, // aClockwise\n 0 // aRotation\n )\n const nArcPoints = 20\n const points = curve.getSpacedPoints(nArcPoints)\n const arcGeometry = new THREE.BufferGeometry().setFromPoints(points)\n const arc = new THREE.Line(arcGeometry, arcMaterial)\n arc.computeLineDistances()\n\n // First rotate the arc so that it's x-axis points towards the\n // first basis vector that defines the arc\n const xAxis = new THREE.Vector3(1, 0, 0)\n const quaternion = new THREE.Quaternion().setFromUnitVectors(\n xAxis,\n basisVec1.clone().normalize()\n )\n arc.quaternion.copy(quaternion)\n\n // Then rotate the arc along it's x axis so that the xy-plane\n // coincides with the plane defined by the the two basis vectors\n // that define the plane.\n const verticesArray = arcGeometry.attributes.position.array\n const nVertices = verticesArray.length / 3\n const lastArcPointLocal = new THREE.Vector3().fromArray(verticesArray, (nVertices - 1) * 3)\n arc.updateMatrixWorld() // The positions are not otherwise updated properly\n const lastArcPointWorld = arc.localToWorld(lastArcPointLocal.clone())\n\n // The angle direction is defined by the first basis vector\n const axis = basisVec1\n const arcNormal = new THREE.Vector3()\n .crossVectors(axis, lastArcPointWorld)\n let planeAngle = normal.angleTo(arcNormal)\n const planeCross = new THREE.Vector3()\n .crossVectors(basisVec2, lastArcPointWorld)\n const directionValue = planeCross.dot(axis)\n if (directionValue > 0) {\n planeAngle = -planeAngle\n }\n arc.rotateX(planeAngle)\n\n // Add label for the angle\n arc.updateMatrixWorld() // The positions are not otherwise updated properly\n arc.updateMatrix() // The positions are not otherwise updated properly\n const angleLabelPos = arc.localToWorld(new THREE.Vector3().fromArray(verticesArray, (nArcPoints / 2 - 1) * 3))\n const angleLabelLen = angleLabelPos.length()\n angleLabelPos.multiplyScalar(1 + 0.3 / angleLabelLen)\n const angleLabelObj = createLabel(\n angleLabelPos,\n angleLabel.toString(),\n angleColor,\n angleFont,\n angleFontSize,\n new THREE.Vector2(0.0, 0.0),\n angleStrokeWidth,\n angleStrokeColor\n )\n latticeConstants.add(angleLabelObj)\n latticeConstants.add(arc)\n }\n }\n return latticeConstants\n}\n\n/**\n * Helper function for creating a text sprite that lives in 3D space.\n *\n * @param pos1 - Start position\n * @param pos2 - End position\n * @param radius - Cylinder radius\n * @param material - Cylinder material\n */\nfunction createLabel(\n position,\n label,\n color,\n fontFamily,\n fontSize,\n offset = undefined,\n strokeWidth = 0,\n strokeColor = \"#000\"\n) {\n const canvas = document.createElement('canvas')\n const size = 256\n canvas.width = size\n canvas.height = size\n const ctx = canvas.getContext('2d')\n\n // Draw label\n const fontFactor = 0.90\n ctx.fillStyle = color\n ctx.font = `${fontFactor * size}px ${fontFamily}`\n ctx.textAlign = \"center\"\n ctx.textBaseline = \"middle\"\n if (strokeWidth > 0) {\n ctx.lineWidth = strokeWidth * size\n ctx.strokeStyle = strokeColor\n ctx.strokeText(label, size / 2, size / 2)\n }\n ctx.fillText(label, size / 2, size / 2)\n\n const texture = new THREE.Texture(canvas)\n texture.needsUpdate = true\n const material = new THREE.SpriteMaterial({ map: texture })\n const sprite = new THREE.Sprite(material)\n sprite.scale.set(fontSize, fontSize, 1)\n\n // Apply offset\n if (offset === undefined) {\n offset = new THREE.Vector2(0, 0)\n }\n const trueOffset = new THREE.Vector2()\n trueOffset.addVectors(offset, new THREE.Vector2(0.5, 0.5))\n sprite.center.copy(trueOffset)\n\n const labelRoot = new THREE.Object3D()\n labelRoot.position.copy(position)\n labelRoot.add(sprite)\n\n return labelRoot\n}\n\n/**\n * Helper function for creating a cylinder mesh.\n *\n * @param pos1 - Start position\n * @param pos2 - End position\n * @param radius - Cylinder radius\n * @param material - Cylinder material\n */\nfunction createCylinder(pos1, pos2, radius, nSegments, material) {\n const direction = new THREE.Vector3().subVectors(pos2, pos1)\n const dirLen = direction.length()\n const dirNorm = direction.clone().divideScalar(dirLen)\n const arrow = new THREE.ArrowHelper(dirNorm, pos1)\n const edgeGeometry = new THREE.CylinderGeometry(radius, radius, dirLen, nSegments)\n const edge = new THREE.Mesh(edgeGeometry, material)\n edge.rotation.copy(arrow.rotation.clone())\n edge.position.copy(new THREE.Vector3().addVectors(pos1, direction.multiplyScalar(0.5)))\n\n return edge\n}\n\n/**\n * Used to add custom three.js objects to an NGL stage. Note that this adds the\n * object to an item inside 'modelGroup'. This is the easiest way to attach the\n * objects to a group with the correct translations and rotations, but may break\n * if the first item is not a group.\n *\n * @param object - The object to add. Can be any object that inherits from Object3D.\n * @param stage - The NGL Stage to add the object into.\n * @param obects - List of custom objects into which the given one is added.\n */\nfunction addObject3DToStage(object, stage) {\n const scene = stage.viewer.scene\n const rotationGroup = scene.getObjectByName('rotationGroup')\n const translationGroup = rotationGroup.getObjectByName('translationGroup')\n const pickingGroup = translationGroup.getObjectByName('modelGroup')\n // TODO: Since we don't know the actual three.js Object3Ds that correspond to\n // each component, we are simply adding the object to the latest model object\n // that is found and is visible by default.\n const group = pickingGroup.children[pickingGroup.children.length - 2]\n group.add(object)\n}\n\n/**\n * For setting the positions according to the currently set wrapmode.\n *\n * @param {ngl.Component} component The ngl component\n * @param {ngl.Representation} representation The ngl representation\n */\nfunction wrapRepresentation(component, representation) {\n let posNew\n const indices = representation.indices\n const wrapMode = representation.wrapMode\n const basis = component.basis\n const cartToFrac = component.cartToFrac\n const fracToCart = component.fracToCart\n const pbc = component.pbc\n\n if (!basis) return\n if (!pbc.some(a => a)) return\n\n // Gather and store the original cartesian positions if they are not already\n // resolved.\n if (isNil(representation.posCart)) {\n representation.posCart = []\n for (const index of indices) {\n const ap = component.structure.getAtomProxy(index)\n representation.posCart.push(ap.positionToVector3(new THREE.Vector3()))\n }\n }\n\n // Use wrapped positions\n if (wrapMode === wrapModes.wrap.key) {\n if (!isNil(representation.posWrap)) {\n posNew = representation.posWrap\n } else {\n posNew = representation.posCart.map(pos => {\n return pos.clone().applyMatrix4(cartToFrac)\n })\n wrapPositions(posNew, cartToFrac, pbc)\n posNew = posNew.map(pos => pos.applyMatrix4(fracToCart))\n representation.posWrap = posNew\n }\n // Use unwrapped positions\n } else if (wrapMode === wrapModes.unwrap.key) {\n if (!isNil(representation.posUnwrap)) {\n posNew = representation.posUnwrap\n } else {\n const posFrac = representation.posCart.map(pos => {\n return pos.clone().applyMatrix4(cartToFrac)\n })\n const centerOfPos = getCenterOfPositions(posFrac, component.pbc)\n posNew = posFrac.map(pos => pos.add(new Vector3(0.5, 0.5, 0.5).sub(centerOfPos)))\n wrapPositions(posNew, cartToFrac, pbc)\n posNew = posNew.map(pos => pos.applyMatrix4(fracToCart))\n representation.posUnwrap = posNew\n }\n // Use original positions\n } else if (wrapMode === wrapModes.original.key) {\n posNew = representation.posCart\n } else {\n throw Error('Invalid wrapmode provided.')\n }\n\n // Set new positions within the structure data. This follows roughly the\n // Structure.updatePosition()-function in NGL.\n let i = 0\n for (const index of indices) {\n const ap = component.structure.getAtomProxy(index)\n ap.positionFromVector3(posNew[i])\n ++i\n }\n\n // This updates the actual visuals. TODO: not sure why this is producing an\n // exception, ignored for now.\n component.structure._hasCoords = undefined\n component.structure.refreshPosition()\n try {\n component.updateRepresentations()\n } catch {\n }\n}\n\n/**\n * Wraps fractional positions within a cell respecting periodic boundary\n * conditions. Wrapping is done in place.\n *\n * @param {THREE.Vector3[]} posFrac Positions to wrap\n * @param {THREE.Matrix4} cartToFrac Matrix to convert cartesian positions to fractional\n * @param {bool[]} pbc Periodic boundary conditions for each lattice vector\n */\nfunction wrapPositions(posFrac, cartToFrac, pbc) {\n const eps = 1e-2\n const epsArray = new THREE.Vector3(eps, eps, eps).applyMatrix4(cartToFrac).toArray()\n const center = [0.5, 0.5, 0.5] // Positions will be nearest to this location\n const shift = center.map((center, i) => pbc[i] ? center - 0.5 - epsArray[i] : 0)\n for (let len = posFrac.length, i = 0; i < len; ++i) {\n const iFracPos = posFrac[i]\n for (let i = 0; i < 3; ++i) {\n if (!pbc[i]) continue\n const comp = iFracPos.getComponent(i)\n let remainder = ((comp - shift[i]) % 1) + shift[i]\n // Unlike in python, remainder in javascript can be negative\n if (remainder < -epsArray[i]) remainder += 1\n iFracPos.setComponent(i, remainder)\n }\n }\n}\n\n// This data is copied directly from NGL as it cannot be imported directly.\nconst atomicNumbers = {\n H: 1, D: 1, T: 1, HE: 2, LI: 3, BE: 4, B: 5, C: 6, N: 7, O: 8, F: 9, NE: 10, NA: 11, MG: 12, AL: 13, SI: 14, P: 15, S: 16, CL: 17, AR: 18, K: 19, CA: 20, SC: 21, TI: 22, V: 23, CR: 24, MN: 25, FE: 26, CO: 27, NI: 28, CU: 29, ZN: 30, GA: 31, GE: 32, AS: 33, SE: 34, BR: 35, KR: 36, RB: 37, SR: 38, Y: 39, ZR: 40, NB: 41, MO: 42, TC: 43, RU: 44, RH: 45, PD: 46, AG: 47, CD: 48, IN: 49, SN: 50, SB: 51, TE: 52, I: 53, XE: 54, CS: 55, BA: 56, LA: 57, CE: 58, PR: 59, ND: 60, PM: 61, SM: 62, EU: 63, GD: 64, TB: 65, DY: 66, HO: 67, ER: 68, TM: 69, YB: 70, LU: 71, HF: 72, TA: 73, W: 74, RE: 75, OS: 76, IR: 77, PT: 78, AU: 79, HG: 80, TL: 81, PB: 82, BI: 83, PO: 84, AT: 85, RN: 86, FR: 87, RA: 88, AC: 89, TH: 90, PA: 91, U: 92, NP: 93, PU: 94, AM: 95, CM: 96, BK: 97, CF: 98, ES: 99, FM: 100, MD: 101, NO: 102, LR: 103, RF: 104, DB: 105, SG: 106, BH: 107, HS: 108, MT: 109, DS: 110, RG: 111, CN: 112, NH: 113, FL: 114, MC: 115, LV: 116, TS: 117, OG: 118\n}\nconst vdwRadii = {\n 1: 1.1, 2: 1.4, 3: 1.81, 4: 1.53, 5: 1.92, 6: 1.7, 7: 1.55, 8: 1.52, 9: 1.47, 10: 1.54, 11: 2.27, 12: 1.73, 13: 1.84, 14: 2.1, 15: 1.8, 16: 1.8, 17: 1.75, 18: 1.88, 19: 2.75, 20: 2.31, 21: 2.3, 22: 2.15, 23: 2.05, 24: 2.05, 25: 2.05, 26: 2.05, 27: 2.0, 28: 2.0, 29: 2.0, 30: 2.1, 31: 1.87, 32: 2.11, 33: 1.85, 34: 1.9, 35: 1.83, 36: 2.02, 37: 3.03, 38: 2.49, 39: 2.4, 40: 2.3, 41: 2.15, 42: 2.1, 43: 2.05, 44: 2.05, 45: 2.0, 46: 2.05, 47: 2.1, 48: 2.2, 49: 2.2, 50: 1.93, 51: 2.17, 52: 2.06, 53: 1.98, 54: 2.16, 55: 3.43, 56: 2.68, 57: 2.5, 58: 2.48, 59: 2.47, 60: 2.45, 61: 2.43, 62: 2.42, 63: 2.4, 64: 2.38, 65: 2.37, 66: 2.35, 67: 2.33, 68: 2.32, 69: 2.3, 70: 2.28, 71: 2.27, 72: 2.25, 73: 2.2, 74: 2.1, 75: 2.05, 76: 2.0, 77: 2.0, 78: 2.05, 79: 2.1, 80: 2.05, 81: 1.96, 82: 2.02, 83: 2.07, 84: 1.97, 85: 2.02, 86: 2.2, 87: 3.48, 88: 2.83, 89: 2.0, 90: 2.4, 91: 2.0, 92: 2.3, 93: 2.0, 94: 2.0, 95: 2.0, 96: 2.0, 97: 2.0, 98: 2.0, 99: 2.0, 100: 2.0, 101: 2.0, 102: 2.0, 103: 2.0, 104: 2.0, 105: 2.0, 106: 2.0, 107: 2.0, 108: 2.0, 109: 2.0, 110: 2.0, 111: 2.0, 112: 2.0, 113: 2.0, 114: 2.0, 115: 2.0, 116: 2.0, 117: 2.0, 118: 2.0\n}\nconst elementColors = {\n 'H': 0xFFFFFF, 'HE': 0xD9FFFF, 'LI': 0xCC80FF, 'BE': 0xC2FF00, 'B': 0xFFB5B5, 'C': 0x909090, 'N': 0x3050F8, 'O': 0xFF0D0D, 'F': 0x90E050, 'NE': 0xB3E3F5, 'NA': 0xAB5CF2, 'MG': 0x8AFF00, 'AL': 0xBFA6A6, 'SI': 0xF0C8A0, 'P': 0xFF8000, 'S': 0xFFFF30, 'CL': 0x1FF01F, 'AR': 0x80D1E3, 'K': 0x8F40D4, 'CA': 0x3DFF00, 'SC': 0xE6E6E6, 'TI': 0xBFC2C7, 'V': 0xA6A6AB, 'CR': 0x8A99C7, 'MN': 0x9C7AC7, 'FE': 0xE06633, 'CO': 0xF090A0, 'NI': 0x50D050, 'CU': 0xC88033, 'ZN': 0x7D80B0, 'GA': 0xC28F8F, 'GE': 0x668F8F, 'AS': 0xBD80E3, 'SE': 0xFFA100, 'BR': 0xA62929, 'KR': 0x5CB8D1, 'RB': 0x702EB0, 'SR': 0x00FF00, 'Y': 0x94FFFF, 'ZR': 0x94E0E0, 'NB': 0x73C2C9, 'MO': 0x54B5B5, 'TC': 0x3B9E9E, 'RU': 0x248F8F, 'RH': 0x0A7D8C, 'PD': 0x006985, 'AG': 0xC0C0C0, 'CD': 0xFFD98F, 'IN': 0xA67573, 'SN': 0x668080, 'SB': 0x9E63B5, 'TE': 0xD47A00, 'I': 0x940094, 'XE': 0x940094, 'CS': 0x57178F, 'BA': 0x00C900, 'LA': 0x70D4FF, 'CE': 0xFFFFC7, 'PR': 0xD9FFC7, 'ND': 0xC7FFC7, 'PM': 0xA3FFC7, 'SM': 0x8FFFC7, 'EU': 0x61FFC7, 'GD': 0x45FFC7, 'TB': 0x30FFC7, 'DY': 0x1FFFC7, 'HO': 0x00FF9C, 'ER': 0x00E675, 'TM': 0x00D452, 'YB': 0x00BF38, 'LU': 0x00AB24, 'HF': 0x4DC2FF, 'TA': 0x4DA6FF, 'W': 0x2194D6, 'RE': 0x267DAB, 'OS': 0x266696, 'IR': 0x175487, 'PT': 0xD0D0E0, 'AU': 0xFFD123, 'HG': 0xB8B8D0, 'TL': 0xA6544D, 'PB': 0x575961, 'BI': 0x9E4FB5, 'PO': 0xAB5C00, 'AT': 0x754F45, 'RN': 0x428296, 'FR': 0x420066, 'RA': 0x007D00, 'AC': 0x70ABFA, 'TH': 0x00BAFF, 'PA': 0x00A1FF, 'U': 0x008FFF, 'NP': 0x0080FF, 'PU': 0x006BFF, 'AM': 0x545CF2, 'CM': 0x785CE3, 'BK': 0x8A4FE3, 'CF': 0xA136D4, 'ES': 0xB31FD4, 'FM': 0xB31FBA, 'MD': 0xB30DA6, 'NO': 0xBD0D87, 'LR': 0xC70066, 'RF': 0xCC0059, 'DB': 0xD1004F, 'SG': 0xD90045, 'BH': 0xE00038, 'HS': 0xE6002E, 'MT': 0xEB0026, 'DS': 0xFFFFFF, 'RG': 0xFFFFFF, 'CN': 0xFFFFFF, 'UUT': 0xFFFFFF, 'FL': 0xFFFFFF, 'UUP': 0xFFFFFF, 'LV': 0xFFFFFF, 'UUH': 0xFFFFFF, 'D': 0xFFFFC0, 'T': 0xFFFFA0\n}\n\n/**\n * Calculates the center of positions and also takes the periodicity of the\n * system into account.\n *\n * The algorithm is replicated from:\n * https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions\n *\n * @param {*} relative_positions\n * @param {*} cell\n * @param {*} pbc\n * @returns\n */\nfunction getCenterOfPositions(posFrac, pbc) {\n const center = new Vector3()\n const total = posFrac.length\n for (const iComp of [0, 1, 2]) {\n const iPbc = pbc[iComp]\n let centerComp\n if (iPbc) {\n let xiSum = 0\n let zetaSum = 0\n for (const pos of posFrac) {\n const component = pos.getComponent(iComp)\n const theta = component * 2 * Math.PI\n xiSum += Math.cos(theta)\n zetaSum += Math.sin(theta)\n }\n const xiMean = xiSum / total\n const zetaMean = zetaSum / total\n const thetaMean = Math.atan2(-zetaMean, -xiMean) + Math.PI\n centerComp = thetaMean / (2 * Math.PI)\n } else {\n let sum = 0\n for (const pos of posFrac) {\n sum += pos.getComponent(iComp)\n }\n centerComp = sum / posFrac.length\n }\n center.setComponent(iComp, centerComp)\n }\n return center\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useState, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { isEmpty, isNil, merge, cloneDeep } from 'lodash'\nimport { PropertyCard } from './PropertyCard'\nimport { Tab, Tabs, Typography, Box } from '@material-ui/core'\nimport { makeStyles, useTheme } from '@material-ui/core/styles'\nimport StructureNGL from '../../visualization/StructureNGL'\nimport { FloatableNoReparent } from '../../visualization/Floatable'\nimport TreeView from '@material-ui/lab/TreeView'\nimport TreeItem from '@material-ui/lab/TreeItem'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight'\nimport { QuantityTable, QuantityRow, QuantityCell } from '../../Quantity'\n\n/**\n * For displaying the most descriptive chemical formula that is present in an\n * entry.\n*/\nconst nElementMap = {\n 1: 'unary',\n 2: 'binary',\n 3: 'ternary',\n 4: 'quaternary',\n 5: 'quinary',\n 6: 'sexinary',\n 7: 'septenary',\n 8: 'octanary',\n 9: 'nonary',\n 10: 'decimary'\n}\n\n/**\n * Displays information about the material and it's structure.\n */\nconst useMaterialCardStyles = makeStyles((theme) => ({\n root: {\n height: '700px'\n },\n card: {\n height: '100%',\n width: '100%'\n }\n}))\n\nconst MaterialCardTopology = React.memo(({index, archive}) => {\n const styles = useMaterialCardStyles()\n const [topologyTrees, topologyMap] = useMemo(() => getTopology(index, archive), [index, archive])\n const [selected, setSelected] = useState(topologyTrees[0].system_id)\n const [tab, setTab] = useState('composition')\n const [float, setFloat] = useState(false)\n\n // Handle tab change\n const handleTabChange = useCallback((event, value) => {\n setTab(value)\n }, [])\n\n // Handle float change\n const handleFloat = useCallback(() => {\n setFloat(old => !old)\n }, [])\n\n return
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n})\n\nMaterialCardTopology.propTypes = {\n index: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\nconst useTopologyStyles = makeStyles((theme) => ({\n root: {\n height: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n tree: {\n borderTop: `1px solid ${theme.palette.divider}`,\n overflow: 'auto'\n },\n spacer: {\n flexGrow: 1\n }\n}))\n\n/**\n * Displays the topology in an interactive tree.\n */\nconst Topology = React.memo(({topologyTrees, topologyMap, selected, onSelect}) => {\n const styles = useTopologyStyles()\n\n // Add selection handlers and gather a list of all nodes.\n const nodes = useMemo(() => {\n const nodes = []\n Object.values(topologyMap).forEach(node => {\n node.onClick = () => onSelect(node.system_id)\n nodes.push(node.system_id)\n })\n return nodes\n }, [onSelect, topologyMap])\n\n const [expanded, setExpanded] = useState(nodes)\n const description = topologyMap?.[selected].description\n\n // Handle node expansion\n const handleToggle = useCallback((event, nodeIds) => {\n setExpanded(nodeIds)\n }, [])\n\n return
\n }\n defaultExpandIcon={}\n >\n {topologyTrees.map(topologyTree =>\n \n )}\n \n
\n {description && \n Description:\n {description}\n }\n
\n})\nTopology.propTypes = {\n topologyTrees: PropTypes.array,\n topologyMap: PropTypes.object,\n selected: PropTypes.string,\n onSelect: PropTypes.func\n}\n\nconst useTopologyItemStyles = makeStyles({\n root: (props) => ({\n '&:hover > $content': {\n backgroundColor: props.theme.palette.action.hover\n },\n '&$selected > $content': {\n backgroundColor: props.theme.palette.primary.main,\n color: 'white'\n },\n '&:focus > $content $label, &:hover > $content $label, &$selected > $content $label': {\n backgroundColor: 'transparent'\n }\n }),\n content: (props) => ({\n borderBottom: `1px solid ${props.theme.palette.divider}`,\n fontWeight: props.theme.typography.fontWeightMedium,\n '$expanded > &': {\n fontWeight: props.theme.typography.fontWeightRegular\n },\n paddingLeft: props.theme.spacing(0.75 * props.level),\n boxSizing: 'border-box'\n }),\n group: (props) => ({marginLeft: 0}),\n // These empty classes are needed for reset\n expanded: (props) => ({}),\n selected: (props) => ({}),\n label: (props) => ({\n fontWeight: 'inherit',\n color: 'inherit',\n paddingLeft: 0\n }),\n row: (props) => ({\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'row',\n paddingRight: props.theme.spacing(0.5)\n }),\n column: (props) => ({\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'center',\n flexDirection: 'column',\n padding: props.theme.spacing(0.25, 0),\n flexGrow: 1,\n height: props.theme.spacing(5)\n }),\n nodeLabelPrimary: (props) => ({\n textTransform: 'uppercase',\n fontSize: 14\n }),\n nodeLabelSecondary: (props) => ({\n fontSize: 12\n }),\n iconContainer: (props) => ({\n paddingLeft: props.theme.spacing(0.5)\n })\n})\n\nconst TopologyItem = React.memo(({node, level, selected}) => {\n // The best way to dynamically manipulate the classes created by makeStyles\n // was to make each style dependent on a set of properties. Creating the\n // styles within the function does not seem to work.\n const theme = useTheme()\n const styleProps = useMemo(() => ({theme, level: level}), [theme, level])\n const classes = useTopologyItemStyles(styleProps)\n const isSelected = selected === node.system_id\n\n return { node.onClick && node.onClick(); event.preventDefault() }}\n nodeId={node.system_id}\n label={\n
\n
\n \n {`${node.label}`}\n \n \n {node.label === 'original'\n ? undefined\n : `${node.structural_type}` + (!isEmpty(node?.child_systems) && node.structural_type === 'group'\n ? ` (${[...new Set(node.child_systems.map(x => x.structural_type))].join(', ')})`\n : ''\n )}\n \n
\n
\n }\n classes={{\n root: classes.root,\n content: classes.content,\n expanded: classes.expanded,\n selected: classes.selected,\n iconContainer: classes.iconContainer,\n group: classes.group,\n label: classes.label\n }}\n >\n {node.child_systems && node.child_systems.map(node => {\n return \n })}\n \n})\nTopologyItem.propTypes = {\n node: PropTypes.object,\n level: PropTypes.number,\n selected: PropTypes.string\n}\n\n/**\n * Displays the information that is present for a single node within tabs.\n */\nconst useMaterialTabsStyles = makeStyles(theme => ({\n noData: {\n height: 172.72 // The height of three QuantityRows\n }\n}))\nconst MaterialTabs = React.memo(({value, onChange, node}) => {\n const styles = useMaterialTabsStyles()\n const nElems = node?.n_elements\n const nElemsLabel = nElementMap[nElems]\n const n_elements = `${nElems}${nElemsLabel ? ` (${nElemsLabel})` : ''}`\n const tabMap = useMemo(() => {\n const hasTopology = !isEmpty(node)\n const hasCell = !isEmpty(node?.cell)\n const hasSymmetry = !isEmpty(node?.symmetry)\n const hasPorosity = [\n node.largest_cavity_diameter,\n node.pore_limiting_diameter,\n node.accessible_surface_area,\n node.accessible_volume,\n node.void_fraction,\n node.n_of_channels\n ].some(x => !isNil(x))\n const hasSbu = [\n node.sbu_type,\n node.sbu_coordination_number\n ].some(x => !isNil(x))\n const hasActiveOrbitals = !isEmpty(node?.active_orbitals)\n const hasCoreHole = hasActiveOrbitals && node?.label === 'core-hole'\n const tabMap = {\n composition: hasTopology && {\n label: 'Composition'\n },\n cell: hasCell && {\n label: 'Cell'\n },\n porosity: hasPorosity && {\n label: 'Porosity'\n },\n sbu: hasSbu && {\n label: 'SBU'\n },\n symmetry: hasSymmetry && {\n label: 'Symmetry'\n },\n coreHole: hasCoreHole && {\n label: 'Core-hole'\n }\n }\n return tabMap\n }, [node])\n\n const finalValue = tabMap[value] ? value : 'composition'\n\n return <>\n \n {Object.entries(tabMap).map(([key, value]) => value ? : null)}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n}) // TODO: Add a cell for the total charge? Or keep it for the composition? + Add j and m_j (which are numerical arrays)\nMaterialTabs.propTypes = {\n node: PropTypes.object,\n value: PropTypes.any,\n onChange: PropTypes.func\n}\n\nconst MaterialTab = React.memo(({selected, value, children}) => {\n return
\n})\nMaterialTab.propTypes = {\n selected: PropTypes.string.isRequired,\n value: PropTypes.string.isRequired,\n children: PropTypes.node\n}\n\nexport default MaterialCardTopology\n\n/**\n * Retrieves the topology for a calculation given the index and archive.\n *\n * @param {object} index\n * @param {object} archive\n *\n * @return {undefined|object} If the given structure cannot be converted,\n * returns an empty object.\n */\nexport function getTopology(index, archive) {\n // If topology is explicitly stored, use it.\n let topology\n if (index?.results?.material?.topology) {\n topology = merge(\n cloneDeep(index?.results?.material?.topology),\n archive?.results?.material?.topology\n )\n }\n\n // Create topology map\n const topologyMap = Object.fromEntries(topology.map(top => ([top.system_id, top])))\n\n // Create topology tree by finding the root node and then recursively\n // replacing its children with the actual child instances.\n const roots = topology.filter(top => isNil(top.parent_system))\n const traverse = (node) => {\n if (!isEmpty(node?.child_systems)) {\n node.child_systems = node.child_systems.map(id => topologyMap[id])\n node.child_systems.forEach(child => traverse(child))\n }\n }\n for (const root of roots) {\n traverse(root)\n }\n\n // Simplify the view if there is only one subsystem that covers everything.\n for (const root of roots) {\n if (root?.child_systems?.length === 1) {\n const child = root.child_systems[0]\n if (child.atomic_fraction === 1 && child?.system_relation?.type === 'subsystem') {\n child.parent_system = root\n root.child_systems = child.child_systems\n }\n }\n }\n\n return [roots, topologyMap]\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard, PropertyGrid, PropertyItem } from './PropertyCard'\nimport { QuantityTable, QuantityRow, QuantityCell } from '../../Quantity'\n\n/**\n * Displays a summary of material related properties for an entry.\n */\nconst MaterialCardFormula = React.memo(({index}) => {\n if (!index?.results?.material) {\n return null\n }\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\n\nMaterialCardFormula.propTypes = {\n index: PropTypes.object\n}\n\nexport default MaterialCardFormula\n","/* eslint-disable quotes */\n/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport H5Web from '../../visualization/H5Web'\nimport { Card, makeStyles } from '@material-ui/core'\n\nconst useNexusCardStyles = makeStyles(theme => ({\n root: {\n height: 500\n }\n}))\n\nconst NexusCard = React.memo(function NexusCard({index}) {\n const classes = useNexusCardStyles()\n if (index.parser_name !== 'pynxtools.nomad.entrypoints:nexus_parser') {\n return null\n }\n return (\n \n \n \n )\n})\nNexusCard.propTypes = {\n index: PropTypes.object.isRequired\n}\n\nexport default NexusCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useEffect, useState, useMemo} from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { mergeObjects } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { withErrorHandler } from '../ErrorHandler'\n\nconst HeatCapacity = React.memo(({\n data,\n layout,\n className,\n units,\n 'data-testid': testID,\n ...other\n}) => {\n const tempUnit = useMemo(() => new Unit('kelvin'), [])\n const capacityUnit = useMemo(() => new Unit('joule / kelvin'), [])\n const [finalData, setFinalData] = useState(!data ? data : undefined)\n const theme = useTheme()\n\n // Merge custom layout with default layout\n const finalLayout = useMemo(() => {\n const defaultLayout = {\n xaxis: {\n title: {\n text: `Temperature (${tempUnit.toSystem(units).label()})`\n },\n zeroline: false\n },\n yaxis: {\n title: {\n text: `Heat capacity (${capacityUnit.toSystem(units).label()})`\n },\n zeroline: false\n }\n }\n return mergeObjects(layout, defaultLayout)\n }, [layout, units, tempUnit, capacityUnit])\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n if (!data) {\n setFinalData(data)\n return\n }\n\n // Convert units and determine range\n const temperatures = new Quantity(data.temperatures, tempUnit).toSystem(units).value()\n const heatCapacities = new Quantity(data.heat_capacities, capacityUnit).toSystem(units).value()\n\n // Create the final data that will be plotted.\n const plotData = [{\n x: temperatures,\n y: heatCapacities,\n type: 'scatter',\n mode: 'lines',\n line: {\n color: theme.palette.primary.main,\n width: 2\n }\n }]\n\n setFinalData(plotData)\n }, [data, units, tempUnit, capacityUnit, theme])\n\n return \n})\n\nHeatCapacity.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.bool, // Set to false to show NoData component\n PropTypes.shape({\n heat_capacities: PropTypes.array.isRequired,\n temperatures: PropTypes.array.isRequired,\n m_path: PropTypes.string // Path of the section containing the data in the Archive\n })\n ]),\n layout: PropTypes.object,\n className: PropTypes.string,\n units: PropTypes.object, // Contains the unit configuration\n 'data-testid': PropTypes.string\n}\nHeatCapacity.defaultProps = {\n type: 'electronic'\n}\n\nexport default withErrorHandler('Could not load heat capacity.')(HeatCapacity)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useEffect, useState, useMemo} from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { mergeObjects } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { withErrorHandler } from '../ErrorHandler'\n\nconst HelmholtzFreeEnergy = React.memo(({\n data,\n layout,\n className,\n units,\n 'data-testid': testID,\n ...other\n}) => {\n const tempUnit = useMemo(() => new Unit('kelvin'), [])\n const energyUnit = useMemo(() => new Unit('joule'), [])\n\n // Merge custom layout with default layout\n const finalLayout = useMemo(() => {\n const defaultLayout = {\n xaxis: {\n title: {\n text: `Temperature (${tempUnit.toSystem(units).label()})`\n },\n zeroline: false\n },\n yaxis: {\n title: {\n text: `Helmholtz free energy (${energyUnit.toSystem(units).label()})`\n },\n zeroline: false\n }\n }\n return mergeObjects(layout, defaultLayout)\n }, [layout, units, energyUnit, tempUnit])\n\n const [finalData, setFinalData] = useState(!data ? data : undefined)\n const theme = useTheme()\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n if (!data) {\n setFinalData(data)\n return\n }\n\n // Convert units\n const temperatures = new Quantity(data.temperatures, tempUnit).toSystem(units).value()\n const energies = new Quantity(data.energies, energyUnit).toSystem(units).value()\n\n // Create the final data that will be plotted.\n const plotData = [{\n x: temperatures,\n y: energies,\n type: 'scatter',\n mode: 'lines',\n line: {\n color: theme.palette.primary.main,\n width: 2\n }\n }]\n\n setFinalData(plotData)\n }, [data, units, energyUnit, tempUnit, theme])\n\n return \n})\n\nHelmholtzFreeEnergy.propTypes = {\n data: PropTypes.oneOfType([\n PropTypes.bool, // Set to false to show NoData component\n PropTypes.shape({\n energies: PropTypes.array.isRequired,\n temperatures: PropTypes.array.isRequired,\n m_path: PropTypes.string // Path of the section containing the data in the Archive\n })\n ]),\n layout: PropTypes.object,\n className: PropTypes.string,\n units: PropTypes.object, // Contains the unit configuration\n 'data-testid': PropTypes.string\n}\n\nexport default withErrorHandler('Could not load Helmholtz free energy.')(HelmholtzFreeEnergy)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { Subject } from 'rxjs'\nimport DOS from './DOS'\nimport BandStructure from './BandStructure'\nimport HeatCapacity from './HeatCapacity'\nimport { PropertyGrid, PropertyItem } from '../entry/properties/PropertyCard'\nimport HelmholtzFreeEnergy from './HelmholtzFreeEnergy'\nimport { Quantity } from '../units/Quantity'\n\nconst VibrationalProperties = React.memo(({\n bs,\n dos,\n freeEnergy,\n heatCapacity,\n units\n}) => {\n // Find minimum and maximum from DOS/BS. Use this range for both plots.\n const range = useMemo(() => {\n let range = [undefined, undefined]\n if (dos) {\n const energies = []\n dos.forEach(d => {\n if (d.energies) energies.push(...d.energies)\n })\n const min = Math.min(...energies)\n const max = Math.max(...energies)\n range = new Quantity([min, max], 'joule').toSystem(units).value()\n }\n return range\n }, [dos, units])\n\n // RxJS subject for efficiently propagating y axis changes between DOS and BS\n const bsYSubject = useMemo(() => new Subject(), [])\n const dosYSubject = useMemo(() => new Subject(), [])\n const bsLayout = useMemo(() => ({yaxis: {autorange: false, range: range}}), [range])\n const dosLayout = useMemo(() => ({yaxis: {autorange: false, range: range}}), [range])\n\n // Synchronize panning between BS/DOS plots\n const handleBSRelayouting = useCallback((event) => {\n const update = {yaxis: {range: [event['yaxis.range[0]'], event['yaxis.range[1]']]}}\n bsYSubject.next(update)\n }, [bsYSubject])\n const handleDOSRelayouting = useCallback((event) => {\n const update = {yaxis: {range: [event['yaxis.range[0]'], event['yaxis.range[1]']]}}\n dosYSubject.next(update)\n }, [dosYSubject])\n\n return \n \n { bsYSubject.next({yaxis: {range: range}}) }}\n layoutSubject={dosYSubject}\n metaInfoLink={bs ? bs[0].m_path : null}\n type=\"vibrational\"\n data-testid=\"bs-phonon\"\n />\n \n \n { dosYSubject.next({yaxis: {range: range}}) }}\n units={units}\n layoutSubject={bsYSubject}\n metaInfoLink={dos ? dos[0].m_path : null}\n type=\"vibrational\"\n data-testid=\"dos-phonon\"\n />\n \n \n \n \n \n \n \n \n})\n\nVibrationalProperties.propTypes = {\n dos: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n bs: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n freeEnergy: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n heatCapacity: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n range: PropTypes.array,\n units: PropTypes.object // Contains the unit configuration\n}\n\nexport default VibrationalProperties\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport { useUnitContext } from '../../units/UnitContext'\nimport { getLocation, resolveInternalRef } from '../../../utils'\nimport { refPath } from '../../archive/metainfo'\nimport VibrationalProperties from '../../visualization/VibrationalProperties'\n\n/**\n * Card displaying vibrational properties.\n */\nconst VibrationalPropertiesCard = React.memo(({index, properties, archive}) => {\n const {units} = useUnitContext()\n const urlPrefix = `${getLocation()}/data`\n\n // Find out which properties are present\n const hasDos = properties.has('dos_phonon')\n const hasBs = properties.has('band_structure_phonon')\n const hasEnergyFree = properties.has('energy_free_helmholtz')\n const hasHeatCapacity = properties.has('heat_capacity_constant_volume')\n\n // Do not show the card if none of the properties are available\n if (!hasDos && !hasBs && !hasEnergyFree && !hasHeatCapacity) {\n return null\n }\n\n // Resolve phonon DOS\n let dos = hasDos ? null : false\n const dosData = archive?.results?.properties?.vibrational?.dos_phonon\n if (dosData) {\n dos = {}\n dos.energies = resolveInternalRef(dosData.energies, archive)\n dos.densities = resolveInternalRef(dosData.total, archive).map(dos => dos.value)\n dos.m_path = `${urlPrefix}/${refPath(dosData.energies.split('/').slice(0, -1).join('/'))}`\n dos = [dos]\n }\n\n // Resolve phonon band structure\n let bs = hasBs ? null : false\n const bsData = archive?.results?.properties?.vibrational?.band_structure_phonon\n if (bsData) {\n bs = {}\n bs.segment = resolveInternalRef(bsData.segment, archive)\n bs.m_path = `${urlPrefix}/${refPath(bsData.segment[0].split('/').slice(0, -2).join('/'))}`\n bs = [bs]\n }\n\n // Resolve free energy\n let energyFree = hasEnergyFree ? null : false\n const energyFreeData = archive?.results?.properties?.vibrational?.energy_free_helmholtz\n if (energyFreeData) {\n energyFree = {}\n energyFree.energies = resolveInternalRef(energyFreeData.energies, archive)\n energyFree.temperatures = resolveInternalRef(energyFreeData.temperatures, archive)\n energyFree.m_path = `${urlPrefix}/${refPath(energyFreeData.energies)}`\n }\n\n // Resolve heat capacity\n let heatCapacity = hasHeatCapacity ? null : false\n const heatCapacityData = archive?.results?.properties?.vibrational?.heat_capacity_constant_volume\n if (heatCapacityData) {\n heatCapacity = {}\n heatCapacity.heat_capacities = resolveInternalRef(heatCapacityData.heat_capacities, archive)\n heatCapacity.temperatures = resolveInternalRef(heatCapacityData.temperatures, archive)\n heatCapacity.m_path = `${urlPrefix}/${refPath(heatCapacityData.heat_capacities)}`\n }\n\n // TODO implement plotting of multiple dos and bs data\n return \n \n \n})\n\nVibrationalPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default VibrationalPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { } from 'react'\nimport PropTypes from 'prop-types'\nimport { SectionTable } from '../Quantity'\nimport { PropertyGrid, PropertyItem } from '../entry/properties/PropertyCard'\nimport EnergyVolumeCurve from '../visualization/EnergyVolumeCurve'\n\n/**\n * Shows a summary of Mechanical properties.\n */\nconst modulusQuantities = {\n type: {label: 'Type', align: 'left'},\n value: {label: 'Value', align: 'right'}\n}\nconst MechanicalProperties = React.memo(({\n evCurves,\n bulkModulus,\n shearModulus,\n units\n}) => {\n return \n {evCurves !== false && \n \n }\n \n \n \n \n \n \n \n})\n\nMechanicalProperties.propTypes = {\n evCurves: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n bulkModulus: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n shearModulus: PropTypes.any, // Set to false if not available, set to other falsy value to show placeholder.\n units: PropTypes.object // Contains the unit configuration\n}\n\nexport default MechanicalProperties\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport { useUnitContext } from '../../units/UnitContext'\nimport { getLocation, resolveInternalRef } from '../../../utils'\nimport { refPath } from '../../archive/metainfo'\nimport MechanicalProperties from '../../visualization/MechanicalProperties'\n\n/**\n * Card displaying mechanical properties.\n */\nconst MechanicalPropertiesCard = React.memo(({index, properties, archive}) => {\n const {units} = useUnitContext()\n const urlPrefix = `${getLocation()}/data`\n\n // Find out which properties are present\n const hasEVCurves = properties.has('energy_volume_curve')\n const hasBulkModulus = properties.has('bulk_modulus')\n const hasShearModulus = properties.has('shear_modulus')\n\n // Do not show the card if none of the properties are available\n if (!hasBulkModulus && !hasEVCurves && !hasShearModulus) {\n return null\n }\n\n // Resolve EV curves\n let evCurves = hasEVCurves ? null : false\n if (hasEVCurves && archive) {\n const evCurveData = archive?.results?.properties?.mechanical?.energy_volume_curve\n evCurves = {\n m_path: `${urlPrefix}/${refPath(evCurveData[0].volumes.split('/').slice(0, -1).join('/'))}`,\n data: evCurveData.map(ev => ({\n volumes: resolveInternalRef(ev.volumes, archive),\n energies: resolveInternalRef(ev.energies_raw || ev.energies_fit, archive),\n name: ev.type\n }))\n }\n }\n\n // Resolve bulk modulus\n let bulkModulus = false\n if (hasBulkModulus) {\n bulkModulus = {\n data: index?.results?.properties?.mechanical?.bulk_modulus\n }\n }\n\n // Resolve shear modulus\n let shearModulus = false\n if (hasShearModulus) {\n shearModulus = {\n data: index?.results?.properties?.mechanical?.shear_modulus\n }\n }\n\n return \n \n \n})\n\nMechanicalPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default MechanicalPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { isNil, get } from 'lodash'\nimport { useTheme, makeStyles } from '@material-ui/core/styles'\nimport { Box } from '@material-ui/core'\nimport Plot from '../plotting/Plot'\nimport { mergeObjects, getLocation } from '../../utils'\nimport {\n PropertyProvenanceItem,\n PropertyProvenanceList\n} from '../entry/properties/PropertyCard'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport { withErrorHandler } from '../ErrorHandler'\nimport { getPlotLayoutVertical, getPlotTracesVertical } from '../plotting/common'\n\nconst timeUnit = new Unit('second')\nconst energyUnit = new Unit('joule')\nconst temperatureUnit = new Unit('kelvin')\nconst pressureUnit = new Unit('pascal')\nexport const trajectoryPath = ['results', 'properties', 'thermodynamic', 'trajectory']\nexport const trajectoryError = 'Could not load trajectory data.'\n\n/**\n * Plot for the thermodynamic properties reported during molecular dynamics.\n */\nconst useStyles = makeStyles((theme) => ({\n trajectory: {}\n}))\nconst Trajectory = React.memo(({\n temperature,\n pressure,\n energyPotential,\n provenance,\n layout,\n className,\n classes,\n archiveURL,\n ...other\n}) => {\n let nPlots = 0\n if (temperature !== false) ++nPlots\n if (pressure !== false) ++nPlots\n if (energyPotential !== false) ++nPlots\n const styles = useStyles({classes: classes})\n const theme = useTheme()\n const {units} = useUnitContext()\n const [finalData, setFinalData] = useState(nPlots === 0 ? false : undefined)\n const [finalLayout, setFinalLayout] = useState()\n\n // Create a configuration for the plot data\n useEffect(() => {\n // Since the properties are plotted together, if any of them is laoding, show the\n // placeholder\n if ([temperature, pressure, energyPotential].some(isNil)) {\n setFinalData(undefined)\n return\n }\n // If there is no data, show the NoData component.\n if (nPlots === 0) {\n setFinalData(false)\n return\n }\n const traces = [\n {\n data: temperature && {\n x: new Quantity(temperature.time, timeUnit).toSystem(units).value(),\n y: new Quantity(temperature.value, temperatureUnit).toSystem(units).value()\n },\n ytitle: {text: `Temperature (${temperatureUnit.toSystem(units).label()})`}\n },\n {\n data: pressure && {\n x: new Quantity(pressure.time, timeUnit).toSystem(units).value(),\n y: new Quantity(pressure.value, pressureUnit).toSystem(units).value()\n },\n ytitle: {text: `Pressure (${pressureUnit.toSystem(units).label()})`}\n },\n {\n data: energyPotential && {\n x: new Quantity(energyPotential.time, timeUnit).toSystem(units).value(),\n y: new Quantity(energyPotential.value, energyUnit).toSystem(units).value()\n },\n ytitle: {text: `Potential energy (${energyUnit.toSystem(units).label()})`}\n }\n ]\n const defaultLayout = getPlotLayoutVertical(\n traces,\n {text: `Time (${timeUnit.toSystem(units).label()})`},\n theme\n )\n const mergedLayout = mergeObjects(layout, defaultLayout)\n setFinalData(getPlotTracesVertical(traces, theme))\n setFinalLayout(mergedLayout)\n }, [temperature, pressure, energyPotential, layout, units, theme, nPlots])\n\n return \n \n \n \n {provenance && \n \n \n \n }\n \n})\n\nconst dynamicShape = PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.shape({\n value: PropTypes.arrayOf(PropTypes.number),\n time: PropTypes.arrayOf(PropTypes.number)\n })\n])\n\nTrajectory.propTypes = {\n temperature: dynamicShape,\n pressure: dynamicShape,\n energyPotential: dynamicShape,\n provenance: PropTypes.object,\n layout: PropTypes.object,\n className: PropTypes.string,\n classes: PropTypes.object,\n archiveURL: PropTypes.string // Path for the data in the archive browser\n}\n\nexport default withErrorHandler(trajectoryError)(Trajectory)\n\n/**\n * Fetches all trajectories from the archive and displays them.\n */\nconst useTrajectoriesStyles = makeStyles((theme) => ({\n trajectory: {height: '450px'}\n}))\nconst TrajectoriesRaw = React.memo(({index, archive}) => {\n const styles = useTrajectoriesStyles()\n const urlPrefix = `${getLocation()}/data`\n\n // Resolve and return component for showing the list of trajectories\n const trajsIndex = get(index, trajectoryPath) || []\n const trajsArchive = get(archive, trajectoryPath) || []\n\n return trajsIndex.map((trajIndex, i) => {\n const trajProperties = new Set(trajIndex?.available_properties || [])\n const trajArchive = trajsArchive[i]\n const hasPressure = trajProperties.has('pressure')\n const pressure = hasPressure ? trajArchive?.pressure : false\n const hasTemperature = trajProperties.has('temperature')\n const temperature = hasTemperature ? trajArchive?.temperature : false\n const hasEnergyPotential = trajProperties.has('energy_potential')\n const energyPotential = hasEnergyPotential ? trajArchive?.energy_potential : false\n const provenance = trajIndex?.provenance || false\n\n return \n })\n})\n\nTrajectoriesRaw.propTypes = {\n index: PropTypes.object,\n archive: PropTypes.object\n}\n\nexport const Trajectories = withErrorHandler(trajectoryError)(TrajectoriesRaw)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { } from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyGrid, PropertyItem } from '../entry/properties/PropertyCard'\nimport { Trajectories } from './Trajectory'\n\n/**\n * Shows a summary of thermodynamic properties for the given entry data.\n */\nconst ThermodynamicProperties = React.memo(({index, archive}) => {\n return \n \n \n \n \n})\n\nThermodynamicProperties.propTypes = {\n index: PropTypes.any,\n archive: PropTypes.any\n}\n\nexport default ThermodynamicProperties\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport ThermodynamicProperties from '../../visualization/ThermodynamicProperties'\n\n/**\n * Card displaying molecular dynamics properties.\n */\nconst ThermodynamicPropertiesCard = React.memo(({index, properties, archive}) => {\n // Check what data is available and do not show the card if none of the\n // properties are available.\n const hasTrajectory = properties.has('trajectory')\n if (!hasTrajectory) return null\n\n return \n \n \n})\n\nThermodynamicPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default ThermodynamicPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useEffect, useMemo, useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport assert from 'assert'\nimport { set, get, isNil, isArray, has, capitalize, isPlainObject} from 'lodash'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { PropertyGrid, PropertyItem } from '../entry/properties/PropertyCard'\nimport { getLocation, formatNumber, DType } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport { ErrorHandler, withErrorHandler } from '../ErrorHandler'\nimport { getLineStyles } from '../plotting/common'\n\nconst timeUnit = new Unit('second')\nconst distanceUnitSquared = new Unit('meter**2')\nconst diffusionUnit = new Unit('meter**2 / second')\nexport const msdPath = ['results', 'properties', 'dynamical', 'mean_squared_displacement']\nexport const msdError = 'Could not load mean squared displacement data.'\n\n/**\n * Creates plots for a set of mean squared displacements (msds). The\n * different types of msds (molecular, atomic, etc.) get their own subtitle and\n * all MSDs (regardless of label) are plotted in the same graph.\n */\nconst MeanSquaredDisplacement = React.memo(({\n msd,\n className,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const [finalData, setFinalData] = useState(msd)\n const [finalLayout, setFinalLayout] = useState()\n const {units} = useUnitContext()\n\n // Check that the data is valid. Otherwise raise an exception.\n assert(isPlainObject(msd), 'Invalid msd data provided.')\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n // Loop through different types\n const tracesAll = {}\n const layoutAll = {}\n for (const [type, values] of Object.entries(msd)) {\n const path = [type]\n if (isNil(values)) {\n set(tracesAll, path, undefined)\n set(layoutAll, path, undefined)\n continue\n }\n if (values === false) {\n set(tracesAll, path, false)\n continue\n }\n let i = 0\n const traces = []\n const lineStyles = getLineStyles(values.length, theme)\n const layout = {\n showlegend: true,\n legend: {\n x: 1,\n y: 1,\n xanchor: 'right'\n },\n xaxis: {\n title: {\n text: `time (${timeUnit.toSystem(units).label()})`\n },\n type: 'log',\n autorange: true,\n zeroline: false\n },\n yaxis: {\n title: {\n text: `msd (${distanceUnitSquared.toSystem(units).label()})`\n },\n type: 'log',\n autorange: true,\n zeroline: false\n }\n }\n for (const value of values) {\n assert(isArray(value?.times), `Mean squared displacent was expecting an array of times, but instead got: ${msd?.times}`)\n assert(isArray(value?.value), `Mean squared displacement was expecting an array of values, but instead got: ${msd?.value}`)\n const t = new Quantity(value?.times, timeUnit).toSystem(units).value()\n const val = new Quantity(value?.value, distanceUnitSquared).toSystem(units).value()\n let name = value?.label\n if (!isNil(value?.diffusion_constant_value)) {\n const diffusionConstant = new Quantity(value.diffusion_constant_value, diffusionUnit).toSystem(units)\n const D = formatNumber(diffusionConstant.value(), DType.Float, 'scientific', 2)\n const D_label = diffusionConstant.label()\n name = `${name}: D=${D} ${D_label}`\n }\n if (!isNil(value?.diffusion_constant_errors)) {\n const diffusionConstantError = new Quantity(value.diffusion_constant_errors, diffusionUnit)\n const R = formatNumber(diffusionConstantError.value(), DType.Float, 'standard', 2)\n name = `${name}; R=${R}`\n }\n\n traces.push({\n x: t,\n y: val,\n name: name,\n type: 'scatter',\n showlegend: true,\n line: lineStyles[i]\n })\n ++i\n }\n set(tracesAll, path, traces)\n set(layoutAll, path, layout)\n }\n setFinalData(tracesAll)\n setFinalLayout(layoutAll)\n }, [msd, units, theme])\n\n const plots = useMemo(() => {\n const plots = []\n finalData && Object.entries(finalData).forEach(([type, values]) => {\n const title = `${capitalize(type)} mean squared displacements`\n plots.push(\n \n \n \n \n )\n })\n return plots\n }, [className, finalData, finalLayout, testID])\n\n return \n {plots}\n \n})\n\nconst msdPlotShape = PropTypes.oneOfType([\n PropTypes.oneOf([false, undefined]),\n PropTypes.shape({\n times: PropTypes.arrayOf(PropTypes.number),\n value: PropTypes.arrayOf(PropTypes.number)\n })\n])\nconst msdLabelShape = PropTypes.arrayOf(msdPlotShape)\nconst msdShape = PropTypes.objectOf(msdLabelShape)\n\nMeanSquaredDisplacement.propTypes = {\n msd: msdShape,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nMeanSquaredDisplacement.defaultProps = {\n 'data-testid': 'mean-squared-displacement'\n}\n\nexport default withErrorHandler(msdError)(MeanSquaredDisplacement)\n\n/**\n * Returns the plots for all mean squared displacements that are contained in\n * the given archive.\n */\nconst MeanSquaredDisplacementsRaw = React.memo(({\n index,\n archive\n}) => {\n const fromEntry = useCallback((index, archive) => {\n let msdAll = {}\n const urlPrefix = `${getLocation()}/data`\n const msdIndex = get(index, msdPath)\n\n // No data\n if (!msdIndex) return msdAll\n\n // Load the basic information from the index in order to show the plot\n // layout with placeholders\n msdIndex.forEach((msd) => {\n set(msdAll, [msd.type], undefined)\n })\n\n // Loading archive\n if (!archive) return msdAll\n\n // Full data ready\n msdAll = {}\n msdIndex.forEach((msd, i) => {\n const type = msd.type\n if (!has(msdAll, type)) msdAll[type] = []\n const msdArchive = get(archive, msdPath)?.[i]\n msdAll[type].push({\n ...msd,\n ...msdArchive,\n archiveUrl: `${urlPrefix}/${msdPath.join('/')}:${i}`\n })\n })\n return msdAll\n }, [])\n const msd = fromEntry(index, archive)\n\n return \n})\n\nMeanSquaredDisplacementsRaw.propTypes = {\n index: PropTypes.object,\n archive: PropTypes.object\n}\n\nexport const MeanSquaredDisplacements = withErrorHandler(msdError)(MeanSquaredDisplacementsRaw)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport { MeanSquaredDisplacements } from '../../visualization/MeanSquaredDisplacement'\n\n/**\n * Card for displaying dynamical properties.\n */\nconst DynamicalPropertiesCard = React.memo(({index, properties, archive}) => {\n // Check what data is available and do not show the card if none of the properties are\n // available.\n const hasMsd = properties.has('mean_squared_displacement')\n if (!hasMsd) return null\n\n return \n {hasMsd && }\n \n})\n\nDynamicalPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default DynamicalPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useEffect, useMemo, useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport assert from 'assert'\nimport { set, get, isNil, isArray, has, capitalize, isPlainObject} from 'lodash'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { PropertyItem, PropertySubGrid } from '../entry/properties/PropertyCard'\nimport { getLocation } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport { ErrorHandler, withErrorHandler } from '../ErrorHandler'\nimport { getLineStyles } from '../plotting/common'\n\nconst distanceUnit = new Unit('meter')\nexport const rdfPath = ['results', 'properties', 'structural', 'radial_distribution_function']\nexport const rdfError = 'Could not load radial distribution function data.'\n\n/**\n * Creates plots for a set of radial distribution functions (RDFs). The\n * different types of rdfs (molecular, atomic, etc.) get their own subtitle and\n * all RDFs with the same label are plotted in the same graph.\n */\nconst RadialDistributionFunction = React.memo(({\n rdf,\n className,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const [finalData, setFinalData] = useState(rdf)\n const [finalLayout, setFinalLayout] = useState()\n const {units} = useUnitContext()\n\n // Check that the data is valid. Otherwise raise an exception.\n assert(isPlainObject(rdf), 'Invalid rdf data provided.')\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n // Loop through different types\n const tracesAll = {}\n const layoutAll = {}\n for (const [type, labels] of Object.entries(rdf)) {\n for (const [label, values] of Object.entries(labels)) {\n const path = [type, label]\n if (isNil(values)) {\n set(tracesAll, path, undefined)\n set(layoutAll, path, undefined)\n continue\n }\n if (values === false) {\n set(tracesAll, path, false)\n continue\n }\n let i = 0\n const traces = []\n const lineStyles = getLineStyles(values.length, theme)\n const layout = {\n showlegend: true,\n legend: {\n x: 1,\n y: 1,\n xanchor: 'right'\n },\n xaxis: {\n title: {\n text: `${label} distance (${distanceUnit.toSystem(units).label()})`\n },\n zeroline: false\n },\n yaxis: {\n title: {\n text: `g(r)`\n },\n zeroline: false\n }\n }\n for (const value of values) {\n assert(isArray(value?.bins), `Radial distribution function was expecting an array of bins, but instead got: ${rdf?.bins}`)\n assert(isArray(value?.value), `Radial distribution function was expecting an array of values, but instead got: ${rdf?.value}`)\n const r = new Quantity(value?.bins, distanceUnit).toSystem(units).value()\n traces.push({\n x: r,\n y: value.value,\n name: `Frames: ${value.frame_start}-${value.frame_end}`,\n type: 'scatter',\n showlegend: true,\n line: lineStyles[i]\n })\n ++i\n }\n set(tracesAll, path, traces)\n set(layoutAll, path, layout)\n }\n }\n setFinalData(tracesAll)\n setFinalLayout(layoutAll)\n }, [rdf, units, theme])\n\n const plots = useMemo(() => {\n const plots = []\n finalData && Object.entries(finalData).forEach(([type, labels]) => {\n const title = `${capitalize(type)} radial distribution functions`\n plots.push(\n \n \n \n {Object.keys(labels).map((label, i) => )}\n \n \n \n )\n })\n return plots\n }, [className, finalData, finalLayout, testID])\n\n return plots\n})\n\nconst rdfPlotShape = PropTypes.oneOfType([\n PropTypes.shape({\n bins: PropTypes.arrayOf(PropTypes.number),\n value: PropTypes.arrayOf(PropTypes.number)\n }),\n PropTypes.oneOf([false, undefined])\n])\nconst rdfLabelShape = PropTypes.objectOf(PropTypes.arrayOf(rdfPlotShape))\nconst rdfShape = PropTypes.objectOf(rdfLabelShape)\n\nRadialDistributionFunction.propTypes = {\n rdf: rdfShape,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nRadialDistributionFunction.defaultProps = {\n 'data-testid': 'radial-distribution-function'\n}\n\nexport default withErrorHandler(rdfError)(RadialDistributionFunction)\n\n/**\n * Returns the plots for all radial distribution functions that are contained in\n * the given archive.\n */\nconst RadialDistributionFunctionsRaw = React.memo(({\n index,\n archive\n}) => {\n const fromEntry = useCallback((index, archive) => {\n let rdfAll = {}\n const urlPrefix = `${getLocation()}/data`\n const rdfIndex = get(index, rdfPath)\n\n // No data\n if (!rdfIndex) return rdfAll\n\n // Load the basic information from the index in order to show the plot\n // layout with placeholders\n rdfIndex.forEach((rdf, i) => {\n set(rdfAll, [rdf.type, rdf.label], undefined)\n })\n\n // Loading archive\n if (!archive) return rdfAll\n\n // Full data ready\n rdfAll = {}\n rdfIndex.forEach((rdf, i) => {\n const type = rdf.type\n const label = rdf.label\n if (!has(rdfAll, type)) rdfAll[type] = {}\n if (!has(rdfAll[type], label)) rdfAll[type][label] = []\n const rdfArchive = get(archive, rdfPath)?.[i]\n rdfAll[type][label].push({\n ...rdf,\n ...rdfArchive,\n archiveUrl: `${urlPrefix}/${rdfPath.join('/')}:${i}`\n })\n })\n return rdfAll\n }, [])\n const rdf = fromEntry(index, archive)\n\n return \n})\n\nRadialDistributionFunctionsRaw.propTypes = {\n index: PropTypes.object,\n archive: PropTypes.object\n}\n\nexport const RadialDistributionFunctions = withErrorHandler(rdfError)(RadialDistributionFunctionsRaw)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useEffect, useMemo, useCallback} from 'react'\nimport PropTypes from 'prop-types'\nimport assert from 'assert'\nimport { set, get, isNil, isArray, isPlainObject, has, capitalize} from 'lodash'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { PropertyItem, PropertySubGrid } from '../entry/properties/PropertyCard'\nimport { getLocation } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport { ErrorHandler, withErrorHandler } from '../ErrorHandler'\nimport { getLineStyles } from '../plotting/common'\n\nconst timeUnit = new Unit('second')\nconst distanceUnit = new Unit('meter')\nexport const rgPath = ['results', 'properties', 'structural', 'radius_of_gyration']\nexport const rgError = 'Could not load radius of gyration data.'\n\n/**\n * Creates plots for a set of radii of gyration (Rgs). The\n * different types of rgs (molecular, atomic, etc.) get their own subtitle and\n * all Rgs (regardless of label) are plotted in the same graph.\n */\nconst RadiusOfGyration = React.memo(({\n rg,\n className,\n 'data-testid': testID\n}) => {\n const theme = useTheme()\n const [finalData, setFinalData] = useState(rg)\n const [finalLayout, setFinalLayout] = useState()\n const {units} = useUnitContext()\n\n // Check that the data is valid. Otherwise raise an exception.\n assert(isPlainObject(rg), 'Invalid radius of gyration data provided.')\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n // Loop through different types\n const tracesAll = {}\n const layoutAll = {}\n for (const [type, values] of Object.entries(rg)) {\n const path = [type]\n if (isNil(values)) {\n set(tracesAll, path, undefined)\n set(layoutAll, path, undefined)\n continue\n }\n if (values === false) {\n set(tracesAll, path, false)\n continue\n }\n\n let i = 0\n const traces = [[], []]\n const lineStyles = getLineStyles(values.length, theme)\n const layout = []\n layout.push({\n showlegend: true,\n legend: {\n x: 1,\n y: 1,\n xanchor: 'right'\n },\n xaxis: {\n title: {\n text: `Time (${timeUnit.toSystem(units).label()})`\n },\n autorange: true,\n zeroline: false\n },\n yaxis: {\n title: {\n text: `Rg (${distanceUnit.toSystem(units).label()})`\n },\n autorange: true,\n zeroline: false\n }\n })\n layout.push({\n showlegend: true,\n legend: {\n x: 1,\n y: 1,\n xanchor: 'right'\n },\n yaxis: {\n title: 'Occurrence (%)',\n autorange: true,\n zeroline: false\n },\n xaxis: {\n title: {\n text: `Rg (${distanceUnit.toSystem(units).label()})`\n },\n autorange: true,\n zeroline: false\n }\n })\n\n for (const value of values) {\n assert(isArray(value?.time), `Radius of gyration was expecting an array of times, but instead got: ${rg?.time}`)\n assert(isArray(value?.value), `Radius of gyration was expecting an array of values, but instead got: ${rg?.value}`)\n const t = new Quantity(value?.time, timeUnit).toSystem(units).value()\n const val = new Quantity(value?.value, distanceUnit).toSystem(units).value()\n\n traces[0].push({\n x: t,\n y: val,\n name: `${value?.label}`,\n type: 'scatter',\n showlegend: true,\n line: lineStyles[i]\n })\n\n traces[1].push({\n x: val,\n name: `${value?.label}`,\n type: 'histogram',\n histnorm: 'percent',\n showlegend: true,\n line: lineStyles[i]\n })\n ++i\n }\n set(tracesAll, path, traces)\n set(layoutAll, path, layout)\n }\n setFinalData(tracesAll)\n setFinalLayout(layoutAll)\n }, [rg, units, theme])\n\n const plots = useMemo(() => {\n const plots = []\n finalData && Object.entries(finalData).forEach(([type, values]) => {\n const title = `${capitalize(type)} radii of gyration`\n plots.push(\n \n \n \n \n \n \n \n \n \n \n \n \n )\n })\n return plots\n }, [className, finalData, finalLayout, testID])\n\n return plots\n})\n\nconst rgPlotShape = PropTypes.oneOfType([\n PropTypes.shape({\n time: PropTypes.arrayOf(PropTypes.number),\n value: PropTypes.arrayOf(PropTypes.number)\n }),\n PropTypes.oneOf([false, undefined])\n])\nconst rgLabelShape = PropTypes.arrayOf(rgPlotShape)\nconst rgShape = PropTypes.objectOf(rgLabelShape)\n\nRadiusOfGyration.propTypes = {\n rg: rgShape,\n className: PropTypes.string,\n 'data-testid': PropTypes.string\n}\n\nRadiusOfGyration.defaultProps = {\n 'data-testid': 'radius-of-gyration'\n}\n\nexport default withErrorHandler(rgError)(RadiusOfGyration)\n\n/**\n * Returns the plots for all radii of gyration that are contained in\n * the given archive.\n */\nconst RadiiOfGyrationRaw = React.memo(({\n index,\n archive\n}) => {\n const fromEntry = useCallback((index, archive) => {\n let rgAll = {}\n const urlPrefix = `${getLocation()}/data`\n const rgIndex = get(index, rgPath)\n\n // No data\n if (!rgIndex) return rgAll\n\n // Load the basic information from the index.\n rgIndex.forEach((rg, i) => {\n set(rgAll, [rg.kind], undefined)\n })\n\n // Still loading archive but the amount of plots is already known\n if (!archive) return rgAll\n\n // Full data ready\n rgAll = {}\n rgIndex.forEach((rg, i) => {\n const kind = rg.kind\n if (!has(rgAll, kind)) {\n rgAll[kind] = []\n }\n const rgArchive = get(archive, rgPath)?.[i]\n rgAll[kind].push({\n ...rg,\n ...rgArchive,\n archiveUrl: `${urlPrefix}/${rgPath.join('/')}:${i}`\n })\n })\n return rgAll\n }, [])\n const rg = fromEntry(index, archive)\n\n return \n})\n\nRadiiOfGyrationRaw.propTypes = {\n index: PropTypes.object,\n archive: PropTypes.object\n}\n\nexport const RadiiOfGyration = withErrorHandler(rgError)(RadiiOfGyrationRaw)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { RadialDistributionFunctions } from './RadialDistributionFunction'\nimport { RadiiOfGyration } from './RadiusOfGyration'\nimport { PropertyGrid } from '../entry/properties/PropertyCard'\n\nexport const rdfPath = ['results', 'properties', 'structural', 'radial_distribution_function']\nexport const rdfError = 'Could not load radial distribution function data.'\nexport const rgPath = ['results', 'properties', 'structural', 'radius_of_gyration']\n\nconst StructuralProperties = React.memo(({\n index,\n properties,\n archive\n}) => {\n // Find out which properties are present\n const hasRdf = properties.has('radial_distribution_function')\n const hasRg = properties.has('radius_of_gyration')\n\n return \n {hasRdf && }\n {hasRg && }\n \n})\n\nStructuralProperties.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default StructuralProperties\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport StructuralProperties from '../../visualization/StructuralProperties'\n\n/**\n * Card for displaying structural properties.\n */\nconst StructuralPropertiesCard = React.memo(({index, properties, archive}) => {\n // Check what data is available and do not show the card if none of the properties are\n // available.\n // Find out which properties are present\n const hasRdf = properties.has('radial_distribution_function')\n const hasRg = properties.has('radius_of_gyration')\n\n // Do not show the card if none of the properties are available\n if (!hasRdf && !hasRg) {\n return null\n }\n\n return \n \n \n})\n\nStructuralPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default StructuralPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useMemo, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport assert from 'assert'\nimport { isNil, isArray } from 'lodash'\nimport { useTheme } from '@material-ui/core/styles'\nimport Plot from '../plotting/Plot'\nimport { QuantityTable, QuantityRow, QuantityCell } from '../Quantity'\nimport { ErrorHandler, withErrorHandler } from '../ErrorHandler'\nimport { diffTotal } from '../../utils'\nimport { Quantity } from '../units/Quantity'\nimport { Unit } from '../units/Unit'\nimport { useUnitContext } from '../units/UnitContext'\nimport { PropertyGrid, PropertyItem } from '../entry/properties/PropertyCard'\n\nconst energyUnit = new Unit('joule')\n/**\n * Component for visualizing the results of a geometry optimization workflow.\n */\nconst GeometryOptimization = React.memo(({\n energies,\n convergence,\n className,\n classes,\n 'data-testid': testID\n}) => {\n const [finalData, setFinalData] = useState(!energies ? energies : undefined)\n const {units} = useUnitContext()\n const theme = useTheme()\n\n // Side effect that runs when the data that is displayed should change. By\n // running all this heavy stuff within useEffect (instead of e.g. useMemo),\n // the first render containing the placeholders etc. can be done as fast as\n // possible.\n useEffect(() => {\n if (!energies) {\n setFinalData(energies)\n return\n }\n\n // Convert energies into the correct units and calculate the total difference\n assert(\n isArray(energies),\n `Geometry optimization was expecting an array of energies, but instead got: ${energies}`\n )\n const energyDiffTotal = new Quantity(diffTotal(energies), energyUnit).toSystem(units).value()\n const convergenceCriteria = isNil(convergence?.convergence_tolerance_energy_difference)\n ? undefined\n : new Quantity(convergence.convergence_tolerance_energy_difference, energyUnit).toSystem(units).value()\n\n const steps = [...Array(energies.length).keys()]\n const energyDiff = []\n for (let i = 0; i < energyDiffTotal.length - 1; ++i) {\n energyDiff.push(Math.abs(energyDiffTotal[i + 1] - energyDiffTotal[i]))\n }\n const traces = [\n {\n x: steps,\n y: energyDiffTotal,\n name: 'Total change',\n type: 'scatter',\n showlegend: false,\n line: {\n color: theme.palette.primary.main,\n width: 2\n }\n },\n {\n x: steps.slice(1, steps.length),\n y: energyDiff,\n yaxis: 'y2',\n name: 'Abs. change per step',\n type: 'scatter',\n showlegend: false,\n line: {\n color: theme.palette.secondary.main,\n width: 2\n }\n }\n ]\n if (convergenceCriteria) {\n traces.push({\n x: [steps[0], steps[steps.length - 1]],\n y: [\n convergenceCriteria,\n convergenceCriteria\n ],\n yaxis: 'y2',\n name: 'Convergence criteria',\n showlegend: true,\n type: 'line',\n mode: 'lines',\n line: {\n color: theme.palette.secondary.main,\n width: 1,\n dash: '10px,10px'\n }\n })\n }\n setFinalData(traces)\n }, [energies, convergence, units, theme])\n\n const plotLayout = useMemo(() => {\n if (!energies) {\n return null\n }\n return {\n showlegend: true,\n legend: {\n x: 0,\n y: 1,\n xanchor: 'left'\n },\n xaxis: {\n showexponent: 'first',\n title: {\n text: 'Step number'\n },\n tickmode: 'auto',\n tickformat: ',d',\n autorange: false,\n range: [0, energies.length - 1],\n zeroline: false,\n showspikes: true,\n spikethickness: 2,\n spikedash: 'dot',\n spikecolor: '#999999',\n spikemode: 'across' },\n yaxis: {\n title: {\n text: `Total change (${energyUnit.toSystem(units).label()})`\n },\n tickfont: {\n color: theme.palette.primary.dark\n },\n autorange: true,\n zeroline: false\n },\n yaxis2: {\n title: {\n text: `Abs. change per step (${energyUnit.toSystem(units).label()})`\n },\n tickfont: {\n color: theme.palette.secondary.dark\n },\n type: 'log',\n autorange: true,\n zeroline: false,\n overlaying: 'y',\n side: 'right'\n }\n }\n }, [energies, theme, units])\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n})\n\nGeometryOptimization.propTypes = {\n energies: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.oneOf([undefined]),\n PropTypes.arrayOf(PropTypes.number)\n ]),\n convergence: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.oneOf([undefined]),\n PropTypes.shape({\n final_energy_difference: PropTypes.number,\n final_displacement_maximum: PropTypes.number,\n final_force_maximum: PropTypes.number\n })\n ]),\n className: PropTypes.string,\n classes: PropTypes.object,\n 'data-testid': PropTypes.string\n}\n\nGeometryOptimization.defaultProps = {\n 'data-testid': 'geometry-optimization'\n}\n\nexport default withErrorHandler('Could not load geometry optimization data.')(GeometryOptimization)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport { resolveInternalRef } from '../../../utils'\nimport GeometryOptimization from '../../visualization/GeometryOptimization'\n\nconst GeometryOptimizationCard = React.memo(({index, archive, properties}) => {\n const geoOptProps = index?.results?.properties?.geometry_optimization\n\n // Find out which properties are present. If only one step is calculated\n // (n_calculations == 1 and none of the convergence criteria are available),\n // the card will not be displayed.\n const hasEnergies = properties.has('geometry_optimization') &&\n index?.results?.properties?.n_calculations > 1\n const hasConvergence = properties.has('geometry_optimization') &&\n (\n index?.results?.properties?.geometry_optimization?.final_energy_difference ||\n index?.results?.properties?.geometry_optimization?.final_displacement_maximum ||\n index?.results?.properties?.geometry_optimization?.final_force_maximum\n )\n\n // Do not show the card if none of the properties are available\n if (!hasEnergies && !hasConvergence) {\n return null\n }\n\n // Resolve energies\n let energies = hasEnergies ? null : false\n const energiesArchive = archive?.results?.properties?.geometry_optimization?.energies\n if (hasEnergies && energiesArchive) {\n energies = resolveInternalRef(energiesArchive, archive)\n }\n\n // Resolve convergence properties\n const convergence = hasConvergence ? geoOptProps : false\n\n return \n \n \n})\n\nGeometryOptimizationCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default GeometryOptimizationCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard, PropertyGrid, PropertyItem } from './PropertyCard'\nimport Spectra from '../../visualization/Spectra'\n\n/**\n * Card displaying spectroscopic properties.\n*/\nconst SpectroscopicPropertiesCard = React.memo(({index, properties, archive}) => {\n // Find out which properties are present\n const hasSpectra = properties.has('spectra')\n\n // Do not show the card if none of the properties are available\n if (!hasSpectra) return null\n\n // Check index for which types of spectras exist. Create a mapping based on\n // this: this will allow the GUI to show a placeholder while the data is\n // loaded from archive.\n const spectras = hasSpectra ? {} : false\n for (const spectra of index?.results?.properties?.spectroscopic?.spectra) {\n spectras[spectra.type] = undefined\n }\n\n // When archive is loaded, fill out the information\n if (archive) {\n let spectraReferences = archive?.results?.properties?.spectroscopic?.spectra\n if (!Array.isArray(spectraReferences)) spectraReferences = [spectraReferences]\n if (spectraReferences) {\n for (const spectra of spectraReferences) {\n const data = {}\n data.type = spectra.type\n data.label = spectra.label === 'computation' ? 'comp.' : 'exp.'\n data.intensities = spectra.intensities\n data.energies = spectra.energies\n if (data.energies) {\n if (spectras[spectra.type]) {\n spectras[spectra.type].push(data)\n } else {\n spectras[spectra.type] = [data]\n }\n }\n }\n }\n }\n\n return \n \n {spectras && Object.entries(spectras).map(([key, value]) => {\n return \n \n \n })}\n \n \n})\n\nSpectroscopicPropertiesCard.propTypes = {\n index: PropTypes.object.isRequired,\n properties: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default SpectroscopicPropertiesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useEffect, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { Link, IconButton, Typography, makeStyles, Box } from '@material-ui/core'\nimport TooltipButton from '../../utils/TooltipButton'\nimport NavigateNextIcon from '@material-ui/icons/NavigateNext'\nimport { useApi } from '../../api'\nimport { useErrors } from '../../errors'\nimport { Datatable, DatatableTable, DatatablePagePagination } from '../../datatable/Datatable'\nimport { formatTimestamp } from '../../../utils'\nimport Quantity from '../../Quantity'\nimport { PropertyCard } from './PropertyCard'\nimport Ellipsis from '../../visualization/Ellipsis'\n\nconst useResourceDetailsStyles = makeStyles(theme => ({\n resourceDetails: {\n padding: theme.spacing(1)\n },\n resourceDetailsContents: {\n display: 'flex',\n width: '100%',\n margin: '0'\n },\n resourceDetailsRow: {\n paddingRight: theme.spacing(3)\n },\n resourceDetailsActions: {\n display: 'flex',\n flexBasis: 'auto',\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: 'flex-end',\n marginBottom: theme.spacing(1),\n marginTop: theme.spacing(2)\n },\n resourceURL: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n width: '11rem'\n }\n}))\n\nconst ResourceDetails = React.memo(({data}) => {\n const classes = useResourceDetailsStyles()\n const downloadTime = {download_time: formatTimestamp(data?.download_time)}\n\n return
\n
\n
\n \n \n
\n
\n \n
\n
\n \n
\n
\n
\n})\n\nResourceDetails.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nconst ResourceActions = React.memo(({data}) => {\n return { window.location = data.url }}\n >\n \n \n})\n\nResourceActions.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nconst RelatedResourcesCard = React.memo(({index, archive}) => {\n const {resourcesApi} = useApi()\n const {raiseError} = useErrors()\n const [externalResources, setExternalResources] = useState()\n const [pagination, setPagination] = useState({\n page_size: 10, page: 1, order_by: 'id', order: 'asc', total: 0\n })\n\n useEffect(() => {\n const material = archive?.results?.material\n const spg = material?.symmetry?.space_group_number\n const structures = archive?.results?.properties?.structures\n const wyckoffSets = structures?.structure_conventional?.wyckoff_sets\n const wyckoff = wyckoffSets ? wyckoffSets.map((set) => set?.wyckoff_letter || '') : null\n const species = structures?.structure_original?.species_at_sites || null\n const nsites = species ? species.length : null\n const formula = material?.chemical_formula_reduced\n const params = []\n if (spg) {\n params.push(`space_group_number=${spg}`)\n }\n if (wyckoff) {\n params.push(`wyckoff_letters=${wyckoff.join('&wyckoff_letters=')}`)\n }\n if (nsites) {\n params.push(`n_sites=${nsites}`)\n }\n if (formula) {\n params.push(`chemical_formula_reduced=${formula}`)\n }\n resourcesApi.get(`/?${params.join('&')}`).then(response => {\n setExternalResources(response)\n setPagination(pagination => ({...pagination, total: response.data.length}))\n }).catch(raiseError)\n }, [archive, resourcesApi, raiseError, setExternalResources, setPagination])\n\n const columns = useMemo(() => [\n {\n key: 'id',\n sortable: true,\n align: 'left',\n render: data => (\n \n {data.id}\n \n )\n },\n {\n key: 'url',\n sortable: true,\n align: 'left',\n render: data => (\n \n \n {data.url}\n \n \n )\n },\n {\n key: 'database',\n sortable: true,\n align: 'left',\n render: data => data.database_name\n }\n ], [])\n\n if (!externalResources || (!externalResources.is_retrieving_more && externalResources.data.length === 0)) {\n return ''\n }\n\n const {page_size, page, total, order, order_by} = pagination\n const compare = (a, b) => {\n const value = data => String(data[order_by])\n return value(a).localeCompare(value(b)) * (order === 'asc' ? 1 : -1)\n }\n const start = page_size * (page - 1)\n const end = page_size + start\n const length = (end > total) ? total - start : page_size\n const data = [...externalResources.data].sort(compare).slice(start, start + length)\n\n return \n {externalResources.is_retrieving_more && externalResources.data.length === 0 && (\n \n Updating external resources, try again later\n \n )}\n {(externalResources.data.length > 0) && (\n \n \n \n \n \n )}\n \n})\n\nRelatedResourcesCard.propTypes = {\n index: PropTypes.object.isRequired,\n archive: PropTypes.object\n}\n\nexport default RelatedResourcesCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\")\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useMemo, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport * as d3 from 'd3'\nimport { makeStyles, Tooltip, IconButton, TextField, FormControl } from '@material-ui/core'\nimport grey from '@material-ui/core/colors/grey'\nimport blueGrey from '@material-ui/core/colors/blueGrey'\nimport red from '@material-ui/core/colors/red'\nimport { Replay, Undo, Label, LabelOff, PlayArrowSharp, StopSharp, Clear } from '@material-ui/icons'\nimport { useHistory } from 'react-router-dom'\nimport { isPlainObject } from 'lodash'\nimport { PropertyCard, PropertyGrid } from './PropertyCard'\nimport { resolveNomadUrl, resolveInternalRef, createEntryUrl } from '../../../utils'\nimport { useApi } from '../../api'\nimport { getUrl } from '../../nav/Routes'\nimport { nomadFontFamily, apiBase } from '../../../config'\nimport { useAsyncError } from '../../../hooks'\n\nconst useWorkflowGraphStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n minWidth: 1000,\n '& .link': {\n fill: 'none',\n strokeOpacity: 0.5,\n fillOpacity: 0.5,\n strokeWidth: 2.5\n },\n '& .text': {\n fontFamily: nomadFontFamily,\n fontSize: 12,\n dy: '0.35em',\n textAnchor: 'middle'\n },\n '& .icon': {\n strokeWidth: 2,\n strokeOpacity: 0.5\n }\n }\n}))\n\nlet archives = {}\n\nconst resolveSection = async (source, query) => {\n if (isPlainObject(source.section)) {\n // already resolved\n return source\n }\n\n let path = source.path\n if (typeof path !== 'string') path = source.section || '/'\n const pathSegments = path.split('#').filter(p => p)\n\n let archive = source.archive\n let baseUrl = createEntryUrl(apiBase, archive?.metadata?.upload_id, archive?.metadata?.entry_id)\n let section\n if (pathSegments.length === 1) {\n // internal reference\n path = pathSegments[0]\n try {\n section = source.section ? source.path : resolveInternalRef(path, archive)\n } catch (error) {\n console.error(`Cannot resolve section ${path}`)\n return\n }\n } else {\n // external reference\n // temporary fix for path following the format /entries/entry_id/archive\n // TODO extend resolveNomadUrl for other reference formats\n let entryId\n const match = path.match('/entries/(.+?)/archive')\n if (match) {\n entryId = match[1]\n } else {\n const url = resolveNomadUrl(path, baseUrl)\n entryId = url.entryId\n }\n const {api, required} = query\n try {\n archive = archives[entryId]\n if (!archive) {\n const response = await api.post(`/entries/${entryId}/archive/query`, {required: required})\n archive = response.data.archive\n archives[entryId] = archive\n }\n path = pathSegments[1]\n if (!path.startsWith('/')) path = `/${path}`\n section = source.section ? source.path : resolveInternalRef(path, archive)\n } catch (error) {\n console.error(`Cannot resolve entry ${entryId}: ${error}`)\n return\n }\n }\n\n if (!section) return\n\n baseUrl = createEntryUrl(apiBase, archive?.metadata?.upload_id, archive?.metadata?.entry_id)\n const match = path.match('.*/([^/]+)/(\\\\d+)$')\n\n const sectionKeys = query.sectionKeys || []\n const nChildren = (section) => (sectionKeys.map(key => (section[key] || []).length)).reduce((a, b) => a + b)\n if (section.task) {\n const task = await resolveSection({path: section.task, archive: archive}, query)\n if (!task) return\n task.section.inputs = section.inputs && section.inputs.length ? section.inputs : task.section.inputs\n task.section.outputs = section.outputs && section.outputs.length ? section.outputs : task.section.outputs\n task.nChildren = nChildren(task.section)\n return task\n }\n\n return {\n name: section.name,\n section: section,\n sectionType: match ? match[1] : path.split('/').pop(),\n path: path,\n archive: source.section ? null : archive,\n url: [baseUrl, path].join('#'),\n entryId: archive?.metadata?.entry_id,\n color: section.color,\n nChildren: nChildren(section)\n }\n}\n\nconst range = (start, stop) => Array.from(Array(stop - start).fill(start).map((n, i) => n + i))\n\nconst getNodes = async (source, query) => {\n let {resolveIndices, maxNodes} = query\n const {sectionKeys} = query\n\n let nodes = source.nodes || []\n if (nodes.length && !resolveIndices) return nodes\n\n if (!maxNodes) maxNodes = 7\n\n const resolved = await resolveSection(source, query)\n if (!resolved) return nodes\n const parent = resolved.section\n if (!parent) return nodes\n\n nodes = []\n const archive = resolved.archive\n for (const key of sectionKeys) {\n let children = parent[key] || []\n const nChildren = children.length\n if (!Array.isArray(children)) children = [children]\n\n let sectionIndices = range(0, nChildren)\n if (resolveIndices && resolveIndices[key]) {\n sectionIndices = resolveIndices[key] || sectionIndices\n } else if (maxNodes < nChildren) {\n const mid = Math.floor(maxNodes / 2)\n // show first and last few nodes\n sectionIndices = [...range(0, mid), ...range(nChildren - mid, nChildren)]\n }\n\n for (const index of sectionIndices) {\n const child = children[index]\n if (!child) continue\n\n let path = child\n if (!child.section) path = `${source.path}/${key}/${index}`\n const section = await resolveSection({section: child.section, path: path, archive: archive}, query)\n if (!section) continue\n\n section.name = child.name\n section.type = key\n section.index = index\n section.parent = source\n section.total = nChildren\n nodes.push(section)\n }\n }\n\n return nodes\n}\n\nconst getLinks = async (source, query) => {\n if (source.links) return source.links\n\n const nodes = source.nodes\n if (!source.nodes) return\n\n const links = []\n for (const node of nodes) {\n if (node.type === 'tasks') {\n node.nodes = await getNodes(node, query)\n }\n }\n\n const isLinked = (source, target) => {\n if (source.url === target.url) return false\n\n const outputs = []\n if (source.type === 'tasks' && source.nodes) {\n outputs.push(...source.nodes.filter(node => node.type === 'outputs').map(node => node.url))\n } else {\n outputs.push(source.url)\n }\n\n const inputs = []\n if (target.type === 'tasks' && target.nodes) {\n inputs.push(...target.nodes.filter(node => node.type && node.type.startsWith('inputs')).map(node => node.url))\n } else {\n inputs.push(target.url)\n }\n\n let linked = false\n for (const output of outputs) {\n if (!output) continue\n if (inputs.includes(output)) {\n linked = true\n break\n }\n }\n return linked\n }\n\n // links from inputs to source\n const inputs = nodes.filter(node => node.type && node.type.startsWith('inputs') && node.url)\n inputs.forEach(input => {\n links.push({source: input, target: source, label: 'Input'})\n })\n // links from source to outputs\n const outputs = nodes.filter(node => node.type === 'outputs' && node.url)\n outputs.forEach(output => {\n links.push({source: source, target: output, label: 'Output'})\n })\n\n // source and target are linked if any of the outputs of source or source itself is any of the\n // inputs of target or target itself\n for (const source of ['inputs', 'tasks']) {\n for (const target of ['outputs', 'tasks']) {\n const sourceNodes = nodes.filter(node => node.type && node.type.startsWith(source) && node.url)\n const targetNodes = nodes.filter(node => node.type === target && node.url)\n sourceNodes.forEach(sourceNode => {\n targetNodes.forEach(targetNode => {\n if (isLinked(sourceNode, targetNode)) {\n let label = ''\n if (source === 'inputs') {\n label = 'Input'\n } else if (target === 'outputs') {\n label = 'Output'\n } else {\n label = 'Click to see how tasks are linked'\n }\n links.push({source: sourceNode, target: targetNode, label: label})\n }\n })\n })\n }\n }\n\n return links\n}\n\nconst Graph = React.memo(({\n source,\n query,\n layout,\n setTooltipContent,\n setCurrentNode,\n setShowLegend,\n setEnableForce\n }) => {\n const classes = useWorkflowGraphStyles()\n const svgRef = useRef()\n const history = useHistory()\n const asyncError = useAsyncError()\n const finalLayout = useMemo(() => {\n const defaultLayout = {\n width: 700,\n margin: {top: 60, bottom: 60, left: 40, right: 40},\n circleRadius: 20,\n markerWidth: 4,\n scaling: 0.35,\n color: {\n text: grey[800],\n link: red[800],\n outline: blueGrey[800],\n workflow: '#192E86',\n task: '#00AC7C',\n input: '#A59FFF',\n output: '#005A35'\n },\n shape: {\n input: 'circle',\n workflow: 'rect',\n task: 'rect',\n output: 'circle'\n }\n }\n return {...defaultLayout, ...layout}\n }, [layout])\n archives = {}\n\n useEffect(() => {\n const {width, markerWidth, scaling, color} = finalLayout\n const nodeShape = finalLayout.shape\n const whRatio = 1.6\n const legendSize = 12\n const height = width / whRatio\n\n const svg = d3.select(svgRef.current)\n\n const inOutColor = d3.interpolateRgb(color.input, color.output)(0.5)\n\n let nodes, node, line\n let id = 0\n let view\n let focus\n let previousNode = 'root'\n let root\n const dquery = {...query, resolveIndices: {}}\n let currentNode = root\n let hasError = false\n let enableForce = false\n let dragged = false\n let zoomTransform = d3.zoomIdentity\n\n const isWorkflow = (d) => {\n if (d.sectionType && d.sectionType.startsWith('workflow')) return true\n const tasks = (d.nodes || []).filter(n => n.type === 'tasks')\n return tasks.length > 0\n }\n\n const nodeColor = (d) => {\n if (d.color) return d.color\n if (d.type === 'link') return '#ffffff'\n if (isWorkflow(d)) return color.workflow\n if (d.type === 'tasks') return color.task\n if (d.type === 'inputs-outputs') return inOutColor\n return d.type === 'inputs' ? color.input : color.output\n }\n\n const trimName = (name) => name && name.length > 25 ? `${name.substring(0, 22)}...` : name\n\n svg.attr('width', width)\n .attr('height', height)\n\n svg.append('g')\n .attr('class', 'svgGroup')\n\n const svgGroup = svg.select('.svgGroup')\n\n svg.append('defs')\n .attr('class', 'defs')\n\n const addLinkMarkers = (links) => {\n svg.select('.defs')\n .selectAll('marker')\n .exit().remove()\n .data(links.map(link => link.id))\n .enter()\n .append('marker')\n .attr('class', d => `marker-${d}`)\n .attr('id', String)\n .attr('viewBox', '0 -5 10 10')\n .attr('refX', 0)\n .attr('refY', 0)\n .attr('markerWidth', markerWidth)\n .attr('markerHeight', markerWidth)\n .attr('xoverflow', 'visible')\n .attr('orient', 'auto')\n .style('fill', color.link)\n .attr('fill-opacity', 0.5)\n .append('path')\n .attr('d', 'M0,-5L10,0L0,5')\n }\n\n svg.append('g')\n .attr('class', 'legend')\n .attr('visibility', 'visible')\n\n const legend = svg.select('.legend')\n\n const addLegend = (label, index) => {\n const gLegend = legend.append('g')\n .attr('cursor', 'pointer')\n .attr('pointer-events', 'all')\n const shape = nodeShape[label]\n const icon = gLegend.append(shape)\n const dx = width / 8\n const x = width / 2 + dx * index - dx * 1.5\n const y = height - legendSize * 2\n\n if (shape === 'rect') {\n icon.attr('width', legendSize * whRatio)\n .attr('height', legendSize)\n .attr('rx', legendSize * 0.1)\n .attr('x', x - legendSize * whRatio / 2)\n .attr('y', y - legendSize / 2)\n } else {\n icon.attr('r', legendSize / 2)\n .attr('cx', x)\n .attr('cy', y)\n }\n icon\n .attr('fill', nodeColor({type: label + 's', sectionType: label + 's'}))\n\n gLegend.append('text')\n .attr('class', 'text')\n .text(label)\n .style('text-anchor', 'middle')\n .attr('x', x)\n .attr('y', y + legendSize * 1.2)\n .style('alignment-baseline', 'middle')\n\n gLegend\n .on('mouseover', () => {\n let tooltip = ''\n if (label === 'input') {\n tooltip =

\n Input to a task or workflow.\n

\n } else if (label === 'output') {\n tooltip =

\n Output from a task or workflow.\n

\n } else if (label === 'workflow') {\n tooltip =

\n Task containing further sub-tasks.\n

\n } else if (label === 'task') {\n tooltip =

\n Elementary task with inputs and outputs.\n

\n }\n setTooltipContent(tooltip)\n })\n .on('mouseout', () => {\n setTooltipContent('')\n })\n }\n\n // add legend\n legend.append('path')\n .attr('d', () => {\n const line = d3.line().x(d => d[0]).y(d => d[1])\n return line([\n [width / 4 + 70, height - legendSize * 3],\n [3 * width / 4, height - legendSize * 3],\n [3 * width / 4, height],\n [width / 4, height],\n [width / 4, height - legendSize * 3],\n [width / 4 + 10, height - legendSize * 3]\n ])\n })\n .attr('stroke', grey[900])\n .attr('stroke-width', 0.5)\n .attr('fill', 'none')\n legend.append('text')\n .text('Legend')\n .attr('class', 'text')\n .attr('font-weight', 'bold')\n .attr('x', width / 4 + 40)\n .attr('y', height - legendSize * 2.8)\n\n const legendLabels = Object.keys(nodeShape)\n legendLabels.forEach((label, index) => addLegend(label, index))\n\n // add zoom\n const zoomBehaviors = d3.zoom()\n .on('zoom', () => {\n zoomTransform = d3.event.transform\n svgGroup.attr('transform', zoomTransform)\n })\n\n svg.call(zoomBehaviors)\n\n // set zoom factor to <1 inorder to see the inputs and outputs\n const zoomF = (r) => width * scaling / r\n\n // add force directed behavior for tasks inside box\n const simulation = d3.forceSimulation()\n .force('link', d3.forceLink().id(d => d.id))\n .force('charge', d3.forceManyBody())\n .velocityDecay(0.2)\n .alphaDecay(0.2)\n\n // add drag\n const dragBehaviors = d3.drag()\n .on('drag', d => {\n if (!d.parent || d.id === nodes[0].id) return\n const event = d3.event.sourceEvent\n const k = zoomF(view[2])\n const x = ((event.offsetX - zoomTransform.x) / zoomTransform.k - width / 2) / k + view[0]\n const y = ((event.offsetY - zoomTransform.y) / zoomTransform.k - height / 2) / k + view[1]\n setTooltipContent('')\n if (enableForce) {\n d.fx = x\n d.fy = y\n } else {\n d.x = x\n d.y = y\n zoomTo(view)\n }\n })\n .on('start', d => {\n if (!enableForce) return\n simulation.alphaTarget(0.7).restart()\n })\n .on('end', d => {\n dragged = true\n if (!enableForce) return\n simulation.alphaTarget(0)\n d.fx = null\n d.fy = null\n })\n\n const gNode = svgGroup.append('g')\n .attr('class', 'node')\n .attr('cursor', 'pointer')\n .attr('pointer-events', 'all')\n\n const gLink = svgGroup.append('g')\n .attr('class', 'link')\n .attr('cursor', 'default')\n .attr('pointer-events', 'all')\n .attr('stroke', color.link)\n\n const setNodesPosition = (root) => {\n // layout root and its nodes horizontally from inputs (left) root and tasks (middle)\n // and outputs (right)\n if (!root.nodes || root.children) return\n\n const circleRadius = root.r / 12\n const dx = circleRadius * 4\n const fx = 1.4\n const tasks = root.nodes.filter(node => node.type === 'tasks')\n root.children = tasks\n // tasks are arranged in a circle inside the parent workflow\n tasks.forEach((node, index) => {\n const theta = (2 * Math.PI * index / tasks.length) - Math.PI / 4\n node.r = Math.sqrt(node.size || 1) * circleRadius * 1.5\n const r = root.r - node.r\n node.x = -r * 0.95 * Math.cos(theta) * whRatio + root.x\n node.y = -r * (theta < 0 || theta > Math.PI ? 0.95 : 0.85) * Math.sin(theta) + root.y\n })\n\n // inputs left\n const inputs = root.nodes.filter(node => node.type === 'inputs')\n let offsetX = (inputs.length - 1) * dx / 2\n inputs.forEach((node, index) => {\n node.y = index * dx - offsetX + root.y\n node.x = -root.r * fx * whRatio + root.x\n node.r = circleRadius\n })\n\n // inputs-outputs top\n const inouts = root.nodes.filter(node => node.type === 'inputs-outputs')\n offsetX = (inouts.length - 1) * dx\n inouts.forEach((node, index) => {\n node.x = index * dx * 2 - offsetX + root.x\n node.y = -root.r * fx + root.y\n node.r = circleRadius\n })\n\n // outputs right\n const outputs = root.nodes.filter(node => node.type === 'outputs')\n offsetX = (outputs.length - 1) * dx / 2\n outputs.forEach((node, index) => {\n node.y = index * dx - offsetX + root.y\n node.x = root.r * whRatio * fx + root.x\n node.r = circleRadius\n })\n root.nodes = [...inputs, ...inouts, ...root.children, ...outputs]\n }\n\n const fLink = (source, target) => {\n let vx = target.x - source.x\n let vy = target.y - source.y\n const vr = Math.sqrt(vx * vx + vy * vy)\n const sin = vy / vr\n const cos = vx / vr\n const sx = vy ? Math.max(-1, Math.min(cos / sin, 1)) * Math.sign(sin) : Math.sign(vx)\n const sy = vx ? Math.max(-1, Math.min(sin / cos, 1)) * Math.sign(cos) : Math.sign(vy)\n const targetR = (f) => Math.abs(target.r) * f\n let offsetxt, offsetyt, offsetxs, offsetys\n if (source.r > 0) {\n // offset from edge of circle\n offsetxs = cos * source.r\n offsetys = sin * source.r\n } else {\n // offset from edge of square\n offsetxs = -sx * source.r * whRatio\n offsetys = -sy * source.r\n }\n if (target.r > 0) {\n // offset to edge of circle\n offsetxt = cos * targetR(1)\n offsetyt = sin * targetR(1)\n } else {\n // offset to edge of square\n offsetxt = sx * targetR(whRatio)\n offsetyt = sy * targetR(1)\n }\n source = {x: source.x + offsetxs, y: source.y + offsetys}\n target = {x: target.x - offsetxt, y: target.y - offsetyt}\n vx = target.x - source.x\n vy = target.y - source.y\n const line = d3.line().x(d => d[0]).y(d => d[1])\n .curve(d3.curveBasis)\n const points = [[source.x, source.y]]\n if (Math.abs(vx) > Math.abs(vy)) {\n target.x = target.x - markerWidth * 2 * Math.sign(vx)\n // points.push([source.x + vx / 2, source.y])\n // points.push([source.x + vx / 2, target.y])\n } else {\n target.y = target.y - markerWidth * 2 * Math.sign(vy)\n // points.push([source.x, source.y + vy / 2])\n // points.push([target.x, source.y + vy / 2])\n }\n points.push([target.x, target.y])\n return line(points)\n }\n\n const zoomTo = (v) => {\n if (!node) return\n\n // for elementary tasks, set radius to 1/6\n const k = zoomF(v[2])\n const rk = (node) => {\n return node.id === focus.id && !isWorkflow(node) ? 1 / 6 : 1\n }\n const bound = (d) => {\n let x = (d.x - v[0]) * k + width / 2\n let y = (d.y - v[1]) * k + height / 2\n const s = 0.8 * scaling\n if (d.type === 'tasks' && d.id !== source.id) {\n x = Math.min(Math.max(x, s * width), (1 - s) * width)\n y = Math.min(Math.max(y, s * height), (1 - s) * height)\n }\n return [x, y]\n }\n\n view = v\n node\n .attr('transform', d => {\n const [x, y] = bound(d)\n return `translate(${x},${y})`\n })\n node.selectAll('circle').attr('r', d => d.r * rk(d) * k)\n node.selectAll('rect')\n .attr('x', d => -d.r * rk(d) * k * whRatio)\n .attr('y', d => -d.r * rk(d) * k)\n .attr('rx', d => d.r * rk(d) * k * 0.05)\n .attr('width', d => d.r * 2 * rk(d) * k * whRatio)\n .attr('height', d => d.r * 2 * rk(d) * k)\n line.attr('d', d => {\n const translate = (node) => {\n const isCircle = ['inputs', 'outputs', 'inputs-outputs'].includes(node.type)\n const dr = node.r * rk(node) * k\n const [x, y] = bound(node)\n return {\n x: x,\n y: y,\n r: isCircle ? dr : -dr\n }\n }\n return fLink(translate(d.source), translate(d.target))\n })\n node.selectAll('text').attr('y', d => -1.2 * d.r * rk(d) * k)\n }\n\n const zoom = (d) => {\n focus = d\n if (!focus) return\n const transition = svg.transition()\n .duration(500)\n .tween('zoom', d => {\n const i = d3.interpolateZoom(view, [focus.x, focus.y, focus.r * 2])\n return t => zoomTo(i(t))\n })\n\n node.selectAll('text')\n .transition(transition)\n }\n\n const update = (source) => {\n if (!source) return\n\n if (!source.nodes || !source.nodes.length) return\n\n dragged = false\n\n const setShowNodes = (inputValue) => {\n const value = []\n if (hasError) setCurrentNode(currentNode)\n let sourceNode = currentNode\n if (['inputs', 'outputs'].includes(currentNode.type)) {\n sourceNode = currentNode.parent\n }\n if (!sourceNode) return\n let total = 1\n const nodes = sourceNode.nodes.filter(node => node.type === (currentNode.type || 'tasks'))\n if (nodes.length) total = nodes[0].total\n const toNumber = (value) => {\n if (value.includes('%')) return Math.floor(parseFloat(value.replace('%')) * total / 100)\n if (value.includes('.')) return Math.floor(parseFloat(value.replace('%')) * total)\n value = parseInt(value)\n if (value < 0) value = total + value\n return value\n }\n for (const query of inputValue.split(',')) {\n try {\n const q = query.split(':')\n if (q.length === 2) {\n value.push(...range(...q.map((qi, n) => qi ? toNumber(qi) : n === 0 ? 0 : total)))\n } else {\n value.push(toNumber(q[0]))\n }\n } catch (error) {\n console.error(error)\n hasError = true\n setCurrentNode(null)\n break\n }\n }\n if (!value.length) return\n dquery['resolveIndices'][currentNode.type || 'tasks'] = [...new Set(value)]\n source.nodes = source.nodes.filter(node => node.id !== currentNode.id)\n // set children and links to recalculate node positions and links\n const d = source\n d.children = undefined\n d.links = undefined\n d.parent = source.parent\n resolveSection(d, query).then(d => {\n if (!d) return\n getNodes(d, dquery).then(nodes => {\n d.nodes = nodes\n getLinks(d, query).then(links => {\n d.links = links\n update(d)\n zoom(d)\n }).catch(asyncError)\n }).catch(asyncError)\n .catch(asyncError)\n })\n }\n\n d3.select('#nodes-filter-clear')\n .on('click', () => {\n const mid = (query.maxNodes || 6) / 2\n setShowNodes(`:${mid},${-mid}:`)\n })\n\n d3.select('#nodes-filter-enter')\n .on('keydown', () => {\n const inputValue = d3.event.target.value\n if (d3.event.key === 'Enter' && inputValue) setShowNodes(inputValue)\n })\n\n d3.select('#backbutton')\n .on('click', () => {\n previousNode = source.parent\n handleClickIcon(source)\n })\n\n d3.select('#resetbutton')\n .on('click', () => {\n previousNode = 'root'\n root.nodes = null\n root.links = null\n root.children = null\n dquery.resolveIndices = {}\n resolveSection(root, query).then(d => {\n if (!d) return\n getNodes(d, query).then(nodes => {\n d.nodes = nodes\n getLinks(d, query).then(links => {\n d.links = links\n update(d)\n zoom(d)\n }).catch(asyncError)\n }).catch(asyncError)\n .catch(asyncError)\n })\n svg.call(zoomBehaviors.transform, d3.zoomIdentity)\n if (enableForce) simulation.alphaTarget(0)\n })\n\n d3.select('#legendtogglebutton')\n .on('click', () => {\n const visibility = legend.attr('visibility') === 'visible' ? 'hidden' : 'visible'\n legend.attr('visibility', visibility)\n setShowLegend(visibility === 'visible')\n })\n\n d3.select('#forcetogglebutton')\n .on('click', () => {\n enableForce = !enableForce\n setEnableForce(enableForce)\n update(source)\n zoom(source)\n if (enableForce) {\n simulation.alphaTarget(0.7).restart()\n } else {\n simulation.alphaTarget(0)\n }\n })\n\n // set ids and size\n const maxLength = Math.max(...source.nodes\n .filter(node => node.type === 'tasks').map(node => node.nChildren || 0))\n source.size = source.nChildren / maxLength\n source.id = id\n id = id + 1\n source.nodes.forEach((node) => {\n node.size = isWorkflow(node) ? node.nChildren / maxLength : 1\n // put a lower limit on size so node will not get too small\n node.size = Math.max(node.size, 0.1)\n node.id = id\n id = id + 1\n })\n\n setNodesPosition(source)\n\n nodes = [source, ...source.nodes]\n const links = source.links\n\n links.forEach((link) => {\n link.id = `${link.source.id}-${link.target.id}`\n })\n\n addLinkMarkers(links)\n\n if (enableForce) {\n const k = zoomF(source.r * 2)\n simulation\n .nodes(source.nodes.filter(node => node.type === 'tasks'))\n .on('tick', () => zoomTo(view))\n\n simulation\n .force('charge')\n .strength(-10 / k ** 2)\n\n simulation\n .force('link')\n .strength(0.005 / k)\n .distance(source.r)\n .links(source.links.filter(link => link.source.type === 'tasks' && link.target.type === 'tasks'))\n\n simulation\n .force('center', d3.forceCenter(source.x, source.y))\n\n simulation\n .force('collide', d3.forceCollide(source.r / 3).strength(2))\n }\n\n const handleMouseOverIcon = (d) => {\n d3.select(`#icon-${d.id}`).style('stroke-opacity', 1)\n if (d.id === source.id) {\n if (!previousNode || previousNode === 'root') return\n setTooltipContent(

Click to go back up

)\n return\n }\n if (['inputs', 'outputs'].includes(d.type)) {\n setTooltipContent(

Click to switch {d.type} filter

)\n }\n const sectionType = d.sectionType === 'tasks' ? 'task' : 'workflow'\n if (d.type === 'tasks') setTooltipContent(

Click to expand {sectionType}

)\n }\n\n const handleMouseOutIcon = (d) => {\n setTooltipContent('')\n d3.select(`#icon-${d.id}`).style('stroke-opacity', 0.5)\n }\n\n const handleClickIcon = (d) => {\n if (dragged) d.children = null\n d3.event.stopPropagation()\n setCurrentNode(d)\n dquery['resolveIndices'][d.type || 'tasks'] = null\n currentNode = d\n if (!d.nodes || !d.nodes.length) {\n return\n }\n if (d.id === source.id) {\n if (!previousNode || previousNode === 'root') return\n setCurrentNode(previousNode)\n currentNode = previousNode\n update(previousNode)\n zoom(previousNode)\n previousNode = previousNode.parent\n return\n }\n d.parent = source\n previousNode = d.parent\n resolveSection(d, query).then(d => {\n if (!d) return\n getNodes(d, query).then(nodes => {\n d.nodes = nodes\n getLinks(d, query).then(links => {\n d.links = links\n update(d)\n zoom(d)\n }).catch(asyncError)\n }).catch(asyncError)\n .catch(asyncError)\n })\n }\n\n node = gNode.selectAll('g')\n .attr('visibility', 'hidden')\n .attr('pointer-events', 'none')\n .exit().remove()\n .data(nodes, d => d.id)\n .attr('cursor', d => d.nodes ? null : 'pointer')\n .join('g')\n .call(dragBehaviors)\n\n node\n .filter(d => d.type === 'tasks' || d.id === source.id)\n .append('rect')\n .attr('class', 'icon')\n .attr('id', d => `icon-${d.id}`)\n .attr('stroke', color.outline)\n .attr('fill', d => nodeColor(d))\n .attr('fill-opacity', d => {\n if (d.type === 'link') return 0\n if (!d.nodes || !d.nodes.filter(node => node.type === 'tasks').length) return 1\n if (d.id === source.id) return 0.2\n return 1\n })\n .on('mouseover', handleMouseOverIcon)\n .on('mouseout', handleMouseOutIcon)\n .on('click', handleClickIcon)\n\n node\n .filter(d => d.type === 'inputs' || d.type === 'outputs' || d.type === 'inputs-outputs')\n .append('circle')\n .attr('class', 'icon')\n .attr('id', d => `icon-${d.id}`)\n .attr('stroke', color.outline)\n .attr('fill', d => nodeColor(d))\n .on('mouseover', handleMouseOverIcon)\n .on('mouseout', handleMouseOutIcon)\n .on('click', handleClickIcon)\n\n node.append('text')\n .attr('class', 'text')\n .attr('fill', color.text)\n .attr('font-weight', d => d.id === source.id ? 'bold' : 'none')\n .attr('id', d => `text-${d.id}`)\n .text(d => trimName(d.name))\n .style('font-size', d => d.id === nodes[0].id ? 18 : 14)\n .on('click', d => {\n d3.event.stopPropagation()\n if (!d.entryId || !d.parent) return\n let path = `entry/id/${d.entryId}`\n const sectionPath = d.path ? d.path.replace(/\\/(?=\\d)/g, ':') : null\n path = isWorkflow(d) ? path : sectionPath ? `${path}/data${sectionPath}` : path\n const url = getUrl(path)\n history.push(url)\n })\n .on('mouseover', d => {\n if (!d.type || !d.parent) return\n if (!d.sectionType) return\n d3.select(`#text-${d.id}`).style('font-weight', 'bold')\n .text(d.name)\n const text = isWorkflow(d) ? 'overview page' : 'archive section'\n if (d.entryId) {\n setTooltipContent(

Click to go to {text} for entry
{d.entryId}

)\n }\n })\n .on('mouseout', d => {\n setTooltipContent('')\n d3.select(`#text-${d.id}`).style('font-weight', null)\n .text(d => trimName(d.name))\n })\n\n const link = gLink.selectAll('path')\n .attr('visibility', 'hidden')\n .attr('pointer-events', 'none')\n .exit().remove()\n .data(links)\n\n line = link.enter()\n .append('path')\n .attr('pointer-events', 'all')\n .attr('id', d => `link-${d.id}`)\n .attr('marker-end', d => `url(#${d.id})`)\n .attr('visibility', 'visible')\n .on('click', d => {\n d3.event.stopPropagation()\n const parent = d.source.parent || d.target.parent\n if (!parent) return\n // use the parent node to containt source and target nodes\n const linkNode = parent\n const sourceNode = d.source\n const targetNode = d.target\n if (sourceNode.type !== 'tasks' || targetNode.type !== 'tasks') return\n\n const store = (node, recursive) => {\n if (typeof node !== 'object') return\n node._name = node.name\n node._type = node.type\n node.children = null\n if (node.links) {\n node._links = [...node.links]\n node.links = null\n }\n if (node.nodes) {\n node._nodes = [...node.nodes]\n if (recursive) {\n node.nodes.forEach(n => {\n store(n)\n })\n }\n }\n }\n\n const restore = (node) => {\n if (typeof node !== 'object' || !node._nodes) return\n node.nodes = node._nodes\n node.links = node._links\n node.children = null\n node.name = node._name || node.name\n node.type = node._type || node.type\n }\n\n // store the original nodes info\n store(linkNode)\n store(sourceNode)\n store(targetNode)\n\n // include into sourceNode the tagetNode inputs\n const inputs = [...targetNode.nodes.filter(node => node.type === 'inputs')]\n let url = {}\n sourceNode.nodes.forEach(node => {\n url[node.url] = node.name\n })\n inputs.forEach(input => {\n if (Object.keys(url).includes(input.url)) {\n sourceNode.nodes.push(input)\n input._name = input.name\n const sourceName = url[input.url]\n if (sourceName !== input.name) input.name = `${input.name}/${url[input.url]}`\n input._type = input.type\n input.type = 'inputs-outputs'\n }\n })\n\n linkNode.type = 'link'\n // parent nodes should contain the source, target\n linkNode.nodes = [sourceNode, targetNode]\n // and the targetNode inputs\n linkNode.nodes.push(...inputs)\n\n // and the sourceNode outputs\n url = inputs.map(node => node.url)\n const outputs = sourceNode.nodes.filter(node => node.type === 'outputs' && !url.includes(node.url))\n linkNode.nodes.push(...outputs)\n\n // and the tagetNode outputs\n linkNode.nodes.push(...targetNode.nodes.filter(node => node.type === 'outputs'))\n\n // generate links for this configuration\n getLinks(linkNode, query).then(links => {\n for (const [index, link] of links.entries()) {\n if (link.target.url === sourceNode.url) {\n // flip source and target since node is output of sourceNode\n links[index] = {source: link.target, target: link.source, id: link.id, label: 'Output'}\n } else if (link.target.url === linkNode.url || link.source.url === linkNode.url) {\n // remove link to and from rootNode\n links[index] = null\n } else if (link.source.url === sourceNode.url && link.target.url === targetNode.url) {\n // remove link from sourceNode to targetNode, unnecessary\n links[index] = null\n }\n }\n linkNode.links = links.filter(link => link)\n linkNode.name = null\n // linkNode.type = 'link'\n update(linkNode)\n zoom(linkNode)\n previousNode = linkNode\n // reset original nodes info\n inputs.forEach(input => {\n input.type = 'inputs'\n input.name = input._name || input.name\n input.children = null\n })\n linkNode.type = linkNode._type\n restore(linkNode)\n restore(sourceNode)\n restore(targetNode)\n setNodesPosition(linkNode)\n })\n })\n .on('mouseover', d => {\n d3.select(`#link-${d.id}`).style('stroke-opacity', 1.0)\n svg.select(`.marker-${d.id}`).attr('fill-opacity', 1.0)\n d3.select(`#icon-${d.source.id}`).style('stroke', color.link).style('stroke-opacity', 1.0)\n d3.select(`#icon-${d.target.id}`).style('stroke', color.link).style('stroke-opacity', 1.0)\n setTooltipContent(

{d.label}

)\n })\n .on('mouseout', d => {\n d3.select(`#link-${d.id}`).style('stroke-opacity', 0.5)\n svg.select(`.marker-${d.id}`).attr('fill-opacity', 0.5)\n d3.select(`#icon-${d.source.id}`).style('stroke', color.outline).style('stroke-opacity', 0.5)\n d3.select(`#icon-${d.target.id}`).style('stroke', color.outline).style('stroke-opacity', 0.5)\n setTooltipContent('')\n })\n }\n\n resolveSection(source, query).then(source => {\n if (!source) return\n getNodes(source, query).then(nodes => {\n source.nodes = nodes\n source.x = 0\n source.y = 0\n source.r = width / 2\n getLinks(source, query).then(links => {\n source.links = links\n focus = source\n root = source\n setCurrentNode(source)\n currentNode = source\n update(source)\n zoomTo([source.x, source.y, source.r * 2])\n }).catch(asyncError)\n }).catch(asyncError)\n .catch(asyncError)\n })\n }, [\n history,\n setTooltipContent,\n setCurrentNode,\n setShowLegend,\n setEnableForce,\n query,\n source,\n svgRef,\n finalLayout,\n asyncError\n ])\n\n return \n})\n\nGraph.propTypes = {\n source: PropTypes.object.isRequired,\n query: PropTypes.object.isRequired,\n layout: PropTypes.object,\n setTooltipContent: PropTypes.any,\n setCurrentNode: PropTypes.any,\n setShowLegend: PropTypes.any,\n setEnableForce: PropTypes.any\n}\n\nconst WorkflowCard = React.memo(({archive}) => {\n const {api} = useApi()\n const [tooltipContent, setTooltipContent] = useState('')\n const [tooltipPosition, setTooltipPosition] = useState({x: undefined, y: undefined})\n const [showLegend, setShowLegend] = useState(true)\n const [enableForce, setEnableForce] = useState(false)\n const [currentNode, setCurrentNode] = useState({type: 'tasks'})\n const [inputValue, setInputValue] = useState('')\n const query = useMemo(() => ({\n api: api,\n required: { 'workflow2': '*', 'metadata': '*', 'data': '*' },\n sectionKeys: ['inputs', 'tasks', 'outputs'],\n maxNodes: 6\n }), [api])\n\n const graph = useMemo(() => {\n if (!archive || !archive.workflow2) return ''\n\n const source = {\n path: '/workflow2',\n archive: archive\n }\n\n return \n }, [archive, query])\n\n let nodeType = 'tasks'\n let nodesCount = 0\n if (currentNode) {\n nodeType = currentNode.type || 'tasks'\n let sourceNode = currentNode\n if (['inputs', 'outputs'].includes(nodeType)) sourceNode = currentNode.parent || currentNode\n const nodes = sourceNode.nodes ? sourceNode.nodes.filter(node => node.type === nodeType) : []\n if (nodes.length) nodesCount = nodes[0].total\n }\n\n let label = `No ${nodeType.slice(0, -1)} to show`\n if (nodesCount) label = `Filter ${nodeType} (N=${nodesCount})`\n\n const actions =
\n \n setInputValue(event.target.value)}\n InputProps={{\n endAdornment: (\n setInputValue('')} size='medium'>\n \n \n )\n }}\n >\n \n \n \n {enableForce ? : }\n \n \n \n \n {showLegend ? : \n \n \n \n \n \n \n \n \n \n \n \n
\n\n return graph && \n \n setTooltipPosition({x: event.pageX, y: event.pageY})}\n PopperProps={\n {anchorEl: {\n clientHeight: 0,\n clientWidth: 0,\n getBoundingClientRect: () => ({\n top: tooltipPosition.y,\n left: tooltipPosition.x,\n right: tooltipPosition.x,\n bottom: tooltipPosition.y,\n width: 0,\n height: 0\n })\n }}\n }\n >\n
\n {graph}\n
\n
\n
\n
\n})\n\nWorkflowCard.propTypes = {\n index: PropTypes.object,\n properties: PropTypes.object,\n archive: PropTypes.object\n}\n\nexport default WorkflowCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport {PropertyCard} from './PropertyCard'\nimport { useEntryStore } from '../EntryContext'\nimport { Box, IconButton, Typography, Link } from '@material-ui/core'\nimport MoreIcon from '@material-ui/icons/MoreVert'\nimport { ArchiveButton } from '../../nav/Routes'\n\nconst DefinitionsCard = React.memo(function DefinitionsCard({index, archive}) {\n const {entryId, uploadId} = useEntryStore()\n\n if (!index?.quantities?.includes('definitions')) {\n return null\n }\n\n const actions = (\n \n \n \n )\n const name = archive ? archive.definitions?.name || '' : '...'\n const sections = archive ? archive.definitions?.section_definitions?.length : '...'\n return \n \n \n \n This entry contains a schema package {name} with {sections} section definitions.\n \n \n {archive?.definitions?.section_definitions?.map(sectionDef => {\n const path = 'definitions/' + sectionDef.name\n return \n \n {sectionDef.more?.label || sectionDef.name}\n \n \n })}\n\n \n \n})\nDefinitionsCard.propTypes = {\n index: PropTypes.object,\n archive: PropTypes.object\n}\n\nexport default DefinitionsCard\n","/* eslint-disable quotes */\n/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { memo, useEffect, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport { Box, Collapse, List, ListItem, ListItemText, Tooltip } from '@material-ui/core'\nimport { useApi } from '../../api'\nimport { useErrors } from '../../errors'\nimport Quantity from '../../Quantity'\nimport { Datatable, DatatableTable } from '../../datatable/Datatable'\nimport EntryDetails, { EntryRowActions } from '../EntryDetails'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport ExpandLessIcon from '@material-ui/icons/ExpandLess'\nimport { Alert } from '@material-ui/lab'\n\nconst columns = [\n {\n key: 'entry_name',\n label: 'Name',\n align: 'left',\n sortable: false,\n render: entry => \n },\n {key: 'entry_type', align: 'left', sortable: false, label: 'Type'},\n {\n key: 'mainfile',\n align: 'left',\n render: entry => \n },\n {\n key: 'upload_id',\n render: upload => \n }\n]\n\nconst defaultColumns = [\n 'entry_name',\n 'entry_type',\n 'mainfile'\n]\n\nconst baseQuery = {\n 'required': {\n 'metadata': '*'\n },\n 'owner': 'visible',\n 'pagination': {\n 'order_by': 'upload_create_time', 'order': 'desc', 'page_size': 20\n }\n}\n\nexport const ReferenceTable = memo(({refPool, defaultColumns, noAction}) => {\n return ({...entry.entry_metadata, ...entry}))}\n >\n \n \n \n})\nReferenceTable.propTypes = {\n refPool: PropTypes.arrayOf(\n PropTypes.shape({\n entry_metadata: PropTypes.object\n })\n ),\n defaultColumns: PropTypes.arrayOf(PropTypes.string),\n noAction: PropTypes.bool\n}\n\nconst ReferenceUsingCard = memo(({index}) => {\n const [referencingPool, setReferencingPool] = useState(null)\n const [referencedPool, setReferencedPool] = useState(null)\n const [openReferencing, setOpenReferencing] = useState(true)\n const [openReferenced, setOpenReferenced] = useState(false)\n\n const {api} = useApi()\n const {raiseError} = useErrors()\n\n // the referencing list from the archive itself\n useEffect(() => {\n if (!index?.entry_references) {\n setReferencingPool(null)\n return\n }\n\n const targetEntryIds = new Set()\n for (const entry of index.entry_references) targetEntryIds.add(entry.target_entry_id)\n\n const referencing_query = {\n ...baseQuery,\n query: {\n 'entry_id:any': [...targetEntryIds]\n }\n }\n api.query('entries', referencing_query, {noLoading: true})\n .then((data) => {\n setReferencingPool(data.data)\n })\n .catch(raiseError)\n }, [api, index, raiseError])\n\n const referencingList = referencingPool?.length > 0\n ? \n : Not referencing other entries.\n\n // load the referenced list of references from search\n useEffect(() => {\n const referenced_query = {\n ...baseQuery,\n ...{query: {'entry_references.target_entry_id': index.entry_id}}\n }\n api.query('entries', referenced_query, {noLoading: true}).then((data) => {\n setReferencedPool(data.data)\n }).catch(raiseError)\n }, [api, index, raiseError])\n\n // the referenced by list via search\n const referencedList = referencedPool?.length > 0\n ? \n : Not referenced by other entries.\n\n return (\n \n setOpenReferencing(!openReferencing)}>\n \n \n \n {openReferencing ? : }\n \n \n \n {referencingList}\n \n \n setOpenReferenced(!openReferenced)}>\n = 20 ? 'Only showing the latest 20 entries. ' : '') + 'Click to expand/collapse'}>\n \n \n {openReferenced ? : }\n \n {referencedList}\n \n )\n})\nReferenceUsingCard.propTypes = {\n index: PropTypes.shape({\n entry_id: PropTypes.string.isRequired,\n entry_references: PropTypes.arrayOf(PropTypes.shape({\n target_entry_id: PropTypes.string.isRequired,\n target_path: PropTypes.string.isRequired\n }))\n }).isRequired\n}\n\nexport default ReferenceUsingCard\n","/* eslint-disable quotes */\n/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\")\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { memo, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { PropertyCard } from './PropertyCard'\nimport { SearchContext, useSearchContext } from \"../../search/SearchContext\"\nimport { SearchResults } from \"../../search/SearchResults\"\nimport { cloneDeep } from \"lodash\"\nimport { ui } from \"../../../config\"\n\nconst context = cloneDeep(ui?.apps?.options?.entries)\nconst columns = [\n {quantity: 'entry_name', title: 'Name', align: 'left', selected: true},\n {quantity: 'entry_type', title: 'Entry type', align: 'left', selected: true},\n {quantity: 'entry_create_time', title: 'Entry creation time', align: 'left', selected: true},\n {quantity: 'upload_name', title: 'Upload name', align: 'left'},\n {quantity: 'upload_id', title: 'Upload id', align: 'left'},\n {quantity: 'upload_create_time', title: 'Upload time', align: 'left'},\n {quantity: 'authors', title: 'Authors', align: 'left', sortable: false},\n {quantity: 'results.eln.lab_ids', title: 'IDs'}\n]\n\ncontext.colums = columns\ncontext.rows.details = { enabled: false }\ncontext.rows.actions = { enabled: true }\n\nconst HistoryCard = memo(() => {\n const { useResults } = useSearchContext()\n const { data } = useResults()\n\n if (!data || data.length === 0) {\n return null\n }\n\n return (\n \n \n \n )\n})\n\nconst SampleHistoryUsingCard = memo(({ index }) => {\n const filtersLocked = useMemo(() => ({\n 'entry_references.target_entry_id': [index.entry_id],\n 'section_defs.definition_qualified_name': ['nomad.datamodel.metainfo.basesections.Activity']\n }), [index.entry_id])\n\n if (!index.section_defs?.some(def => def?.definition_qualified_name === 'nomad.datamodel.metainfo.basesections.Entity')) {\n return null\n }\n\n return (\n \n \n \n )\n})\n\nSampleHistoryUsingCard.propTypes = {\n index: PropTypes.shape({\n entry_id: PropTypes.string.isRequired,\n section_defs: PropTypes.arrayOf(PropTypes.shape({\n definition_qualified_name: PropTypes.string.isRequired\n })).isRequired,\n entry_references: PropTypes.arrayOf(PropTypes.shape({\n target_entry_id: PropTypes.string.isRequired,\n target_path: PropTypes.string.isRequired\n }))\n }).isRequired\n}\n\nexport default SampleHistoryUsingCard\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useMemo} from 'react'\nimport PropTypes from 'prop-types'\nimport {DialogContentText} from '@material-ui/core'\nimport {Datatable} from '../datatable/Datatable'\nimport Quantity from '../Quantity'\n\nconst columns = [\n {key: 'mainfile', align: 'left', label: 'Mainfile'},\n {key: 'upload_id', align: 'left', label: 'Upload Id', render: data => }\n]\n\nexport const DeletingReferencesTable = React.memo(({entryReferences, brokenEntries, message}) => {\n const normalizedEntryReferences = useMemo(() => {\n return entryReferences.map(reference => ({...reference, mainfile: reference.target_mainfile, upload_id: reference.target_upload_id}))\n }, [entryReferences])\n\n return (\n brokenEntries.length > 0 ? \n \n {message || 'Warning: There are some entries which are referenced somewhere else.'}\n \n \n References Being Deleted\n \n \n \n Broken Entries\n \n \n : null)\n})\nDeletingReferencesTable.propTypes = {\n entryReferences: PropTypes.arrayOf(PropTypes.object).isRequired,\n brokenEntries: PropTypes.arrayOf(PropTypes.object).isRequired,\n message: PropTypes.string\n}\n\nexport default DeletingReferencesTable\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useCallback, useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport {\n Tooltip, IconButton, Dialog, DialogContent, DialogContentText, DialogActions, Button,\n Checkbox, FormControlLabel\n} from '@material-ui/core'\nimport DeleteIcon from '@material-ui/icons/Delete'\nimport { useUploadPageContext } from './UploadPageContext'\nimport {useApi} from '../api'\nimport {useErrors} from '../errors'\nimport {pluralize} from '../../utils'\nimport {useEntryStore} from '../entry/EntryContext'\nimport {useHistory} from 'react-router-dom'\nimport DeletingReferencesTable from './DeletingReferencesTable'\n\nexport const DeleteEntriesButton = React.memo(({tooltip, disabled, buttonProps, dark, selectedEntries, selectedCount, setSelected}) => {\n const history = useHistory()\n const uploadContext = useUploadPageContext()\n const entryContext = useEntryStore()\n const {api} = useApi()\n const {raiseError} = useErrors()\n const [openDeleteConfirmDialog, setOpenDeleteConfirmDialog] = useState(false)\n const [deleteFolders, setDeleteFolders] = useState(false)\n const {uploadId} = uploadContext || entryContext\n const {updateUpload} = uploadContext || {}\n const {entryId, editable} = entryContext || {}\n const count = entryId ? 1 : selectedCount\n const [entryReferences, setEntryReferences] = useState([])\n const [brokenEntries, setBrokenEntries] = useState([])\n\n const handleClick = useCallback(() => {\n setOpenDeleteConfirmDialog(true)\n }, [setOpenDeleteConfirmDialog])\n\n useEffect(() => {\n if (!openDeleteConfirmDialog) {\n return\n }\n const requestBody = selectedEntries?.entry_id\n ? {owner: 'visible', query: {entry_references: {'target_entry_id:any': selectedEntries?.entry_id || []}}}\n : {owner: 'visible', query: {entry_references: {'target_upload_id:any': selectedEntries?.upload_id ? [selectedEntries?.upload_id] : []}}}\n api.post(`entries/query`, requestBody)\n .then(results => {\n const data = results?.data || []\n if (data.length > 0) {\n const brokenEntries = selectedEntries?.entry_id\n ? data.filter(entry => !selectedEntries?.entry_id.includes(entry.entry_id))\n : data.filter(entry => entry.upload_id !== selectedEntries?.upload_id)\n setBrokenEntries(brokenEntries)\n const allReferences = data.map(entry => entry.entry_references).flat()\n const references = [...new Map(allReferences.map(entry => [entry.target_entry_id, entry])).values()]\n setEntryReferences(references)\n }\n })\n .catch(err =>\n raiseError(err)\n )\n }, [api, openDeleteConfirmDialog, raiseError, selectedEntries])\n\n const handleDelete = useCallback(() => {\n setOpenDeleteConfirmDialog(false)\n const requestBody = {query: selectedEntries || {entry_id: entryId}, include_parent_folders: deleteFolders}\n api.post(`uploads/${uploadId}/action/delete-entry-files`, requestBody)\n .then(results => {\n updateUpload && updateUpload({upload: results.data})\n setSelected && setSelected(new Set())\n entryId && history.push(`/user/uploads/upload/id/${uploadId}`)\n })\n .catch(err =>\n raiseError(err)\n )\n }, [setOpenDeleteConfirmDialog, api, raiseError, uploadId, selectedEntries, setSelected, updateUpload, entryId, history, deleteFolders])\n\n return (\n uploadContext || (entryContext && editable) ? \n \n \n \n \n \n \n \n \n {`Please confirm deleting the ${pluralize('entry', count, false)}.`}\n \n \n You have selected {pluralize('entry', count, true)}. Are you sure you want to delete the selected {pluralize('entry', count, false)}?\n \n setDeleteFolders(event.target.checked)}\n color='primary'\n checked={deleteFolders}\n name='Delete folders'\n />}\n label={`Delete also the ${pluralize(\"entry's\", count, false)} folders. There might be more entries in them.`}\n />\n \n \n \n \n \n \n \n : null)\n})\nDeleteEntriesButton.propTypes = {\n selectedEntries: PropTypes.object,\n selectedCount: PropTypes.number,\n setSelected: PropTypes.func,\n tooltip: PropTypes.string,\n disabled: PropTypes.bool,\n buttonProps: PropTypes.object,\n dark: PropTypes.bool\n}\n\nexport default DeleteEntriesButton\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { isEmpty } from 'lodash'\nimport { Typography, makeStyles, Box, Grid, Divider } from '@material-ui/core'\nimport { Alert } from '@material-ui/lab'\nimport { resolveNomadUrlNoThrow } from '../../utils'\nimport Quantity from '../Quantity'\nimport ElectronicPropertiesCard from '../entry/properties/ElectronicPropertiesCard'\nimport SolarCellPropertiesCard from '../entry/properties/SolarCellPropertiesCard'\nimport MaterialCard from '../entry/properties/MaterialCard'\nimport MaterialCardTopology from '../entry/properties/MaterialCardTopology'\nimport MaterialCardFormula from './properties/MaterialCardFormula'\nimport NexusCard from './properties/NexusCard'\nimport VibrationalPropertiesCard from '../entry/properties/VibrationalPropertiesCard'\nimport MechanicalPropertiesCard from '../entry/properties/MechanicalPropertiesCard'\nimport ThermodynamicPropertiesCard from '../entry/properties/ThermodynamicPropertiesCard'\nimport DynamicalPropertiesCard from '../entry/properties/DynamicalPropertiesCard'\nimport StructuralPropertiesCard from '../entry/properties/StructuralPropertiesCard'\nimport GeometryOptimizationCard from '../entry/properties/GeometryOptimizationCard'\nimport SpectroscopicPropertiesCard from './properties/SpectroscopicPropertiesCard'\nimport RelatedResourcesCard from '../entry/properties/RelatedResourcesCard'\nimport WorkflowCard from './properties/WorkflowCard'\nimport { MethodMetadata } from './EntryDetails'\nimport Page from '../Page'\nimport { SourceApiCall, SourceApiDialogButton, SourceDialogDivider } from '../buttons/SourceDialogButton'\nimport SectionCard from './properties/SectionCard'\nimport { useMetainfoDef, traverse } from '../archive/metainfo'\nimport {\n ArchiveSaveButton, ArchiveReloadButton, ArchiveReUploadButton\n} from '../archive/ArchiveBrowser'\nimport { useErrors } from '../errors'\nimport DefinitionsCard from './properties/DefinitionsCard'\nimport { ErrorHandler } from '../ErrorHandler'\nimport ReferenceUsingCard from \"./properties/ReferenceCard\"\nimport SampleHistoryUsingCard from \"./properties/SampleHistoryCard\"\nimport { useEntryStore, useEntryContext, useIndex } from './EntryContext'\nimport DeleteEntriesButton from '../uploads/DeleteEntriesButton'\n\nfunction MetadataSection({title, children}) {\n return \n {title && \n \n {title}\n \n }\n {children}\n \n}\n\nMetadataSection.propTypes = {\n title: PropTypes.string,\n children: PropTypes.any\n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n marginBottom: theme.spacing(4)\n },\n leftColumn: {\n maxWidth: '32%',\n flexBasis: '32%',\n flexGrow: 0,\n paddingRight: theme.spacing(3)\n },\n rightColumn: {\n maxWidth: '67.99%',\n flexBasis: '67.99%',\n flexGrow: 0,\n '& > div': {\n marginBottom: theme.spacing(2)\n }\n },\n editActions: {\n marginBottom: `${theme.spacing(1)}px !important`\n },\n divider: {\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1)\n }\n}))\n\n// Optimization: for the overview page, we only need to fetch some of the archive data\nconst required = {\n metadata: '*',\n data: '*',\n definitions: '*',\n workflow2: '*',\n results: {\n material: '*',\n method: '*',\n properties: {\n structural: '*',\n structures: '*',\n dynamical: '*',\n electronic: {\n greens_functions_electronic: 'include-resolved',\n dos_electronic: 'include-resolved',\n // We explicitly ask for everything except the projected DOS: retrieving\n // the projected DOS can get very expensive and ATM we don't visualize\n // them.\n dos_electronic_new: {\n data: {\n energies: 'include-resolved',\n total: 'include-resolved',\n energy_fermi: '*',\n energy_ref: '*',\n spin_channel: '*',\n band_gap: 'include-resolved'\n }\n },\n band_structure_electronic: 'include-resolved',\n band_gap: '*'\n },\n mechanical: 'include-resolved',\n spectroscopic: 'include-resolved',\n vibrational: 'include-resolved',\n thermodynamic: 'include-resolved',\n geometry_optimization: {\n energies: 'include-resolved'\n }\n }\n }\n}\n\nconst OverviewView = React.memo(() => {\n const { cards } = useEntryContext()\n const { data: index, response: indexApiData } = useIndex()\n const { url, exists, editable, archive: archiveTmp, archiveApiData } = useEntryStore(required)\n const [sections, setSections] = useState([])\n\n // The archive is accepted only once it is synced with the index. Notice that\n // we need to get the entry_id from data.entry_id, as some older entries will\n // not have entry_id stored under data.archive.metadata.entry_id\n const archive = index?.entry_id === archiveApiData?.response?.data?.entry_id\n ? archiveTmp\n : undefined\n\n const classes = useStyles()\n const {raiseError} = useErrors()\n const m_def = archive?.data?.m_def_id ? `${archive.data.m_def}@${archive.data.m_def_id}` : archive?.data?.m_def\n const dataMetainfoDefUrl = url && resolveNomadUrlNoThrow(m_def, url)\n const dataMetainfoDef = useMetainfoDef(dataMetainfoDefUrl)\n\n const properties = useMemo(() => {\n return new Set(index?.results?.properties?.available_properties || [])\n }, [index])\n\n useEffect(() => {\n if (!dataMetainfoDef || !archive?.data) {\n return\n }\n const getSections = async () => {\n const sections = []\n traverse(archive.data, dataMetainfoDef, 'data', (section, sectionDef, path) => {\n if (path === 'data' || sectionDef.m_annotations?.eln?.[0]?.overview) {\n sections.push({\n archivePath: path,\n sectionDef: sectionDef,\n section: section\n })\n }\n })\n return sections\n }\n getSections().then((sections) => {\n setSections(sections)\n }).catch(raiseError)\n }, [archive, dataMetainfoDef, setSections, raiseError])\n\n // Determine the cards to show\n const cardComps = useMemo(() => {\n if (!exists || !index) return []\n const cardMap = {\n definitions: DefinitionsCard,\n nexus: NexusCard,\n material: index?.results?.material?.topology\n ? MaterialCardTopology\n : index?.results?.properties?.structures\n ? MaterialCard\n : MaterialCardFormula,\n electronic: ElectronicPropertiesCard,\n solarcell: SolarCellPropertiesCard,\n vibrational: VibrationalPropertiesCard,\n mechanical: MechanicalPropertiesCard,\n thermodynamic: ThermodynamicPropertiesCard,\n structural: StructuralPropertiesCard,\n dynamical: DynamicalPropertiesCard,\n geometry_optimization: GeometryOptimizationCard,\n spectroscopic: SpectroscopicPropertiesCard,\n workflow: WorkflowCard,\n references: ReferenceUsingCard,\n history: SampleHistoryUsingCard,\n relatedResources: RelatedResourcesCard\n }\n\n if (isEmpty(cards?.options)) {\n return \n No overview cards defined in the entry context. Ensure that all GUI artifacts are created.\n \n }\n\n return Object.values(cards.options).map((option) => {\n let comp = null\n const msg = option.error || \"Could not render card.\"\n const key = option.key\n if (key === 'sections') {\n comp = \n {sections\n .map((section, index) => (\n \n \n \n ))}\n \n } else {\n const Comp = cardMap[key]\n if (Comp) {\n comp = \n \n \n }\n }\n return comp\n })\n }, [exists, index, cards, sections, editable, archive, properties])\n\n if (!exists) {\n return \n \n This entry does not exist.\n \n \n }\n\n if (!index) return null\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {indexApiData && }\n \n {archiveApiData && }\n \n \n\n \n {editable && (\n \n \n \n \n \n \n )}\n {cardComps}\n \n \n \n})\n\nOverviewView.whyDidYouRender = true\n\nexport default OverviewView\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport { Card, CardContent, Typography, makeStyles } from '@material-ui/core'\nimport ArchiveBrowser from '../archive/ArchiveBrowser'\nimport Page from '../Page'\nimport { useEntryStore } from './EntryContext'\nimport { ApiDataContext } from '../buttons/SourceDialogButton'\n\nexport const help = `\nThe NOMAD **archive** provides data and meta-data in a common hierarchical format based on\nwell-defined quantity definitions that we call *metainfo*. This representation\nis independent from the raw data format and provides a homogenous data stock.\n\nYou can click the various quantity values to see the quantity definition. Similarly,\nyou can click section names to get more information. Browse the *metainfo* to\nlearn more about NOMAD's archive format [here](/metainfo).\n`\n\nconst useStyles = makeStyles(theme => ({\n archiveBrowser: {\n marginTop: theme.spacing(2)\n },\n error: {\n marginTop: theme.spacing(2)\n },\n downloadFab: {\n zIndex: 1,\n right: 32,\n bottom: 32,\n position: 'fixed !important'\n }\n}))\n\nexport default function ArchiveEntryView(props) {\n const classes = useStyles()\n const {url, archive, archiveApiData, exists} = useEntryStore('*')\n\n if (!exists) {\n return (\n \n \n No archive exists for this entry. Either the archive was not generated due\n to parsing or other processing errors (check the log tab), or the entry it\n self does not exist.\n \n \n )\n }\n\n return (\n \n {\n archive && typeof archive !== 'string'\n ?
\n \n \n \n
:
{\n archive\n ?
\n Processed data is not valid JSON. Displaying plain text instead.\n \n \n
{archive || ''}
\n
\n
\n
\n : loading ...\n }
\n }\n
\n )\n}\nArchiveEntryView.propTypes = {}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Typography, Accordion, AccordionSummary, AccordionDetails, makeStyles, FormGroup, Button, Grid, FormControl, InputLabel, Input, Select, MenuItem, Chip } from '@material-ui/core'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport ReactJson from 'react-json-view'\nimport { amber } from '@material-ui/core/colors'\nimport Page from '../Page'\nimport { useErrors } from '../errors'\nimport { useApi } from '../api'\nimport { useEntryStore } from './EntryContext'\nimport Checkbox from '@material-ui/core/Checkbox'\nimport FormControlLabel from '@material-ui/core/FormControlLabel'\nimport { pluralize } from '../../utils'\n\nconst useLogEntryStyles = makeStyles(theme => ({\n warning: {\n color: amber[700]\n },\n exception: {\n overflowX: 'scroll',\n margin: 0\n }\n}))\n\nconst LogEntry = React.memo(function LogEntry(props) {\n const classes = useLogEntryStyles()\n const {data, keyNames} = props\n\n const summaryProps = {}\n if (data.level === 'ERROR' || data.level === 'CRITICAL') {\n summaryProps.color = 'error'\n } else if (data.level === 'WARNING') {\n summaryProps.classes = {root: classes.warning}\n }\n return (\n \n }>\n {data.level}: {(keyNames.map((key) => `${data[key]}`).join(' | '))}\n \n \n \n \n {data.exception && \n
{data.exception}
\n
}\n
\n )\n})\nLogEntry.propTypes = {\n data: PropTypes.object.isRequired,\n keyNames: PropTypes.array.isRequired\n}\n\nconst useStyles = makeStyles(theme => ({\n moreLogs: {\n marginTop: theme.spacing(2)\n },\n downloadFab: {\n zIndex: 1,\n right: 32,\n bottom: 32,\n position: 'fixed !important'\n },\n formControl: {\n margin: theme.spacing(1),\n minWidth: 120,\n maxWidth: 350\n },\n chips: {\n display: 'flex',\n flexWrap: 'wrap'\n },\n chip: {\n margin: 2\n },\n noLabel: {\n marginTop: theme.spacing(3)\n },\n seeMore: {\n margin: theme.spacing(3)\n }\n}))\n\nconst FilterLogsByLevel = React.memo(function FilterLogsByLevel(props) {\n const {logLevels, onCheckListChanged} = props\n return (\n \n \n Filter Logs by Level:\n \n {['ERROR', 'CRITICAL', 'WARNING', 'INFO', 'DEBUG'].map((key, i) => {\n return (\n }\n label={key}\n />\n )\n })}\n \n )\n})\nFilterLogsByLevel.propTypes = {\n logLevels: PropTypes.object.isRequired,\n onCheckListChanged: PropTypes.func.isRequired\n}\n\nconst FilterLogTagsByKeys = React.memo(function FilterLogTagsByKeys(props) {\n const {className, keyNames, onKeyNamesChanged, uniquekeys} = props\n return (\n \n Filter keys by:\n }\n renderValue={(selected) => (\n
\n {selected.map((value) => (\n \n ))}\n
\n )}\n >\n {uniquekeys.map((name) => (\n \n {name}\n \n ))}\n \n
\n )\n})\nFilterLogTagsByKeys.propTypes = {\n className: PropTypes.object.isRequired,\n keyNames: PropTypes.array.isRequired,\n onKeyNamesChanged: PropTypes.func.isRequired,\n uniquekeys: PropTypes.array.isRequired\n}\n\nexport default function ArchiveLogView(props) {\n const classes = useStyles()\n const {entryId, metadata} = useEntryStore()\n const {api} = useApi()\n const {raiseError} = useErrors()\n\n const [data, setData] = useState(null)\n const [doesNotExist, setDoesNotExist] = useState(false)\n\n const [logLevels, setLogLevels] = useState({\n DEBUG: true,\n ERROR: true,\n CRITICAL: true,\n WARNING: true,\n INFO: true\n })\n\n const [numberOfLogs, setNumberOflogs] = useState(10)\n const [keyNames, setkeyNames] = useState(['parser', 'event'])\n\n const handlekeyNamesChanged = (e) => {\n setkeyNames(e.target.value)\n }\n\n const handleCheckListChanged = (e) => {\n setLogLevels({...logLevels, [e.target.name]: e.target.checked})\n }\n\n useEffect(() => {\n api.post(`/entries/${entryId}/archive/query`, {required: {processing_logs: '*'}})\n .then(response => {\n const data = response.data.archive.processing_logs || []\n setData(data)\n })\n .catch(error => {\n if (error.name === 'DoesNotExist') {\n setDoesNotExist(true)\n } else {\n raiseError(error)\n }\n })\n }, [setData, setDoesNotExist, api, raiseError, entryId])\n\n // Calculate extendedData, which is the log entries fetched + a synthetic log entry, created\n // if the metadata object from the entry page context contains anything in processing_errors.\n // The reason for this is that the processing_logs is fetched from the archive file, and\n // does not include errors occuring after the archive file is written, but these can (in most\n // cases) be found in metadata.processing_errors.\n const extendedData = data ? [...data] : []\n if (metadata?.processing_errors?.length) {\n extendedData.push({\n event: 'processing error',\n level: 'ERROR',\n timestamp: metadata.last_processing_time,\n processing_errors: metadata.processing_errors\n })\n }\n\n if (doesNotExist && !extendedData.length) {\n return (\n \n \n No archive log does exist for this entry. Most likely the entry itself does not\n exist.\n \n \n )\n }\n\n let content = 'loading ...'\n if (extendedData.length) {\n const uniquekeys = [...new Set(\n extendedData.reduce((aggregatedKeys, item) => [...aggregatedKeys, ...Object.keys(item)], []))]\n const filteredIndices = extendedData.map((entry, i) => logLevels[entry.level] ? i : null).filter(el => el !== null)\n\n content =\n \n \n \n \n \n \n \n \n \n {filteredIndices.slice(0, numberOfLogs).map(i =>\n )}\n \n \n {filteredIndices.length === 0\n ? No log entries matching selected criteria\n : filteredIndices.length > numberOfLogs\n ? {`Showing ${numberOfLogs} of ${filteredIndices.length} matching entries`}\n : {`${filteredIndices.length} matching log ${pluralize('entry', filteredIndices.length)} found`}}\n \n \n {filteredIndices.length > numberOfLogs &&\n setNumberOflogs(numberOfLogs + 10)}>\n Load More\n }\n \n \n \n }\n\n return (\n \n {content}\n \n )\n}\nArchiveLogView.propTypes = {}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState, useEffect } from 'react'\nimport { Typography, makeStyles } from '@material-ui/core'\nimport { useErrors } from '../errors'\nimport FileBrowser from '../archive/FileBrowser'\nimport { useApi } from '../api'\nimport Page from '../Page'\nimport { useEntryStore } from './EntryContext'\nimport { createUploadUrl } from '../../utils'\nimport { apiBase } from '../../config'\n\nconst useStyles = makeStyles(theme => ({\n error: {\n marginTop: theme.spacing(2)\n }\n}))\nconst BrowseEntryFilesView = React.memo((props) => {\n const {entryId} = useEntryStore()\n const classes = useStyles()\n const {api} = useApi()\n const {raiseError} = useErrors()\n\n const [data, setData] = useState(null)\n const [doesNotExist, setDoesNotExist] = useState(false)\n\n useEffect(() => {\n api.get(`/entries/${entryId}?include=mainfile&include=upload_id&include=writers&include=published`)\n .then(response => {\n setData(response.data)\n })\n .catch(error => {\n if (error.name === 'DoesNotExist') {\n setDoesNotExist(true)\n } else {\n raiseError(error)\n }\n })\n }, [setData, setDoesNotExist, api, raiseError, entryId])\n\n if (doesNotExist) {\n return (\n \n \n This entry does not exist.\n \n \n )\n }\n if (data && data?.upload_id && data?.mainfile) {\n const lastSlash = data.mainfile.lastIndexOf('/')\n const mainfileDirname = lastSlash === -1 ? '' : data.mainfile.substr(0, lastSlash)\n const mainfileBasename = data.mainfile.split('/').pop()\n return \n \n \n } else {\n return loading ...\n }\n})\nBrowseEntryFilesView.propTypes = {}\nexport default BrowseEntryFilesView\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useEffect, useMemo, useRef} from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles, Tab, Tabs } from '@material-ui/core'\nimport { trimEnd } from 'lodash'\nimport OverviewView from './OverviewView'\nimport ArchiveEntryView from './ArchiveEntryView'\nimport ArchiveLogView from './ArchiveLogView'\nimport BrowseEntryFilesView from './BrowseEntryFilesView'\nimport { useRouteMatch, useHistory, matchPath, Redirect } from 'react-router-dom'\nimport { CacheRoute, CacheSwitch } from 'react-router-cache-route'\nimport { EntryContext, useEntryStore } from './EntryContext'\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline'\nimport {useDataStore} from '../DataStore'\n\nconst useStyles = makeStyles(theme => ({\n errorLogs: {\n color: theme.palette.error.main\n },\n errorIcon: {\n verticalAlign: 'middle',\n paddingRight: 10\n }\n}))\n\nfunction EntryTabs({tab, onChange}) {\n const {metadata} = useEntryStore()\n const dataStore = useDataStore()\n const styles = useStyles()\n const entryHasProcessingError = metadata?.processing_errors?.length > 0\n\n useEffect(() => {\n dataStore.breadcrumb.setUpload(metadata?.upload_name || 'Upload')\n dataStore.breadcrumb.setEntry(metadata?.entry_name || metadata?.mainfile || 'Entry')\n }, [dataStore.breadcrumb, metadata?.entry_name, metadata?.mainfile, metadata?.upload_name])\n\n const renderLogsTabLabel = () => {\n if (entryHasProcessingError) {\n return (\n
\n \n Logs\n
\n )\n }\n return 'Logs'\n }\n\n return \n \n \n \n \n \n}\n\nEntryTabs.propTypes = {\n tab: PropTypes.string,\n onChange: PropTypes.func\n}\n\nexport const help = `\nThe *overview* tab gives you an insightful overview about the most prominent\ncontents found in an entry. You can find more details in the *archive* tab.\n\nThe *raw data* tab will show you all files that belong to the entry and offers a download\non individual, or all files. The files can be selected and downloaded. You can also\nview the contents of some files directly here on this page.\n\nThe *archive* tab shows you the parsed data as a tree\ndata structure. This view is connected to NOMAD's [metainfo](/metainfo), which acts a schema for\nall parsed data.\n\nThe *log* tab will show you a log of the entry's processing.\n`\n\nconst EntryPage = React.memo(() => {\n const history = useHistory()\n const currentPath = history.location.pathname\n const {path, url} = useRouteMatch()\n const match = matchPath(currentPath, { path: `${path}/:tab?` })\n const {params: {tab = 'overview'}} = match\n const entryId = match?.params?.entryId\n const defaultUrls = useMemo(() => {\n const urlNoSlash = trimEnd(url, '/')\n return {\n 'overview': `${urlNoSlash}/overview`,\n 'files': `${urlNoSlash}/files/_mainfile`,\n 'data': `${urlNoSlash}/data`,\n 'logs': `${urlNoSlash}/logs`\n }\n }, [url])\n\n // We use a useRef object to keep track of the current urls of each tab. Switching\n // tabs would go to the previous tab url. This way, the views behind a tab can add\n // state to the URL (e.g. path to section on the ArchiveEntryView).\n const urls = useRef(defaultUrls)\n\n const handleChange = (_, value) => {\n urls.current[tab] = currentPath\n history.push(urls.current[value])\n }\n\n // Reset the urls if a new entry is visited\n useMemo(() => {\n if (entryId) {\n urls.current = defaultUrls\n }\n }, [entryId, defaultUrls, urls])\n\n return \n \n \n } />\n } />\n } />\n }/>\n \n \n \n})\n\nexport default EntryPage\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Button } from '@material-ui/core'\nimport React, { useState } from 'react'\nimport { useHistory, useLocation } from 'react-router-dom'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport { getUrl } from '../nav/Routes'\nimport PropTypes from 'prop-types'\n\nexport default function NewUploadButton({...props}) {\n const {api} = useApi()\n const errors = useErrors()\n const history = useHistory()\n const location = useLocation()\n const [clicked, setClicked] = useState(false)\n const handleClick = () => {\n setClicked(true)\n api.post('/uploads')\n .then((upload) => {\n history.push(getUrl(`upload/id/${upload.upload_id}`, location))\n })\n .catch((error) => {\n setClicked(false)\n errors.raiseError(error)\n })\n }\n\n return \n}\nNewUploadButton.propTypes = {\n isDisable: PropTypes.bool\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from '@material-ui/core'\nimport React, { useCallback, useState, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport Markdown from '../Markdown'\nimport { useHistory } from 'react-router-dom'\nimport { ui, exampleUploads } from '../../config'\n\nconst ExampleUploadDialog = React.memo(function ExampleUploadDialog(props) {\n const { onSelect, ...dialogProps } = props\n\n const exampleUploadsConfig = useMemo(() => ui?.exampleUploads || {}, [])\n const filterExamples = useCallback(key => (\n (key => !exampleUploadsConfig.include || exampleUploadsConfig.include.includes(key)) &&\n (key => !exampleUploadsConfig.exclude || !exampleUploadsConfig.exclude.includes(key))\n ), [exampleUploadsConfig])\n\n const renderCategory = useCallback(category => {\n return Object.keys(category)\n .filter(filterExamples)\n .map(key => {\n const exampleUpload = category[key]\n return (\n \n \n {exampleUpload.title}\n {`${exampleUpload.description}`}\n \n onSelect(exampleUpload)}\n >\n add\n \n \n )\n })\n }, [filterExamples, onSelect])\n\n return (\n \n Select a sample Upload\n \n \n {Object.keys(exampleUploads).map(categoryKey => (\n \n {categoryKey}\n {renderCategory(exampleUploads[categoryKey])}\n \n ))}\n \n \n \n \n \n \n )\n})\n\nExampleUploadDialog.propTypes = {\n onClose: PropTypes.func.isRequired,\n onSelect: PropTypes.func.isRequired\n}\n\nexport default function ExampleUploadButton(props) {\n const {api} = useApi()\n const {raiseError} = useErrors()\n const history = useHistory()\n\n const [isOpen, setOpen] = useState(false)\n\n const handleClickOpen = () => {\n setOpen(true)\n }\n\n const handleClose = () => setOpen(false)\n\n const handleSelect = (exampleUpload) => {\n api.post(`/uploads?local_path=${exampleUpload.local_path}&upload_name=${exampleUpload.title}`)\n .then((data) => {\n history.push(`/user/uploads/upload/id/${data.upload_id}`)\n })\n .catch(raiseError)\n .finally(() => {\n setOpen(false)\n })\n }\n\n return (\n
\n \n \n
\n )\n}\nExampleUploadButton.propTypes = {\n isDisable: PropTypes.bool\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useState, useCallback, useEffect, useMemo} from 'react'\nimport PropTypes from 'prop-types'\nimport {\n Tooltip,\n IconButton,\n Dialog,\n DialogContent,\n DialogContentText,\n DialogActions,\n Button\n} from '@material-ui/core'\nimport DeleteIcon from '@material-ui/icons/Delete'\nimport {pluralize} from '../../utils'\nimport {useApi} from '../api'\nimport {useErrors} from '../errors'\nimport DeletingReferencesTable from './DeletingReferencesTable'\n\n/**\n * Button for deleting uploads. Shows a confirmation dialog with additional\n * information about the effects of the deletion.\n */\nconst DeleteUploadsButton = React.memo(({\n tooltip,\n disabled,\n buttonProps,\n dark,\n uploads,\n onConfirm,\n 'data-testid': testID\n}) => {\n const [openDialog, setOpenDialog] = useState(false)\n const {api} = useApi()\n const {raiseError} = useErrors()\n const [entryReferences, setEntryReferences] = useState([])\n const [brokenEntries, setBrokenEntries] = useState([])\n const {uploadIDs, nUploads, shared, uploadText, haveText} = useMemo(() => {\n const nUploads = uploads?.length || 0\n const uploadText = pluralize('upload', nUploads, false)\n const haveText = pluralize('has', nUploads, false)\n return {\n uploadIDs: uploads?.map(upload => upload.upload_id) || [],\n nUploads,\n shared: uploads?.some(entry => entry?.coauthors?.length > 0 || entry?.reviewers?.length > 0),\n uploadText,\n haveText\n }\n }, [uploads])\n\n // Fetch information about whether deleting the uploads will result in broken\n // references.\n useEffect(() => {\n if (!openDialog) return\n\n api.post(`entries/query`,\n {\n owner: 'visible',\n query: {entry_references: {'target_upload_id:any': uploadIDs}}\n }\n )\n .then(results => {\n const data = results?.data || []\n if (data.length > 0) {\n const brokenEntries = data.filter(entry => !uploadIDs.includes(entry.upload_id))\n setBrokenEntries(brokenEntries)\n const allReferences = data.map(entry => entry.entry_references).flat()\n const references = [...new Map(allReferences.map(entry => [entry.target_entry_id, entry])).values()]\n setEntryReferences(references)\n }\n })\n .catch(raiseError)\n }, [api, openDialog, raiseError, uploadIDs])\n\n const handleClick = useCallback(() => {\n setOpenDialog(true)\n }, [])\n\n const handleDelete = useCallback(() => {\n setOpenDialog(false)\n onConfirm && onConfirm()\n }, [onConfirm])\n\n return (\n \n \n \n \n \n \n \n \n \n {`Please confirm deleting the ${uploadText}`}\n \n \n {nUploads > 1 ? `You have selected ${nUploads} ${uploadText}. ` : ''}\n {shared ? `The ${uploadText} you are about to delete ${haveText} been shared with at least one coauthor or reviewer. ` : ''}\n {`Are you sure you want to delete the selected ${uploadText}?`}\n \n \n \n \n \n \n \n \n )\n})\nDeleteUploadsButton.propTypes = {\n uploads: PropTypes.arrayOf(PropTypes.object).isRequired,\n onConfirm: PropTypes.func.isRequired,\n tooltip: PropTypes.string,\n disabled: PropTypes.bool,\n buttonProps: PropTypes.object,\n dark: PropTypes.bool,\n 'data-testid': PropTypes.string\n}\n\nexport default DeleteUploadsButton\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Button, Dialog, DialogActions, DialogContent, DialogTitle, Link } from '@material-ui/core'\n\n/** A link that opens a simple help/explanation dialog */\nconst DialogLink = React.memo(function DialogLink(props) {\n const {title, text, linkProps, children, ...dialogProps} = props\n const [open, setOpen] = useState(false)\n\n const handleClick = useCallback(() => {\n setOpen(true)\n }, [setOpen])\n\n const handleClose = useCallback(() => {\n setOpen(false)\n }, [setOpen])\n\n return (\n \n \n {title}\n \n {children}\n \n \n \n \n \n \n {text}\n \n \n )\n})\nDialogLink.propTypes = {\n /** The dialog title. */\n title: PropTypes.string.isRequired,\n /** The text to render the link. */\n text: PropTypes.string.isRequired,\n /** The dialog contents. */\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]),\n /** Additional optional dialog props. */\n linkProps: PropTypes.object\n /** Other props are forwarded to the dialog compotnent. */\n}\n\nexport default DialogLink\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { IconButton, makeStyles, Tooltip } from '@material-ui/core'\nimport CopyToClipboard from 'react-copy-to-clipboard'\nimport ClipboardIcon from '@material-ui/icons/Assignment'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n '& div': {\n marginRight: theme.spacing(1)\n }\n }\n}))\n\nexport default function WithButton({children, button, icon, tooltip, onClick, clipboard, ...rest}) {\n const classes = useStyles()\n\n if (!icon && clipboard) {\n icon = \n rest.size = rest.size || 'small'\n }\n\n if (!button) {\n button = \n {icon}\n \n }\n\n if (tooltip) {\n button = \n {button}\n \n }\n\n if (clipboard) {\n button = null}\n >\n
e.stopPropagation()}>\n {button}\n
\n \n }\n\n return
\n
{children}
\n {button}\n
\n}\n\nWithButton.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ]),\n button: PropTypes.node,\n icon: PropTypes.node,\n tooltip: PropTypes.string,\n onClick: PropTypes.func,\n clipboard: PropTypes.string\n}\n","import React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport {\n Button, TextField, Dialog, DialogTitle, IconButton, DialogContent,\n DialogContentText, DialogActions, Tooltip, makeStyles, Box, RadioGroup, FormControlLabel, Radio,\n FormControl\n} from '@material-ui/core'\nimport { Autocomplete } from '@material-ui/lab'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport { getUrl } from '../nav/Routes'\nimport { useHistory, useLocation } from 'react-router-dom'\nimport { getUrlFromDefinition, SectionMDef, useGlobalMetainfo } from '../archive/metainfo'\nimport { useUploadPageContext } from './UploadPageContext'\nimport SearchIcon from '@material-ui/icons/Search'\nimport SectionSelectDialog from './SectionSelectDialog'\nimport SectionSelectAutocomplete from './SectionSelectAutocomplete'\n\nconst useStyles = makeStyles(theme => ({\n dialog: {\n width: '100%',\n minWidth: 600\n },\n nameField: {\n marginBottom: theme.spacing(3),\n width: '100%'\n },\n schemaField: {\n marginBottom: theme.spacing(1),\n width: '100%'\n },\n radioGroup: {\n marginTop: 0,\n display: 'flex'\n }\n}))\n\nfunction addSearchIconToEndAdornment(endAdornment, onClick) {\n const children = React.Children.toArray(endAdornment.props.children)\n children.push(\n \n \n \n )\n return React.cloneElement(endAdornment, {}, children)\n}\n\nconst CreateEntry = React.memo((props) => {\n const classes = useStyles()\n const {deploymentUrl, uploadId, isProcessing} = useUploadPageContext()\n const {api} = useApi()\n const {raiseError} = useErrors()\n const globalMetainfo = useGlobalMetainfo()\n const [builtInTemplates, setBuiltInTemplates] = useState([])\n const [builtInTemplate, setBuiltInTemplate] = useState(null)\n const [customTemplate, setCustomTemplate] = useState(null)\n const [name, setName] = useState('')\n const [open, setOpen] = useState(false)\n const history = useHistory()\n const location = useLocation()\n const [openEntryAlreadyExistsDialog, setOpenEntryAlreadyExistsDialog] = useState(false)\n const [openCreateEntryDialog, setOpenCreateEntryDialog] = useState(false)\n const [schemaType, setSchemaType] = useState('built-in')\n const [error, setError] = useState()\n\n useEffect(() => {\n // TODO this whole thing is quite expensive to repeat on each upload page?\n // There needs to be a register/cache based on hashes or something\n if (!globalMetainfo) {\n return\n }\n\n // Do not reload all possible entries while still processing.\n if (isProcessing) {\n return\n }\n\n const getTemplatesFromGlobalDefinitions = (definitions, prefix, archive, getReference) => {\n const templates = definitions.filter(definition => {\n if (definition.m_def !== SectionMDef) {\n return false\n }\n return definition._allBaseSections?.find(baseSection => baseSection.name === 'EntryData')\n }).map(definition => {\n const label = definition.label || definition.name\n const template = definition.m_annotations?.template?.[0] || {}\n const findCategory = definition => (\n definition.categories.find(category => (\n category.categories.find(category => category._qualifiedName === 'nomad.datamodel.data.EntryDataCategory')\n ))\n )\n let category\n for (const baseDefinition of [definition, ...definition._allBaseSections]) {\n category = findCategory(baseDefinition)\n if (category) {\n break\n }\n }\n return {\n id: `${prefix}:${definition._qualifiedName}`,\n categoryLabel: category?.label || category?.name || 'Other',\n categoryName: category?.name || 'Other',\n definition,\n label,\n archive: {\n data: {\n m_def: getReference(definition),\n ...template\n }\n }\n }\n })\n const categoryNames = templates.map(template => template.categoryName)\n const categoryOrder = ['BasicElnCategory', 'ElnExampleCategory', 'ElnIntegrationCategory', 'UseCaseElnCategory', 'WorkflowsElnCategory', 'Other']\n categoryNames.sort((a, b) => categoryOrder.indexOf(a) - categoryOrder.indexOf(b))\n templates.sort((a, b) => a.label.localeCompare(b.label))\n templates.sort((a, b) => categoryNames.indexOf(a.categoryName) - categoryNames.indexOf(b.categoryName))\n return templates\n }\n\n const getTemplates = async () => {\n const globalDefinitions = await globalMetainfo.getDefs()\n const globalTemplates = getTemplatesFromGlobalDefinitions(\n globalDefinitions, '__global__', null, section => section._qualifiedName)\n return globalTemplates.map(template => ({group: 'OASIS', ...template}))\n }\n\n getTemplates().then(templates => {\n setBuiltInTemplates(templates)\n setBuiltInTemplate(templates[0])\n }).catch(raiseError)\n }, [api, raiseError, setBuiltInTemplates, globalMetainfo, isProcessing, deploymentUrl, uploadId])\n\n const handleAdd = useCallback(() => {\n const selectedTemplate = schemaType === 'built-in' ? builtInTemplate : customTemplate\n api.put(`uploads/${uploadId}/raw/?file_name=${name}.archive.json&overwrite_if_exists=false&wait_for_processing=true`, selectedTemplate.archive)\n .then(response => {\n // TODO handle processing errors\n const entryId = response.processing.entry_id\n history.push(getUrl(`entry/id/${entryId}/data/data`, location))\n setOpenCreateEntryDialog(false)\n })\n .catch(error => {\n if (error.apiMessage?.startsWith('The provided path already exists')) {\n setOpenEntryAlreadyExistsDialog(true)\n } else {\n raiseError(error)\n }\n })\n }, [setOpenEntryAlreadyExistsDialog, api, raiseError, schemaType, builtInTemplate, customTemplate, name, uploadId, history, location])\n\n const handleBuiltInChange = useCallback((event, value) => {\n setBuiltInTemplate(value)\n }, [])\n\n const getTemplateFromDefinition = useCallback((dataSection, prefix, archive, getReference) => {\n let label = dataSection.name\n const entry_name = archive?.metadata?.entry_name\n const mainfile = archive?.metadata?.mainfile\n\n if (entry_name) {\n label = `${label} (${entry_name})`\n } else if (mainfile) {\n const file_name = mainfile.substring(mainfile.lastIndexOf('/') + 1)\n label = `${label} (${file_name})`\n } else if (prefix === '__global__') {\n label = `${label} (OASIS)`\n }\n const template = dataSection.m_annotations?.template?.[0] || {}\n return {\n id: `${prefix}:${dataSection._qualifiedName}`,\n label: label,\n entry_id: prefix,\n value: dataSection.name,\n archive: {\n data: {\n m_def: getReference(dataSection),\n ...template\n }\n }\n }\n }, [])\n\n const handleCustomChange = useCallback((value) => {\n const data = value?.data\n if (!data) {\n setCustomTemplate(null)\n return\n }\n const customTemplate = getTemplateFromDefinition(data.sectionDef, data.archive.metadata.entry_id, data.archive,\n section => {\n return getUrlFromDefinition(section, {deploymentUrl, uploadId}, true)\n })\n setCustomTemplate(customTemplate)\n }, [deploymentUrl, getTemplateFromDefinition, uploadId])\n\n const handleSelect = useCallback((value) => {\n const data = value?.data\n if (!data) {\n setCustomTemplate(null)\n return\n }\n const customTemplate = getTemplateFromDefinition(data.sectionDef, data.archive.metadata.entry_id, data.archive,\n section => {\n return getUrlFromDefinition(section, {deploymentUrl, uploadId}, true)\n })\n setCustomTemplate(customTemplate)\n setOpen(false)\n }, [getTemplateFromDefinition, deploymentUrl, uploadId])\n\n const filtersLocked = useMemo(() => ({'section_defs.definition_qualified_name': ['nomad.metainfo.metainfo.Definition']}), [])\n\n const handleChangeTab = (event) => {\n setSchemaType(event.target.value)\n }\n\n const handleError = useCallback((error) => {\n setError(error)\n }, [])\n\n return \n setOpenCreateEntryDialog(true)}\n disabled={isProcessing}\n {...props}\n />\n setOpenCreateEntryDialog(false)}\n data-testid='create-entry-dialog'\n >\n Create new entry from schema\n \n \n Name of the entry\n \n setName(event.target.value.replace(/ /g, '_'))}/>\n \n Select a schema\n \n \n \n }\n label=\"Built-in schema\"\n labelPlacement=\"end\"\n />\n }\n label=\"Custom schema\"\n labelPlacement=\"end\"\n />\n \n \n {schemaType === 'built-in' && template.id === builtInTemplate?.id) ? builtInTemplate : null}\n onChange={handleBuiltInChange}\n options={builtInTemplates || []}\n groupBy={option => option.categoryLabel}\n getOptionLabel={option => option.label}\n renderInput={(params) => {\n return (\n \n )\n }}\n />}\n {schemaType === 'custom' && \n {\n return (\n setOpen(true)\n )\n }}\n data-testid='custom-select-schema'\n />\n )\n }}\n />\n }\n \n {name ? `File name: ${name}.archive.json` : ''}\n \n setOpen(false)}\n onSelectedChanged={handleSelect}\n selected={customTemplate && {entry_id: customTemplate?.entry_id, value: customTemplate?.value}}\n filtersLocked={filtersLocked}\n />\n \n \n \n \n \n \n \n setOpenEntryAlreadyExistsDialog(false)}\n >\n Entry already exists\n \n \n A mainfile with the specified name already exists. Please choose a different name.\n \n \n \n \n \n \n \n})\n\nexport default CreateEntry\n","import {\n CircularProgress,\n Dialog,\n DialogContent,\n DialogTitle, TextField, makeStyles\n} from '@material-ui/core'\nimport Button from '@material-ui/core/Button'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport DialogContentText from '@material-ui/core/DialogContentText'\nimport React, { useCallback, useState } from 'react'\nimport { useApi } from '../api'\n\nexport const useInviteUserDialogStyles = makeStyles(theme => ({\n button: {\n marginLeft: theme.spacing(1)\n },\n dialog: {\n width: '100%'\n },\n submitWrapper: {\n margin: theme.spacing(1),\n position: 'relative'\n },\n submitProgress: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n marginTop: -12,\n marginLeft: -12\n }\n}))\n\nexport const InviteUserDialog = React.memo(function InviteUserDialog(props) {\n const classes = useInviteUserDialogStyles()\n const [open, setOpen] = useState(false)\n const [submitting, setSubmitting] = useState(false)\n const [canSubmit, setCanSubmit] = useState(false)\n const [error, setError] = useState(null)\n const [data, setData] = useState({\n first_name: '',\n last_name: '',\n email: '',\n affiliation: ''\n })\n const { api } = useApi()\n\n const handleClose = useCallback((event, reason) => {\n if (reason !== 'backdropClick') {\n setOpen(false)\n }\n }, [setOpen])\n\n const handleSubmit = useCallback(() => {\n setSubmitting(true)\n\n api.inviteUser(data).then(() => {\n setSubmitting(false)\n setOpen(false)\n }).catch(error => {\n let message = '' + error\n try {\n message = JSON.parse(error.request.responseText).detail || '' + error\n } catch (e) { }\n setError(message)\n setSubmitting(false)\n setCanSubmit(false)\n })\n }, [data, setSubmitting, setOpen, setError, api])\n\n const handleChange = useCallback((key, value) => {\n const valid = value && !Object.keys(data).find(dataKey => !(key === dataKey || data[dataKey]))\n setData({ ...data, [key]: value })\n setCanSubmit(valid)\n }, [setData, data, setCanSubmit])\n\n const handleOpen = useCallback(() => {\n setOpen(true)\n }, [setOpen])\n\n const input = (key, label) => handleChange(key, event.target.value)}\n margin=\"normal\"\n fullWidth />\n return \n \n \n Invite a new user to NOMAD\n \n \n If you want to add a user as co-author or share your data with someone that\n is not already a NOMAD user, you can invite this person here. We need just a few\n details about this person. After your invite, the new user will receive an\n Email that allows her to set a password and further details. Anyhow, you will\n be able to add the user as co-author or someone to share with immediately after the\n invite.\n \n {error && \n {error}\n }\n {input('email', 'Email')}\n {input('first_name', 'First name')}\n {input('last_name', 'Last name')}\n {input('affiliation', 'Affiliation')}\n \n \n \n
\n \n {submitting && }\n
\n
\n \n
\n})\nInviteUserDialog.propTypes = {}\n","import GroupIcon from '@material-ui/icons/Group'\nimport PersonIcon from '@material-ui/icons/Person'\nimport _ from 'lodash'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { fetchUsersByIds } from '../utils/apiUtils.js'\n\nexport const ROLES = Object.freeze({\n MAIN_AUTHOR: 'Main author',\n COAUTHOR: 'Co-author',\n REVIEWER: 'Reviewer'\n})\n\nexport const TYPES = Object.freeze({\n USER: 'user',\n GROUP: 'group'\n})\n\nexport function MemberIcon({ type }) {\n return (type === TYPES.USER ? : )\n}\nMemberIcon.propTypes = {\n type: PropTypes.string.isRequired\n}\n\nexport function userToMember(user, role = ROLES.REVIEWER) {\n return {\n type: TYPES.USER,\n id: user.user_id,\n name: user.name,\n affiliation: user.affiliation,\n role: role\n }\n}\n\nexport function groupToMember(group, usersDict = {}, role = ROLES.REVIEWER, defaultId = null) {\n return {\n type: TYPES.GROUP,\n id: group?.group_id ?? defaultId,\n name: group?.group_name ?? null,\n affiliation: usersDict[group?.owner]?.name ?? group?.owner ?? null,\n role: role,\n error: !group ? `missing` : null\n }\n}\n\nexport async function groupsToMembers(groups, api) {\n if (!groups.length) return []\n\n let ownersDict = {}\n if (api) {\n const ownerIds = groups.map(group => group.owner)\n const ownerUsers = await fetchUsersByIds(api, ownerIds)\n ownersDict = _.keyBy(ownerUsers, 'user_id')\n }\n return groups.map(group => groupToMember(group, ownersDict))\n}\n\nexport const getMemberIdsByTypeAndRole = (members, type, role) => {\n return members\n .filter(member => member.type === type && member.role === role)\n .map(member => member.id)\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Dialog,\n DialogContent,\n DialogTitle,\n FormGroup,\n IconButton,\n makeStyles,\n MenuItem,\n Select,\n TextField,\n Tooltip,\n Typography\n} from '@material-ui/core'\nimport Button from '@material-ui/core/Button'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport DialogContentText from '@material-ui/core/DialogContentText'\nimport DeleteIcon from '@material-ui/icons/Delete'\nimport AutoComplete from '@material-ui/lab/Autocomplete'\nimport _, { debounce } from 'lodash'\nimport PropTypes from 'prop-types'\nimport React, { useCallback, useContext, useEffect, useMemo, useReducer, useState } from 'react'\nimport { uploadMembersGroupSearchEnabled } from '../../config'\nimport { isUploadVisibleForAll } from '../../utils'\nimport { useApi } from '../api'\nimport { Datatable, DatatableTable } from '../datatable/Datatable'\nimport { useErrors } from '../errors'\nimport {\n fetchGroupsByIds,\n fetchGroupsByNameSearch,\n fetchUsersByIds,\n fetchUsersByNamePrefix\n} from '../utils/apiUtils'\nimport { InviteUserDialog } from './InviteUserDialog'\nimport { useUploadPageContext } from './UploadPageContext'\nimport {\n getMemberIdsByTypeAndRole,\n groupsToMembers,\n groupToMember,\n MemberIcon,\n ROLES,\n TYPES,\n userToMember\n} from './memberUtils'\n\nexport const editMembersDialogContext = React.createContext()\n\nconst useStyles = makeStyles(theme => ({\n dialog: {\n width: '100%'\n },\n memberSearch: {\n columnGap: theme.spacing(1)\n },\n memberSearchType: {\n width: '7em'\n },\n memberSearchText: {\n flexGrow: 1\n }\n}))\n\nfunction renderMemberName(member) {\n if (member.error === 'missing') {\n return (\n \n Error: {member.type} was deleted\n \n )\n }\n return member.name\n}\n\nfunction MembersTable() {\n const {members, setIsChanged} = useContext(editMembersDialogContext)\n const forceUpdate = useReducer(bool => !bool)[1]\n\n const columns = [\n {key: '', align: 'right', render: member => ()},\n {key: 'Name', align: 'left', render: renderMemberName},\n {key: 'Affiliation', align: 'left', render: member => member.affiliation},\n {\n key: 'Role',\n align: 'left',\n render: member => (member.role === ROLES.MAIN_AUTHOR ? member.role\n : {\n member.role = event.target.value\n setIsChanged(true)\n forceUpdate()\n }}\n >\n Co-author\n Reviewer\n )\n }\n ]\n\n return \n \n \n}\n\nfunction AddMember() {\n const classes = useStyles()\n const {api} = useApi()\n const {raiseError} = useErrors()\n const [suggestions, setSuggestions] = useState([])\n const {members, setMembers, setIsChanged} = useContext(editMembersDialogContext)\n const [query, setQuery] = useState('')\n const [searchType, setSearchType] = useState(TYPES.USER)\n const [selectedSuggestion, setSelectedSuggestion] = useState(null)\n const [suggestionsAreLoading, setSuggestionsAreLoading] = useState(false)\n\n const handleInputChange = useCallback(async (event, value) => {\n const newQuery = value.toLowerCase()\n const oldQuery = query\n\n if (oldQuery !== '' && newQuery.startsWith(oldQuery) && suggestions.length === 0) {\n setQuery(newQuery)\n return\n }\n\n try {\n setSuggestionsAreLoading(true)\n let newSuggestions = []\n if (searchType === TYPES.GROUP) {\n const groups = await fetchGroupsByNameSearch(api, newQuery)\n newSuggestions = await groupsToMembers(groups, api)\n } else {\n const users = await fetchUsersByNamePrefix(api, newQuery)\n newSuggestions = users.map(user => userToMember(user))\n }\n\n const filteredSuggestions = newSuggestions.filter(\n suggestion => !members.some(member => member.id === suggestion.id)\n )\n\n setSuggestions(filteredSuggestions)\n } catch (err) {\n setSuggestions([])\n raiseError(err)\n } finally {\n setSuggestionsAreLoading(false)\n }\n\n setQuery(newQuery)\n }, [api, searchType, members, query, raiseError, suggestions.length])\n\n const debouncedHandleInputChange = useMemo(() => (\n debounce(handleInputChange, 700)\n ), [handleInputChange])\n\n const handleSearchTypeChange = useCallback((event) => {\n setSearchType(event.target.value)\n setSelectedSuggestion(null)\n }, [])\n\n const handleSearchSelectionChange = useCallback((event, value) => {\n setSelectedSuggestion(null)\n\n if (members.some(member => member.id === value?.id)) {\n return\n }\n\n setMembers([...members, value])\n setIsChanged(true)\n }, [members, setMembers, setIsChanged])\n\n return \n \n {uploadMembersGroupSearchEnabled && \n User\n Group\n }\n (option.affiliation ? `${option.name} (${option.affiliation})` : option.name)}\n getOptionSelected={(option, value) => value ? option.id === value.id : false}\n onInputChange={debouncedHandleInputChange}\n onChange={handleSearchSelectionChange}\n value={selectedSuggestion}\n blurOnSelect={true}\n loading={suggestionsAreLoading}\n renderInput={params => (\n \n )}\n />\n \n \n}\n\nconst DeleteAction = React.memo((props) => {\n const {data} = props\n const {members, setMembers, setIsChanged} = useContext(editMembersDialogContext)\n\n const handleRemove = () => {\n const filteredMembers = members.filter(member => member.id !== data.id)\n setMembers(filteredMembers)\n setIsChanged(true)\n }\n\n const isOwner = data.role === ROLES.MAIN_AUTHOR\n\n return \n \n \n \n \n})\nDeleteAction.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nconst EditMembersDialog = ({open, setOpen}) => {\n const classes = useStyles()\n const {api} = useApi()\n const {raiseError} = useErrors()\n const {uploadId, upload, updateUpload} = useUploadPageContext()\n const [members, setMembers] = useState([])\n const [isChanged, setIsChanged] = useState(false)\n const [openConfirmDialog, setOpenConfirmDialog] = useState(false)\n\n const fetchMembers = useCallback(async () => {\n const { main_author, coauthors, reviewers, coauthor_groups } = upload\n const reviewer_groups = upload.reviewer_groups.filter(group => group !== 'all')\n\n const groupIds = [...coauthor_groups, ...reviewer_groups]\n const groupRoles = [...coauthor_groups.map(_ => ROLES.COAUTHOR),\n ...reviewer_groups.map(_ => ROLES.REVIEWER)]\n const groups = await fetchGroupsByIds(api, groupIds)\n const ownerIds = groups.map(group => group.owner)\n const groupsDict = _.keyBy(groups, 'group_id')\n\n const memberUserIds = [main_author, ...coauthors, ...reviewers]\n const userRoles = [ROLES.MAIN_AUTHOR,\n ...coauthors.map(_ => ROLES.COAUTHOR),\n ...reviewers.map(_ => ROLES.REVIEWER)]\n const users = await fetchUsersByIds(api, [...memberUserIds, ...ownerIds])\n const usersDict = _.keyBy(users, 'user_id')\n\n const memberUsers = memberUserIds.map((userId, index) =>\n userToMember(usersDict[userId], userRoles[index])\n )\n const memberGroups = groupIds.map((groupId, index) =>\n groupToMember(groupsDict[groupId], usersDict, groupRoles[index], groupId)\n )\n\n return [...memberUsers, ...memberGroups]\n }, [api, upload])\n\n useEffect(() => {\n if (!open) {\n return\n }\n\n setMembers([])\n setIsChanged(false)\n fetchMembers()\n .then(setMembers)\n .catch(raiseError)\n }, [fetchMembers, open, raiseError])\n\n const handleDiscardChanges = () => {\n setOpenConfirmDialog(false)\n setOpen(false)\n }\n\n const handleSubmitChanges = () => {\n if (!isChanged) {\n setOpen(false)\n return\n }\n\n const metadata = {\n 'coauthors': getMemberIdsByTypeAndRole(members, TYPES.USER, ROLES.COAUTHOR),\n 'reviewers': getMemberIdsByTypeAndRole(members, TYPES.USER, ROLES.REVIEWER),\n 'coauthor_groups': getMemberIdsByTypeAndRole(members, TYPES.GROUP, ROLES.COAUTHOR),\n 'reviewer_groups': getMemberIdsByTypeAndRole(members, TYPES.GROUP, ROLES.REVIEWER)\n }\n\n if (isUploadVisibleForAll(upload)) {\n metadata.reviewer_groups.push('all')\n }\n\n api.post(`/uploads/${uploadId}/edit`, {'metadata': metadata})\n .then(results => {\n updateUpload({upload: results.data})\n setOpen(false)\n })\n .catch(raiseError)\n }\n\n const handleCancel = () => {\n if (isChanged) {\n setOpenConfirmDialog(true)\n } else {\n setOpen(false)\n }\n }\n\n const contextValue = useMemo(() => ({\n members: members,\n setMembers: setMembers,\n isChanged: isChanged,\n setIsChanged: setIsChanged\n }), [members, setMembers, isChanged, setIsChanged])\n\n return \n \n {open && \n Edit upload members\n \n \n You can add and remove members for this upload and change their access.\n Reviewers can view the upload, co-authors can also edit it.\n \n \n \n \n \n \n \n \n \n \n \n \n \n Your changes are not submitted yet. Discard changes?\n \n \n \n \n \n \n \n }\n \n \n}\nEditMembersDialog.propTypes = {\n open: PropTypes.bool.isRequired,\n setOpen: PropTypes.func.isRequired\n}\n\nexport default EditMembersDialog\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useMemo, useState} from 'react'\nimport {\n makeStyles, DialogTitle, DialogContent, Dialog, IconButton, Tooltip, Divider,\n Typography, TextField, Box\n} from '@material-ui/core'\nimport DialogContentText from '@material-ui/core/DialogContentText'\nimport EditIcon from '@material-ui/icons/Edit'\nimport Button from '@material-ui/core/Button'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport PropTypes from 'prop-types'\nimport AutoComplete from '@material-ui/lab/Autocomplete'\nimport {useApi} from '../api'\nimport {useErrors} from '../errors'\nimport {useLocation} from 'react-router'\nimport {Link} from 'react-router-dom'\nimport {getUrl} from '../nav/Routes'\nimport {Datatable, DatatableTable} from '../datatable/Datatable'\nimport DeleteIcon from '@material-ui/icons/Delete'\nimport OpenInNewIcon from '@material-ui/icons/OpenInNew'\nimport Quantity from '../Quantity'\nimport {DOI} from '../dataset/DOI'\nimport { useUploadPageContext } from './UploadPageContext'\n\nfunction EditComments(props) {\n const {value, onChange} = props\n\n return \n \n \n Comments\n \n \n onChange(event.target.value)}\n inputProps={{ 'data-testid': 'metadata-comment-field' }}\n />\n \n}\nEditComments.propTypes = {\n value: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired\n}\n\nfunction EditReferences(props) {\n const {values, onAdd, onRemove} = props\n const [newReference, setNewReference] = useState('')\n const [urlValidation, setUrlValidation] = useState('')\n\n const validateURL = useCallback((value) => {\n try {\n const url = new URL(value)\n if (url) {}\n } catch (_) {\n return 'Pleas enter a valid URL ...'\n }\n }, [])\n\n const validation = useMemo(() => {\n if (newReference === '') return undefined\n if (values?.includes(newReference)) return 'The URL is already in the references'\n return undefined\n }, [values, newReference])\n\n const columns = useMemo(() => {\n return [\n {key: 'url',\n align: 'left',\n render: reference => {\n return \n \n \n }\n }\n ]\n }, [])\n\n const handleChangeReference = useCallback((event) => {\n setUrlValidation(undefined)\n setNewReference(event.target.value)\n }, [])\n\n const handleAdd = useCallback(() => {\n const validateURLError = validateURL(newReference)\n setUrlValidation(validateURLError)\n if (validateURLError) return\n onAdd(newReference)\n setNewReference('')\n }, [newReference, onAdd, validateURL])\n\n const apiError = useMemo(() => values && values.find(value => !!(value?.error_reference))?.error_reference, [values])\n\n return \n \n \n References\n \n \n \n \n \n \n {columns && values.length > 0 && \n {apiError && \n {apiError}\n }\n \n !(value?.error_reference)).map(value => Object({url: value, onRemove: onRemove}))}>\n \n \n }\n \n}\nEditReferences.propTypes = {\n values: PropTypes.arrayOf(PropTypes.string).isRequired,\n onAdd: PropTypes.func.isRequired,\n onRemove: PropTypes.func.isRequired\n}\n\nconst ReferencesActions = React.memo((props) => {\n const {data} = props\n\n const handleOpenLink = () => {\n window.open(data.url, '_blank')\n }\n\n return \n \n \n \n \n \n data.onRemove(data.url)} data-testid='reference-delete-action'>\n \n \n \n \n \n})\nReferencesActions.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nfunction EditDatasets(props) {\n const {values, userDatasets, onCreate, onAdd, onRemove} = props\n const [newDataset, setNewDataset] = useState('')\n const [datasetToAdd, setDatasetToAdd] = useState('')\n\n const columns = useMemo(() => ([\n {key: 'dataset', align: 'left', render: row => ('doi' in row.dataset ? {`${row.dataset.dataset_name}, DOI:`} : row.dataset.dataset_name)}\n ]), [])\n\n const isDuplicated = useMemo(() => {\n return !!values.find(dataset => dataset.dataset_id && dataset.dataset_id === datasetToAdd.dataset_id)\n }, [datasetToAdd, values])\n\n const validation = useMemo(() => {\n if (userDatasets.map(dataset => dataset.dataset_name).includes(newDataset)) return `There is already a dataset with name ${newDataset}`\n if (values.map(dataset => dataset.dataset_name).includes(newDataset)) return `There is already a dataset with name ${newDataset}`\n if (newDataset[0] === ' ') return `Invalid name for dataset`\n return ''\n }, [newDataset, values, userDatasets])\n\n const handleDatasetToAddChanged = useCallback((event, value) => {\n (value && value?.dataset_id ? setDatasetToAdd(value) : setDatasetToAdd(''))\n }, [])\n\n const handleNewDatasetChanged = useCallback((event) => {\n setNewDataset(event.target.value)\n }, [])\n\n const handleCreate = useCallback(() => {\n onCreate(newDataset)\n setNewDataset('')\n }, [newDataset, onCreate])\n\n const handleAdd = useCallback(() => {\n onAdd(datasetToAdd)\n setDatasetToAdd('')\n }, [datasetToAdd, onAdd])\n\n const addDatasetButton = useMemo(() => {\n if (validation === '' && newDataset !== '') {\n return \n } else if (!isDuplicated && datasetToAdd !== '') {\n return \n } else {\n return \n }\n }, [datasetToAdd, newDataset, handleAdd, handleCreate, validation, isDuplicated])\n\n const apiError = useMemo(() => values && values.find(value => !!(value?.error_dataset))?.error_dataset, [values])\n\n return \n \n \n Datasets\n \n \n \n \n \n option.dataset_name || ''}\n onChange={handleDatasetToAddChanged}\n value={datasetToAdd}\n getOptionSelected={(option, value) => (value ? option?.dataset_name === value?.dataset_name : true)}\n renderInput={params => (\n \n )}\n />\n \n {addDatasetButton}\n \n {apiError && \n {apiError}\n }\n \n {columns && values.length > 0 && !(value?.error_dataset)).map(value => Object({dataset: value, onRemove: onRemove}))}>\n \n }\n \n}\nEditDatasets.propTypes = {\n values: PropTypes.arrayOf(PropTypes.object).isRequired,\n userDatasets: PropTypes.arrayOf(PropTypes.object).isRequired,\n onCreate: PropTypes.func.isRequired,\n onAdd: PropTypes.func.isRequired,\n onRemove: PropTypes.func.isRequired\n}\n\nconst DatasetsActions = React.memo((props) => {\n const {data} = props\n const location = useLocation()\n\n const openDatasetUrl = useMemo(() => {\n const path = `datasets/dataset/id/${data.dataset.dataset_id}`\n return getUrl(path, location)\n }, [data, location])\n\n return \n {data.dataset.dataset_id && \n \n \n \n }\n data.onRemove(data.dataset)} disabled={!!data.dataset.doi && !data.dataset?.notSubmitted} style={{pointerEvents: 'auto'}} data-testid='dataset-delete-action'>\n \n \n \n \n \n})\nDatasetsActions.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nconst useEditMetaDataDialogStyles = makeStyles(theme => ({\n dialog: {\n width: '100%'\n }\n}))\n\nfunction EditMetaDataDialog({...props}) {\n const {isIcon, selectedEntries} = props\n const classes = useEditMetaDataDialogStyles()\n const {api, user} = useApi()\n const {raiseError} = useErrors()\n const {uploadId, upload, entries, updateUpload} = useUploadPageContext()\n const [open, setOpen] = useState(false)\n const [openConfirmDialog, setOpenConfirmDialog] = useState(false)\n const isProcessing = upload?.process_running\n const nSelected = (selectedEntries.upload_id ? upload?.entries : selectedEntries.entry_id.length)\n const [userDatasets, setUserDatasets] = useState([])\n const [userDatasetsFetched, setUserDatasetsFetched] = useState(false)\n const [actions, setActions] = useState([])\n\n const handleDiscardChanges = useCallback(() => {\n setOpenConfirmDialog(false)\n setOpen(false)\n }, [])\n\n useEffect(() => {\n if (open && !userDatasetsFetched) {\n setUserDatasetsFetched(true)\n api.get(`/datasets/?page_size=${1000}&page=${1}&user_id=${user.sub}`)\n .then(datasets => {\n setUserDatasets(datasets?.data)\n })\n .catch(err => {\n setUserDatasets([])\n raiseError(err)\n })\n }\n }, [api, user, raiseError, open, userDatasetsFetched, setUserDatasetsFetched])\n\n const selectedEntriesObjects = useMemo(() => {\n return selectedEntries.upload_id ? entries : entries.filter(entry => selectedEntries.entry_id.includes(entry?.entry_id))\n }, [entries, selectedEntries.entry_id, selectedEntries.upload_id])\n\n const defaultComment = useMemo(() => (\n entries?.length > 0 ? selectedEntriesObjects[0]?.entry_metadata?.comment || '' : ''\n ), [entries, selectedEntriesObjects])\n\n const defaultReferences = useMemo(() => {\n if (entries?.length < 0) {\n return []\n }\n const referencesList = selectedEntriesObjects.map(entry => entry?.entry_metadata?.references).flat()\n return referencesList.filter((value, index) => referencesList.indexOf(value) === index)\n }, [entries.length, selectedEntriesObjects])\n\n const defaultDatasets = useMemo(() => {\n if (entries?.length < 0) {\n return []\n }\n const datasetsList = selectedEntriesObjects.map(entry => entry?.entry_metadata?.datasets)\n return userDatasets.filter(datasetFullData => datasetsList.flat().map(dataset => dataset.dataset_id).includes(datasetFullData.dataset_id))\n }, [selectedEntriesObjects, entries.length, userDatasets])\n\n const handleOpenDialog = useCallback(() => {\n setActions([])\n setOpen(true)\n }, [])\n\n const createNewDatasets = useCallback(() => {\n const promises = actions.filter(action => action.create_dataset).map(action => api.post(`/datasets/`, {dataset_name: action.create_dataset}))\n return Promise.all(promises)\n }, [api, actions])\n\n const edit = useCallback((metadata, verify_only) => {\n return new Promise((resolve, reject) => {\n try {\n const requestBody = {metadata: metadata, verify_only: verify_only, owner: 'user'}\n if (selectedEntries.entry_id) requestBody.query = selectedEntries\n api.post(`uploads/${uploadId}/edit`, requestBody)\n .then(() => resolve(''))\n .catch(error => reject(error.apiMessage))\n } catch (error) {\n reject(error.apiMessage)\n }\n })\n }, [api, uploadId, selectedEntries])\n\n const submitChanges = useCallback((metadata) => {\n edit(metadata, true)\n .then(response => {\n edit(metadata, false)\n .then(results => {\n setActions([])\n updateUpload({upload: results.data})\n }).catch(err => {\n raiseError(err)\n })\n })\n .catch(errors => {\n errors.forEach(error => {\n if (error.loc.includes('references')) setActions(oldActions => [...oldActions, {'error_reference': error.msg}])\n if (error.loc.includes('datasets')) setActions(oldActions => [...oldActions, {'error_dataset': error.msg}])\n })\n })\n }, [edit, updateUpload, raiseError])\n\n const isCommentChanged = useMemo(() => !!actions.find(action => 'set_comment' in action), [actions])\n const isReferencesChanged = useMemo(() => !!actions.find(action => 'add_reference' in action || 'remove_reference' in action), [actions])\n const isDatasetChanged = useMemo(() => !!actions.find(action => 'add_dataset' in action || 'remove_dataset' in action || 'create_dataset' in action), [actions])\n\n const comment = useMemo(() => {\n const action = actions.find(action => 'set_comment' in action)\n return (action ? action.set_comment : defaultComment)\n }, [actions, defaultComment])\n\n const references = useMemo(() => {\n let references = [...defaultReferences]\n actions.forEach(action => {\n if (action.add_reference) references = [...references, action.add_reference]\n if (action.remove_reference) references = references.filter(reference => reference !== action.remove_reference)\n if (action.error_reference) references = [...references, action]\n })\n return references\n }, [actions, defaultReferences])\n\n const datasets = useMemo(() => {\n let datasets = [...defaultDatasets]\n actions.forEach(action => {\n if (action.add_dataset) {\n const notSubmittedDataset = userDatasets.find(datasetFullData => action.add_dataset === datasetFullData.dataset_id)\n notSubmittedDataset.notSubmitted = true\n datasets = [...datasets, notSubmittedDataset]\n }\n if (action.create_dataset) datasets = [...datasets, {'dataset_name': action.create_dataset}]\n if (action.remove_dataset) datasets = datasets.filter(dataset => dataset.dataset_id !== action.remove_dataset)\n if (action.error_dataset) datasets = [...datasets, action]\n })\n return datasets\n }, [actions, defaultDatasets, userDatasets])\n\n const handleSubmitChanges = useCallback(() => {\n if (isCommentChanged || isReferencesChanged || isDatasetChanged) {\n const metadata = {}\n if (isCommentChanged) metadata.comment = comment\n if (isReferencesChanged) {\n metadata.references = {}\n if (actions.find(action => 'add_reference' in action)) metadata.references.add = actions.flatMap(action => action.add_reference || [])\n if (actions.find(action => 'remove_reference' in action)) metadata.references.remove = actions.flatMap(action => action.remove_reference || [])\n }\n if (isDatasetChanged) {\n metadata.datasets = {}\n createNewDatasets().then(newDatasets => {\n const newDatasetsIDs = newDatasets.map(_dataset => _dataset.dataset_id)\n if (actions.find(action => 'add_dataset' in action || 'create_dataset' in action)) metadata.datasets.add = actions.flatMap(action => action.add_dataset || []).concat(newDatasetsIDs)\n if (actions.find(action => 'remove_dataset' in action)) metadata.datasets.remove = actions.flatMap(action => action.remove_dataset || [])\n submitChanges(metadata)\n })\n } else {\n submitChanges(metadata)\n }\n } else {\n setOpen(false)\n }\n }, [actions, comment, createNewDatasets, isCommentChanged, isDatasetChanged, isReferencesChanged, submitChanges])\n\n const handleSetComment = useCallback((value) => {\n const action = actions.find(action => 'set_comment' in action)\n if (action) {\n const newActions = [...actions]\n if (value === defaultComment) {\n newActions.splice(actions.indexOf(action), 1)\n } else {\n newActions[actions.indexOf(action)] = {set_comment: value}\n }\n setActions(newActions)\n } else {\n setActions(oldActions => [...oldActions, {set_comment: value}])\n }\n }, [actions, defaultComment])\n\n const handleAddReference = useCallback((value) => {\n setActions(oldActions => oldActions.filter(action => !('error_reference' in action)))\n if (actions.flatMap(action => action.remove_reference || []).includes(value)) {\n setActions(_actions => _actions.filter(action => action.remove_reference !== value))\n } else {\n setActions(_actions => [..._actions, {add_reference: value}])\n }\n }, [actions])\n\n const handleRemoveReference = useCallback((value) => {\n setActions(oldActions => oldActions.filter(action => !('error_reference' in action)))\n if (actions.flatMap(action => action.add_reference || []).includes(value)) {\n setActions(_actions => _actions.filter(action => action.add_reference !== value))\n } else {\n setActions(_actions => [..._actions, {remove_reference: value}])\n }\n }, [actions])\n\n const handleCreateDataset = useCallback((value) => {\n setActions(oldActions => oldActions.filter(action => !('error_dataset' in action)))\n if (value && !actions.find(action => action.create_dataset === value)) {\n setActions(_actions => [..._actions, {create_dataset: value}])\n }\n }, [actions])\n\n const handleAddDataset = useCallback((value) => {\n if (value) {\n setActions(oldActions => oldActions.filter(action => !('error_dataset' in action)))\n if (actions.flatMap(action => action.remove_dataset || []).includes(value.dataset_id)) {\n setActions(_actions => _actions.filter(action => action.remove_dataset !== value.dataset_id))\n } else {\n setActions(_actions => [..._actions, {add_dataset: value.dataset_id}])\n }\n }\n }, [actions])\n\n const handleRemoveDataset = useCallback((value) => {\n setActions(oldActions => oldActions.filter(action => !('error_dataset' in action)))\n if (actions.flatMap(action => action.create_dataset || []).includes(value.dataset_name)) {\n setActions(_actions => _actions.filter(action => action.create_dataset !== value.dataset_name))\n } else if (actions.flatMap(action => action.add_dataset || []).includes(value.dataset_id)) {\n setActions(_actions => _actions.filter(action => action.add_dataset !== value.dataset_id))\n } else {\n setActions(_actions => [..._actions, {remove_dataset: value.dataset_id}])\n }\n }, [actions])\n\n const handleConfirm = useCallback(() => {\n if (isCommentChanged || isReferencesChanged || isDatasetChanged) {\n setOpenConfirmDialog(true)\n } else {\n setOpen(false)\n }\n }, [isCommentChanged, isDatasetChanged, isReferencesChanged])\n\n return \n {isIcon && handleOpenDialog()}>\n \n \n \n }\n {!isIcon && }\n {open && \n Edit upload metadata\n \n \n You can add, edit, or remove the metadata for the selected entries.\n
\n {nSelected} of {upload?.entries} {upload?.entries === 1 ? 'entry' : 'entries'} is selected.\n
\n \n
\n \n \n \n
\n
\n \n \n \n \n \n \n \n \n Your changes are not submitted yet. Discard changes?\n \n \n \n \n \n \n
\n }\n
\n}\nEditMetaDataDialog.propTypes = {\n isIcon: PropTypes.bool,\n selectedEntries: PropTypes.object\n}\n\nexport default EditMetaDataDialog\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Button, Dialog, DialogActions, DialogContent, DialogTitle, makeStyles } from '@material-ui/core'\nimport InfiniteScroll from 'react-infinite-scroller'\n\nconst useFilePreviewStyles = makeStyles(theme => ({\n contents: {\n width: '85%',\n overflowX: 'auto',\n color: theme.palette.primary.contrastText,\n backgroundColor: theme.palette.primary.dark,\n marginTop: theme.spacing(1),\n padding: '3px 6px',\n fontFamily: 'Consolas, \"Liberation Mono\", Menlo, Courier, monospace',\n fontSize: 12\n }\n}))\n\nexport default function FilePreview({uploadId, path, onClose}) {\n const scrollRef = useRef()\n const [content] = useState(null)\n const classes = useFilePreviewStyles()\n\n return \n File preview: {path}\n \n console.log('### load more')}\n hasMore={false}\n useWindow={false}\n getScrollParent={() => scrollRef.current}\n >\n
\n          {`${content}`}\n           \n        
\n \n
\n \n \n \n
\n}\n\nFilePreview.propTypes = {\n uploadId: PropTypes.string.isRequired,\n path: PropTypes.string.isRequired,\n onClose: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useMemo, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Box, Chip, CircularProgress, Collapse, IconButton, makeStyles, Paper, Tooltip, Typography } from '@material-ui/core'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight'\nimport NavigateIcon from '@material-ui/icons/ArrowForward'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport FilePreview from './FilePreview'\nimport { EntryButton } from '../nav/Routes'\n\nconst useFolderStyles = makeStyles(theme => ({\n root: {},\n item: {\n '&:hover': {\n backgroundColor: theme.palette.grey[100]\n },\n width: '100%',\n display: 'flex',\n flexDirection: 'raw',\n alignItems: 'center',\n flexWrap: 'nowrap',\n height: 32,\n paddingRight: theme.spacing(1)\n },\n icon: {\n },\n name: {\n\n },\n tags: {\n // textTransform: 'uppercase',\n marginLeft: theme.spacing(1)\n },\n info: {\n marginLeft: theme.spacing(1)\n },\n actions: {\n marginLeft: theme.spacing(1),\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-end',\n flexWrap: 'nowrap'\n },\n children: {\n marginLeft: theme.spacing(3)\n }\n}))\n\nfunction FileOrFolder({onToggle, open, hasChildren, children, name, parser, info, entry_id, path}) {\n const classes = useFolderStyles()\n const handleToggle = event => {\n event.stopPropagation()\n if (onToggle) {\n onToggle()\n }\n }\n const iconProps = {\n className: classes.icon,\n fontSize: 'small'\n }\n const icon = hasChildren\n ? (open ? : )\n :
\n\n return
\n
\n {icon}\n \n {name || '/'}\n \n {(info || parser) &&
\n {info}\n
}\n
\n {parser && }\n
\n {entry_id && (\n \n \n \n \n \n \n \n \n )}\n
\n \n {children || 'loading ...'}\n \n
\n}\n\nFileOrFolder.propTypes = {\n onToggle: PropTypes.func,\n open: PropTypes.bool,\n hasChildren: PropTypes.bool,\n children: PropTypes.arrayOf(PropTypes.object),\n name: PropTypes.string,\n path: PropTypes.string,\n entry_id: PropTypes.string,\n parser: PropTypes.string,\n info: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node\n ])\n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(2),\n position: 'relative'\n },\n disabled: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n borderRadius: 4,\n background: 'rgba(200, 200, 200, 0.5)',\n zIndex: 10\n },\n disabledProgress: {\n position: 'absolute',\n margin: 0,\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)'\n }\n}))\n\nexport default function FilesBrower({uploadId, disabled}) {\n const classes = useStyles()\n const {api} = useApi()\n const errors = useErrors()\n const [renderCounter, setRenderCounter] = useState(-1)\n const [previewPath, setPreviewPath] = useState(null)\n const allData = useRef({})\n\n const fetchData = useMemo(() => (path, open) => {\n async function fetchData() {\n const encodedPath = path.split('/').map(segment => encodeURIComponent(segment)).join('/')\n const results = await api.get(`/uploads/${uploadId}/rawdir/${encodedPath}?page_size=500&include_entry_info=true`)\n allData.current[path] = {\n open: open,\n ...results\n }\n const resultsByPath = {}\n results.directory_metadata.content\n .filter(item => item.is_file)\n .forEach(item => {\n resultsByPath[`${path}/${item.name}`] = item\n if (item.parser_name) {\n item.parser = item.parser_name.replace('parsers/', '').replace('parser/', '')\n }\n })\n setRenderCounter(renderCounter => renderCounter + 1)\n }\n if (!disabled) {\n fetchData().catch(errors.raiseError)\n }\n }, [uploadId, api, errors, setRenderCounter, disabled])\n\n useEffect(() => {\n if (!disabled) {\n fetchData('')\n }\n }, [fetchData, disabled])\n\n const handleToggle = (path) => {\n const folderData = allData.current[path]\n if (folderData) {\n // TODO this can be avoided, if this component gets notified about possible file\n // changes behind\n // the api.\n if (!folderData.open) {\n fetchData(path, true)\n }\n folderData.open = !folderData.open\n setRenderCounter(renderCounter + 1)\n } else {\n fetchData(path, true)\n }\n }\n\n function renderFileOrFolder(path, item) {\n const {is_file} = item\n const data = allData.current[path]\n const pathPrefix = path ? `${path}/` : ''\n const mapContent = item => renderFileOrFolder(`${pathPrefix}${item.name}`, item)\n const props = {\n key: path,\n path: path,\n uploadId: uploadId,\n hasChildren: !is_file,\n open: data?.open,\n children: data?.directory_metadata?.content?.map(mapContent),\n onToggle: is_file ? null : () => handleToggle(path),\n // TODO\n // info: !is_file && data?.content?.length === 0 && \n // {'empty directory'}\n // ,\n ...item\n }\n\n return \n }\n\n const root = allData.current['']\n\n return \n {disabled &&
}\n {disabled &&
}\n {root && renderFileOrFolder('', root)}\n {previewPath && setPreviewPath(null)} />}\n \n}\n\nFilesBrower.propTypes = {\n uploadId: PropTypes.string.isRequired,\n disabled: PropTypes.bool\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {useMemo, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport { Paper, Link } from '@material-ui/core'\nimport EntryDetails, { EntryRowActions } from '../entry/EntryDetails'\nimport {\n addColumnDefaults,\n Datatable, DatatablePagePagination, DatatableTable,\n DatatableToolbar, DatatableToolbarActions } from '../datatable/Datatable'\nimport EntryDownloadButton from '../entry/EntryDownloadButton'\nimport DeleteEntriesButton from './DeleteEntriesButton'\nimport Quantity from '../Quantity'\nimport EditMetaDataDialog from './EditMetaDataDialog'\nimport {authorList, formatTimestamp, pluralize} from '../../utils'\nimport { useUploadPageContext } from './UploadPageContext'\nimport { defaultFilterData } from '../search/FilterRegistry'\n\nconst columns = [\n {\n key: 'entry_name',\n label: 'Name',\n align: 'left',\n sortable: false,\n render: entry => \n },\n {key: 'entry_type', align: 'left', sortable: false, label: 'Type'},\n {\n key: 'mainfile',\n align: 'left',\n render: entry => \n },\n {\n key: 'entry_id',\n align: 'left',\n sortable: false,\n render: entry => \n },\n {key: 'parser_name', align: 'left'},\n {key: 'authors', align: 'left', render: row => authorList(row)},\n {key: 'process_status', align: 'left'},\n {\n label: 'Modified',\n key: 'complete_time',\n align: 'left',\n sortable: false,\n render: entry => formatTimestamp(entry.complete_time)\n },\n {key: 'comment', sortable: false, align: 'left'},\n {\n key: 'references',\n sortable: false,\n align: 'left',\n render: row => {\n const refs = row.references || []\n if (refs.length > 0) {\n return (\n
\n {refs.map((ref, i) => \n {ref}{(i + 1) < refs.length ? ', ' : }\n )}\n
\n )\n } else {\n return no references\n }\n }\n },\n {\n key: 'datasets',\n align: 'left',\n sortable: false,\n render: entry => {\n const datasets = entry.datasets || []\n if (datasets.length > 0) {\n return datasets.map(dataset => dataset.dataset_name).join(', ')\n } else {\n return no datasets\n }\n }\n }\n]\n\naddColumnDefaults(columns, defaultFilterData)\n\nconst defaultSelectedColumns = [\n 'entry_name',\n 'entry_type',\n 'mainfile',\n 'process_status'\n]\n\nexport default function ProcessingTable(props) {\n const [selected, setSelected] = useState(new Set())\n const {pagination, customTitle} = props\n const {upload, isEditable} = useUploadPageContext()\n\n const selectedQuery = useMemo(() => {\n if (selected === 'all') {\n return {'upload_id': upload.upload_id}\n }\n\n return {entry_id: [...selected]}\n }, [selected, upload])\n\n return \n option.entry_id} onSelectedChanged={setSelected}\n >\n \n \n \n {isEditable &&\n }\n {isEditable &&\n }\n \n \n \n \n \n \n \n}\nProcessingTable.propTypes = {\n data: PropTypes.arrayOf(PropTypes.object).isRequired,\n pagination: PropTypes.object.isRequired,\n onPaginationChanged: PropTypes.func.isRequired,\n customTitle: PropTypes.string\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useEffect, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles, Typography, Button, TextField } from '@material-ui/core'\nimport EditIcon from '@material-ui/icons/Edit'\nimport WithButton from '../utils/WithButton'\n\n/**\n * Displays the upload name and controls for updating it.\n */\nconst useStyles = makeStyles(theme => ({\n row: {\n display: 'flex',\n alignItems: 'center',\n '& :not(:first-child)': {\n marginLeft: theme.spacing(2)\n }\n }\n}))\n\nexport const UploadName = React.memo(({upload_name, onChange}) => {\n const [edit, setEdit] = useState(false)\n const [value, setValue] = useState()\n const styles = useStyles()\n\n // Any changes to the upload name through the prop override the shown value.\n useEffect(() => {\n setValue(upload_name)\n }, [upload_name])\n\n // The upload name is trimmed, and an untouched input field is considered as\n // an empty string. Currently the only way to unset upload name is to post an\n // empty string, posting 'undefined' gives an error.\n const handleSave = useCallback(() => {\n setEdit(false)\n const trimmedValue = value?.trim() || ''\n onChange && onChange(trimmedValue)\n setValue(trimmedValue)\n }, [onChange, value])\n\n const handleEdit = useCallback(() => {\n setEdit(true)\n }, [])\n\n const handleChange = useCallback((event) => {\n setValue(event.target.value)\n }, [])\n\n return edit\n ?
\n \n \n
\n : } onClick={handleEdit}>\n \n {value || unnamed upload}\n \n \n})\nUploadName.propTypes = {\n upload_name: PropTypes.string,\n onChange: PropTypes.func\n}\n\nexport default UploadName\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isEmpty } from 'lodash'\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Divider } from '@material-ui/core'\nimport { MenuBarItem, MenuBarList, MenuBarMenu } from './MenuBar'\n\nconst MenuBarRoute = React.memo(({\n menu,\n label,\n initialFilters,\n children\n}) => {\n let filters = initialFilters && Object.entries(initialFilters).length > 0 && Object.entries(initialFilters).map(x => x.join('=')).join('&')\n filters = filters ? `?${filters}` : ''\n if (!menu.menu) return null\n // Gather all categories for the items in this menu\n const categories = {}\n menu.routes\n .filter(item => item.category)\n .forEach(item => {\n if (!categories[item.category]) categories[item.category] = []\n categories[item.category].push(item)\n })\n\n // Items without a category are laid out linearly\n let content\n if (isEmpty(categories)) {\n content = menu.routes.filter(route => route.menu).map((itemRoute, i) => (\n \n ))\n // Categorized items are laid out in columns\n } else {\n content = Object.entries(categories).map(([category, values], index) => {\n return
\n {index ? : null}\n \n {values.map(item => (\n \n ))}\n \n
\n })\n }\n\n return \n {content}\n \n})\n\nMenuBarRoute.propTypes = {\n menu: PropTypes.object.isRequired,\n label: PropTypes.string.isRequired,\n // The 'initialFilters' property is optional and should be a object representing\n // the initial set of filters for the menu. For ex, it could be set to '{upload_id:abc}'\n // to preselect items based on the 'upload_id' parameter with the value 'abc'\n initialFilters: PropTypes.object,\n children: PropTypes.node\n}\n\nexport default MenuBarRoute\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { routes } from '../nav/Routes'\nimport MenuBarRoute from '../nav/MenuBarRoute'\nimport SearchIcon from '@material-ui/icons/Search'\n\nconst UploadSearchMenu = React.memo(({\n uploadId\n}) => {\n const filteredMenus = routes.filter((menu) => menu.menu === 'Explore')\n if (filteredMenus.length !== 1) {\n return null\n }\n const menu = filteredMenus[0]\n return (\n \n \n \n )\n})\n\nUploadSearchMenu.propTypes = {\n uploadId: PropTypes.string.isRequired\n}\n\nexport default UploadSearchMenu\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Accordion, AccordionDetails, AccordionSummary, Box, Button, Checkbox, Dialog,\n DialogContent, DialogTitle, FormControl, FormHelperText, Grid, IconButton, Input,\n InputLabel, Link, makeStyles, MenuItem, Select, Step, StepContent, StepLabel, Stepper,\n Tooltip, Typography\n} from '@material-ui/core'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport DialogContentText from '@material-ui/core/DialogContentText'\nimport FormControlLabel from '@material-ui/core/FormControlLabel'\nimport ReprocessIcon from '@material-ui/icons/Autorenew'\nimport DownloadIcon from '@material-ui/icons/CloudDownload'\nimport UploadIcon from '@material-ui/icons/CloudUpload'\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore'\nimport MembersIcon from '@material-ui/icons/Group'\nimport ReloadIcon from '@material-ui/icons/Replay'\nimport PropTypes from 'prop-types'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { useDropzone } from 'react-dropzone'\nimport { appBase, oasis } from '../../config'\nimport { formatTimestamp } from '../../utils'\nimport { CodeList } from '../About'\nimport { useDataStore } from \"../DataStore\"\nimport Markdown from '../Markdown'\nimport Page from '../Page'\nimport { useApi } from '../api'\nimport { SourceApiCall, SourceApiDialogButton } from '../buttons/SourceDialogButton'\nimport { combinePagination } from '../datatable/Datatable'\nimport Download from '../entry/Download'\nimport { useErrors } from '../errors'\nimport DialogLink from '../utils/DialogLink'\nimport WithButton from '../utils/WithButton'\nimport CreateEntry from './CreateEntry'\nimport DeleteUploadsButton from './DeleteUploadsButton'\nimport EditMembersDialog from './EditMembersDialog'\nimport EditMetaDataDialog from './EditMetaDataDialog'\nimport FilesBrower from './FilesBrowser'\nimport ProcessingTable from './ProcessingTable'\nimport UploadName from './UploadName'\nimport { useUploadPageContext } from './UploadPageContext'\nimport UploadProgressDialog from './UploadProgressDialog'\nimport UploadSearchMenu from './UploadSearchMenu'\nimport UploadStatusIcon from './UploadStatusIcon'\n\nconst useDropButtonStyles = makeStyles(theme => ({\n dropzone: {\n width: '100%'\n },\n dropzoneAccept: {\n '& button': {\n background: theme.palette.secondary.main,\n color: theme.palette.common.white\n }\n },\n dropzoneReject: {\n '& button': {\n background: theme.palette.error.main,\n color: theme.palette.common.white\n }\n }\n}))\n\nfunction DropButton({onDrop, ...buttonProps}) {\n const classes = useDropButtonStyles()\n const {getRootProps, getInputProps, isDragAccept, isDragReject} = useDropzone({onDrop})\n const className = (isDragAccept && classes.dropzoneAccept) || (isDragReject && classes.dropzoneReject) || classes.dropzone\n return (\n
\n
\n \n }\n {...buttonProps}\n >\n Drop files here or click to open dialog\n \n
\n
\n )\n}\nDropButton.propTypes = {\n onDrop: PropTypes.func\n}\n\nfunction EmbargoSelect({embargo, onChange, disabledReason}) {\n return \n \n Embargo period\n \n onChange(event.target.value)}\n input={}\n displayEmpty\n name=\"embargo\"\n disabled={!!disabledReason}\n >\n \n No embargo\n \n 3\n 6\n 12\n 24\n 36\n \n \n {disabledReason ||\n (embargo > 0 ? 'months before the data becomes public' : 'publish without embargo')}\n \n \n}\n\nEmbargoSelect.propTypes = {\n embargo: PropTypes.number,\n onChange: PropTypes.func,\n disabledReason: PropTypes.string\n}\n\nfunction PublishUpload({upload, onPublish, isVisibleForAll}) {\n const [embargo, setEmbargo] = useState(upload.embargo_length === undefined ? 0 : upload.embargo_length)\n const [openConfirmDialog, setOpenConfirmDialog] = useState(false)\n const handlePublish = () => {\n setOpenConfirmDialog(false)\n onPublish({embargo_length: embargo, to_central_nomad: false})\n }\n\n useEffect(() => {\n if (isVisibleForAll) {\n setEmbargo(0)\n }\n }, [isVisibleForAll])\n\n if (upload.published) {\n return {`\n This upload has already been published.\n `}\n }\n\n const buttonLabel = embargo > 0 ? 'Publish with embargo' : 'Publish'\n\n return \n setOpenConfirmDialog(false)}\n >\n Confirm that you want to publish the upload\n \n \n You are about the publish this upload. The upload cannot be removed and\n the files and entries in this upload cannot be changed after publication.\n \n \n \n \n \n \n \n {`\n If you agree this upload will be published and move out of your private staging\n area into the public NOMAD. This step is final. All public data will be made available under the Creative\n Commons Attribution license ([CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)).\n\n If you wish, you can put an embargo on your data. This makes some metadata (e.g.\n chemical formula, system type, spacegroup, etc.) public, but the raw-file\n and archive contents remain hidden (except to you, and users you explicitly\n share the data with).\n You can already create datasets and assign DOIs for data with embargo, e.g.\n to put it into your unpublished paper.\n The embargo will last up to 36 month. Afterwards, your data will be made publicly\n available. You can also lift the embargo sooner if you wish.\n `}\n \n \n \n \n \n \n \n setOpenConfirmDialog(true)} color=\"primary\"\n disabled={upload.process_running}\n data-testid='publish-upload-button'\n >\n {buttonLabel}\n \n \n \n \n \n \n}\nPublishUpload.propTypes = {\n upload: PropTypes.object,\n onPublish: PropTypes.func,\n isVisibleForAll: PropTypes.bool\n}\n\nfunction PublishUploadExternally({upload, onPublish, isPublished, isVisibleForAll}) {\n const [embargo, setEmbargo] = useState(upload.embargo_length === undefined ? 0 : upload.embargo_length)\n const [openConfirmDialog, setOpenConfirmDialog] = useState(false)\n const handlePublish = () => {\n setOpenConfirmDialog(false)\n onPublish({embargo_length: embargo, to_central_nomad: true})\n }\n\n useEffect(() => {\n if (isVisibleForAll) {\n setEmbargo(0)\n }\n }, [isVisibleForAll])\n\n if (upload?.published_to?.find(server => server === 'https://nomad-lab.eu/prod/v1/api')) {\n return {`\n This upload has already been published to central NOMAD.\n `}\n }\n\n const buttonLabel = 'Publish to Central NOMAD'\n\n return \n setOpenConfirmDialog(false)}\n >\n Confirm that you want to publish the upload to central NOMAD\n \n \n You are about to publish this upload to central NOMAD.\n \n \n Please note that this upload will be published under the pre-configured account of this OASIS, which may or\n may not be your current account.\n \n \n The upload will be published to the central NOMAD with the chosen embargo period. Please check the central\n NOMAD for the status of the upload.\n If this upload is already published, this action has no effect.\n \n \n \n \n \n \n \n \n After publishing locally on this OASIS. You can choose to publish this upload to the central NOMAD.\n \n \n \n \n \n \n \n \n setOpenConfirmDialog(true)} color=\"primary\"\n disabled={!isPublished}\n data-testid='publish-upload-externally-button'\n >\n {buttonLabel}\n \n \n \n \n \n \n}\n\nPublishUploadExternally.propTypes = {\n upload: PropTypes.object,\n onPublish: PropTypes.func,\n isPublished: PropTypes.bool,\n isVisibleForAll: PropTypes.bool\n}\n\nfunction ProcessingStatus({data}) {\n const {pagination, upload, processing_successful, processing_failed} = data\n let mainMessage = null\n if (upload.process_running) {\n mainMessage = 'Processing ...'\n } else {\n if (upload.process_status === 'SUCCESS') {\n mainMessage = 'Processing completed'\n } else if (upload.process_status === 'FAILURE') {\n mainMessage = 'Processing failed ' + upload.errors.join(', ')\n } else {\n mainMessage = 'Waiting for processing ...'\n }\n }\n return \n \n {mainMessage}, {processing_successful}/{pagination?.total} entries processed{(processing_failed > 0) && `, ${processing_failed} failed`}\n \n \n}\nProcessingStatus.propTypes = {\n data: PropTypes.object\n}\n\nconst useStyles = makeStyles(theme => ({\n stepper: {\n backgroundColor: 'inherit',\n paddingLeft: 0,\n paddingRight: 0\n },\n stepContent: {\n marginBottom: theme.spacing(2)\n },\n mixedButtonIcon: {\n fontSize: '150%',\n marginRight: theme.spacing(1)\n }\n}))\n\nexport function SupportedCodes({children}) {\n return \n \n For the following codes, we support automatic parsing of data into\n entries: . Click the code to get more\n specific information about how to prepare your files.\n \n \n}\nSupportedCodes.propTypes = {\n children: PropTypes.node\n}\n\nexport function UploadDocumentation({children}) {\n return \n {children}\n \n}\nUploadDocumentation.propTypes = {\n children: PropTypes.node\n}\n\nexport function SchemaDocumentation({children}) {\n return \n {children}\n \n}\nSchemaDocumentation.propTypes = {\n children: PropTypes.node\n}\n\nfunction UploadOverview(props) {\n const classes = useStyles()\n const dataStore = useDataStore()\n const {api, user} = useApi()\n const {raiseError} = useErrors()\n const {\n uploadId, upload, entries, apiData, hasUpload, isProcessing, error, isVisibleForAll,\n isWriter, pagination, deleteRequested, updateUpload, requestRefreshUpload,\n isMainAuthor} = useUploadPageContext()\n const [uploading, setUploading] = useState(null)\n const [openEmbargoConfirmDialog, setOpenEmbargoConfirmDialog] = useState(false)\n const [readme, setReadme] = useState(null)\n const [openEditMembersDialog, setOpenEditMembersDialog] = useState(false)\n\n const handleIsVisibleForAll = useCallback((event) => {\n const action = event.target.checked ? 'add' : 'remove'\n api.post(`/uploads/${uploadId}/edit`, {metadata: {\n 'reviewer_groups': { [action]: 'all'}\n }})\n .then(requestRefreshUpload)\n .catch(raiseError)\n }, [api, requestRefreshUpload, raiseError, uploadId])\n\n useEffect(() => {\n if (uploading) return\n dataStore.breadcrumb.setUpload(upload?.upload_name || 'Upload')\n api.get(`/uploads/${uploadId}/raw/README.md`)\n .then(setReadme)\n .catch(error => {\n setReadme(null)\n if (error.name !== 'DoesNotExist') {\n raiseError(error)\n }\n })\n }, [api, raiseError, uploadId, uploading, setReadme, dataStore.breadcrumb, upload?.upload_name])\n\n const handleDropFiles = useCallback(files => {\n if (!files[0]?.name) {\n return // Not dropping a file, but something else. Ignore.\n }\n const formData = new FormData() // eslint-disable-line no-undef\n for (const file of files) {\n formData.append('file', file)\n }\n setUploading(0)\n api.put(`/uploads/${uploadId}/raw/`, formData, {\n onUploadProgress: (progressEvent) => {\n const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)\n setUploading(percentCompleted)\n }\n })\n .then(results => updateUpload({upload: results.data}))\n .catch(raiseError)\n .finally(() => {\n setUploading(null)\n })\n }, [uploadId, updateUpload, setUploading, api, raiseError])\n\n const handleNameChange = (upload_name) => {\n api.post(`/uploads/${uploadId}/edit`, {metadata: {upload_name: upload_name}})\n .then(() => requestRefreshUpload())\n .catch(raiseError)\n }\n\n const handlePublish = ({embargo_length, to_central_nomad}) => {\n api.post(`/uploads/${uploadId}/action/publish?embargo_length=${embargo_length}&to_central_nomad=${to_central_nomad}`)\n .then(results => updateUpload({upload: results.data}))\n .catch(raiseError)\n }\n\n const handleLiftEmbargo = () => {\n setOpenEmbargoConfirmDialog(false)\n api.post(`/uploads/${uploadId}/edit`, {metadata: {embargo_length: 0}})\n .then(() => requestRefreshUpload())\n .catch(raiseError)\n }\n\n const handleReload = () => {\n requestRefreshUpload()\n }\n\n const handleReprocess = () => {\n api.post(`/uploads/${uploadId}/action/process`)\n .then(results => updateUpload({upload: results.data}))\n .catch(raiseError)\n }\n\n const handleDelete = () => {\n api.delete(`/uploads/${uploadId}`)\n .then(results => updateUpload({upload: results.data}))\n .catch(raiseError)\n }\n\n if (!hasUpload || !entries) {\n return \n {(error ? {error.apiMessage || error.message || 'Failed to load'} : loading ...)}\n \n }\n\n const isAuthenticated = api.keycloak.authenticated\n const isPublished = upload.published\n const isEmpty = upload.entries === 0\n\n return (\n \n \n \n \n \n \n \n \n \n upload id: {uploadId}\n \n \n \n \n \n setOpenEditMembersDialog(true)}\n disabled={!isWriter || isProcessing}\n data-testid='edit-members-action'\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {readme && (\n \n \n }>\n README.md\n \n \n {readme}\n \n \n \n )}\n \n \n Prepare and upload your files\n \n {isPublished && \n This upload is published and it's files can't be modified anymore.\n }\n {!isPublished && isAuthenticated && isWriter && (\n \n \n Here you can upload files. Top-level .zip/.tar files will be uncompressed automatically. For more information,\n see our documentation on uploading\n files or view the supported codes.\n Optionally, you can also create an entry from built-in or\n uploaded schemas. Please take a look at our documentation on schemas.\n \n \n \n \n \n \n \n Create from schema\n \n \n \n \n )}\n
\n \n
\n
\n
\n \n Process data\n \n \n ({...entry.entry_metadata, ...entry}))}\n pagination={combinePagination(pagination, apiData.response?.pagination)}\n customTitle='entry'\n onPaginationChanged={newPagination => updateUpload({pagination: newPagination})}/>\n \n \n {(isAuthenticated && isWriter) && \n Edit visibility and access\n \n \n }\n />\n \n You can edit the access to the upload by adding or removing users as upload members.\n \n setOpenEditMembersDialog(true)}\n variant='contained'\n color='primary'\n disabled={isProcessing}\n >\n Edit upload members\n \n \n }\n {(isAuthenticated && isWriter) && \n Edit metadata\n \n \n You can add more information about your data, like comments,\n references (e.g. links to publications). You can also create\n datasets from your entries.\n \n \n You can either select and edit individual entries from the list above, or\n edit all entries at once.\n \n {!isEmpty && }\n \n }\n {(isAuthenticated && isWriter) && \n Publish\n \n {isPublished && \n {upload?.with_embargo ? `This upload has been published under embargo with a period of ${upload?.embargo_length} months from ${formatTimestamp(upload?.publish_time)}.`\n : `This upload has already been published.`}\n }\n {!isPublished && }\n {isPublished && upload?.with_embargo && upload?.embargo_length > 0 &&\n }\n \n \n \n You are about lifting the embargo. The data will be publicly accessible.\n \n \n \n \n \n \n \n \n }\n {(isAuthenticated && isWriter && oasis) && \n Publish to central NOMAD\n \n \n \n }\n
\n
\n )\n}\n\nexport default UploadOverview\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useEffect, useState, useMemo, useContext, useRef} from 'react'\nimport PropTypes from 'prop-types'\nimport Markdown from '../Markdown'\nimport {\n Paper, IconButton, Tooltip, Typography,\n Box, Divider, makeStyles\n} from '@material-ui/core'\nimport ClipboardIcon from '@material-ui/icons/Assignment'\nimport { HelpButton } from '../Help'\nimport { CopyToClipboard } from 'react-copy-to-clipboard'\nimport { guiBase, servicesUploadLimit } from '../../config'\nimport NewUploadButton from './NewUploadButton'\nimport ExampleUploadButton from './ExampleUploadButton'\nimport { useApi, withLoginRequired } from '../api'\nimport Page from '../Page'\nimport { useErrors } from '../errors'\nimport DetailsIcon from '@material-ui/icons/ArrowForward'\nimport { UploadButton } from '../nav/Routes'\nimport {\n addColumnDefaults, combinePagination, Datatable, DatatablePagePagination,\n DatatableTable, DatatableToolbar, DatatableToolbarActions\n} from '../datatable/Datatable'\nimport TooltipButton from '../utils/TooltipButton'\nimport ReloadIcon from '@material-ui/icons/Replay'\nimport Quantity from '../Quantity'\nimport { SourceApiCall, SourceApiDialogButton } from '../buttons/SourceDialogButton'\nimport { useHistory } from 'react-router-dom'\nimport DeleteUploadsButton from './DeleteUploadsButton'\nimport UploadStatusIcon from './UploadStatusIcon'\nimport { formatTimestamp } from '../../utils'\nimport { SupportedCodes, UploadDocumentation } from './UploadOverview'\nimport { defaultFilterData } from '../search/FilterRegistry'\n\nexport const help = `\nNOMAD allows you to upload data. After upload, NOMAD will process your data: it will\nidentify parseable files (*mainfiles*) and parse these.\nThe result will be a list of entries (one per identified mainfile).\nEach entry is associated with metadata. This is data that NOMAD acquired from your files and that\ndescribe your entry (e.g. chemical formula, used code, system type and symmetry, etc.).\nFurthermore, you can provide your own metadata (comments, references, co-authors, etc.).\nWhen an upload is created, it is created in the *staging area*, and it will only be visible\nto you (the main author). You can add other users as *co-authors*. They will be listed\nas co-authors of the upload and all its entries, and they can view and edit the upload.\nYou can also add *reviewers*, which are users who are allowed the view the upload. No\nother users can see your data until you *publish* the upload.\n\n#### Prepare and upload files\n\nWhile the upload is in the staging area, you and the co-authors can add and remove files\nto it. You can upload plain files, or \\`*.zip\\` or \\`*.tar.gz\\` archives. We encourage you\nto add all input and output files, as well as any other auxiliary files that you might\nhave created, and to organize your files in a folder structure. Ideally, you should have a\nseparate directory for each entry, as NOMAD considers all files located in a directory where\nthere is a mainfile to be auxiliary files to this entry. If users want to download an entry,\nthey can download all files in the directory where the entry's mainfile is located. The\ndirectory structure can be nested.\n\nDrop your archive file(s) on the dropbox. You can also click the dropbox to select a file from\nyour hard drive. Alternatively, you can upload files via the given shell command.\nReplace \\`\\` with your archive file. After executing the command,\nreturn here and press the reload button below).\n\n### Limits\n\nThere is a limit of 10 unpublished uploads per user. Please accumulate all data into as\nfew uploads as possible. But, there is a also an upper limit of 32 GB per upload.\nPlease upload multiple archives, if you have more than 32 GB of data to upload.\nOnly uploads with at least one recognized entry can be published.\n\n#### The uploads page\n\nHere you will find all your unpublished and published uploads. You can see the\nprogress on the processing, you can review your uploads, and publish or delete them.\n\nClick on an upload to see more details about its contents. Click on processed entries\nto see their metadata, archive data, and a processing log. In the details view, you also\nfind buttons for editing user metadata, deleting uploads, and publishing uploads. Entries\ncannot be published individually, only the upload as a whole, with all its entries, can be published.\n\n#### Publishing and embargo\n\nWhen you publish, you can set an *embargo* or publish your data as *Open Access* right away.\nThe embargo allows you to share data with selected users, create a DOI for your data, etc,\nbefore the full upload data is made public. The embargo might last up to 36 months, and when\nit expires the data becomes public automatically. While embargoed, some metadata (and datasets\ncreated from this data) are publicly visible and findable, but only you and users you share\nthe upload with (i.e. users added as co-authors or reviewers) can view and download the raw\ndata and archive.\n\n#### Processing errors\n\nWe distinguish between uploads that fail processing completely and uploads that contain\nentries that could not be processed. The former might be caused by issues during the\nupload, bad file formats, etc. The latter (far more common) case means that not all of the\nidentified mainfiles could be parsed. The processing logs of the failed entries might\nprovide some insight.\n\nYou cannot publish uploads that failed processing completely. In most\ncases they wouldn't have any entries to publish anyway. In the case of failed processing of\nsome entries however, the data can still be published. You will be able to share it and create\nDOIs for it, etc. The only shortcomings will be missing metadata (labeled *not processed*\nor *unavailable*) and missing archive data. We continuously improve our parsers and\nthe now missing information might become available in the future automatically.\n\n#### Co-Authors, References, Comments, Datasets, DOIs\n\nYou can edit additional *user metadata*. Some of these fields are set on the upload level,\nothers on the entry level. You can select and edit many entries at once. Edit buttons for\nuser metadata are available in many views on this web-page. For example, you can edit user\nmetadata when you click on an upload to open its details, and press the edit button there.\nThe metadata fields cannot be changed after the upload has been published (except for dataset members).\nThe documentation on the [user data page](${guiBase}/userdata) contains more information.\n`\nexport const uploadsPageContext = React.createContext()\nexport function useUploadsPageContext() {\n return useContext(uploadsPageContext)\n}\n\nconst useUploadCommandStyles = makeStyles(theme => ({\n root: {\n width: '100%'\n },\n commandContainer: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center'\n },\n commandMarkup: {\n flexGrow: 1,\n marginRight: theme.spacing(1),\n overflow: 'hidden'\n }\n}))\n\nfunction UploadCommands({uploadCommands}) {\n const classes = useUploadCommandStyles()\n\n return
\n
\n
\n {`\n \\`\\`\\`\n ${uploadCommands.upload_command}\n \\`\\`\\`\n `}\n
\n null}>\n \n \n \n \n \n \n \n \\`) (like in the\n examples above) or multi-part form data (\\`-X PUT -f file=@\\`):\n \\`\\`\\`\n ${uploadCommands.upload_command_form}\n \\`\\`\\`\n We generally recommend to use streaming, because form data can produce very\n large HTTP request on large files. Form data has the advantage of carrying\n more information (e.g. the file name) to our servers (see below).\n\n #### Upload names\n With multi-part form data (\\`-X PUT -f file=@\\`), your upload will\n be named after the file by default. With stream data (\\`-T \\`)\n there will be no default name. To set a custom name, you can use the URL\n parameter \\`name\\`:\n \\`\\`\\`\n ${uploadCommands.upload_command_with_name}\n \\`\\`\\`\n Make sure to user proper [URL encoding](https://www.w3schools.com/tags/ref_urlencode.asp)\n and shell encoding, if your name contains spaces or other special characters.\n `}/>\n \n
\n
\n}\n\nconst UploadActions = React.memo(function UploadActions({data}) {\n return \n \n \n \n \n})\nUploadActions.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nUploadCommands.propTypes = {\n uploadCommands: PropTypes.object.isRequired\n}\n\nexport function UploadsPage() {\n const {api, user} = useApi()\n const errors = useErrors()\n const [apiData, setApiData] = useState(null)\n const data = useMemo(() => apiData?.response, [apiData])\n const [unpublished, setUnpublished] = useState(null)\n const [uploadCommands, setUploadCommands] = useState(null)\n const [selected, setSelected] = useState(new Set())\n const fetchTimer = useRef(-1)\n const [pagination, setPagination] = useState({\n page_size: 10,\n page: 1,\n order_by: 'upload_create_time',\n order: 'desc'\n })\n const history = useHistory()\n\n const fetchData = useCallback(() => {\n const {page_size, page, order_by, order} = pagination\n const url = `/uploads?page_size=${page_size}&page=${page}&order_by=${(order_by === 'published' ? 'publish_time' : order_by)}&order=${order}`\n api.get(url, null, {returnRequest: true})\n .then(uploads => {\n setApiData(uploads)\n const deleteStatus = uploads.response.data.filter(upload => upload?.current_process === 'delete_upload' && (upload?.process_status === 'PENDING' || upload?.process_status === 'RUNNING'))\n if (deleteStatus.length === 0) {\n if (fetchTimer.current !== -1) {\n clearInterval(fetchTimer.current)\n }\n fetchTimer.current = -1\n } else {\n if (fetchTimer.current === -1) {\n fetchTimer.current = setInterval(fetchData, 2000)\n }\n }\n })\n .catch(errors.raiseError)\n api.get(`/uploads?is_published=false&roles=main_author&page_size=10000&order_by=${(order_by === 'published' ? 'publish_time' : order_by)}&order=${order}`)\n .then(response => {\n setUnpublished(response)\n })\n .catch(errors.raiseError)\n }, [pagination, setApiData, setUnpublished, errors, api])\n\n const handleReload = () => {\n fetchData()\n }\n\n // This history dependency makes sure that the uploads are reloaded after page navigating\n // back to the UploadsPage. E.g. if an upload was deleted on the UploadPage, we are\n // history.pushed back to the UploadsPage and want to reload the list of uploads.\n useEffect(() => {\n fetchData()\n return () => {\n if (fetchTimer.current !== -1) clearInterval(fetchTimer.current)\n fetchTimer.current = -1\n }\n }, [fetchData, history])\n\n const isDisabled = unpublished\n ? (unpublished.pagination ? unpublished.pagination.total >= servicesUploadLimit : false)\n : false\n\n useEffect(() => {\n api.get('/uploads/command-examples')\n .then(setUploadCommands)\n .catch(errors.raiseError)\n }, [api, errors, setUploadCommands])\n\n const selectedUploads = useMemo(() => selected === 'all'\n ? unpublished.data\n : data?.data?.filter(upload => selected.has(upload.upload_id)\n ), [data, selected, unpublished])\n\n // A map to store whether each of the upload object's main author is the current user\n const currentUserUploadsMap = useMemo(() => {\n const map = new Map()\n if (data && user) {\n data.data.forEach((d) => {\n map[d.upload_id] = d.main_author === user.sub\n })\n }\n return map\n }, [data, user])\n\n // boolean to disable the Delete button if any of the upload's main author is not the current user\n const disableDeleteButton = useMemo(() => {\n if (selected === 'all' && data) {\n return data.data.some(({upload_id}) => !currentUserUploadsMap[upload_id])\n } else {\n return Array.from(selected).some((id) => !currentUserUploadsMap[id])\n }\n }, [data, selected, currentUserUploadsMap])\n\n const deleteUploads = useCallback(() => {\n const promises = selectedUploads.map(upload => api.delete(`uploads/${upload.upload_id}`))\n return Promise.allSettled(promises)\n }, [selectedUploads, api])\n\n const handleDeleteSubmitted = useCallback(() => {\n deleteUploads().then(responses => {\n responses.forEach((response) => {\n if (response.status === 'fulfilled') {\n // No error occurred\n } else if (response.status === 'rejected') {\n errors.raiseError(new Error(response.reason.apiMessage))\n } else {\n errors.raiseError(new Error('Unexpected error!'))\n }\n })\n setSelected(new Set([]))\n fetchData()\n })\n }, [deleteUploads, errors, fetchData])\n\n // Setup columns\n const columns = useMemo(() => {\n const columns = [\n {\n key: 'upload_create_time',\n render: upload => formatTimestamp(upload.upload_create_time)\n },\n {key: 'upload_name'},\n {\n key: 'upload_id',\n render: upload => \n },\n {key: 'last_status_message', label: 'Status'},\n {key: 'entries', render: upload => upload.entries, align: 'center'},\n {key: 'published', render: upload => , align: 'center'}\n ]\n addColumnDefaults(columns, {align: 'left'}, defaultFilterData)\n return columns\n }, [user])\n\n return (\n \n \n \n You can either create an upload and upload files through the browser:\n \n \n \n \n or\n \n \n {isDisabled && \n You have reached maximum number of unpublished uploads!\n }\n \n \n \n \n Or, you can create an upload by sending a file-archive via shell command:\n \n \n \n {uploadCommands && }\n \n \n \n Visit our documentation on uploading files or show supported codes.\n \n \n {(data?.pagination?.total || 0) > 0 && \n \n \n \n \n column.key)}\n sortingColumns={['upload_create_time', 'upload_name', 'last_status_message', 'published']}\n data={data.data || []}\n pagination={combinePagination(pagination, data.pagination)}\n onPaginationChanged={setPagination}\n selected={selected}\n getId={option => option.upload_id}\n onSelectedChanged={setSelected}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n }\n \n )\n}\n\nexport default withLoginRequired(UploadsPage)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport { ui } from '../config'\nimport { cloneDeep } from 'lodash'\nimport { withLoginRequired } from './api'\nimport { SearchContext } from './search/SearchContext'\nimport SearchPage from './search/SearchPage'\n\nexport const help = `\nThis page allows you to **inspect** and **manage** your own data. It is similar to the\n*entry search page*, but it will only show data that was uploaded by you or is shared with you.\n\nBesides giving you a filter for your data, this page also allows you to edit the *user metadata*\non all entries. User metadata is assigned to individual entries, but of course you can\nedit many entries at once. User metadata comprises comments, references, datasets, co-authors,\nand users to share data with.\n\n#### Selecting entries for edit\n\nYou can use the search in combination with the entries, dataset, or uploads table to\nhelp select sets of entries that you like to edit. If you select individual entries,\nonly these entries will be edit. If you select all entries, all entries fitting your\nsearch (including those\n on further pages) will be edited. If you hit edit on datasets or uploads all entries\n in these dataset or upload will be edited.\n\n#### The edit user metadata dialog\n\nIf you click an edit button, a dialog will appear. It is pre-filled with the values of\nthe first selected entry. However, the settings will be applied to all selected entries,\npotentially overwriting existing data. Only those settings that you change will be applied.\nFor example, if you only set a new comment, only the comments on all entries will be overwritten.\nIf you add a co-author, you changed the co-authors and all co-authors on all entries will be\nset with the new authors.\n\n#### Datasets\n\nThe edit dialog also allows you to put entries into datasets. Just enter the name of\nan existing or new dataset. We only consider datasets with data. You should never see\nan empty dataset. Entries can be put into many datasets. There is no explicit hierarchy\nbetween datasets, but of course you can effectively form super-sets by assigning entries\nrespectively.\n\nTo remove entries from datasets, simple set the list of datasets for those entries to a\nlist that is empty or does not contain the respective dataset anymore. If you remove\nall entries from a dataset like this, it will effectively disappear. You can also\ndelete datasets from the dataset table with the delete button. The dataset will be removed\nfrom the dataset list of all its current entries.\n\n#### DOIs\n\nOn the dataset table, you can also click the DOI button to assign a DOI to a dataset.\nThis DOI can be used in publications to link to your dataset. If people resovle the\nDOI, they will be redirected to a NOMAD view that shows the dataset and allows its download.\n\nOnce you assigned a DOI to a dataset, no entries can be removed or added to the dataset.\n`\n\n// Use the same context as in the global entries search, but with free-text\n// query enabled\nconst context = cloneDeep(ui?.apps?.options?.entries)\ncontext.search_syntaxes.exclude = undefined\n\nconst initialFiltersLocked = {\n 'visibility': 'user'\n}\nconst UserdataPage = React.memo(() => {\n return \n \n \n})\n\nexport default withLoginRequired(UserdataPage, 'Please login to search your data.')\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { React, useEffect, useState } from 'react'\n\nimport { addSeconds, endOfDay, format, formatDistanceToNow, getUnixTime, isValid,\n subDays } from \"date-fns\"\nimport { Box, IconButton, Tooltip, makeStyles } from '@material-ui/core'\nimport ClipboardIcon from '@material-ui/icons/Assignment'\nimport { DatePicker } from '@material-ui/pickers'\nimport { CopyToClipboard } from 'react-copy-to-clipboard'\nimport { useKeycloak } from '@react-keycloak/web'\nimport { LoginRequired, useApi } from './api'\nimport { appTokenMaxExpiresIn } from '../config'\nimport { useErrors } from './errors'\n\nconst useStyles = makeStyles({\n root: {\n padding: 0\n }\n})\n\nexport default function AppTokenForm() {\n const classes = useStyles()\n const {keycloak} = useKeycloak()\n const {api} = useApi()\n const errors = useErrors()\n\n const [error, setError] = useState()\n const [dateValue, setDateValue] = useState(new Date())\n const [token, setToken] = useState()\n\n let maxDate = subDays(addSeconds(new Date(), appTokenMaxExpiresIn), 1)\n if (!isValid(maxDate)) maxDate = undefined\n\n useEffect(() => {\n if (error) setError(undefined)\n\n const expiresAt = endOfDay(dateValue)\n const expiresInS = getUnixTime(expiresAt) - getUnixTime(new Date())\n api.get(`/auth/app_token?expires_in=${expiresInS}`)\n .then((response) => {\n setToken(response.app_token)\n })\n .catch((exception) => {\n setToken(undefined)\n\n if (exception.status !== 422) {\n if (exception.status !== 401) {\n errors.raiseError(exception)\n }\n return\n }\n\n const limitExpiresInS = exception.apiMessage[0].ctx.limit_value\n const limitExpiresAt = subDays(addSeconds(new Date(), limitExpiresInS), 1)\n setError(`Choose not later than ${format(limitExpiresAt, 'yyyy-MM-dd')} ` +\n `(in ${formatDistanceToNow(limitExpiresAt)}).`)\n })\n }, [dateValue, api, setToken, error, errors])\n\n const handleDateChange = value => setDateValue(value)\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { makeStyles } from '@material-ui/core'\nimport React from 'react'\nimport { apiBase, appBase } from '../config'\nimport Markdown from './Markdown'\nimport AppTokenForm from './AppTokenForm'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3),\n maxWidth: 1024,\n margin: 'auto',\n width: '100%'\n }\n}))\n\nexport default function About() {\n const classes = useStyles()\n\n return
\n {`\n # APIs\n\n NOMAD's Application Programming Interface (API) allows you to access NOMAD data\n and functions programatically. For all APIs, we offer dashboards that let you use\n each API interactively, right in your browser.\n\n ## NOMAD's API\n\n - [API dashboard](${apiBase}/v1/extensions/docs)\n - [API documentation](${apiBase}/v1/extensions/redoc)\n\n We started to implement a more consise and easier to use API for access NOMAD\n data. This will step-by-step reimplement all functions of NOMAD's old main API.\n At some point, it will replace it entirely. For new users, we recommend to start\n using this API. API Dashboard and documentation contain a tutorial on how to get started.\n\n There is a [tutorial on how to use the API with plain Python](${appBase}/docs/api_tutorial.html).\n Another [tutorial covers how to install and use NOMAD's Python client library](${appBase}/docs/archive_tutorial.html).\n The [NOMAD Analytics Toolkit](https://nomad-lab.eu/AIToolkit) allows to use\n this without installation and directly on NOMAD servers.\n\n ### App token\n\n Next to the usual access token based on OpenID Connect, we provide an\n [app token](${appBase}/docs/apis/api.html#app-token) with custom expiration date.\n You may request one via the [API](${apiBase}/v1/extensions/docs) or the following form:\n `}\n\n \n\n {`\n\n ### Old API\n\n You can still use NOMAD's old REST API. The data it provides might miss the most\n recent contributions:\n\n - [v0 API dashboard](https://nomad-lab.eu/prod/rae/api/)\n\n ## OPTIMADE\n\n - [OPTIMADE API overview page](${appBase}/optimade/)\n - [OPTIMADE API dashboard](${appBase}/optimade/v1/extensions/docs)\n - [OPTIMADE API documentation](${appBase}/optimade/v1/extensions/redoc)\n\n [OPTIMADE](https://www.optimade.org/) is an\n open API standard for materials science databases. This API can be used to search\n and access NOMAD metadata in a standardized way that can also be applied to many\n [other materials science databses](https://providers.optimade.org/).\n\n ## DCAT\n\n - [DCAT API dashboard](${appBase}/dcat/)\n\n [DCAT](https://www.w3.org/TR/vocab-dcat-2/) is a RDF vocabulary designed to facilitate\n interoperability between data catalogs published on the Web. This API allows you\n access to NOMAD via RDF documents following DCAT. You can access NOMAD entries as\n DCAT Datasets or all NOMAD entries as a DCAT Catalog.\n\n ## Resources\n\n - [Resources API dashboard](${appBase}/resources/extensions/docs)\n\n The resources API provides links from NOMAD entries to related external resources.\n These include the [Aflow Encyclopedia of Crystallographic Prototypes](https://www.aflowlib.org/prototype-encyclopedia/),\n [Springer Materials Database of Inorganic Solid Phases](https://materials.springer.com)\n and [OPTIMADE providers](https://providers.optimade.org/).\n `}\n
\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useMemo, useState } from 'react'\nimport { Typography, Link, makeStyles } from '@material-ui/core'\nimport { useHistory, useLocation } from 'react-router'\nimport qs from 'qs'\nimport { useApi } from '../api'\nimport { useErrors } from '../errors'\nimport { getUrl } from '../nav/Routes'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3)\n }\n}))\n\nexport default function EntryQuery(props) {\n const classes = useStyles()\n const history = useHistory()\n const location = useLocation()\n const {api} = useApi()\n const {raiseError} = useErrors()\n\n const [doesNotExist, setDoesNotExist] = useState(false)\n\n const queryParams = useMemo(() => qs.parse(location.search.substring(1)), [location])\n\n useEffect(() => {\n api.get('/entries', {...queryParams})\n .then(response => {\n if (response.pagination.total > 0) {\n const {entry_id, upload_id} = response.data[0]\n history.push(getUrl(`entry/id/${upload_id}/${entry_id}`))\n } else {\n setDoesNotExist(true)\n }\n })\n .catch(raiseError)\n }, [history, api, raiseError, setDoesNotExist, queryParams])\n\n let message = 'loading ...'\n\n if (doesNotExist) {\n if (queryParams && queryParams['external_id'] && queryParams['external_id'].startsWith('mp-')) {\n message = \n This particular entry \n {queryParams['external_id']}\n has not yet been provided to NOMAD by the Materials Project.\n \n } else if (api.isLoggedIn) {\n message = `\n This URL points to an entry that either does not exist, or that you are not\n authorized to see.`\n } else {\n message = `\n This URL points to an entry that either does not exist, or that is not\n publically visibile. Please login; you might be authorized to view it.`\n }\n }\n\n return (\n {message}\n )\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useState } from 'react'\nimport { Typography, makeStyles } from '@material-ui/core'\nimport { matchPath, useLocation, useRouteMatch, useHistory } from 'react-router'\nimport {useApi} from '../api'\nimport {useErrors} from '../errors'\nimport { getUrl } from '../nav/Routes'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3)\n }\n}))\n\nexport default function ResolvePID() {\n const classes = useStyles()\n const {api, user} = useApi()\n const {raiseError} = useErrors()\n const history = useHistory()\n const location = useLocation()\n const match = useRouteMatch()\n\n const [doesNotExist, setDoesNotExist] = useState(false)\n\n useEffect(() => {\n const pidMatch = matchPath(location.pathname, {\n path: `${match.path}/:pid/:handle?`\n })\n const { pid, handle } = pidMatch.params\n const pidWithHandle = handle ? pid + '/' + handle : pid\n\n api.post('/entries/query', {owner: 'all', query: {pid: pidWithHandle}})\n .then(response => {\n if (response.pagination.total >= 1) {\n const entry = response.data[0]\n history.push(getUrl(`entry/id/${entry.upload_id}/${entry.entry_id}`, location))\n } else {\n setDoesNotExist(true)\n }\n })\n .catch(raiseError)\n }, [setDoesNotExist, history, location, match, api, raiseError])\n\n let message = 'loading ...'\n\n if (doesNotExist) {\n if (user) {\n message = `\n This URL points to an entry that either does not exist, or that you are not\n authorized to see.`\n } else {\n message = `\n This URL points to an entry that either does not exist, or that is not\n publically visibile. Please login; you might be authorized to view it.`\n }\n }\n\n return (\n {message}\n )\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext, useState, useEffect, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { cloneDeep } from 'lodash'\nimport { Typography, makeStyles } from '@material-ui/core'\nimport { ui } from '../../config'\nimport { errorContext } from '../errors'\nimport { useApi } from '../api'\nimport SearchPage from '../search/SearchPage'\nimport { SearchContext } from '../search/SearchContext'\nimport { DOI } from './DOI'\n\nexport const help = `\nThis page allows you to **inspect** and **download** NOMAD datasets. It also allows you\nto explore a dataset with similar controls that the search page offers.\n`\n\n// Use the same context as in the global entries search, but with free-text\n// query enabled\nconst context = cloneDeep(ui?.apps?.options?.entries)\ncontext.search_syntaxes.exclude = undefined\n\nconst useStyles = makeStyles(theme => ({\n header: {\n display: 'flex',\n flexDirection: 'column'\n }\n}))\nconst DatasetPage = React.memo(({match}) => {\n const styles = useStyles()\n const [dataset, setDataset] = useState()\n const {raiseError} = useContext(errorContext)\n const {api} = useApi()\n\n // Router provides the URL parameters via props, here we read the dataset ID.\n const datasetId = match?.params?.datasetId\n const datasetFilter = useMemo(() => ({\n 'visibility': 'all',\n 'datasets.dataset_id': datasetId\n }), [datasetId])\n\n // Fetch the dataset information from API.\n useEffect(() => {\n api.datasets(datasetId)\n .then(setDataset)\n .catch(error => {\n setDataset(undefined)\n raiseError(error)\n })\n }, [datasetId, api, raiseError])\n\n // Show a customized search page for this dataset. Basic dataset information\n // shown in the header.\n return dataset\n ? \n \n \n {dataset.dataset_name || (dataset.isEmpty && 'Empty or non existing dataset') || 'loading ...'}\n \n \n dataset{dataset.doi ? , with DOI : ''}\n \n
}\n />\n \n : null\n})\nDatasetPage.propTypes = {\n match: PropTypes.object\n}\n\nexport default DatasetPage\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useContext, useEffect, useState, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport {Paper, IconButton, Tooltip, DialogContent, Button, Dialog, DialogTitle} from '@material-ui/core'\nimport { useApi, withLoginRequired } from '../api'\nimport Page from '../Page'\nimport { useErrors } from '../errors'\nimport DetailsIcon from '@material-ui/icons/ArrowForward'\nimport DeleteIcon from '@material-ui/icons/Delete'\nimport DOIIcon from '@material-ui/icons/Bookmark'\nimport { DatasetButton } from '../nav/Routes'\nimport {\n addColumnDefaults, combinePagination, Datatable,\n DatatablePagePagination,\n DatatableTable, DatatableToolbar } from '../datatable/Datatable'\nimport Quantity from '../Quantity'\nimport DialogContentText from '@material-ui/core/DialogContentText'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport { SourceApiCall, SourceApiDialogButton } from '../buttons/SourceDialogButton'\nimport { formatTimestamp } from '../../utils'\nimport { dataciteEnabled } from '../../config'\n\nexport const help = `\nNOMAD allows you to create *datasets* from your data. A dataset is like a tag that you\ncann attach to one or many entries. An entry can have abitrary many datasets assign.\nThis way you can create datasets that overlap or contain each other. Datasets work\nvery similar to labels, albums, or tags on other platforms.\n`\n\nconst columns = [\n {key: 'dataset_name'},\n {\n key: 'doi',\n label: 'Digital object identifier (DOI)',\n render: dataset => {\n if (dataset.doi) {\n return \n }\n return null\n }\n },\n {\n key: 'dataset_id',\n render: dataset => \n },\n {\n key: 'dataset_create_time',\n label: 'Create time',\n render: dataset => formatTimestamp(dataset.dataset_create_time)\n },\n {\n key: 'dataset_modified_time',\n label: 'Modify time',\n render: dataset => (dataset.dataset_modified_time ? formatTimestamp(dataset.dataset_modified_time) : '')\n }\n]\n\naddColumnDefaults(columns, {align: 'left'})\n\nconst PageContext = React.createContext({})\n\nconst DatasetActions = React.memo(function VisitDatasetAction({data}) {\n const {api} = useApi()\n const {raiseError} = useErrors()\n const {refresh} = useContext(PageContext)\n const [openConfirmDeleteDialog, setOpenConfirmDeleteDialog] = useState(false)\n const [openConfirmDoiDialog, setOpenConfirmDoiDialog] = useState(false)\n\n const handleDelete = useCallback(() => {\n setOpenConfirmDeleteDialog(false)\n api.delete(`/datasets/${data.dataset_id}`)\n .then(refresh).catch(raiseError)\n }, [api, raiseError, data.dataset_id, refresh, setOpenConfirmDeleteDialog])\n\n const handleAssignDoi = useCallback(() => {\n setOpenConfirmDoiDialog(false)\n api.post(`/datasets/${data.dataset_id}/action/doi`)\n .then(refresh)\n .catch(raiseError)\n }, [api, raiseError, data.dataset_id, refresh, setOpenConfirmDoiDialog])\n\n return \n {dataciteEnabled && \n \n setOpenConfirmDoiDialog(true)} disabled={!!data.doi}>\n \n \n \n }\n \n \n setOpenConfirmDeleteDialog(true)} disabled={!!data.doi} style={{pointerEvents: 'auto'}}>\n \n \n \n \n \n \n \n \n \n \n \n \n Are you sure you want to permanently delete the dataset?\n \n \n \n \n \n \n \n setOpenConfirmDoiDialog(false)}\n >\n Confirm that you want to assign a DOI\n \n \n Assigning a DOI is permanent. You will not be able to remove entries from\n datasets with a DOI. You cannot delete datasets with a DOI.\n \n \n \n \n \n \n \n \n})\nDatasetActions.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nfunction DatasetsPage() {\n const {api, user} = useApi()\n const errors = useErrors()\n const [apiData, setApiData] = useState(null)\n const data = useMemo(() => apiData?.response, [apiData])\n const [pagination, setPagination] = useState({\n page_size: 10,\n page: 1,\n order_by: 'dataset_create_time',\n order: 'desc'\n })\n\n const load = useCallback(() => {\n if (!user) {\n return\n }\n const {page_size, page, order_by, order} = pagination\n const url = `/datasets/?page_size=${page_size}&page=${page}&order_by=${order_by}&order=${order}&user_id=${user.sub}`\n api.get(url, null, {returnRequest: true})\n .then(setApiData)\n .catch(errors.raiseError)\n }, [pagination, setApiData, errors, api, user])\n\n useEffect(() => {\n load()\n }, [load])\n\n return \n \n {data &&\n \n column.key)}\n sortingColumns={['dataset_create_time', 'dataset_modified_time', 'dataset_name']}\n data={data.data || []}\n pagination={combinePagination(pagination, data.pagination)}\n onPaginationChanged={setPagination}\n >\n \n \n \n \n \n \n \n \n \n \n }\n \n \n}\n\nexport default withLoginRequired(DatasetsPage)\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useState } from 'react'\nimport { Typography, makeStyles } from '@material-ui/core'\nimport { matchPath, useLocation, useRouteMatch, useHistory } from 'react-router'\nimport {useApi} from '../api'\nimport {useErrors} from '../errors'\nimport { getUrl } from '../nav/Routes'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3)\n }\n}))\n\nexport default function ResolveDOI() {\n const classes = useStyles()\n const {api} = useApi()\n const {raiseError} = useErrors()\n const history = useHistory()\n const location = useLocation()\n const match = useRouteMatch()\n\n const [doesNotExist, setDoesNotExist] = useState(false)\n\n useEffect(() => {\n const doiMatch = matchPath(location.pathname, {\n path: `${match.path}/:doi*`\n })\n const { doi } = doiMatch.params\n\n api.get('/datasets/', {doi: doi})\n .then(response => {\n if (response.pagination.total >= 1) {\n const dataset_id = response.data[0].dataset_id\n history.push(getUrl(`dataset/id/${dataset_id}`, location))\n } else {\n setDoesNotExist(true)\n }\n })\n .catch(raiseError)\n }, [setDoesNotExist, history, location, match, api, raiseError])\n\n let message = 'loading ...'\n\n if (doesNotExist) {\n message = 'This URL points to a dataset that does not exist.'\n }\n\n return (\n {message}\n )\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { IconButton, Paper, Tabs, Tab, Box } from '@material-ui/core'\nimport TooltipButton from '../utils/TooltipButton'\nimport EditIcon from '@material-ui/icons/Edit'\nimport NavigateNextIcon from '@material-ui/icons/NavigateNext'\nimport { Datatable, DatatableToolbar, DatatableToolbarActions, DatatableTable,\n DatatablePagePagination, DatatableScrollPagination, DatatableLoadMorePagination } from './Datatable'\nimport Page from '../Page'\nimport { sleep } from '../../utils'\n\nconst createExampleData = (length) => Array.from({length: length}, (_, i) => ({\n id: (i + 1).toString(), value: i + 1\n}))\n\nconst columns = [\n {\n key: 'id',\n sortable: true,\n align: 'right',\n render: data => data.id\n },\n {\n key: 'value',\n sortable: true,\n render: data => `This is value for id ${data.value}.`\n }\n]\n\nfunction DetailsExample({data}) {\n return
Details: {data.id}
\n}\nDetailsExample.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nfunction ActionsExample({data}) {\n return console.log(`Perform row action for ${data.id}.`)}\n >\n \n \n}\nActionsExample.propTypes = {\n data: PropTypes.object.isRequired\n}\n\nfunction ScrollDatatableExample() {\n const exampleData = useMemo(() => createExampleData(1024), [])\n const [pagination, setPagination] = useState({\n total: 1024, page_size: 100\n })\n const [data, setData] = useState([])\n const [selected, setSelected] = useState(new Set())\n\n useEffect(() => {\n sleep(100).then(() => {\n const nextPageAfterValueInt = parseInt(pagination.page_after_value || 0) + pagination.page_size\n setData(exampleData.slice(0, nextPageAfterValueInt))\n setPagination(pagination => ({\n ...pagination,\n next_page_after_value: nextPageAfterValueInt > exampleData.length ? null : String(nextPageAfterValueInt)\n }))\n })\n }, [pagination.page_after_value, pagination.page_size, exampleData])\n\n return \n option.id}\n onSelectedChanged={setSelected}\n >\n \n \n \n \n \n \n}\n\nfunction LoadMoreDatatableExample() {\n const exampleData = useMemo(() => createExampleData(1024), [])\n const [pagination, setPagination] = useState({\n total: 1024, page_size: 10\n })\n const [data, setData] = useState([])\n const [selected, setSelected] = useState(new Set())\n\n useEffect(() => {\n sleep(100).then(() => {\n const nextPageAfterValueInt = parseInt(pagination.page_after_value || 0) + pagination.page_size\n setData(exampleData.slice(0, nextPageAfterValueInt))\n setPagination(pagination => ({\n ...pagination,\n next_page_after_value: nextPageAfterValueInt > exampleData.length ? null : String(nextPageAfterValueInt)\n }))\n })\n }, [pagination.page_after_value, pagination.page_size, exampleData])\n\n return \n option.id}\n onSelectedChanged={setSelected}\n >\n \n \n \n load more\n \n \n \n \n}\n\nexport function DatatableExamples() {\n const exampleData = useMemo(() => createExampleData(23), [])\n\n const [data, setData] = useState([])\n const [pagination, setPagination] = useState({\n page_size: 10, page: 1, order_by: 'id', order: 'asc', total: exampleData.length\n })\n const [selected, setSelected] = useState(new Set())\n\n useEffect(() => {\n const {page_size, page, total, order, order_by} = pagination\n const compare = (a, b) => {\n const value = data => parseInt(String(data[order_by]))\n return (value(a) - value(b)) * (order === 'asc' ? 1 : -1)\n }\n const data = [...exampleData].sort(compare)\n const start = page_size * (page - 1)\n const end = page_size + start\n const length = (end > total) ? total - start : page_size\n setData(data.slice(start, start + length))\n }, [pagination, exampleData])\n\n const [tab, setTab] = useState(3)\n\n return \n setTab(tab)}>\n \n \n \n \n \n \n\n \n \n\n \n \n \n \n \n \n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useCallback, useMemo, useState} from 'react'\nimport {\n Box,\n FormControl,\n FormLabel, Slider\n} from '@material-ui/core'\nimport PropTypes from 'prop-types'\nimport {Quantity} from '../units/Quantity'\nimport {Unit} from '../units/Unit'\nimport {useUnitContext} from '../units/UnitContext'\nimport {UnitSelect} from './NumberEditQuantity'\nimport {getDisplayLabel} from \"../../utils\"\nimport {useRecoilValue} from \"recoil\"\nimport {configState} from \"../archive/ArchiveBrowser\"\n\nexport const SliderEditQuantity = React.memo((props) => {\n const {quantityDef, value, onChange, minValue, maxValue, ...sliderProps} = props\n const config = useRecoilValue(configState)\n const label = getDisplayLabel(quantityDef, true, config?.showMeta)\n\n const {units} = useUnitContext()\n const defaultUnit = useMemo(() => quantityDef.unit && new Unit(quantityDef.unit), [quantityDef])\n const dimension = defaultUnit && defaultUnit.dimension()\n const [unit, setUnit] = useState(units[dimension]?.definition || quantityDef.unit)\n const minValueConverted = useMemo(() => {\n return unit\n ? new Quantity(minValue, quantityDef.unit).to(unit).value()\n : minValue\n }, [minValue, quantityDef, unit])\n const maxValueConverted = useMemo(() => {\n return unit\n ? new Quantity(maxValue, quantityDef.unit).to(unit).value()\n : maxValue\n }, [maxValue, quantityDef, unit])\n const sliderValue = useMemo(() => {\n return unit\n ? new Quantity(value || 0, quantityDef.unit).to(unit).value()\n : value || 0\n }, [unit, quantityDef, value])\n\n const handleChangeValue = useCallback((event, value) => {\n const convertedValue = unit ? new Quantity(value, unit).to(quantityDef.unit).value() : value\n if (onChange) {\n onChange(convertedValue)\n }\n }, [unit, onChange, quantityDef])\n\n return \n {label}\n \n \n {unit && (\n \n )}\n \n \n})\nSliderEditQuantity.propTypes = {\n quantityDef: PropTypes.object.isRequired,\n value: PropTypes.number,\n minValue: PropTypes.number.isRequired,\n maxValue: PropTypes.number.isRequired,\n onChange: PropTypes.func\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {useRef, useState} from 'react'\nimport PropTypes from 'prop-types'\nimport {Card, Box, Typography, Grid, CardContent} from '@material-ui/core'\nimport {NumberEditQuantity} from './NumberEditQuantity'\nimport {StringEditQuantity, URLEditQuantity} from './StringEditQuantity'\nimport {EnumEditQuantity} from './EnumEditQuantity'\nimport {AutocompleteEditQuantity} from './AutocompleteEditQuantity'\nimport {RadioEnumEditQuantity} from './RadioEnumEditQuantity'\nimport {BoolEditQuantity} from './BoolEditQuantity'\nimport {SliderEditQuantity} from './SliderEditQuantity'\nimport { DateEditQuantity, DateTimeEditQuantity, TimeEditQuantity } from './DateTimeEditQuantity'\nimport RichTextEditQuantity from './RichTextEditQuantity'\nimport ListEditQuantity from './ListEditQuantity'\nimport { Code } from '../buttons/SourceDialogButton'\nimport { stripIndent } from '../../utils'\nimport AuthorEditQuantity from './AuthorEditQuantity'\nimport QueryEditQuantity from \"./QueryEditQuantity\"\n\nconst enumValues = [\n 'Vapor deposition', 'Chemical vapor deposition', 'Metalorganic vapour phase epitaxy', 'Electrostatic spray assisted vapour deposition (ESAVD)', 'Sherardizing',\n 'Some forms of Epitaxy', 'Molecular beam epitaxy', 'Physical vapor deposition', 'Cathodic arc deposition', 'Electron beam physical vapor deposition (EBPVD)',\n 'Ion plating', 'Ion beam assisted deposition (IBAD)', 'Magnetron sputtering', 'Pulsed laser deposition', 'Sputter deposition',\n 'Vacuum deposition', 'Pulsed electron deposition (PED)', 'Chemical and electrochemical techniques', 'Conversion coating', 'Autophoretic', 'Anodising',\n 'Chromate conversion coating', 'Plasma electrolytic oxidation', 'Phosphate', 'Ion beam mixing', 'Pickled and oiled, a type of plate steel coating',\n 'Plating', 'Electroless plating', 'Electroplating', 'Spraying', 'Spray painting', 'High velocity oxygen fuel (HVOF)', 'Plasma spraying',\n 'Thermal spraying', 'Kinetic metallization (KM)', 'Plasma transferred wire arc thermal spraying', 'The common forms of Powder coating', 'Roll-to-roll coating processes',\n 'Common roll-to-roll coating processes include:', 'Air knife coating', 'Anilox coater', 'Flexo coater', 'Gap Coating', 'Knife-over-roll coating', 'Gravure coating',\n 'Immersion dip coating', 'Kiss coating', 'Metering rod (Meyer bar) coating', 'Roller coating', 'Forward roller coating', 'Reverse roll coating',\n 'Silk Screen coater', 'Rotary screen', 'Lithography', 'Flexography', 'Physical coating processes', 'Langmuir-Blodgett', 'Spin coating', 'Dip coating']\n\nfunction Example({code, children}) {\n return (\n \n \n {children}\n \n \n \n )\n}\nExample.propTypes = {\n code: PropTypes.string,\n children: PropTypes.any\n}\n\nexport function EditQuantityExamples() {\n const [, setUpdate] = useState(0)\n const propsRef = useRef({})\n const sectionRef = useRef({})\n\n const createDefaultProps = (name, props) => {\n if (!propsRef.current[name]) {\n propsRef.current[name] = {\n quantityDef: {\n name: name,\n _qualifiedName: `${name}-qualifiedName`,\n description: `\n This is **MARKDOWN** help text.\n `,\n ...(props || {})\n },\n onChange: value => {\n sectionRef.current[name] = value\n setUpdate(value => value + 1)\n }\n }\n }\n return {\n ...(propsRef.current[name]),\n value: sectionRef.current[name]\n }\n }\n\n const float = {\n type_kind: 'python',\n type_data: 'float'\n }\n\n const int = {\n type_kind: 'python',\n type_data: 'int'\n }\n\n const user = {\n type_kind: 'User',\n type_data: 'User'\n }\n\n return \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {JSON.stringify(sectionRef.current, null, 4)}\n \n \n \n \n \n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport FileBrowser from '../archive/FileBrowser'\nimport Page from '../Page'\nimport { useUploadPageContext } from './UploadPageContext'\nimport { createUploadUrl } from '../../utils'\nimport { Typography } from '@material-ui/core'\n\nconst UploadFilesView = React.memo(function UploadFilesView() {\n const {deploymentUrl, uploadId, error, hasUpload} = useUploadPageContext()\n\n if (!hasUpload) {\n return \n {(error ? {error.apiMessage || error.message || 'Failed to load'} : loading ...)}\n \n }\n\n return \n \n \n})\nUploadFilesView.propTypes = {\n uploadId: PropTypes.string\n}\nexport default UploadFilesView\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport { CircularProgress, Grid, makeStyles, Paper, Slide, Typography } from '@material-ui/core'\nimport Page from '../Page'\nimport { useUploadPageContext } from './UploadPageContext'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n position: 'absolute',\n left: 0,\n right: 0,\n marginTop: -20,\n margin: -10,\n padding: 10,\n paddingTop: 20,\n zIndex: 1000\n }\n}))\n\nconst UploadProcessingStatus = React.memo(function ProcessingStatus() {\n const {isProcessing, upload} = useUploadPageContext()\n const classes = useStyles()\n\n if (!upload) {\n return null\n }\n\n return (\n \n \n \n \n \n \n \n \n Upload is processing ...\n {upload.last_status_message}\n \n \n \n \n \n )\n})\n\nexport default UploadProcessingStatus\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { Card, Box, CardContent } from '@material-ui/core'\nimport { Code } from '../buttons/SourceDialogButton'\nimport { stripIndent } from '../../utils'\nimport { SectionPlots } from './ArchiveBrowser'\nimport { useGlobalMetainfo } from './metainfo'\nimport InputConfig from '../search/input/InputConfig'\nimport Typography from '@material-ui/core/Typography'\n\nconst pvdSection = {\n name: 'Substrate 1',\n process_time: [-2099, -2026, -1953, -1880, -1807, -1734, -1661, -1588, -1515, -1442, -1369, -1296, -1223, -1150, -1077, -1004, -931, -858, -785, -712, -639, -566, -493, -419, -346, -273, -200, -127, -54, 19, 92, 165, 238, 311, 384, 457, 530, 603, 676, 749, 822, 895, 968, 1041, 1114, 1187, 1260, 1333, 1406, 1479, 1552, 1625, 1698, 1771, 1844, 1917, 1990, 2063, 2136, 2209, 2282, 2355, 2428, 2501, 2574, 2647, 2720, 2793, 2866, 2939, 3012, 3085, 3158, 3231, 3304, 3377, 3450, 3523, 3596, 3669, 3742, 3815, 3888, 3961, 4034, 4107, 4180, 4253, 4326, 4399, 4472, 4545, 4618, 4691, 4764, 4837, 4910, 4983, 5056, 5129, 5202, 5275, 5348, 5421, 5494, 5567, 5640, 5713, 5786, 5859, 5932, 6005, 6078, 6151, 6225, 6298, 6371, 6444, 6517, 6590, 6663, 6736, 6809, 6882, 6955, 7028, 7101, 7174, 7247, 7320, 7393, 7466, 7539],\n set_substrate_temperature: [309.356, 309.217, 309.084, 308.958, 308.838, 308.724, 308.616, 308.513, 308.415, 308.322, 308.233, 308.148, 308.068, 307.992, 307.919, 307.85, 307.784, 307.722, 307.662, 307.606, 307.552, 307.501, 307.452, 307.406, 307.362, 307.32, 307.28, 307.242, 307.206, 307.171, 307.139, 307.108, 307.078, 307.05, 307.023, 306.998, 306.974, 306.951, 306.929, 306.908, 306.888, 306.869, 306.851, 306.834, 306.818, 306.803, 306.788, 306.774, 306.761, 306.748, 306.736, 306.725, 306.714, 306.704, 306.694, 306.684, 306.676, 306.667, 306.659, 306.651, 306.644, 306.637, 306.631, 306.624, 306.618, 306.613, 306.607, 306.602, 306.597, 306.593, 306.588, 306.584, 306.58, 306.576, 306.573, 306.569, 306.566, 306.563, 306.56, 306.557, 306.554, 306.552, 306.549, 306.547, 306.545, 306.543, 306.541, 306.539, 306.537, 306.535, 306.534, 306.532, 306.531, 306.529, 306.528, 306.527, 306.525, 306.524, 306.523, 306.522, 306.521, 306.52, 306.519, 306.519, 306.518, 306.517, 306.516, 306.516, 306.515, 306.514, 306.514, 306.513, 306.513, 306.512, 306.512, 306.511, 306.511, 306.51, 306.51, 306.509, 306.509, 306.509, 306.508, 306.508, 306.508, 306.508, 306.507, 306.507, 306.507, 306.507, 306.506, 306.506, 306.506],\n substrate_temperature: [305.563, 305.527, 305.518, 305.523, 305.506, 305.502, 305.506, 305.515, 305.563, 305.575, 305.591, 305.607, 305.609, 305.637, 305.683, 305.701, 305.74, 305.788, 305.813, 305.871, 305.913, 305.977, 306.003, 306.076, 306.143, 306.179, 306.267, 306.321, 306.374, 306.453, 306.635, 306.871, 307.098, 307.324, 307.549, 307.801, 308.03, 308.264, 308.499, 308.728, 308.971, 309.16, 309.374, 309.6, 309.779, 309.95, 310.16, 310.334, 310.501, 310.668, 310.84, 310.999, 311.145, 311.303, 311.45, 311.58, 311.709, 311.852, 311.991, 312.093, 312.243, 312.336, 312.464, 312.569, 312.664, 312.785, 312.887, 312.973, 313.099, 313.192, 313.27, 313.369, 313.47, 313.568, 313.638, 313.718, 314.497, 317.131, 316.92, 316.736, 316.561, 316.389, 316.204, 316.021, 315.853, 315.692, 315.552, 315.409, 315.284, 315.124, 314.984, 314.851, 314.719, 314.583, 314.466, 314.338, 314.226, 314.085, 313.986, 313.85, 313.765, 313.639, 313.536, 313.44, 313.315, 313.211, 313.123, 313.004, 312.9, 312.801, 312.717, 312.634, 312.553, 312.468, 312.371, 312.257, 312.172, 312.085, 312.004, 311.921, 311.833, 311.75, 311.658, 311.583, 310.238, 310.188, 310.204, 310.208, 310.185, 309.659, 309.457, 309.572, 309.602],\n chamber_pressure: [0.313, 0.328, 0.319, 0.313, 0.307, 0.306, 0.304, 0.303, 0.304, 0.303, 0.303, 0.303, 0.303, 0.303, 0.303, 0.303, 0.302, 0.303, 0.301, 0.303, 0.303, 0.302, 0.301, 0.303, 0.303, 0.303, 0.303, 0.304, 0.303, 0.303, 0.303, 0.304, 0.304, 0.304, 0.304, 0.305, 0.304, 0.305, 0.304, 0.305, 0.305, 0.307, 0.305, 0.307, 0.308, 0.307, 0.31, 0.309, 0.307, 0.308, 0.314, 0.309, 0.307, 0.31, 0.311, 0.31, 0.312, 0.312, 0.314, 0.313, 0.315, 0.314, 0.314, 0.317, 0.314, 0.315, 0.319, 0.318, 0.317, 0.319, 0.317, 0.318, 0.317, 0.318, 0.318, 0.319, 0.319, 0.318, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.32, 0.318, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.321, 0.32, 0.32, 0.32, 0.322, 0.32, 0.32, 0.321, 0.32, 0.32, 0.321, 0.321, 0.321, 0.321, 0.321, 0.321, 0.322, 0.322, 0.323, 0.94, 2.25, 3.49, 4.28, 2.21, 0.72, 0.291, 47700.0, 102000.0, 102000.0, 102000.0, 102000.0, 102000.0, 102000.0, 102000.0, 3220.0]\n}\n\nconst pvdSectionSecond = {\n name: 'Substrate 2',\n process_time: [-2099, -2026, -1953, -1880, -1807, -1734, -1661, -1588, -1515, -1442, -1369, -1296, -1223, -1150, -1077, -1004, -931, -858, -785, -712, -639, -566, -493, -419, -346, -273, -200, -127, -54, 19, 92, 165, 238, 311, 384, 457, 530, 603, 676, 749, 822, 895, 968, 1041, 1114, 1187, 1260, 1333, 1406, 1479, 1552, 1625, 1698, 1771, 1844, 1917, 1990, 2063, 2136, 2209, 2282, 2355, 2428, 2501, 2574, 2647, 2720, 2793, 2866, 2939, 3012, 3085, 3158, 3231, 3304, 3377, 3450, 3523, 3596, 3669, 3742, 3815, 3888, 3961, 4034, 4107, 4180, 4253, 4326, 4399, 4472, 4545, 4618, 4691, 4764, 4837, 4910, 4983, 5056, 5129, 5202, 5275, 5348, 5421, 5494, 5567, 5640, 5713, 5786, 5859, 5932, 6005, 6078, 6151, 6225, 6298, 6371, 6444, 6517, 6590, 6663, 6736, 6809, 6882, 6955, 7028, 7101, 7174, 7247, 7320, 7393, 7466, 7539],\n set_substrate_temperature: [309.356, 309.217, 309.084, 308.958, 308.838, 308.724, 308.616, 308.513, 308.415, 308.322, 308.233, 308.148, 308.068, 307.992, 307.919, 307.85, 307.784, 307.722, 307.662, 307.606, 307.552, 307.501, 307.452, 307.406, 307.362, 307.32, 307.28, 307.242, 307.206, 307.171, 307.139, 307.108, 307.078, 307.05, 307.023, 306.998, 306.974, 306.951, 306.929, 306.908, 306.888, 306.869, 306.851, 306.834, 306.818, 306.803, 306.788, 306.774, 306.761, 306.748, 306.736, 306.725, 306.714, 306.704, 306.694, 306.684, 306.676, 306.667, 306.659, 306.651, 306.644, 306.637, 306.631, 306.624, 306.618, 306.613, 306.607, 306.602, 306.597, 306.593, 306.588, 306.584, 306.58, 306.576, 306.573, 306.569, 306.566, 306.563, 306.56, 306.557, 306.554, 306.552, 306.549, 306.547, 306.545, 306.543, 306.541, 306.539, 306.537, 306.535, 306.534, 306.532, 306.531, 306.529, 306.528, 306.527, 306.525, 306.524, 306.523, 306.522, 306.521, 306.52, 306.519, 306.519, 306.518, 306.517, 306.516, 306.516, 306.515, 306.514, 306.514, 306.513, 306.513, 306.512, 306.512, 306.511, 306.511, 306.51, 306.51, 306.509, 306.509, 306.509, 306.508, 306.508, 306.508, 306.508, 306.507, 306.507, 306.507, 306.507, 306.506, 306.506, 306.506],\n substrate_temperature: [366.6756, 366.6324, 366.6216, 366.6276, 366.6072, 366.6024, 366.6072, 366.618, 366.6756, 366.69, 366.7092, 366.7284, 366.7308, 366.7644, 366.8196, 366.8412, 366.888, 366.9456, 366.9756, 367.0452, 367.0956, 367.1724, 367.2036, 367.2912, 367.3716, 367.4148, 367.5204, 367.5852, 367.6488, 367.7436, 367.962, 368.2452, 368.5176, 368.7888, 369.0588, 369.3612, 369.636, 369.9168, 370.1988, 370.4736, 370.7652, 370.992, 371.2488, 371.52, 371.7348, 371.94, 372.192, 372.4008, 372.6012, 372.8016, 373.008, 373.1988, 373.374, 373.5636, 373.74, 373.896, 374.0508, 374.2224, 374.3892, 374.5116, 374.6916, 374.8032, 374.9568, 375.0828, 375.1968, 375.342, 375.4644, 375.5676, 375.7188, 375.8304, 375.924, 376.0428, 376.164, 376.2816, 376.3656, 376.4616, 377.3964, 380.5572, 380.304, 380.0832, 379.8732, 379.6668, 379.4448, 379.2252, 379.0236, 378.8304, 378.6624, 378.4908, 378.3408, 378.1488, 377.9808, 377.8212, 377.6628, 377.4996, 377.3592, 377.2056, 377.0712, 376.902, 376.7832, 376.62, 376.518, 376.3668, 376.2432, 376.128, 375.978, 375.8532, 375.7476, 375.6048, 375.48, 375.3612, 375.2604, 375.1608, 375.0636, 374.9616, 374.8452, 374.7084, 374.6064, 374.502, 374.4048, 374.3052, 374.1996, 374.1, 373.9896, 373.8996, 372.2856, 372.2256, 372.2448, 372.2496, 372.222, 371.5908, 371.3484, 371.4864, 371.5224],\n chamber_pressure: [0.313, 0.328, 0.319, 0.313, 0.307, 0.306, 0.304, 0.303, 0.304, 0.303, 0.303, 0.303, 0.303, 0.303, 0.303, 0.303, 0.302, 0.303, 0.301, 0.303, 0.303, 0.302, 0.301, 0.303, 0.303, 0.303, 0.303, 0.304, 0.303, 0.303, 0.303, 0.304, 0.304, 0.304, 0.304, 0.305, 0.304, 0.305, 0.304, 0.305, 0.305, 0.307, 0.305, 0.307, 0.308, 0.307, 0.31, 0.309, 0.307, 0.308, 0.314, 0.309, 0.307, 0.31, 0.311, 0.31, 0.312, 0.312, 0.314, 0.313, 0.315, 0.314, 0.314, 0.317, 0.314, 0.315, 0.319, 0.318, 0.317, 0.319, 0.317, 0.318, 0.317, 0.318, 0.318, 0.319, 0.319, 0.318, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.319, 0.32, 0.318, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.321, 0.32, 0.32, 0.32, 0.322, 0.32, 0.32, 0.321, 0.32, 0.32, 0.321, 0.321, 0.321, 0.321, 0.321, 0.321, 0.322, 0.322, 0.323, 0.94, 2.25, 3.49, 4.28, 2.21, 0.72, 0.291, 47700.0, 102000.0, 102000.0, 102000.0, 102000.0, 102000.0, 102000.0, 102000.0, 3220.0]\n}\n\nconst processSection = {\n PVDEvaporation: [pvdSection, pvdSectionSecond]\n}\n\nfunction Example({code, children}) {\n return (\n \n \n {children}\n \n \n \n )\n}\nExample.propTypes = {\n code: PropTypes.string,\n children: PropTypes.any\n}\n\nconst pvdExamples = [{\n plotly_graph_object: {\n data: {\n x: '#process_time',\n y: '#./substrate_temperature'\n },\n layout: {title: {text: 'T Substrate'}},\n config: {\n editable: true,\n scrollZoom: false\n }\n }\n}, {\n plotly_graph_object: {\n data: [\n {\n x: '#process_time',\n y: '#./set_substrate_temperature',\n mode: 'markers',\n marker: {\n color: '#./substrate_temperature'\n }\n },\n {\n x: '#process_time',\n y: '#./substrate_temperature'\n }\n ],\n layout: {title: {text: 'Temperature'}}\n }\n}, {\n plotly_graph_object: [{\n data: [\n {\n x: '#process_time',\n y: '#./substrate_temperature',\n mode: 'markers',\n marker: {\n color: 'rgb(40, 80, 130)'\n }\n },\n {\n x: '#process_time',\n y: '#./chamber_pressure',\n mode: 'lines',\n line: {\n color: 'rgb(100, 0, 0)'\n }\n }\n ],\n layout: {title: {text: 'Temperature and Pressure'}}\n }, {\n data: {\n x: '#process_time',\n y: '#chamber_pressure'\n },\n layout: {\n title: {text: 'T Substrate'},\n xaxis: {title: 't (sec)'},\n yaxis: {title: 'P (GPa)', type: 'log'}\n }\n }]\n}]\n\nconst processExamples = [\n {\n plotly_graph_object: {\n data: {\n x: '#PVDEvaporation/0/process_time',\n y: '#PVDEvaporation/0/chamber_pressure'\n },\n layout: {title: {text: 'Chamber Pressure'}}\n }\n }, {\n plotly_graph_object: {\n data: {\n x: '#PVDEvaporation/1/process_time',\n y: '#PVDEvaporation/1/substrate_temperature'\n },\n layout: {title: {text: 'Substrate Temperature'}}\n }\n }, {\n plotly_graph_object: {\n data: [\n {\n x: '#PVDEvaporation/0/process_time',\n y: '#PVDEvaporation/0/substrate_temperature'\n },\n {\n x: '#PVDEvaporation/0/process_time',\n y: '#PVDEvaporation/2/substrate_temperature'\n }\n ],\n layout: {title: {text: 'Temperature'}}\n }\n }, {\n plotly_graph_object: {\n data: {\n x: '#PVDEvaporation/:2/process_time',\n y: '#PVDEvaporation/:2/substrate_temperature'\n },\n layout: {title: {text: 'Substrate Temperature'}}\n }\n }\n]\n\nfunction getSection(metainfo, packageName, sectionName) {\n if (!metainfo) return undefined\n const packages = metainfo?._data?.packages\n const eln = packages?.find(section => section.name === packageName)\n const section_definitions = eln?.section_definitions\n return section_definitions?.find(section => section.name === sectionName)\n}\n\nexport function PlotExamples() {\n const metainfo = useGlobalMetainfo()\n const [plots, setPlots] = useState(pvdExamples.concat(processExamples))\n const [keys, setKeys] = useState(pvdExamples.concat(processExamples).map((example, index) => `plot${index}-0`))\n\n const pvdSectionDef = useMemo(() => ({\n name: 'PVDEvaporation',\n _allBaseSections: [\n {\n m_def: 'nomad.metainfo.metainfo.Section',\n name: 'PlotSection'\n }\n ],\n _properties: {\n name: {\n m_def: 'nomad.metainfo.metainfo.Quantity'\n },\n process_time: {\n m_def: 'nomad.metainfo.metainfo.Quantity',\n unit: 'second',\n shape: ['*']\n },\n set_substrate_temperature: {\n m_def: 'nomad.metainfo.metainfo.Quantity',\n unit: 'kelvin',\n shape: ['*']\n },\n substrate_temperature: {\n m_def: 'nomad.metainfo.metainfo.Quantity',\n unit: 'kelvin',\n shape: ['*']\n },\n chamber_pressure: {\n m_def: 'nomad.metainfo.metainfo.Quantity',\n unit: 'pascal',\n shape: ['*']\n }\n }\n }), [])\n const archiveSectionDef = useMemo(() => metainfo ? getSection(metainfo, 'nomad.datamodel.data', 'ArchiveSection') : undefined, [metainfo])\n\n if (archiveSectionDef) {\n archiveSectionDef['sub_section'] = {\n m_def: 'nomad.metainfo.metainfo.Section',\n _allBaseSections: [\n {\n m_def: 'nomad.metainfo.metainfo.Section',\n name: 'PlotSection'\n }\n ],\n _properties: {\n PVDEvaporation: {\n m_def: 'nomad.metainfo.metainfo.SubSection',\n repeats: true,\n sub_section: pvdSectionDef\n }\n }\n }\n }\n\n const sections = useMemo(() => {\n return plots.map((example, index) => {\n const graphObject = example.plotly_graph_object\n const examples = Array.isArray(graphObject) ? graphObject : [graphObject]\n return index < pvdExamples.length\n ? {sectionDef: pvdSectionDef, figures: examples.map((figure) => ({figure: figure}))}\n : {sectionDef: archiveSectionDef, figures: examples.map((figure) => ({figure: figure}))}\n }\n )\n }, [plots, pvdSectionDef, archiveSectionDef])\n\n const handleJsonChange = useCallback((data, index) => {\n const newPlots = [...plots]\n newPlots[index] = data\n setPlots(newPlots)\n const newKeys = [...keys]\n const [plotIndex, plotKey] = newKeys[index].split('-')\n newKeys[index] = `${plotIndex}-${Number(plotKey) + 1}`\n setKeys(newKeys)\n }, [keys, plots])\n\n return sections.map((section, index) => (\n \n {index === 0 && \n \n Examples to show how to plot simple and multiline graphs and how to customize the line styles\n \n }\n {index === pvdExamples.length && \n \n Examples to plot data from an array of section\n \n }\n {index === pvdExamples.length + 2 && \n \n Non instantiated subsections are ignored\n \n }\n {index === pvdExamples.length + 3 && \n \n Subsection index can use python slice notation\n \n }\n \n \n \n \n \n \n \n \n \n handleJsonChange(data, index)}\n />\n \n \n \n ))\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Route } from 'react-router'\nimport { CacheRoute, CacheSwitch } from 'react-router-cache-route'\nimport { matchPath, useLocation, Redirect, useHistory, Link as RouterLink } from 'react-router-dom'\nimport { Button, Link, makeStyles, Tooltip } from '@material-ui/core'\nimport About from '../About'\nimport { MetainfoPage, help as metainfoHelp } from '../archive/MetainfoBrowser'\nimport EntryPage, { help as entryHelp } from '../entry/EntryPage'\nimport UploadsPage, { help as uploadsHelp } from '../uploads/UploadsPage'\nimport UserdataPage, { help as userdataHelp } from '../UserdataPage'\nimport APIs from '../APIs'\nimport SearchPage from '../search/SearchPage'\nimport { SearchContext } from '../search/SearchContext'\nimport NorthPage, {help as NORTHHelp} from '../north/NorthPage'\nimport { appBase, encyclopediaBase, ui, apps } from '../../config'\nimport EntryQuery from '../entry/EntryQuery'\nimport ResolvePID from '../entry/ResolvePID'\nimport DatasetPage, { help as datasetHelp } from '../dataset/DatasetPage'\nimport DatasetsPage, { help as datasetsHelp } from '../dataset/DatasetsPage'\nimport ResolveDOI from '../dataset/ResolveDOI'\nimport { DatatableExamples } from '../datatable/DatatableExamples'\nimport {EditQuantityExamples} from '../editQuantity/EditQuantityExamples'\nimport UploadPage from '../uploads/UploadPage'\nimport {PlotExamples} from '../archive/PlotExamples'\n\n/**\n * Each route is an object with possible nested sub routes. Therefore, each object only\n * represents one segment of a full path (from root to sub route). Of course sub routes\n * can be re-used by putting them into variables and inserting them at multiple places.\n * Sub routes are matched before there parents. This way, react routers `exact` parameter\n * can be mostly omitted.\n *\n * The following keys are possible:\n * @param {string} path The path segment for this route.\n * @param {array} routes The sub routes.\n * @param {string} breadcrumb An optional breadcrumb. The string is used verbatim.\n * @param {boolean} exact Is passed to react-router routes. Does not match paths that are longer.\n * @param {string} menu This is only allowed on the first two levels. The string is used\n * verbatim to create menu and menu items respectively.\n * @param {string} tooltip Used as tooltip titles for menu items.\n * @param {object} help Optional object with string values keys `title` and `help`.\n * Used for the help dialog.\n * @param {Component} component A react component that will be rendered if this route is\n * matching the current location. Alternative for render.\n * @param {func} render This is used if this route is matching the current location.\n * Alternative for component.\n * @param {string} href This can be used for menu items that are not used for navigating\n * in the app, but linking to other web sites.\n */\n\n/**\n * The reusable sub routes for entries.\n */\nconst entryRoutes = [\n {\n path: 'entry',\n routes: [\n {\n path: 'id/:entryId',\n breadcrumb: 'Entry',\n component: EntryPage,\n help: {\n title: 'The entry page',\n content: entryHelp\n },\n routes: [\n {\n path: 'files',\n exact: true,\n breadcrumb: 'Files'\n },\n {\n path: 'data',\n exact: true,\n breadcrumb: 'Data'\n },\n {\n path: 'logs',\n exact: true,\n breadcrumb: 'Logs'\n }\n ]\n },\n {\n path: 'query',\n exact: true,\n component: EntryQuery\n },\n {\n path: 'pid',\n component: ResolvePID\n }\n ]\n }\n]\n\n/**\n * The reusable sub routes for datasets\n */\nconst datasetRoutes = [\n {\n path: 'dataset',\n routes: [\n {\n path: 'id/:datasetId',\n cache: 'always',\n breadcrumb: 'Dataset',\n component: DatasetPage,\n routes: entryRoutes,\n help: {\n title: 'Datasets',\n content: datasetHelp\n }\n },\n {\n path: 'doi',\n component: ResolveDOI\n }\n ]\n }\n]\n\n/**\n * The reusable sub routes for uploads\n */\nconst uploadRoutes = [\n {\n path: 'upload',\n routes: [\n {\n path: 'id/:uploadId',\n breadcrumb: 'Upload',\n component: UploadPage,\n routes: [\n {\n path: 'files',\n exact: true,\n breadcrumb: 'Files'\n },\n ...entryRoutes\n ]\n }\n ]\n }\n]\n\nconst searchRoutes = apps\n .map((context) => {\n const routeMap = {\n entries: entryRoutes\n }\n return {\n path: context.path,\n exact: true,\n cache: 'always',\n menu: context.label,\n tooltip: context.description,\n breadcrumb: context.breadcrumb || context.label,\n category: context.category,\n render: (props) => (\n \n \n \n ),\n help: {\n title: 'About this page',\n content: context.readme || context.description\n },\n routes: routeMap[context.resource]\n }\n })\n\n/**\n * The list with all routes. This is used to determine the routes for routing, the breadcrumbs,\n * and the main menu.\n */\nexport const routes = [\n {\n path: 'user',\n exact: true,\n redirect: '/user/uploads',\n menu: 'Publish',\n routes: [\n {\n path: 'uploads',\n exact: true,\n component: UploadsPage,\n menu: 'Uploads',\n tooltip: 'Upload and publish new data',\n breadcrumb: 'Your uploads',\n routes: uploadRoutes,\n help: {\n title: 'How to upload data to NOMAD',\n content: uploadsHelp\n }\n },\n {\n path: 'datasets',\n exact: true,\n component: DatasetsPage,\n menu: 'Datasets',\n tooltip: 'Manage your datasets',\n breadcrumb: 'Your datasets',\n routes: datasetRoutes,\n help: {\n title: 'What are NOMAD datasets',\n content: datasetsHelp\n }\n },\n {\n path: 'search',\n exact: true,\n cache: 'always',\n menu: 'Search your data',\n breadcrumb: 'Search your data',\n tooltip: 'Search the data you have uploaded',\n help: {\n title: 'How to manage your data',\n content: userdataHelp\n },\n component: UserdataPage,\n routes: [...entryRoutes, ...datasetRoutes, ...uploadRoutes]\n }\n ]\n },\n {\n path: 'search',\n redirect: '/search/entries',\n menu: 'Explore',\n routes: searchRoutes\n },\n {\n path: 'analyze',\n menu: 'Analyze',\n routes: [\n {\n path: 'apis',\n exact: true,\n menu: 'APIs',\n tooltip: 'The list of APIs offered by NOMAD',\n breadcrumb: 'NOMAD APIs',\n component: APIs\n },\n {\n path: 'metainfo',\n menu: 'The NOMAD Metainfo',\n tooltip: 'Browse the NOMAD Metainfo Schema',\n breadcrumb: 'NOMAD Metainfo Browser',\n help: {\n title: 'About the NOMAD metainfo',\n content: metainfoHelp\n },\n component: MetainfoPage\n },\n ...(ui?.north?.enabled ? [\n {\n path: 'north',\n menu: 'NOMAD Remote Tools Hub',\n tooltip: 'Browse the list of available remote tools.',\n breadcrumb: 'NOMAD Remote Tools Hub',\n help: {\n title: 'NOMAD Remote Tools help page',\n content: NORTHHelp\n },\n component: NorthPage\n }\n ] : [])\n ]\n },\n {\n path: 'about',\n menu: 'About',\n redirect: '/about/information',\n routes: [\n {\n path: 'information',\n exact: true,\n menu: 'Information',\n component: About,\n breadcrumb: 'About NOMAD',\n tooltip: 'Overview of the NOMAD'\n },\n {\n menu: 'Forum',\n href: 'https://matsci.org/c/nomad/',\n tooltip: 'The NOMAD user/developer forum on matsci.org'\n },\n {\n menu: 'FAQ',\n href: 'https://nomad-lab.eu/repository-archive-faqs',\n tooltip: 'Frequently Asked Questions (FAQ)'\n },\n {\n menu: 'Docs',\n href: `${appBase}/docs/index.html`,\n tooltip: 'The full user and developer documentation'\n },\n {\n menu: 'Sources',\n href: 'https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR',\n tooltip: 'NOMAD\\'s main Gitlab project'\n },\n {\n menu: 'Terms',\n consent: true,\n tooltip: 'The terms of service',\n href: 'https://nomad-lab.eu/nomad-lab/terms.html'\n }\n ]\n },\n ...datasetRoutes,\n ...entryRoutes,\n ...uploadRoutes,\n {\n path: 'dev/datatable',\n render: () => \n },\n {\n path: 'dev/editquantity',\n render: () => \n },\n {\n path: 'dev/plot',\n render: () => \n }\n]\n\n/**\n * The flattened array of all possible routs with paths starting the the root of the\n * app.\n */\nexport const allRoutes = []\n\nfunction addRoute(route, pathPrefix) {\n let path = ''\n if (!(route.path === '' && pathPrefix === '')) {\n path = route.path && `${pathPrefix}/${route.path}`\n }\n if (route.routes) {\n route.routes.forEach(childRoute => addRoute(childRoute, path))\n }\n const fullRoute = {...route, path: path}\n allRoutes.push(fullRoute)\n}\nroutes.forEach(route => addRoute(route, ''))\n\n/**\n * Renders all the apps routes according to `routes`.\n */\nconst useStyles = makeStyles((theme) => (\n {\n wrapper: {\n height: '100%'\n }\n }\n))\nexport const Routes = React.memo(function Routes() {\n const styles = useStyles()\n return \n {allRoutes\n .filter(route => route.path && (route.component || route.render || route.redirect || route.children))\n .map((route, i) => {\n if (route.redirect) {\n return \n }\n const Comp = route.cache ? CacheRoute : Route\n return \n {route.children || undefined}\n \n })}\n \n \n})\n\n/**\n * Some routes are available under different prefix routes. E.g., entries under search,\n * uploads, or datasets. This function computes a full url for such a route, based on\n * the given location. E.g., if location is `/search/entries/...`, getUrl for entries\n * would give `/search/entries/entry/id/someuploadid/someentryid`. If the current location\n * does not contain a possible prefix, the url will be returned without prefix.\n *\n * @param {*} path The partial path that should be the end of the returned url.\n * @param {*} location The current react-router location object, e.g. from `useLocation()`.\n * @returns The full url. E.g., that can be put into react-router ``.\n */\nexport function getUrl(path, location) {\n const commonPathPrefix = path.split('/')[0]\n const pathname = typeof location === 'string' ? location : location?.pathname\n const match = pathname && allRoutes\n .filter(route => route.routes?.some(route => route.path === commonPathPrefix))\n .map(route => matchPath(pathname, route.path)).find(match => match)\n const url = match?.url || ''\n\n return `${url}/${path}`\n}\n\nexport const RouteLink = React.forwardRef((props, ref) => {\n const {path, children, ...moreProps} = props\n const location = useLocation()\n const to = getUrl(path, location)\n return {children}\n})\nRouteLink.propTypes = {\n path: PropTypes.string.isRequired,\n children: PropTypes.node\n}\n\nexport const RouteButton = React.forwardRef((props, ref) => {\n const {component, onClick, path, ...moreProps} = props\n const location = useLocation()\n const history = useHistory()\n const handleClick = (event) => {\n event.stopPropagation()\n onClick && onClick(event)\n history.push(getUrl(path, location))\n }\n return React.createElement(component || Button, {onClick: handleClick, ...moreProps, ref: ref})\n})\nRouteButton.propTypes = {\n path: PropTypes.string.isRequired,\n onClick: PropTypes.func,\n component: PropTypes.elementType\n}\n\n/**\n * A button that allows to navigate to the entry page under the current route prefix.\n * @param {string} uploadId\n * @param {string} entryId\n * @param {elementType} component The component to use to render the button. Default is Button.\n */\nexport const EntryButton = React.forwardRef((props, ref) => {\n const {entryId, ...moreProps} = props\n const path = `entry/id/${entryId}`\n return \n})\nEntryButton.propTypes = {\n entryId: PropTypes.string.isRequired\n}\n\n/**\n * A button that allows to navigate to the entry page's archive view under the current route prefix.\n * @param {string} uploadId\n * @param {string} entryId\n * @param {string} path\n * @param {elementType} component The component to use to render the button. Default is Button.\n */\nexport const ArchiveButton = React.forwardRef((props, ref) => {\n const {uploadId, entryId, path, ...moreProps} = props\n const routePath = `entry/id/${entryId}/data/${path}`\n return \n})\nArchiveButton.propTypes = {\n uploadId: PropTypes.string.isRequired,\n entryId: PropTypes.string.isRequired,\n path: PropTypes.string\n}\n\n/**\n * A button that allows to navigate to the dataset page under the current route prefix.\n * @param {string} datasetId\n * @param {elementType} component The component to use to render the button. Default is Button.\n */\nexport const DatasetButton = React.forwardRef((props, ref) => {\n const {datasetId, ...moreProps} = props\n const path = `dataset/id/${datasetId}`\n return \n})\nDatasetButton.propTypes = {\n datasetId: PropTypes.string.isRequired\n}\n\n/**\n * A button that allows to navigate to the upload page under the current route prefix.\n * @param {string} uploadId\n * @param {elementType} component The component to use to render the button. Default is Button.\n */\nexport const UploadButton = React.forwardRef((props, ref) => {\n const {uploadId, ...moreProps} = props\n const path = `upload/id/${uploadId}`\n return \n})\nUploadButton.propTypes = {\n uploadId: PropTypes.string.isRequired\n}\n\n/**\n * A link that allows to navigate to the material page (currently an external link).\n * @param {string} materialId\n */\nexport const MaterialLink = React.forwardRef(({materialId, ...rest}, ref) => {\n const href = `${encyclopediaBase}/material/${materialId}`\n return \n})\n\nMaterialLink.propTypes = {\n materialId: PropTypes.string.isRequired\n}\n\n/**\n * A button that allows to navigate to the material page (currently an external link).\n * @param {string} materialId\n * @param {elementType} component The component to use to render the button. Default is Button.\n */\nexport const MaterialButton = React.forwardRef(({materialId, component, tooltip, ...rest}, ref) => {\n const href = `${encyclopediaBase}/material/${materialId}`\n const props = component\n ? {href: href, ...rest}\n : {href: href, color: 'primary', ...rest}\n const comp = React.createElement(component || Button, {...props, ref})\n\n // The portal is disabled for this tooltip because this button causes a\n // navigation that otherwise leaves the popup opened (the Tooltip state does\n // not get updated since the page is cached and a new page is shown\n // immediately).\n if (tooltip) {\n return \n {comp}\n \n }\n return comp\n})\n\nMaterialButton.propTypes = {\n materialId: PropTypes.string.isRequired,\n component: PropTypes.elementType,\n tooltip: PropTypes.string\n}\nMaterialButton.defaultProps = {\n tooltip: 'View this material in the Encyclopedia'\n}\n\nexport default Routes\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useRef } from 'react'\nimport { Tab, Tabs } from '@material-ui/core'\nimport { trimEnd } from 'lodash'\nimport { useRouteMatch, useHistory, matchPath, Redirect } from 'react-router-dom'\nimport { CacheRoute, CacheSwitch } from 'react-router-cache-route'\nimport UploadOverview from './UploadOverview'\nimport UploadFilesView from './UploadFilesView'\nimport UploadPageContext from './UploadPageContext'\nimport UploadProcessingStatus from './UploadProcessingStatus'\nimport PropTypes from 'prop-types'\n\nconst UploadPage = React.memo((props) => {\n const history = useHistory()\n const { uploadId: propsUploadId } = props\n const currentPath = history.location.pathname\n const {path, url} = useRouteMatch()\n const urlNoSlash = trimEnd(url, '/')\n const match = matchPath(currentPath, { path: `${path}/:tab?` })\n const {params: {tab = 'overview'}} = match\n const uploadId = propsUploadId || match?.params?.uploadId\n\n // We use a useRef object to keep track of the current urls of each tab. Switching\n // tabs would go to the previous tab url. This way, the views behind a tab can add\n // state to the URL (e.g. path to section on the ArchiveEntryView).\n const urls = useRef({\n 'overview': `${urlNoSlash}/overview`,\n 'files': `${urlNoSlash}/files`\n })\n\n const handleChange = (_, value) => {\n urls.current[tab] = currentPath\n history.push(urls.current[value])\n }\n // TODO I removed the UploadOverview view from the cache, because\n // processing in the UploadFile (Browser) view do not update the\n // upload context and do not refresh the UploadOverview data,\n // Test\n return \n \n \n \n \n \n {tab === 'overview' && (\n \n )}\n \n } />\n \n \n \n})\nUploadPage.propTypes = {\n uploadId: PropTypes.string\n}\n\nexport default UploadPage\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react'\nimport { MenuBar } from './MenuBar'\nimport { routes } from './Routes'\nimport MenuBarRoute from './MenuBarRoute'\n\nconst MainMenu = React.memo(() => {\n return {routes.map((menu) => )}\n})\n\nexport default MainMenu\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useMemo } from 'react'\nimport { matchPath, useLocation, Link as RouterLink } from 'react-router-dom'\nimport { Typography, Breadcrumbs as MUIBreadcrumbs, Link, Box, makeStyles, Tooltip } from '@material-ui/core'\nimport { HelpButton } from '../Help'\nimport { allRoutes } from './Routes'\nimport {useDataStore} from \"../DataStore\"\n\nconst useStyles = makeStyles(theme => ({\n root: {\n marginLeft: 5,\n marginTop: theme.spacing(-0.25)\n },\n help: {\n marginLeft: theme.spacing(0.5)\n },\n ellipsis: {\n direction: 'rtl',\n textAlign: 'left',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: 350\n }\n}))\n\nconst Breadcrumbs = React.memo(function Breadcrumbs() {\n const styles = useStyles()\n const dataStore = useDataStore()\n const {pathname} = useLocation()\n const routes = useMemo(() => allRoutes.slice().reverse(), [])\n\n const getRef = useCallback((breadcrumb) => {\n if (breadcrumb === 'Entry') {\n return dataStore.breadcrumb.entryRef\n } else if (breadcrumb === 'Upload') {\n return dataStore.breadcrumb.uploadRef\n } else {\n return undefined\n }\n }, [dataStore.breadcrumb.entryRef, dataStore.breadcrumb.uploadRef])\n\n const getFinalBreadcrumb = useCallback((breadcrumb) => {\n if (breadcrumb === 'Entry') {\n return dataStore.breadcrumb.getEntry()\n } else if (breadcrumb === 'Upload') {\n return dataStore.breadcrumb.getUpload()\n } else {\n return breadcrumb\n }\n }, [dataStore.breadcrumb])\n\n return \n {routes\n .filter(route => route.breadcrumb && route.path)\n .map(route => ({route: route, match: matchPath(pathname, {path: route.path})}))\n .filter(({match}) => match)\n .map(({route, match}, i) => {\n const title = \n {getFinalBreadcrumb(route.breadcrumb)}\n \n if (match.url === pathname) {\n return \n {title}\n {route.help && (\n \n \n \n )}\n \n } else {\n return {title}\n }\n })}\n \n})\n\nexport default Breadcrumbs\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport {\n AppBar as MuiAppBar,\n Toolbar,\n Link,\n LinearProgress,\n makeStyles\n} from '@material-ui/core'\nimport LoginLogout from '../LoginLogout'\nimport UnitMenu from '../units/UnitMenu'\nimport MainMenu from './MainMenu'\nimport { useLoading } from '../api'\nimport { guiBase, oasis } from '../../config'\nimport Breadcrumbs from './Breadcrumbs'\n\nexport const appBarHeight = 10\n\n/**\n * Linear indefinite loading indicator that is connceted to API traffic.\n */\nfunction LoadingIndicator({className}) {\n const loading = useLoading()\n return loading && \n}\n\nLoadingIndicator.propTypes = {\n className: PropTypes.string\n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n zIndex: theme.zIndex.drawer + 1,\n backgroundColor: 'white',\n display: 'flex',\n flexDirection: 'column',\n padding: theme.spacing(1),\n height: theme.spacing(appBarHeight)\n },\n logo: {\n display: 'flex',\n alignItems: 'center',\n alignContent: 'flex-start',\n color: theme.palette.primary.main\n },\n toolbar: {\n display: 'flex',\n flexDirection: 'row'\n },\n logoImg: {\n height: 44,\n marginLeft: theme.spacing(1),\n marginRight: theme.spacing(2),\n marginTop: theme.spacing(1)\n },\n actions: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n justifyContent: 'space-evenly'\n },\n menuItem: {\n borderColor: theme.palette.getContrastText(theme.palette.primary.main),\n marginRight: 0,\n minWidth: '6rem',\n justifyContent: 'flex-start'\n },\n navigation: {\n flexGrow: 1,\n marginRight: theme.spacing(1),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n justifyContent: 'space-evenly'\n },\n progress: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0\n },\n crumbs: {\n padding: '9px 0px 9px 5px'\n }\n}))\n\n/**\n * The App bar that is always shown at the top of the screen.\n */\nexport default function AppBar() {\n const styles = useStyles()\n\n return \n \n
\n \n \"The\n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useMemo, useRef, useState } from 'react'\nimport { makeStyles } from '@material-ui/core/styles'\nimport { useLocation } from 'react-router-dom'\nimport { Snackbar, SnackbarContent, IconButton, Link as MuiLink, Link } from '@material-ui/core'\nimport UnderstoodIcon from '@material-ui/icons/Check'\nimport { amber } from '@material-ui/core/colors'\nimport AppBar, { appBarHeight } from './AppBar'\nimport { guiBase, version } from '../../config'\nimport { Routes } from './Routes'\nimport { ErrorBoundary } from '../errors'\nimport { useCookies } from 'react-cookie'\n\nexport const ScrollContext = React.createContext({scrollParentRef: null})\n\nconst useTermsSnackStyles = makeStyles(theme => ({\n termsLink: {\n color: theme.palette.primary.light\n }\n}))\n\nfunction TermsSnack() {\n const [cookies, setCookie] = useCookies()\n const [accepted, setAccepted] = useState(cookies['terms-accepted'])\n const classes = useTermsSnackStyles()\n\n const cookieOptions = useMemo(() => ({\n expires: new Date(2147483647 * 1000),\n path: '/' + guiBase.split('/').slice(1).join('/')\n }), [])\n\n return \n \n NOMAD only uses cookies that are strictly necessary for this site's functionality.\n No tracking or marketing cookies are used. By using this site you agree to\n our terms of service.\n }\n action={[\n {\n setCookie('terms-accepted', true, cookieOptions)\n setAccepted(true)\n }}\n >\n \n \n ]}\n />\n \n}\n\nconst useBetaSnackStyles = makeStyles(theme => ({\n root: {},\n snack: {\n backgroundColor: amber[700]\n }\n}))\nfunction BetaSnack() {\n const classes = useBetaSnackStyles()\n const [understood, setUnderstood] = useState(false)\n\n if (!version) {\n console.warn('no version data available')\n return null\n }\n\n if (!version.isBeta && !version.isTest) {\n return null\n }\n\n return \n \n You are using a {version.isBeta ? 'beta' : 'test'} version of NOMAD ({version.label}). {\n version.usesBetaData ? 'This version is not using the official data. Everything you upload here, might get lost.' : ''\n } Click here for the official NOMAD version.\n }\n action={[\n setUnderstood(true)}>\n \n \n ]}\n />\n \n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n minWidth: 1024\n },\n appFrame: {\n zIndex: 1,\n overflow: 'hidden',\n position: 'relative',\n display: 'flex',\n width: '100%',\n height: '100vh'\n },\n content: {\n marginTop: theme.spacing(appBarHeight),\n flexGrow: 1,\n backgroundColor: theme.palette.background.default,\n width: '100%',\n overflow: 'auto'\n }\n}))\n\nexport default function Navigation() {\n const classes = useStyles()\n const { pathname } = useLocation()\n const scrollParentRef = useRef(null)\n\n // Scroll to top upon changing page\n useEffect(() => {\n if (scrollParentRef.current) {\n scrollParentRef.current.scrollTo(0, 0)\n }\n }, [pathname])\n\n return (\n
\n
\n \n \n \n \n
\n \n \n \n
\n
\n
\n
\n )\n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react'\nimport { Helmet } from \"react-helmet\"\nimport { Router, Route } from 'react-router-dom'\nimport { QueryParamProvider } from 'use-query-params'\nimport { RecoilRoot } from 'recoil'\nimport CssBaseline from '@material-ui/core/CssBaseline'\nimport history from '../history'\nimport DateFnsUtils from '@date-io/date-fns'\nimport { MuiPickersUtilsProvider } from '@material-ui/pickers'\nimport { ui, nomadTheme, keycloakBase, keycloakRealm, keycloakClientId } from '../config'\nimport Keycloak from 'keycloak-js'\nimport { ReactKeycloakProvider } from '@react-keycloak/web'\nimport { MuiThemeProvider } from '@material-ui/core/styles'\nimport { ErrorSnacks, ErrorBoundary } from './errors'\nimport Navigation from './nav/Navigation'\nimport GUIMenu from './GUIMenu'\nimport { APIProvider, GlobalLoginRequired, onKeycloakEvent } from './api'\nimport DataStore from './DataStore'\nimport { UnitProvider } from './units/UnitContext'\nimport { GlobalMetainfo } from './archive/metainfo'\n\nconst keycloak = new Keycloak({\n url: keycloakBase,\n realm: keycloakRealm,\n clientId: keycloakClientId\n})\n\nexport default function App() {\n return \n \n {ui?.theme?.title || 'NOMAD'}\n \n }\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n}\n","/*\n * Copyright The NOMAD Authors.\n *\n * This file is part of NOMAD. See https://nomad-lab.eu for further info.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport './index.css'\nimport '@fontsource/titillium-web/400.css'\nimport '@fontsource/titillium-web/600.css'\nimport './wdyr'\nimport 'react-app-polyfill/ie11'\nimport 'react-app-polyfill/stable'\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport '../node_modules/react-grid-layout/css/styles.css'\nimport '../node_modules/react-resizable/css/styles.css'\nimport App from './components/App'\nimport '@fontsource/material-icons'\n\nReactDOM.render(, document.getElementById('root'))\n"],"sourceRoot":""}