@@ -32,7 +32,7 @@ import { TextareaFieldComponent } from '../../components/core/textarea-field/tex
32
32
import { ButtonComponent } from '../../components/core/button/button.component' ;
33
33
import { AiChatComponent } from '../../components/ai-chat/ai-chat.component' ;
34
34
import { MultiUploadComponent } from '../../components/multi-upload/multi-upload.component' ;
35
- import { NgIconComponent } from '@ng-icons/core' ;
35
+ import { NgIconComponent , provideIcons } from '@ng-icons/core' ;
36
36
import { ErrorMessageComponent } from '../../components/core/error-message/error-message.component' ;
37
37
import { ConfirmationDialogComponent } from '../../components/confirmation-dialog/confirmation-dialog.component' ;
38
38
import {
@@ -44,6 +44,7 @@ import {
44
44
import { ToasterService } from 'src/app/services/toaster/toaster.service' ;
45
45
import { catchError , switchMap , take } from 'rxjs' ;
46
46
import { RequirementTypeEnum } from 'src/app/model/enum/requirement-type.enum' ;
47
+ import { heroSparklesSolid } from '@ng-icons/heroicons/solid' ;
47
48
48
49
@Component ( {
49
50
selector : 'app-edit-solution' ,
@@ -64,6 +65,11 @@ import { RequirementTypeEnum } from 'src/app/model/enum/requirement-type.enum';
64
65
ErrorMessageComponent ,
65
66
MatTooltipModule ,
66
67
] ,
68
+ providers : [
69
+ provideIcons ( {
70
+ heroSparklesSolid
71
+ } )
72
+ ]
67
73
} )
68
74
export class EditSolutionComponent {
69
75
projectId : string = '' ;
@@ -133,92 +139,84 @@ export class EditSolutionComponent {
133
139
this . createRequirementForm ( ) ;
134
140
}
135
141
136
- updateRequirement ( ) {
137
- if ( this . requirementForm . getRawValue ( ) . expandAI ) {
138
- const body : IUpdateRequirementRequest = {
139
- updatedReqt : this . requirementForm . getRawValue ( ) . title ,
140
- addReqtType : this . folderName ,
141
- fileContent : this . uploadedFileContent ,
142
- contentType : this . uploadedFileContent ? 'fileContent' : 'userContent' ,
143
- id : this . initialData . id ,
144
- reqId : this . fileName . replace ( / \- b a s e .j s o n $ / , '' ) ,
145
- reqDesc : this . requirementForm . getRawValue ( ) . content ,
146
- name : this . initialData . name ,
147
- description : this . initialData . description ,
148
- useGenAI : true ,
149
- } ;
150
- this . featureService . updateRequirement ( body ) . subscribe (
151
- ( data ) => {
152
- data . updated . requirement = data . updated . requirement . replace (
153
- PRD_HEADINGS . SCREENS ,
154
- PRD_HEADINGS . SCREENS_FORMATTED ,
155
- ) . replace (
156
- PRD_HEADINGS . PERSONAS ,
157
- PRD_HEADINGS . PERSONAS_FORMATTED ,
158
- ) ;
159
- this . store . dispatch (
160
- new UpdateFile ( this . absoluteFilePath , {
161
- requirement : data . updated . requirement ,
162
- title : data . updated . title ,
163
- chatHistory : this . chatHistory ,
164
- epicTicketId : this . initialData . epicTicketId ,
165
- } ) ,
166
- ) ;
167
- this . allowFreeRedirection = true ;
168
- this . store . dispatch ( new ReadFile ( `${ this . folderName } /${ this . fileName } ` ) ) ;
169
- this . selectedFileContent$ . subscribe ( ( res : any ) => {
170
- this . oldContent = res . requirement ;
171
- this . requirementForm . patchValue ( {
172
- title : res . title ,
173
- content : res . requirement ,
174
- epicticketid : res . epicTicketId ,
175
- } ) ;
176
- this . chatHistory = res . chatHistory || [ ] ;
142
+ updateRequirementWithAI ( ) {
143
+ const body : IUpdateRequirementRequest = {
144
+ updatedReqt : this . requirementForm . getRawValue ( ) . title ,
145
+ addReqtType : this . folderName ,
146
+ fileContent : this . uploadedFileContent ,
147
+ contentType : this . uploadedFileContent ? 'fileContent' : 'userContent' ,
148
+ id : this . initialData . id ,
149
+ reqId : this . fileName . replace ( / \- b a s e .j s o n $ / , '' ) ,
150
+ reqDesc : this . requirementForm . getRawValue ( ) . content ,
151
+ name : this . initialData . name ,
152
+ description : this . initialData . description ,
153
+ useGenAI : true ,
154
+ } ;
155
+ this . featureService . updateRequirement ( body ) . subscribe (
156
+ ( data ) => {
157
+ data . updated . requirement = data . updated . requirement
158
+ . replace ( PRD_HEADINGS . SCREENS , PRD_HEADINGS . SCREENS_FORMATTED )
159
+ . replace ( PRD_HEADINGS . PERSONAS , PRD_HEADINGS . PERSONAS_FORMATTED ) ;
160
+ this . store . dispatch (
161
+ new UpdateFile ( this . absoluteFilePath , {
162
+ requirement : data . updated . requirement ,
163
+ title : data . updated . title ,
164
+ chatHistory : this . chatHistory ,
165
+ epicTicketId : this . initialData . epicTicketId ,
166
+ } ) ,
167
+ ) ;
168
+ this . allowFreeRedirection = true ;
169
+ this . store . dispatch (
170
+ new ReadFile ( `${ this . folderName } /${ this . fileName } ` ) ,
171
+ ) ;
172
+ this . selectedFileContent$ . subscribe ( ( res : any ) => {
173
+ this . oldContent = res . requirement ;
174
+ this . requirementForm . patchValue ( {
175
+ title : res . title ,
176
+ content : res . requirement ,
177
+ epicticketid : res . epicTicketId ,
177
178
} ) ;
178
- this . toastService . showSuccess (
179
- TOASTER_MESSAGES . ENTITY . UPDATE . SUCCESS (
180
- body . addReqtType ,
181
- data . reqId ,
182
- ) ,
183
- ) ;
184
- } ,
185
- ( error ) => {
186
- console . error ( 'Error updating requirement:' , error ) ; // Handle any errors
187
- this . toastService . showError (
188
- TOASTER_MESSAGES . ENTITY . UPDATE . FAILURE (
189
- this . folderName ,
190
- body . reqId ,
191
- ) ,
192
- ) ;
193
- } ,
194
- ) ;
195
- } else {
196
- this . store . dispatch (
197
- new UpdateFile ( this . absoluteFilePath , {
198
- requirement : this . requirementForm . getRawValue ( ) . content ,
199
- title : this . requirementForm . getRawValue ( ) . title ,
200
- chatHistory : this . chatHistory ,
201
- epicTicketId : this . initialData . epicTicketId ,
202
- } ) ,
203
- ) ;
204
- this . allowFreeRedirection = true ;
205
- this . store . dispatch ( new ReadFile ( `${ this . folderName } /${ this . fileName } ` ) ) ;
206
- this . selectedFileContent$ . subscribe ( ( res : any ) => {
207
- this . oldContent = res . requirement ;
208
- this . requirementForm . patchValue ( {
209
- title : res . title ,
210
- content : res . requirement ,
211
- epicticketid : res . epicTicketId ,
179
+ this . chatHistory = res . chatHistory || [ ] ;
212
180
} ) ;
213
- this . chatHistory = res . chatHistory || [ ] ;
181
+ this . toastService . showSuccess (
182
+ TOASTER_MESSAGES . ENTITY . UPDATE . SUCCESS ( body . addReqtType , data . reqId ) ,
183
+ ) ;
184
+ } ,
185
+ ( error ) => {
186
+ console . error ( 'Error updating requirement:' , error ) ; // Handle any errors
187
+ this . toastService . showError (
188
+ TOASTER_MESSAGES . ENTITY . UPDATE . FAILURE ( this . folderName , body . reqId ) ,
189
+ ) ;
190
+ } ,
191
+ ) ;
192
+ }
193
+
194
+ updateRequirement ( ) {
195
+ this . store . dispatch (
196
+ new UpdateFile ( this . absoluteFilePath , {
197
+ requirement : this . requirementForm . getRawValue ( ) . content ,
198
+ title : this . requirementForm . getRawValue ( ) . title ,
199
+ chatHistory : this . chatHistory ,
200
+ epicTicketId : this . initialData . epicTicketId ,
201
+ } ) ,
202
+ ) ;
203
+ this . allowFreeRedirection = true ;
204
+ this . store . dispatch ( new ReadFile ( `${ this . folderName } /${ this . fileName } ` ) ) ;
205
+ this . selectedFileContent$ . subscribe ( ( res : any ) => {
206
+ this . oldContent = res . requirement ;
207
+ this . requirementForm . patchValue ( {
208
+ title : res . title ,
209
+ content : res . requirement ,
210
+ epicticketid : res . epicTicketId ,
214
211
} ) ;
215
- this . toastService . showSuccess (
216
- TOASTER_MESSAGES . ENTITY . UPDATE . SUCCESS (
217
- this . folderName ,
218
- this . fileName . replace ( / \- b a s e .j s o n $ / , '' ) ,
219
- ) ,
220
- ) ;
221
- }
212
+ this . chatHistory = res . chatHistory || [ ] ;
213
+ } ) ;
214
+ this . toastService . showSuccess (
215
+ TOASTER_MESSAGES . ENTITY . UPDATE . SUCCESS (
216
+ this . folderName ,
217
+ this . fileName . replace ( / \- b a s e .j s o n $ / , '' ) ,
218
+ ) ,
219
+ ) ;
222
220
}
223
221
224
222
navigateBackToDocumentList ( data : any ) {
0 commit comments