Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpgreen2 committed Jan 28, 2025
1 parent ede3cdf commit a0fea42
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
7 changes: 1 addition & 6 deletions web-common/src/features/connectors/olap/TableEntry.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@
});
$: showSchema = $expandedStore;
const {
allowContextMenu,
allowNavigateToTable,
allowShowSchema,
allowSelectTable,
} = store;
const { allowContextMenu, allowNavigateToTable, allowShowSchema } = store;
$: fullyQualifiedTableName = makeFullyQualifiedTableName(
driver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ export class WatchResourcesClient {
);

// Remove the connector's state from the connector explorer store
connectorExplorerStore.deleteItem(res.name.name);
connectorExplorerStore.deleteItem({
connector: res.name.name,
});

// Done
return;
Expand Down
18 changes: 6 additions & 12 deletions web-common/src/features/welcome/ProjectCards.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import { MetricsEventSpace } from "../../metrics/service/MetricsTypes";
import { createRuntimeServiceUnpackExample } from "../../runtime-client";
import { runtime } from "../../runtime-client/runtime-store";
import { EMPTY_PROJECT_TITLE } from "./constants";
const unpackExampleProject = createRuntimeServiceUnpackExample();
Expand Down Expand Up @@ -42,26 +41,21 @@
$: ({ mutateAsync: unpackExample } = $unpackExampleProject);
async function unpackProject(example?: (typeof EXAMPLES)[number]) {
selectedProjectName = example ? example.name : EMPTY_PROJECT_TITLE;
async function unpackProject(example: (typeof EXAMPLES)[number]) {
selectedProjectName = example.name;
await behaviourEvent?.fireSplashEvent(
example
? BehaviourEventAction.ExampleAdd
: BehaviourEventAction.ProjectEmpty,
BehaviourEventAction.ExampleAdd,
BehaviourEventMedium.Card,
MetricsEventSpace.Workspace,
example?.name,
selectedProjectName,
);
const mutationFunction = example ? unpackExample : unpackEmpty;
const key = example ? "name" : "displayName";
try {
await mutationFunction({
await unpackExample({
instanceId,
data: {
[key]: selectedProjectName,
name: selectedProjectName,
force: true,
},
});
Expand Down
29 changes: 18 additions & 11 deletions web-common/src/features/welcome/wizard/onboarding-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
runtimeServiceListFiles,
runtimeServicePutFile,
runtimeServiceUnpackEmpty,
type V1GetFileResponse,
type V1ListFilesResponse,
} from "../../../runtime-client";
import { runtime } from "../../../runtime-client/runtime-store";
Expand Down Expand Up @@ -80,9 +81,11 @@ export class OnboardingState {
await this.save();
}

async fetch() {
async fetchAndParse() {
let response: V1GetFileResponse;

try {
const response = await queryClient.fetchQuery({
response = await queryClient.fetchQuery({
queryKey: getRuntimeServiceGetFileQueryKey(this.runtimeInstanceId, {
path: ONBOARDING_STATE_FILE_PATH,
}),
Expand All @@ -91,23 +94,27 @@ export class OnboardingState {
path: ONBOARDING_STATE_FILE_PATH,
}),
});

// parse the state
const state = JSON.parse(response.blob);

// set the state
this.managementType = writable(state.managementType);
this.olapDriver = writable(state.olapDriver);
this.firstDataSource = writable(state.firstDataSource);
return;
} catch (error) {
if (error?.response?.data?.message?.includes("no such file")) {
await this.initializeOnboardingState();
return;
} else {
console.error("throwing error", error);
throw error;
}
}

if (!response.blob) {
throw new Error("No file content found");
}

// parse the state
const state = JSON.parse(response.blob);

// set the state
this.managementType = writable(state.managementType);
this.olapDriver = writable(state.olapDriver);
this.firstDataSource = writable(state.firstDataSource);
}

async save() {
Expand Down
6 changes: 3 additions & 3 deletions web-common/src/features/workspaces/VisualMetrics.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
const { clickhouseModeling } = featureFlags;
const store = connectorExplorerStore.duplicateStore(
(connector, database, schema, table) => {
if (!table || !schema) return;
({ connector, database, databaseSchema, table }) => {
if (!table || !databaseSchema) return;
confirmation = {
action: "switch",
connector,
database,
schema,
schema: databaseSchema,
model: table,
};
Expand Down
2 changes: 1 addition & 1 deletion web-local/src/routes/welcome/(wizard)/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function load({ parent }) {
if (!(await onboardingState.isOnboardingStateFilePresent())) {
await onboardingState.initializeOnboardingState().catch(console.error);
} else {
await onboardingState.fetch().catch(console.error);
await onboardingState.fetchAndParse().catch(console.error);
}

return { onboardingState };
Expand Down

0 comments on commit a0fea42

Please sign in to comment.