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

Feature/wip catalogue #53

Merged
merged 2 commits into from
Sep 6, 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
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,31 @@ GLHUserCatalogueV2Test >> testExportToJson [
self assert: ((res at: 'test user2') at: #contributedProjects) size equals: 2.
]

{ #category : #test }
GLHUserCatalogueV2Test >> testExportToJsonApostrophe [

| user json res |
user := GLHUser new
username: 'test User';
name: 'tes''t user';
contributedProjects: { GLHProject new id: 11 } ;
id: 1;
yourself.



catalogue
addUser: user.
json := catalogue exportToJson.

res := STONJSON fromString: json.
self assert: res size equals: catalogue size.

self assert: ((res at: 'tes''t user') at: #foundNames) size equals: 2.
self assert: ((res at: 'tes''t user') at: #contributedProjects) size equals: 1.

]

{ #category : #'as yet unclassified' }
GLHUserCatalogueV2Test >> testLevenshteinDistanceBetweenBenoitAndNicolas [
self assert: ('benoit' levenshteinDistanceWith: 'nicolas') equals: 6
Expand Down
7 changes: 7 additions & 0 deletions src/GitLabHealth-Model-Extension/GLHGroup.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #GLHGroup }

{ #category : #'*GitLabHealth-Model-Extension' }
GLHGroup >> allProjectstoScope [
"return the all the projects and subprojects of this group"
^ self toScope: GLHProject
]
10 changes: 10 additions & 0 deletions src/GitLabHealth-Model-Extension/GLHProject.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Extension { #name : #GLHProject }

{ #category : #'*GitLabHealth-Model-Extension' }
GLHProject >> projectContributorsInspector: aBuilder [

<inspectorPresentationOrder: 100 title: 'Contributors'>
^ SpRoassalInspectorPresenter new
canvas: (GLHProjectContributorVisualization new forProject: self );
yourself
]
8 changes: 4 additions & 4 deletions src/GitLabHealth-Model-Importer/GLHModelImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,11 @@ GLHModelImporter >> importContributedProjectsOfUser: aGLHUser [
{ #category : #'as yet unclassified' }
GLHModelImporter >> importCreatorOfCommit: aCommit [

aCommit commitCreator ifNil: [

aCommit commitCreator ifNil: [
aCommit commitCreator:

(self importUserByUsername: aCommit author_name) ]
(self importUserByUsername: aCommit author_name) ].
self userCatalogue addUser: aCommit commitCreator withProject: aCommit repository project id.
^ aCommit commitCreator
]

{ #category : #api }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
Class {
#name : #GLHProjectContributorVisualization,
#superclass : #MiAbstractVisualization,
#instVars : [
'fakeUserColor',
'userColor'
],
#category : #'GitLabHealth-Model-Visualization'
}

{ #category : #private }
GLHProjectContributorVisualization >> createLegend [

| legend |
legend := RSLegend new.
legend
text: 'fake user'
withBoxColor: self fakeUserColor .
legend
text: 'real user'
withBoxColor: self userColor .


legend legendDo: [ :l |
l
draggable;
withBorder;
padding: 20 ].
legend location right middle.

^ legend
]

{ #category : #'as yet unclassified' }
GLHProjectContributorVisualization >> createShapeForProject: aProject [

| box inspect |

box := RSBox new
size: 5;
model: aProject;
yourself.
box color: Color lightBlue .

inspect := RSInspectableInteraction new.
inspect inspectShapeBlock: [ :user |
user inspect.
"block must return a Window :-("
SystemWindow new
].
box @ inspect.

box @ (RSPopup text: [ :user |
String streamContents: [ :st |
] ]).

^ box
]

{ #category : #'as yet unclassified' }
GLHProjectContributorVisualization >> createShapeForUser: aUser [

| box inspect rsGroup|

box := RSBox new
size: 10;
model: aUser;
yourself.
box color: (aUser id
ifNil: [ self fakeUserColor ]
ifNotNil: [ self userColor.]).


inspect := RSInspectableInteraction new.
inspect inspectShapeBlock: [ :user |
user inspect.
"block must return a Window :-("
SystemWindow new
].
box @ inspect.

box @ (RSPopup text: [ :user |
String streamContents: [ :st |
st << user name"; << 'id: ' ; << (user id ifNil: ['-'])".
] ]).

rsGroup := RSGroup new add: box; yourself.
rsGroup add: (RSLabel new text: aUser name; yourself ).

RSHorizontalLineLayout new alignMiddle on: rsGroup.

^ RSComposite new
shapes: rsGroup;
model: aUser;

yourself
]

{ #category : #accessing }
GLHProjectContributorVisualization >> fakeUserColor [
^ Color lightGray
]

{ #category : #'as yet unclassified' }
GLHProjectContributorVisualization >> forProject: aGLHProject [

| c shapes legend |
c := RSCanvas new.

shapes := ((aGLHProject toScope: GLHCommit) collect: #commitCreator) asSet collect: [:author | self createShapeForUser: author ].
" shapes add: (self createShapeForProject: aGLHProject )."

c addAll: shapes.

c @ RSCanvasController.
RSLineBuilder orthoHorizontal
markerEnd: (RSMarker new
offset: 2;
shape: (RSShapeFactory triangle
color: Color black;
size: 5;
yourself));
attachPoint: RSHorizontalAttachPoint new;
canvas: c;
shapes: c nodes;
connectFrom: [ ].
RSHorizontalVanDerPloegTreeLayout new on: c nodes.

legend := self createLegend.
legend container: c.
legend build.

^ c
]

{ #category : #initialization }
GLHProjectContributorVisualization >> initialize [

super initialize.

fakeUserColor := Color purple lighter.
userColor := Color green.

]

{ #category : #accessing }
GLHProjectContributorVisualization >> userColor [
^ Color lightGreen
]
Loading