[CORD-1651] Add action to xosTable to navigate to the detail page
Change-Id: Id948d83bcc039287fa7841908214b2d856844af8
(cherry picked from commit 2c61b883912f73875b819961fb54d946f42ba529)
diff --git a/src/app/core/services/helpers/config.helpers.spec.ts b/src/app/core/services/helpers/config.helpers.spec.ts
index 5b2ae07..4245b81 100644
--- a/src/app/core/services/helpers/config.helpers.spec.ts
+++ b/src/app/core/services/helpers/config.helpers.spec.ts
@@ -191,7 +191,9 @@
expect(cfg.columns).toBeDefined();
expect(cfg.filter).toBe('fulltext');
expect(cfg.order).toEqual({field: 'id', reverse: false});
- expect(cfg.actions.length).toBe(1);
+ expect(cfg.actions.length).toBe(2);
+ expect(cfg.actions[0].label).toEqual('details');
+ expect(cfg.actions[1].label).toEqual('delete');
});
});
diff --git a/src/app/core/services/helpers/config.helpers.ts b/src/app/core/services/helpers/config.helpers.ts
index 5dbd74e..85039fe 100644
--- a/src/app/core/services/helpers/config.helpers.ts
+++ b/src/app/core/services/helpers/config.helpers.ts
@@ -121,6 +121,13 @@
},
actions: [
{
+ label: 'details',
+ icon: 'search',
+ cb: (item) => {
+ this.$state.go(this.$state.current.name, {id: item.id});
+ }
+ },
+ {
label: 'delete',
icon: 'remove',
color: 'red',
diff --git a/src/app/core/table/table.html b/src/app/core/table/table.html
index 8583fd9..2d52feb 100644
--- a/src/app/core/table/table.html
+++ b/src/app/core/table/table.html
@@ -84,7 +84,7 @@
</div>
</div>
</td>
- <td ng-if="vm.config.actions">
+ <td class="xos-table-actions" ng-if="vm.config.actions">
<a href=""
ng-repeat="action in vm.config.actions"
ng-click="action.cb(item)"
diff --git a/src/app/core/table/table.scss b/src/app/core/table/table.scss
index 9922026..2d50db0 100644
--- a/src/app/core/table/table.scss
+++ b/src/app/core/table/table.scss
@@ -33,4 +33,10 @@
z-index: 2;
}
+ td.xos-table-actions {
+ a + a {
+ margin-left: $padding-base-horizontal;
+ }
+ }
+
}
\ No newline at end of file