github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/stories/components/json-viewer.stories.js (about) 1 import hbs from 'htmlbars-inline-precompile'; 2 3 import DelayedTruth from '../utils/delayed-truth'; 4 5 export default { 6 title: 'Components|JSON Viewer', 7 }; 8 9 export let Standard = () => { 10 return { 11 template: hbs` 12 <h5 class="title is-5">JSON Viewer</h5> 13 {{#if delayedTruth.complete}} 14 <JsonViewer @json={{jsonSmall}} /> 15 {{/if}} 16 `, 17 context: { 18 delayedTruth: DelayedTruth.create(), 19 jsonSmall: { 20 delayedData: {}, 21 data: { 22 foo: 'bar', 23 number: 123456789, 24 products: ['Consul', 'Nomad', 'Packer', 'Terraform', 'Vagrant', 'Vault'], 25 currentTime: '2019-10-16T14:24:12.378Z', 26 nested: { 27 obj: 'ject', 28 }, 29 nonexistent: null, 30 isTrue: false, 31 }, 32 }, 33 }, 34 }; 35 }; 36 37 export let FullDocument = () => { 38 return { 39 template: hbs` 40 <h5 class="title is-5">JSON Viewer for full document</h5> 41 {{#if delayedTruth.complete}} 42 <JsonViewer @json={{jsonLarge}} /> 43 {{/if}} 44 `, 45 context: { 46 delayedTruth: DelayedTruth.create(), 47 jsonLarge: { 48 delayedData: {}, 49 data: { 50 Stop: false, 51 Region: 'global', 52 Namespace: 'default', 53 ID: 'syslog', 54 ParentID: '', 55 Name: 'syslog', 56 Type: 'system', 57 Priority: 50, 58 AllAtOnce: false, 59 Datacenters: ['dc1', 'dc2'], 60 letraints: null, 61 TaskGroups: [ 62 { 63 Name: 'syslog', 64 Count: 1, 65 Update: { 66 Stagger: 10000000000, 67 MaxParallel: 1, 68 HealthCheck: 'checks', 69 MinHealthyTime: 10000000000, 70 HealthyDeadline: 300000000000, 71 ProgressDeadline: 600000000000, 72 AutoRevert: false, 73 Canary: 0, 74 }, 75 Migrate: null, 76 letraints: [ 77 { 78 LTarget: '', 79 RTarget: '', 80 Operand: 'distinct_hosts', 81 }, 82 ], 83 RestartPolicy: { 84 Attempts: 10, 85 Interval: 300000000000, 86 Delay: 25000000000, 87 Mode: 'delay', 88 }, 89 Tasks: [ 90 { 91 Name: 'syslog', 92 Driver: 'docker', 93 User: '', 94 Config: { 95 port_map: [ 96 { 97 tcp: 601, 98 udp: 514, 99 }, 100 ], 101 image: 'balabit/syslog-ng:latest', 102 }, 103 Env: null, 104 Services: null, 105 Vault: null, 106 Templates: null, 107 letraints: null, 108 Resources: { 109 CPU: 500, 110 MemoryMB: 256, 111 DiskMB: 0, 112 IOPS: 0, 113 Networks: [ 114 { 115 Device: '', 116 CIDR: '', 117 IP: '', 118 MBits: 10, 119 ReservedPorts: [ 120 { 121 Label: 'udp', 122 Value: 514, 123 }, 124 { 125 Label: 'tcp', 126 Value: 601, 127 }, 128 ], 129 DynamicPorts: null, 130 }, 131 ], 132 }, 133 DispatchPayload: null, 134 Meta: null, 135 KillTimeout: 5000000000, 136 LogConfig: { 137 MaxFiles: 10, 138 MaxFileSizeMB: 10, 139 }, 140 Artifacts: null, 141 Leader: false, 142 ShutdownDelay: 0, 143 KillSignal: '', 144 }, 145 ], 146 EphemeralDisk: { 147 Sticky: false, 148 SizeMB: 300, 149 Migrate: false, 150 }, 151 Meta: null, 152 ReschedulePolicy: null, 153 }, 154 ], 155 Update: { 156 Stagger: 10000000000, 157 MaxParallel: 1, 158 HealthCheck: '', 159 MinHealthyTime: 0, 160 HealthyDeadline: 0, 161 ProgressDeadline: 0, 162 AutoRevert: false, 163 Canary: 0, 164 }, 165 Periodic: null, 166 ParameterizedJob: null, 167 Dispatched: false, 168 Payload: null, 169 Meta: null, 170 VaultToken: '', 171 Status: 'running', 172 StatusDescription: '', 173 Stable: false, 174 Version: 0, 175 SubmitTime: 1530052201331477800, 176 CreateIndex: 27, 177 ModifyIndex: 27, 178 JobModifyIndex: 27, 179 }, 180 }, 181 }, 182 }; 183 };