Skip to content

Commit

Permalink
Feature: dashboards without time series (#1459)
Browse files Browse the repository at this point in the history
* queries-caching-impl

* queries-caching-impl

* caching for time grain query

* caching: column numeric histogram

* caching: column numeric histogram

* caching: table cardinality fix

* caching: rug histogram

* caching: time range

* caching: time range

* caching: column cardinality

* caching: rollup interval

* caching: column with all nulls

* caching: code style

* caching: rug

* caching: code style

* caching: ts fix

* caching: ts fix

* caching: ts fix

* caching: code style

* caching: timeseries

* caching: table columns

* caching: metricsview totals

* caching: metricsview toplist

* caching: metricsview toplist

* caching: metricsview timeseries

* Making metrics dashboard less strict

* adds rudimentary dashboard support for no time series

* Removing model path filter (#1488)

* Adding support for reading public buckets (#1491)

* Refresh when local file changes (#1489)

* Refresh when local file changes

* Fixing test failure

* spaces in timestamp column name (#1490)

* spaces in timestamp column name

* spaces in timestamp column name

* spaces in timestamp column name

Co-authored-by: egor-ryashin <[email protected]>

* npm install

* Temporarily disable docker releases

* Setup golangci-lint in rill-developer (#1417)

* golangci-lint initial commit

* added new line

* adding .golangci.yml config

* latest version and comment GH action on pull_request

* go version update

* go version update + prettier

* for current branch

* typo

* run with config file

* adding timeout

* commenting disable all

* default run

* setup go changes

* go setup changes

* lint version latest

* Adding golangci.yml file

* with config arg

* adding goreportcard-action

* removed some linters from enable list

* fix suggested by golangci linters

* updaing GH action args with config and verbose

* errors fix by linters

* trigger ci check

* trigger ci check

* trigger ci check

* trigger ci check

* fixed errcheck issues

* on push main branch and pull_request

* adding golangci-lint-setup for test

* golangci-lint error fix

* more fixes

* fixed statuscode const etc

* fixes after merging with main

* PR requested changes

* Fixed PR changes and other errors

* prettier on go-test.yml

* Final changes

* fixed PR requested changes

* fixed some more changes after merge with main branch

* reverted errcheck and gofumpt and fixed the changes

* gofmt

* updated CONTRIBUTING.md for golint setup

* updated GH actions for golint

* test action

* fixed some more errors from linters

* updated GH action and fixed typo

* udpated CONTRIBUTING.md for golint instructions

* changes in GH actions for golint

* Release notes 0.17 (#1497)

* release notes for 0.17

* fixing static image in docusaurus

* Maybe fixes builds

Co-authored-by: Marissa Gorlick <[email protected]>
Co-authored-by: Benjamin Egelund-Müller <[email protected]>

* Update 0.17.md

* Fix suppress tooltip not being reactive (#1493)

* [Dashboard] Fix jarring rearrange when include/exclude is toggled from filter pills (#1494)

* Fixing misused older types

* Fixing the jarring rearrange on toggling include/exclude

* Update help links to new docs structure (#1499)

Co-authored-by: Marissa Gorlick <[email protected]>

* Move design system to `web-common` (#1486)

* Move files from `web-local` to `web-common`

* Move files out of design system and into app

* Move utils into `web-common`

* Add typescript & eslint config files to `web-common`

* Update imports (design system)

* Delete blank file

* Update imports (application)

* Move duckdb data types to `web-common`

* Fix import of chip component

* Fix two missing imports

* Edit path in the menu component's README

* Add `svelte` as a `web-common` dependency

* Remove old paths from typscript and vite configs

* Fix imports in `/dev` routes

* Add back imports to fix lint

* Add `web-common` to tailwind config

* Move to one top-level `eslint` file

* Move `data-types` into `web-common/components`

* Move `data-graphic` into `web-common/components`

* Bugfix: show nav border

* Add more data file extensions to `.prettierignore`

* Fix prettier warning

* Publish nightly docker image (#1500)

* golint improvements  (#1502)

* skip proto files and only-new-issues is set true

* testing with adding few errors

* revert errors and commented dupl

* adding dupl

* dupl with thresold setting

* removed dupl linter

* removing only-new-issues

* Improved dimension validations

* Addressing PR comments

* Enable dashboards with no time dimension (#1544)

* Use RefreshedOn in runtime query cache (#1559)

* Remove timestamp required from CTA buttons

* Dashboard without time dimension

* Remove logs

* Add lint fixes

* Address review comments

* Use single container component

* Add grid to measures

* Increase max size for measures

* Metrics View: Value exclusion should keep nulls (#1535)

* exclude with nulls

* exclude with nulls

* exclude with nulls for timeseries

* Add explicit is null check instead of coalesce with UUID

* fix failing test

* Adress review + Resolve filter code duplication

Co-authored-by: egor-ryashin <[email protected]>
Co-authored-by: Nishant Bangarwa <[email protected]>
Co-authored-by: Benjamin Egelund-Müller <[email protected]>

* Remove redundant import

* Fix imports

* Remove time params

* Connection pool for DuckDB (#1405)

* connection pooling for duckdb

* close channel

* set pool size

* fix test

* fix stopping of pw

* formatting

* start mulitple jobs are getting unpaused

* conn pool dequeue

* fix test

* better concurrency test of priority worker

* comment

* Merging with context affinity

* Pass pool size through DSN

* Formatting

* Added a priority semaphore

* Update duckdb driver to use priority semaphore

* Maybe fix failing test case

* Document priorityqueue.Semaphore

* Bind time series to one connection

* Use sqlx.Conn + fix hanging errors

* Temporarily committing spending benchmark in examples

* fix failing test

* formatting

* Commit js benchmark

* Removing benchmarks

* duckdb driver fix, tests with pool size > 1, separate meta connection

* use conn from pool in migrate

* use single conn in migrate

* use built in connection pool

* fix conn release race condition

* fix linter errors

* fmt

* gofmt fix

* gofmt fix

* fix tests

* upgrade duckdb driver

* Meta and OLAP sems; ensuring safe release

* Use WithConnection for temporary tables

* formatting

* Review

Co-authored-by: Benjamin Egelund-Müller <[email protected]>

* Improve handling of time ranges (#1560)

* Improve handling of time ranges (maybe)

* Run prettier

* Update tests

* Update web-local/src/lib/temp/time-control-types.ts

Co-authored-by: Hamilton Ulmer <[email protected]>

* Make `rill init` Fail When Passed Arguments (Probably By Accident) (#1566)

Make `rill init --example <example>` fail instead of quietly using the
"default" example project when used instead of `--example=example`.

The latter form is required due to a bug in cobra.  See
#1398 (comment)

* Left align measures

* Change copy, add tooltips

* Remove CTA from metrics no timeseries icon

* dyanamic number of columns upto 3 based on measures

* Fix nightly builds

* Remove old runtime release CI

* more from r to f for integer formatting in summary numbers (#1572)

* Show error on refresh failure (#1492)

* Show error on refresh failure

* Improving error display in sources

* Fix lint

* Fixing navigation blocked during profiling (#1561)

* Release notes 0.18 (#1565)

* release notes for 0.18

* Update 0.18.md

Co-authored-by: Marissa Gorlick <[email protected]>

* Handle long labels

* Increase margin top to 20

* For measures with timeseries align center

* Align measures on the left side

* Align measures with timecharts

* Align measures from the top

* Increase gap between measures

* use observer in measures container

* changes the edit tooltip (#1575)

* When a model query is blank, hide the table & inspector (#1568)

* adds in a placeholder when a model is blank

* ensures preview table is hidden when model is empty

* makes a more dramatic yet more subtle style for empty models

* Fix S3 Region not recognised (#1583)

* changing aws.region to region

* fixing ci

* Add S3/GCS region to docs (#1581)

* Add region to docs

As proposed in #1577

* Update project-files.md

* Update project-files.md

* Check rows.Err() after all relevant queries (#1540)

* check rows.Err() after all relevant DB queries

* removed extra lines

* fixed test cases

* requested changes

* adding err check for drivers.Result

* revert deleted code

* Use measure height and prevent overflow

* Dispatch trigger for nightlies (#1586)

* Testing trigger dynamics

* Enable manual nightly trigger

* Typo

* Improve comments

* Glob support for local_file, S3 and GCS (#1578)

* initial commit

* download plus ingestion support

* adding config for limit

* linting issues

* linting issues

* const name declaration

* ut fix

* config fix

* config fix

* batch mode fix

* read parquet changes

* ingestion by folder

* review comments

* unused code

* relative local paths

* local invalid path handling

* review nit picks

* review nit picks

* Update error messages

Co-authored-by: anshul khandelwal <[email protected]>
Co-authored-by: Benjamin Egelund-Müller <[email protected]>

* Adding gci for import grouping (#1587)

* adding gci for import groupin

* cleanup requested changes

* Run DuckDB tests in CI (#1584)

* fix olap test

* run duckdb olap test always

* Reflow measures on window resize

* Fix spinner alignment

* reflow on resize

* Use max content for measures

Co-authored-by: Benjamin Egelund-Müller <[email protected]>
Co-authored-by: Egor Riashin <[email protected]>
Co-authored-by: egor-ryashin <[email protected]>
Co-authored-by: Nishant Bangarwa <[email protected]>
Co-authored-by: Parag Jain <[email protected]>
Co-authored-by: Hamilton Ulmer <[email protected]>
Co-authored-by: Christian G. Warden <[email protected]>
Co-authored-by: Aditya Hegde <[email protected]>
Co-authored-by: Marissa Gorlick <[email protected]>
Co-authored-by: Marissa Gorlick <[email protected]>
Co-authored-by: rakeshsharma14317 <[email protected]>
Co-authored-by: marcelteraflow <[email protected]>
Co-authored-by: Anshul <[email protected]>
Co-authored-by: anshul khandelwal <[email protected]>

* Check for zero heights

* address PR comments

* Increase column gap and fix node bug

Co-authored-by: egor-ryashin <[email protected]>
Co-authored-by: Hamilton Ulmer <[email protected]>
Co-authored-by: Egor Riashin <[email protected]>
Co-authored-by: Benjamin Egelund-Müller <[email protected]>
Co-authored-by: rakeshsharma14317 <[email protected]>
Co-authored-by: Marissa Gorlick <[email protected]>
Co-authored-by: Marissa Gorlick <[email protected]>
Co-authored-by: Eric P Green <[email protected]>
Co-authored-by: Himadri Singh <[email protected]>
Co-authored-by: Dhiraj Barnwal <[email protected]>
Co-authored-by: Nishant Bangarwa <[email protected]>
Co-authored-by: Parag Jain <[email protected]>
Co-authored-by: Christian G. Warden <[email protected]>
Co-authored-by: Marissa Gorlick <[email protected]>
Co-authored-by: marcelteraflow <[email protected]>
Co-authored-by: Anshul <[email protected]>
Co-authored-by: anshul khandelwal <[email protected]>
  • Loading branch information
18 people authored and bcolloran committed Mar 6, 2023
1 parent 33e9a24 commit 0d52da4
Show file tree
Hide file tree
Showing 37 changed files with 2,216 additions and 2,020 deletions.
3,344 changes: 1,566 additions & 1,778 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 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.

22 changes: 19 additions & 3 deletions runtime/services/catalog/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,23 @@ func TestReconcileMetricsView(t *testing.T) {
// dropping the timestamp column gives a different error
require.Equal(t, metricsviews.TimestampNotFound, result.Errors[0].Message)

// remove timestamp all together
time.Sleep(time.Millisecond * 10)
err = s.Repo.Put(context.Background(), s.InstID, AdBidsDashboardRepoPath, strings.NewReader(`model: AdBids_model
dimensions:
- label: Publisher
property: publisher
- label: Domain
property: domain
measures:
- expression: count(*)
- expression: avg(bid_price)
`))
result, err = s.Reconcile(context.Background(), catalog.ReconcileConfig{})
require.NoError(t, err)
// no error if timestamp is not set
testutils.AssertMigration(t, result, 0, 1, 0, 0, []string{AdBidsDashboardRepoPath})

testutils.CreateModel(t, s, "AdBids_model", "select id, timestamp, publisher from AdBids", AdBidsModelRepoPath)
result, err = s.Reconcile(context.Background(), catalog.ReconcileConfig{})
require.NoError(t, err)
Expand All @@ -508,7 +525,6 @@ timeseries: timestamp
timegrains:
- 1 day
- 1 month
default_timegrain: ""
dimensions:
- label: Publisher
property: publisher
Expand Down Expand Up @@ -578,8 +594,8 @@ measures:
require.NoError(t, err)
result, err = s.Reconcile(context.Background(), catalog.ReconcileConfig{})
require.NoError(t, err)
testutils.AssertMigration(t, result, 1, 0, 0, 0, []string{AdBidsDashboardRepoPath})
require.Equal(t, metricsviews.MissingDimension, result.Errors[0].Message)
// no error if there are no dimensions
testutils.AssertMigration(t, result, 0, 1, 0, 0, []string{AdBidsDashboardRepoPath})
}

func TestInvalidFiles(t *testing.T) {
Expand Down
37 changes: 10 additions & 27 deletions runtime/services/catalog/migrator/metricsviews/metrics_views.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"strconv"
"strings"

runtimev1 "github.com/rilldata/rill/proto/gen/rill/runtime/v1"
"github.com/rilldata/rill/runtime/drivers"
Expand Down Expand Up @@ -51,9 +52,6 @@ func (m *metricsViewMigrator) Validate(ctx context.Context, olap drivers.OLAPSto
if mv.Model == "" {
return migrator.CreateValidationError(catalog.Path, SourceNotSelected)
}
if mv.TimeDimension == "" {
return migrator.CreateValidationError(catalog.Path, TimestampNotSelected)
}
model, err := olap.InformationSchema().Lookup(ctx, mv.Model)
if err != nil {
if errors.Is(err, drivers.ErrNotFound) {
Expand All @@ -64,33 +62,28 @@ func (m *metricsViewMigrator) Validate(ctx context.Context, olap drivers.OLAPSto

fieldsMap := make(map[string]*runtimev1.StructType_Field)
for _, field := range model.Schema.Fields {
fieldsMap[field.Name] = field
fieldsMap[strings.ToLower(field.Name)] = field
}

if _, ok := fieldsMap[mv.TimeDimension]; !ok {
return migrator.CreateValidationError(catalog.Path, TimestampNotFound)
// if a time dimension is selected it should exist
if mv.TimeDimension != "" {
if _, ok := fieldsMap[strings.ToLower(mv.TimeDimension)]; !ok {
return migrator.CreateValidationError(catalog.Path, TimestampNotFound)
}
}

var validationErrors []*runtimev1.ReconcileError

for i, dimension := range mv.Dimensions {
err := validateDimension(ctx, model, dimension)
if err != nil {
if _, ok := fieldsMap[strings.ToLower(dimension.Name)]; !ok {
validationErrors = append(validationErrors, &runtimev1.ReconcileError{
Code: runtimev1.ReconcileError_CODE_VALIDATION,
FilePath: catalog.Path,
Message: err.Error(),
Message: fmt.Sprintf("dimension not found: %s", dimension.Name),
PropertyPath: []string{"Dimensions", strconv.Itoa(i)},
})
}
}
if len(mv.Dimensions) == 0 {
validationErrors = append(validationErrors, &runtimev1.ReconcileError{
Code: runtimev1.ReconcileError_CODE_VALIDATION,
FilePath: catalog.Path,
Message: MissingDimension,
})
}

for i, measure := range mv.Measures {
err := validateMeasure(ctx, olap, model, measure)
Expand All @@ -103,6 +96,7 @@ func (m *metricsViewMigrator) Validate(ctx context.Context, olap drivers.OLAPSto
})
}
}
// at least one measure has to be there in the metrics view
if len(mv.Measures) == 0 {
validationErrors = append(validationErrors, &runtimev1.ReconcileError{
Code: runtimev1.ReconcileError_CODE_VALIDATION,
Expand All @@ -123,17 +117,6 @@ func (m *metricsViewMigrator) ExistsInOlap(ctx context.Context, olap drivers.OLA
return true, nil
}

func validateDimension(ctx context.Context, model *drivers.Table, dimension *runtimev1.MetricsView_Dimension) error {
for _, field := range model.Schema.Fields {
// TODO: check type
if field.Name == dimension.Name {
return nil
}
}

return fmt.Errorf("dimension not found: %s", dimension.Name)
}

func validateMeasure(ctx context.Context, olap drivers.OLAPStore, model *drivers.Table, measure *runtimev1.MetricsView_Measure) error {
err := olap.Exec(ctx, &drivers.Statement{
Query: fmt.Sprintf("SELECT %s from %s", measure.Expression, model.Name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,12 @@
</script>

<MenuItem
disabled={!schemaHasTimestampColumn(model?.schema)}
icon
on:select={() => createDashboardFromModel(modelName)}
propogateSelect={false}
>
<Explore slot="icon" />
Autogenerate dashboard
<svelte:fragment slot="description">
{#if !schemaHasTimestampColumn(model?.schema)}
Requires a timestamp column
{/if}
</svelte:fragment>
</MenuItem>
<Divider />
<MenuItem
Expand Down
15 changes: 14 additions & 1 deletion web-common/src/features/models/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { useRuntimeServiceListFiles } from "@rilldata/web-common/runtime-client";
import {
useRuntimeServiceGetFile,
useRuntimeServiceListFiles,
} from "@rilldata/web-common/runtime-client";

export function useModelNames(instanceId: string) {
return useRuntimeServiceListFiles(
Expand All @@ -21,3 +24,13 @@ export function useModelNames(instanceId: string) {
}
);
}

export function useModelFileIsEmpty(instanceId, modelName) {
return useRuntimeServiceGetFile(instanceId, `/models/${modelName}.sql`, {
query: {
select(data) {
return data?.blob?.length === 0;
},
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
modelName
);
$: model = $getModel.data?.entry?.model;
$: timestampColumns = selectTimestampColumnFromSchema(model?.schema);
$: dashboardNames = useDashboardNames($runtimeStore.instanceId);
const queryClient = useQueryClient();
Expand Down Expand Up @@ -103,21 +102,13 @@
</script>

<Tooltip alignment="right" distance={16} location="bottom">
<Button
disabled={!timestampColumns?.length}
on:click={handleCreateDashboard}
type="primary"
>
<Button on:click={handleCreateDashboard} type="primary">
<ResponsiveButtonText {collapse}>Create Dashboard</ResponsiveButtonText>
<Explore size="14px" /></Button
>
<TooltipContent slot="tooltip-content">
{#if hasError}
Fix the errors in your model to autogenerate dashboard
{:else if timestampColumns?.length}
Generate a dashboard based on your model
{:else}
Add a timestamp column to your model in order to generate a dashboard
{/if}
</TooltipContent>
</Tooltip>
4 changes: 2 additions & 2 deletions web-common/src/features/models/workspace/ModelBody.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import { getContext } from "svelte";
import type { Writable } from "svelte/store";
import { slide } from "svelte/transition";
import { modelIsEmpty } from "../utils/model-is-empty";
import { useModelFileIsEmpty } from "../selectors";
import { sanitizeQuery } from "../utils/sanitize-query";
import Editor from "./Editor.svelte";
Expand All @@ -57,7 +57,7 @@
$: modelError = $fileArtifactsStore.entities[modelPath]?.errors[0]?.message;
$: modelSqlQuery = useRuntimeServiceGetFile(runtimeInstanceId, modelPath);
$: modelEmpty = modelIsEmpty(runtimeInstanceId, modelName);
$: modelEmpty = useModelFileIsEmpty(runtimeInstanceId, modelName);
$: modelSql = $modelSqlQuery?.data?.blob;
$: hasModelSql = typeof modelSql === "string";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { createResizeListenerActionFactory } from "@rilldata/web-common/lib/actions/create-resize-listener-factory";
import { runtimeStore } from "@rilldata/web-local/lib/application-state-stores/application-store";
import { modelIsEmpty } from "../../utils/model-is-empty";
import { useModelFileIsEmpty } from "../../selectors";
import ModelInspectorHeader from "./ModelInspectorHeader.svelte";
import ModelInspectorModelProfile from "./ModelInspectorModelProfile.svelte";
Expand All @@ -10,7 +10,7 @@
const { observedNode, listenToNodeResize } =
createResizeListenerActionFactory();
$: emptyModel = modelIsEmpty($runtimeStore?.instanceId, modelName);
$: emptyModel = useModelFileIsEmpty($runtimeStore?.instanceId, modelName);
</script>

{#if !$emptyModel?.data}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,12 @@
</MenuItem>

<MenuItem
disabled={!schemaHasTimestampColumn(source?.schema)}
icon
on:select={() => handleCreateDashboardFromSource(sourceName)}
propogateSelect={false}
>
<Explore slot="icon" />
Autogenerate dashboard
<svelte:fragment slot="description">
{#if !schemaHasTimestampColumn(source?.schema)}
Requires a timestamp column
{/if}
</svelte:fragment>
</MenuItem>

{#if $getSource?.data?.entry?.source?.connector === "local_file"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
useAllNames,
useCreateDashboardFromSource,
} from "@rilldata/web-local/lib/svelte-query/actions";
import { selectTimestampColumnFromSchema } from "@rilldata/web-local/lib/svelte-query/column-selectors";
import { useDashboardNames } from "@rilldata/web-local/lib/svelte-query/dashboards";
import { invalidateAfterReconcile } from "@rilldata/web-local/lib/svelte-query/invalidation";
import { getRouteFromName } from "@rilldata/web-local/lib/util/entity-mappers";
Expand Down Expand Up @@ -73,8 +72,7 @@
const createModelMutation = useRuntimeServicePutFileAndReconcile();
const createDashboardFromSourceMutation = useCreateDashboardFromSource();
$: timestampColumns = selectTimestampColumnFromSchema(source?.schema);
let connector: string;
$: connector = $getSource.data?.entry?.source.connector as string;
$: allNamesQuery = useAllNames(runtimeInstanceId);
Expand Down Expand Up @@ -285,24 +283,19 @@
</TooltipContent>
</Tooltip>
{#if !embedded}
<Tooltip location="bottom" alignment="right" distance={16}>
<Tooltip alignment="right" distance={16} location="bottom">
<Button
type="primary"
disabled={!timestampColumns?.length}
on:click={() => handleCreateDashboardFromSource(sourceName)}
type="primary"
>
<ResponsiveButtonText collapse={width < 1100}>
<ResponsiveButtonText collapse={width < 800}>
Create Dashboard
</ResponsiveButtonText>

<Explore size="16px" />
</Button>
<TooltipContent slot="tooltip-content">
{#if timestampColumns?.length}
Create a dashboard for this source
{:else}
This data source does not have a TIMESTAMP column
{/if}
Create a dashboard for this source
</TooltipContent>
</Tooltip>
{/if}
Expand Down
6 changes: 3 additions & 3 deletions web-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"@babel/preset-env": "^7.16.11",
"@playwright/test": "^1.28.1",
"@rollup/plugin-typescript": "^8.3.1",
"@sveltejs/adapter-static": "^1.0.0-next.41",
"@sveltejs/kit": "^1.0.0-next.463",
"@sveltejs/adapter-static": "^1.0.0",
"@sveltejs/kit": "^1.0.0",
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/svelte": "^3.1.0",
"@types/jest": "^27.4.1",
Expand All @@ -57,7 +57,7 @@
"should": "^13.2.3",
"sinon": "^15.0.0",
"supertest": "^6.2.4",
"svelte-check": "^2.8.0",
"svelte-check": "^2.10.2",
"svelte-jester": "^2.3.2",
"svelte-preprocess": "^4.10.7",
"tailwindcss": "^3.0.23",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ export function addQuickMetricsToDashboardYAML(yaml: string, model: V1Model) {
doc.set("model", model.name);

const timestampColumns = selectTimestampColumnFromSchema(model?.schema);
doc.set("timeseries", timestampColumns[0]);
if (timestampColumns?.length) {
doc.set("timeseries", timestampColumns[0]);
} else {
doc.set("timeseries", "");
}

const measureNode = doc.createNode({
label: "Total records",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,18 @@
class="flex flex-row items-center ui-copy-muted"
style:grid-column-gap=".4rem"
in:send={{ key: "leaderboard-metric" }}
style:max-width="355px"
>
<div>Dimension Leaders by</div>
<div class="whitespace-nowrap">Dimension Leaders by</div>

<SelectMenu
{options}
{selection}
tailwindClasses="overflow-hidden"
alignment="end"
on:select={handleMeasureUpdate}
>
<span class="font-bold">{selection?.main}</span>
<span class="font-bold truncate">{selection?.main}</span>
</SelectMenu>
</div>
{:else}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@
);
};
$: if (
$metricsInternalRep.getMetricKey("model") === "" ||
$metricsInternalRep.getMetricKey("timeseries") === ""
) {
$: if ($metricsInternalRep.getMetricKey("model") === "") {
buttonDisabled = true;
buttonStatus = "MISSING_MODEL_OR_TIMESTAMP";
buttonStatus = "MISSING_MODEL";
} else if (
// check if all the measures have a valid expression
measures?.filter((measure) => measure?.expression?.length)?.length === 0 ||
Expand All @@ -63,8 +60,8 @@
</Button>
<TooltipContent slot="tooltip-content">
<div>
{#if buttonStatus === "MISSING_MODEL_OR_TIMESTAMP"}
Select a model and a timestamp column before exploring metrics
{#if buttonStatus === "MISSING_MODEL"}
Select a model before exploring metrics
{:else if buttonStatus === "MISSING_MEASURES_OR_DIMENSIONS"}
Add measures and dimensions before exploring metrics
{:else}
Expand Down
Loading

0 comments on commit 0d52da4

Please sign in to comment.