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
Select apps in group edit analysis page T517 #225
Select apps in group edit analysis page T517 #225
Conversation
5c44525
to
4a0b3b5
Compare
This needs to be deferred, as the data model is likely to change completely. T517 is not in the current sprint, afaik? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left you there couple of comments.
{ | ||
return this.registeredApplicationService.getAllApplications(); | ||
if (projectId == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that. MigrationProject entity has applications collection so we can load then with project.
Or add new endpoint getProjectApplications. IMHO getAllApplications should always return all applications and remain parameterless. And this endpoint is not even used in the application, I think we use it only in tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"MigrationProject entity has applications collection" - well, it has. But jpamodelgen strips relations away.
Regarding new endpoint resource - that was my first idea too. But the way the subpaths were created, it's not possible - / is used and /{*} is used. Only after that I found I can use regex in the URL, so that could be the solution. When we get back to this task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think putting it in here is ok, but it probably should be something like getApplicationsByProject, instead of overriding "getAllApplications".
The other paths are used, but they could be changed. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you would even need to change the others, actually. Why not just "/by-project-id/{id}"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path of least resistance. If I changed other paths, I would have to go through all components and search where the path is used. Since we don't use a single constant and build them by concatenation, this seemed easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, I am for such path, perhaps shorter one, like, .../id-{id}
. It's only it was already this way. Maybe we could have a guide on how to do the endpoint URLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand your point there. It seems like each endpoint has a single client service and that service does generally use constants.
@@ -64,6 +65,9 @@ export class MigrationProjectService extends AbstractService { | |||
get(id: number) { | |||
let headers = new Headers(); | |||
let options = new RequestOptions({ headers: headers }); | |||
if (!isNumber(id)) { | |||
throw new Error("Not an app ID: " + id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it is not an app id. It should be project id.
But 👍 for adding parameter validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE
@@ -40,6 +42,7 @@ | |||
public static final String REGISTERED_APPLICATION_ID = "registered_application_id"; | |||
|
|||
@Id | |||
@Access(AccessType.PROPERTY) // Allow accessing ID without Lazy-loading the entity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work? Does it mean you can load collection of RegisteredApplications and if you access only ID, it will create SQL query getting only ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a relation to this, the ID is in the source entity table. And the proxy returns that id. So Hibernate doesn't need to load anything, it's just there.
this.dummyProject = this.dataProvider.getMigrationProject(); | ||
} | ||
|
||
@Test | ||
@RunAsClient | ||
public void testRegisterAppFromProject() throws Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test do anything we don't have covered already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see it now. It is wrongly named test. It should not test registering applications, but rather getAllApplications
endpoint with projectId
parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it should be named testRegisteredAppFromProject(). I don't like the name RegisteredApplication, too long and not much meaningful. I'd rather name the other one UserApplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE
@@ -16,8 +17,8 @@ <h2 *ngIf="!applicationGroup" i18n>Loading...</h2> | |||
</div> | |||
<div class="row"> | |||
<div class="form-group"> | |||
<label class="col-md-2 control-label" for="migrationPath" i18n>Migration Path</label> | |||
<div class="col-md-6"> | |||
<label class="col-md-2 control-label" for="migrationPath" i18n>Migration Scenario</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We agreed we will stick to Migration Path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgotten bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE
<button [disabled]="!analysisContextForm.form.valid" class="btn btn-primary" (click)="save()" i18n>Save Configuration</button> | ||
<button (click)="cancel()" type="button" class="btn btn-default" i18n>Cancel</button> | ||
<div class="col-lg-10 col-lg-offset-2"> | ||
<button (click)="saveAndRun()" class="btn btn-primary" [disabled]="!analysisContextForm.form.valid" *ngIf="isInWizard" i18n>Save & Run</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this change good for? It just reorders things...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes the source more readable - attributes are in the same order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's questionable because you moved *ngIf
part to the end so it will take you more time to figure out when it is visible.
But we don't really have any convention on this, so if you think it is better...
|
||
private _migrationPathsObservable:Observable<MigrationPath[]>; | ||
private _migrationPathsObservable: Observable<MigrationPath[]>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do those formatting changes at least in different commit, if not in different PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but then I wouldn't probably get to it ever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. At least try to make it in different commit next time :)
Btw maybe we could define some code formatting rules and run some automatic reformatting on all files? (when changes settle down little bit, so we don't have tons of conflicts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@klinki - I would love to have a code formatter that we could all consistently use. We all use different IDEs, though, I think, so that might be a little harder. It would probably have to be an external tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on IDEA now, what do you use?
Also, +1 to formatter if it doesn't control everything, like the one we have for Java. Sometimes the default is not the best, especially for the condensed syntax of TS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on IDEA as well, but I don't think that everyone is. And, I think it would be a good idea to avoid tying to a single IDE anyway.
saveAndRun() { | ||
this.action = Action.SaveAndRun; | ||
} | ||
save() { | ||
this.action = Action.Save; | ||
} | ||
cancel() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any need of this reordering.
I suggest we merge this (when ok to), because the data layer change won't change much in this PR - just the service and the checked values mapping. |
I am not sure how to rebase this, standard rebase fails. Maybe by doing a diff and applying that? |
0e59d7c
to
657bbc4
Compare
I have done basically that - detaching, git reset master, git commit --all |
Why did standard rebase fail? |
0e59d7c
to
1875f31
Compare
It was a weird rebase, I ended up with master merged into my branch, and then I couldn't push it to my github repo, kept refusing... so I did what I wrote above, and lost those 2 files for some reason |
retest |
I think some of the merges have broken this. Just a few things that I noticed:
|
I will look at it tomorrow and fix it. |
I forgot I left it in half-done state, only the UI + storing. |
e3d9fec
to
c840aad
Compare
|
8167859
to
f522bad
Compare
That path thing was my fault, sorry. I fixed that. |
retest |
|
adf3754
to
dd1d394
Compare
It didn't test anything new.
Send only relevant fields to server: - id - title - applications
dd1d394
to
2d02e92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though I think there are still some minor issues, I'm for merging.
All those major issues should be resolved. I just tested it and now it successfully updates the group and it actually changes the analyzed applications so it seems to be working.
IMO the POJO issue should be solved at the server. The server service should be able to accept the real data. It doesn't matter in our current situation, but imagine we have 10 different clients. Each client will have to strip the object before sending to the service. |
"for some reason it calls method shouldBeChecked every few seconds" - that's not a problem of this PR but of the whole app - it's being re-rendered repeatedly. We need to find out why. |
@OndraZizka Well, for the first item there is much, much more work to be done, if we want to support different clients in the future. And that POJO issue is IMHO caused by RestEasy and |
It would be nice if we had a client library that could deal with cycles properly. I'm sure some of these must exist. |
How was the "The selections don't appear to actually affect the analysis runs" solved? |
@klinki The point was not having multiple clients. The point was that this way of doing REST api creates a burden of extra handling on the client side at each place where it is used. |
No description provided.