|
@@ -71,7 +71,7 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.$scope.isHistoryLoading = () => {
|
|
this.$scope.isHistoryLoading = () => {
|
|
|
- let selection = this.$scope.history.selection
|
|
|
|
|
|
|
+ const selection = this.$scope.history.selection
|
|
|
return (
|
|
return (
|
|
|
this.$scope.history.loadingFileTree ||
|
|
this.$scope.history.loadingFileTree ||
|
|
|
(this.$scope.history.viewMode === HistoryViewModes.POINT_IN_TIME &&
|
|
(this.$scope.history.viewMode === HistoryViewModes.POINT_IN_TIME &&
|
|
@@ -153,7 +153,7 @@ export default HistoryManager = (function () {
|
|
|
labels: null,
|
|
labels: null,
|
|
|
loadingFileTree: true,
|
|
loadingFileTree: true,
|
|
|
}
|
|
}
|
|
|
- let _deregisterFeatureWatcher = this.$scope.$watch(
|
|
|
|
|
|
|
+ const _deregisterFeatureWatcher = this.$scope.$watch(
|
|
|
'project.features.versioning',
|
|
'project.features.versioning',
|
|
|
hasVersioning => {
|
|
hasVersioning => {
|
|
|
if (hasVersioning != null) {
|
|
if (hasVersioning != null) {
|
|
@@ -222,21 +222,21 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
setHoverFrom(fromV) {
|
|
setHoverFrom(fromV) {
|
|
|
- let selection = this.$scope.history.selection
|
|
|
|
|
|
|
+ const selection = this.$scope.history.selection
|
|
|
selection.hoveredRange.fromV = fromV
|
|
selection.hoveredRange.fromV = fromV
|
|
|
selection.hoveredRange.toV = selection.range.toV
|
|
selection.hoveredRange.toV = selection.range.toV
|
|
|
this.$scope.history.hoveringOverListSelectors = true
|
|
this.$scope.history.hoveringOverListSelectors = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
setHoverTo(toV) {
|
|
setHoverTo(toV) {
|
|
|
- let selection = this.$scope.history.selection
|
|
|
|
|
|
|
+ const selection = this.$scope.history.selection
|
|
|
selection.hoveredRange.toV = toV
|
|
selection.hoveredRange.toV = toV
|
|
|
selection.hoveredRange.fromV = selection.range.fromV
|
|
selection.hoveredRange.fromV = selection.range.fromV
|
|
|
this.$scope.history.hoveringOverListSelectors = true
|
|
this.$scope.history.hoveringOverListSelectors = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
resetHover() {
|
|
resetHover() {
|
|
|
- let selection = this.$scope.history.selection
|
|
|
|
|
|
|
+ const selection = this.$scope.history.selection
|
|
|
selection.hoveredRange.toV = null
|
|
selection.hoveredRange.toV = null
|
|
|
selection.hoveredRange.fromV = null
|
|
selection.hoveredRange.fromV = null
|
|
|
this.$scope.history.hoveringOverListSelectors = false
|
|
this.$scope.history.hoveringOverListSelectors = false
|
|
@@ -278,7 +278,7 @@ export default HistoryManager = (function () {
|
|
|
|
|
|
|
|
_loadFileTree(toV, fromV) {
|
|
_loadFileTree(toV, fromV) {
|
|
|
let url = `/project/${this.$scope.project_id}/filetree/diff`
|
|
let url = `/project/${this.$scope.project_id}/filetree/diff`
|
|
|
- let selection = this.$scope.history.selection
|
|
|
|
|
|
|
+ const selection = this.$scope.history.selection
|
|
|
const query = [`from=${fromV}`, `to=${toV}`]
|
|
const query = [`from=${fromV}`, `to=${toV}`]
|
|
|
url += `?${query.join('&')}`
|
|
url += `?${query.join('&')}`
|
|
|
|
|
|
|
@@ -300,7 +300,7 @@ export default HistoryManager = (function () {
|
|
|
.get(url, { timeout: this._loadFileTreeRequestCanceller.promise })
|
|
.get(url, { timeout: this._loadFileTreeRequestCanceller.promise })
|
|
|
.then(response => {
|
|
.then(response => {
|
|
|
this.$scope.history.selection.files = response.data.diff
|
|
this.$scope.history.selection.files = response.data.diff
|
|
|
- for (let file of this.$scope.history.selection.files) {
|
|
|
|
|
|
|
+ for (const file of this.$scope.history.selection.files) {
|
|
|
if (file.newPathname != null) {
|
|
if (file.newPathname != null) {
|
|
|
file.oldPathname = file.pathname
|
|
file.oldPathname = file.pathname
|
|
|
file.pathname = file.newPathname
|
|
file.pathname = file.newPathname
|
|
@@ -334,12 +334,12 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
autoSelectFile() {
|
|
autoSelectFile() {
|
|
|
- let selectedPathname = null
|
|
|
|
|
- let files = this.$scope.history.selection.files
|
|
|
|
|
|
|
+ const selectedPathname = null
|
|
|
|
|
+ const files = this.$scope.history.selection.files
|
|
|
let fileToSelect = null
|
|
let fileToSelect = null
|
|
|
let previouslySelectedFile = null
|
|
let previouslySelectedFile = null
|
|
|
let previouslySelectedFileHasOp = false
|
|
let previouslySelectedFileHasOp = false
|
|
|
- let filesWithOps = this._getFilesWithOps()
|
|
|
|
|
|
|
+ const filesWithOps = this._getFilesWithOps()
|
|
|
const orderedOpTypes = ['edited', 'added', 'renamed', 'removed']
|
|
const orderedOpTypes = ['edited', 'added', 'renamed', 'removed']
|
|
|
|
|
|
|
|
if (this._previouslySelectedPathname != null) {
|
|
if (this._previouslySelectedPathname != null) {
|
|
@@ -353,8 +353,8 @@ export default HistoryManager = (function () {
|
|
|
if (previouslySelectedFile != null && previouslySelectedFileHasOp) {
|
|
if (previouslySelectedFile != null && previouslySelectedFileHasOp) {
|
|
|
fileToSelect = previouslySelectedFile
|
|
fileToSelect = previouslySelectedFile
|
|
|
} else {
|
|
} else {
|
|
|
- for (let opType of orderedOpTypes) {
|
|
|
|
|
- let fileWithMatchingOpType = _.find(filesWithOps, {
|
|
|
|
|
|
|
+ for (const opType of orderedOpTypes) {
|
|
|
|
|
+ const fileWithMatchingOpType = _.find(filesWithOps, {
|
|
|
operation: opType,
|
|
operation: opType,
|
|
|
})
|
|
})
|
|
|
if (fileWithMatchingOpType != null) {
|
|
if (fileWithMatchingOpType != null) {
|
|
@@ -368,13 +368,13 @@ export default HistoryManager = (function () {
|
|
|
if (previouslySelectedFile != null) {
|
|
if (previouslySelectedFile != null) {
|
|
|
fileToSelect = previouslySelectedFile
|
|
fileToSelect = previouslySelectedFile
|
|
|
} else {
|
|
} else {
|
|
|
- let mainFile = _.find(files, function (file) {
|
|
|
|
|
|
|
+ const mainFile = _.find(files, function (file) {
|
|
|
return /main\.tex$/.test(file.pathname)
|
|
return /main\.tex$/.test(file.pathname)
|
|
|
})
|
|
})
|
|
|
if (mainFile != null) {
|
|
if (mainFile != null) {
|
|
|
fileToSelect = mainFile
|
|
fileToSelect = mainFile
|
|
|
} else {
|
|
} else {
|
|
|
- let anyTeXFile = _.find(files, function (file) {
|
|
|
|
|
|
|
+ const anyTeXFile = _.find(files, function (file) {
|
|
|
return /\.tex$/.test(file.pathname)
|
|
return /\.tex$/.test(file.pathname)
|
|
|
})
|
|
})
|
|
|
if (anyTeXFile != null) {
|
|
if (anyTeXFile != null) {
|
|
@@ -393,18 +393,18 @@ export default HistoryManager = (function () {
|
|
|
_getFilesWithOps() {
|
|
_getFilesWithOps() {
|
|
|
let filesWithOps
|
|
let filesWithOps
|
|
|
if (this.$scope.history.viewMode === HistoryViewModes.POINT_IN_TIME) {
|
|
if (this.$scope.history.viewMode === HistoryViewModes.POINT_IN_TIME) {
|
|
|
- let currentUpdate = this.getUpdateForVersion(
|
|
|
|
|
|
|
+ const currentUpdate = this.getUpdateForVersion(
|
|
|
this.$scope.history.selection.range.toV
|
|
this.$scope.history.selection.range.toV
|
|
|
)
|
|
)
|
|
|
filesWithOps = []
|
|
filesWithOps = []
|
|
|
if (currentUpdate != null) {
|
|
if (currentUpdate != null) {
|
|
|
- for (let pathname of currentUpdate.pathnames) {
|
|
|
|
|
|
|
+ for (const pathname of currentUpdate.pathnames) {
|
|
|
filesWithOps.push({
|
|
filesWithOps.push({
|
|
|
pathname: pathname,
|
|
pathname: pathname,
|
|
|
operation: 'edited',
|
|
operation: 'edited',
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- for (let op of currentUpdate.project_ops) {
|
|
|
|
|
|
|
+ for (const op of currentUpdate.project_ops) {
|
|
|
let fileWithOp
|
|
let fileWithOp
|
|
|
if (op.add != null) {
|
|
if (op.add != null) {
|
|
|
fileWithOp = {
|
|
fileWithOp = {
|
|
@@ -450,7 +450,7 @@ export default HistoryManager = (function () {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let toV = this.$scope.history.updates[0].toV
|
|
|
|
|
|
|
+ const toV = this.$scope.history.updates[0].toV
|
|
|
let fromV = null
|
|
let fromV = null
|
|
|
|
|
|
|
|
let indexOfLastUpdateNotByMe = 0
|
|
let indexOfLastUpdateNotByMe = 0
|
|
@@ -474,7 +474,7 @@ export default HistoryManager = (function () {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
let versionToSelect = this.$scope.history.updates[0].toV
|
|
let versionToSelect = this.$scope.history.updates[0].toV
|
|
|
- let range = this.$scope.history.selection.range
|
|
|
|
|
|
|
+ const range = this.$scope.history.selection.range
|
|
|
if (
|
|
if (
|
|
|
range.toV != null &&
|
|
range.toV != null &&
|
|
|
range.fromV != null &&
|
|
range.fromV != null &&
|
|
@@ -504,7 +504,7 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
selectVersionForPointInTime(version) {
|
|
selectVersionForPointInTime(version) {
|
|
|
- let selection = this.$scope.history.selection
|
|
|
|
|
|
|
+ const selection = this.$scope.history.selection
|
|
|
if (
|
|
if (
|
|
|
selection.range.toV !== version &&
|
|
selection.range.toV !== version &&
|
|
|
selection.range.fromV !== version
|
|
selection.range.fromV !== version
|
|
@@ -516,7 +516,7 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
selectVersionsForCompare(toV, fromV) {
|
|
selectVersionsForCompare(toV, fromV) {
|
|
|
- let range = this.$scope.history.selection.range
|
|
|
|
|
|
|
+ const range = this.$scope.history.selection.range
|
|
|
if (range.toV !== toV || range.fromV !== fromV) {
|
|
if (range.toV !== toV || range.fromV !== fromV) {
|
|
|
range.toV = toV
|
|
range.toV = toV
|
|
|
range.fromV = fromV
|
|
range.fromV = fromV
|
|
@@ -559,7 +559,7 @@ export default HistoryManager = (function () {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- for (let update of Array.from(this.$scope.history.updates)) {
|
|
|
|
|
|
|
+ for (const update of Array.from(this.$scope.history.updates)) {
|
|
|
if (update.toV === labelToSelect.version) {
|
|
if (update.toV === labelToSelect.version) {
|
|
|
updateToSelect = update
|
|
updateToSelect = update
|
|
|
break
|
|
break
|
|
@@ -569,7 +569,7 @@ export default HistoryManager = (function () {
|
|
|
if (updateToSelect != null) {
|
|
if (updateToSelect != null) {
|
|
|
this.selectVersionForPointInTime(updateToSelect.toV)
|
|
this.selectVersionForPointInTime(updateToSelect.toV)
|
|
|
} else {
|
|
} else {
|
|
|
- let selection = this.$scope.history.selection
|
|
|
|
|
|
|
+ const selection = this.$scope.history.selection
|
|
|
selection.range.toV = labelToSelect.version
|
|
selection.range.toV = labelToSelect.version
|
|
|
selection.range.fromV = labelToSelect.version
|
|
selection.range.fromV = labelToSelect.version
|
|
|
this.loadFileTreeForVersion(labelToSelect.version)
|
|
this.loadFileTreeForVersion(labelToSelect.version)
|
|
@@ -577,7 +577,7 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getUpdateForVersion(version) {
|
|
getUpdateForVersion(version) {
|
|
|
- for (let update of this.$scope.history.updates) {
|
|
|
|
|
|
|
+ for (const update of this.$scope.history.updates) {
|
|
|
if (update.toV === version) {
|
|
if (update.toV === version) {
|
|
|
return update
|
|
return update
|
|
|
}
|
|
}
|
|
@@ -585,7 +585,7 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
autoSelectLabelsForComparison() {
|
|
autoSelectLabelsForComparison() {
|
|
|
- let labels = this.$scope.history.labels
|
|
|
|
|
|
|
+ const labels = this.$scope.history.labels
|
|
|
let nLabels = 0
|
|
let nLabels = 0
|
|
|
if (Array.isArray(labels)) {
|
|
if (Array.isArray(labels)) {
|
|
|
nLabels = labels.length
|
|
nLabels = labels.length
|
|
@@ -657,11 +657,11 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
_loadLabels(labels, lastUpdateToV) {
|
|
_loadLabels(labels, lastUpdateToV) {
|
|
|
- let sortedLabels = this._sortLabelsByVersionAndDate(labels)
|
|
|
|
|
- let labelsWithoutPseudoLabel = this._deletePseudoCurrentStateLabelIfExistent(
|
|
|
|
|
|
|
+ const sortedLabels = this._sortLabelsByVersionAndDate(labels)
|
|
|
|
|
+ const labelsWithoutPseudoLabel = this._deletePseudoCurrentStateLabelIfExistent(
|
|
|
sortedLabels
|
|
sortedLabels
|
|
|
)
|
|
)
|
|
|
- let labelsWithPseudoLabelIfNeeded = this._addPseudoCurrentStateLabelIfNeeded(
|
|
|
|
|
|
|
+ const labelsWithPseudoLabelIfNeeded = this._addPseudoCurrentStateLabelIfNeeded(
|
|
|
labelsWithoutPseudoLabel,
|
|
labelsWithoutPseudoLabel,
|
|
|
lastUpdateToV
|
|
lastUpdateToV
|
|
|
)
|
|
)
|
|
@@ -680,7 +680,7 @@ export default HistoryManager = (function () {
|
|
|
(labels.length && labels[0].version !== mostRecentVersion) ||
|
|
(labels.length && labels[0].version !== mostRecentVersion) ||
|
|
|
labels.length === 0
|
|
labels.length === 0
|
|
|
) {
|
|
) {
|
|
|
- let pseudoCurrentStateLabel = {
|
|
|
|
|
|
|
+ const pseudoCurrentStateLabel = {
|
|
|
id: '1',
|
|
id: '1',
|
|
|
isPseudoCurrentStateLabel: true,
|
|
isPseudoCurrentStateLabel: true,
|
|
|
version: mostRecentVersion,
|
|
version: mostRecentVersion,
|
|
@@ -911,7 +911,7 @@ export default HistoryManager = (function () {
|
|
|
const iterable = updates || []
|
|
const iterable = updates || []
|
|
|
for (let i = 0; i < iterable.length; i++) {
|
|
for (let i = 0; i < iterable.length; i++) {
|
|
|
const update = iterable[i]
|
|
const update = iterable[i]
|
|
|
- for (let user of Array.from(update.meta.users || [])) {
|
|
|
|
|
|
|
+ for (const user of Array.from(update.meta.users || [])) {
|
|
|
if (user != null) {
|
|
if (user != null) {
|
|
|
user.hue = ColorManager.getHueForUserId(user.id)
|
|
user.hue = ColorManager.getHueForUserId(user.id)
|
|
|
}
|
|
}
|
|
@@ -986,7 +986,7 @@ export default HistoryManager = (function () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
_updateContainsUserId(update, user_id) {
|
|
_updateContainsUserId(update, user_id) {
|
|
|
- for (let user of Array.from(update.meta.users)) {
|
|
|
|
|
|
|
+ for (const user of Array.from(update.meta.users)) {
|
|
|
if ((user != null ? user.id : undefined) === user_id) {
|
|
if ((user != null ? user.id : undefined) === user_id) {
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|