|
|
@@ -6,6 +6,8 @@ define [
|
|
|
"ide/history/controllers/HistoryV2ListController"
|
|
|
"ide/history/controllers/HistoryV2DiffController"
|
|
|
"ide/history/controllers/HistoryV2FileTreeController"
|
|
|
+ "ide/history/controllers/HistoryV2ToolbarController"
|
|
|
+ "ide/history/controllers/HistoryV2AddLabelModalController"
|
|
|
"ide/history/directives/infiniteScroll"
|
|
|
"ide/history/components/historyEntriesList"
|
|
|
"ide/history/components/historyEntry"
|
|
|
@@ -68,6 +70,7 @@ define [
|
|
|
toV: null
|
|
|
}
|
|
|
}
|
|
|
+ labels: null
|
|
|
files: []
|
|
|
diff: null # When history.viewMode == HistoryViewModes.COMPARE
|
|
|
selectedFile: null # When history.viewMode == HistoryViewModes.POINT_IN_TIME
|
|
|
@@ -126,18 +129,25 @@ define [
|
|
|
|
|
|
BATCH_SIZE: 10
|
|
|
fetchNextBatchOfUpdates: () ->
|
|
|
- url = "/project/#{@ide.project_id}/updates?min_count=#{@BATCH_SIZE}"
|
|
|
+ updatesURL = "/project/#{@ide.project_id}/updates?min_count=#{@BATCH_SIZE}"
|
|
|
if @$scope.history.nextBeforeTimestamp?
|
|
|
- url += "&before=#{@$scope.history.nextBeforeTimestamp}"
|
|
|
+ updatesURL += "&before=#{@$scope.history.nextBeforeTimestamp}"
|
|
|
+
|
|
|
@$scope.history.loading = true
|
|
|
@$scope.history.loadingFileTree = true
|
|
|
- @ide.$http
|
|
|
- .get(url)
|
|
|
- .then (response) =>
|
|
|
- { data } = response
|
|
|
- @_loadUpdates(data.updates)
|
|
|
- @$scope.history.nextBeforeTimestamp = data.nextBeforeTimestamp
|
|
|
- if !data.nextBeforeTimestamp?
|
|
|
+
|
|
|
+ requests =
|
|
|
+ updates: @ide.$http.get updatesURL
|
|
|
+
|
|
|
+ if !@$scope.history.labels?
|
|
|
+ requests.labels = @ide.$http.get "/project/#{@ide.project_id}/labels"
|
|
|
+
|
|
|
+ @ide.$q.all requests
|
|
|
+ .then (responses) =>
|
|
|
+ updatesData = responses.updates.data
|
|
|
+ @_loadUpdates(updatesData.updates)
|
|
|
+ @$scope.history.nextBeforeTimestamp = updatesData.nextBeforeTimestamp
|
|
|
+ if !updatesData.nextBeforeTimestamp?
|
|
|
@$scope.history.atEnd = true
|
|
|
@$scope.history.loading = false
|
|
|
|
|
|
@@ -199,6 +209,9 @@ define [
|
|
|
diff.loading = false
|
|
|
diff.error = true
|
|
|
|
|
|
+ labelCurrentVersion: (labelComment) =>
|
|
|
+ @_labelVersion labelComment, @$scope.history.selection.updates[0].toV
|
|
|
+
|
|
|
_parseDiff: (diff) ->
|
|
|
if diff.binary
|
|
|
return { binary: true }
|
|
|
@@ -278,6 +291,14 @@ define [
|
|
|
else
|
|
|
@autoSelectLastUpdate()
|
|
|
|
|
|
+ _labelVersion: (comment, version) ->
|
|
|
+ url = "/project/#{@$scope.project_id}/labels"
|
|
|
+ @ide.$http.post url, {
|
|
|
+ comment,
|
|
|
+ version,
|
|
|
+ _csrf: window.csrfToken
|
|
|
+ }
|
|
|
+
|
|
|
_perDocSummaryOfUpdates: (updates) ->
|
|
|
# Track current_pathname -> original_pathname
|
|
|
# create bare object for use as Map
|