Subscriber Portal working with Mock data
diff --git a/views/ngXosViews/subscriberPortal/bs-config.js b/views/ngXosViews/subscriberPortal/bs-config.js
index 3418583..507b8d3 100644
--- a/views/ngXosViews/subscriberPortal/bs-config.js
+++ b/views/ngXosViews/subscriberPortal/bs-config.js
@@ -40,12 +40,16 @@
],
"server": {
baseDir: './src',
+ routes: {
+ '/rs/dashboard': './mocks/dashboard.json',
+ '/rs/bundle': './mocks/bundle.json',
+ '/rs/users': './mocks/users.json'
+ },
middleware: function(req, res, next){
if(
req.url.indexOf('/xos/') !== -1 ||
req.url.indexOf('/xoslib/') !== -1 ||
- req.url.indexOf('/hpcapi/') !== -1 ||
- req.url.indexOf('/rs/') !== -1
+ req.url.indexOf('/hpcapi/') !== -1
){
if(conf.xoscsrftoken && conf.xossessionid){
req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
diff --git a/views/ngXosViews/subscriberPortal/mocks/bundle.json b/views/ngXosViews/subscriberPortal/mocks/bundle.json
new file mode 100644
index 0000000..035f23f
--- /dev/null
+++ b/views/ngXosViews/subscriberPortal/mocks/bundle.json
@@ -0,0 +1,33 @@
+{
+ "bundle": {
+ "id": "family",
+ "name": "Family Bundle",
+ "functions": [
+ {
+ "id": "internet",
+ "name": "Internet",
+ "desc": "Basic internet connectivity.",
+ "params": {}
+ },
+ {
+ "id": "firewall",
+ "name": "Firewall",
+ "desc": "Normal firewall protection.",
+ "params": {}
+ },
+ {
+ "id": "url_filter",
+ "name": "Parental Control",
+ "desc": "Variable levels of URL filtering.",
+ "params": {
+ "level": "PG",
+ "levels": [ "PG", "PG-13", "R" ]
+ }
+ }
+ ]
+ },
+ "bundles": [
+ { "id": "basic", "name": "Basic Bundle" },
+ { "id": "family", "name": "Family Bundle" }
+ ]
+}
diff --git a/views/ngXosViews/subscriberPortal/mocks/dashboard.json b/views/ngXosViews/subscriberPortal/mocks/dashboard.json
new file mode 100644
index 0000000..696b74b
--- /dev/null
+++ b/views/ngXosViews/subscriberPortal/mocks/dashboard.json
@@ -0,0 +1,10 @@
+{
+ "bundle_name": "Family Bundle",
+ "bundle_desc": "This is the bundle description. Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
+ "users": [
+ { "id": 1, "name": "Mom's MacBook", "icon_id": "mom", "mac": "00:11:22:33:44:55" },
+ { "id": 1, "name": "Dad's iPad", "icon_id": "dad", "mac": "00:11:22:33:44:66" },
+ { "id": 1, "name": "Dick's laptop", "icon_id": "boy2", "mac": "00:11:22:33:44:77" },
+ { "id": 1, "name": "Jane's laptop", "icon_id": "girl1", "mac": "00:11:22:33:44:88" }
+ ]
+}
diff --git a/views/ngXosViews/subscriberPortal/mocks/users.json b/views/ngXosViews/subscriberPortal/mocks/users.json
new file mode 100644
index 0000000..3b9ed10
--- /dev/null
+++ b/views/ngXosViews/subscriberPortal/mocks/users.json
@@ -0,0 +1,48 @@
+{
+ "users": [
+ {
+ "id": 1,
+ "name": "Mom's MacBook",
+ "mac": "010203040506",
+ "icon_id": "mom",
+ "profile": {
+ "url_filter": {
+ "level": "R"
+ }
+ }
+ },
+ {
+ "id": 2,
+ "name": "Dad's iPad",
+ "mac": "010203040507",
+ "icon_id": "dad",
+ "profile": {
+ "url_filter": {
+ "level": "R"
+ }
+ }
+ },
+ {
+ "id": 3,
+ "name": "Dick's laptop",
+ "mac": "010203040508",
+ "icon_id": "boy2",
+ "profile": {
+ "url_filter": {
+ "level": "PG_13"
+ }
+ }
+ },
+ {
+ "id": 4,
+ "name": "Jane's laptop",
+ "mac": "010203040509",
+ "icon_id": "girl1",
+ "profile": {
+ "url_filter": {
+ "level": "PG"
+ }
+ }
+ }
+ ]
+}
diff --git a/views/ngXosViews/subscriberPortal/src/app/view/bundle/bundle.js b/views/ngXosViews/subscriberPortal/src/app/view/bundle/bundle.js
index a5b59d0..60dea84 100644
--- a/views/ngXosViews/subscriberPortal/src/app/view/bundle/bundle.js
+++ b/views/ngXosViews/subscriberPortal/src/app/view/bundle/bundle.js
@@ -46,6 +46,7 @@
availId = (current === basic) ? family : basic;
resource.bundles.forEach(function (bundle) {
if (bundle.id === availId) {
+ // NOTE available should be an array
$scope.available = bundle;
}
});
diff --git a/views/ngXosViews/subscriberPortal/src/app/view/common/common.css b/views/ngXosViews/subscriberPortal/src/app/view/common/common.css
index c2bc96d..5ae154b 100644
--- a/views/ngXosViews/subscriberPortal/src/app/view/common/common.css
+++ b/views/ngXosViews/subscriberPortal/src/app/view/common/common.css
@@ -20,6 +20,7 @@
html, body, div#frame, div#view {
height: 100%;
+ overflow: scroll;
}
head, body, footer,
diff --git a/views/ngXosViews/subscriberPortal/src/app/view/home/home.html b/views/ngXosViews/subscriberPortal/src/app/view/home/home.html
index 27f0d96..a3d7fb2 100644
--- a/views/ngXosViews/subscriberPortal/src/app/view/home/home.html
+++ b/views/ngXosViews/subscriberPortal/src/app/view/home/home.html
@@ -26,6 +26,8 @@
</thead>
<tbody>
+ <!--<pre>{{users | json}}</pre>-->
+
<tr ng-repeat="user in users" class="fadein">
<td class="user-pic">
<img ng-src="{{'/imgs/' + user.icon_id + '.jpg'}}">
@@ -37,4 +39,4 @@
</table>
</div>
</div>
-</div>
+</div>
\ No newline at end of file
diff --git a/views/ngXosViews/subscriberPortal/src/app/view/user/user.js b/views/ngXosViews/subscriberPortal/src/app/view/user/user.js
index bb44fec..971838c 100644
--- a/views/ngXosViews/subscriberPortal/src/app/view/user/user.js
+++ b/views/ngXosViews/subscriberPortal/src/app/view/user/user.js
@@ -22,9 +22,15 @@
family = 'family',
url_filter = 'url_filter';
+ function randomDate(start, end) {
+ return new Date(
+ start.getTime() + Math.random() * (end.getTime() - start.getTime())
+ );
+ }
+
angular.module('cordUser', [])
- .controller('CordUserCtrl', ['$log', '$scope', '$resource', '$timeout',
- function ($log, $scope, $resource, $timeout) {
+ .controller('CordUserCtrl', ['$log', '$scope', '$resource', '$timeout', '$filter',
+ function ($log, $scope, $resource, $timeout, $filter) {
var BundleData, bundleResource;
$scope.page.curr = 'user';
$scope.isFamily = false;
@@ -63,6 +69,15 @@
// success
function () {
$scope.users = userResource.users;
+ if ($.isEmptyObject($scope.shared.userActivity)) {
+ $scope.users.forEach(function (user) {
+ var date = randomDate(new Date(2015, 0, 1),
+ new Date());
+
+ $scope.shared.userActivity[user.id] =
+ $filter('date')(date, 'mediumTime');
+ });
+ }
},
// error
function () {
diff --git a/views/ngXosViews/subscriberPortal/src/cord.js b/views/ngXosViews/subscriberPortal/src/cord.js
index e183466..889341e 100644
--- a/views/ngXosViews/subscriberPortal/src/cord.js
+++ b/views/ngXosViews/subscriberPortal/src/cord.js
@@ -28,25 +28,9 @@
'cordHome',
'cordUser',
'cordBundle'
- ],
- viewIds = [
- ],
- viewDependencies = [],
- dependencies;
+ ];
- function capitalize(word) {
- return word ? word[0].toUpperCase() + word.slice(1) : word;
- }
-
- viewIds.forEach(function (id) {
- if (id) {
- viewDependencies.push('cord' + capitalize(id));
- }
- });
-
- dependencies = modules.concat(viewDependencies);
-
- angular.module('cordGui', dependencies)
+ angular.module('cordGui', modules)
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/login', {