Milimetric has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/196230

Change subject: [WIP] Add tabular layout with generic router
......................................................................

[WIP] Add tabular layout with generic router

Parking this change in gerrit as it's no longer relevant, moving onto a
specific layout just for the VE dashboard.

Change-Id: I51675c2fcacd2fcbcf869f71cb2ad8eaefa98f53
---
M .gitignore
A src/components/graph-browser/graph-browser.html
A src/components/graph-browser/graph-browser.js
A src/components/graph-processor/graph-processor.html
A src/components/graph-processor/graph-processor.js
A src/components/tab-browser/tab-browser.html
A src/components/tab-browser/tab-browser.js
A src/components/tabular-layout/tabular-layout.html
A src/components/tabular-layout/tabular-layout.js
A src/lib/router.js
A src/tabular.html
11 files changed, 98 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/dashiki 
refs/changes/30/196230/1

diff --git a/.gitignore b/.gitignore
index 0eb9f17..fc8a4c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 .DS_Store
 node_modules/
 bower_modules/
+bower_packages
 
 # personal dev stuff
 .jslintrc
diff --git a/src/components/graph-browser/graph-browser.html 
b/src/components/graph-browser/graph-browser.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/components/graph-browser/graph-browser.html
diff --git a/src/components/graph-browser/graph-browser.js 
b/src/components/graph-browser/graph-browser.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/components/graph-browser/graph-browser.js
diff --git a/src/components/graph-processor/graph-processor.html 
b/src/components/graph-processor/graph-processor.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/components/graph-processor/graph-processor.html
diff --git a/src/components/graph-processor/graph-processor.js 
b/src/components/graph-processor/graph-processor.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/components/graph-processor/graph-processor.js
diff --git a/src/components/tab-browser/tab-browser.html 
b/src/components/tab-browser/tab-browser.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/components/tab-browser/tab-browser.html
diff --git a/src/components/tab-browser/tab-browser.js 
b/src/components/tab-browser/tab-browser.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/components/tab-browser/tab-browser.js
diff --git a/src/components/tabular-layout/tabular-layout.html 
b/src/components/tabular-layout/tabular-layout.html
new file mode 100644
index 0000000..434db41
--- /dev/null
+++ b/src/components/tabular-layout/tabular-layout.html
@@ -0,0 +1,9 @@
+<section>
+    <section class="page column projects">
+        <tab-browser params="tabs: tabs, graphs: graphs" class="ui segment 
metric"/>
+    </section>
+    <section class="page column main">
+        <graph-browser params="graphs: graphs, graph: graph"/>
+        <graph-processor params="graph: graph" class="ui segment graph"/>
+    </section>
+</section>
diff --git a/src/components/tabular-layout/tabular-layout.js 
b/src/components/tabular-layout/tabular-layout.js
new file mode 100644
index 0000000..b139c0e
--- /dev/null
+++ b/src/components/tabular-layout/tabular-layout.js
@@ -0,0 +1,17 @@
+define(function (require) {
+    'use strict';
+
+    var ko = require('knockout'),
+        templateMarkup = require('text!./tabular-layout.html'),
+        stateManager = require('stateManager');
+
+    function TabularLayout() {
+        stateManager.getManager(this.selectedProjects, this.selectedMetric,
+            this.defaultProjects, this.defaultMetrics);
+    }
+
+    return {
+        viewModel: TabularLayout,
+        template: templateMarkup
+    };
+});
diff --git a/src/lib/router.js b/src/lib/router.js
new file mode 100644
index 0000000..2c26146
--- /dev/null
+++ b/src/lib/router.js
@@ -0,0 +1,42 @@
+/**
+ * State urls are of the generic form:
+ *
+ * http: //dashiki.com/something#list-param=val1,val2/single-param=val1
+ *
+ * where one or more list-param and single-param are configured
+ * when initializing the router
+ **/
+define(function (require) {
+    'use strict';
+
+    var URI = require('uri/URI');
+
+    function Router (parameterDict) {
+        this.parameterDict = parameterDict;
+
+        this.state = ko.computed(function () {
+            var fragment = Object.getOwnPropertyNames(this.parameterDict).map(
+                function (key) {
+                    return key +'='+ ko.unwrap(this.parameterDict[key]).join();
+                }
+            ).join('/');
+
+            this.publish(fragment);
+            return fragment;
+        }, this);
+    }
+
+    /**
+     * Publishes a fragment to the url
+     * @param State object
+     **/
+    Router.prototype.publish = function (fragment) {
+        var uri = new URI().normalizeHash();
+        //reset fragment
+        uri.fragment(fragment);
+        // careful, only reseting '#' to avoid reloads
+        window.location.assign(uri.toString());
+    };
+
+    return Router;
+});
diff --git a/src/tabular.html b/src/tabular.html
new file mode 100644
index 0000000..b2d5da4
--- /dev/null
+++ b/src/tabular.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <meta name="viewport" content="initial-scale=1, maximum-scale=1">
+        <title>Dashiki</title>
+        <!-- build:css -->
+            <link href="css/000_grid.min.css" rel="stylesheet">
+            <link href="css/010_menu.min.css" rel="stylesheet">
+            <link href="css/020_dropdown.min.css" rel="stylesheet">
+            <link href="css/030_label.min.css" rel="stylesheet">
+            <link href="css/040_icon.min.css" rel="stylesheet">
+            <link href="css/050_input.min.css" rel="stylesheet">
+            <link href="css/060_segment.min.css" rel="stylesheet">
+            <link href="css/061_popup.min.css" rel="stylesheet">
+
+            <link href="css/070_styles.css" rel="stylesheet">
+            <link href="css/080_responsive.css" rel="stylesheet">
+        <!-- endbuild -->
+        <!-- build:js -->
+            <script src="app/require.config.js"></script>
+            <script data-main="app/startup" 
src="bower_modules/requirejs/require.js"></script>
+        <!-- endbuild -->
+    </head>
+    <body>
+        <tabular-layout/>
+    </body>
+</html>

-- 
To view, visit https://gerrit.wikimedia.org/r/196230
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I51675c2fcacd2fcbcf869f71cb2ad8eaefa98f53
Gerrit-PatchSet: 1
Gerrit-Project: analytics/dashiki
Gerrit-Branch: master
Gerrit-Owner: Milimetric <dandree...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to