feat: 🎸 edit project configuration#87
feat: 🎸 edit project configuration#87amanecer2levi wants to merge 1 commit intofeature/workspace-settingsfrom
Conversation
Nx Cloud ReportCI is running for commit 199e799. 📂 Click to track the progress, see the status, the terminal output, and the build insights. Sent with 💌 from NxCloud. |
1a43871 to
d260f16
Compare
libs/configuration/src/lib/configuration/configuration.component.html
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
15949c3 to
ca3783a
Compare
Danieliverant
left a comment
There was a problem hiding this comment.
I resolved what you fixed and reviewed again, please see my previous review comments
| "noImplicitReturns": true, | ||
| "noFallthroughCasesInSwitch": true | ||
| "noFallthroughCasesInSwitch": true, | ||
| "resolveJsonModule": true |
There was a problem hiding this comment.
why is it needed? I didnt see that you import json anywhere, if its for jest, move it to tsconfig.spec.json
There was a problem hiding this comment.
im importing angular.json file.
| this.workspaceSettingsService | ||
| .updateWorkspaceProjectConfiguration( | ||
| this.projectName, | ||
| this.form.value as Project | ||
| ) | ||
| .subscribe(); |
There was a problem hiding this comment.
| 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
| readonly formly$: Observable<{ | ||
| formData: JsonObject; | ||
| formFields: FormlyFieldConfig[]; | ||
| }> = combineLatest([this.formData$, this.formFields$]).pipe( | ||
| map(([formData, formFields]) => ({ formFields, formData })) | ||
| ); |
There was a problem hiding this comment.
| 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) | ||
| ) |
There was a problem hiding this comment.
| ) | |
| ), | |
| distinctUntilChanged() |
| .readWorkspaceProjectNames() | ||
| .pipe( | ||
| map((names) => names[0]), | ||
| tap((projectName) => (this.projectName = projectName)) |
There was a problem hiding this comment.
| tap((projectName) => (this.projectName = projectName)) | |
| distinctUntilChanged() |
| changeDetection: ChangeDetectionStrategy.OnPush, | ||
| }) | ||
| export class ConfigurationComponent {} | ||
| export class ConfigurationComponent implements OnInit { |
There was a problem hiding this comment.
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
ca3783a to
019dd07
Compare
✅ Closes: 15
019dd07 to
199e799
Compare
Danieliverant
left a comment
There was a problem hiding this comment.
Looks good to me, just a small question - have we decided to go with Formly? why not plain reactive-forms?
| } 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'; |
There was a problem hiding this comment.
why this import is from 'node_modules' and not from @angular/cli like the others?
| } 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'; |
There was a problem hiding this comment.
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
✅ Closes: 15
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: 15
What is the new behavior?
Edit project configuration
Does this PR introduce a breaking change?
Other information