Skip to content

Commit 11b52a8

Browse files
committed
chore(admin-server): remove dead GraphQL decorators, allowlist config, and shared GQL utilities
1 parent 32c3d87 commit 11b52a8

33 files changed

+84
-819
lines changed

configs/gql/allowlist/gql-playground.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

nx.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,13 @@
3232
"outputs": ["{projectRoot}/build", "{projectRoot}/dist"],
3333
"cache": true
3434
},
35-
"gql-copy": {
36-
"dependsOn": [
37-
{
38-
"projects": ["fxa-admin-panel"],
39-
"target": "gql-extract"
40-
}
41-
],
42-
"inputs": ["typescript", "^typescript"],
43-
"outputs": ["{projectRoot}/src/config/gql/allowlist"],
44-
"cache": true
45-
},
4635
"lint": {
4736
"inputs": ["lint", "{workspaceRoot}/.eslintrc.json"],
4837
"outputs": ["{projectRoot}/.eslintcache"],
4938
"cache": true
5039
},
5140
"prebuild": {
52-
"dependsOn": ["gql-copy"],
41+
"dependsOn": [],
5342
"inputs": [],
5443
"outputs": [
5544
"{projectRoot}/public/locales",

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"l10n:prime": "_scripts/l10n/prime.sh",
2424
"l10n:bundle": "_scripts/l10n/bundle.sh",
2525
"legal:clone": "_scripts/clone-legal-docs.sh",
26-
"gql:allowlist": "nx run-many -t gql-extract && nx run-many -t gql-copy",
2726
"check:mysql": "_scripts/check-mysql.sh",
2827
"check:url": "_scripts/check-url.sh",
2928
"prepare": "husky",
@@ -276,7 +275,6 @@
276275
"mocha-multi": "^1.1.7",
277276
"nx": "21.2.4",
278277
"nx-cloud": "19.1.0",
279-
"persistgraphql": "^0.3.11",
280278
"postcss": "8.5.0",
281279
"react-test-renderer": "^18.3.1",
282280
"reflect-metadata": "^0.2.1",

packages/functional-tests/scripts/start-services.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ NODE_OPTIONS="--max-old-space-size=7168" NODE_ENV=test npx nx run-many \
1818
--verbose \
1919
-p \
2020
123done \
21+
fxa-admin-panel \
22+
fxa-admin-server \
2123
fxa-auth-server \
2224
fxa-content-server \
2325
fxa-payments-server \
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
import { expect, test } from '../../lib/fixtures/standard';
6+
7+
const ADMIN_PANEL_URL = process.env.ADMIN_PANEL_URL ?? 'http://localhost:8091';
8+
const ADMIN_SERVER_URL = process.env.ADMIN_SERVER_URL ?? 'http://localhost:8095';
9+
10+
// Admin panel tests only run locally (stage/prod require SSO)
11+
test.skip(({ target }) => target.name !== 'local');
12+
13+
test.describe('Admin Panel', () => {
14+
test('admin panel loads and renders navigation', async ({ page }) => {
15+
await page.goto(ADMIN_PANEL_URL);
16+
await expect(
17+
page.getByRole('link', { name: /account search/i })
18+
).toBeVisible();
19+
});
20+
21+
test('admin panel heartbeat is healthy', async () => {
22+
const res = await fetch(`${ADMIN_PANEL_URL}/__lbheartbeat__`);
23+
expect(res.status).toBe(200);
24+
});
25+
26+
test('admin server heartbeat is healthy', async () => {
27+
const res = await fetch(`${ADMIN_SERVER_URL}/__lbheartbeat__`);
28+
expect(res.status).toBe(200);
29+
});
30+
31+
test('account search by email returns account data via API', async ({
32+
target,
33+
testAccountTracker,
34+
}) => {
35+
const credentials = testAccountTracker.generateAccountDetails();
36+
await target.createAccount(credentials.email, credentials.password);
37+
38+
const res = await fetch(
39+
`${ADMIN_SERVER_URL}/api/account/by-email?email=${encodeURIComponent(credentials.email)}`,
40+
{
41+
headers: {
42+
'oidc-claim-id-token-email': 'test-admin@mozilla.com',
43+
'remote-groups': 'vpn_fxa_admin_panel_prod',
44+
},
45+
}
46+
);
47+
expect(res.status).toBe(200);
48+
const data = await res.json();
49+
expect(data.email).toBe(credentials.email);
50+
});
51+
52+
test('account search from UI shows results', async ({
53+
target,
54+
page,
55+
testAccountTracker,
56+
}) => {
57+
const credentials = testAccountTracker.generateAccountDetails();
58+
await target.createAccount(credentials.email, credentials.password);
59+
60+
await page.goto(`${ADMIN_PANEL_URL}/account-search`);
61+
62+
const searchInput = page.getByRole('textbox');
63+
await searchInput.fill(credentials.email);
64+
await searchInput.press('Enter');
65+
66+
await expect(page.getByText(credentials.email)).toBeVisible({
67+
timeout: 10000,
68+
});
69+
});
70+
});

packages/fxa-admin-panel/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"jest": "27.5.1",
7676
"jest-watch-typeahead": "0.6.5",
7777
"nx": "21.2.4",
78-
"persistgraphql": "^0.3.11",
7978
"pm2": "^6.0.14",
8079
"postcss-import": "^16.1.0",
8180
"prettier": "^3.5.3",

packages/fxa-admin-panel/pm2.config.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,5 @@ module.exports = {
7171
ignore_watch: ['src/styles/tailwind.out.css'],
7272
time: true,
7373
},
74-
{
75-
name: 'admin-gql-allowlist',
76-
autorestart: false,
77-
script: 'yarn gql:allowlist',
78-
watch: ['src/**/*.ts'],
79-
cwd: __dirname,
80-
filter_env: ['npm_'],
81-
},
8274
],
8375
};

