/vueboot

Spring boot with Vuejs web site

Primary LanguageJavaScript

VueBoot

A Spring Boot with Vue.js site project

Plugins

Links

Code

Table (server side)

<div id="loggers">
  <v-server-table url="http://localhost:8080/loggers" :columns="columns" :options="options">
    <template slot="update" slot-scope="props">
      <div>
        <span class="badge badge-danger">Error</span>
      </div>
    </template>
  </v-server-table>
</div>
data () {
  return {
    columns: ['name', 'configuredLevel', 'effectiveLevel', 'update'],
    options: {
      sortable: ['name', 'configuredLevel', 'effectiveLevel'],
      columnsClasses: {
        name: 'logger-column-name',
        configuredLevel: 'logger-column-level-conf',
        effectiveLevel: 'logger-column-level-eff'
      },
      texts: {
        count: '{from} à {to} sur {count} résultats|{count} résultats|Un résultat',
        filter: 'Filtrer:',
        filterPlaceholder: 'Rechercher...',
        limit: 'Résultats :',
        page: 'Page :',
        noResults: 'Aucune',
        filterBy: 'Filter by {column}',
        loading: 'Loading...',
        defaultOption: 'Select {column}'
      },
      headings: {
        name: 'Logger Name',
        configuredLevel: 'Configured Level',
        effectiveLevel: 'Effective Level'
      },
      requestFunction: function (data) {
        return this.$api.loggers().then((response) => {
          return Object.assign({params: data}, response)
        })
      },
      responseAdapter: function (response) {
        console.log(response)
        let ar = Object.keys(response.data.loggers).map(function (key) {
          return Object.assign({name: key}, response.data.loggers[key])
        })
        return {
          data: ar.slice(response.params.limit * (response.params.page - 1), response.params.limit * response.params.page),
          count: ar.length
        }
      },
      perPage: 8,
      perPageValues: [8, 17, 50, 100, 200, 400],
      sortIcon: {
        base: 'fa', up: 'fa-caret-up', down: 'fa-caret-down', is: 'fa-sort'
      }
    }
  }
  }