Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const ij = angular.element(document).injector();
- const Customization = ij.get('Customization');
- const customDashboards = ij.get('customDashboards');
- const visualisationContainerSrc = 'https://rawgit.com/jean-moldovan/08844b90524ec5bd9db78b76bf02f245/raw/39df263535aae431fd320f1d76e65898a5352eb7/vs.js';
- const dashboard = {
- "sections" : [
- {
- "type" : "grid",
- "widgets" : [
- {
- "name" : "vs-container",
- "src" : visualisationContainerSrc,
- "config" : {
- "position" : {
- "value" : {
- "sizeX" : 1,
- "col" : 2,
- "row" : 3
- }
- },
- "type" : {
- "values" : [
- {
- "display" : "Line Chart",
- "value" : "line"
- },
- {
- "display" : "Bar Chart",
- "value" : "bar"
- },
- {
- "display" : "Pie Chart",
- "value" : "pie"
- },
- {
- "display" : "Trend Line Chart",
- "value" : "trend-line"
- },
- {
- "display" : "Trend Bar Chart",
- "value" : "trend-bar"
- },
- {
- "display" : "Treemap",
- "value" : "treemap"
- }
- ],
- "value" : "treemap",
- "editor" : "vs-visualisation-select"
- },
- "description" : {
- "value" : ""
- },
- "title" : {
- "value" : "Treemap"
- }
- },
- "hidden" : false
- },
- {
- "name" : "vs-container",
- "src" : visualisationContainerSrc,
- "config" : {
- "position" : {
- "value" : {
- "sizeX" : 1,
- "col" : 1,
- "row" : 3
- }
- },
- "type" : {
- "values" : [
- {
- "display" : "Line Chart",
- "value" : "line"
- },
- {
- "display" : "Bar Chart",
- "value" : "bar"
- },
- {
- "display" : "Pie Chart",
- "value" : "pie"
- },
- {
- "display" : "Trend Line Chart",
- "value" : "trend-line"
- },
- {
- "display" : "Trend Bar Chart",
- "value" : "trend-bar"
- },
- {
- "display" : "Treemap",
- "value" : "evtx-treemap"
- }
- ],
- "value" : "trend-bar",
- "editor" : "vs-visualisation-select"
- },
- "description" : {
- "value" : ""
- },
- "title" : {
- "value" : "Trend Bar"
- }
- }
- },
- {
- "name" : "vs-container",
- "src" : visualisationContainerSrc,
- "config" : {
- "position" : {
- "value" : {
- "sizeX" : 1,
- "col" : 0,
- "row" : 3
- }
- },
- "type" : {
- "values" : [
- {
- "display" : "Line Chart",
- "value" : "line"
- },
- {
- "display" : "Bar Chart",
- "value" : "bar"
- },
- {
- "display" : "Pie Chart",
- "value" : "pie"
- },
- {
- "display" : "Trend Line Chart",
- "value" : "trend-line"
- },
- {
- "display" : "Trend Bar Chart",
- "value" : "trend-bar"
- },
- {
- "display" : "Treemap",
- "value" : "evtx-treemap"
- }
- ],
- "value" : "trend-line",
- "editor" : "vs-visualisation-select"
- },
- "description" : {
- "value" : ""
- },
- "title" : {
- "value" : "Trend Line"
- }
- }
- },
- {
- "name" : "vs-container",
- "src" : visualisationContainerSrc,
- "config" : {
- "position" : {
- "value" : {
- "sizeX" : 3,
- "col": 0,
- "row" : 2
- }
- },
- "type" : {
- "values" : [
- {
- "display" : "Line Chart",
- "value" : "line"
- },
- {
- "display" : "Bar Chart",
- "value" : "bar"
- },
- {
- "display" : "Pie Chart",
- "value" : "pie"
- },
- {
- "display" : "Trend Line Chart",
- "value" : "trend-line"
- },
- {
- "display" : "Trend Bar Chart",
- "value" : "trend-bar"
- },
- {
- "display" : "Treemap",
- "value" : "evtx-treemap"
- }
- ],
- "value" : "pie",
- "editor" : "vs-visualisation-select"
- },
- "description" : {
- "value" : ""
- },
- "title" : {
- "value" : "Pie Chart"
- }
- }
- },
- {
- "name" : "vs-container",
- "src" : visualisationContainerSrc,
- "config" : {
- "position" : {
- "value" : {
- "sizeX" : 3,
- "col": 0,
- "row" : 1
- }
- },
- "type" : {
- "values" : [
- {
- "display" : "Line Chart",
- "value" : "line"
- },
- {
- "display" : "Bar Chart",
- "value" : "bar"
- },
- {
- "display" : "Pie Chart",
- "value" : "pie"
- },
- {
- "display" : "Trend Line Chart",
- "value" : "trend-line"
- },
- {
- "display" : "Trend Bar Chart",
- "value" : "trend-bar"
- },
- {
- "display" : "Treemap",
- "value" : "evtx-treemap"
- }
- ],
- "value" : "bar",
- "editor" : "vs-visualisation-select"
- },
- "description" : {
- "value" : ""
- },
- "title" : {
- "value" : "Bar Chart"
- }
- }
- },
- {
- "name" : "vs-container",
- "src" : visualisationContainerSrc,
- "config" : {
- "position" : {
- "value" : {
- "sizeX" : 3,
- "col": 0,
- "row" : 0
- }
- },
- "type" : {
- "values" : [
- {
- "display" : "Line Chart",
- "value" : "line"
- },
- {
- "display" : "Bar Chart",
- "value" : "bar"
- },
- {
- "display" : "Pie Chart",
- "value" : "pie"
- },
- {
- "display" : "Trend Line Chart",
- "value" : "trend-line"
- },
- {
- "display" : "Trend Bar Chart",
- "value" : "trend-bar"
- },
- {
- "display" : "Treemap",
- "value" : "evtx-treemap"
- }
- ],
- "value" : "line",
- "editor" : "vs-visualisation-select"
- },
- "description" : {
- "value" : ""
- },
- "title" : {
- "value" : "Line Chart"
- }
- }
- }
- ]
- }
- ],
- "icon" : "tooltip-image",
- "title" : "Visualisations",
- "slug" : "visualisations"
- };
- /////////////////////////////////////////////////
- run()
- .then(() => {
- window.location.href = '/';
- })
- .catch(err => {
- console.error(err);
- });
- /////////////////////////////////////////////////
- function run() {
- if (exist()) {
- return remove().then(create);
- } else {
- return create();
- }
- }
- function exist() {
- return !!getDashboard();
- }
- function getDashboard() {
- return customDashboards.filter(d => d.title === dashboard.title)[0];
- }
- function remove() {
- let id = getDashboard().id;
- return Customization.removeDashboard(id);
- }
- function create() {
- return Customization.addDashboard(dashboard);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement