-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [Form Editor]inline lu editor in trigger (#1872)
* lu in form editor * fix naming * bugfix * fix circular reference in shared and indexer * add start and end line for each intent * add diagnostics * delete lu editor in dialog * remove notice * fix bug: composer crashed when switch page to lu page * fix tslint error * support navigation back for lu error in notification * remove unused referrence * update the lib Co-authored-by: Zhixiang Zhan <[email protected]> Co-authored-by: liweitian <[email protected]> Co-authored-by: leileizhang <[email protected]>
- Loading branch information
1 parent
1d5f59e
commit ce3ea42
Showing
20 changed files
with
298 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,89 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { Diagnostic, createSingleMessage, DialogInfo, LuFile } from '@bfc/indexers'; | ||
|
||
import { replaceDialogDiagnosticLabel } from '../../utils'; | ||
|
||
export const DiagnosticSeverity = ['Error', 'Warning']; //'Information', 'Hint' | ||
|
||
export enum NotificationType { | ||
DIALOG, | ||
LG, | ||
LU, | ||
} | ||
|
||
export interface INotification { | ||
id: string; | ||
severity: string; | ||
type: string; | ||
type: NotificationType; | ||
location: string; | ||
message: string; | ||
diagnostic: any; | ||
dialogPath?: string; //the data path in dialog | ||
} | ||
|
||
export const DiagnosticSeverity = ['Error', 'Warning']; //'Information', 'Hint' | ||
export class DialogNotification implements INotification { | ||
id: string; | ||
severity: string; | ||
type: NotificationType; | ||
location: string; | ||
message: string; | ||
diagnostic: Diagnostic; | ||
dialogPath?: string; | ||
constructor(id: string, location: string, diagnostic: Diagnostic) { | ||
this.id = id; | ||
this.severity = DiagnosticSeverity[diagnostic.severity] || ''; | ||
this.message = `In ${replaceDialogDiagnosticLabel(diagnostic.path)} ${diagnostic.message}`; | ||
this.diagnostic = diagnostic; | ||
this.location = location; | ||
this.type = NotificationType.DIALOG; | ||
this.dialogPath = diagnostic.path; | ||
} | ||
} | ||
|
||
export class LgNotification implements INotification { | ||
id: string; | ||
severity: string; | ||
type: NotificationType; | ||
location: string; | ||
message: string; | ||
diagnostic: Diagnostic; | ||
dialogPath?: string; | ||
constructor(id: string, location: string, diagnostic: Diagnostic) { | ||
this.id = id; | ||
this.severity = DiagnosticSeverity[diagnostic.severity] || ''; | ||
this.message = createSingleMessage(diagnostic); | ||
this.diagnostic = diagnostic; | ||
this.location = location; | ||
this.type = NotificationType.LG; | ||
} | ||
} | ||
|
||
export class LuNotification implements INotification { | ||
id: string; | ||
severity: string; | ||
type: NotificationType; | ||
location: string; | ||
message: string; | ||
diagnostic: Diagnostic; | ||
dialogPath?: string; | ||
constructor(id: string, location: string, diagnostic: Diagnostic, luFile: LuFile, dialogs: DialogInfo[]) { | ||
this.id = id; | ||
this.severity = DiagnosticSeverity[diagnostic.severity] || ''; | ||
this.message = createSingleMessage(diagnostic); | ||
this.diagnostic = diagnostic; | ||
this.location = location; | ||
this.type = NotificationType.LU; | ||
this.dialogPath = this.findDialogPath(luFile, dialogs, diagnostic); | ||
} | ||
|
||
private findDialogPath(luFile: LuFile, dialogs: DialogInfo[], d: Diagnostic) { | ||
const intentName = luFile.intents.find(intent => { | ||
const { range } = intent; | ||
if (!range) return false; | ||
return d.range && d.range.start.line >= range.startLineNumber && d.range.end.line <= range.endLineNumber; | ||
})?.Name; | ||
|
||
return dialogs.find(dialog => dialog.id === luFile.id)?.referredLuIntents.find(lu => lu.name === intentName)?.path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.