packages/fxa-admin-server/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"description": "FxA Admin Server",
55
"scripts": {
66
"prebuild": "yarn clean",
7-
"gql-copy": "mkdir -p src/config/gql/allowlist/ && cp ../../configs/gql/allowlist/*.json src/config/gql/allowlist/.",
8-
"build": "nest build && yarn copy-config && yarn gql-copy && yarn copy-email-assets && yarn copy-email-l10n-assets",
7+
"build": "nest build && yarn copy-config && yarn copy-email-assets && yarn copy-email-l10n-assets",
98
"copy-config": "cp ./src/config/*.json ./dist/packages/fxa-admin-server/src/config",
109
"copy-email-assets": "copyfiles --up 1 '../../libs/accounts/email-renderer/**/*.{mjml,ftl,txt,css}' dist/libs/ ",
1110
"copy-email-l10n-assets": "copyfiles --up 1 '../../libs/accounts/email-renderer/public/locales' dist/libs/accounts/email-render/public/locales ",

packages/fxa-admin-server/src/config/index.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,6 @@ convict.addFormats(require('convict-format-with-moment'));
1414
convict.addFormats(require('convict-format-with-validator'));
1515

1616
const conf = convict({
17-
gql: {
18-
allowlist: {
19-
doc: 'A list of json files holding allowed gql queries',
20-
env: 'GQL_ALLOWLIST',
21-
default: [
22-
'src/config/gql/allowlist/fxa-admin-panel.json',
23-
'src/config/gql/allowlist/gql-playground.json',
24-
],
25-
format: Array,
26-
},
27-
enabled: {
28-
doc: 'Toggles whether or not gql queries are checked against the allowlist.',
29-
env: 'GQL_ALLOWLIST_ENABLED',
30-
default: true,
31-
format: Boolean,
32-
},
33-
},
3417
authHeader: {
3518
default: USER_EMAIL_HEADER,
3619
doc: 'Authentication header that should be logged for the user',
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
/* This Source Code Form is subject to the terms of the Mozilla Public
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4-
import { Field, ObjectType } from '@nestjs/graphql';
54

65
export enum AccountDeleteStatus {
76
Success = 'Success',
87
Failure = 'Failure',
98
NoAccount = 'No account found',
109
}
1110

12-
@ObjectType()
1311
export class AccountDeleteResponse {
1412
/** Name of task held in the task queue. This can be used to get task's status later. */
15-
@Field({ nullable: false })
1613
public taskName!: string;
1714

1815
/** A valid account email or UID */
19-
@Field({ nullable: false })
2016
public locator!: string;
2117

2218
/** A short status message. */
23-
@Field({ nullable: false })
2419
status!: AccountDeleteStatus;
2520
}
2621

27-
@ObjectType()
2822
export class AccountDeleteTaskStatus {
2923
/** Name of task held in the task queue.. */
30-
@Field({ nullable: false })
3124
public taskName!: string;
3225

3326
/** A short status message. */
34-
@Field({ nullable: false })
3527
status!: string;
3628
}

0 commit comments

Comments
 (0)