Compare commits

..

6 Commits

Author SHA1 Message Date
59d5ad5bd3 logic cleanup 🧠
All checks were successful
continuous-integration/drone/push Build is passing
ref #12
2021-01-09 16:06:03 +01:00
71c761187f UserOverview cleanup
ref #12
2021-01-09 15:58:58 +01:00
11457b2792 added Breadcrumb nav to UserDetail
ref #12
2021-01-09 15:40:10 +01:00
4fd1ac28c5 display profilepic properly
ref #12
2021-01-09 15:39:56 +01:00
8cf73a2be0 added middlename input field to mock
ref #12
2021-01-09 15:39:43 +01:00
644b9a7683 proper middlename display support
ref #12
2021-01-09 15:39:28 +01:00
8 changed files with 134 additions and 93 deletions

View File

@ -48,7 +48,7 @@
import OrgDetail from "./components/OrgDetail.svelte";
import Teams from "./components/Teams.svelte";
import { OpenAPI, AuthService } from "@odit/lfk-client-js";
import UserDetailOne from "./components/UserDetailOne.svelte";
import UserDetail from "./components/UserDetail.svelte";
OpenAPI.BASE = config.baseurl;
store.init();
@ -86,7 +86,7 @@
<Users />
</Route>
<Route path="/:userid" let:params>
<UserDetailOne {params} />
<UserDetail {params} />
</Route>
</Route>
<Route path="/tracks/*">

View File

@ -19,7 +19,6 @@
.then((response) => response.json())
.then((json) => {
licenses = json;
console.log(json);
});
</script>

View File

