Merge 'new-dashboard-feature' into 14318-bulk-actions

pull/14400/head
jesusbotella 6 years ago
commit 1a216cc3ad

@ -0,0 +1,5 @@
<svg width="18" height="20" viewBox="0 0 18 20" xmlns="http://www.w3.org/2000/svg">
<g fill="#036FE2" fill-rule="evenodd">
<path d="M8.3 6.7l1.4-1.4L5 .58.3 5.29l1.4 1.42L4 4.4v11.6h2V4.4zM16.3 13.3L14 15.58V4h-2V15.6l-2.3-2.3-1.4 1.42 4.7 4.7 4.7-4.7z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 275 B

@ -0,0 +1,7 @@
<svg width="38" height="42" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M-6-5.998h49.92v49.922H-6z"/>
<path d="M-6-3.92h49.92V46H-6z"/>
<path d="M18.96.24C9.656.24.24 3.098.24 8.56v24.96c0 5.462 9.416 8.32 18.72 8.32 9.304 0 18.72-2.858 18.72-8.32V8.56c0-5.462-9.416-8.32-18.72-8.32zm0 4.16c9.458 0 14.56 2.954 14.56 4.16s-5.102 4.16-14.56 4.16S4.4 9.766 4.4 8.56 9.502 4.4 18.96 4.4zm0 33.28c-9.458 0-14.56-2.954-14.56-4.16v-2.912c3.61 1.92 9.098 2.912 14.56 2.912s10.95-.994 14.56-2.912v2.912c0 1.206-5.102 4.16-14.56 4.16zm0-8.32c-9.458 0-14.56-2.954-14.56-4.16v-2.912c3.61 1.92 9.098 2.912 14.56 2.912s10.95-.994 14.56-2.912V25.2c0 1.206-5.102 4.16-14.56 4.16zm0-8.32c-9.458 0-14.56-2.954-14.56-4.16v-2.912c3.61 1.918 9.098 2.912 14.56 2.912s10.95-.994 14.56-2.912v2.912c0 1.206-5.102 4.16-14.56 4.16z" fill="#E6E8EB" fill-rule="nonzero"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 908 B

@ -0,0 +1,9 @@
<svg width="56" height="56" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M-4-4h64v64H-4z"/>
<g fill="#E6E8EB">
<path d="M32.667 40.334C29.923 41.258 26.014 42 21 42c-10.61 0-16.333-3.313-16.333-4.667v-3.266c4.05 2.151 10.206 3.266 16.333 3.266 4.093 0 8.185-.508 11.667-1.481V31c-2.744.924-6.653 1.666-11.667 1.666-10.61 0-16.333-3.314-16.333-4.667v-3.267C8.717 26.885 14.873 28 21 28c6.127 0 12.283-1.115 16.333-3.267V28H42V9.333C42 3.206 31.437 0 21 0S0 3.206 0 9.333v28c0 6.128 10.563 9.334 21 9.334 4.088 0 8.183-.5 11.667-1.466v-4.867zM21 4.667c10.61 0 16.333 3.313 16.333 4.666C37.333 10.687 31.61 14 21 14S4.667 10.687 4.667 9.333C4.667 7.98 10.39 4.667 21 4.667zM4.667 15.4c4.05 2.151 10.206 3.267 16.333 3.267 6.127 0 12.283-1.116 16.333-3.267v3.267c0 1.353-5.723 4.666-16.333 4.666S4.667 20.02 4.667 18.667V15.4z" fill-rule="nonzero"/>
<path d="M56 44.333h-7v-7h-4.667v7h-7V49h7v7H49v-7h7z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 984 B

