Explorar o código

Merge pull request #2621 from overleaf/jpa-ns-empty-history

Add messaging to projects with empty history

GitOrigin-RevId: 3fab0b115d35ec3d7f7d1ffa5603b7c7d3423c94
Eric Mc Sween %!s(int64=6) %!d(string=hai) anos
pai
achega
506bc44336

+ 5 - 1
services/web/app/views/project/editor/history.pug

@@ -1,10 +1,14 @@
-div#history(ng-show="ui.view == 'history'")
+div#history(ng-show="ui.view == 'history' && history.updates.length > 0")
 	include ./history/entriesListV1
 	include ./history/entriesListV1
 	include ./history/entriesListV2
 	include ./history/entriesListV2
 
 
 	include ./history/diffPanelV1
 	include ./history/diffPanelV1
 	include ./history/previewPanelV2
 	include ./history/previewPanelV2
 
 
+.full-size(ng-if="ui.view == 'history' && history.updates.length === 0 && !isHistoryLoading()")
+	.no-history-available
+		h3
+			| #{translate('no_history_available')}
 script(type="text/ng-template", id="historyRestoreDiffModalTemplate")
 script(type="text/ng-template", id="historyRestoreDiffModalTemplate")
 	.modal-header
 	.modal-header
 		button.close(
 		button.close(

+ 2 - 2
services/web/app/views/project/editor/history/previewPanelV2.pug

@@ -1,5 +1,5 @@
 .diff-panel.full-size(
 .diff-panel.full-size(
-	ng-if="history.isV2 && history.viewMode === HistoryViewModes.COMPARE"
+	ng-if="history.isV2 && history.viewMode === HistoryViewModes.COMPARE && history.updates.length !== 0"
 )
 )
 	.diff(
 	.diff(
 		ng-show="!!history.selection.diff && !isHistoryLoading() && !history.selection.diff.error",
 		ng-show="!!history.selection.diff && !isHistoryLoading() && !history.selection.diff.error",
@@ -26,7 +26,7 @@
 		.alert.alert-danger #{translate("generic_something_went_wrong")}
 		.alert.alert-danger #{translate("generic_something_went_wrong")}
 
 
 .point-in-time-panel.full-size(
 .point-in-time-panel.full-size(
-	ng-if="history.isV2 && history.viewMode === HistoryViewModes.POINT_IN_TIME"
+	ng-if="history.isV2 && history.viewMode === HistoryViewModes.POINT_IN_TIME && history.updates.length !== 0"
 )
 )
 	.point-in-time-editor-container(
 	.point-in-time-editor-container(
 		ng-if="!!history.selection.file && !history.selection.file.loading && !history.selection.file.error"
 		ng-if="!!history.selection.file && !history.selection.file.loading && !history.selection.file.error"

+ 3 - 3
services/web/app/views/project/editor/history/toolbarV2.pug

@@ -40,7 +40,7 @@
 
 
 	//- point-in-time mode actions
 	//- point-in-time mode actions
 	div.history-toolbar-actions(
 	div.history-toolbar-actions(
-		ng-if="history.viewMode === HistoryViewModes.POINT_IN_TIME && !history.error"
+		ng-if="history.viewMode === HistoryViewModes.POINT_IN_TIME && !history.error && history.updates.length > 0"
 	)
 	)
 		button.history-toolbar-btn(
 		button.history-toolbar-btn(
 			ng-click="showAddLabelDialog();"
 			ng-click="showAddLabelDialog();"
@@ -68,7 +68,7 @@
 
 
 	//- compare mode actions
 	//- compare mode actions
 	div.history-toolbar-actions(
 	div.history-toolbar-actions(
-		ng-if="history.viewMode === HistoryViewModes.COMPARE && !history.error"
+		ng-if="history.viewMode === HistoryViewModes.COMPARE && !history.error && history.updates.length > 0"
 	)
 	)
 		button.history-toolbar-btn(
 		button.history-toolbar-btn(
 			ng-click="toggleHistoryViewMode();"
 			ng-click="toggleHistoryViewMode();"
@@ -91,7 +91,7 @@
 			| Error restoring, sorry
 			| Error restoring, sorry
 
 
 	.history-toolbar-entries-list(
 	.history-toolbar-entries-list(
-		ng-if="!history.error"
+		ng-if="!history.error && history.updates.length > 0"
 	)
 	)
 		toggle-switch(
 		toggle-switch(
 			ng-model="toolbarUIConfig.showOnlyLabels"
 			ng-model="toolbarUIConfig.showOnlyLabels"

+ 0 - 1
services/web/frontend/js/ide/history/HistoryV2Manager.js

@@ -189,7 +189,6 @@ define([
         }
         }
         this.$scope.history.error = null
         this.$scope.history.error = null
         this.$scope.history.showOnlyLabels = this._getShowOnlyLabelsUserPref()
         this.$scope.history.showOnlyLabels = this._getShowOnlyLabelsUserPref()
-        this.$scope.history.loadingFileTree = true
       }
       }
 
 
       toggleHistoryViewMode() {
       toggleHistoryViewMode() {

+ 2 - 0
services/web/frontend/stylesheets/app/editor.less

@@ -95,6 +95,7 @@
   top: @editor-toolbar-height;
   top: @editor-toolbar-height;
 }
 }
 
 
+.no-history-available,
 .no-file-selection,
 .no-file-selection,
 .multi-selection-ongoing {
 .multi-selection-ongoing {
   &::before {
   &::before {
@@ -107,6 +108,7 @@
   }
   }
 }
 }
 
 
+.no-history-available,
 .no-file-selection-message,
 .no-file-selection-message,
 .multi-selection-message {
 .multi-selection-message {
   width: 50%;
   width: 50%;