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

UI Clean up #247

Merged
merged 20 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"integrity": "sha256:0ec758e44468ba2a8b70b87613762ab04e50f7bb5eac8f2aea592cff213dbde5"
}
}
}
}
1 change: 1 addition & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
DEFAULT_BRANCH: main
VALIDATE_ALL_CODEBASE: false
VALIDATE_PYTHON_PYLINT: false
VALIDATE_JSCPD: false
LINTER_RULES_PATH: /
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
PYTHON_FLAKE8_CONFIG_FILE: .flake8
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ build-css:
mkdir -p static/assets/images
cp -R node_modules/govuk-frontend/dist/govuk/assets/fonts/. static/assets/fonts
cp -R node_modules/govuk-frontend/dist/govuk/assets/images/. static/assets/images
cp -R node_modules/@ministryofjustice/frontend/moj/assets/images/. static/assets/images
npm run css

build-js:
Expand Down
2 changes: 0 additions & 2 deletions ap/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
"django.contrib.staticfiles",
# Provides shell_plus, runserver_plus, etc
"django_extensions",
# frontend component integration with govuk_frontend node-js package
"govuk_frontend_django",
# Provide structured log service
"django_structlog",
# First party project defined apps
Expand Down
4 changes: 3 additions & 1 deletion ap/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
LOGGING["loggers"]["ap"]["level"] = LOG_LEVEL # noqa: F405

AUTHENTICATION_BACKENDS = [
"rules.permissions.ObjectPermissionBackend",
"django.contrib.auth.backends.ModelBackend",
]

Expand All @@ -34,3 +33,6 @@
},
},
}

GLUE_CATALOG_ID = "123456789012"
DEFAULT_STS_ROLE_TO_ASSUME = "arn:aws:iam::123456789012:role/test-role-12345"
4 changes: 2 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apiVersion: v2
name: analytical-platform-ui
description: Analytical Platform UI
type: application
version: 0.1.6
appVersion: 0.1.6
version: 0.1.7
appVersion: 0.1.7
icon: https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Ministry_of_Justice_logo_%28United_Kingdom%29.svg/611px-Ministry_of_Justice_logo_%28United_Kingdom%29.svg.png
maintainers:
- name: moj-data-platform-robot
Expand Down
3 changes: 3 additions & 0 deletions examples/launch.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"justMyCode": false,
"preLaunchTask": "aws-sso-process",
"program": "${workspaceFolder}/manage.py",
"env": {
"DJANGO_SETTINGS_MODULE": "ap.settings.local"
}
},
{
"name": "Python: Debug Tests",
Expand Down
2 changes: 1 addition & 1 deletion examples/tasks.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "aws-sso-process",
"type": "shell",
"command": "aws-sso process --sts-refresh --profile analytical-platform-compute-development:modernisation-platform-sandbox"
"command": "aws-sso process --sts-refresh --profile analytical-platform-management-production:AdministratorAccess"
}
]
}
27 changes: 15 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
},
"license": "MIT",
"devDependencies": {
"sass": "1.77.6"
"sass": "1.77.8"
},
"dependencies": {
"@ministryofjustice/frontend": "2.1.3",
"govuk-frontend": "5.4.0",
"@ministryofjustice/frontend": "2.2.0",
"govuk-frontend": "5.5.0",
"jquery": "3.7.1",
"nunjucks": "3.2.4"
}
Expand Down
2 changes: 1 addition & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
black==24.4.2
flake8==7.1.0
isort==5.13.2
mypy==1.9.0
mypy==1.11.2
pre-commit==3.7.1
pytest-dotenv==0.5.2
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ asgiref==3.8.1
Authlib==1.3.1
boto3==1.34.158
cfgv==3.4.0
Django==4.2.15
Django==5.1
django-structlog==8.1.0
django_extensions==3.2.3
govuk-frontend-django==0.9.1
gunicorn==22.0.0
gunicorn==23.0.0
iniconfig==2.0.0
josepy==1.14.0
jwt==1.3.1
model-bakery==1.17.0
model-bakery==1.19.5
moto[all]==5.0.11
psycopg2==2.9.9
PyJWT==2.4.0
pyOpenSSL==24.1.0
pytest==8.0.0
pytest==8.3.2
pytest-django==4.8.0
python-dotenv==1.0.1
requests==2.32.3
Expand Down
8 changes: 6 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
{% extends "govuk_frontend_django/base.html" %}
{% load static govuk_frontend_django %}
{% extends "govuk-frontend.html" %}
{% load static %}

{% block title %}Analytical Platform{% endblock title %}

Expand All @@ -12,6 +12,10 @@
{% include "includes/header.html" %}
{% endblock header %}

{% block footer %}
{% include "includes/footer.html" %}
{% endblock footer %}


{% block body_end %}
<script src="{% static 'assets/js/govuk.js' %}"></script>
Expand Down
2 changes: 1 addition & 1 deletion templates/database_access/database/detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}

{% block title %}Analytical Platform - Tables for {{ database.name }}{% endblock title %}
{% block content %}

<span class="govuk-caption-xl">Database</span>
Expand Down
1 change: 1 addition & 0 deletions templates/database_access/database/list.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% block title %}Analytical Platform - Databases{% endblock title %}

{% block content %}
<div class="govuk-width-container">
Expand Down
1 change: 1 addition & 0 deletions templates/database_access/database/table.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% block title %}Analytical Platform - Table {{ table.name }}{% endblock title %}

