|
| 1 | + |
| 2 | + |
| 3 | +| Property | Type | Value | Description |
| 4 | +| :--------|:-----|:------|:------------ |
| 5 | +| `id`| `string` || ID of the element on the page |
| 6 | +| `type`| `string` | "Scorecard" | |
| 7 | +| `title`| `string` || Title that will appear at the top of the card |
| 8 | +| `size`| `{ w: number, h: number}` || Width/Height of the card. The size of each inner card is 2x2 or 2x3 depending on subheading |
| 9 | +| `dependencies`| `object` || Dependencies that will be requested for this element |
| 10 | +| `props`| `object` || Additional properties to define for this element |
| 11 | +| `actions`| `object` || Defined actions for this element |
| 12 | + |
| 13 | +# Three States |
| 14 | +There are 3 configuraions for this element type |
| 15 | + |
| 16 | +## Single value |
| 17 | + |
| 18 | +To read how to define dependencies [click here](/dependencies). |
| 19 | +Define `dependencies` as follows: |
| 20 | + |
| 21 | +| Property | Description |
| 22 | +| :--------|:------------ |
| 23 | +| `value`| Large value to display |
| 24 | +| `color`| Color to be used |
| 25 | +| `icon`| Icon to display next to the large value |
| 26 | +| `subvalue`| Small value to display |
| 27 | +| `className`| Class name to add to value |
| 28 | + |
| 29 | +Define `properties` as follow: |
| 30 | + |
| 31 | +| Property | Type | Description |
| 32 | +| :--------|:-----|:------------ |
| 33 | +| `subheading`| `string` | Large value to display |
| 34 | +| `onClick`| `string` | Action name [[Read about actions](/actions)] |
| 35 | + |
| 36 | +```js |
| 37 | +{ |
| 38 | + id: "errors", |
| 39 | + type: "Scorecard", |
| 40 | + title: "Errors", |
| 41 | + size: { w: 2, h: 3 }, |
| 42 | + dependencies: { |
| 43 | + value: "errors:handledAtTotal", |
| 44 | + color: "errors:handledAtTotal_color", |
| 45 | + icon: "errors:handledAtTotal_icon", |
| 46 | + subvalue: "errors:handledAtTotal", |
| 47 | + className: "errors:handledAtTotal_class" |
| 48 | + }, |
| 49 | + props: { subheading: "Avg" } |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +## Multiple values |
| 54 | + |
| 55 | +## Dynamic cards |
| 56 | + |
| 57 | +# Actions |
| 58 | +Selected cards will call an action with the card's value. |
| 59 | +A card value has the following properties: |
| 60 | + |
| 61 | +| Property | Description |
| 62 | +| :--------|:------------ |
| 63 | +| `value`| Large value to display |
| 64 | +| `heading`| Large heading under large value |
| 65 | +| `color`| Color to be used |
| 66 | +| `icon`| Icon to display next to the large value |
| 67 | +| `subvalue`| Small value to display |
| 68 | +| `subheading`| Small heading under small value to display |
| 69 | +| `className`| Class name to add to value |
| 70 | + |
| 71 | +These are examples of openning a dialog when clicking on a card: |
| 72 | + |
| 73 | +`One value card`: |
| 74 | + |
| 75 | +```js |
| 76 | +{ |
| 77 | + id: "errors", |
| 78 | + type: "Scorecard", |
| 79 | + title: "Errors", |
| 80 | + size: { w: 2, h: 3 }, |
| 81 | + dependencies: { |
| 82 | + value: "errors:handledAtTotal", |
| 83 | + color: "errors:handledAtTotal_color", |
| 84 | + icon: "errors:handledAtTotal_icon", |
| 85 | + subvalue: "errors:handledAtTotal", |
| 86 | + className: "errors:handledAtTotal_class" |
| 87 | + }, |
| 88 | + props: { |
| 89 | + subheading: "Avg", |
| 90 | + onClick: "onErrorsClick" |
| 91 | + }, |
| 92 | + actions: { |
| 93 | + onErrorsClick: { |
| 94 | + action: "dialog:errors", |
| 95 | + params: { |
| 96 | + title: "args:heading", |
| 97 | + type: "args:type", |
| 98 | + innermostMessage: "args:innermostMessage", |
| 99 | + queryspan: "timespan:queryTimespan" |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +`Dyanmic card click`: |
| 107 | + |
| 108 | +```js |
| 109 | +{ |
| 110 | + id: "scores", |
| 111 | + type: "Scorecard", |
| 112 | + size: { w: 2, h: 3 }, |
| 113 | + dependencies: { |
| 114 | + card_errors_value: "errors:handledAtTotal", |
| 115 | + card_errors_heading: "::Errors", |
| 116 | + card_errors_color: "errors:handledAtTotal_color", |
| 117 | + card_errors_icon: "errors:handledAtTotal_icon", |
| 118 | + card_errors_subvalue: "errors:handledAtTotal", |
| 119 | + card_errors_subheading: "::Avg", |
| 120 | + card_errors_className: "errors:handledAtTotal_class", |
| 121 | + card_errors_onClick: "::onErrorsClick", |
| 122 | + |
| 123 | + card_users_value: "ai:users-value", |
| 124 | + card_users_heading: "::Total Users", |
| 125 | + card_users_icon: "ai:users-icon" |
| 126 | + }, |
| 127 | + actions: { |
| 128 | + onErrorsClick: { |
| 129 | + action: "dialog:errors", |
| 130 | + params: { |
| 131 | + title: "args:heading", |
| 132 | + type: "args:type", |
| 133 | + innermostMessage: "args:innermostMessage", |
| 134 | + queryspan: "timespan:queryTimespan" |
| 135 | + } |
| 136 | + } |
| 137 | + } |
| 138 | +} |
| 139 | +``` |
0 commit comments