-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added user column to Named versions and Changeset tables + changeset …
…information panel (#98) - Added user column to both Named Versions and Changes table. - Added Information panel for the changeset that includes- changeset id, description, created by, created date , application and Changed Files information.
- Loading branch information
1 parent
972542f
commit a4fb572
Showing
22 changed files
with
623 additions
and
71 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...-versions-react/Pooja-Add-user-column-to-version-and-changes-tables_2023-10-26-07-02.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@itwin/manage-versions-react", | ||
"comment": "Added user column to Named versions and Changeset tables", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@itwin/manage-versions-react" | ||
} |
10 changes: 10 additions & 0 deletions
10
...-versions-react/Pooja-Add-user-column-to-version-and-changes-tables_2023-10-30-08-06.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@itwin/manage-versions-react", | ||
"comment": "Added information panel for changeset", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@itwin/manage-versions-react" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...es/modules/manage-versions/src/components/InformationPanel/ChangesetInformationPanel.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
.iac-info-panel { | ||
width: 400px; | ||
min-width: 400px; | ||
.iac-info-panel-body { | ||
.iac-info-panel-container { | ||
padding: var(--iui-size-xs); | ||
|
||
& + div { | ||
border-top: 1px solid var(--iui-color-border-subtle); | ||
} | ||
} | ||
.iac-info-panel-details { | ||
padding: var(--iui-size-xs); | ||
display: flex; | ||
flex-direction: row; | ||
align-items: flex-start; | ||
justify-content: space-between; | ||
.iac-info-panel-data-value { | ||
flex: 2; | ||
min-width: 50%; | ||
} | ||
} | ||
|
||
.iac-info-panel-property { | ||
display: flex; | ||
flex: 1; | ||
margin-right: var(--iui-size-m); | ||
justify-content: right; | ||
color: var(--iui-color-text-disabled); | ||
} | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...odules/manage-versions/src/components/InformationPanel/ChangesetInformationPanel.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { render, screen } from "@testing-library/react"; | ||
import React from "react"; | ||
|
||
import { ConfigProvider } from "../../common/configContext"; | ||
import { MOCKED_CONFIG_PROPS, MockedChangeset } from "../../mocks"; | ||
import { localeDateWithTimeFormat } from "../../models/utils"; | ||
import { defaultStrings } from "../ManageVersions/ManageVersions"; | ||
import { | ||
ChangesetInfoPanelProps, | ||
ChangesetInformationPanel, | ||
} from "./ChangesetInformationPanel"; | ||
|
||
const mockedCreatedDateTime = localeDateWithTimeFormat( | ||
new Date(MockedChangeset().pushDateTime) | ||
); | ||
|
||
const renderComponent = (initialProps?: Partial<ChangesetInfoPanelProps>) => { | ||
const props: ChangesetInfoPanelProps = { | ||
changeset: MockedChangeset(), | ||
onClose: jest.fn(), | ||
stringOverrides: defaultStrings.informationPanelStringOverrides, | ||
...initialProps, | ||
}; | ||
return render( | ||
<ConfigProvider {...MOCKED_CONFIG_PROPS}> | ||
<ChangesetInformationPanel {...props} /> | ||
</ConfigProvider> | ||
); | ||
}; | ||
|
||
describe("ChangesetInformationPanel test", () => { | ||
it("should show required details in information-panel", () => { | ||
const { container } = renderComponent(); | ||
const expectedValues = [ | ||
{ property: "Created By: ", value: MockedChangeset().createdBy }, | ||
{ property: "Date Created: ", value: mockedCreatedDateTime }, | ||
{ property: "Application: ", value: MockedChangeset().application.name }, | ||
{ | ||
property: "Changed Files: ", | ||
value: MockedChangeset().synchronizationInfo.changedFiles.join(","), | ||
}, | ||
]; | ||
|
||
const changeset_desc = container.querySelector( | ||
".iac-info-panel-container" | ||
) as Element; | ||
|
||
const info_panel_details = container.querySelectorAll( | ||
".iac-info-panel-details" | ||
); | ||
expect(info_panel_details.length).toBe(4); | ||
info_panel_details.forEach((detailsElement, index) => { | ||
const info_panel_property = detailsElement.querySelector( | ||
".iac-info-panel-property" | ||
) as Element; | ||
const info_panel_property_value = detailsElement.querySelector( | ||
".iac-info-panel-data-value" | ||
) as Element; | ||
expect(info_panel_property.textContent).toBe( | ||
expectedValues[index].property | ||
); | ||
expect(info_panel_property_value.textContent).toBe( | ||
expectedValues[index].value | ||
); | ||
}); | ||
|
||
expect(changeset_desc.textContent).toBe(MockedChangeset().description); | ||
}); | ||
|
||
it("should have close icon in the panel header", () => { | ||
renderComponent(); | ||
const closeButton = screen.getByLabelText("Close"); | ||
expect(closeButton).toBeTruthy(); | ||
}); | ||
}); |
85 changes: 85 additions & 0 deletions
85
...ges/modules/manage-versions/src/components/InformationPanel/ChangesetInformationPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import "./ChangesetInformationPanel.scss"; | ||
|
||
import { | ||
InformationPanel, | ||
InformationPanelBody, | ||
InformationPanelHeader, | ||
Text, | ||
} from "@itwin/itwinui-react"; | ||
import React from "react"; | ||
|
||
import { Changeset } from "../../models/changeset"; | ||
import { | ||
informationPanelDefaultStrings, | ||
localeDateWithTimeFormat, | ||
} from "../../models/utils"; | ||
import { InformationPanelStringOverrides } from "../ManageVersions/types"; | ||
|
||
export interface ChangesetInfoPanelProps { | ||
changeset: Changeset; | ||
onClose: (e: React.MouseEvent<Element, MouseEvent>) => void; | ||
stringOverrides?: InformationPanelStringOverrides; | ||
} | ||
|
||
export const ChangesetInformationPanel = (props: ChangesetInfoPanelProps) => { | ||
const { | ||
changeset, | ||
onClose, | ||
stringOverrides = informationPanelDefaultStrings, | ||
} = props; | ||
const files: string[] = changeset.synchronizationInfo?.changedFiles | ||
? changeset.synchronizationInfo.changedFiles | ||
: [stringOverrides.noValue]; | ||
|
||
const createdDateTime = localeDateWithTimeFormat( | ||
new Date(changeset.pushDateTime) | ||
); | ||
|
||
const renderProperty = (property: string, value: string | undefined) => { | ||
return ( | ||
<div className="iac-info-panel-details"> | ||
<span className="iac-info-panel-property">{`${property}: `}</span> | ||
<span className="iac-info-panel-data-value">{value}</span> | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<InformationPanel className={"iac-info-panel"} resizable={false} isOpen> | ||
<InformationPanelHeader onClose={onClose}> | ||
<Text variant="subheading"> | ||
{stringOverrides.title + changeset.index} | ||
</Text> | ||
</InformationPanelHeader> | ||
<InformationPanelBody> | ||
<div className="iac-info-panel-body"> | ||
<Text className="iac-info-panel-container"> | ||
{changeset.description} | ||
</Text> | ||
<div className="iac-info-panel-container"> | ||
{renderProperty( | ||
stringOverrides.createdBy, | ||
changeset.createdBy ?? "" | ||
)} | ||
{renderProperty(stringOverrides.createdDate, createdDateTime ?? "")} | ||
{renderProperty( | ||
stringOverrides.application, | ||
changeset.application.name ?? stringOverrides.noValue | ||
)} | ||
</div> | ||
|
||
<div className="iac-info-panel-container"> | ||
<Text variant="leading"> | ||
{stringOverrides.connectionAttributes} | ||
</Text> | ||
{renderProperty(stringOverrides.changedFiles, files.join(","))} | ||
</div> | ||
</div> | ||
</InformationPanelBody> | ||
</InformationPanel> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.