1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

Updated Team UI

This commit is contained in:
Eldad Fux 2020-06-07 12:29:51 +03:00
parent 950a66f294
commit fb2663745d
4 changed files with 91 additions and 13 deletions

View file

@ -2,8 +2,11 @@
## Features
- New route in Locale API to fetch a list of languages
- Added a new route in Locale API to fetch a list of languages
- Added Google Fonts to Appwrite for offline availability
- Added option to delete team from the console
- Added option to view team members from the console
- Added option to join a user to any team from the console
## Bug Fixes

View file

@ -371,8 +371,12 @@ $utopia->get('/v1/teams/:teamId/memberships')
->label('sdk.method', 'getMemberships')
->label('sdk.description', '/docs/references/teams/get-team-members.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC']); }, 'Order result by ASC or DESC order.', true)
->action(
function ($teamId) use ($response, $projectDB) {
function ($teamId, $search, $limit, $offset, $orderType) use ($response, $projectDB) {
$team = $projectDB->getDocument($teamId);
if (empty($team->getId()) || Database::SYSTEM_COLLECTION_TEAMS != $team->getCollection()) {
@ -380,8 +384,12 @@ $utopia->get('/v1/teams/:teamId/memberships')
}
$memberships = $projectDB->getCollection([
'limit' => 50,
'offset' => 0,
'limit' => $limit,
'offset' => $offset,
'orderField' => 'joined',
'orderType' => $orderType,
'orderCast' => 'int',
'search' => $search,
'filters' => [
'$collection='.Database::SYSTEM_COLLECTION_MEMBERSHIPS,
'teamId='.$teamId,
@ -408,15 +416,8 @@ $utopia->get('/v1/teams/:teamId/memberships')
]));
}
usort($users, function ($a, $b) {
if ($a['joined'] === 0 || $b['joined'] === 0) {
return $b['joined'] - $a['joined'];
}
$response->json(['sum' => $projectDB->getSum(), 'memberships' => $users]);
return $a['joined'] - $b['joined'];
});
$response->json($users);
}
);

View file

@ -383,7 +383,7 @@ $customDomainsTarget = $this->getParam('customDomainsTarget', false);
data-success-param-trigger-events="teams.getMemberships">
<div class="box margin-bottom">
<ul data-ls-loop="members" data-ls-as="member" class="list">
<ul data-ls-loop="members.memberships" data-ls-as="member" class="list">
<li class="clear">
<form class="pull-end"
data-analytics-event="submit"

View file

@ -65,7 +65,81 @@
<h3 class="margin-bottom">Members</h3>
<div
data-service="teams.getMemberships"
data-event="load,teams.create,teams.update,teams.delete"
data-param-team-id="{{router.params.id}}"
data-param-limit="<?php echo APP_PAGING_LIMIT; ?>"
data-param-offset="{{router.params.offset}}"
data-param-order-type="DESC"
data-scope="sdk"
data-name="project-teams">
<div data-ls-if="0 == {{project-teams.sum}}" class="box margin-bottom">
<h3 class="margin-bottom-small text-bold">No Memberships Found</h3>
<p class="margin-bottom-no">Create your first team member to get started</p>
</div>
<div data-ls-if="0 != {{project-teams.sum}}">
<div class="margin-bottom-small margin-end-small text-align-end text-size-small"><span data-ls-bind="{{project-teams.sum}}"></span> results found</div>
<div class="box margin-bottom margin-top-negative">
<table class="vertical">
<thead>
<tr>
<th width="40"></th>
<th>Name</th>
<th width="150">Members</th>
<th width="150">Created</th>
</tr>
</thead>
<tbody data-ls-loop="project-teams.teams" data-ls-as="team">
<tr>
<td class="hide">
<img src="" data-ls-attrs="src={{team.name|gravatar}}" data-size="45" alt="Collection Avatar" class="avatar margin-end pull-start" loading="lazy" width="30" height="30" />
</td>
<td data-title="Name: ">
<a data-ls-attrs="href=/console/users/teams/team?id={{team.$id}}&project={{router.params.project}}" data-ls-bind="{{team.name}}"></a>
</td>
<td data-title="Members: "><span data-ls-bind="{{team.sum}} members"></span></td>
<td data-title="Date Created: "><small data-ls-bind="{{team.dateCreated|date-text}}"></small></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="clear text-align-center paging">
<form
data-service="teams.list"
data-event="submit"
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT; ?>"
data-param-order-type="DESC"
data-scope="sdk"
data-name="project-teams"
data-success="state"
data-success-param-state-keys="search,offset">
<button name="offset" data-paging-back data-offset="{{router.params.offset}}" data-sum="{{project-teams.sum}}" class="margin-end round small" aria-label="Back"><i class="icon-left-open"></i></button>
</form>
<span data-ls-bind="{{router.params.offset|pageCurrent}} / {{project-teams.sum|pageTotal}}"></span>
<form
data-service="teams.list"
data-event="submit"
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT; ?>"
data-param-order-type="DESC"
data-scope="sdk"
data-name="project-teams"
data-success="state"
data-success-param-state-keys="search,offset">
<button name="offset" data-paging-next data-offset="{{router.params.offset}}" data-sum="{{project-teams.sum}}" class="margin-start round small" aria-label="Next"><i class="icon-right-open"></i></button>
</form>
</div>
</div>
</div>
<div class="col span-4 sticky-top">
<label>Team ID</label>