@scm-manager/ui-components 2.25.1-20211003-143409 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -8
- package/src/Autocomplete.tsx +6 -6
- package/src/BranchSelector.stories.tsx +1 -1
- package/src/Breadcrumb.tsx +4 -1
- package/src/CardColumn.stories.tsx +2 -2
- package/src/CardColumn.tsx +1 -2
- package/src/HelpIcon.tsx +3 -1
- package/src/Icon.stories.tsx +3 -3
- package/src/Notification.stories.tsx +1 -1
- package/src/Paginator.test.tsx +16 -16
- package/src/ProtectedRoute.tsx +3 -3
- package/src/Tag.tsx +1 -1
- package/src/__resources__/Diff.markdown.ts +19 -21
- package/src/__resources__/changesets.tsx +73 -109
- package/src/__resources__/repository.ts +8 -8
- package/src/__snapshots__/storyshots.test.ts.snap +71237 -71286
- package/src/buttons/Button.tsx +63 -74
- package/src/buttons/ButtonAddons.tsx +1 -1
- package/src/buttons/ButtonGroup.tsx +1 -1
- package/src/buttons/SubmitButton.tsx +1 -1
- package/src/buttons/index.stories.tsx +5 -6
- package/src/comparators.test.ts +6 -6
- package/src/comparators.ts +1 -1
- package/src/devBuild.ts +1 -1
- package/src/forms/AddKeyValueEntryToTableField.stories.tsx +1 -1
- package/src/forms/AutocompleteAddEntryToTableField.tsx +1 -1
- package/src/forms/Checkbox.stories.tsx +4 -4
- package/src/forms/DropDown.stories.tsx +4 -4
- package/src/forms/DropDown.tsx +1 -1
- package/src/forms/FileInput.stories.tsx +1 -1
- package/src/forms/FilterInput.tsx +1 -1
- package/src/forms/InputField.stories.tsx +1 -1
- package/src/forms/MemberNameTagGroup.tsx +3 -3
- package/src/forms/PasswordConfirmation.tsx +4 -4
- package/src/forms/Radio.stories.tsx +2 -2
- package/src/forms/Select.stories.tsx +4 -5
- package/src/forms/Textarea.stories.tsx +1 -1
- package/src/languages.ts +1 -1
- package/src/layout/Footer.stories.tsx +3 -3
- package/src/layout/SecondaryNavigationColumn.tsx +1 -1
- package/src/layout/Title.tsx +2 -2
- package/src/markdown/MarkdownCodeRenderer.tsx +1 -1
- package/src/markdown/MarkdownHeadingRenderer.tsx +2 -2
- package/src/markdown/MarkdownLinkRenderer.test.tsx +1 -1
- package/src/markdown/MarkdownLinkRenderer.tsx +1 -1
- package/src/markdown/MarkdownView.stories.tsx +4 -4
- package/src/markdown/MarkdownView.tsx +9 -9
- package/src/markdown/createComponentList.ts +1 -1
- package/src/markdown/createMdastPlugin.ts +1 -1
- package/src/markdown/markdownExtensions.ts +1 -1
- package/src/markdown/remarkChangesetShortLinkParser.ts +7 -7
- package/src/markdown/remarkToRehypeRendererAdapters.ts +10 -9
- package/src/modals/ConfirmAlert.stories.tsx +5 -5
- package/src/modals/ConfirmAlert.tsx +2 -2
- package/src/modals/CreateTagModal.tsx +4 -4
- package/src/modals/Modal.stories.tsx +1 -1
- package/src/navigation/MenuContext.tsx +2 -2
- package/src/navigation/NavAction.tsx +3 -3
- package/src/navigation/SecondaryNavigation.stories.tsx +4 -4
- package/src/navigation/SubNavigation.tsx +2 -2
- package/src/popover/Popover.stories.tsx +37 -35
- package/src/popover/usePopover.ts +10 -10
- package/src/repos/Diff.stories.tsx +1 -1
- package/src/repos/DiffExpander.test.ts +39 -41
- package/src/repos/DiffExpander.ts +10 -10
- package/src/repos/RepositoryEntry.stories.tsx +1 -1
- package/src/repos/RepositoryFlag.tsx +1 -1
- package/src/repos/Tokenize.worker.ts +3 -3
- package/src/repos/TokenizedDiffView.tsx +1 -1
- package/src/repos/annotate/Annotate.stories.tsx +29 -29
- package/src/repos/changesets/ChangesetAuthor.tsx +4 -4
- package/src/repos/changesets/ChangesetDescription.tsx +2 -2
- package/src/repos/changesets/ChangesetDiff.test.ts +18 -18
- package/src/repos/changesets/ChangesetId.tsx +1 -1
- package/src/repos/changesets/ChangesetList.tsx +1 -1
- package/src/repos/changesets/ChangesetTagsCollapsed.tsx +1 -1
- package/src/repos/changesets/Changesets.stories.tsx +185 -142
- package/src/repos/changesets/SignatureIcon.tsx +4 -4
- package/src/repos/changesets/changesets.ts +1 -1
- package/src/repos/diffs.test.ts +3 -3
- package/src/repos/refractorAdapter.ts +3 -3
- package/src/repositories.test.ts +18 -18
- package/src/storyshots.test.ts +3 -3
- package/src/syntax-highlighting.module.css +17 -16
- package/src/syntax-highlighting.ts +59 -54
- package/src/table/Table.stories.tsx +7 -7
- package/src/table/Table.tsx +1 -1
- package/src/table/TextColumn.tsx +1 -1
- package/src/textSplitAndReplace.test.ts +3 -3
- package/src/textSplitAndReplace.ts +2 -2
- package/src/toast/Toast.tsx +2 -2
- package/src/toast/index.stories.tsx +2 -2
- package/src/toast/themes.ts +6 -6
- package/src/useDateFormatter.ts +3 -3
- package/src/validation.test.ts +6 -6
- package/src/validation.ts +1 -4
|
@@ -42,8 +42,8 @@ const HUNK_0: Hunk = {
|
|
|
42
42
|
{ content: "line", type: "insert", lineNumber: 5, isInsert: true },
|
|
43
43
|
{ content: "line", type: "normal", oldLineNumber: 6, newLineNumber: 6, isNormal: true },
|
|
44
44
|
{ content: "line", type: "normal", oldLineNumber: 7, newLineNumber: 7, isNormal: true },
|
|
45
|
-
{ content: "line", type: "normal", oldLineNumber: 8, newLineNumber: 8, isNormal: true }
|
|
46
|
-
]
|
|
45
|
+
{ content: "line", type: "normal", oldLineNumber: 8, newLineNumber: 8, isNormal: true },
|
|
46
|
+
],
|
|
47
47
|
};
|
|
48
48
|
const HUNK_1: Hunk = {
|
|
49
49
|
content: "@@ -14,6 +14,7 @@",
|
|
@@ -58,8 +58,8 @@ const HUNK_1: Hunk = {
|
|
|
58
58
|
{ content: "line", type: "insert", lineNumber: 17, isInsert: true },
|
|
59
59
|
{ content: "line", type: "normal", oldLineNumber: 17, newLineNumber: 18, isNormal: true },
|
|
60
60
|
{ content: "line", type: "normal", oldLineNumber: 18, newLineNumber: 19, isNormal: true },
|
|
61
|
-
{ content: "line", type: "normal", oldLineNumber: 19, newLineNumber: 20, isNormal: true }
|
|
62
|
-
]
|
|
61
|
+
{ content: "line", type: "normal", oldLineNumber: 19, newLineNumber: 20, isNormal: true },
|
|
62
|
+
],
|
|
63
63
|
};
|
|
64
64
|
const HUNK_2: Hunk = {
|
|
65
65
|
content: "@@ -21,7 +22,7 @@",
|
|
@@ -75,8 +75,8 @@ const HUNK_2: Hunk = {
|
|
|
75
75
|
{ content: "line", type: "insert", lineNumber: 25, isInsert: true },
|
|
76
76
|
{ content: "line", type: "normal", oldLineNumber: 25, newLineNumber: 26, isNormal: true },
|
|
77
77
|
{ content: "line", type: "normal", oldLineNumber: 26, newLineNumber: 27, isNormal: true },
|
|
78
|
-
{ content: "line", type: "normal", oldLineNumber: 27, newLineNumber: 28, isNormal: true }
|
|
79
|
-
]
|
|
78
|
+
{ content: "line", type: "normal", oldLineNumber: 27, newLineNumber: 28, isNormal: true },
|
|
79
|
+
],
|
|
80
80
|
};
|
|
81
81
|
const HUNK_3: Hunk = {
|
|
82
82
|
content: "@@ -33,6 +34,7 @@",
|
|
@@ -91,8 +91,8 @@ const HUNK_3: Hunk = {
|
|
|
91
91
|
{ content: "line", type: "insert", lineNumber: 37, isInsert: true },
|
|
92
92
|
{ content: "line", type: "normal", oldLineNumber: 36, newLineNumber: 38, isNormal: true },
|
|
93
93
|
{ content: "line", type: "normal", oldLineNumber: 37, newLineNumber: 39, isNormal: true },
|
|
94
|
-
{ content: "line", type: "normal", oldLineNumber: 38, newLineNumber: 40, isNormal: true }
|
|
95
|
-
]
|
|
94
|
+
{ content: "line", type: "normal", oldLineNumber: 38, newLineNumber: 40, isNormal: true },
|
|
95
|
+
],
|
|
96
96
|
};
|
|
97
97
|
const TEST_CONTENT_WITH_HUNKS: FileDiff = {
|
|
98
98
|
hunks: [HUNK_0, HUNK_1, HUNK_2, HUNK_3],
|
|
@@ -107,9 +107,9 @@ const TEST_CONTENT_WITH_HUNKS: FileDiff = {
|
|
|
107
107
|
_links: {
|
|
108
108
|
lines: {
|
|
109
109
|
href: "http://localhost:8081/scm/api/v2/content/abc/CommitMessage.js?start={start}&end={end}",
|
|
110
|
-
templated: true
|
|
111
|
-
}
|
|
112
|
-
}
|
|
110
|
+
templated: true,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
const TEST_CONTENT_WITH_NEW_BINARY_FILE: FileDiff = {
|
|
@@ -119,7 +119,7 @@ const TEST_CONTENT_WITH_NEW_BINARY_FILE: FileDiff = {
|
|
|
119
119
|
newEndingNewLine: true,
|
|
120
120
|
oldRevision: "0000000000000000000000000000000000000000",
|
|
121
121
|
newRevision: "86c370aae0727d628a5438f79a5cdd45752b9d99",
|
|
122
|
-
type: "add"
|
|
122
|
+
type: "add",
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
const TEST_CONTENT_WITH_NEW_TEXT_FILE: FileDiff = {
|
|
@@ -138,17 +138,16 @@ const TEST_CONTENT_WITH_NEW_TEXT_FILE: FileDiff = {
|
|
|
138
138
|
newLines: 2,
|
|
139
139
|
changes: [
|
|
140
140
|
{ content: "line 1", type: "insert", lineNumber: 1, isInsert: true },
|
|
141
|
-
{ content: "line 2", type: "insert", lineNumber: 2, isInsert: true }
|
|
142
|
-
]
|
|
143
|
-
}
|
|
141
|
+
{ content: "line 2", type: "insert", lineNumber: 2, isInsert: true },
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
144
|
],
|
|
145
145
|
_links: {
|
|
146
146
|
lines: {
|
|
147
|
-
href:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
147
|
+
href: "http://localhost:8081/scm/api/v2/repositories/scm-manager/scm-editor-plugin/content/c63898d35520ee47bcc3a8291660979918715762/src/main/markdown/README.md?start={start}&end={end}",
|
|
148
|
+
templated: true,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
152
151
|
};
|
|
153
152
|
|
|
154
153
|
const TEST_CONTENT_WITH_DELETED_TEXT_FILE: FileDiff = {
|
|
@@ -165,10 +164,10 @@ const TEST_CONTENT_WITH_DELETED_TEXT_FILE: FileDiff = {
|
|
|
165
164
|
content: "@@ -1 +0,0 @@",
|
|
166
165
|
oldStart: 1,
|
|
167
166
|
oldLines: 1,
|
|
168
|
-
changes: [{ content: "# scm-editor-plugin", type: "delete", lineNumber: 1, isDelete: true }]
|
|
169
|
-
}
|
|
167
|
+
changes: [{ content: "# scm-editor-plugin", type: "delete", lineNumber: 1, isDelete: true }],
|
|
168
|
+
},
|
|
170
169
|
],
|
|
171
|
-
_links: { lines: { href: "http://localhost:8081/dev/null?start={start}&end={end}", templated: true } }
|
|
170
|
+
_links: { lines: { href: "http://localhost:8081/dev/null?start={start}&end={end}", templated: true } },
|
|
172
171
|
};
|
|
173
172
|
|
|
174
173
|
const TEST_CONTENT_WITH_DELETED_LINES_AT_END: FileDiff = {
|
|
@@ -202,16 +201,16 @@ const TEST_CONTENT_WITH_DELETED_LINES_AT_END: FileDiff = {
|
|
|
202
201
|
{ content: "line", type: "delete", lineNumber: 119, isDelete: true },
|
|
203
202
|
{ content: "line", type: "delete", lineNumber: 120, isDelete: true },
|
|
204
203
|
{ content: "line", type: "delete", lineNumber: 121, isDelete: true },
|
|
205
|
-
{ content: "line", type: "delete", lineNumber: 122, isDelete: true }
|
|
206
|
-
]
|
|
207
|
-
}
|
|
204
|
+
{ content: "line", type: "delete", lineNumber: 122, isDelete: true },
|
|
205
|
+
],
|
|
206
|
+
},
|
|
208
207
|
],
|
|
209
208
|
_links: {
|
|
210
209
|
lines: {
|
|
211
210
|
href: "http://localhost:8081/scm/api/v2/content/abc/CommitMessage.js?start={start}&end={end}",
|
|
212
|
-
templated: true
|
|
213
|
-
}
|
|
214
|
-
}
|
|
211
|
+
templated: true,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
215
214
|
};
|
|
216
215
|
|
|
217
216
|
const TEST_CONTENT_WITH_ALL_LINES_REMOVED_FROM_FILE: FileDiff = {
|
|
@@ -231,17 +230,16 @@ const TEST_CONTENT_WITH_ALL_LINES_REMOVED_FROM_FILE: FileDiff = {
|
|
|
231
230
|
changes: [
|
|
232
231
|
{ content: "line", type: "delete", lineNumber: 1, isDelete: true },
|
|
233
232
|
{ content: "line", type: "delete", lineNumber: 2, isDelete: true },
|
|
234
|
-
{ content: "line", type: "delete", lineNumber: 3, isDelete: true }
|
|
235
|
-
]
|
|
236
|
-
}
|
|
233
|
+
{ content: "line", type: "delete", lineNumber: 3, isDelete: true },
|
|
234
|
+
],
|
|
235
|
+
},
|
|
237
236
|
],
|
|
238
237
|
_links: {
|
|
239
238
|
lines: {
|
|
240
|
-
href:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
239
|
+
href: "http://localhost:8081/scm/api/v2/repositories/scm-manager/scm-editor-plugin/content/b313a7690f028c77df98417c1ed6cba67e5692ec/pom.xml?start={start}&end={end}",
|
|
240
|
+
templated: true,
|
|
241
|
+
},
|
|
242
|
+
},
|
|
245
243
|
};
|
|
246
244
|
|
|
247
245
|
describe("with hunks the diff expander", () => {
|
|
@@ -285,7 +283,7 @@ describe("with hunks the diff expander", () => {
|
|
|
285
283
|
await diffExpander
|
|
286
284
|
.getHunk(1)
|
|
287
285
|
.expandBottom(1)
|
|
288
|
-
.then(file => (newFile = file));
|
|
286
|
+
.then((file) => (newFile = file));
|
|
289
287
|
expect(fetchMock.done()).toBe(true);
|
|
290
288
|
expect(newFile!.hunks!.length).toBe(oldHunkCount + 1);
|
|
291
289
|
expect(newFile!.hunks![1]).toBe(expandedHunk);
|
|
@@ -310,7 +308,7 @@ describe("with hunks the diff expander", () => {
|
|
|
310
308
|
await diffExpander
|
|
311
309
|
.getHunk(1)
|
|
312
310
|
.expandHead(5)
|
|
313
|
-
.then(file => (newFile = file));
|
|
311
|
+
.then((file) => (newFile = file));
|
|
314
312
|
expect(fetchMock.done()).toBe(true);
|
|
315
313
|
expect(newFile!.hunks!.length).toBe(oldHunkCount + 1);
|
|
316
314
|
expect(newFile!.hunks![0]).toBe(preceedingHunk);
|
|
@@ -339,7 +337,7 @@ describe("with hunks the diff expander", () => {
|
|
|
339
337
|
await diffExpander
|
|
340
338
|
.getHunk(3)
|
|
341
339
|
.expandBottom(10)
|
|
342
|
-
.then(file => (newFile = file));
|
|
340
|
+
.then((file) => (newFile = file));
|
|
343
341
|
expect(newFile!.hunks!.length).toBe(oldHunkCount + 1);
|
|
344
342
|
expect(newFile!.hunks![4].fullyExpanded).toBe(true);
|
|
345
343
|
});
|
|
@@ -352,7 +350,7 @@ describe("with hunks the diff expander", () => {
|
|
|
352
350
|
await diffExpander
|
|
353
351
|
.getHunk(3)
|
|
354
352
|
.expandBottom(-1)
|
|
355
|
-
.then(file => (newFile = file));
|
|
353
|
+
.then((file) => (newFile = file));
|
|
356
354
|
await fetchMock.flush(true);
|
|
357
355
|
expect(newFile!.hunks![4].fullyExpanded).toBe(true);
|
|
358
356
|
});
|
|
@@ -75,7 +75,7 @@ class DiffExpander {
|
|
|
75
75
|
expandHead: (n: number, count: number) => Promise<FileDiff> = (n, count) => {
|
|
76
76
|
const start = this.minLineNumber(n) - Math.min(count, this.computeMaxExpandHeadRange(n)) - 1;
|
|
77
77
|
const end = this.minLineNumber(n) - 1;
|
|
78
|
-
return this.loadLines(start, end).then(lines => {
|
|
78
|
+
return this.loadLines(start, end).then((lines) => {
|
|
79
79
|
const hunk = this.file.hunks![n];
|
|
80
80
|
|
|
81
81
|
const newHunk = this.createNewHunk(
|
|
@@ -96,7 +96,7 @@ class DiffExpander {
|
|
|
96
96
|
count > 0
|
|
97
97
|
? start + Math.min(count, maxExpandBottomRange > 0 ? maxExpandBottomRange : Number.MAX_SAFE_INTEGER)
|
|
98
98
|
: -1;
|
|
99
|
-
return this.loadLines(start, end).then(lines => {
|
|
99
|
+
return this.loadLines(start, end).then((lines) => {
|
|
100
100
|
const hunk = this.file.hunks![n];
|
|
101
101
|
|
|
102
102
|
const newHunk: Hunk = this.createNewHunk(
|
|
@@ -116,9 +116,9 @@ class DiffExpander {
|
|
|
116
116
|
.replace("{end}", end.toString());
|
|
117
117
|
return apiClient
|
|
118
118
|
.get(lineRequestUrl)
|
|
119
|
-
.then(response => response.text())
|
|
120
|
-
.then(text => text.split("\n"))
|
|
121
|
-
.then(lines => (lines[lines.length - 1] === "" ? lines.slice(0, lines.length - 1) : lines));
|
|
119
|
+
.then((response) => response.text())
|
|
120
|
+
.then((text) => text.split("\n"))
|
|
121
|
+
.then((lines) => (lines[lines.length - 1] === "" ? lines.slice(0, lines.length - 1) : lines));
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
addHunkToFile = (newHunk: Hunk, position: number) => {
|
|
@@ -141,13 +141,13 @@ class DiffExpander {
|
|
|
141
141
|
let oldLineNumber: number = oldFirstLineNumber;
|
|
142
142
|
let newLineNumber: number = newFirstLineNumber;
|
|
143
143
|
|
|
144
|
-
lines.forEach(line => {
|
|
144
|
+
lines.forEach((line) => {
|
|
145
145
|
newChanges.push({
|
|
146
146
|
content: line,
|
|
147
147
|
type: "normal",
|
|
148
148
|
oldLineNumber,
|
|
149
149
|
newLineNumber,
|
|
150
|
-
isNormal: true
|
|
150
|
+
isNormal: true,
|
|
151
151
|
});
|
|
152
152
|
oldLineNumber += 1;
|
|
153
153
|
newLineNumber += 1;
|
|
@@ -161,7 +161,7 @@ class DiffExpander {
|
|
|
161
161
|
oldLines: lines.length,
|
|
162
162
|
newLines: lines.length,
|
|
163
163
|
expansion: true,
|
|
164
|
-
fullyExpanded: requestedLines < 0 || lines.length < requestedLines
|
|
164
|
+
fullyExpanded: requestedLines < 0 || lines.length < requestedLines,
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
167
|
|
|
@@ -175,13 +175,13 @@ class DiffExpander {
|
|
|
175
175
|
return lastChange.newLineNumber || lastChange.lineNumber!;
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
getHunk: (n: number) => ExpandableHunk = n => {
|
|
178
|
+
getHunk: (n: number) => ExpandableHunk = (n) => {
|
|
179
179
|
return {
|
|
180
180
|
maxExpandHeadRange: this.computeMaxExpandHeadRange(n),
|
|
181
181
|
maxExpandBottomRange: this.computeMaxExpandBottomRange(n),
|
|
182
182
|
expandHead: (count: number) => this.expandHead(n, count),
|
|
183
183
|
expandBottom: (count: number) => this.expandBottom(n, count),
|
|
184
|
-
hunk: this.file?.hunks![n]
|
|
184
|
+
hunk: this.file?.hunks![n],
|
|
185
185
|
};
|
|
186
186
|
};
|
|
187
187
|
}
|
|
@@ -98,7 +98,7 @@ const archivedExportingRepository = {
|
|
|
98
98
|
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
storiesOf("RepositoryEntry", module)
|
|
101
|
+
storiesOf("Repositories/RepositoryEntry", module)
|
|
102
102
|
.addDecorator((story) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
|
|
103
103
|
.addDecorator((storyFn) => <Container>{storyFn()}</Container>)
|
|
104
104
|
.add("Default", () => {
|
|
@@ -49,7 +49,7 @@ function runTokenize({ id, payload }: TokenizeMessage) {
|
|
|
49
49
|
const options = {
|
|
50
50
|
highlight: language !== "text",
|
|
51
51
|
language: language,
|
|
52
|
-
refractor
|
|
52
|
+
refractor,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const doTokenization = (worker: Worker) => {
|
|
@@ -57,13 +57,13 @@ function runTokenize({ id, payload }: TokenizeMessage) {
|
|
|
57
57
|
const tokens = tokenize(hunks, options);
|
|
58
58
|
const payload = {
|
|
59
59
|
success: true,
|
|
60
|
-
tokens: tokens
|
|
60
|
+
tokens: tokens,
|
|
61
61
|
};
|
|
62
62
|
worker.postMessage({ id, payload });
|
|
63
63
|
} catch (ex) {
|
|
64
64
|
const payload = {
|
|
65
65
|
success: false,
|
|
66
|
-
reason: ex.message
|
|
66
|
+
reason: ex.message,
|
|
67
67
|
};
|
|
68
68
|
worker.postMessage({ id, payload });
|
|
69
69
|
}
|
|
@@ -73,7 +73,7 @@ type Props = {
|
|
|
73
73
|
const TokenizedDiffView: FC<Props> = ({ file, viewType, className, children }) => {
|
|
74
74
|
const { tokens } = useTokenizeWorker(tokenize, {
|
|
75
75
|
hunks: file.hunks,
|
|
76
|
-
language: determineLanguage(file.language)
|
|
76
|
+
language: determineLanguage(file.language),
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
return (
|
|
@@ -40,30 +40,30 @@ const commitCreateNewApp = {
|
|
|
40
40
|
revision: "0d8c1d328f4599b363755671afe667c7ace52bae",
|
|
41
41
|
author: {
|
|
42
42
|
name: "Arthur Dent",
|
|
43
|
-
mail: "arthur.dent@hitchhiker.com"
|
|
43
|
+
mail: "arthur.dent@hitchhiker.com",
|
|
44
44
|
},
|
|
45
45
|
description: "create new app",
|
|
46
|
-
when: new Date("2020-04-09T13:07:42Z")
|
|
46
|
+
when: new Date("2020-04-09T13:07:42Z"),
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
const commitFixedMissingImport = {
|
|
50
50
|
revision: "fab38559ce3ab8c388e067712b4bd7ab94b9fa9b",
|
|
51
51
|
author: {
|
|
52
52
|
name: "Tricia Marie McMillan",
|
|
53
|
-
mail: "trillian@hitchhiker.com"
|
|
53
|
+
mail: "trillian@hitchhiker.com",
|
|
54
54
|
},
|
|
55
55
|
description: "fixed missing import",
|
|
56
|
-
when: new Date("2020-05-10T09:18:42Z")
|
|
56
|
+
when: new Date("2020-05-10T09:18:42Z"),
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const commitImplementMain = {
|
|
60
60
|
revision: "5203292ab2bc0c020dd22adc4d3897da4930e43f",
|
|
61
61
|
author: {
|
|
62
62
|
name: "Ford Prefect",
|
|
63
|
-
mail: "ford.prefect@hitchhiker.com"
|
|
63
|
+
mail: "ford.prefect@hitchhiker.com",
|
|
64
64
|
},
|
|
65
65
|
description: "implemented main function",
|
|
66
|
-
when: new Date("2020-04-12T16:29:42Z")
|
|
66
|
+
when: new Date("2020-04-12T16:29:42Z"),
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const source: AnnotatedSource = {
|
|
@@ -72,44 +72,44 @@ const source: AnnotatedSource = {
|
|
|
72
72
|
{
|
|
73
73
|
lineNumber: 1,
|
|
74
74
|
code: "package main",
|
|
75
|
-
...commitCreateNewApp
|
|
75
|
+
...commitCreateNewApp,
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
lineNumber: 2,
|
|
79
79
|
code: "",
|
|
80
|
-
...commitCreateNewApp
|
|
80
|
+
...commitCreateNewApp,
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
lineNumber: 3,
|
|
84
84
|
code: 'import "fmt"',
|
|
85
|
-
...commitFixedMissingImport
|
|
85
|
+
...commitFixedMissingImport,
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
lineNumber: 4,
|
|
89
89
|
code: "",
|
|
90
|
-
...commitFixedMissingImport
|
|
90
|
+
...commitFixedMissingImport,
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
lineNumber: 5,
|
|
94
94
|
code: "func main() {",
|
|
95
|
-
...commitCreateNewApp
|
|
95
|
+
...commitCreateNewApp,
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
lineNumber: 6,
|
|
99
99
|
code: ' fmt.Println("Hello World")',
|
|
100
|
-
...commitImplementMain
|
|
100
|
+
...commitImplementMain,
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
lineNumber: 7,
|
|
104
104
|
code: "}",
|
|
105
|
-
...commitCreateNewApp
|
|
105
|
+
...commitCreateNewApp,
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
lineNumber: 8,
|
|
109
109
|
code: "",
|
|
110
|
-
...commitCreateNewApp
|
|
111
|
-
}
|
|
112
|
-
]
|
|
110
|
+
...commitCreateNewApp,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
const markdownSource: AnnotatedSource = {
|
|
@@ -118,44 +118,44 @@ const markdownSource: AnnotatedSource = {
|
|
|
118
118
|
{
|
|
119
119
|
lineNumber: 1,
|
|
120
120
|
code: "# Title",
|
|
121
|
-
...commitCreateNewApp
|
|
121
|
+
...commitCreateNewApp,
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
lineNumber: 2,
|
|
125
125
|
code: "",
|
|
126
|
-
...commitCreateNewApp
|
|
126
|
+
...commitCreateNewApp,
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
lineNumber: 3,
|
|
130
130
|
code: "This is a short Markdown text.",
|
|
131
|
-
...commitFixedMissingImport
|
|
131
|
+
...commitFixedMissingImport,
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
lineNumber: 4,
|
|
135
135
|
code: "",
|
|
136
|
-
...commitFixedMissingImport
|
|
136
|
+
...commitFixedMissingImport,
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
lineNumber: 5,
|
|
140
140
|
code: "With **bold** and __italic__ words.",
|
|
141
|
-
...commitCreateNewApp
|
|
141
|
+
...commitCreateNewApp,
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
lineNumber: 6,
|
|
145
145
|
code: "",
|
|
146
|
-
...commitImplementMain
|
|
146
|
+
...commitImplementMain,
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
lineNumber: 7,
|
|
150
150
|
code: "> This should be a quote",
|
|
151
|
-
...commitCreateNewApp
|
|
151
|
+
...commitCreateNewApp,
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
lineNumber: 8,
|
|
155
155
|
code: "",
|
|
156
|
-
...commitCreateNewApp
|
|
157
|
-
}
|
|
158
|
-
]
|
|
156
|
+
...commitCreateNewApp,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
const Robohash: FC = ({ children }) => {
|
|
@@ -164,9 +164,9 @@ const Robohash: FC = ({ children }) => {
|
|
|
164
164
|
return <BinderContext.Provider value={binder}>{children}</BinderContext.Provider>;
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
-
storiesOf("Annotate", module)
|
|
168
|
-
.addDecorator(storyFn => <MemoryRouter initialEntries={["/"]}>{storyFn()}</MemoryRouter>)
|
|
169
|
-
.addDecorator(storyFn => <Wrapper className="box">{storyFn()}</Wrapper>)
|
|
167
|
+
storiesOf("Repositories/Annotate", module)
|
|
168
|
+
.addDecorator((storyFn) => <MemoryRouter initialEntries={["/"]}>{storyFn()}</MemoryRouter>)
|
|
169
|
+
.addDecorator((storyFn) => <Wrapper className="box">{storyFn()}</Wrapper>)
|
|
170
170
|
.add("Default", () => (
|
|
171
171
|
<Annotate source={source} repository={repository} baseDate={new Date("2020-04-16T09:22:42Z")} />
|
|
172
172
|
))
|
|
@@ -115,7 +115,7 @@ const Contributors: FC<PersonsProps> = ({ persons, label, displayTextOnly }) =>
|
|
|
115
115
|
<>
|
|
116
116
|
{t(label)}{" "}
|
|
117
117
|
<AvatarList>
|
|
118
|
-
{persons.map(p => (
|
|
118
|
+
{persons.map((p) => (
|
|
119
119
|
<ContributorWithAvatar key={p.name} person={p} avatar={avatarFactory(p)} />
|
|
120
120
|
))}
|
|
121
121
|
</AvatarList>
|
|
@@ -125,9 +125,9 @@ const Contributors: FC<PersonsProps> = ({ persons, label, displayTextOnly }) =>
|
|
|
125
125
|
return (
|
|
126
126
|
<>
|
|
127
127
|
{t(label)}{" "}
|
|
128
|
-
<
|
|
128
|
+
<span title={persons.map((person) => "- " + person.name).join("\n")}>
|
|
129
129
|
{t("changeset.contributors.more", { count: persons.length })}
|
|
130
|
-
</
|
|
130
|
+
</span>
|
|
131
131
|
</>
|
|
132
132
|
);
|
|
133
133
|
}
|
|
@@ -148,7 +148,7 @@ const ChangesetAuthor: FC<Props> = ({ changeset }) => {
|
|
|
148
148
|
|
|
149
149
|
const filterContributorsByType = (type: string) => {
|
|
150
150
|
if (changeset.contributors) {
|
|
151
|
-
return changeset.contributors.filter(p => p.type === type).map(contributor => contributor.person);
|
|
151
|
+
return changeset.contributors.filter((p) => p.type === type).map((contributor) => contributor.person);
|
|
152
152
|
}
|
|
153
153
|
return emptyListOfContributors;
|
|
154
154
|
};
|
|
@@ -39,11 +39,11 @@ const ChangesetDescription: FC<Props> = ({ changeset, value }) => {
|
|
|
39
39
|
"changeset.description.tokens",
|
|
40
40
|
{
|
|
41
41
|
changeset,
|
|
42
|
-
value
|
|
42
|
+
value,
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
return <SplitAndReplace text={value} replacements={replacements.flatMap(r => r(changeset, value))} />;
|
|
46
|
+
return <SplitAndReplace text={value} replacements={replacements.flatMap((r) => r(changeset, value))} />;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
export default ChangesetDescription;
|
|
@@ -29,9 +29,9 @@ describe("isDiffSupported tests", () => {
|
|
|
29
29
|
const supported = isDiffSupported({
|
|
30
30
|
_links: {
|
|
31
31
|
diff: {
|
|
32
|
-
href: "http://diff"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
32
|
+
href: "http://diff",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
expect(supported).toBe(true);
|
|
@@ -41,9 +41,9 @@ describe("isDiffSupported tests", () => {
|
|
|
41
41
|
const supported = isDiffSupported({
|
|
42
42
|
_links: {
|
|
43
43
|
diffParsed: {
|
|
44
|
-
href: "http://diff"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
44
|
+
href: "http://diff",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
expect(supported).toBe(true);
|
|
@@ -51,7 +51,7 @@ describe("isDiffSupported tests", () => {
|
|
|
51
51
|
|
|
52
52
|
it("should return false if not diff link was provided", () => {
|
|
53
53
|
const supported = isDiffSupported({
|
|
54
|
-
_links: {}
|
|
54
|
+
_links: {},
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
expect(supported).toBe(false);
|
|
@@ -63,9 +63,9 @@ describe("createUrl tests", () => {
|
|
|
63
63
|
const url = createUrl({
|
|
64
64
|
_links: {
|
|
65
65
|
diff: {
|
|
66
|
-
href: "http://diff"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
66
|
+
href: "http://diff",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
expect(url).toBe("http://diff?format=GIT");
|
|
@@ -75,9 +75,9 @@ describe("createUrl tests", () => {
|
|
|
75
75
|
const url = createUrl({
|
|
76
76
|
_links: {
|
|
77
77
|
diffParsed: {
|
|
78
|
-
href: "http://diff-parsed"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
78
|
+
href: "http://diff-parsed",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
expect(url).toBe("http://diff-parsed");
|
|
@@ -87,12 +87,12 @@ describe("createUrl tests", () => {
|
|
|
87
87
|
const url = createUrl({
|
|
88
88
|
_links: {
|
|
89
89
|
diff: {
|
|
90
|
-
href: "http://diff"
|
|
90
|
+
href: "http://diff",
|
|
91
91
|
},
|
|
92
92
|
diffParsed: {
|
|
93
|
-
href: "http://diff-parsed"
|
|
94
|
-
}
|
|
95
|
-
}
|
|
93
|
+
href: "http://diff-parsed",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
expect(url).toBe("http://diff-parsed");
|
|
@@ -101,7 +101,7 @@ describe("createUrl tests", () => {
|
|
|
101
101
|
it("should throw an error if no diff link is defined", () => {
|
|
102
102
|
expect(() =>
|
|
103
103
|
createUrl({
|
|
104
|
-
_links: {}
|
|
104
|
+
_links: {},
|
|
105
105
|
})
|
|
106
106
|
).toThrow();
|
|
107
107
|
});
|
|
@@ -34,7 +34,7 @@ type Props = {
|
|
|
34
34
|
class ChangesetList extends React.Component<Props> {
|
|
35
35
|
render() {
|
|
36
36
|
const { repository, changesets } = this.props;
|
|
37
|
-
const content = changesets.map(changeset => {
|
|
37
|
+
const content = changesets.map((changeset) => {
|
|
38
38
|
return <ChangesetRow key={changeset.id} repository={repository} changeset={changeset} />;
|
|
39
39
|
});
|
|
40
40
|
return <>{content}</>;
|
|
@@ -34,7 +34,7 @@ type Props = WithTranslation & {
|
|
|
34
34
|
class ChangesetTagsCollapsed extends React.Component<Props> {
|
|
35
35
|
render() {
|
|
36
36
|
const { tags, t } = this.props;
|
|
37
|
-
const message = tags.map(tag => tag.name).join(", ");
|
|
37
|
+
const message = tags.map((tag) => tag.name).join(", ");
|
|
38
38
|
return (
|
|
39
39
|
<Tooltip location="top" message={message} multiline={true}>
|
|
40
40
|
<ChangesetTagBase icon="tags" label={tags.length + " " + t("changeset.tags")} />
|