Skip to content

Commit

Permalink
feature(405666): made api path changes
Browse files Browse the repository at this point in the history
  • Loading branch information
VijayalakshmirSF4471 committed Dec 30, 2024
1 parent 38a440a commit df976db
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/app/api/workflowDesignerAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ export interface WorkflowListPathsType {
readonly deleteWorkflowRules: string;
}

// Define the path template once
const workflowRulesPath = `{baseUrl}/{workflowId}/rules/{ruleId}`;

const apiPaths: WorkflowListPathsType = {
updateWorkflowRules: `{baseUrl}/{workflowId}/rules/{ruleId}/update`,
deleteWorkflowRules: `{baseUrl}/{ruleId}/rules`,
updateWorkflowRules: workflowRulesPath,
deleteWorkflowRules: workflowRulesPath,
}

export const WorkflowApiPaths: WorkflowListPathsType = apiPaths;
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export class WorkflowDiagramComponent implements AfterViewInit {
public onDeleteNode(nodeObject) : void{
let ruleData : RuleData2 = nodeObject.data as RuleData2;
const index = this.diagram.nodes.findIndex(node => (node.data as RuleData2).successRuleId === ruleData.id);
this.workflowService.deleteRule(ruleData.id).then((result) => {
this.workflowService.deleteRule(ruleData.chatWorkflowId, ruleData.id).then((result) => {
console.log(result.message);
this.diagram.setProperties({ nodes: [], connectors: [] }, true);
this.diagram.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<label>
Description: <input type="text" [(ngModel)]="sideBarDescription" name="singleDescription" placeholder="Enter description..." class="description-box" />
</label>
<label>
<label [hidden]="nodeBlockType === chatWorkflowBlockTypeEnum.SendTextMessage">
Label: <input type="text" [(ngModel)]="sideBarLabel" name="sideBarLabel" placeholder="Enter label..." class="description-box" required />
</label>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/app/services/workflow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export class WorkflowService {
return this.http.put<{ message: string }>(url, body, this.httpOptions).toPromise();
}

deleteRule(ruleId: number): Promise<{ message: string }> {
deleteRule(workflowId :number, ruleId: number): Promise<{ message: string }> {
const url = WorkflowApiPaths.deleteWorkflowRules
.replace('{baseUrl}', this.baseUrl)
.replace('{workflowId}', workflowId.toString())
.replace('{ruleId}', ruleId.toString());

return this.http.delete<{ message: string }>(url, this.httpOptions).toPromise();
Expand Down

0 comments on commit df976db

Please sign in to comment.