@ -1,11 +1,7 @@
<template>
<section v-click-outside="closeDropdown">
<button class="dropdown__toggle" @click="toggleDropdown" :class="{ 'dropdown__toggle--active': isDropdownOpen }">
<svg width="18" height="20" viewBox="0 0 18 20" xmlns="http://www.w3.org/2000/svg">
<g fill="#036FE2" fill-rule="evenodd">
<path d="M8.3 6.7l1.4-1.4L5 .58.3 5.29l1.4 1.42L4 4.4v11.6h2V4.4zM16.3 13.3L14 15.58V4h-2V15.6l-2.3-2.3-1.4 1.42 4.7 4.7 4.7-4.7z"/>
</g>
</svg>
<slot />
</button>
<div class="dropdown" :class="{ 'is-open': isDropdownOpen }">
@ -211,8 +207,8 @@ export default {
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
padding: 0 9px;
border-radius: 2px;
&.dropdown__toggle--active {

@ -11,7 +11,7 @@
<slot name="dropdownButton"></slot>
</li>
<li class="head-sectionActionsItem" v-if="showActionButton">
<li class="head-sectionActionsItem" v-if="!!$slots.actionButton">
<slot name="actionButton"></slot>
</li>
</ul>

@ -40,7 +40,13 @@
"private": "Your private datasets"
}
},
"createDataset": "New Dataset"
"createDataset": "New Dataset",
"zeroCase": {
"title": "Upload, create or connect your first dataset",
"description": "Incorporate your data and create insightful visualizations that leverage big data and Location Intelligence.",
"createDataset": "New Dataset"
},
"emptyState": "There are no datasets here."
},
"MapsPage": {
"header": {
@ -60,7 +66,7 @@
"description": "Build your first Location Intelligence analysis or take a look to our <a href='https://carto.com/help'>guides and help</a>.",
"createMap": "Create your first map"
},
"emptyCase": "There are no maps here."
"emptyState": "There are no maps here."
},
"FilterDropdown": {
"showMe": "Show me",
@ -87,6 +93,7 @@
"last": "Last",
"first": "First"
}
}
},
"initialState": "Change Filters"
}
}

@ -6,10 +6,24 @@
<template slot="icon">
<img src="../assets/icons/section-title/data.svg" />
</template>
<template slot="actionButton">
<template slot="actionButton" v-if="!initialState">
<CreateButton visualizationType="dataset">{{ $t(`DataPage.createDataset`) }}</CreateButton>
</template>
</SectionTitle>
<div class="grid-cell" v-if="initialState">
<InitialState :title="$t(`DataPage.zeroCase.title`)">
<template slot="icon">
<img svg-inline src="../assets/icons/datasets/initialState.svg">
</template>
<template slot="description">
<p class="text is-caption is-txtGrey" v-html="$t(`DataPage.zeroCase.description`)"></p>
</template>
<template slot="actionButton">
<CreateButton visualizationType="dataset">{{ $t(`DataPage.zeroCase.createDataset`) }}</CreateButton>
</template>
</InitialState>
</div>
</div>
<ul v-if="isFetchingDatasets">
@ -31,6 +45,12 @@
</ul>
</div>
<EmptyState
:text="$t('DataPage.emptyState')"
v-if="emptyState">
<img svg-inline src="../assets/icons/datasets/emptyState.svg">
</EmptyState>
<Pagination v-if="!isFetchingDatasets && numResults > 0" :page=currentPage :numPages=numPages @pageChange="goToPage"></Pagination>
</section>
</template>
@ -39,7 +59,9 @@
import { mapState } from 'vuex';
import Pagination from 'new-dashboard/components/Pagination';
import SectionTitle from 'new-dashboard/components/SectionTitle';
import CreateButton from 'new-dashboard/components/CreateButton.vue';
import InitialState from 'new-dashboard/components/States/InitialState';
import EmptyState from 'new-dashboard/components/States/EmptyState';
import CreateButton from 'new-dashboard/components/CreateButton';
import { isAllowed } from '../core/filters';
export default {
@ -47,7 +69,9 @@ export default {
components: {
SectionTitle,
CreateButton,
Pagination
Pagination,
InitialState,
EmptyState
},
beforeRouteUpdate (to, from, next) {
const urlOptions = { ...to.params, ...to.query };
@ -68,10 +92,18 @@ export default {
datasets: state => state.datasets.list,
datasetsMetadata: state => state.datasets.metadata,
isFetchingDatasets: state => state.datasets.isFetching,
numResults: state => state.datasets.metadata.total_entries
numResults: state => state.datasets.metadata.total_entries,
filterType: state => state.datasets.filterType,
totalUserEntries: state => state.datasets.metadata.total_user_entries
}),
pageTitle () {
return this.$t(`DataPage.header.title['${this.appliedFilter}']`);
},
initialState () {
return !this.isFetchingDatasets && this.hasFilterApplied('mine') && this.totalUserEntries <= 0;
},
emptyState () {
return !this.isFetchingDatasets && !this.numResults && !this.hasFilterApplied('mine');
}
},
methods: {
@ -84,7 +116,10 @@ export default {
});
},
applyFilter (filter) {
this.$router.push({ name: 'maps', params: { filter } });
this.$router.push({ name: 'datasets', params: { filter } });
},
hasFilterApplied (filter) {
return this.filterType === filter;
}
}
};

