@@ -819,7 +819,6 @@ func databasePage(w http.ResponseWriter, r *http.Request, dbOwner string, dbFold
819819 MyStar bool
820820 MyWatch bool
821821 Config com.TomlConfig // FIXME: This seems silly to include here, when we just need to provide the server/port info
822- IsLive bool
823822 }
824823
825824 pageData .Meta .PageSection = "db_data"
@@ -948,16 +947,15 @@ func databasePage(w http.ResponseWriter, r *http.Request, dbOwner string, dbFold
948947 }
949948
950949 // Check if this is a live database
951- var liveNode string
952- pageData .IsLive , liveNode , err = com .CheckDBLive (dbOwner , dbFolder , dbName )
950+ isLive , liveNode , err := com .CheckDBLive (dbOwner , dbFolder , dbName )
953951 if err != nil {
954952 errorPage (w , r , http .StatusInternalServerError , err .Error ())
955953 return
956954 }
957955
958956 // Only standard databases have commits, branches, tags (etC)
959957 branchHeads := make (map [string ]com.BranchEntry )
960- if ! pageData . IsLive {
958+ if ! isLive {
961959 // If a specific commit was requested, make sure it exists in the database commit history
962960 if commitID != "" {
963961 commitList , err := com .GetCommitList (dbOwner , dbFolder , dbName )
@@ -1030,52 +1028,13 @@ func databasePage(w http.ResponseWriter, r *http.Request, dbOwner string, dbFold
10301028 return
10311029 }
10321030 }
1031+ }
10331032
1034- // Retrieve the database details
1035- err = com .DBDetails (& pageData .DB , pageData .Meta .LoggedInUser , dbOwner , dbFolder , dbName , commitID )
1036- if err != nil {
1037- errorPage (w , r , http .StatusBadRequest , err .Error ())
1038- return
1039- }
1040- } else {
1041- // FIXME: We need an equivalent of com.DBDetails() for live databases
1042- pageData .DB = com.SQLiteDBinfo {
1043- Info : com.DBInfo {
1044- Branch : "" ,
1045- Branches : 0 ,
1046- BranchList : nil ,
1047- Commits : 0 ,
1048- CommitID : "" ,
1049- Contributors : 1 , // 1 makes sense here, as we don't yet support sharing live databases
1050- Database : dbName ,
1051- DateCreated : time.Time {},
1052- DBEntry : com.DBTreeEntry {},
1053- DefaultBranch : "" ,
1054- DefaultTable : "" ,
1055- Discussions : 0 ,
1056- Downloads : 0 ,
1057- Folder : "" ,
1058- Forks : 0 ,
1059- FullDesc : "" ,
1060- LastModified : time.Time {},
1061- Licence : "" ,
1062- LicenceURL : "" ,
1063- MRs : 0 ,
1064- OneLineDesc : "" ,
1065- Public : false ,
1066- RepoModified : time.Time {},
1067- Releases : 0 ,
1068- SHA256 : "" ,
1069- Size : 0 ,
1070- SourceURL : "" ,
1071- Stars : 0 ,
1072- Tables : nil ,
1073- Tags : 0 ,
1074- Views : 0 ,
1075- Watchers : 0 ,
1076- },
1077- MaxRows : 0 ,
1078- }
1033+ // Retrieve the database details
1034+ err = com .DBDetails (& pageData .DB , pageData .Meta .LoggedInUser , dbOwner , dbFolder , dbName , commitID )
1035+ if err != nil {
1036+ errorPage (w , r , http .StatusBadRequest , err .Error ())
1037+ return
10791038 }
10801039
10811040 // Get the latest discussion and merge request count directly from PG, skipping the ones (incorrectly) stored in memcache
@@ -1125,7 +1084,7 @@ func databasePage(w http.ResponseWriter, r *http.Request, dbOwner string, dbFold
11251084 }
11261085
11271086 // If it's a standard database then we query it directly, otherwise we query it via our AMQP backend
1128- if ! pageData . IsLive {
1087+ if ! isLive {
11291088 bucket := pageData .DB .Info .DBEntry .Sha256 [:com .MinioFolderChars ]
11301089 id := pageData .DB .Info .DBEntry .Sha256 [com .MinioFolderChars :]
11311090 pageData .DB .Info .Tables , pageData .DB .Info .DefaultTable , pageData .Data , _ , err =
@@ -1235,7 +1194,7 @@ func databasePage(w http.ResponseWriter, r *http.Request, dbOwner string, dbFold
12351194 pageData .DB .Info .MRs = currentMRs
12361195
12371196 // If this is a standard database, then cache the table row data
1238- if ! pageData . IsLive {
1197+ if ! isLive {
12391198 rowCacheKey := com .TableRowsCacheKey (fmt .Sprintf ("tablejson/%s/%s/%d" , sortCol , sortDir , rowOffset ),
12401199 pageData .Meta .LoggedInUser , dbOwner , dbFolder , dbName , commitID , dbTable , pageData .DB .MaxRows )
12411200 err = com .CacheData (rowCacheKey , pageData .Data , com .Conf .Memcache .DefaultCacheTime )
0 commit comments