From 506bc4433618f6a8ec71e9483f65b37a08ce0b67 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Mon, 2 Mar 2020 07:33:09 -0500 Subject: [PATCH] Merge pull request #2621 from overleaf/jpa-ns-empty-history Add messaging to projects with empty history GitOrigin-RevId: 3fab0b115d35ec3d7f7d1ffa5603b7c7d3423c94 --- services/web/app/views/project/editor/history.pug | 6 +++++- .../web/app/views/project/editor/history/previewPanelV2.pug | 4 ++-- services/web/app/views/project/editor/history/toolbarV2.pug | 6 +++--- services/web/frontend/js/ide/history/HistoryV2Manager.js | 1 - services/web/frontend/stylesheets/app/editor.less | 2 ++ 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/services/web/app/views/project/editor/history.pug b/services/web/app/views/project/editor/history.pug index 9f4df23c9c..e99c3a35e2 100644 --- a/services/web/app/views/project/editor/history.pug +++ b/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/entriesListV2 include ./history/diffPanelV1 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") .modal-header button.close( diff --git a/services/web/app/views/project/editor/history/previewPanelV2.pug b/services/web/app/views/project/editor/history/previewPanelV2.pug index 656dda3532..6210a3a691 100644 --- a/services/web/app/views/project/editor/history/previewPanelV2.pug +++ b/services/web/app/views/project/editor/history/previewPanelV2.pug @@ -1,5 +1,5 @@ .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( ng-show="!!history.selection.diff && !isHistoryLoading() && !history.selection.diff.error", @@ -26,7 +26,7 @@ .alert.alert-danger #{translate("generic_something_went_wrong")} .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( ng-if="!!history.selection.file && !history.selection.file.loading && !history.selection.file.error" diff --git a/services/web/app/views/project/editor/history/toolbarV2.pug b/services/web/app/views/project/editor/history/toolbarV2.pug index 334e4aa000..9e54614846 100644 --- a/services/web/app/views/project/editor/history/toolbarV2.pug +++ b/services/web/app/views/project/editor/history/toolbarV2.pug @@ -40,7 +40,7 @@ //- point-in-time mode 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( ng-click="showAddLabelDialog();" @@ -68,7 +68,7 @@ //- compare mode 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( ng-click="toggleHistoryViewMode();" @@ -91,7 +91,7 @@ | Error restoring, sorry .history-toolbar-entries-list( - ng-if="!history.error" + ng-if="!history.error && history.updates.length > 0" ) toggle-switch( ng-model="toolbarUIConfig.showOnlyLabels" diff --git a/services/web/frontend/js/ide/history/HistoryV2Manager.js b/services/web/frontend/js/ide/history/HistoryV2Manager.js index 6cdce2dced..268b0bf426 100644 --- a/services/web/frontend/js/ide/history/HistoryV2Manager.js +++ b/services/web/frontend/js/ide/history/HistoryV2Manager.js @@ -189,7 +189,6 @@ define([ } this.$scope.history.error = null this.$scope.history.showOnlyLabels = this._getShowOnlyLabelsUserPref() - this.$scope.history.loadingFileTree = true } toggleHistoryViewMode() { diff --git a/services/web/frontend/stylesheets/app/editor.less b/services/web/frontend/stylesheets/app/editor.less index 0568e57aae..cf0320f4c6 100644 --- a/services/web/frontend/stylesheets/app/editor.less +++ b/services/web/frontend/stylesheets/app/editor.less @@ -95,6 +95,7 @@ top: @editor-toolbar-height; } +.no-history-available, .no-file-selection, .multi-selection-ongoing { &::before { @@ -107,6 +108,7 @@ } } +.no-history-available, .no-file-selection-message, .multi-selection-message { width: 50%;