Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK-1059] Handle submission groups in Access Log UI #5115

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
f80be70
Use Node 20.15.1, and add it to CI
p2edwards Jul 15, 2024
cfce973
Let each Node CI run finish independently
p2edwards Jul 15, 2024
7c6dfec
Make tests run in Node >=17. Wow…
p2edwards Jul 16, 2024
6975b22
Add comments to npm-test
p2edwards Jul 16, 2024
de9b001
start simplifying button types
magicznyleszek Jul 30, 2024
dde11de
migrate Button to use only one type option instead of type+color pairs
magicznyleszek Aug 2, 2024
2896b3b
update sharing form buttons
magicznyleszek Aug 2, 2024
bfaf051
update button types
magicznyleszek Aug 2, 2024
50f3ed4
improve Button stories
magicznyleszek Aug 2, 2024
4a70b71
improve All Buttons story
magicznyleszek Aug 2, 2024
66cb008
improve Button's pending/disabled handling so that the focus and navi…
magicznyleszek Aug 2, 2024
71a560b
Merge branch 'beta' into task915-simplify-button-component
magicznyleszek Aug 2, 2024
7196fea
simplify focus styles of Button and change text type paddings
magicznyleszek Aug 5, 2024
3e1d9d1
Fix bug on redeploy
noliveleger Aug 6, 2024
d40c334
Merge branch 'kobocat-django-app-part-2-remove-kobocat-rest-service' …
noliveleger Aug 6, 2024
a15612c
Merge branch 'update-colors' into task915-simplify-button-component
magicznyleszek Aug 7, 2024
6c57024
Merge branch 'beta' into node-20-upgrade-CI-testing
p2edwards Aug 12, 2024
f088b17
update NewFeatureDialog close button looks
magicznyleszek Aug 14, 2024
8d96fc4
move collect method selection to separate component and simplify its …
magicznyleszek Aug 14, 2024
f496ee0
Merge branch 'release/2.024.25' into release/2.024.33
noliveleger Aug 15, 2024
3ee226a
Merge pull request #5037 from kobotoolbox/kobocat-django-app-part-2-r…
jnm Aug 20, 2024
598aced
Use no email login digest factory
noliveleger Aug 20, 2024
bf67805
Backport #5068
noliveleger Aug 20, 2024
79546c3
fix thumbnail resizing with FileSystemStorage (backport from kobotool…
noliveleger Aug 21, 2024
88ba330
Merge pull request #5070 from kobotoolbox/backport-fix-suspiciouspath
noliveleger Aug 21, 2024
c50ce44
Merge branch 'release/2.024.25' into fix-digest-concurrency
noliveleger Aug 21, 2024
34e5fcd
Merge pull request #5068 from kobotoolbox/fix-digest-concurrency
noliveleger Aug 21, 2024
77336c0
Merge pull request #5069 from kobotoolbox/backport-5068-partial-diges…
noliveleger Aug 21, 2024
e553474
Merge branch 'main' into release/2.024.25
noliveleger Aug 21, 2024
72d5b81
make sure that supplemental details are not processed with the repeat…
RuthShryock Aug 22, 2024
32bbcc5
Apply requested changes
noliveleger Aug 22, 2024
b36a130
Fix bad refactoring
noliveleger Aug 22, 2024
0f7f8b7
Fix sync_kobocat_xforms
noliveleger Aug 22, 2024
aab7bb1
Merge pull request #5074 from kobotoolbox/qa-reponses-missing-bug
jamesrkiger Aug 22, 2024
735817d
Improve error message when XForm does not exist
noliveleger Aug 22, 2024
425d624
Refactor delete action and bulk update
noliveleger Aug 22, 2024
821686f
Use contextmanager to handle create_instance errors
noliveleger Aug 22, 2024
f5e1f92
Add TODO comment
noliveleger Aug 22, 2024
26e21fd
Merge pull request #5038 from kobotoolbox/kobocat-django-app-part-2-o…
jnm Aug 22, 2024
ada05fa
Merge pull request #5042 from kobotoolbox/kobocat-django-app-part-2-r…
jnm Aug 22, 2024
1a8da58
Merge branch 'kobocat-django-app-part-2' into kobocat-django-app-part…
noliveleger Aug 23, 2024
7697d68
Use MagicMock instead of MockSSRFProtect
noliveleger Aug 23, 2024
3698143
Remove unused import
noliveleger Aug 23, 2024
a056a74
Fix unit tests
noliveleger Aug 23, 2024
25f8558
Merge branch 'beta' into node-20-upgrade-CI-testing
p2edwards Aug 23, 2024
c543376
Bump various github-provided actions to v4
p2edwards Aug 23, 2024
fcc3a3e
improve comment
p2edwards Aug 23, 2024
56e5f47
Pin Node to v20.17.0 / [email protected]
p2edwards Aug 23, 2024
375e092
Run latest, unpinned versions of Node in CI, too
p2edwards Aug 23, 2024
5da699c
Use the nodesource install script in Dockerfile
p2edwards Aug 23, 2024
944d24f
Merge pull request #5041 from kobotoolbox/kobocat-django-app-part-2-r…
jnm Aug 23, 2024
f587a1e
Bump actions/checkout and setup-python in pytest
p2edwards Aug 26, 2024
7e2aad3
Merge branch 'beta' into task915-simplify-button-component
magicznyleszek Aug 26, 2024
78eb204
Remove deprecated documentation
noliveleger Aug 28, 2024
aee0df0
Merge branch 'beta' into task915-simplify-button-component
duvld Aug 28, 2024
4281fa2
Merge branch 'beta' into beta-refactored
noliveleger Aug 28, 2024
a9662a8
Fix missing field in constance configuration
Guitlle Aug 28, 2024
f9d55ba
Merge pull request #5085 from kobotoolbox/fix-missing-constance-nlp-f…
Guitlle Aug 28, 2024
0fe50a3
Merge branch 'beta-refactored' of github.com:kobotoolbox/kpi into bet…
noliveleger Aug 29, 2024
d235ce1
Merge pull request #5012 from kobotoolbox/node-20-upgrade-CI-testing
jnm Aug 30, 2024
09a942a
Apply `--no-install-recommends` to OpenJDK install
jnm Aug 30, 2024
7d49107
Resolve Docker ConsistentInstructionCasing warning
jnm Aug 30, 2024
35c46d3
Resolve Docker LegacyKeyValueFormat warning
jnm Aug 30, 2024
01443e1
Merge pull request #5088 from kobotoolbox/no-install-recommends-openjdk
JacquelineMorrissette Aug 30, 2024
697f204
Merge branch 'refs/heads/main' into beta
JacquelineMorrissette Sep 2, 2024
8f30351
Merge branch 'refs/heads/beta' into release/2.024.33
JacquelineMorrissette Sep 2, 2024
d3c38c6
Merge branch 'beta' into task915-simplify-button-component
Sep 3, 2024
7a7ba6e
Merge branch 'beta' into beta-refactored
noliveleger Sep 3, 2024
53ff257
Merge branch 'beta-refactored' of github.com:kobotoolbox/kpi into bet…
noliveleger Sep 3, 2024
cc50e2e
improve comments for button type type
magicznyleszek Sep 3, 2024
98cf909
Merge pull request #5046 from kobotoolbox/task915-simplify-button-com…
magicznyleszek Sep 3, 2024
2dabaec
Fix wrong attribute
noliveleger Sep 4, 2024
57eb2b2
Merge branch 'kobocat-django-app-part-2-refactor-mock-deployment-back…
noliveleger Sep 4, 2024
b062996
Merge branch 'kobocat-django-app-part-2-handle-missing-xform' into ko…
noliveleger Sep 4, 2024
f6802ae
Merge branch 'kobocat-django-app-part-2-handle-missing-xform' into be…
noliveleger Sep 4, 2024
75cf23e
fix misalignment of columns in data table after paginating
RuthShryock Sep 5, 2024
ae91f5c
Fix DDA bug without service account
noliveleger Sep 5, 2024
b1d5000
Merge branch 'kobocat-django-app-part-2' into kobocat-django-app-part…
noliveleger Sep 5, 2024
a27edc3
Merge branch 'kobocat-django-app-part-2-remove-service-account' into …
noliveleger Sep 5, 2024
74b82e2
Merge branch 'kobocat-django-app-part-2-refactor-mock-deployment-back…
noliveleger Sep 5, 2024
0c7dde8
Fix asset clone UI crash from Project > Form > "Clone this project"
magicznyleszek Sep 5, 2024
0fb498b
Merge branch 'kobocat-django-app-part-2-handle-missing-xform' into ko…
noliveleger Sep 5, 2024
34b228b
Merge branch 'kobocat-django-app-part-2-handle-missing-xform' into be…
noliveleger Sep 5, 2024
985e974
Merge pull request #5100 from kobotoolbox/release-2.024.33-clone-asse…
RuthShryock Sep 5, 2024
3ccf9c8
Merge branch 'kobocat-django-app-part-2-better-error-handling' into b…
noliveleger Sep 5, 2024
d7bd068
Fix tests
noliveleger Sep 5, 2024
89efcdf
Merge branch 'kobocat-django-app-part-2-refactor-mock-deployment-back…
noliveleger Sep 5, 2024
569efe7
Merge branch 'kobocat-django-app-part-2-handle-missing-xform' into ko…
noliveleger Sep 5, 2024
0d7131f
Merge branch 'kobocat-django-app-part-2-better-error-handling' into b…
noliveleger Sep 5, 2024
1d2070f
Merge pull request #5096 from kobotoolbox/data-table-column-glitch
magicznyleszek Sep 9, 2024
559e691
conditional delete button label
pauloamorimbr Sep 11, 2024
5f22d64
Move condition to the button element to take advantage of its conditi…
pauloamorimbr Sep 11, 2024
00fc88c
Add DB indexes, only load PK of this Asset
noliveleger Sep 11, 2024
9e10341
Add reverse operation when deleting old tables
noliveleger Sep 12, 2024
fde9526
Do not use "safe_create_instance" anymore in DeploymentBackend classes
noliveleger Sep 12, 2024
5b4173f
Remove import
noliveleger Sep 12, 2024
2f17199
Merge branch 'kobocat-django-app-part-2-better-error-handling' into b…
noliveleger Sep 12, 2024
fdc9ed2
Merge pull request #5105 from kobotoolbox/fix-bad-performance-with-fo…
noliveleger Sep 12, 2024
81ef0fd
Merge pull request #5104 from kobotoolbox/task-1027-change-delete-pro…
p2edwards Sep 12, 2024
603ade4
Merge branch 'main' into release/2.024.33
noliveleger Sep 12, 2024
91d1909
Fix migration conflicts
noliveleger Sep 12, 2024
50e367b
Merge branch 'release/2.024.33' into beta
noliveleger Sep 12, 2024
b30a3e7
Merge branch 'beta' of github.com:kobotoolbox/kpi into beta
noliveleger Sep 12, 2024
f4529a3
Merge branch 'beta' into beta-refactored
noliveleger Sep 12, 2024
e0ab6f6
Fix bad merge
noliveleger Sep 12, 2024
147f53c
Skip some tests which fail in this release but are fixed in the futur…
noliveleger Sep 12, 2024
c9a38bd
Merge pull request #5107 from kobotoolbox/skip-temporarily-mock-attac…
noliveleger Sep 12, 2024
bb4062a
Merge branch 'release/2.024.36' into beta
noliveleger Sep 12, 2024
56df467
Merge branch 'beta' into beta-refactored
noliveleger Sep 12, 2024
2c945a0
Create `UniversalTable` and `PaginatedQueryUniversalTable` components
magicznyleszek Sep 13, 2024
a98ae4b
Add Access Log section to security route, add access log query and us…
magicznyleszek Sep 13, 2024
a3bb916
update styles of all security route sections
magicznyleszek Sep 16, 2024
0c797d0
simplify MFA section styles and HTML by removing BEM and making it us…
magicznyleszek Sep 16, 2024
6f62c3e
code review fixes
magicznyleszek Sep 17, 2024
8040ec7
Merge branch 'task858-universal-table' into task857-access-log-ui
magicznyleszek Sep 18, 2024
195d65d
hook up log out all button to API
magicznyleszek Sep 18, 2024
f2f6e46
Merge branch 'task857-access-log-ui' into task1059-access-log-ui-subm…
magicznyleszek Sep 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 44 additions & 13 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,69 @@ on:
jobs:
build:
runs-on: ubuntu-20.04

strategy:

matrix:
node-version:
- '16.15.0' # prior pinned Node version supported by kpi
- '20.17.0' # version pinned for kpi release
- '20' # latest available v20
- '22' # latest available v22
fail-fast: false # Let each job finish

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
# We need this particular version, as npm 8.5.5 is the last version
# that works with our package.json :sadface:.
node-version: '16.15.0'
node-version: ${{ matrix.node-version }}
check-latest: true # download newer semver match if available
cache: 'npm'

- name: Identify resolved node version
id: resolved-node-version
run: echo "NODE_VERSION=$(node --version)" >> "$GITHUB_OUTPUT"
- name: Add "Node ${{ steps.resolved-node-version.outputs.NODE_VERSION }}" to summary
run: echo "${{ matrix.node-version }} → **${{ steps.resolved-node-version.outputs.NODE_VERSION }}**" >> "$GITHUB_STEP_SUMMARY"

# Set up Chrome, for the unit tests
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- name: Check for cached node_modules

# Cache node_modules, keyed on os, node version, package-lock, and patches
- uses: actions/cache@v4
name: Check for cached node_modules
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', 'patches/**/*.patch') }}
- name: Install JavaScript dependencies (npm install)
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm install
- name: Run copy-fonts (if using cached node_modules)
if: steps.cache-nodemodules.outputs.cache-hit == 'true'
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-v${{ steps.resolved-node-version.outputs.NODE_VERSION }}-${{ hashFiles('**/package-lock.json', 'patches/**/*.patch') }}

# Cache hit: node_modules is copied from a previous run. Run copy-fonts
- if: steps.cache-nodemodules.outputs.cache-hit == 'true'
name: Run copy-fonts (if using cached node_modules)
run: npm run copy-fonts

# Cache miss: Run npm install, which does copy-fonts as post-install step
- if: steps.cache-nodemodules.outputs.cache-hit != 'true'
name: Install JavaScript dependencies (npm install)
run: npm install

# Build the app!
- name: Build Prod
run: SKIP_TS_CHECK=true npm run build

# Run TypeScript Checks and ESLint
- name: Check TypeScript # Separated for visibility
run: npm run check-types
- name: Check ESLint, errors only
run: npm run lint -- --quiet

# Unit Tests
- name: Build Tests
run: npx webpack --config webpack/test.config.js

- name: Run Tests, with mocha-chrome
run: npx mocha-chrome test/tests.html --chrome-launcher.connectionPollInterval=5000
# This step takes less than 1 minute if it succeeds, but will hang for
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pip-tools
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.15.0
v20.17.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.15.0
v20.17.0
22 changes: 9 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10 as build-python
FROM python:3.10 AS build-python

ENV VIRTUAL_ENV=/opt/venv \
TMP_DIR=/srv/tmp
Expand All @@ -10,7 +10,7 @@ COPY ./dependencies/pip/requirements.txt "${TMP_DIR}/pip_dependencies.txt"
RUN pip-sync "${TMP_DIR}/pip_dependencies.txt" 1>/dev/null


from python:3.10-slim
FROM python:3.10-slim

ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8
Expand Down Expand Up @@ -48,14 +48,8 @@ RUN mkdir -p "${NGINX_STATIC_DIR}" && \
# jnm (or the current on-call sysadmin). Thanks.

RUN apt-get -qq update && \
apt-get -qq -y install ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list && \
apt-get -qq update && \
apt-get -qq -y install openjdk-17-jre && \
apt-get -qq -y install curl && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get -qq -y install --no-install-recommends \
ffmpeg \
gdal-bin \
Expand All @@ -65,7 +59,9 @@ RUN apt-get -qq update && \
less \
libproj-dev \
locales \
nodejs=$(apt-cache show nodejs | grep -F 'Version: 16.15.0' | cut -f 2 -d ' ') \
# pin an exact Node version for stability. update this regularly.
nodejs=$(apt-cache show nodejs | grep -F 'Version: 20.17.0' | cut -f 2 -d ' ') \
openjdk-17-jre \
postgresql-client \
procps \
rsync \
Expand Down Expand Up @@ -109,14 +105,14 @@ WORKDIR ${KPI_SRC_DIR}/
RUN rm -rf ${KPI_NODE_PATH} && \
mkdir -p "${TMP_DIR}/.npm" && \
npm config set cache "${TMP_DIR}/.npm" --global && \
npm install -g npm@8.5.5 && \
# to pin an exact npm version, see 'git blame' here
npm install -g check-dependencies@1 && \
rm -rf "${KPI_SRC_DIR}/jsapp/fonts" && \
rm -rf "${KPI_SRC_DIR}/jsapp/compiled" && \
npm install --quiet && \
npm cache clean --force

ENV PATH $PATH:${KPI_NODE_PATH}/.bin
ENV PATH=$PATH:${KPI_NODE_PATH}/.bin

######################
# Build client code. #
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pip/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile dependencies/pip/dev_requirements.in
#
-e git+https://github.com/kobotoolbox/django-digest@43f3100a7e257942c313ad79057e6a0b1612a74a#egg=django_digest
-e git+https://github.com/kobotoolbox/django-digest@3995226ed8e5bd1cb32c640aae970f8c104f6156#egg=django_digest
# via -r dependencies/pip/requirements.in
-e git+https://github.com/trevoriancox/django-dont-vary-on.git@01a804122b7ddcdc22f50b40993f91c27b03bef6#egg=django-dont-vary-on
# via -r dependencies/pip/requirements.in
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pip/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# More up-to-date version of django-digest than PyPI seems to have.
# Also, python-digest is an unlisted dependency thereof.
-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest
-e git+https://github.com/kobotoolbox/django-digest@43f3100a7e257942c313ad79057e6a0b1612a74a#egg=django_digest
-e git+https://github.com/kobotoolbox/django-digest@3995226ed8e5bd1cb32c640aae970f8c104f6156#egg=django_digest

# ssrf protect
-e git+https://github.com/kobotoolbox/ssrf-protect@9b97d3f0fd8f737a38dd7a6b64efeffc03ab3cdd#egg=ssrf_protect
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pip/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile dependencies/pip/requirements.in
#
-e git+https://github.com/kobotoolbox/django-digest@43f3100a7e257942c313ad79057e6a0b1612a74a#egg=django_digest
-e git+https://github.com/kobotoolbox/django-digest@3995226ed8e5bd1cb32c640aae970f8c104f6156#egg=django_digest
# via -r dependencies/pip/requirements.in
-e git+https://github.com/trevoriancox/django-dont-vary-on.git@01a804122b7ddcdc22f50b40993f91c27b03bef6#egg=django-dont-vary-on
# via -r dependencies/pip/requirements.in
Expand Down
3 changes: 1 addition & 2 deletions jsapp/js/account/accountSettingsRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ const AccountSettings = observer(() => {
<bem.AccountSettings onSubmit={updateProfile}>
<bem.AccountSettings__actions>
<Button
type={'full'}
type='primary'
className='account-settings-save'
color={'blue'}
size={'l'}
isSubmit
label={t('Save Changes') + (form.isPristine ? '' : ' *')}
Expand Down
3 changes: 1 addition & 2 deletions jsapp/js/account/changePasswordRoute.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ const ChangePasswordRoute = class ChangePassword extends React.Component<WithRou
<bem.AccountSettings>
<bem.AccountSettings__actions>
<Button
type='bare'
color='dark-blue'
type='text'
size='l'
startIcon='close'
onClick={this.close.bind(this)}
Expand Down
10 changes: 7 additions & 3 deletions jsapp/js/account/plans/billingButton.component.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cx from 'classnames';
import type {ButtonProps} from 'js/components/common/button';
import type {ButtonProps, ButtonType} from 'js/components/common/button';
import Button from 'js/components/common/button';
import React from 'react';
import styles from './billingButton.module.scss';
Expand All @@ -10,10 +10,14 @@ import styles from './billingButton.module.scss';
* page that need reusable logic extend this component.
*/
export default function BillingButton(props: Partial<ButtonProps>) {
let buttonType: ButtonType = 'primary';
if (props.type) {
buttonType = props.type;
}

return (
<Button
type='full'
color='blue'
type={buttonType}
size='l'
{...props}
className={cx([styles.button, props.className])}
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/account/plans/confirmChangeModal.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const ConfirmChangeModal = ({
label={t('Submit')}
/>
<BillingButton
color='red'
type='danger'
isDisabled={isLoading}
onClick={onClickCancel}
label={t('Cancel')}
Expand Down
3 changes: 1 addition & 2 deletions jsapp/js/account/plans/plan.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ export default function Plan(props: PlanProps) {
hasMetaFeatures() && (
<div className={styles.comparisonButton}>
<Button
type='bare'
color='dark-blue'
type='text'
size='m'
label={
expandComparison
Expand Down
55 changes: 55 additions & 0 deletions jsapp/js/account/security/accessLog/accessLogSection.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Libraries
import React from 'react';

// Partial components
import Button from 'js/components/common/button';
import PaginatedQueryUniversalTable from 'js/universalTable/paginatedQueryUniversalTable.component';

// Utilities
import useAccessLogQuery, {type AccessLog} from 'js/query/queries/accessLog.query';
import {formatTime} from 'js/utils';
import sessionStore from 'js/stores/session';

// Styles
import securityStyles from 'js/account/security/securityRoute.module.scss';

export default function AccessLogSection() {
function logOutAllSessions() {
sessionStore.logOutAll();
}

return (
<>
<header className={securityStyles.securityHeader}>
<h2 className={securityStyles.securityHeaderText}>
{t('Recent account activity')}
</h2>

<div className={securityStyles.securityHeaderActions}>
<Button
type='text'
size='m'
onClick={logOutAllSessions}
label={t('Log out of all devices')}
startIcon='logout'
/>
</div>
</header>

<PaginatedQueryUniversalTable<AccessLog>
queryHook={useAccessLogQuery}
columns={[
// The `key`s of these columns are matching the `AccessLog` interface
// properties (from `accessLog.query.ts` file) using dot notation.
{key: 'metadata.source', label: t('Source')},
{
key: 'date_created',
label: t('Last activity'),
cellFormatter: (date: string) => formatTime(date),
},
{key: 'metadata.ip_address', label: t('IP Address')},
]}
/>
</>
);
}
54 changes: 31 additions & 23 deletions jsapp/js/account/security/apiToken/apiTokenSection.component.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
// Libraries
import React, {
useState,
useEffect,
} from 'react';
import {dataInterface} from 'js/dataInterface';
import cx from 'classnames';

// Partial components
import TextBox from 'js/components/common/textBox';
import Button from 'js/components/common/button';

// Utils
import {dataInterface} from 'js/dataInterface';
import {notify} from 'js/utils';

// Styles
import styles from './apiTokenSection.module.scss';
import securityStyles from 'js/account/security/securityRoute.module.scss';

const HIDDEN_TOKEN_VALUE = '*'.repeat(40);

Expand Down Expand Up @@ -42,29 +51,28 @@ export default function ApiTokenDisplay() {
}, [isVisible]);

return (
<div className={styles.root}>
<div className={styles.titleSection}>
<h2 className={styles.title}>{t('API Key')}</h2>
</div>

<div className={styles.bodySection}>
<TextBox
type={isVisible && !isFetching && token !== null ? 'text' : 'password'}
value={token !== null ? token : HIDDEN_TOKEN_VALUE}
readOnly
/>
</div>
<section className={securityStyles.securitySection}>
<div className={securityStyles.securitySectionTitle}>
<h2 className={securityStyles.securitySectionTitleText}>{t('API Key')}</h2>
</div>

<div className={styles.optionsSection}>
<Button
label='Display'
size='m'
color='blue'
type='frame'
onClick={toggleTokenVisibility}
/>
</div>
</div>
<div className={cx(securityStyles.securitySectionBody, styles.body)}>
<TextBox
type={isVisible && !isFetching && token !== null ? 'text' : 'password'}
value={token !== null ? token : HIDDEN_TOKEN_VALUE}
readOnly
className={styles.token}
/>
</div>

<div className={styles.options}>
<Button
label='Display'
size='m'
type='primary'
onClick={toggleTokenVisibility}
/>
</div>
</section>
);
}
Loading