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

update: submodel versions added #110

Merged
Merged
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: 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
Loading