mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Load labels list from the backend.
This commit is contained in:
parent
7e8e2a89ae
commit
cd853abb3c
2 changed files with 22 additions and 3 deletions
|
@ -20,6 +20,14 @@
|
||||||
i.fa.fa-exchange
|
i.fa.fa-exchange
|
||||||
| #{translate("compare_to_another_version")}
|
| #{translate("compare_to_another_version")}
|
||||||
|
|
||||||
|
.history-toolbar-entries-list
|
||||||
|
toggle-switch(
|
||||||
|
ng-model="history.showOnlyLabels"
|
||||||
|
label-true="Labels"
|
||||||
|
label-false="All history"
|
||||||
|
description="Show all of the project history or only labelled versions."
|
||||||
|
)
|
||||||
|
|
||||||
script(type="text/ng-template", id="historyV2AddLabelModalTemplate")
|
script(type="text/ng-template", id="historyV2AddLabelModalTemplate")
|
||||||
form(
|
form(
|
||||||
name="addLabelModalForm"
|
name="addLabelModalForm"
|
||||||
|
|
|
@ -12,6 +12,7 @@ define [
|
||||||
"ide/history/directives/infiniteScroll"
|
"ide/history/directives/infiniteScroll"
|
||||||
"ide/history/components/historyEntriesList"
|
"ide/history/components/historyEntriesList"
|
||||||
"ide/history/components/historyEntry"
|
"ide/history/components/historyEntry"
|
||||||
|
"ide/history/components/historyLabelsList"
|
||||||
"ide/history/components/historyLabel"
|
"ide/history/components/historyLabel"
|
||||||
"ide/history/components/historyFileTree"
|
"ide/history/components/historyFileTree"
|
||||||
"ide/history/components/historyFileEntity"
|
"ide/history/components/historyFileEntity"
|
||||||
|
@ -72,6 +73,7 @@ define [
|
||||||
toV: null
|
toV: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
showOnlyLabels: false
|
||||||
labels: null
|
labels: null
|
||||||
files: []
|
files: []
|
||||||
diff: null # When history.viewMode == HistoryViewModes.COMPARE
|
diff: null # When history.viewMode == HistoryViewModes.COMPARE
|
||||||
|
@ -134,17 +136,26 @@ define [
|
||||||
updatesURL = "/project/#{@ide.project_id}/updates?min_count=#{@BATCH_SIZE}"
|
updatesURL = "/project/#{@ide.project_id}/updates?min_count=#{@BATCH_SIZE}"
|
||||||
if @$scope.history.nextBeforeTimestamp?
|
if @$scope.history.nextBeforeTimestamp?
|
||||||
updatesURL += "&before=#{@$scope.history.nextBeforeTimestamp}"
|
updatesURL += "&before=#{@$scope.history.nextBeforeTimestamp}"
|
||||||
|
labelsURL = "/project/#{@ide.project_id}/labels"
|
||||||
|
|
||||||
@$scope.history.loading = true
|
@$scope.history.loading = true
|
||||||
@$scope.history.loadingFileTree = true
|
@$scope.history.loadingFileTree = true
|
||||||
|
|
||||||
@ide.$http.get updatesURL
|
requests =
|
||||||
|
updates: @ide.$http.get updatesURL
|
||||||
|
|
||||||
|
if !@$scope.history.labels?
|
||||||
|
requests.labels = @ide.$http.get labelsURL
|
||||||
|
|
||||||
|
@ide.$q.all requests
|
||||||
.then (response) =>
|
.then (response) =>
|
||||||
updatesData = response.data
|
updatesData = response.updates.data
|
||||||
@_loadUpdates(updatesData.updates)
|
@_loadUpdates(updatesData.updates)
|
||||||
@$scope.history.nextBeforeTimestamp = updatesData.nextBeforeTimestamp
|
@$scope.history.nextBeforeTimestamp = updatesData.nextBeforeTimestamp
|
||||||
if !updatesData.nextBeforeTimestamp?
|
if !updatesData.nextBeforeTimestamp?
|
||||||
@$scope.history.atEnd = true
|
@$scope.history.atEnd = true
|
||||||
|
if response.labels?
|
||||||
|
@$scope.history.labels = response.labels.data
|
||||||
@$scope.history.loading = false
|
@$scope.history.loading = false
|
||||||
|
|
||||||
loadFileAtPointInTime: () ->
|
loadFileAtPointInTime: () ->
|
||||||
|
|
Loading…
Reference in a new issue