Skip to content

Commit

Permalink
Merge branch 'release-0.47' of https://github.com/rilldata/rill into …
Browse files Browse the repository at this point in the history
…release-0.47
  • Loading branch information
begelundmuller committed Jul 9, 2024
2 parents dc6ec5b + 4028b09 commit 88faba9
Show file tree
Hide file tree
Showing 20 changed files with 610 additions and 306 deletions.
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
frame-ancestors *; \
object-src 'none'; \
connect-src https: *.usepylon.com *.posthog.com wss://*.pusher.com; \
font-src 'self' https://fonts.gstatic.com;
font-src 'self' https://fonts.gstatic.com *.usepylon.com;
"""
Permissions-Policy = "geolocation=(),midi=(),sync-xhr=(self),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()"
Referrer-Policy = "no-referrer"
Expand Down
34 changes: 17 additions & 17 deletions proto/gen/rill/runtime/v1/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 4 additions & 14 deletions proto/gen/rill/runtime/v1/api.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions proto/gen/rill/runtime/v1/api_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 23 additions & 20 deletions proto/gen/rill/runtime/v1/runtime.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ paths:
tags:
- ConnectorService
/v1/dev-jwt:
get:
post:
summary: IssueDevJWT issues a JWT for mimicking a user in local development.
operationId: RuntimeService_IssueDevJWT
responses:
"200":
Expand All @@ -147,25 +148,11 @@ paths:
schema:
$ref: '#/definitions/rpcStatus'
parameters:
- name: name
in: query
required: false
type: string
- name: email
in: query
required: false
type: string
- name: groups
in: query
required: false
type: array
items:
type: string
collectionFormat: multi
- name: admin
in: query
required: false
type: boolean
- name: body
in: body
required: true
schema:
$ref: '#/definitions/v1IssueDevJWTRequest'
tags:
- RuntimeService
/v1/examples:
Expand Down Expand Up @@ -295,6 +282,7 @@ paths:
- ConnectorService
/v1/health:
get:
summary: Health runs a health check on the runtime.
operationId: RuntimeService_Health
responses:
"200":
Expand All @@ -309,6 +297,7 @@ paths:
- RuntimeService
/v1/health/instances/{instanceId}:
get:
summary: InstanceHealth runs a health check on a specific instance.
operationId: RuntimeService_InstanceHealth
responses:
"200":
Expand Down Expand Up @@ -3958,6 +3947,20 @@ definitions:
properties:
instanceHealth:
$ref: '#/definitions/v1InstanceHealth'
v1IssueDevJWTRequest:
type: object
properties:
name:
type: string
email:
type: string
groups:
type: array
items:
type: string
admin:
type: boolean
title: Request message for RuntimeService.IssueDevJWT
v1IssueDevJWTResponse:
type: object
properties:
Expand Down
10 changes: 9 additions & 1 deletion proto/rill/runtime/v1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ service RuntimeService {
option (google.api.http) = {get: "/v1/ping"};
}

// Health runs a health check on the runtime.
rpc Health(HealthRequest) returns (HealthResponse) {
option (google.api.http) = {get: "/v1/health"};
}

// InstanceHealth runs a health check on a specific instance.
rpc InstanceHealth(InstanceHealthRequest) returns (InstanceHealthResponse) {
option (google.api.http) = {get: "/v1/health/instances/{instance_id}"};
}
Expand Down Expand Up @@ -206,8 +208,14 @@ service RuntimeService {
option (google.api.http) = {get: "/v1/instances/{instance_id}/connectors/notifiers"};
}

// Access management

// IssueDevJWT issues a JWT for mimicking a user in local development.
rpc IssueDevJWT(IssueDevJWTRequest) returns (IssueDevJWTResponse) {
option (google.api.http) = {get: "/v1/dev-jwt"};
option (google.api.http) = {
post: "/v1/dev-jwt",
body: "*"
};
}
}

Expand Down
7 changes: 7 additions & 0 deletions runtime/drivers/druid/druidsqldriver/druid_api_sql_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ func (c *sqlConnection) QueryContext(ctx context.Context, query string, args []d
return nil, err
}

// Druid sends well-formed response for 200, 400 and 500 status codes, for others use this
// ref - https://druid.apache.org/docs/latest/api-reference/sql-api/#responses
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusBadRequest && resp.StatusCode != http.StatusInternalServerError {
resp.Body.Close()
return nil, fmt.Errorf("unexpected status code: %d, status: %s", resp.StatusCode, resp.Status)
}

dec := json.NewDecoder(resp.Body)

var obj any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
TabsTrigger,
} from "@rilldata/web-common/components/tabs";
import { copyToClipboard } from "@rilldata/web-common/lib/actions/copy-to-clipboard";
export let createMagicAuthTokens: boolean;
</script>

<Popover>
Expand All @@ -24,7 +26,9 @@
<Tabs>
<TabsList>
<TabsTrigger value="tab1">Copy link</TabsTrigger>
<TabsTrigger value="tab2">Create public link</TabsTrigger>
{#if createMagicAuthTokens}
<TabsTrigger value="tab2">Create public link</TabsTrigger>
{/if}
</TabsList>
<TabsContent value="tab1" class="mt-0 p-4">
<div class="flex flex-col gap-y-2">
Expand Down
4 changes: 3 additions & 1 deletion web-admin/src/features/navigation/TopNavigationBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
isProjectPage,
} from "./nav-utils";
export let createMagicAuthTokens: boolean;
const user = createAdminServiceGetCurrentUser();
$: instanceId = $runtime?.instanceId;
Expand Down Expand Up @@ -175,7 +177,7 @@
{#if $user.isSuccess && $user.data.user && !onMagicLinkPage}
<CreateAlert />
<Bookmarks />
<ShareDashboardButton />
<ShareDashboardButton {createMagicAuthTokens} />
{/if}
</StateManagersProvider>
{/if}
Expand Down
8 changes: 7 additions & 1 deletion web-admin/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import { initPylonWidget } from "../features/help/initPylonWidget";
import TopNavigationBar from "../features/navigation/TopNavigationBar.svelte";
export let data;
$: ({ projectPermissions } = data);
// Motivation:
// - https://tkdodo.eu/blog/breaking-react-querys-api-on-purpose#a-bad-api
// - https://tkdodo.eu/blog/react-query-error-handling#the-global-callbacks
Expand Down Expand Up @@ -49,7 +53,9 @@
<main class="flex flex-col min-h-screen h-screen">
<BannerCenter />
{#if !isEmbed}
<TopNavigationBar />
<TopNavigationBar
createMagicAuthTokens={projectPermissions?.createMagicAuthTokens}
/>
{/if}
<ErrorBoundary>
<slot />
Expand Down
65 changes: 65 additions & 0 deletions web-admin/src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,68 @@ app in production. Here, we are setting server-side rendering (SSR) to false to
ensure the same single-page app behavior in development.
*/
export const ssr = false;

import type { V1ProjectPermissions } from "@rilldata/web-admin/client";
import { adminServiceGetProject } from "@rilldata/web-admin/client/index.js";
import { getAdminServiceGetProjectQueryKey } from "@rilldata/web-admin/client/index.js";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient.js";
import { error } from "@sveltejs/kit";
import type { QueryFunction, QueryKey } from "@tanstack/svelte-query";
import {
adminServiceGetProjectWithBearerToken,
getAdminServiceGetProjectWithBearerTokenQueryKey,
} from "../features/shareable-urls/get-project-with-bearer-token.js";

export const load = async ({ params }) => {
const { organization, project, token } = params;

if (!organization || !project) {
return {
projectPermissions: <V1ProjectPermissions>{},
};
}

let queryKey: QueryKey;
let queryFn: QueryFunction<
Awaited<ReturnType<typeof adminServiceGetProject>>
>;

if (token) {
queryKey = getAdminServiceGetProjectWithBearerTokenQueryKey(
organization,
project,
token,
{},
);

queryFn = ({ signal }) =>
adminServiceGetProjectWithBearerToken(
organization,
project,
token,
{},
signal,
);
} else {
queryKey = getAdminServiceGetProjectQueryKey(organization, project);

queryFn = ({ signal }) =>
adminServiceGetProject(organization, project, {}, signal);
}

try {
const response = await queryClient.fetchQuery({
queryFn,
queryKey,
});

const { projectPermissions } = response;

return {
projectPermissions,
};
} catch (e) {
console.error(e);
throw error(e.response.status, "Error fetching deployment");
}
};
Loading

1 comment on commit 88faba9

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉 Published on https://ui.rilldata.com as production
🚀 Deployed on https://668d6eb6bfe56bb346b4e129--rill-ui.netlify.app

Please sign in to comment.