Skip to content

feat: 🎸 edit project configuration #87

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

Open
wants to merge 1 commit into
base: feature/workspace-settings
Choose a base branch
from

Conversation

amanecer2levi
Copy link

✅ Closes: 15

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines: CONTRIBUTING.md
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: 15

What is the new behavior?

Edit project configuration

Does this PR introduce a breaking change?

[ ] Yes
[x ] No

Other information

@nx-cloud
Copy link

nx-cloud bot commented Mar 2, 2023

Nx Cloud Report

CI is running for commit 199e799.

📂 Click to track the progress, see the status, the terminal output, and the build insights.


Sent with 💌 from NxCloud.

@amanecer2 amanecer2 force-pushed the shahar/workspace-settings-configuration branch 2 times, most recently from 1a43871 to d260f16 Compare March 2, 2023 10:23
@ronnetzer ronnetzer requested a review from a team March 2, 2023 12:14
@amanecer2 amanecer2 force-pushed the shahar/workspace-settings-configuration branch 2 times, most recently from 15949c3 to ca3783a Compare March 5, 2023 11:29
Copy link
Collaborator

@Danieliverant Danieliverant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved what you fixed and reviewed again, please see my previous review comments

@@ -18,6 +18,7 @@
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it needed? I didnt see that you import json anywhere, if its for jest, move it to tsconfig.spec.json

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im importing angular.json file.

Comment on lines 88 to 80
this.workspaceSettingsService
.updateWorkspaceProjectConfiguration(
this.projectName,
this.form.value as Project
)
.subscribe();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.workspaceSettingsService
.updateWorkspaceProjectConfiguration(
this.projectName,
this.form.value as Project
)
.subscribe();
this.projectName$.pipe(
take(1),
switchMap(projectName =>
this.workspaceSettingsService
.updateWorkspaceProjectConfiguration(
projectName,
this.form.value as Project
)
)
).subscribe();

then you can remove this.projectName and the tap that assigns its value

Comment on lines 63 to 68
readonly formly$: Observable<{
formData: JsonObject;
formFields: FormlyFieldConfig[];
}> = combineLatest([this.formData$, this.formFields$]).pipe(
map(([formData, formFields]) => ({ formFields, formData }))
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
readonly formly$: Observable<{
formData: JsonObject;
formFields: FormlyFieldConfig[];
}> = combineLatest([this.formData$, this.formFields$]).pipe(
map(([formData, formFields]) => ({ formFields, formData }))
);
readonly formly$: Observable<{
formData: JsonObject;
formFields: FormlyFieldConfig[];
}> = combineLatest([this.projectConfiguration$, this.workspaceProject$]).pipe(
map(([formFields, formData]) => ({ formFields, formData }))
);

then you can remove formFields$ and formData$ subjects and ngOnInit completely

private readonly workspaceProject$ = this.projectName$.pipe(
switchMap((currentProjectName: string) =>
this.workspaceSettingsService.readWorkspaceProject(currentProjectName)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
)
),
distinctUntilChanged()

.readWorkspaceProjectNames()
.pipe(
map((names) => names[0]),
tap((projectName) => (this.projectName = projectName))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tap((projectName) => (this.projectName = projectName))
distinctUntilChanged()

})
export class ConfigurationComponent {}
export class ConfigurationComponent implements OnInit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if observables are being subscribed in more than once place you should also add shareReplay({ bufferSize: 1, refCount: true }) operator at the end, in order to avoid multiple subscriptions to the source

@amanecer2 amanecer2 force-pushed the shahar/workspace-settings-configuration branch from ca3783a to 019dd07 Compare March 7, 2023 13:56
@amanecer2 amanecer2 force-pushed the shahar/workspace-settings-configuration branch from 019dd07 to 199e799 Compare March 7, 2023 14:15
Copy link
Collaborator

@Danieliverant Danieliverant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just a small question - have we decided to go with Formly? why not plain reactive-forms?

@@ -15,10 +15,14 @@ import {
Logger,
NotFoundException,
} from '@nestjs/common';
import { JSONSchema7 } from 'json-schema';
import { Draft07 } from 'json-schema-library';
import * as angularSchema from 'node_modules/@angular/cli/lib/config/schema.json';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this import is from 'node_modules' and not from @angular/cli like the others?

@@ -15,10 +15,14 @@ import {
Logger,
NotFoundException,
} from '@nestjs/common';
import { JSONSchema7 } from 'json-schema';
import { Draft07 } from 'json-schema-library';
import * as angularSchema from 'node_modules/@angular/cli/lib/config/schema.json';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be read in runtime. Currently you're bundling & reading our installed angular pkg, instead you need to read the installed angular pkg in the currently active user's workspace by using node's fs module (readFile, readFileSync).

After this change you can revert the changes you made in the tsconfig file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants