Skip to content

Commit

Permalink
#1274 Promotion level properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoraboeuf committed May 17, 2024
1 parent a163829 commit 46318b8
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {Space, Typography} from "antd";
import ValidationStamp from "@components/validationStamps/ValidationStamp";
import PromotionLevel from "@components/promotionLevels/PromotionLevel";

export default function Display({property}) {
return (
<>
<Space direction="vertical">
{
property.value.validationStamps.length > 0 &&
<>
<Typography.Text strong>Validations</Typography.Text>
<Space>
{
property.value.validationStamps.map(vs => (
<>
<ValidationStamp
key={vs.id}
validationStamp={vs}
/>
</>
))
}
</Space>
</>
}
{
property.value.promotionLevels.length > 0 &&
<>
<Typography.Text strong>Promotions</Typography.Text>
<Space>
{
property.value.promotionLevels.map(pl => (
<>
<PromotionLevel
key={pl.id}
promotionLevel={pl}
displayText={true}
/>
</>
))
}
</Space>
</>
}
</Space>
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {FaBolt} from "react-icons/fa";

export default function Icon() {
return <FaBolt/>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import Head from "next/head";
import {promotionLevelTitle} from "@components/common/Titles";
import StoredGridLayoutContextProvider from "@components/grid/StoredGridLayoutContext";
import MainPage from "@components/layouts/MainPage";
import {Space} from "antd";
import {Skeleton} from "antd";
import {promotionLevelBreadcrumbs} from "@components/common/Breadcrumbs";
import {PromotionLevelImage} from "@components/promotionLevels/PromotionLevelImage";
import LoadingContainer from "@components/common/LoadingContainer";
import StoredGridLayout from "@components/grid/StoredGridLayout";
import PromotionLevelLeadTimeChart from "@components/promotionLevels/PromotionLevelLeadTimeChart";
import GridCell from "@components/grid/GridCell";
Expand All @@ -27,6 +25,7 @@ import PromotionLevelStabilityChart from "@components/promotionLevels/PromotionL
import PromotionLevelHistory from "@components/promotionLevels/PromotionLevelHistory";
import UserMenuActions from "@components/entities/UserMenuActions";
import PromotionLevelViewTitle from "@components/promotionLevels/PromotionLevelViewTitle";
import PromotionLevelViewDrawer from "@components/promotionLevels/PromotionLevelViewDrawer";

export default function PromotionLevelView({id}) {

Expand Down Expand Up @@ -168,15 +167,15 @@ export default function PromotionLevelView({id}) {
commands={commands}
description={promotionLevel.description}
>
<LoadingContainer loading={loadingPromotionLevel} tip="Loading promotion level">
<Skeleton loading={loadingPromotionLevel} active>
<StoredGridLayout
id="page-promotion-level-layout"
defaultLayout={defaultLayout}
items={items}
rowHeight={30}
/>
{/* TODO Promotion levels properties */}
</LoadingContainer>
<PromotionLevelViewDrawer promotionLevel={promotionLevel} loading={loadingPromotionLevel}/>
</Skeleton>
</MainPage>
</StoredGridLayoutContextProvider>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import InfoViewDrawer from "@components/common/InfoViewDrawer";
import PropertiesSection from "@components/framework/properties/PropertiesSection";
import InformationSection from "@components/framework/information/InformationSection";

export default function PromotionLevelViewDrawer({promotionLevel, loading}) {
return (
<>
<InfoViewDrawer
title="Promotion level information"
tooltip="Displays information about the promotion level"
width="33%"
>
<PropertiesSection
entity={promotionLevel}
loading={loading}
/>
<InformationSection
entity={promotionLevel}
loading={loading}
/>
</InfoViewDrawer>
</>
)
}
26 changes: 17 additions & 9 deletions ontrack-web-core/components/services/fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ export const gqlPromotionLevelFragment = gql`
${gqlUserMenuActionFragment}
`

export const gqlPromotionLevelByIdQuery = gql`
query PromotionLevelById($id: Int!) {
promotionLevel(id: $id) {
...PromotionLevelData
}
}
${gqlPromotionLevelFragment}
`

export const getPromotionLevelById = (client, id) => {
return client.request(
gqlPromotionLevelByIdQuery,
Expand Down Expand Up @@ -187,3 +178,20 @@ export const gqlValidationStampByIdQuery = gql`
${gqlInformationFragment}
${gqlUserMenuActionFragment}
`

export const gqlPromotionLevelByIdQuery = gql`
query PromotionLevelById($id: Int!) {
promotionLevel(id: $id) {
...PromotionLevelData
properties {
...propertiesFragment
}
information {
...informationFragment
}
}
}
${gqlPromotionLevelFragment}
${gqlPropertiesFragment}
${gqlInformationFragment}
`

0 comments on commit 46318b8

Please sign in to comment.