Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
sv2 committed Jul 2, 2019
1 parent eaad255 commit d811a1b
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 39 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]

# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
node_modules
public
tests
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"printWidth": 120
}
62 changes: 29 additions & 33 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<div id="app">
<v-app id="inspire" :dark="switchDark">
<v-toolbar dense fixed app clipped-right>
<v-toolbar-side-icon
@click.stop="drawer = !drawer"
></v-toolbar-side-icon>
<v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon>
<v-toolbar-title>{{ currentRouteName }}</v-toolbar-title>
<v-spacer></v-spacer>
<div>
Expand Down Expand Up @@ -34,12 +32,7 @@
</v-toolbar>

<v-list dense two-line subheader>
<v-list-tile
v-for="item in items"
:key="item.title"
avatar
:to="item.href"
>
<v-list-tile v-for="item in items" :key="item.title" avatar :to="item.href">
<v-tooltip bottom>
<v-list-tile-avatar slot="activator">
<v-icon :class="[item.iconClass]">{{ item.icon }}</v-icon>
Expand Down Expand Up @@ -75,11 +68,7 @@
</v-list-tile>
</template>

<v-list-tile
v-for="subItem in item.items"
:key="subItem.title"
:to="subItem.href"
>
<v-list-tile v-for="subItem in item.items" :key="subItem.title" :to="subItem.href">
<v-list-tile-content>
<v-list-tile-title>{{ subItem.title }}</v-list-tile-title>
</v-list-tile-content>
Expand Down Expand Up @@ -114,34 +103,41 @@ export default {
drawerRight: false,
items2: [
{
icon: "bar_chart",
title: "Dygraphs",
icon: 'bar_chart',
title: 'Dygraphs',
items: [
{
title: "Dynamic Updates",
href: "/dygraphsdynamic"
title: 'Dynamic Updates',
href: '/dygraphsdynamic'
},
{
title: "TODO",
href: "/dashsix"
title: 'TODO',
href: '/dashsix'
}
]
}
],
items: [
{
icon: "bar_chart",
iconClass: "teal lighten-2 white--text",
title: "Dashblocks",
subtitle: "Dashboard Showcase",
href: "/"
icon: 'bar_chart',
iconClass: 'teal lighten-2 white--text',
title: 'Dashblocks',
subtitle: 'Dashboard Showcase',
href: '/'
},
{
icon: 'bubble_chart',
iconClass: 'teal lighten-2 white--text',
title: 'Sample Dashboard',
subtitle: 'my first dashboard',
href: '/sample'
},
{
icon: "bubble_chart",
iconClass: "teal lighten-2 white--text",
title: "Chart.JS",
subtitle: "showcase",
href: "/chartjs"
icon: 'bubble_chart',
iconClass: 'teal lighten-2 white--text',
title: 'Chart.JS',
subtitle: 'showcase',
href: '/chartjs'
}
]
};
Expand All @@ -155,7 +151,7 @@ export default {
return this.$store.state.switchDark;
},
set(value) {
this.$store.commit("setSwitchDark", value);
this.$store.commit('setSwitchDark', value);
}
}
},
Expand All @@ -166,15 +162,15 @@ export default {
</script>

<style lang="scss">
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600");
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600');
body,
html {
margin: 0;
padding: 0;
}
body {
font-family: "Source Sans Pro", sans-serif;
font-family: 'Source Sans Pro', sans-serif;
}
/*
.theme--dark.v-navigation-drawer {
Expand Down
18 changes: 12 additions & 6 deletions src/router.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import Vue from "vue";
import Router from "vue-router";
import Vue from 'vue';
import Router from 'vue-router';
//import DygraphsDynamic from "./views/DygraphsDynamic";
//import ChartJsShowcase from "./views/ChartJsShowcase";
import DashblocksShowcase from "./views/DashblocksShowcase";
import DashblocksShowcase from './views/DashblocksShowcase';
import SampleDashboard from './views/SampleDashboard';

Vue.use(Router);

export default new Router({
base: "/dashblocks-template/",
base: '/dashblocks-template/',
routes: [
{
path: "/",
name: "Dashblocks Dashboard",
path: '/',
name: 'Dashblocks Dashboard',
component: DashblocksShowcase
},
{
path: '/sample',
name: 'Sample Dashboard',
component: SampleDashboard
}
/*
{
Expand Down
134 changes: 134 additions & 0 deletions src/views/SampleDashboard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<template>
<div>
<db-dashboard v-if="ready" :dbspec="dbspec" :dbdata="dbdata" :dark="isDark"> </db-dashboard>
</div>
</template>

<script>
import { DbData, DbDashboard } from 'dashblocks';
export default {
name: 'SampleDashboard',
components: {
DbDashboard
},
data() {
return {
dbdata: new DbData(),
// Declare Dashboard Layout. Add widgets to your dashboard, specifying how many columns and rows
// each widget takes. Dashblocks provides 16-columns CSS Grid layout.
// Pass additional options to widgets to adjust appearance as needed.
dbspec: {
layout: {
type: 'grid'
},
widgets: [
{
id: 'w1',
type: 'DbDygraphsBar',
cspan: 16,
height: 250,
properties: {
options: {
stackedGraph: true,
title: 'Traffic over time',
ylabel: 'Requests, Mil.',
labels: ['Date', 'Success', 'Error'],
legend: 'always'
}
}
},
{
id: 'w2',
type: 'DbChartjsPie',
cspan: 4,
height: 250
},
{
id: 'w3',
type: 'DbChartjsPie',
cspan: 4,
properties: {
options: {
legend: {
position: 'right'
}
}
}
},
{
id: 'w4',
type: 'DbChartjsBar',
cspan: 4
},
{
id: 'w5',
type: 'DbChartjsBar',
cspan: 4
}
]
},
ready: false
};
},
mounted() {
this.initialize();
this.ready = true;
},
methods: {
initialize: function() {
// Initialize dashboard data - set data for each dashboard widget
// This is obviously a sample that generates random data
// In real dashboards you would get data from database, backend APIs, vuex, etc
let dthData = [];
let sTS = Date.now() - 100 * 3600 * 1000;
for (let i = 0; i < 100; i++) {
dthData.push([new Date(sTS + i * 3600 * 1000), Math.random(), Math.random()]);
}
this.dbdata.setWData('w1', {
data: dthData
});
let dataOneSeries = {
labels: ['January', 'February', 'March', 'April'],
datasets: [
{
label: 'Data One',
data: [10, 20, 30, 100]
}
]
};
let dataTwoSeries = {
labels: ['January', 'February', 'March', 'April'],
datasets: [
{
label: 'Data One',
data: [10, 20, 30, 100]
},
{
label: 'Data Two',
data: [50, 10, 70, 11]
}
]
};
this.dbdata.setWData('w2', {
data: JSON.parse(JSON.stringify(dataOneSeries))
});
this.dbdata.setWData('w3', {
data: JSON.parse(JSON.stringify(dataOneSeries))
});
this.dbdata.setWData('w4', {
data: JSON.parse(JSON.stringify(dataOneSeries))
});
this.dbdata.setWData('w5', {
data: JSON.parse(JSON.stringify(dataTwoSeries))
});
}
}
};
</script>

0 comments on commit d811a1b

Please sign in to comment.