-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add all available actions with their definitions
- Loading branch information
1 parent
dcd4e0f
commit d47374e
Showing
6 changed files
with
141 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { WebviewView } from "vscode"; | ||
import { IAdditionalContext } from "../types"; | ||
import { availableActions } from "../utils"; | ||
|
||
|
||
export const actionIntenthandler = async (jsonObject: any, webview: WebviewView) => { | ||
const actions = jsonObject?.actions; | ||
const resultingActions: string[] = []; | ||
if(actions.length === 0){ | ||
return resultingActions; | ||
} | ||
for await (let action of actions) { | ||
if(availableActions.includes(action)){ | ||
resultingActions.push(action); | ||
} | ||
} | ||
|
||
// Send back the resulting actions to webview from right here | ||
webview.webview.postMessage({ | ||
command: "vscode-webview.iq.updateActions", | ||
actions: resultingActions | ||
}); | ||
|
||
return resultingActions; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export const availableActions = ["Data Import", "Send Feedback", "Data Export", "DDL Export", "Open Query Editor", "Open SQL++ Notebook"]; |
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,8 +1,87 @@ | ||
import { IActionBarButton } from "chatscope/src/components/ActionBar/ActionBar"; | ||
|
||
export const availableActions = [ | ||
"Data Import", | ||
"Send Feedback", | ||
"Data Export", | ||
"DDL Export", | ||
"Open Query Editor", | ||
"Open SQL++ Notebook", | ||
]; | ||
|
||
export const ChatAction = (actionName: string, ...rest) => { | ||
switch (actionName) { | ||
|
||
export const ChatAction = ( | ||
actionName: string, | ||
...args: any[] | ||
): IActionBarButton => { | ||
switch (actionName) { | ||
case "Data Import": { | ||
return { | ||
name: "Data Import", | ||
onclick: () => { | ||
tsvscode.postMessage({ | ||
command: "vscode-couchbase.iq.executeActionCommand", | ||
value: "vscode-couchbase.tools.dataImport", | ||
}); | ||
}, | ||
}; | ||
} | ||
return <></>; | ||
}; | ||
case "Data Export": { | ||
return { | ||
name: "Data Export", | ||
onclick: () => { | ||
tsvscode.postMessage({ | ||
command: "vscode-couchbase.iq.executeActionCommand", | ||
value: "vscode-couchbase.tools.dataExport", | ||
}); | ||
}, | ||
}; | ||
} | ||
case "DDL Export": { | ||
return { | ||
name: "DDL Export", | ||
onclick: () => { | ||
tsvscode.postMessage({ | ||
command: "vscode-couchbase.iq.executeActionCommand", | ||
value: "vscode-couchbase.tools.DDLExport", | ||
}); | ||
}, | ||
}; | ||
} | ||
case "Open Query Editor": { | ||
return { | ||
name: "Open Query Editor", | ||
onclick: () => { | ||
tsvscode.postMessage({ | ||
command: "vscode-couchbase.iq.executeActionCommand", | ||
value: "vscode-couchbase.openQueryWorkbench", | ||
}); | ||
}, | ||
}; | ||
} | ||
case "Open SQL++ Notebook": { | ||
return { | ||
name: "Open SQL++ Notebook", | ||
onclick: () => { | ||
tsvscode.postMessage({ | ||
command: "vscode-couchbase.iq.executeActionCommand", | ||
value: "vscode-couchbase.openQueryNotebook", | ||
}); | ||
}, | ||
}; | ||
} | ||
case "Send Feedback": { | ||
const [setShowFeedbackModal, setFeedbackModalData, index, qaId] = args; | ||
return { | ||
name: "Send Feedback", | ||
onclick: () => { | ||
setShowFeedbackModal(true); | ||
setFeedbackModalData({ | ||
msgIndex: index, | ||
qaId: qaId, | ||
}); | ||
}, | ||
}; | ||
} | ||
} | ||
return undefined; | ||
}; |