Skip to content

Commit

Permalink
fix: move current columns after table stats
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Aug 27, 2020
1 parent e39d868 commit 3409e77
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 33 deletions.
8 changes: 4 additions & 4 deletions components/Stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default {
}
val = Math.round(sum / this.filteredItems.length);
validateClass = this.getColumnValidateClass(val, field.validate);
valueText = val + " (average)";
valueText = val + " (average)"; // tolang
}
// enum
Expand Down Expand Up @@ -205,11 +205,11 @@ export default {
// console.log('dupls: ', dupls);
val = dupls.length;
validateClass = dupls.length > 0 ? "warning" : "success";
validateClass = dupls.length > 0 ? "warning" : "success"; // tolang
if (dupls.length > 0) {
valueText = `${dupls.length} non-unique values`;
valueText = `${dupls.length} non-unique values`; // tolang
} else {
valueText = `all unique`;
valueText = `all unique`; // tolang
}
}
Expand Down
25 changes: 4 additions & 21 deletions components/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@

<QueryInput class="filter__query"></QueryInput>

<div>
total: {{ filteredItems.length }}
</div>

<div class="filter-presets">filters:
<FilterPresetButton
:preset="preset"
Expand All @@ -78,17 +82,6 @@
:key="preset.name"
></ColumnPresetButton>
</div>

<div class="current-columns"><span style="margin-right:18px;">current:</span>
<ColumnField
:field="field"
:checked="$store.getters.fieldExists(field)"
@click="$emit('toggleField', field)"
:class="{ 'available-fields__field': true, active: $store.getters.fieldExists(field) }"
v-for="field of fieldsWithoutComments"
:key="field.name"
></ColumnField>
</div>
</div>
</template>

Expand All @@ -108,7 +101,6 @@
<script>
import FilterPresetButton from "~/components/FilterPresetButton";
import ColumnPresetButton from "~/components/ColumnPresetButton";
import ColumnField from "~/components/ColumnField";
import FieldGroup from "~/components/FieldGroup";
import QueryInput from "~/components/QueryInput";
import "vue-awesome/icons/check-double";
Expand All @@ -119,7 +111,6 @@ export default {
components: {
FilterPresetButton,
ColumnPresetButton,
ColumnField,
FieldGroup,
QueryInput
},
Expand Down Expand Up @@ -148,14 +139,6 @@ export default {
return this.$store.state.fields;
},
fieldsWithoutComments() {
return this.$store.state.fields.map(f => {
f = {...f};
delete (f.comment);
return f;
});
},
availableFields() {
return this.$store.state.availableFields;
},
Expand Down
42 changes: 34 additions & 8 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
<div v-if="!jsonLoading && !jsonLoadError">
<Toolbar @toggleField="toggleField" @setFields="setFields"></Toolbar>

<Stats></Stats>

<div class="current-columns"><span style="margin-right:18px;">current:</span>
<ColumnField
:field="field"
:checked="$store.getters.fieldExists(field)"
@click="toggleField(field)"
:class="{ 'available-fields__field': true, active: $store.getters.fieldExists(field) }"
v-for="field of fieldsWithoutComments"
:key="field.name"
></ColumnField>
</div>

<div><br>
total: {{ filteredItems.length }}
</div>
Expand All @@ -34,8 +47,6 @@
</button>
</div>

<Stats></Stats>

<v-client-table
v-if="filteredItems.length > 0"
:columns="columns"
Expand Down Expand Up @@ -65,6 +76,7 @@

<script>
import Toolbar from "~/components/Toolbar";
import ColumnField from "~/components/ColumnField";
import ItemDetails from "~/components/ItemDetails";
import Stats from "~/components/Stats";
import ReportHistory from "~/components/ReportHistory";
Expand All @@ -74,14 +86,20 @@ import _ from "lodash";
import XLSX from "xlsx";
export default {
components: { Toolbar, ItemDetails, Stats, ReportHistory },
components: {
Toolbar,
ItemDetails,
Stats,
ReportHistory,
ColumnField,
},
data() {
return {
routerProcess: false,
tests: this.$store.state.tests,
jsonLoadError: false,
jsonLoading: true,
introTourSteps: [
introTourSteps: [ // tolang
{
target: '.current-json',
header: {
Expand Down Expand Up @@ -124,13 +142,13 @@ export default {
offset: -200,
},
{
target: '.current-columns',
content: `Quick remove current table columns.`,
target: '.table-stats',
content: `Stats by filtered rows: average, non-unique, enum values.`,
offset: -200,
},
{
target: '.table-stats',
content: `Stats by filtered rows: average, non-unique, enum values.`,
target: '.current-columns',
content: `Quick remove current table columns.`,
offset: -200,
},
{
Expand Down Expand Up @@ -168,6 +186,14 @@ export default {
return this.$store.state.filteredItems;
},
fieldsWithoutComments() {
return this.$store.state.fields.map(f => {
f = {...f};
delete (f.comment);
return f;
});
},
tableOptions() {
// console.log("this.filteredItems: ", this.filteredItems);
Expand Down

0 comments on commit 3409e77

Please sign in to comment.