Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2004] Remove redundant Segment class #2085

Merged
merged 4 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/components/c-segment-collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script lang='ts'>
import { defineComponent } from 'vue';
import cSegment from './c-segment.vue';
import Segment from '../utils/segment';
import { AuthorshipFileSegment } from '../types/types';
export default defineComponent({
name: 'c-segment-collection',
Expand All @@ -16,7 +16,7 @@ export default defineComponent({
},
props: {
segments: {
type: Array<Segment>,
type: Array<AuthorshipFileSegment>,
required: true,
},
path: {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/c-segment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
</template>

<script lang='ts'>
import { defineComponent } from 'vue';
import { defineComponent, PropType } from 'vue';
import { mapState } from 'vuex';
import Segment from '../utils/segment';
import { StoreState } from '../types/vuex.d';
import { AuthorshipFileSegment } from '../types/types';
export default defineComponent({
name: 'c-segment',
props: {
segment: {
type: Segment,
type: Object as PropType<AuthorshipFileSegment>,
required: true,
},
path: {
Expand Down
13 changes: 0 additions & 13 deletions frontend/src/utils/segment.ts

This file was deleted.

15 changes: 7 additions & 8 deletions frontend/src/views/c-authorship.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,10 @@ import minimatch from 'minimatch';
import brokenLinkDisabler from '../mixin/brokenLinkMixin';
import tooltipPositioner from '../mixin/dynamicTooltipMixin';
import cSegmentCollection from '../components/c-segment-collection.vue';
import Segment from '../utils/segment';
import getNonRepeatingColor from '../utils/random-color-generator';
import { StoreState } from '../types/vuex.d';
import { FileResult, Line } from '../types/zod/authorship-type';
import { AuthorshipFile } from '../types/types';
import { AuthorshipFile, AuthorshipFileSegment } from '../types/types';
import { FilesSortType, FilterType } from '../types/authorship';
const filesSortDict = {
Expand Down Expand Up @@ -518,11 +517,11 @@ export default defineComponent({
return name === '-';
},
splitSegments(lines: Line[]): { segments: Segment[]; blankLineCount: number; } {
splitSegments(lines: Line[]): { segments: AuthorshipFileSegment[]; blankLineCount: number; } {
// split into segments separated by knownAuthor
let lastState: string | null;
let lastId = -1;
const segments: Segment[] = [];
const segments: AuthorshipFileSegment[] = [];
let blankLineCount = 0;
lines.forEach((line, lineCount) => {
Expand All @@ -532,11 +531,11 @@ export default defineComponent({
const knownAuthor = (line.author && isAuthorMatched) ? line.author.gitId : null;
if (knownAuthor !== lastState || lastId === -1) {
segments.push(new Segment(
segments.push({
knownAuthor,
[],
[],
));
lineNumbers: [],
lines: [],
});
lastId += 1;
lastState = knownAuthor;
Expand Down
Loading