data()

in shadingsphere-benchmark-ui/src/utils/mixin.js [21:164]


  data() {
    return {
      modal: false,
      rules: '',
      titleRule: '',
      legend: {},
      series: {},
      desc: {},
      xAxis: {},
      loading: false,
      columns: [
        {
          title: 'MySQL Verison',
          align: 'center',
          key: 'mysqlVerison'
        },
        {
          title: 'Table Description',
          key: 'tableDescription',
          render: (h, params) => {
            if (params.row.tableDescription === 'None') return h('div', '-')
            const rows = params.row.tableDescription.split('\n')
            const html = []
            for (const v of rows) {
              html.push(h('div', v))
            }
            return h('div', html)
          }
        },
        {
          title: 'Encrypt Rule',
          align: 'center',
          key: 'encryptRule',
          render: (h, params) => {
            if (params.row.encryptRule === 'None') return h('div', '-')
            const rows = params.row.encryptRule.split('↵')
            let html = ``
            for (const v of rows) {
              html += v + '\n'
            }
            // const _html = `${JSON.stringify(yaml.safeLoad(html), null, '\t')}`
            return h('div', [
              h(
                'Button',
                {
                  props: {
                    type: 'primary',
                    size: 'small'
                  },
                  on: {
                    click: () => {
                      this.modal = true
                      this.rules = html
                      this.titleRule = 'Encrypt Rule'
                    }
                  }
                },
                'view rules'
              )
            ])
          }
        },
        {
          title: 'Master-slave Rule',
          align: 'center',
          key: 'masterSlaveRule',
          render: (h, params) => {
            if (params.row.masterSlaveRule === 'None') return h('div', '-')
            const rows = params.row.masterSlaveRule.split('↵')
            let html = ``
            for (const v of rows) {
              html += v + '\n'
            }
            // const _html = `${JSON.stringify(yaml.safeLoad(html), null, '\t')}`
            return h('div', [
              h(
                'Button',
                {
                  props: {
                    type: 'primary',
                    size: 'small'
                  },
                  on: {
                    click: () => {
                      this.modal = true
                      this.rules = html
                      this.titleRule = 'Master-slave Rule'
                    }
                  }
                },
                'view rules'
              )
            ])
          }
        },
        {
          title: 'Sharding Rule',
          align: 'center',
          key: 'shardingRule',
          render: (h, params) => {
            if (params.row.shardingRule === 'None') return h('div', '-')
            const rows = params.row.shardingRule.split('↵')
            let html = ``
            for (const v of rows) {
              html += v + '\n'
            }
            // const _html = `${JSON.stringify(yaml.safeLoad(html), null, '\t')}`
            return h('div', [
              h(
                'Button',
                {
                  props: {
                    type: 'primary',
                    size: 'small'
                  },
                  on: {
                    click: () => {
                      this.modal = true
                      this.rules = html
                      this.titleRule = 'Sharding Rule'
                    }
                  }
                },
                'view rules'
              )
            ])
          }
        },
        {
          title: 'SQL Example',
          key: 'sqlExample',
          render: (h, params) => {
            if (params.row.sqlExample === 'None') return h('div', '-')
            const rows = params.row.sqlExample.split('\n')
            const html = []
            for (const v of rows) {
              html.push(h('div', v))
            }
            return h('div', html)
          }
        }
      ]
    }
  },