Load labels list from the backend.

This commit is contained in:
Paulo Reis 2018-08-08 11:02:14 +01:00
parent 7e8e2a89ae
commit cd853abb3c
2 changed files with 22 additions and 3 deletions

View file

@ -20,6 +20,14 @@
i.fa.fa-exchange
|  #{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")
form(
name="addLabelModalForm"

View file

@ -12,6 +12,7 @@ define [
"ide/history/directives/infiniteScroll"
"ide/history/components/historyEntriesList"
"ide/history/components/historyEntry"
"ide/history/components/historyLabelsList"
"ide/history/components/historyLabel"
"ide/history/components/historyFileTree"
"ide/history/components/historyFileEntity"
@ -72,6 +73,7 @@ define [
toV: null
}
}
showOnlyLabels: false
labels: null
files: []
diff: null # When history.viewMode == HistoryViewModes.COMPARE
@ -134,17 +136,26 @@ define [
updatesURL = "/project/#{@ide.project_id}/updates?min_count=#{@BATCH_SIZE}"
if @$scope.history.nextBeforeTimestamp?
updatesURL += "&before=#{@$scope.history.nextBeforeTimestamp}"
labelsURL = "/project/#{@ide.project_id}/labels"
@$scope.history.loading = 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) =>
updatesData = response.data
updatesData = response.updates.data
@_loadUpdates(updatesData.updates)
@$scope.history.nextBeforeTimestamp = updatesData.nextBeforeTimestamp
if !updatesData.nextBeforeTimestamp?
@$scope.history.atEnd = true
if response.labels?
@$scope.history.labels = response.labels.data
@$scope.history.loading = false
loadFileAtPointInTime: () ->