-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
301 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
<!-- Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS --> | ||
|
||
<template> | ||
<ion-page class="modal"> | ||
<ms-modal | ||
:title="$t('UsersPage.UserDetailsModal.title')" | ||
:close-button="{ visible: true }" | ||
> | ||
<div class="details"> | ||
<div class="details-name"> | ||
<ion-text class="button-small"> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.name') }} | ||
</ion-text> | ||
<ion-text class="details-name__fullname subtitles-normal"> | ||
{{ user.humanHandle.label }} | ||
</ion-text> | ||
</div> | ||
<div class="details-joined"> | ||
<ion-text class="button-small"> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.joined') }} | ||
</ion-text> | ||
<ion-text class="details-joined__date body-lg"> | ||
{{ timeSince(user.createdOn, '--', 'short') }} | ||
</ion-text> | ||
</div> | ||
</div> | ||
<div> | ||
<ion-chip | ||
v-if="user.isRevoked()" | ||
color="danger" | ||
> | ||
<ion-icon | ||
:icon="ellipse" | ||
class="revoked" | ||
/> | ||
<ion-label> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.revoked') }} | ||
</ion-label> | ||
</ion-chip> | ||
</div> | ||
<ion-list> | ||
<ion-text class="button-small"> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.commonWorkspaces') }} | ||
</ion-text> | ||
<ion-card | ||
v-for="workspace in workspaces" | ||
:key="workspace.id" | ||
:disabled="user.isRevoked()" | ||
class="workspace-card" | ||
> | ||
<ion-card-content> | ||
<ion-avatar class="card-content-icons"> | ||
<ion-icon | ||
class="card-content-icons__item" | ||
:icon="business" | ||
/> | ||
<ion-icon | ||
class="cloud-overlay" | ||
:class="workspace.availableOffline ? 'cloud-overlay-ok' : 'cloud-overlay-ko'" | ||
:icon="workspace.availableOffline ? cloudDone : cloudOffline" | ||
/> | ||
<ion-text class="workspace-name cell"> | ||
{{ workspace.name }} | ||
</ion-text> | ||
<workspace-tag-role :role="workspace.role" /> | ||
</ion-avatar> | ||
</ion-card-content> | ||
</ion-card> | ||
</ion-list> | ||
<ion-button | ||
class="close-button" | ||
@click="cancel" | ||
> | ||
{{ $t('UsersPage.UserDetailsModal.actions.close') }} | ||
</ion-button> | ||
</ms-modal> | ||
</ion-page> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { MsModal } from '@/components/core'; | ||
import { MsModalResult } from '@/components/core/ms-modal/types'; | ||
import { | ||
IonChip, | ||
IonAvatar, | ||
IonButton, | ||
IonList, | ||
IonPage, | ||
IonText, | ||
modalController, | ||
IonCard, | ||
IonCardContent, | ||
IonIcon, | ||
IonLabel, | ||
} from '@ionic/vue'; | ||
import { business, cloudDone, cloudOffline, ellipse } from 'ionicons/icons'; | ||
import { UserInfo, WorkspaceRole } from '@/parsec'; | ||
import { FormattersKey, Formatters } from '@/common/injectionKeys'; | ||
import { defineProps, inject } from 'vue'; | ||
import WorkspaceTagRole from '@/components/workspaces/WorkspaceTagRole.vue'; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const { timeSince } = inject(FormattersKey)! as Formatters; | ||
const workspaces = [ | ||
{ | ||
id: 'fake1', | ||
name: 'Workspace1', | ||
role: WorkspaceRole.Owner, | ||
availableOffline: true, | ||
}, | ||
{ | ||
id: 'fake2', | ||
name: 'Workspace2', | ||
role: WorkspaceRole.Contributor, | ||
availableOffline: false, | ||
}, | ||
]; | ||
defineProps<{ | ||
user: UserInfo; | ||
}>(); | ||
async function cancel(): Promise<boolean> { | ||
return await modalController.dismiss(null, MsModalResult.Cancel); | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.details { | ||
display: flex; | ||
margin-bottom: 1rem; | ||
.details-name { | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
gap: 0.5rem; | ||
} | ||
.details-joined { | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
gap: 0.5rem; | ||
} | ||
} | ||
.workspace-name { | ||
margin-left: 1rem; | ||
margin-right: auto; | ||
} | ||
.close-button { | ||
display: flex; | ||
margin-left: auto; | ||
width: fit-content; | ||
} | ||
.card-content-icons { | ||
margin: 0 auto 0.5rem; | ||
position: relative; | ||
height: fit-content; | ||
display: flex; | ||
justify-content: left; | ||
align-items: center; | ||
color: var(--parsec-color-light-primary-900); | ||
width: 100%; | ||
&__item { | ||
font-size: 2rem; | ||
} | ||
.cloud-overlay { | ||
position: absolute; | ||
font-size: 1rem; | ||
bottom: -10px; | ||
left: 4%; | ||
padding: 2px; | ||
background: white; | ||
border-radius: 50%; | ||
} | ||
.cloud-overlay-ok { | ||
color: var(--parsec-color-light-primary-500); | ||
} | ||
.cloud-overlay-ko { | ||
color: var(--parsec-color-light-secondary-text); | ||
} | ||
} | ||
.revoked { | ||
font-size: 0.5rem; | ||
margin-right: 0.5rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS | ||
|
||
describe('Check user details modal', () => { | ||
beforeEach(() => { | ||
cy.visitApp(); | ||
cy.login('Boby', 'P@ssw0rd.'); | ||
cy.get('.organization-card__manageBtn').click(); | ||
cy.get('.users-container').find('.user-list-item').eq(2).find('.options-button').invoke('show').click(); | ||
cy.get('.user-context-menu').find('.menu-list').find('ion-item').as('menuItems'); | ||
cy.get('@menuItems').eq(3).contains('View details').click(); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.dropTestbed(); | ||
}); | ||
|
||
it('Tests user details modal', () => { | ||
cy.get('.user-details-modal').as('modal').find('ion-header').contains('User details'); | ||
cy.get('@modal').find('.ms-modal-content').as('modal-content').find('ion-text').eq(0).contains('Name'); | ||
// cspell:disable-next-line | ||
cy.get('@modal-content').find('ion-text').eq(1).contains('Jaheira'); | ||
cy.get('@modal-content').find('ion-text').eq(2).contains('Joined'); | ||
cy.get('@modal-content').find('ion-text').eq(3).contains('one second ago'); | ||
cy.get('@modal-content').find('ion-text').eq(4).contains('Shared workspaces'); | ||
cy.get('@modal-content').find('ion-list').find('ion-card').as('workspace-cards').should('have.length', 2); | ||
cy.get('@workspace-cards').eq(0).find('ion-text').contains('Workspace1'); | ||
cy.get('@workspace-cards').eq(0).find('ion-icon').should('exist'); | ||
cy.get('@workspace-cards').eq(0).find('ion-label').contains('Owner'); | ||
cy.get('@workspace-cards').eq(1).find('ion-text').contains('Workspace2'); | ||
cy.get('@workspace-cards').eq(1).find('ion-icon').should('exist'); | ||
cy.get('@workspace-cards').eq(1).find('ion-label').contains('Contributor'); | ||
cy.get('@modal-content').find('ion-button').contains('Close').click(); | ||
cy.get('@modal').should('not.exist'); | ||
}); | ||
}); |