Skip to content

Commit

Permalink
chore: Renamed changed/created_on to changed/created_at
Browse files Browse the repository at this point in the history
  • Loading branch information
John Bodley committed Aug 28, 2020
1 parent 3e374da commit 3bb0dd3
Show file tree
Hide file tree
Showing 72 changed files with 364 additions and 231 deletions.
3 changes: 3 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ assists people when migrating to a new version.

## Next

* [10719](https://github.com/apache/incubator-superset/pull/10719): a change which renames the changed_on and created_on columns to changed_at and created_at respectively. This change alters a number of tables including the heavily leveraged `query` table (which additionally requires dropping and recreating an index) and thus scheduled downtime is advised. This also impacts the cache key and thus as a consequence all
previously cached results will be invalidated.

* [10674](https://github.com/apache/incubator-superset/pull/10674): Breaking change: PUBLIC_ROLE_LIKE_GAMMA was removed is favour of the new PUBLIC_ROLE_LIKE so it can be set it whatever role you want.

* [10590](https://github.com/apache/incubator-superset/pull/10590): Breaking change: this PR will convert iframe chart into dashboard markdown component, and remove all `iframe`, `separator`, and `markup` slices (and support) from Superset. If you have important data in those slices, please backup manually.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe('SliceAdder', () => {
describe('SliceAdder.sortByComparator', () => {
it('should sort by timestamp descending', () => {
const sortedTimestamps = Object.values(props.slices)
.sort(SliceAdder.sortByComparator('changed_on'))
.map(slice => slice.changed_on);
.sort(SliceAdder.sortByComparator('changed_at'))
.map(slice => slice.changed_at);
expect(
sortedTimestamps.every((currentTimestamp, index) => {
if (index === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const sliceEntitiesForChart = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332615,
changed_at: 1529453332615,
},
},
isLoading: false,
Expand Down Expand Up @@ -84,7 +84,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332615,
changed_at: 1529453332615,
},
128: {
slice_id: 128,
Expand All @@ -97,7 +97,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332628,
changed_at: 1529453332628,
},
129: {
slice_id: 129,
Expand All @@ -110,7 +110,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332637,
changed_at: 1529453332637,
},
130: {
slice_id: 130,
Expand All @@ -123,7 +123,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332645,
changed_at: 1529453332645,
},
131: {
slice_id: 131,
Expand All @@ -136,7 +136,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332654,
changed_at: 1529453332654,
},
132: {
slice_id: 132,
Expand All @@ -149,7 +149,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332663,
changed_at: 1529453332663,
},
133: {
slice_id: 133,
Expand All @@ -162,7 +162,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332673,
changed_at: 1529453332673,
},
134: {
slice_id: 134,
Expand All @@ -175,7 +175,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332680,
changed_at: 1529453332680,
},
135: {
slice_id: 135,
Expand All @@ -188,7 +188,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332688,
changed_at: 1529453332688,
},
136: {
slice_id: 136,
Expand All @@ -201,7 +201,7 @@ export const sliceEntitiesForDashboard = {
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332700,
changed_at: 1529453332700,
},
},
isLoading: false,
Expand Down
10 changes: 5 additions & 5 deletions superset-frontend/spec/javascripts/sqllab/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ export const table = {
indexed: false,
longType: 'DATETIME',
type: 'DATETIME',
name: 'created_on',
name: 'created_at',
},
{
indexed: false,
longType: 'DATETIME',
type: 'DATETIME',
name: 'changed_on',
name: 'changed_at',
},
{
indexed: true,
Expand Down Expand Up @@ -205,7 +205,7 @@ export const queries = [
tempTable: null,
userId: 1,
executedSql: null,
changed_on: '2016-10-19T20:56:06',
changed_at: '2016-10-19T20:56:06',
rows: 42,
endDttm: 1476910566798,
limit_reached: false,
Expand Down Expand Up @@ -263,11 +263,11 @@ export const queries = [
tempTable: null,
userId: 1,
executedSql:
'SELECT * \nFROM (SELECT created_on, changed_on, id, slice_name, ' +
'SELECT * \nFROM (SELECT created_at, changed_at, id, slice_name, ' +
'druid_datasource_id, table_id, datasource_type, datasource_name, ' +
'viz_type, params, created_by_fk, changed_by_fk, description, ' +
'cache_timeout, perm\nFROM superset.slices) AS inner_qry \n LIMIT 1000',
changed_on: '2016-10-19T20:56:12',
changed_at: '2016-10-19T20:56:12',
rows: 42,
endDttm: 1476910579693,
limit_reached: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const chartsVizTypesEndpoint = 'glob:*/api/v1/chart/viz_types';
const chartsDtasourcesEndpoint = 'glob:*/api/v1/chart/datasources';

const mockCharts = [...new Array(3)].map((_, i) => ({
changed_on: new Date().toISOString(),
changed_at: new Date().toISOString(),
creator: 'super user',
id: i,
slice_name: `cool chart ${i}`,
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('ChartList', () => {
const callsD = fetchMock.calls(/chart\/\?q/);
expect(callsD).toHaveLength(1);
expect(callsD[0][0]).toMatchInlineSnapshot(
`"http://localhost/api/v1/chart/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25)"`,
`"http://localhost/api/v1/chart/?q=(order_column:changed_at_delta_humanized,order_direction:desc,page:0,page_size:25)"`,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const mockDashboards = [...new Array(3)].map((_, i) => ({
changed_by_url: 'changed_by_url',
changed_by_fk: 1,
published: true,
changed_on_utc: new Date().toISOString(),
changed_on_delta_humanized: '5 minutes ago',
changed_at_utc: new Date().toISOString(),
changed_at_delta_humanized: '5 minutes ago',
owners: [{ first_name: 'admin', last_name: 'admin_user' }],
thumbnail_url: '/thumbnail',
}));
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('DashboardList', () => {
const callsD = fetchMock.calls(/dashboard\/\?q/);
expect(callsD).toHaveLength(1);
expect(callsD[0][0]).toMatchInlineSnapshot(
`"http://localhost/api/v1/dashboard/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25)"`,
`"http://localhost/api/v1/dashboard/?q=(order_column:changed_at_delta_humanized,order_direction:desc,page:0,page_size:25)"`,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const mockdatasets = [...new Array(3)].map((_, i) => ({
kind: i === 0 ? 'virtual' : 'physical', // ensure there is 1 virtual
changed_by_url: 'changed_by_url',
changed_by: 'user',
changed_on: new Date().toISOString(),
changed_at: new Date().toISOString(),
database_name: `db ${i}`,
explore_url: `/explore/table/${i}`,
id: i,
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('DatasetList', () => {
const callsD = fetchMock.calls(/dataset\/\?q/);
expect(callsD).toHaveLength(2);
expect(callsD[1][0]).toMatchInlineSnapshot(
`"http://localhost/api/v1/dataset/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25)"`,
`"http://localhost/api/v1/dataset/?q=(order_column:changed_at_delta_humanized,order_direction:desc,page:0,page_size:25)"`,
);
});

Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/components/OmniContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const getDashboards = query =>
// todo: Build a dedicated endpoint for dashboard searching
// i.e. superset/v1/api/dashboards?q=${query}
SupersetClient.get({
endpoint: `/dashboardasync/api/read?_oc_DashboardModelViewAsync=changed_on&_od_DashboardModelViewAsync=desc&_flt_2_dashboard_title=${query}`,
endpoint: `/dashboardasync/api/read?_oc_DashboardModelViewAsync=changed_at&_od_DashboardModelViewAsync=desc&_flt_2_dashboard_title=${query}`,
})
.then(({ json }) =>
json.result.map(item => ({
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/dashboard/actions/sliceEntities.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export function fetchAllSlices(userId) {
form_data,
datasource_name: slice.datasource_name_text,
datasource_link: slice.datasource_link,
changed_on: new Date(slice.changed_on).getTime(),
changed_at: new Date(slice.changed_at).getTime(),
description: slice.description,
description_markdown: slice.description_markeddown,
viz_type: slice.viz_type,
modified: slice.modified,
changed_on_humanized: slice.changed_on_humanized,
changed_at_humanized: slice.changed_at_humanized,
};
}
});
Expand Down
8 changes: 4 additions & 4 deletions superset-frontend/src/dashboard/components/SliceAdder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const KEYS_TO_SORT = [
{ key: 'slice_name', label: 'Name' },
{ key: 'viz_type', label: 'Vis type' },
{ key: 'datasource_name', label: 'Datasource' },
{ key: 'changed_on', label: 'Recent' },
{ key: 'changed_at', label: 'Recent' },
];

const MARGIN_BOTTOM = 16;
Expand All @@ -66,7 +66,7 @@ const DEFAULT_CELL_HEIGHT = 112;

class SliceAdder extends React.Component {
static sortByComparator(attr) {
const desc = attr === 'changed_on' ? -1 : 1;
const desc = attr === 'changed_at' ? -1 : 1;

return (a, b) => {
if (a[attr] < b[attr]) {
Expand All @@ -83,7 +83,7 @@ class SliceAdder extends React.Component {
this.state = {
filteredSlices: [],
searchTerm: '',
sortBy: KEYS_TO_SORT.findIndex(item => item.key === 'changed_on'),
sortBy: KEYS_TO_SORT.findIndex(item => item.key === 'changed_at'),
selectedSliceIdsSet: new Set(props.selectedSliceIds),
};
this.rowRenderer = this.rowRenderer.bind(this);
Expand Down Expand Up @@ -188,7 +188,7 @@ class SliceAdder extends React.Component {
innerRef={dragSourceRef}
style={style}
sliceName={cellData.slice_name}
lastModified={cellData.changed_on_humanized}
lastModified={cellData.changed_at_humanized}
visType={cellData.viz_type}
datasourceUrl={cellData.datasource_url}
datasourceName={cellData.datasource_name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function AddSliceDragPreview({ dragItem, slices, isDragging, currentOffset }) {
transform: `translate(${currentOffset.x}px, ${currentOffset.y}px)`,
}}
sliceName={slice.slice_name}
lastModified={slice.changed_on_humanized}
lastModified={slice.changed_at_humanized}
visType={slice.viz_type}
datasourceUrl={slice.datasource_url}
datasourceName={slice.datasource_name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default function (bootstrapData) {
description_markeddown: slice.description_markeddown,
owners: slice.owners,
modified: slice.modified,
changed_on: new Date(slice.changed_on).getTime(),
changed_at: new Date(slice.changed_at).getTime(),
};

sliceIds.add(key);
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/util/propShapes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const slicePropShape = PropTypes.shape({
datasource: PropTypes.string,
datasource_name: PropTypes.string,
datasource_link: PropTypes.string,
changed_on: PropTypes.number.isRequired,
changed_at: PropTypes.number.isRequired,
modified: PropTypes.string.isRequired,
viz_type: PropTypes.string.isRequired,
description: PropTypes.string,
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/types/Chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export default interface Chart {
viz_type: string;
slice_name: string;
creator: string;
changed_on: string;
changed_at: string;
description: string | null;
cache_timeout: number | null;
thumbnail_url?: string;
changed_on_delta_humanized?: string;
changed_at_delta_humanized?: string;
owners?: Owner[];
datasource_name_text?: string;
}
12 changes: 6 additions & 6 deletions superset-frontend/src/views/CRUD/chart/ChartList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function ChartList(props: ChartListProps) {

const canEdit = hasPerm('can_edit');
const canDelete = hasPerm('can_delete');
const initialSort = [{ id: 'changed_on_delta_humanized', desc: true }];
const initialSort = [{ id: 'changed_at_delta_humanized', desc: true }];

function openChartEditModal(chart: Chart) {
setSliceCurrentlyEditing({
Expand Down Expand Up @@ -238,11 +238,11 @@ function ChartList(props: ChartListProps) {
{
Cell: ({
row: {
original: { changed_on_delta_humanized: changedOn },
original: { changed_at_delta_humanized: changedOn },
},
}: any) => <span className="no-wrap">{changedOn}</span>,
Header: t('Last Modified'),
accessor: 'changed_on_delta_humanized',
accessor: 'changed_at_delta_humanized',
},
{
accessor: 'description',
Expand Down Expand Up @@ -379,13 +379,13 @@ function ChartList(props: ChartListProps) {
},
{
desc: true,
id: 'changed_on_delta_humanized',
id: 'changed_at_delta_humanized',
label: 'Recently Modified',
value: 'recently_modified',
},
{
desc: false,
id: 'changed_on_delta_humanized',
id: 'changed_at_delta_humanized',
label: 'Least Recently Modified',
value: 'least_recently_modified',
},
Expand Down Expand Up @@ -438,7 +438,7 @@ function ChartList(props: ChartListProps) {
url={bulkSelectEnabled ? undefined : chart.url}
imgURL={chart.thumbnail_url ?? ''}
imgFallbackURL={'/static/assets/images/chart-card-fallback.png'}
description={t('Last modified %s', chart.changed_on_delta_humanized)}
description={t('Last modified %s', chart.changed_at_delta_humanized)}
coverLeft={(chart.owners || []).slice(0, 5).map(owner => (
<AvatarIcon
key={owner.id}
Expand Down
Loading

0 comments on commit 3bb0dd3

Please sign in to comment.