Skip to content

Commit

Permalink
Merge pull request #110 from catenax-ng/update/submodel_version
Browse files Browse the repository at this point in the history
update: submodel versions added
  • Loading branch information
almadigabor authored May 8, 2024
2 parents b1ee5ac + 96ce9de commit f004a2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/features/provider/submodels/apiSlice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/********************************************************************************
* Copyright (c) 2021,2022,2023 T-Systems International GmbH
* Copyright (c) 2022,2023 Contributors to the Eclipse Foundation
* Copyright (c) 2022,2024 T-Systems International GmbH
* Copyright (c) 2022,2024 Contributors to the Eclipse Foundation
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
Expand Down Expand Up @@ -35,7 +35,7 @@ export const helpApiSlice = apiSlice.injectEndpoints({
transformResponse: (response: any[]) => {
const pageData = response.map(submodel => {
return {
name: submodel.title,
name: `${submodel.title} - ${submodel.version}`,
description: submodel.description,
id: submodel.id,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
18 changes: 6 additions & 12 deletions src/features/provider/submodels/slice.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
/********************************************************************************
* Copyright (c) 2022,2024 T-Systems International GmbH
Expand Down Expand Up @@ -41,7 +42,6 @@ const initialState: ISubmodelsSlice = {
previewTableDescriptions: [],
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleColumnTypes = (value: any) => {
if (value.type.includes('number')) {
return value.enum?.length ? 'singleSelect' : 'number';
Expand Down Expand Up @@ -90,8 +90,8 @@ export const submodelSlice = createSlice({
},
extraReducers: builder => {
builder.addCase(fetchSubmodelList.fulfilled, (state, { payload }) => {
const list = payload.map((e: { id: string; name: string }, index: number) => {
const item = { id: index, title: e.name, value: e.id };
const list = payload.map((e: { id: string; name: string; version: string }, index: number) => {
const item = { id: index, title: `${e.name} - ${e.version}`, value: e.id };
return item;
});
state.submodelList = list;
Expand Down Expand Up @@ -123,19 +123,13 @@ export const submodelSlice = createSlice({
// for submodel description table
state.previewTableHeadings = ['Field name', ...Object.keys(payload.items.properties)];
state.previewTableDescriptions = Object.entries(payload.items.properties).map(
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
([key, value]: any) => value.description,
([_key, value]: any) => value.description,
);
state.previewTableData = [
[
'Example entries',
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
...Object.entries(payload.items.properties).map(([key, value]: any) => value.examples[0]),
],
['Example entries', ...Object.entries(payload.items.properties).map(([_key, value]: any) => value.examples[0])],
[
'Mandatory',
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
...Object.entries(payload.items.properties).map(([key, value]: any) =>
...Object.entries(payload.items.properties).map(([key, _value]: any) =>
indexOf(payload.items.required, key) > -1 ? 'true' : 'false',
),
],
Expand Down

0 comments on commit f004a2f

Please sign in to comment.