Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSCFC4EMSCR-624 Add false links and draft for infrastructure for new … #240

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion mscr-ui/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,21 @@
},
"working-version": "",
"workspace": {
"annotations": "Annotations",
"crosswalks": "Crosswalks",
"group": "Group workspaces",
"label": "Name",
"mappings": "Mappings",
"navigation": "Workspaces",
"no-crosswalks": "There are no crosswalks to show yet",
"no-schemas": "There are no schemas to show yet",
"numberOfRevisions": "Revisions",
"ontologies": "Ontologies",
"personal": "Personal workspace",
"pid": "PID",
"schemas": "Schemas",
"state": "State",
"view": "View"
"view": "View",
"vocabularies": "Vocabularies"
}
}
6 changes: 5 additions & 1 deletion mscr-ui/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,21 @@
},
"working-version": "",
"workspace": {
"annotations": "",
"crosswalks": "",
"group": "",
"label": "",
"mappings": "",
"navigation": "",
"no-crosswalks": "",
"no-schemas": "",
"numberOfRevisions": "",
"ontologies": "",
"personal": "",
"pid": "",
"schemas": "",
"state": "",
"view": ""
"view": "",
"vocabularies": ""
}
}
6 changes: 5 additions & 1 deletion mscr-ui/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,21 @@
},
"working-version": "",
"workspace": {
"annotations": "",
"crosswalks": "",
"group": "",
"label": "",
"mappings": "",
"navigation": "",
"no-crosswalks": "",
"no-schemas": "",
"numberOfRevisions": "",
"ontologies": "",
"personal": "",
"pid": "",
"schemas": "",
"state": "",
"view": ""
"view": "",
"vocabularies": ""
}
}
19 changes: 15 additions & 4 deletions mscr-ui/src/common/components/mscr-search/mscr-search.slice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@ import {
PaginatedQuery,
} from '@app/common/interfaces/search.interface';
import { UrlState } from '@app/common/utils/hooks/use-url-state';
import {
formatsRelatedToSubtype,
SubType,
} from '@app/common/interfaces/type.interface';

function createUrl(
scope: string,
{ type, pageSize, urlState, ownerOrg }: PaginatedQuery
{ type, pageSize, urlState, ownerOrg, subType }: PaginatedQuery
) {
const pageFrom = (urlState.page - 1) * pageSize;
return `/frontend/mscrSearch${scope}Content?query=&type=${type}${
scope === 'Org' ? `&ownerOrg=${ownerOrg}` : ''
}&pageSize=${pageSize}&pageFrom=${pageFrom}`;
let url = `/frontend/mscrSearch${scope}Content?query=&type=${type}`;
if (scope == 'Org' && ownerOrg) {
url = `${url}&ownerOrg=${ownerOrg}`;
}
if (subType != SubType.Schema && subType != SubType.Crosswalk && subType) {
for (const format in formatsRelatedToSubtype[subType]) {
url = `${url}&format=${format}`;
}
}
return `${url}&pageSize=${pageSize}&pageFrom=${pageFrom}`;
}

