Default order and custom icons for status
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
index 0e28a19..dfbb700 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
@@ -22,7 +22,10 @@
* columns: [
* {
* label: 'Human readable name',
- * prop: 'Property to read in the model object'
+ * prop: 'Property to read in the model object',
+ * type: 'boolean'| 'array'| 'object'| 'custom'| 'date' | 'icon' // see examples for more details
+ formatter: fn(), // receive the whole item if tipe is custom and return a string
+ link: fn() // receive the whole item and return an url
* }
* ],
* classes: 'table table-striped table-bordered',
@@ -37,7 +40,7 @@
}
],
filter: 'field', // can be by `field` or `fulltext`
- order: true // whether to show ordering arrows
+ order: true | {field: 'property name', reverse: true | false} // whether to show ordering arrows, or a configuration for a default ordering
* }
* ```
* @param {Array} data The data that should be rendered
@@ -223,6 +226,16 @@
label: 'Details',
prop: 'details',
type: 'object'
+ },
+ {
+ label: 'Created',
+ prop: 'created',
+ type: 'date'
+ },
+ {
+ label: 'Icon',
+ type: 'icon',
+ formatter: item => item.icon //note that this refer to [Bootstrap Glyphicon](http://getbootstrap.com/components/#glyphicons)
}
]
};
@@ -235,7 +248,9 @@
details: {
c_tag: '243',
s_tag: '444'
- }
+ },
+ created: new Date('December 17, 1995 03:24:00'),
+ icon: 'music'
},
{
name: 'Gili',
@@ -244,7 +259,9 @@
details: {
c_tag: '675',
s_tag: '893'
- }
+ },
+ created: new Date(),
+ icon: 'camera'
}
]
});
diff --git a/views/ngXosViews/serviceGrid/env/default.js b/views/ngXosViews/serviceGrid/env/default.js
index 3d60258..07017a6 100644
--- a/views/ngXosViews/serviceGrid/env/default.js
+++ b/views/ngXosViews/serviceGrid/env/default.js
@@ -8,6 +8,6 @@
module.exports = {
host: 'http://xos.dev:9999/',
- xoscsrftoken: 'comXS9APlpktu9OcQqcNgpqQQ5tx68L1',
- xossessionid: '9cw4yv28j4wqcbewdxh3rucamev8tg9q'
+ xoscsrftoken: '528Q93KwEJn88ET6TZipc1gsc7qjhaTz',
+ xossessionid: '8ij3xax15jxwr3abkwohkczwrfivfbzk'
};
diff --git a/views/ngXosViews/serviceGrid/src/js/main.js b/views/ngXosViews/serviceGrid/src/js/main.js
index c52ef9f..88a0f95 100644
--- a/views/ngXosViews/serviceGrid/src/js/main.js
+++ b/views/ngXosViews/serviceGrid/src/js/main.js
@@ -34,7 +34,18 @@
{
label: 'Status',
prop: 'status',
- type: 'boolean',
+ type: 'icon',
+ formatter: item => {
+ let status = parseInt(item.backend_status.match(/^[0-9]/)[0]);
+ switch(status){
+ case 0:
+ return 'time';
+ case 1:
+ return 'ok';
+ case 2:
+ return 'remove';
+ }
+ }
},
{
label: 'Name',
@@ -52,7 +63,9 @@
}
],
filter: 'field',
- order: true
+ order: {
+ field: 'name'
+ }
};
// retrieving user list