@@ -16,19 +16,16 @@ class DeployPage extends React.Component {
1616 shortCode : PropTypes . string . isRequired
1717 } ;
1818
19- constructor ( props ) {
20- super ( props ) ;
21- this . state = {
22- owner : null ,
23- repo : null ,
24- deployments : null ,
25- commits : null ,
26- deployInfo : null ,
27- error : null ,
28- loading : null ,
29- tags : null
30- } ;
31- }
19+ state = {
20+ owner : null ,
21+ repo : null ,
22+ deployments : null ,
23+ commits : null ,
24+ deployInfo : null ,
25+ error : null ,
26+ loading : null ,
27+ tags : null
28+ } ;
3229
3330 isLoading ( ) {
3431 if ( this . state . loading === null ) {
@@ -53,14 +50,17 @@ class DeployPage extends React.Component {
5350
5451 async decodeShortCode ( ) {
5552 const {
56- match : {
57- params : { code }
58- }
53+ history,
54+ match : { params }
5955 } = this . props ;
6056 this . startLoad ( 'parameters' ) ;
6157 try {
62- let { owner, repo, deployments } = await shortUrls . decode ( code ) ;
58+ let { owner, repo, deployments } = await shortUrls . decode ( params . code ) ;
6359 this . setState ( { owner, repo, deployments } ) ;
60+ if ( params . owner !== owner || params . repo !== repo ) {
61+ history . replace ( `/s/${ params . code } /${ owner } /${ repo } ` ) ;
62+ }
63+
6464 this . fetchShas ( ) ;
6565 this . fetchCommits ( ) ;
6666 this . finishLoad ( 'parameters' ) ;
@@ -144,46 +144,55 @@ class DeployPage extends React.Component {
144144
145145 document . title = `What's Deployed on ${ owner } /${ repo } ?` ;
146146
147- if ( error ) {
148- return < div className = "alert alert-danger" > { error . toString ( ) } </ div > ;
149- }
150-
151- if ( this . isLoading ( ) ) {
152- return (
153- < div >
154- < span > Loading { Array . from ( loading || '...' ) . join ( ' and ' ) } </ span >
155- < AutoProgressBar
156- count = { loading ? loading . size : 0 }
157- total = { 3 }
158- targetTime = { 5000 }
159- />
160- </ div >
161- ) ;
162- }
163-
164- if ( ! deployInfo ) {
165- return (
166- < div className = "alert alert-danger" >
167- No Deployment info could be found
168- </ div >
169- ) ;
170- }
171-
172147 return (
173148 < div >
174- < DeployTable
175- deployInfo = { deployInfo }
176- commits = { commits }
177- tags = { tags }
178- shortUrl = { `/s/${ code } ` }
179- />
180- < RepoSummary
181- deployInfo = { deployInfo }
182- tags = { tags }
183- owner = { owner }
184- repo = { repo }
185- />
186- < Culprits deployInfo = { deployInfo } owner = { owner } repo = { repo } />
149+ < h2 className = "text-center" >
150+ What's Deployed
151+ { owner && repo && (
152+ < span >
153+ { ' ' }
154+ on{ ' ' }
155+ < a
156+ href = { `https://github.com/${ owner } /${ repo } ` }
157+ className = "reponame"
158+ >
159+ { owner } /{ repo }
160+ </ a >
161+ </ span >
162+ ) }
163+ ?
164+ </ h2 >
165+ { error && < div className = "alert alert-danger" > { error . toString ( ) } </ div > }
166+ { this . isLoading ( ) ? (
167+ < >
168+ < span > Loading { Array . from ( loading || '...' ) . join ( ' and ' ) } </ span >
169+ < AutoProgressBar
170+ count = { loading ? loading . size : 0 }
171+ total = { 3 }
172+ targetTime = { 5000 }
173+ />
174+ </ >
175+ ) : ! deployInfo ? (
176+ < div className = "alert alert-danger" >
177+ No Deployment info could be found
178+ </ div >
179+ ) : (
180+ < >
181+ < DeployTable
182+ deployInfo = { deployInfo }
183+ commits = { commits }
184+ tags = { tags }
185+ shortUrl = { `/s/${ code } ` }
186+ />
187+ < RepoSummary
188+ deployInfo = { deployInfo }
189+ tags = { tags }
190+ owner = { owner }
191+ repo = { repo }
192+ />
193+ < Culprits deployInfo = { deployInfo } owner = { owner } repo = { repo } />
194+ </ >
195+ ) }
187196 </ div >
188197 ) ;
189198 }
0 commit comments