-
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.
- Loading branch information
Showing
3 changed files
with
112 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,112 @@ | ||
import ReportsManager from "@/ee/reporting/components/ReportsManager.vue"; | ||
import RunReportDialog from "@/ee/reporting/components/RunReportDialog.vue"; | ||
import { type DefineComponent } from "vue"; | ||
import { boot } from "quasar/wrappers"; | ||
|
||
export default boot(({ app }) => { | ||
interface FileBarIntegration { | ||
component: DefineComponent; | ||
name: string; | ||
type: "dialog" | "route"; | ||
} | ||
|
||
type ContextMenuType = "client" | "site" | "agent"; | ||
|
||
interface ContextMenuProps { | ||
id: number; | ||
type: ContextMenuType; | ||
} | ||
|
||
interface ContextMenuIntegration { | ||
component: DefineComponent; | ||
name: string; | ||
type: "dialog" | "route"; | ||
props: (id: number, type: ContextMenuType) => ContextMenuProps; | ||
} | ||
|
||
const propsFunction = (id: number, type: ContextMenuType) => ({ id, type }); | ||
const propsFunctionDownload = (id: number, type: ContextMenuType) => ({ | ||
id, | ||
type, | ||
download: true, | ||
}); | ||
|
||
export default boot(({ app, router }) => { | ||
router.addRoute("reports", { | ||
path: "/reports/:id", | ||
name: "Reports", | ||
component: () => import("@/ee/reporting/views/ReportView.vue"), | ||
props: (route) => ({ | ||
id: parseInt(route.params.id), | ||
format: route.query.format, | ||
dependsOn: route.query.dependsOn | ||
? JSON.parse(route.query.dependsOn) | ||
: undefined, | ||
dependencies: route.query.dependencies | ||
? JSON.parse(route.query.dependencies) | ||
: undefined, | ||
}), | ||
meta: { | ||
requireAuth: true, | ||
}, | ||
}); | ||
|
||
const fileBarIntegrations = [ | ||
{ | ||
component: ReportsManager, | ||
name: "Reporting Manager", | ||
type: "dialog", | ||
}, | ||
] as FileBarIntegration[]; | ||
|
||
const clientMenuIntegrations: ContextMenuIntegration[] = [ | ||
{ | ||
component: RunReportDialog, | ||
name: "Run Report", | ||
type: "dialog", | ||
props: propsFunction, | ||
}, | ||
{ | ||
component: RunReportDialog, | ||
name: "Download Report", | ||
type: "dialog", | ||
props: propsFunctionDownload, | ||
}, | ||
]; | ||
|
||
const siteMenuIntegrations: ContextMenuIntegration[] = [ | ||
{ | ||
component: RunReportDialog, | ||
name: "Run Report", | ||
type: "dialog", | ||
props: propsFunction, | ||
}, | ||
{ | ||
component: RunReportDialog, | ||
name: "Download Report", | ||
type: "dialog", | ||
props: propsFunctionDownload, | ||
}, | ||
]; | ||
|
||
const agentMenuIntegrations: ContextMenuIntegration[] = [ | ||
{ | ||
component: RunReportDialog, | ||
name: "Run Report", | ||
type: "dialog", | ||
props: propsFunction, | ||
}, | ||
{ | ||
component: RunReportDialog, | ||
name: "Download Report", | ||
type: "dialog", | ||
props: propsFunctionDownload, | ||
}, | ||
]; | ||
|
||
app.config.globalProperties.$integrations = { | ||
fileBarIntegrations: [], | ||
clientMenuIntegrations: [], | ||
siteMenuIntegrations: [], | ||
agentMenuIntegrations: [], | ||
fileBarIntegrations, | ||
clientMenuIntegrations, | ||
siteMenuIntegrations, | ||
agentMenuIntegrations, | ||
}; | ||
}); |