Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud native -- FRONTEND custom branch -- #16451

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.15.1
12.22.12
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Development
- None yet

### Features
* Display GeoParquet link in Catalog [16453](https://github.com/CartoDB/cartodb/pull/16453)
* Display notifications about the new CARTO platform release [16352](https://github.com/CartoDB/cartodb/pull/16352)
* Upgrade to deck.gl 8.5.6 [16338](https://github.com/CartoDB/cartodb/pull/16338)
* Update DO Catalog dependencies and some changes to use bundle on CARTO Workspace [#16325](https://github.com/CartoDB/cartodb/pull/16325)
Expand Down
1 change: 1 addition & 0 deletions lib/assets/javascripts/do-catalog/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div class="do-catalog">
<router-view></router-view>
<div id="tooltip-portal"></div>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import { mapState } from 'vuex';
import mapboxgl from 'mapbox-gl';
import { Deck } from '@deck.gl/core';
import { CartoBQTilerLayer, BASEMAP } from '@deck.gl/carto';
import { VectorTileLayer, vectorTilesetSource, BASEMAP } from '@deck.gl/carto';

import { generateColorStyleProps, resetColorStyleProps } from './map-styles/colorStyles';
import { getQuantiles, formatNumber, capitalize, compare } from './map-styles/utils';
Expand Down Expand Up @@ -170,6 +170,13 @@ export default {
getTooltip: this.getTooltip
});

this.tilesetSource = vectorTilesetSource({
accessToken: window.accessToken,
...(window.apiBaseUrl && { apiBaseUrl: window.apiBaseUrl }),
connectionName: 'carto_dw',
tableName: this.tilesetSampleId
});

this.renderLayer();
},
methods: {
Expand Down Expand Up @@ -201,13 +208,8 @@ export default {
},
renderLayer () {
const layers = [
new CartoBQTilerLayer({
data: this.tilesetSampleId,
credentials: {
username: this.username || 'public',
apiKey: 'default_public',
...(this.mapUrl && { mapsUrl: this.mapUrl })
},
new VectorTileLayer({
data: this.tilesetSource,
...styleProps.deck,
lineWidthUnits: 'pixels',
pointRadiusUnits: 'pixels',
Expand All @@ -226,7 +228,6 @@ export default {
this.setGeomType(tilestats);
this.setVariable(tilestats);
this.setStyleProps();
this.renderLayer();
this.showMap = true;
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,37 +98,60 @@

<ul class="u-mt--24 text f12 is-small is-txtMainTextColor">
<li class="grid title is-txtMidGrey header-row">
<div class="grid-cell grid-cell--col4">Column Name</div>
<div class="grid-cell" :class="cssColumnName" >Column Name</div>
<div
class="grid-cell grid-cell--col7 grid-cell--col6--tablet grid-cell--col5--mobile"
class="grid-cell"
:class="cssColumnDescription"
>
Description
</div>
<div
class="grid-cell grid-cell--col1 grid-cell--col2--tablet grid-cell--col3--mobile"
class="grid-cell"
:class="cssColumnType"
>
Type
</div>
<div
class="grid-cell grid-cell--col2 grid-cell--col3--tablet grid-cell--col3--mobile"
v-if="showId"
>
ID
</div>
</li>

<li
class="grid info-row"
v-for="variable in variables"
:key="variable.slug"
>
<div class="grid-cell grid-cell--col4 is-semibold name-cell">
<div :class="cssColumnName" class="grid-cell is-semibold name-cell">
{{ variable.column_name }}
</div>
<div
class="grid-cell grid-cell--col7 grid-cell--col6--tablet grid-cell--col5--mobile"
class="grid-cell"
:class="cssColumnDescription"
>
{{ variable.description }}
</div>
<div
class="grid-cell grid-cell--col1 grid-cell--col2--tablet grid-cell--col3--mobile"
class="grid-cell"
:class="cssColumnType"
>
{{ variable.db_type }}
</div>
<div
class="grid-cell grid-cell--col2 grid-cell--col3--tablet grid-cell--col3--mobile"
v-if="showId"
>
<Tooltip :text="copyMessage" position="bottom-left" class="text is-small u-flex u-flex__align-center">
<div class="u-flex u-alignCenter copy" @click="() => copyString(variable.slug)" @mouseleave="resetCopyStatus">
<svg class="u-mr--8" width="20" height="20" viewBox="0 0 20 20" style="flex-shrink: 0">
<path xmlns="http://www.w3.org/2000/svg" d="M15.833 2.5c.869 0 1.588.673 1.66 1.523l.007.144v11.666c0 .869-.673 1.588-1.523 1.66l-.144.007H4.167a1.672 1.672 0 0 1-1.66-1.523l-.007-.144V4.167c0-.869.673-1.588 1.523-1.66l.144-.007h11.666zm0 1.667H4.167v11.666h11.666V4.167zM7.917 7.5v5h-1.25v-5h1.25zm4.583 0c.708 0 1.25.542 1.25 1.25v2.5c0 .708-.542 1.25-1.25 1.25H9.583v-5zm0 1.25h-1.667v2.5H12.5v-2.5z" fill="#2C3032" fill-rule="evenodd" fill-opacity=".6"/>
</svg>
{{ variable.slug }}
</div>
</Tooltip>
</div>
</li>
</ul>
</div>
Expand All @@ -139,16 +162,19 @@
<script>
import { mapState } from 'vuex';
import NotAvailable from 'new-dashboard/components/Catalog/NotAvailable.vue';
import Tooltip from 'new-dashboard/components/Tooltip/Tooltip';
import { formURL } from 'new-dashboard/utils/catalog/form-url';
import { sendCustomDimensions } from 'new-dashboard/utils/catalog/custom-dimensions-ga';

export default {
name: 'CatalogDatasetData',
components: {
NotAvailable
NotAvailable,
Tooltip
},
data () {
return {
isCopied: false,
tooltip: {
visible: false,
isFirst: false,
Expand Down Expand Up @@ -180,6 +206,9 @@ export default {
variables: state => state.catalog.variables,
isFetching: state => state.catalog.isFetching
}),
copyMessage () {
return this.isCopied ? 'Copied!' : 'Copy ID';
},
tableKey () {
if (this.dataset && this.dataset.summary_json) {
if (this.dataset.summary_json.ordered_glimpses) {
Expand Down Expand Up @@ -214,9 +243,34 @@ export default {
},
isGeography () {
return this.$route.params.entity_type === 'geography';
},
showId () {
return this.$route.query.showId;
},
cssColumnName () {
return {'grid-cell--col3': this.showId, 'grid-cell--col4': !this.showId};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A space is required after '{' object-curly-spacing
A space is required before '}' object-curly-spacing

},
cssColumnDescription () {
return {
'grid-cell--col6 grid-cell--col4--tablet grid-cell--col4--mobile': this.showId,
'grid-cell--col7 grid-cell--col6--tablet grid-cell--col5--mobile': !this.showId
};
},
cssColumnType () {
return {
'grid-cell--col1 grid-cell--col2--tablet grid-cell--col2--mobile': this.showId,
'grid-cell--col1 grid-cell--col2--tablet grid-cell--col3--mobile': !this.showId
};
}
},
methods: {
async copyString (value) {
await navigator.clipboard.writeText(value);
this.isCopied = true;
},
resetCopyStatus () {
this.isCopied = false;
},
findVariableInfo (variableName) {
return this.variables.find(e => e.column_name === variableName);
},
Expand Down Expand Up @@ -311,14 +365,6 @@ a {
border-bottom: 2px solid $blue--100;
}

.tooltip-container {
position: absolute;
z-index: 2;
bottom: 100%;
margin-left: 32px;
padding-bottom: 8px;
}

.table-wrapper {
position: relative;
}
Expand Down Expand Up @@ -376,6 +422,13 @@ a {
}
}

.copy {
&:hover {
cursor: pointer;
text-decoration: underline;
}
}

@media (max-width: $layout-mobile) {
.title-container {
flex-wrap: wrap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@
</router-link>
</p>
</li>
<li
class="u-mb--32 u-mb--12--tablet"
v-if="hasGeoparquetAvailable"
>
<h4 class="text is-small is-txtSoftGrey u-mb--10">
GeoParquet
</h4>
<p class="text is-caption">
<a class="underline" :href="geoparquetUrl" target="_blank">Download</a>
</p>
</li>
</ul>
</div>
</div>
Expand All @@ -112,13 +123,20 @@ import { temporalAggregationName } from 'new-dashboard/utils/catalog/temporal-ag
import { geometryTypeName } from 'new-dashboard/utils/catalog/geometry-type-name';
import { updateFrequencyName } from 'new-dashboard/utils/catalog/update-frequency-name';
import { sendCustomDimensions } from 'new-dashboard/utils/catalog/custom-dimensions-ga';
import { checkGeoparquetBucket } from 'new-dashboard/utils/catalog/geoparquet';
import CatalogMapPreview from 'new-dashboard/components/Catalog/CatalogMapPreview';

export default {
name: 'CatalogDatasetSummary',
components: {
CatalogMapPreview
},
data () {
return {
hasGeoparquetAvailable: false,
geoparquetUrl: undefined
};
},
watch: {
dataset: {
handler (value) {
Expand Down Expand Up @@ -169,10 +187,16 @@ export default {
id: this.$route.params.entity_id,
type: this.$route.params.entity_type
});
},
async checkIfGeoparquetBucketExists () {
const { ok, url } = await checkGeoparquetBucket(this.$route.params.entity_id);
this.hasGeoparquetAvailable = ok;
this.geoparquetUrl = url;
}
},
mounted () {
this.fetchKeyVariables();
this.checkIfGeoparquetBucketExists();
}
};
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export async function checkGeoparquetBucket (dataset) {
try {
const url = `https://storage.googleapis.com/geoparquet/carto/${dataset}.parquet`;
const response = await fetch(url, { method: 'HEAD' });
return { ok: response.ok, url };
} catch (e) {
return { ok: false };
}
}
Loading
Loading