2025-04-16 16:55:38 -07:00
|
|
|
import { findDashboardByURN } from '@graphql-mock/fixtures/searchResult/dashboardSearchResult';
|
|
|
|
import { updateEntityOwners, updateEntityTag } from '@graphql-mock/mutationHelper';
|
|
|
|
import { Dashboard, DashboardUpdateInput } from '@types';
|
2021-07-17 04:56:50 +10:00
|
|
|
|
|
|
|
type UpdateDashboard = {
|
|
|
|
data: { updateDashboard: Dashboard };
|
|
|
|
};
|
|
|
|
|
|
|
|
export const updateDashboardResolver = {
|
2021-09-22 17:30:15 -07:00
|
|
|
updateDashboard({ variables: { urn, input } }): UpdateDashboard {
|
|
|
|
const { ownership, globalTags }: DashboardUpdateInput = input;
|
2021-07-17 04:56:50 +10:00
|
|
|
const dashboard = findDashboardByURN(urn);
|
|
|
|
|
|
|
|
if (ownership) {
|
|
|
|
updateEntityOwners({ entity: dashboard, owners: ownership?.owners });
|
|
|
|
} else if (globalTags) {
|
|
|
|
updateEntityTag({ entity: dashboard, globalTags });
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
data: {
|
|
|
|
updateDashboard: Object.assign(dashboard, {
|
|
|
|
info: {
|
|
|
|
...dashboard.info,
|
|
|
|
charts: [],
|
|
|
|
customProperties: [],
|
|
|
|
lastRefreshed: null,
|
|
|
|
created: {
|
|
|
|
time: 1619160920,
|
|
|
|
__typename: 'AuditStamp',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
downstreamLineage: {
|
|
|
|
entities: [],
|
|
|
|
__typename: 'DownstreamEntityRelationships',
|
|
|
|
},
|
|
|
|
upstreamLineage: {
|
|
|
|
entities: [],
|
|
|
|
__typename: 'UpstreamEntityRelationships',
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|