Skip to content

Commit

Permalink
Merge branch 'datahub-project:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored Aug 6, 2024
2 parents 095dbc9 + 018a106 commit 129eb66
Show file tree
Hide file tree
Showing 54 changed files with 822 additions and 528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,8 @@ private void configureQueryResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("mlModel", getResolver(mlModelType))
.dataFetcher("mlModelGroup", getResolver(mlModelGroupType))
.dataFetcher("assertion", getResolver(assertionType))
.dataFetcher("form", getResolver(formType))
.dataFetcher("view", getResolver(dataHubViewType))
.dataFetcher("listPolicies", new ListPoliciesResolver(this.entityClient))
.dataFetcher("getGrantedPrivileges", new GetGrantedPrivilegesResolver())
.dataFetcher("listUsers", new ListUsersResolver(this.entityClient))
Expand Down
11 changes: 11 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ type Query {
Fetch a Tag by primary key (urn)
"""
tag(urn: String!): Tag

"""
Fetch a View by primary key (urn)
"""
view(urn: String!): DataHubView

"""
Fetch a Form by primary key (urn)
"""
form(urn: String!): Form

"""
Fetch a Role by primary key (urn)
"""
Expand Down
18 changes: 9 additions & 9 deletions datahub-web-react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import Cookies from 'js-cookie';
import { message } from 'antd';
import { BrowserRouter as Router } from 'react-router-dom';
import { ApolloClient, ApolloProvider, createHttpLink, InMemoryCache, ServerError } from '@apollo/client';
import { onError } from '@apollo/client/link/error';
Expand All @@ -21,7 +20,7 @@ import { useCustomTheme } from './customThemeContext';
const httpLink = createHttpLink({ uri: '/api/v2/graphql' });

const errorLink = onError((error) => {
const { networkError, graphQLErrors } = error;
const { networkError } = error;
if (networkError) {
const serverError = networkError as ServerError;
if (serverError.statusCode === ErrorCodes.Unauthorized) {
Expand All @@ -31,13 +30,14 @@ const errorLink = onError((error) => {
window.location.replace(`${PageRoutes.AUTHENTICATE}?redirect_uri=${encodeURIComponent(currentPath)}`);
}
}
if (graphQLErrors && graphQLErrors.length) {
const firstError = graphQLErrors[0];
const { extensions } = firstError;
const errorCode = extensions && (extensions.code as number);
// Fallback in case the calling component does not handle.
message.error(`${firstError.message} (code ${errorCode})`, 3);
}
// Disabled behavior for now -> Components are expected to handle their errors.
// if (graphQLErrors && graphQLErrors.length) {
// const firstError = graphQLErrors[0];
// const { extensions } = firstError;
// const errorCode = extensions && (extensions.code as number);
// // Fallback in case the calling component does not handle.
// message.error(`${firstError.message} (code ${errorCode})`, 3); // TODO: Decide if we want this back.
// }
});

const client = new ApolloClient({
Expand Down
6 changes: 6 additions & 0 deletions datahub-web-react/src/graphql/view.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ query listGlobalViews($start: Int!, $count: Int!, $query: String) {
}
}

query getView($urn: String!) {
view(urn: $urn) {
...view
}
}

mutation createView($input: CreateViewInput!) {
createView(input: $input) {
...view
Expand Down
Loading

0 comments on commit 129eb66

Please sign in to comment.