@ -0,0 +1,128 @@
<script>
import { _ } from "svelte-i18n";
import { UserService } from "@odit/lfk-client-js";
import "gridjs/dist/theme/mermaid.css";
import { tracks as tracksstore } from "../store.js";
import PromiseError from "./PromiseError.svelte";
export let params;
const user_promise = UserService.userControllerGetOne(params.userid);
user_promise.then((data) => {
console.log(data);
tracksstore.set(data);
});
</script>
{#await user_promise}
<!-- -->
{:then user}
<section class="container p-5 select-none">
<div class="flex flex-row mb-4">
<div class="w-full">
<nav class="w-full flex">
<ol class="list-none flex flex-row items-center justify-start">
<li class="flex items-center">
<svg
class="flex-shrink-0 w-5 h-5 mr-2"
fill="currentColor"
width="24"
height="24"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 640 512"><path
fill="currentColor"
d="M610.5 341.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 368.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm224 32c1.9 0 3.7-.5 5.6-.6 8.3-21.7 20.5-42.1 36.3-59.2 7.4-8 17.9-12.6 28.9-12.6 6.9 0 13.7 1.8 19.6 5.3l7.9 4.6c.8-.5 1.6-.9 2.4-1.4 7-14.6 11.2-30.8 11.2-48 0-61.9-50.1-112-112-112S208 82.1 208 144c0 61.9 50.1 112 112 112zm105.2 194.5c-2.3-1.2-4.6-2.6-6.8-3.9-8.2 4.8-15.3 9.8-27.5 9.8-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-10.7-34.5 24.9-49.7 25.8-50.3-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-3.8-2.2-7-5-9.8-8.1-3.3.2-6.5.6-9.8.6-24.6 0-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h255.4c-3.7-6-6.2-12.8-6.2-20.3v-9.2zM173.1 274.6C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z" /></svg>
</li>
<li class="flex items-center">
<a class="mr-2" href="./">{$_('users')}</a><svg
stroke="currentColor"
fill="none"
stroke-width="2"
viewBox="0 0 24 24"
stroke-linecap="round"
stroke-linejoin="round"
class="h-3 w-3 mr-2 stroke-current"
height="1em"
width="1em"
xmlns="http://www.w3.org/2000/svg"><line
x1="5"
y1="12"
x2="19"
y2="12" />
<polyline points="12 5 19 12 12 19" /></svg>
</li>
<li class="flex items-center">
<span class="mr-2">{user.firstname}
{user.middlename || ''}
{user.lastname}</span>
</li>
</ol>
</nav>
</div>
</div>
<span
class="mb-4 text-3xl font-extrabold leading-tight text-gray-900">{user.firstname}
{user.middlename || ''}
{user.lastname}
<button
type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">Delete
User</button></span>
<!-- -->
<div class="mt-2 flex items-center">
<img
alt={$_('profile-picture')}
class="inline-block h-20 w-20 rounded-full overflow-hidden bg-gray-100"
src={user.profilePic} />
<!-- <span
class="inline-block h-12 w-12 rounded-full overflow-hidden bg-gray-100"><svg
class="h-full w-full text-gray-300"
fill="currentColor"
viewBox="0 0 24 24"><path
d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" /></svg></span> -->
<button
type="button"
class="ml-5 bg-white py-2 px-3 border border-gray-300 rounded-md shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Change</button>
</div>
<!-- -->
<div class="mt-3 text-sm w-full">
<input
id="enabled"
name="enabled"
type="checkbox"
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
<label
for="enabled"
class="ml-1 font-medium text-gray-700">Active?</label>
<p class="text-gray-500">set the user active/ inactive</p>
</div>
<div class="text-sm w-full">
<label for="firstname" class="font-medium text-gray-700">First name</label>
<input
autocomplete="off"
placeholder="First name"
type="text"
name="firstname"
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
</div>
<div class="text-sm w-full">
<label for="middlename" class="font-medium text-gray-700">Middle name</label>
<input
autocomplete="off"
placeholder="Middle name"
type="text"
name="middlename"
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
</div>
<div class="text-sm w-full">
<label for="lastname" class="font-medium text-gray-700">Last name</label>
<input
autocomplete="off"
placeholder="Last name"
type="text"
name="lastname"
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
</div>
</section>
{:catch error}
<!-- promise was rejected -->
<PromiseError {error} />
{/await}

View File

@ -1,86 +0,0 @@
<script>
import { _, json } from "svelte-i18n";
import Toastify from "toastify-js";
import TracksEmptyState from "./TracksEmptyState.svelte";
import { TrackService, UserService } from "@odit/lfk-client-js";
import { getlang } from "./datatable_i18n";
import { Grid, html } from "gridjs";
import "gridjs/dist/theme/mermaid.css";
import { tracks as tracksstore } from "../store.js";
import UsersEmptyState from "./UsersEmptyState.svelte";
import PromiseError from "./PromiseError.svelte";
$: userscache = [];
$: blocked = [];
let table;
let datatable;
let datatable_inited = false;
export let params;
const user_promise = UserService.userControllerGetOne(params.userid);
tracksstore.subscribe((val) => {
userscache = val;
});
user_promise.then((data) => {
console.log(data);
tracksstore.set(data);
});
</script>
{#await user_promise}
<!-- -->
{:then user}
<section class="container p-5 select-none">
<span
class="mb-4 text-3xl font-extrabold leading-tight text-gray-900">{user.firstname}
{user.middlename}
{user.lastname}
<button
type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">Delete
User</button></span>
<!-- -->
<div class="mt-2 flex items-center">
<span
class="inline-block h-12 w-12 rounded-full overflow-hidden bg-gray-100"><svg
class="h-full w-full text-gray-300"
fill="currentColor"
viewBox="0 0 24 24"><path
d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" /></svg></span>
<button
type="button"
class="ml-5 bg-white py-2 px-3 border border-gray-300 rounded-md shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Change</button>
</div>
<!-- -->
<div class="mt-3 text-sm w-full">
<input
id="enabled"
name="enabled"
type="checkbox"
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
<label
for="enabled"
class="ml-1 font-medium text-gray-700">Active?</label>
<p class="text-gray-500">set the user active/ inactive</p>
</div>
<div class="text-sm w-full">
<label for="firstname" class="font-medium text-gray-700">First name</label>
<input
autocomplete="off"
placeholder="First name"
type="text"
name="firstname"
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
</div>
<div class="text-sm w-full">
<label for="lastname" class="font-medium text-gray-700">Last name</label>
<input
autocomplete="off"
placeholder="Last name"
type="text"
name="lastname"
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
</div>
</section>
{:catch error}
<!-- promise was rejected -->
<PromiseError {error} />
{/await}

View File

@ -2,7 +2,7 @@
import { _ } from "svelte-i18n";
import AddUserModal from "./AddUserModal.svelte";
export let modal_open = false;
import UsersDetail from "./UsersDetail.svelte";
import UsersOverview from "./UsersOverview.svelte";
</script>
<section class="container p-5">
@ -20,6 +20,6 @@
<p class="mb-8 text-lg text-gray-500">
manage admin users
</p>
<UsersDetail />
<UsersOverview />
</section>
<AddUserModal bind:modal_open />

View File

@ -113,7 +113,7 @@
<a
href="./{u.id}"
class="text-indigo-600 hover:text-indigo-900">Edit</a>
<a href="#" class="ml-4 text-red-600 hover:text-red-900">Delete</a>
<span tabindex="0" href="#" class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">Delete</span>
</td>
</tr>
{/each}

View File

@ -58,6 +58,7 @@
"oss_credit_description": "We use a lot of open source software on these projects, and would like to thank the following projects and contributors who help make open source great!",
"password": "Password",
"please-provide-the-required-information-to-add-a-new-track": "Please provide the required information to add a new track.",
"profile-picture": "Profile Picture",
"read-license": "Read License",
"register": "Register",
"repo_link": "Link",

View File

@ -23,7 +23,6 @@ const store = () => {
state.access_token = access_token;
state.jwtinfo = jwtinfo;
state.isLoggedIn = true;
// console.log('login performed');
return state;
});
},