Sfoglia il codice sorgente

HUE-9485 [frontend] Fix bugs in the Paginator and HueLink components

Johan Ahlen 5 anni fa
parent
commit
9cd9291d3d

+ 1 - 1
desktop/core/src/desktop/js/components/HueLink.vue

@@ -17,7 +17,7 @@
 -->
 
 <template>
-  <a href="javsscript:void(0);" @click="clicked"><slot /></a>
+  <a href="javascript:void(0);" @click="clicked"><slot /></a>
 </template>
 
 <script lang="ts">

+ 12 - 4
desktop/core/src/desktop/js/components/Paginator.vue

@@ -23,9 +23,13 @@
     </div>
     Rows per page:
     <dropdown :inline="true" :text="limit">
-      <dropdown-item-button @click="setLimit(25)">25</dropdown-item-button>
-      <dropdown-item-button @click="setLimit(50)">50</dropdown-item-button>
-      <dropdown-item-button @click="setLimit(100)">100</dropdown-item-button>
+      <dropdown-item-button
+        v-for="presetLimit of presetLimits"
+        :key="presetLimit"
+        @click="setLimit(presetLimit)"
+      >
+        {{ presetLimit }}
+      </dropdown-item-button>
     </dropdown>
     <div class="navigation-actions">
       <a href="javascript: void(0);" @click="gotoFirstPage">|&lt;</a>
@@ -43,6 +47,9 @@
   import Component from 'vue-class-component';
   import { Prop, Watch } from 'vue-property-decorator';
 
+  const DEFAULT_LIMIT = 25;
+  const PRESET_LIMITS = [DEFAULT_LIMIT, 50, 100];
+
   @Component({
     components: { Dropdown, DropdownItemButton }
   })
@@ -51,7 +58,8 @@
     totalEntries!: number;
 
     currentPage = 1;
-    limit = 25;
+    limit = DEFAULT_LIMIT;
+    presetLimits = PRESET_LIMITS;
 
     mounted(): void {
       this.notifyPageChanged();

+ 3 - 3
desktop/core/src/desktop/js/components/__snapshots__/HueLink.test.ts.snap

@@ -2,19 +2,19 @@
 
 exports[`HueLink.vue should not pass href attribute to the a element 1`] = `
 <a
-  href="javsscript:void(0);"
+  href="javascript:void(0);"
 />
 `;
 
 exports[`HueLink.vue should pass attributes to the a element 1`] = `
 <a
-  href="javsscript:void(0);"
+  href="javascript:void(0);"
   target="_blank"
 />
 `;
 
 exports[`HueLink.vue should render a Link 1`] = `
 <a
-  href="javsscript:void(0);"
+  href="javascript:void(0);"
 />
 `;

+ 6 - 2
desktop/core/src/desktop/js/components/__snapshots__/Paginator.test.ts.snap

@@ -19,15 +19,19 @@ exports[`Paginator.vue should render 1`] = `
     text="25"
   >
     <dropdown-item-button-stub>
+      
       25
+    
     </dropdown-item-button-stub>
-     
     <dropdown-item-button-stub>
+      
       50
+    
     </dropdown-item-button-stub>
-     
     <dropdown-item-button-stub>
+      
       100
+    
     </dropdown-item-button-stub>
   </dropdown-stub>