Skip to content

Commit

Permalink
CCS-3790 Product name and version url fragment missing from the view …
Browse files Browse the repository at this point in the history
…on Portal URL intemittenly (#409)

* CCS-3775 Update view_uri to match the ideal URL path

* added support for copy url and assembly fixes

* CCS-3790 Product name and version url fragment missing from the view on Portal URL intemittenly
  • Loading branch information
rednitish committed Sep 9, 2020
1 parent 1509e87 commit 6e519e8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ exports[`AssemblyDisplay tests should render AssemblyDisplay component 1`] = `
modulePath=""
onGetProduct={[Function]}
onGetVersion={[Function]}
onPublishEvent={[Function]}
productInfo=""
updateDate={[Function]}
variant={null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ exports[`ModuleDisplay tests should render ModuleDisplay component 1`] = `
modulePath=""
onGetProduct={[Function]}
onGetVersion={[Function]}
onPublishEvent={[Function]}
productInfo=""
updateDate={[Function]}
variant={null}
Expand Down
5 changes: 5 additions & 0 deletions pantheon-bundle/frontend/src/app/assemblyDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class AssemblyDisplay extends Component<any, any, any> {
updateDate={this.updateDate}
onGetProduct={this.getProduct}
onGetVersion={this.getVersion}
onPublishEvent={this.onPublishEvent}
/>
</Card>
</div>
Expand Down Expand Up @@ -251,6 +252,10 @@ class AssemblyDisplay extends Component<any, any, any> {
this.setState({ versionValue: version })
}

private onPublishEvent = () => {
this.fetchModuleDetails(this.props)
}

private getVersionUUID = (path) => {
// Remove /assembly from path
path = path.substring(PathPrefixes.ASSEBMLY_PATH_PREFIX.length)
Expand Down
5 changes: 5 additions & 0 deletions pantheon-bundle/frontend/src/app/moduleDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class ModuleDisplay extends Component<any, any, any> {
updateDate={this.updateDate}
onGetProduct={this.getProduct}
onGetVersion={this.getVersion}
onPublishEvent={this.onPublishEvent}
/>
</Card>

Expand Down Expand Up @@ -264,6 +265,10 @@ class ModuleDisplay extends Component<any, any, any> {
this.setState({ versionValue: version })
}

private onPublishEvent = () => {
this.getVersionUUID(this.props.location.pathname)
}

private getVersionUUID = (path) => {
// remove /module from path
path = path.substring(PathPrefixes.MODULE_PATH_PREFIX.length)
Expand Down
6 changes: 4 additions & 2 deletions pantheon-bundle/frontend/src/app/versions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const props = {
updateDate: (draftUpdateDate, releaseUpdateDate, releaseVersion, variantUUID) => anymatch,
variant: "test",
variantUUID: "abcd-1234",
versionModulePath: "/modules/test_module/en_US/variants/test/draft"
versionModulePath: "/modules/test_module/en_US/variants/test/draft",
onPublishEvent: () => anymatch
}

describe('Versions tests', () => {
Expand Down Expand Up @@ -201,7 +202,8 @@ describe('Versions tests', () => {
updateDate: (draftUpdateDate, releaseUpdateDate, releaseVersion, variantUUID) => anymatch,
variant: "DEFAULT",
variantUUID: "abcd-1234",
versionModulePath: "versionPath"
versionModulePath: "versionPath",
onPublishEvent: () => anymatch
}
state.updateDate("-", "-", 1, "1234")
expect(state.modulePath).toEqual('somePath')
Expand Down
3 changes: 3 additions & 0 deletions pantheon-bundle/frontend/src/app/versions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface IProps {
updateDate: (draftUpdateDate, releaseUpdateDate, releaseVersion, variantUUID) => any
onGetProduct: (productValue) => any
onGetVersion: (versionValue) => any
onPublishEvent: () => void
}

interface IState {
Expand Down Expand Up @@ -441,11 +442,13 @@ class Versions extends Component<IProps, IState> {
// console.log('Published file path:', this.props.modulePath)
this.draft[0].version = '';
this.setState({ unpublishAlertForModuleVisible: false })
this.props.onPublishEvent()
} else {
formData.append(':operation', 'pant:unpublish');
// console.log('Unpublished file path:', this.props.modulePath);
this.release[0].version = '';
this.setState({ unpublishAlertForModuleVisible: true })
this.props.onPublishEvent()
}
formData.append('locale', 'en_US')
formData.append('variant', this.props.variant)
Expand Down

0 comments on commit 6e519e8

Please sign in to comment.