function createSearchUrl(urlState: UrlState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
import { State } from '@app/common/interfaces/state.interface';
import { SchemaWithVersionInfo } from '@app/common/interfaces/schema.interface';
import { CrosswalkWithVersionInfo } from '@app/common/interfaces/crosswalk.interface';
import { Type } from '@app/common/interfaces/search.interface';
import { useStoreDispatch } from '@app/store';
import { Format } from '@app/common/interfaces/format.interface';
import { Type } from '@app/common/interfaces/type.interface';

export function updateActionMenu(
dispatch: ReturnType<typeof useStoreDispatch>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getDatamodelApiBaseQuery } from '@app/store/api-base-query';
import { Status } from '@app/common/interfaces/status.interface';
import { SearchInternalClasses } from '@app/common/interfaces/search-internal-classes.interface';
import { ResourceType } from '@app/common/interfaces/resource-type.interface';
import { Type } from '@app/common/interfaces/type.interface';
import { DatamodelType } from '@app/common/interfaces/type.interface';

export interface InternalResourcesSearchParams {
query: string;
Expand All @@ -16,7 +16,7 @@ export interface InternalResourcesSearchParams {
sortLang?: string;
pageSize?: number;
pageFrom?: number;
limitToModelType?: Type;
limitToModelType?: DatamodelType;
}

function createUrl(obj: InternalResourcesSearchParams): string {
Expand Down
116 changes: 116 additions & 0 deletions mscr-ui/src/common/components/side-navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,34 @@ export default function SideNavigationPanel({ user }: { user?: MscrUser }) {
</Link>
}
/>
<MscrSideNavigationLevel3
className="personal"
subLevel={3}
selected={router.asPath.startsWith(personalCrosswalksPath + '/mappings')}
content={
<Link
onClick={() => handleNavigate(true)}
href={personalCrosswalksPath}
passHref
>
<RouterLink>{t('workspace.mappings')}</RouterLink>
</Link>
}
/>
<MscrSideNavigationLevel3
className="personal"
subLevel={3}
selected={router.asPath.startsWith(personalCrosswalksPath + '/annotations')}
content={
<Link
onClick={() => handleNavigate(true)}
href={personalCrosswalksPath}
passHref
>
<RouterLink>{t('workspace.annotations')}</RouterLink>
</Link>
}
/>
<MscrSideNavigationLevel3
className="personal"
subLevel={3}
Expand All @@ -129,6 +157,34 @@ export default function SideNavigationPanel({ user }: { user?: MscrUser }) {
</Link>
}
/>
<MscrSideNavigationLevel3
className="personal"
subLevel={3}
selected={router.asPath.startsWith(personalSchemasPath + '/vocabularies')}
content={
<Link
onClick={() => handleNavigate(true)}
href={personalSchemasPath}
passHref
>
<RouterLink>{t('workspace.vocabularies')}</RouterLink>
</Link>
}
/>
<MscrSideNavigationLevel3
className="personal"
subLevel={3}
selected={router.asPath.startsWith(personalSchemasPath + '/ontologies')}
content={
<Link
onClick={() => handleNavigate(true)}
href={personalSchemasPath}
passHref
>
<RouterLink>{t('workspace.ontologies')}</RouterLink>
</Link>
}
/>
</PersonalNavigationWrapper>
</MscrSideNavigationLevel1>
<MscrSideNavigationLevel1
Expand Down Expand Up @@ -170,6 +226,38 @@ export default function SideNavigationPanel({ user }: { user?: MscrUser }) {
</Link>
}
/>
<MscrSideNavigationLevel3
className="group"
subLevel={3}
selected={router.asPath.startsWith(
'/' + group.id + '/crosswalks/mappings'
)}
content={
<Link
onClick={() => handleNavigate()}
href={'/' + group.id + '/crosswalks'}
passHref
>
<RouterLink>{t('workspace.mappings')}</RouterLink>
</Link>
}
/>
<MscrSideNavigationLevel3
className="group"
subLevel={3}
selected={router.asPath.startsWith(
'/' + group.id + '/crosswalks/annotations'
)}
content={
<Link
onClick={() => handleNavigate()}
href={'/' + group.id + '/crosswalks'}
passHref
>
<RouterLink>{t('workspace.annotations')}</RouterLink>
</Link>
}
/>
<MscrSideNavigationLevel3
className="group"
subLevel={3}
Expand All @@ -184,6 +272,34 @@ export default function SideNavigationPanel({ user }: { user?: MscrUser }) {
</Link>
}
/>
<MscrSideNavigationLevel3
className="group"
subLevel={3}
selected={router.asPath.startsWith('/' + group.id + '/schemas/vocabularies')}
content={
<Link
onClick={() => handleNavigate()}
href={'/' + group.id + '/schemas'}
passHref
>
<RouterLink>{t('workspace.vocabularies')}</RouterLink>
</Link>
}
/>
<MscrSideNavigationLevel3
className="group"
subLevel={3}
selected={router.asPath.startsWith('/' + group.id + '/schemas/ontologies')}
content={
<Link
onClick={() => handleNavigate()}
href={'/' + group.id + '/schemas'}
passHref
>
<RouterLink>{t('workspace.ontologies')}</RouterLink>
</Link>
}
/>
</MscrSideNavigationLevel2>
))}
</MscrSideNavigationLevel1>
Expand Down
2 changes: 1 addition & 1 deletion mscr-ui/src/common/components/tabmenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {
setSelectedTab,
} from '@app/common/components/content-view/content-view.slice';
import { useTranslation } from 'next-i18next';
import { Type } from '@app/common/interfaces/search.interface';
import { TabIndex, TabText, MscrTabs } from '@app/common/interfaces/tabmenu';
import { ReactNode } from 'react';
import {
StyledTab,
StyledTabs,
} from '@app/common/components/tabmenu/tabmenu.styles';
import { setQuery } from '@app/common/components/data-type-registry-search/data-type-registry-search.slice';
import { Type } from '@app/common/interfaces/type.interface';

