@@ -10,13 +10,15 @@ import {rpc} from '../utils/rpc';
10
10
interface SitePageProps {
11
11
path : string ;
12
12
siteId ?: string ;
13
+ tab ?: string ;
13
14
}
14
15
15
16
interface SitePageState {
16
17
currentPath : string ;
17
18
siteId : string ;
18
19
manifests : Array < any > ;
19
20
loading : boolean ;
21
+ tab ?: string ;
20
22
}
21
23
22
24
export class SitePage extends Page < SitePageProps , SitePageState > {
@@ -27,6 +29,7 @@ export class SitePage extends Page<SitePageProps, SitePageState> {
27
29
siteId : props . siteId ,
28
30
loading : false ,
29
31
manifests : [ ] ,
32
+ tab : props . tab ,
30
33
} ;
31
34
}
32
35
@@ -47,6 +50,10 @@ export class SitePage extends Page<SitePageProps, SitePageState> {
47
50
}
48
51
}
49
52
53
+ async componentWillReceiveProps ( props : SitePageProps ) {
54
+ this . setState ( { tab : props . tab } ) ;
55
+ }
56
+
50
57
filterManifests ( manifests : Array < any > ) {
51
58
return manifests . sort (
52
59
( a , b ) => new Date ( b . modified ) . getTime ( ) - new Date ( a . modified ) . getTime ( )
@@ -57,10 +64,44 @@ export class SitePage extends Page<SitePageProps, SitePageState> {
57
64
return < Loading /> ;
58
65
}
59
66
67
+ renderTabSet ( ) {
68
+ return (
69
+ < div class = "BuildPage__tabset" >
70
+ < div class = "BuildPage__tabset__bar" >
71
+ < Link
72
+ className = { `BuildPage__tabset__bar__tab ${
73
+ this . state . tab === undefined
74
+ ? 'BuildPage__tabset__bar__tab--active'
75
+ : ''
76
+ } `}
77
+ href = { this . state . currentPath }
78
+ >
79
+ < span class = "material-icons-outlined" > link</ span >
80
+ Staging links
81
+ </ Link >
82
+ < Link
83
+ className = { `BuildPage__tabset__bar__tab ${
84
+ this . state . tab === 'history'
85
+ ? 'BuildPage__tabset__bar__tab--active'
86
+ : ''
87
+ } `}
88
+ href = { `${ this . state . currentPath } ?tab=history` }
89
+ >
90
+ < span class = "material-icons-outlined" > history</ span >
91
+ Builds
92
+ </ Link >
93
+ </ div >
94
+ < div >
95
+ { this . state . tab === undefined ? this . renderManifestTable ( ) : '' }
96
+ { this . state . tab === 'history' ? this . renderManifestTable ( ) : '' }
97
+ </ div >
98
+ </ div >
99
+ ) ;
100
+ }
101
+
60
102
renderManifestTable ( ) {
61
103
return this . state . manifests && this . state . manifests . length ? (
62
104
< div class = "SitePage__content__table" >
63
- < div class = "SitePage__content__table__title" > Staging links</ div >
64
105
< table >
65
106
< thead >
66
107
< tr >
@@ -138,38 +179,7 @@ export class SitePage extends Page<SitePageProps, SitePageState> {
138
179
</ Link >
139
180
</ div >
140
181
< div class = "SitePage__content" >
141
- { /*
142
- <div class="SitePage__content__table">
143
- <div class="SitePage__content__table__title">
144
- Scheduled launches
145
- </div>
146
- <table>
147
- <thead>
148
- <tr>
149
- <td>TTL</td>
150
- <td>Commit</td>
151
- <td>Modified</td>
152
- <td>Staging Link</td>
153
- </tr>
154
- </thead>
155
- <tbody>
156
- <tr>
157
- <td>Master</td>
158
- <td>
159
- <Link href="/fileset/sites/default/abc">abc</Link>
160
- </td>
161
- <td>2020/10/19 05:12</td>
162
- <td>
163
- <a href="#">Link</a>
164
- </td>
165
- </tr>
166
- </tbody>
167
- </table>
168
- </div>
169
- */ }
170
- { this . state . loading
171
- ? this . renderLoading ( )
172
- : this . renderManifestTable ( ) }
182
+ { this . state . loading ? this . renderLoading ( ) : this . renderTabSet ( ) }
173
183
</ div >
174
184
</ div >
175
185
) ;
0 commit comments