-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from sadnub/urlaction-rework
Serverside cli, tasks, and scripts. Plus REST URL Actions
- Loading branch information
Showing
63 changed files
with
4,500 additions
and
2,610 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import axios from "axios"; | ||
|
||
import type { AlertTemplate } from "@/types/alerts"; | ||
|
||
export async function saveAlertTemplate(id: number, payload: AlertTemplate) { | ||
const { data } = await axios.put(`alerts/templates/${id}/`, payload); | ||
return data; | ||
} | ||
|
||
export async function addAlertTemplate(payload: AlertTemplate) { | ||
const { data } = await axios.post("alerts/templates/", payload); | ||
return data; | ||
} |
This file was deleted.
Oops, something went wrong.
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,97 @@ | ||
import axios from "axios"; | ||
import { openURL } from "quasar"; | ||
import { router } from "@/router"; | ||
|
||
import type { | ||
URLAction, | ||
TestRunURLActionRequest, | ||
TestRunURLActionResponse, | ||
} from "@/types/core/urlactions"; | ||
|
||
const baseUrl = "/core"; | ||
|
||
export async function fetchDashboardInfo(params = {}) { | ||
const { data } = await axios.get(`${baseUrl}/dashinfo/`, { params: params }); | ||
return data; | ||
} | ||
|
||
export async function fetchCustomFields(params = {}) { | ||
try { | ||
const { data } = await axios.get(`${baseUrl}/customfields/`, { | ||
params: params, | ||
}); | ||
return data; | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
|
||
export async function fetchURLActions(params = {}): Promise<URLAction[]> { | ||
const { data } = await axios.get(`${baseUrl}/urlaction/`, { | ||
params: params, | ||
}); | ||
return data; | ||
} | ||
|
||
export async function saveURLAction(action: URLAction) { | ||
const { data } = await axios.post(`${baseUrl}/urlaction/`, action); | ||
return data; | ||
} | ||
|
||
export async function editURLAction(id: number, action: URLAction) { | ||
const { data } = await axios.put(`${baseUrl}/urlaction/${id}/`, action); | ||
return data; | ||
} | ||
|
||
export async function removeURLAction(id: number) { | ||
const { data } = await axios.delete(`${baseUrl}/urlaction/${id}/`); | ||
return data; | ||
} | ||
|
||
interface RunURLActionRequest { | ||
agent_id?: string; | ||
client?: number; | ||
site?: number; | ||
action: number; | ||
} | ||
|
||
export async function runURLAction(payload: RunURLActionRequest) { | ||
const { data } = await axios.patch(`${baseUrl}/urlaction/run/`, payload); | ||
openURL(data); | ||
} | ||
|
||
export async function runTestURLAction( | ||
payload: TestRunURLActionRequest, | ||
): Promise<TestRunURLActionResponse> { | ||
const { data } = await axios.post(`${baseUrl}/urlaction/run/test/`, payload); | ||
return data; | ||
} | ||
|
||
export async function checkWebTermPerms(): Promise<{ | ||
message: string; | ||
status: number; | ||
}> { | ||
const ret = await axios.post(`${baseUrl}/webtermperms/`); | ||
return { message: ret.data, status: ret.status }; | ||
} | ||
|
||
export function openWebTerminal(): void { | ||
const url: string = router.resolve("/webterm").href; | ||
openURL(url, undefined, { | ||
popup: true, | ||
scrollbars: false, | ||
location: false, | ||
status: false, | ||
toolbar: false, | ||
menubar: false, | ||
width: 1280, | ||
height: 720, | ||
}); | ||
} | ||
|
||
// TODO: Build out type for openai payload | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export async function generateScript(payload: any) { | ||
const { data } = await axios.post(`${baseUrl}/openai/generate/`, payload); | ||
return data; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { boot } from "quasar/wrappers"; | ||
import { createPinia } from "pinia"; | ||
|
||
export default boot(({ app }) => { | ||
const pinia = createPinia(); | ||
|
||
app.use(pinia); | ||
|
||
// You can add Pinia plugins here | ||
// pinia.use(SomePiniaPlugin) | ||
}); |
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.