Skip to content

Commit

Permalink
small UX and client fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Nov 8, 2022
1 parent a658308 commit a146aa3
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 32 deletions.
1 change: 1 addition & 0 deletions backend/parsers/windmill-parser-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ fn constant_to_value(c: &Constant) -> serde_json::Value {

static PYTHON_IMPORTS_REPLACEMENT: phf::Map<&'static str, &'static str> = phf_map! {
"psycopg2" => "psycopg2-binary",
"yaml" => "pyyaml",
"git" => "GitPython"
};

Expand Down
10 changes: 7 additions & 3 deletions deno-client/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function getResource(path: string, undefinedIfEmpty?: boolean): Pro
if (undefinedIfEmpty && e.status === 404) {
return undefined
} else {
throw e
throw Error(`Resource not found at ${path} or not visible to you`)
}
}
}
Expand Down Expand Up @@ -108,8 +108,12 @@ export async function getInternalState(suffix?: string): Promise<any> {
*/
export async function getVariable(path: string): Promise<string | undefined> {
const workspace = getWorkspace()
const variable = await VariableService.getVariable({ workspace, path })
return variable.value
try {
const variable = await VariableService.getVariable({ workspace, path })
return variable.value
} catch (e: any) {
throw Error(`Variable not found at ${path} or not visible to you`)
}
}

async function transformLeaves(d: { [key: string]: any }): Promise<{ [key: string]: any }> {
Expand Down
16 changes: 6 additions & 10 deletions frontend/src/lib/components/AppConnect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import Icon from 'svelte-awesome'
import Password from './Password.svelte'
import Path from './Path.svelte'
import { Button, Drawer } from './common'
import { Alert, Button, Drawer } from './common'
import DrawerContent from './common/drawer/DrawerContent.svelte'
let manual = false
Expand Down Expand Up @@ -195,15 +195,11 @@
<DrawerContent title="Connect an API" on:close={drawer.closeDrawer}>
{#if step == 1}
{#if resource_type && !connects[resource_type] && !connectsManual.find((x) => x[0] == resource_type)}
<div class="bg-red-100 border-l-4 border-red-600 text-orange-700 p-4" role="alert">
<p class="font-bold">No API integration for {resource_type}</p>
<p>
The resource type "{resource_type}" seems to not have an OAuth API integration. You can
still create this resource manually by closing this modal and pressing: "Add a
resource". You can also contribute to windmill and add it as an API integration if
relevant.
</p>
</div>
<Alert class="mb-4" type="error" title="Resource type not found">
The resource type "{resource_type}" seems to not have an OAuth API integration. You can
still create this resource manually by closing this modal and pressing: "Add a resource".
You can also contribute to windmill and add it as an API integration if relevant.
</Alert>
{/if}
<div class="mb-1 font-semibold text-gray-700">OAuth APIs</div>
<div class="grid sm:grid-cols-2 md:grid-cols-3 gap-x-2 gap-y-1 items-center mb-2">
Expand Down
11 changes: 5 additions & 6 deletions frontend/src/lib/components/EditorBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { getScriptByPath, loadHubScripts, sendUserToast } from '$lib/utils'
import {
faCircle,
faCode,
faCube,
faDollarSign,
Expand Down Expand Up @@ -198,10 +197,10 @@
loadItems={async () =>
await ResourceService.listResource({ workspace: $workspaceStore ?? 'NO_W' })}
>
<div slot="submission" class="flex flex-row">
<div class="text-xs mr-2 align-middle">
The resource you were looking for does not exist yet?
</div>
<div slot="submission" class="flex flex-row gap-x-1">
<Button target="_blank" color="blue" size="sm" href="/resources?connect_app=undefined">
Connect an API
</Button>
<Button
variant="border"
color="blue"
Expand All @@ -210,7 +209,7 @@
resourceEditor.initNew()
}}
>
Create a new resource
New custom resource
</Button>
</div>
</ItemPicker>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/FlowMetadata.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
{@const viewHref = `${stem}/get/${isScript ? job?.script_hash : job?.script_path}`}
<div>
<Icon class="text-gray-700" data={faScroll} scale={SMALL_ICON_SCALE} /><span class="mx-2">
{job?.job_kind}:
<a href={viewHref}>{isScript ? job?.script_hash : job?.script_path}</a>
</span>
</div>
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/lib/components/ResourceEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,6 @@
>
Create a new variable
</Button>
<div class="text-xs mr-2 align-middle">
The variable you were looking for does not exist yet?
</div>
</div>
</ItemPicker>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/common/alert/Alert.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
</script>

<div class={classNames('rounded-md p-4', classes[type].bgClass)}>
<div class={classNames('rounded-md p-4', classes[type].bgClass, $$props.class)}>
<div class="flex">
<div class="flex h-8 w-8 items-center justify-center rounded-full">
<Icon data={icons[type]} class={classes[type].iconClass} />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/common/button/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
event.preventDefault()
dispatch('click', event)
if (href) {
if (href.startsWith('http')) {
if (href.startsWith('http') || target == '_blank') {
window.open(href, target)
} else {
goto(href)
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/routes/resources.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
appConnect.openFromOauth(resource_type)
}
if ($page.url.searchParams.get('connect_app')) {
appConnect.open($page.url.searchParams.get('connect_app') ?? undefined)
const rt = $page.url.searchParams.get('connect_app') ?? undefined
if (rt == 'undefined') {
appConnect.open()
} else {
appConnect.open(rt)
}
}
})
</script>
Expand Down Expand Up @@ -217,7 +222,7 @@
</Button>
</div>
</PageHeader>
<div class="relative overflow-auto">
<div class="overflow-x-auto pb-40 pr-4">
{#if loading.resources}
<Skeleton layout={[0.5, [2], 1]} />
{#each new Array(6) as _}
Expand Down Expand Up @@ -311,7 +316,7 @@
}
}
]}
relative={false}
relative={true}
/>
</td>
</tr>
Expand All @@ -325,7 +330,6 @@
</TableCustom>
{/if}
</div>
<div class="py-10" />
<PageHeader
title="Resources types"
primary={false}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/routes/variables.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</PageHeader>

<VariableEditor bind:this={variableEditor} on:create={loadVariables} />
<div class="relative overflow-auto">
<div class="relative overflow-x-auto pb-40 pr-4">
{#if loading.variables}
<Skeleton layout={[0.5, [2], 1]} />
{#each new Array(3) as _}
Expand Down Expand Up @@ -198,7 +198,7 @@
]
: [])
]}
relative={false}
relative={true}
/></td
>
</tr>
Expand All @@ -215,7 +215,6 @@
loadVariables()
}}
/>
<div class="my-10" />

<PageHeader
title="Contextual Variables"
Expand Down

0 comments on commit a146aa3

Please sign in to comment.