From d87b879cc3d6c771a8a9932409e39068e1b2acdb Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Thu, 14 Jan 2021 19:10:36 +0100 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=8F=83=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=F0=9F=8F=83=E2=80=8D=E2=99=82=EF=B8=8F=F0=9F=8F=83=E2=80=8D?= =?UTF-8?q?=E2=99=82=EF=B8=8F=20basic=20UI=20components=20for=20team=20man?= =?UTF-8?q?agement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #14 --- src/components/AddTeamModal.svelte | 159 ++++++++++++++++++++++ src/components/Teams.svelte | 21 +++ src/components/TeamsEmptyState.svelte | 14 ++ src/components/TeamsOverview.svelte | 182 ++++++++++++++++++++++++++ src/locales/en.json | 1 + 5 files changed, 377 insertions(+) create mode 100644 src/components/AddTeamModal.svelte create mode 100644 src/components/TeamsEmptyState.svelte create mode 100644 src/components/TeamsOverview.svelte diff --git a/src/components/AddTeamModal.svelte b/src/components/AddTeamModal.svelte new file mode 100644 index 00000000..aeff59c8 --- /dev/null +++ b/src/components/AddTeamModal.svelte @@ -0,0 +1,159 @@ + + +{#if modal_open} +
{ + modal_open = false; + }}> +
+ +
+{/if} diff --git a/src/components/Teams.svelte b/src/components/Teams.svelte index 7bcfd325..75ad7411 100644 --- a/src/components/Teams.svelte +++ b/src/components/Teams.svelte @@ -1,10 +1,31 @@
{$_('teams')} + {#if store.state.jwtinfo.userdetails.permissions.includes('USER:CREATE')} + + {/if}

everything is more fun together 🏃‍♂️🏃‍♀️🏃‍♂️

+
+ +{#if store.state.jwtinfo.userdetails.permissions.includes('USER:CREATE')} + +{/if} diff --git a/src/components/TeamsEmptyState.svelte b/src/components/TeamsEmptyState.svelte new file mode 100644 index 00000000..9e306776 --- /dev/null +++ b/src/components/TeamsEmptyState.svelte @@ -0,0 +1,14 @@ + + +
+

+ There are no teams added yet.
+ Add your first team +

+
+ + diff --git a/src/components/TeamsOverview.svelte b/src/components/TeamsOverview.svelte new file mode 100644 index 00000000..7f7b25a5 --- /dev/null +++ b/src/components/TeamsOverview.svelte @@ -0,0 +1,182 @@ + + +{#if store.state.jwtinfo.userdetails.permissions.includes('USER:GET')} + {#await teams_promise} + + {:then} + {#if current_teams.length === 0} + + {:else} + + + + +
+ + + + + + + + + + + {#each current_teams as u} + {#if Object.values(u) + .toString() + .toLowerCase() + .includes(searchvalue)} + + + + + {#if active_deletes[u.id] === true} + + {:else} + + {/if} + + {/if} + {/each} + +
+ Name + + Status + + Groups + + Action +
+
+ {#if u.profilePic} +
+ +
+ {/if} +
+
+ {u.firstname} + {u.middlename || ''} + {u.lastname} +
+
+ {u.email || u.username} +
+
+
+
+ {#if u.enabled} + Active + {:else} + Inactive + {/if} + + {#each u.groups as g} + {g.name} + {/each} + + + + + Edit + {#if store.state.jwtinfo.userdetails.permissions.includes('USER:DELETE')} + + {/if} +
+
+ {/if} + {:catch error} +
+ + {$_('general_promise_error')} + {error} + +
+ {/await} +{/if} diff --git a/src/locales/en.json b/src/locales/en.json index 0c3b7555..91c60fda 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -106,6 +106,7 @@ "settings": "Settings", "signout": "Sign out", "stats-are-being-loaded": "stats are being loaded...", + "team-name": "Team name", "teams": "Teams", "this-might-take-a-moment": "This might take a moment 👀", "total-distance": "total distance", From ace1a1b06379d922df2593c3a7aec77d5f958512 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Thu, 14 Jan 2021 20:15:21 +0100 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=90=9E=20fix=20component=20mount=20in?= =?UTF-8?q?=20TeamsEmptyState?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #14 --- src/components/TeamsEmptyState.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/TeamsEmptyState.svelte b/src/components/TeamsEmptyState.svelte index 9e306776..05b4936e 100644 --- a/src/components/TeamsEmptyState.svelte +++ b/src/components/TeamsEmptyState.svelte @@ -2,6 +2,7 @@ import { _ } from "svelte-i18n"; import AddTeamModal from "./AddTeamModal.svelte"; let modal_open = false; + let current_teams = [];
@@ -11,4 +12,4 @@

- + From 6870a7f9b1fce2f06182dafa502f6dc4bb818bd3 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Fri, 15 Jan 2021 17:51:12 +0100 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=A7=B9=20TeamsOverview=20-=20formatti?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #14 --- src/components/TeamsOverview.svelte | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/TeamsOverview.svelte b/src/components/TeamsOverview.svelte index 7f7b25a5..aa58ec18 100644 --- a/src/components/TeamsOverview.svelte +++ b/src/components/TeamsOverview.svelte @@ -2,19 +2,19 @@ import { _ } from "svelte-i18n"; import Toastify from "toastify-js"; import { RunnerTeamService } from "@odit/lfk-client-js"; - const teams_promise = RunnerTeamService.runnerTeamControllerGetAll() + const teams_promise = RunnerTeamService.runnerTeamControllerGetAll(); import "gridjs/dist/theme/mermaid.css"; import { users as usersstore } from "../store.js"; import store from "../store"; import TeamsEmptyState from "./TeamsEmptyState.svelte"; $: searchvalue = ""; $: active_deletes = []; - export let current_teams=[]; + export let current_teams = []; $: userscache = []; $: advanced_search = false; usersstore.subscribe((val) => { userscache = val; - current_teams=val; + current_teams = val; }); teams_promise.then((data) => { usersstore.set(data); @@ -36,12 +36,12 @@ - + - -
@@ -66,12 +49,12 @@ - {#each current_teams as u} - {#if Object.values(u) + {#each current_teams as t} + {#if Object.values(t) .toString() .toLowerCase() .includes(searchvalue)} - + - - {#if active_deletes[u.id] === true} + {#if active_deletes[t.id] === true}
- Status + {$_('organization')} - Groups + Contact Action @@ -79,66 +62,61 @@
- {#if u.profilePic} -
- -
- {/if}
- {u.firstname} - {u.middlename || ''} - {u.lastname} -
-
- {u.email || u.username} + {t.name}
- {#if u.enabled} - Active - {:else} - Inactive - {/if} +
+
+
+ {#if t.parentGroup} + {t.parentGroup.name} + {:else}no organization specified{/if} +
+
+
- {#each u.groups as g} - {g.name} - {/each} + +
+
+
+ {#if t.contact} + {JSON.stringify(t.contact)} + {:else}no contact specified{/if} +
+
+
Edit - {#if store.state.jwtinfo.userdetails.permissions.includes('USER:DELETE')} + {#if store.state.jwtinfo.userdetails.permissions.includes('TEAM:DELETE')} diff --git a/src/locales/en.json b/src/locales/en.json index 3c4bc96b..6bb8bc40 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -94,6 +94,7 @@ "minimum-lap-time-in-s": "minimum lap time in s", "no-license-text-could-be-found": "No license text could be found 😢", "no-tracks-added-yet": "there are no tracks added yet.", + "organization": "Organization", "organizations": "Organizations", "orgs": "Orgs", "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!", From ccf09f97d5fb476113f24a9559a48bccd75fd0a5 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Fri, 15 Jan 2021 22:01:43 +0100 Subject: [PATCH 6/8] =?UTF-8?q?=E2=9C=A8=20TeamDetail=20with=20edit,delete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #14 --- src/App.svelte | 10 +- src/components/AddTeamModal.svelte | 6 +- src/components/TeamDetail.svelte | 210 +++++++++++++++++++++++++++++ src/locales/en.json | 1 + 4 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 src/components/TeamDetail.svelte diff --git a/src/App.svelte b/src/App.svelte index 13f9d517..c5548087 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -49,6 +49,7 @@ import UserDetail from "./components/UserDetail.svelte"; OpenAPI.BASE = config.baseurl; import { register as registerSW } from "./swmodule"; + import TeamDetail from "./components/TeamDetail.svelte"; store.init(); // registerSW(); @@ -85,8 +86,13 @@ - - + + + + + + + diff --git a/src/components/AddTeamModal.svelte b/src/components/AddTeamModal.svelte index 57b1e3db..4c4ba092 100644 --- a/src/components/AddTeamModal.svelte +++ b/src/components/AddTeamModal.svelte @@ -31,12 +31,12 @@ } }; })(); - $: teams = []; $: parentGroup = undefined; + $: orgs = []; const orgs_promise = RunnerOrganisationService.runnerOrganisationControllerGetAll().then( (val) => { console.log(val); - teams = val; + orgs = val; val.forEach((t) => { console.log(t.name); }); @@ -155,7 +155,7 @@ diff --git a/src/components/TeamDetail.svelte b/src/components/TeamDetail.svelte new file mode 100644 index 00000000..9c1b3cc2 --- /dev/null +++ b/src/components/TeamDetail.svelte @@ -0,0 +1,210 @@ + + +{#if data_loaded} +
+
+ {original.name} + + {#if store.state.jwtinfo.userdetails.permissions.includes('TEAM:DELETE')} + {#if delete_triggered} + + + {/if} + {#if !delete_triggered} + + {/if} + {/if} + {#if !delete_triggered} + + {/if} + +
+
+
+ +
+
+
+ + +
+
+ + +
+ +
+{:else} + {#await promise} + organization detail is being loaded... + {:catch error} + + {/await} +{/if} diff --git a/src/locales/en.json b/src/locales/en.json index 6bb8bc40..53fe708e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -40,6 +40,7 @@ "an_error_happened_while_fetching_the_data": "An error happened while fetching the data" }, "delete-organization": "Delete Organization", + "delete-team": "Delete Team", "delete-user": "Delete User", "dependency_name": "Name", "dont-have-your-email-connected": "Don't have your email connected?", From 07f2e65fc722c0328ee5a8dc4d01fc89c906fa86 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Fri, 15 Jan 2021 22:04:21 +0100 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=A7=B9=20Team=20cleanups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #14 --- src/components/AddTeamModal.svelte | 13 +++---------- src/components/TeamDetail.svelte | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/components/AddTeamModal.svelte b/src/components/AddTeamModal.svelte index 4c4ba092..68f54be0 100644 --- a/src/components/AddTeamModal.svelte +++ b/src/components/AddTeamModal.svelte @@ -33,15 +33,9 @@ })(); $: parentGroup = undefined; $: orgs = []; - const orgs_promise = RunnerOrganisationService.runnerOrganisationControllerGetAll().then( - (val) => { - console.log(val); - orgs = val; - val.forEach((t) => { - console.log(t.name); - }); - } - ); + RunnerOrganisationService.runnerOrganisationControllerGetAll().then((val) => { + orgs = val; + }); function submit() { if (processed_last_submit === true) { processed_last_submit = false; @@ -54,7 +48,6 @@ name: teamname, }) .then((result) => { - console.log(result); teamname = ""; modal_open = false; // diff --git a/src/components/TeamDetail.svelte b/src/components/TeamDetail.svelte index 9c1b3cc2..7ae6fe8f 100644 --- a/src/components/TeamDetail.svelte +++ b/src/components/TeamDetail.svelte @@ -203,7 +203,7 @@ {:else} {#await promise} - organization detail is being loaded... + team detail is being loaded... {:catch error} {/await} From 854db4ece8388a70b8a50c5b4c7ce9be974a2616 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Fri, 15 Jan 2021 22:05:39 +0100 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=A7=B9=20drop=20tmp=20modification=20?= =?UTF-8?q?from=20UsersOverview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #14 --- src/components/UsersOverview.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/UsersOverview.svelte b/src/components/UsersOverview.svelte index c6844137..28603c25 100644 --- a/src/components/UsersOverview.svelte +++ b/src/components/UsersOverview.svelte @@ -10,7 +10,6 @@ export let current_users=[]; $: advanced_search = false; usersstore.subscribe((val) => { - userscache = val; current_users=val; }); users_promise.then((data) => {