interface TabPanel {
tabIndex: TabIndex;
Expand Down
2 changes: 1 addition & 1 deletion mscr-ui/src/common/components/version-history/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
VersionHeading,
VersionHistoryContainer,
} from '@app/common/components/version-history/version-history.styles';
import { Type } from '@app/common/interfaces/search.interface';
import { useRouter } from 'next/router';
import { State } from '@app/common/interfaces/state.interface';
import { Type } from '@app/common/interfaces/type.interface';

interface RevisionRow {
versionLabel: string;
Expand Down
4 changes: 2 additions & 2 deletions mscr-ui/src/common/interfaces/datamodel.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Status } from './status.interface';
import { Type } from './type.interface';
import { DatamodelType } from './type.interface';

export interface DataModel {
comment: {
Expand All @@ -20,5 +20,5 @@ export interface DataModel {
modified: string;
prefix: string;
status: Status;
type: Type;
type: DatamodelType;
}
7 changes: 2 additions & 5 deletions mscr-ui/src/common/interfaces/search.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { State } from '@app/common/interfaces/state.interface';
import { Format } from '@app/common/interfaces/format.interface';
import { ContentRevision } from '@app/common/interfaces/content-revision.interface';
import { UrlState } from '@app/common/utils/hooks/use-url-state';
import { SubType, Type } from '@app/common/interfaces/type.interface';

export interface Label {
[key: string]: string;
Expand All @@ -13,11 +14,6 @@ export enum Visibility {
Public = 'PUBLIC',
}

export enum Type {
Crosswalk = 'CROSSWALK',
Schema = 'SCHEMA',
}

export interface ResultInfo {
id: string;
handle: string;
Expand All @@ -42,6 +38,7 @@ export interface ResultInfo {
export interface PaginatedQuery {
query?: string;
type?: Type;
subType?: SubType;
ownerOrg?: string;
pageSize: number;
urlState: UrlState;
Expand Down
28 changes: 27 additions & 1 deletion mscr-ui/src/common/interfaces/type.interface.ts
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
export type Type = 'LIBRARY' | 'PROFILE';
import { Format } from '@app/common/interfaces/format.interface';

export enum Type {
Crosswalk = 'CROSSWALK',
Schema = 'SCHEMA',
}

export enum SubType {
Schema,
Vocabulary,
Ontology,
Crosswalk,
Mapping,
Annotation,
}

export const formatsRelatedToSubtype = {
0: [Format.Csv, Format.Xsd, Format.Jsonschema, Format.Shacl],
1: [Format.Skosrdf, Format.Enum],
2: [Format.Rdfs, Format.Owl],
3: [Format.Csv, Format.Xsd, Format.Jsonschema, Format.Shacl],
4: [Format.Skosrdf, Format.Rdfs, Format.Owl],
5: [Format.Csv, Format.Xsd, Format.Jsonschema,]
};

// Leftover from codebase
export type DatamodelType = 'LIBRARY' | 'PROFILE';
2 changes: 1 addition & 1 deletion mscr-ui/src/common/utils/hooks/use-initial-form.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useTranslation } from 'next-i18next';
import { Format } from '@app/common/interfaces/format.interface';
import { State } from '@app/common/interfaces/state.interface';
import { Type } from '@app/common/interfaces/search.interface';
import { LanguageBlockType } from 'yti-common-ui/components/form/language-selector';
import { Type } from '@app/common/interfaces/type.interface';

export interface FormType {
format: Format;
Expand Down
4 changes: 2 additions & 2 deletions mscr-ui/src/common/utils/translation-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { TFunction } from 'next-i18next';
import { ResourceType } from '../interfaces/resource-type.interface';
import { Type } from '../interfaces/type.interface';
import { DatamodelType } from '../interfaces/type.interface';
import { NotificationKeys } from '@app/common/interfaces/notifications.interface';

export function translateModelType(type: Type, t: TFunction) {
export function translateModelType(type: DatamodelType, t: TFunction) {
switch (type) {
case 'LIBRARY':
return t('library');
Expand Down
Loading
Loading