Skip to content

Commit

Permalink
feat: user settings is now at workspace level
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed May 8, 2022
1 parent fd1f05d commit a130806
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 56 deletions.
16 changes: 0 additions & 16 deletions frontend/CaddyfileDemo

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/routes/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
>
<span class="block px-4 py-2 text-sm text-gray-500">{$usersWorkspaceStore?.email}</span>
<a
href="/settings"
href="/user/settings"
class="block px-4 py-2 text-sm text-gray-700"
role="menuitem"
tabindex="-1"
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/routes/user/CenteredModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import { SettingsService } from '../../gen';
export let subtitle: string | undefined = undefined;
export let title = 'Welcome to windmill.dev (alpha)';
export let title = 'Welcome to Windmill (beta)';
let version = '';
SettingsService.backendVersion().then((x) => {
version = x;
});
</script>

<div class="flex justify-center h-screen bg-gray-50">
<div class="w-10/12 md:w-7/12 lg:w-4/12 xl:3/12 m-auto">
<div class="flex justify-center min-h-screen bg-gray-50 pt-10">
<div class="w-10/12 md:w-7/12 lg:w-6/12 xl:4/12 m-auto">
<h1 class="justify-center text-center font-medium pb-2 text-gray-700">
{title}
</h1>
Expand All @@ -27,7 +27,7 @@
<!-- empty row to make the form a little bit above vertical centering-->
<div class="py-12" />
</div>
<div class="absolute bottom-0 right-0 text-2xs text-gray-500 italic px-3 py-1">
<div class="absolute top-0 right-0 text-2xs text-gray-500 italic px-3 py-1">
windmill.dev backend v. <span class="font-mono">{version}</span>
</div>
</div>
6 changes: 3 additions & 3 deletions frontend/src/routes/user/login@user.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@

<!-- Enable submit form on enter -->
<CenteredModal subtitle={error}>
<div class="justify-center text-center">
<div class="justify-center text-center flex flex-col">
<span class="text-xs text-gray-600">Currently only signup through Github is supported</span>
<a rel="external" href="/api/oauth/login/github"
><button class="w-full default-button bg-black mt-2 py-2"
><button class="m-auto default-button bg-black mt-2 py-2 w-96"
>Signup or login with Github &nbsp;
<Icon class="text-white pb-1" data={faGithub} scale={1.4} />
</button></a
>
</div>
<div class="flex flex-row-reverse w-full">
<button
class="my-6 text-xs text-blue-400"
class="my-6 text-xs text-blue-400 m-auto"
id="showPassword"
on:click={() => {
showPassword = !showPassword;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<script lang="ts">
import { userStore, workspaceStore } from '../stores';
import { usersWorkspaceStore } from '../../stores';
import { onMount } from 'svelte';
import type { TruncatedToken, NewToken } from '../gen';
import { UserService, SettingsService } from '../gen';
import { displayDate, sendUserToast, getToday } from '../utils';
import PageHeader from './components/PageHeader.svelte';
import CenteredPage from './components/CenteredPage.svelte';
import type { TruncatedToken, NewToken } from '../../gen';
import { UserService, SettingsService } from '../../gen';
import { displayDate, sendUserToast, getToday } from '../../utils';
import PageHeader from './../components/PageHeader.svelte';
import Icon from 'svelte-awesome';
import { faPlus } from '@fortawesome/free-solid-svg-icons';
import TableCustom from './components/TableCustom.svelte';
import TableCustom from '../components/TableCustom.svelte';
import CenteredModal from './CenteredModal.svelte';
let newPassword: string | undefined;
let passwordError: string | undefined;
Expand All @@ -21,14 +20,6 @@
let displayCreateToken = false;
let login_type = 'none';
function handleKeyUp(event: KeyboardEvent) {
const key = event.key || event.keyCode;
if (key === 13 || key === 'Enter') {
event.preventDefault();
setPassword();
}
}
async function setPassword(): Promise<void> {
try {
if (newPassword) {
Expand Down Expand Up @@ -90,30 +81,29 @@
loadVersion();
loadLoginType();
$: {
if ($workspaceStore) {
listTokens();
}
}
listTokens();
</script>

<CenteredPage>
<PageHeader title="User settings" />
<CenteredModal title="User settings">
<div class="flex flex-row justify-between">
<a href="/user/workspaces">&leftarrow; Back to workspaces</a>
</div>
<div class="text-2xs text-gray-500 italic pb-6">
Running windmill version (backend) {version}
</div>
<h2 class="border-b">Change password</h2>
<h2 class="border-b">User info</h2>
<div class="">
{#if passwordError}
<div class="text-purple-500 text-2xs grow">{passwordError}</div>
{/if}
<div class="flex flex-col gap-2 w-full ">
<div class="mt-4">
<label class="block w-60 mb-2 text-gray-500">
<input disabled value={$userStore?.email ?? ''} class="input mt-1" />
<div class="text-gray-700">email</div>
<input disabled value={$usersWorkspaceStore?.email} class="input mt-1" />
</label>
{#if login_type == 'password'}
<label class="block w-12/12">
<label class="block w-120">
<div class="text-gray-700">password</div>
<input
type="password"
Expand All @@ -131,6 +121,7 @@
text-sm
"
/>
<button on:click={() => setPassword()} class="mt-4 default-button">Set password</button>
</label>
{:else if login_type == 'github'}
<span>Authentified through Github OAuth2. Cannot set a password.</span>
Expand Down Expand Up @@ -243,7 +234,8 @@
</tbody>
</TableCustom>
</div>
</CenteredPage>

<style>
</style>
<div class="flex flex-row justify-between pt-4">
<a href="/user/workspaces">&leftarrow; Back to workspaces</a>
</div>
</CenteredModal>
13 changes: 10 additions & 3 deletions frontend/src/routes/user/workspaces@user.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import { superadmin, usersWorkspaceStore, workspaceStore } from '../../stores';
import CenteredModal from './CenteredModal.svelte';
import Switch from '../components/Switch.svelte';
import { faUser, faUserAlt, faUserCog } from '@fortawesome/free-solid-svg-icons';
import Icon from 'svelte-awesome';
let invites: WorkspaceInvite[] = [];
let list_all_as_super_admin: boolean = false;
Expand Down Expand Up @@ -68,7 +70,8 @@
<button
class="
block
w-full
w-96
mx-auto
py-1
px-2
rounded-md
Expand Down Expand Up @@ -102,7 +105,8 @@
<div
class="
block
w-full
w-96
mx-auto
py-1
px-2
rounded-md
Expand Down Expand Up @@ -142,7 +146,10 @@
</span>
</div>
{/each}
<div class="flex flex-row-reverse mt-10">
<div class="flex justify-between mt-10">
<a class="mr-10" href="/user/settings">
<Icon data={faUserCog} class="mr-1" scale={1} />User settings</a
>
<button
class="default-button-secondary"
on:click={async () => {
Expand Down

0 comments on commit a130806

Please sign in to comment.