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