{% block content %}

Expand Down
57 changes: 57 additions & 0 deletions templates/govuk-frontend.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8" lang="en"><![endif]-->
<!--[if gt IE 8]><!--><html lang="en" class="govuk-template"><!--<![endif]-->
{% load static %}
<head>
<meta charset="utf-8">
<title>
{% block title %}
{% endblock %}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
{# Ensure that older IE versions always render with the correct rendering engine #}
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="theme-color" content="{{ themeColor | default:'#0b0c0c' }}" />
michaeljcollinsuk marked this conversation as resolved.
Show resolved Hide resolved
{% block headIcons %}
<link rel="shortcut icon" href="{% static 'assets/images/favicon.ico' %}" type="image/x-icon">
<link rel="apple-touch-icon" href="{% static 'assets/images/moj-apple-touch-icon-180x180.png' %}" sizes="180x180">
<link rel="apple-touch-icon" href="{% static 'assets/images/moj-apple-touch-icon-167x167.png' %}" sizes="167x167">
<link rel="apple-touch-icon" href="{% static 'assets/images/moj-apple-touch-icon-152x152.png' %}" sizes="152x152">
<link rel="apple-touch-icon" href="{% static 'assets/images/moj-apple-touch-icon.png' %}">
{% endblock %}

{% block head %}{% endblock %}
{# The default og:image is added below head so that scrapers see any custom metatags first, and this is just a fallback #}
{# image url needs to be absolute e.g. http://wwww.domain.com/.../govuk-opengraph-image.png #}
{% if request %}
<meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}{% static 'assets/images/moj-opengraph-image.png' %}">
{% else %}
<meta property="og:image" content="http://localhost/{% static 'assets/images/moj-opengraph-image.png' %}">
{% endif %}

</head>

<body class="govuk-template__body govuk-frontend-supported">
<script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
<a href="#main-content" class="govuk-skip-link" data-module="govuk-skip-link">Skip to main content</a>
{% block body_start %}{% endblock %}

{% block header %}
{% endblock %}

{% block main %}
{% block before_content %}{% endblock %}
<div class="{% block container_class_names %}govuk-width-container{% endblock container_class_names %}">
<main class="{% block main_class_names %}govuk-main-wrapper{% endblock main_class_names %}" id="main-content" role="main">
{% block content %}{% endblock %}
</main>
</div>
{% endblock %}

{% block footer %}
{% endblock %}

{% block body_end %}
{% endblock %}
</body>
</html>
2 changes: 2 additions & 0 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

{% extends "base.html" %}

{% block title %}Analytical Platform - Home{% endblock title %}

{% block content %}

<div class="govuk-width-container">
Expand Down
34 changes: 34 additions & 0 deletions templates/includes/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<footer class="govuk-footer">
<div class="govuk-width-container">
<div class="govuk-footer__meta">
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
<svg
aria-hidden="true"
focusable="false"
class="govuk-footer__licence-logo"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 483.2 195.7"
height="17"
width="41">
<path
fill="currentColor"
d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145" />
</svg>
<span class="govuk-footer__licence-description">
All content is available under the
<a
class="govuk-footer__link"
href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
rel="license">Open Government Licence v3.0</a>, except where otherwise stated
</span>
</div>
<div class="govuk-footer__meta-item">
<a
class="govuk-footer__link govuk-footer__copyright-logo"
href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">
© Crown copyright
</a>
</div>
</div>
</div>
</footer>
2 changes: 2 additions & 0 deletions templates/quicksight/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends "base.html" %}

{% block title %}Analytical Platform - Quicksight{% endblock title %}

{% block container_class_names %}govuk-grid-column-full{% endblock container_class_names %}

{% block content %}
Expand Down
Empty file added tests/aws/__init__.py
Empty file.
60 changes: 60 additions & 0 deletions tests/aws/test_glue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from django.conf import settings

import pytest

from ap.aws.glue import GlueService


class TestGlueService:

@pytest.fixture
def glue_service(self):
yield GlueService(settings.GLUE_CATALOG_ID)

def test_get_database_list(self, glue_service):
databases = glue_service.get_database_list()

assert len(databases) == 2

@pytest.mark.parametrize(
"database_name,expected_table_count",
[
("test_database", 2),
("test_database_2", 1),
],
)
def test_get_table_list(self, glue_service, database_name, expected_table_count):
tables = glue_service.get_table_list(database_name)
assert len(tables) == expected_table_count

def test_get_table_detail(self, glue_service):
db_name = "test_database"
table_name = "test_table_1"
table = glue_service.get_table_detail(db_name, table_name)

assert table["Name"] == table_name

@pytest.mark.parametrize(
"resource,service,region_name,account_id,expected_arn",
[
("resource", "", "", "", "arn:aws:glue:eu-west-2:123456789012:resource"),
("resource", "service", "", "", "arn:aws:service:eu-west-2:123456789012:resource"),
(
"resource",
"service",
"region_name",
"",
"arn:aws:service:region_name:123456789012:resource",
),
(
"resource",
"service",
"region_name",
"account_id",
"arn:aws:service:region_name:account_id:resource",
),
],
)
def test_arn(self, glue_service, resource, service, region_name, account_id, expected_arn):
arn = glue_service.arn(resource, service, region_name, account_id)
assert arn == expected_arn
Loading
Loading