@ -31,18 +31,20 @@
:filter="appliedFilter"
:order="appliedOrder"
:metadata="mapsMetadata"
@filterChanged="applyFilter"/>
@filterChanged="applyFilter">
<span v-if="initialState" class="title is-small is-txtPrimary">{{ $t('FilterDropdown.initialState') }}</span>
<img svg-inline v-else src="../assets/icons/common/filter.svg">
</FilterDropdown>
</template>
<template slot="actionButton">
<CreateButton visualizationType="maps" >New map</CreateButton>
<template slot="actionButton" v-if="!initialState && !selectedMaps.length">
<CreateButton visualizationType="maps">New map</CreateButton>
</template>
</SectionTitle>
<div class="grid-cell" v-if="!isFetchingMaps && hasFilterApplied('mine') && totalUserEntries <= 0">
<div class="grid-cell" v-if="initialState">
<InitialState :title="$t(`MapsPage.zeroCase.title`)">
<template slot="icon">
<img src="../assets/icons/maps/initialState.svg">
<img svg-inline src="../assets/icons/maps/initialState.svg">
</template>
<template slot="description">
<p class="text is-caption is-txtGrey" v-html="$t(`MapsPage.zeroCase.description`)"></p>
@ -66,8 +68,8 @@
</ul>
<EmptyState
:text="$t('MapsPage.emptyCase')"
v-if="!isFetchingMaps && !numResults && !hasFilterApplied('mine')">
:text="$t('MapsPage.emptyState')"
v-if="emptyState">
<img svg-inline src="../assets/icons/maps/compass.svg">
</EmptyState>
@ -149,6 +151,12 @@ export default {
},
areAllMapsSelected () {
return Object.keys(this.maps).length === this.selectedMaps.length;
},
initialState () {
return !this.isFetchingMaps && this.hasFilterApplied('mine') && this.totalUserEntries <= 0;
},
emptyState () {
return !this.isFetchingMaps && !this.numResults && !this.hasFilterApplied('mine');
}
},
methods: {

@ -0,0 +1 @@
export const filterIcon = '<svg width="18" height="20" viewBox="0 0 18 20" xmlns="http://www.w3.org/2000/svg"><g fill="#036FE2" fill-rule="evenodd"><path d="M8.3 6.7l1.4-1.4L5 .58.3 5.29l1.4 1.42L4 4.4v11.6h2V4.4zM16.3 13.3L14 15.58V4h-2V15.6l-2.3-2.3-1.4 1.42 4.7 4.7 4.7-4.7z"/></g></svg>';

@ -1,5 +1,6 @@
import { shallowMount } from '@vue/test-utils';
import FilterDropdown from 'new-dashboard/components/FilterDropdown';
import { filterIcon } from 'icons';
const $t = key => key;
@ -55,6 +56,9 @@ function createFilterDropdown (
}) {
return shallowMount(FilterDropdown, {
mocks: { $t },
propsData
propsData,
slots: {
default: filterIcon
}
});
}

Loading…
Cancel
Save