Skip to content

Commit

Permalink
New portal reindex page.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Oct 11, 2023
1 parent eef29c7 commit f34a6e6
Show file tree
Hide file tree
Showing 12 changed files with 1,269 additions and 24 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ foursight-core
Change Log
----------

5.1.0
=====
* New tasks page (initially to kick off Portal reindex).


5.0.0
=====
* Update to Python 3.11.
Expand Down
368 changes: 368 additions & 0 deletions foursight_core/react/api/aws_ecs_tasks.py

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions foursight_core/react/api/react_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,38 @@ def reactapi_route_aws_ecs_task(task_definition_arn: str) -> Response: # noqa:
return app.core.reactapi_aws_ecs_task_run(task_definition_arn)
return app.core.create_forbidden_response()

@route("/aws/ecs/tasks_for_running/{task_name}", authorize=True)
def reactapi_route_aws_ecs_tasks_for_runing(task_name: str) -> Response: # noqa: implicit @staticmethod via @route
from .aws_ecs_tasks import get_aws_ecs_tasks_for_running
return get_aws_ecs_tasks_for_running(app.core._envs, task_definition_type=task_name)

@route("/aws/ecs/task_running/{cluster_arn}/{task_definition_arn}", authorize=True)
def reactapi_route_aws_ecs_task_running(cluster_arn: str, task_definition_arn: str) -> Response: # noqa: implicit @staticmethod via @route
from .aws_ecs_tasks import get_aws_ecs_task_running
return get_aws_ecs_task_running(app.core._envs,
cluster_arn=cluster_arn,
task_definition_arn=task_definition_arn,
check_other_clusters=True)

@route("/aws/ecs/task_last_run/{cluster_arn}/{task_definition_arn}", authorize=True)
def reactapi_route_aws_ecs_task_last_run(cluster_arn: str, task_definition_arn: str) -> Response: # noqa: implicit @staticmethod via @route
from .aws_ecs_tasks import get_aws_ecs_task_last_run
return get_aws_ecs_task_last_run(app.core._envs,
cluster_arn=cluster_arn,
task_definition_arn=task_definition_arn)

@route("/aws/ecs/tasks_running", authorize=True)
def reactapi_route_aws_ecs_tasks_running() -> Response: # noqa: implicit @staticmethod via @route
from .aws_ecs_tasks import get_aws_ecs_tasks_running
return get_aws_ecs_tasks_running(cluster_arn=app.request_arg("cluster_arn"),
task_definition_type=app.request_arg("task_name"),
task_definition_arn=app.request_arg("task_definition_arn"))

@route("/aws/ecs/task_run/{cluster_arn}/{task_definition_arn}", method="POST", authorize=True)
def reactapi_route_aws_ecs_task_run(cluster_arn: str, task_definition_arn: str) -> Response: # noqa: implicit @staticmethod via @route
from .aws_ecs_tasks import aws_ecs_run_task
return aws_ecs_run_task(cluster_arn, task_definition_arn, app.request_body())

@route("/aws/ecs/tasks/latest/details", authorize=True)
def reactapi_route_aws_ecs_task() -> Response: # noqa: implicit @staticmethod via @route
return app.core.reactapi_aws_ecs_tasks(latest=True)
Expand Down
2 changes: 1 addition & 1 deletion foursight_core/react/ui/static/css/main.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions foursight_core/react/ui/static/js/main.js

Large diffs are not rendered by default.

24 changes: 6 additions & 18 deletions poetry.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "foursight-core"
version = "5.0.0"
version = "5.0.0.1b2" # TODO: To become 5.1.0
description = "Serverless Chalice Application for Monitoring"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand All @@ -17,7 +17,7 @@ botocore = "^1.31.62"
click = "^7.1.2"
cron-descriptor = "^1.2.31"
cryptography = "39.0.2" # Required for AWS Cognito JWT decode (PyJWKClient)
dcicutils = "^8.0.0"
dcicutils = "7.12.0.2b9"
elasticsearch = "7.13.4"
elasticsearch-dsl = "^7.0.0"
geocoder = "1.38.1"
Expand Down
6 changes: 6 additions & 0 deletions react/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Page from './Page';
import RedirectPage from './pages/RedirectPage';
import SslCertificatesPage from './pages/SslCertificatesPage';
import PortalAccessKeyPage from './pages/PortalAccessKeyPage';
import PortalReindexPage from './pages/PortalReindexPage';
import UserPage from './pages/UserPage';
import UserCreatePage from './pages/UserCreatePage';
import UserEditPage from './pages/UserEditPage';
Expand Down Expand Up @@ -149,6 +150,11 @@ const App = () => {
<PortalAccessKeyPage />
</Page.KnownEnvRequired>
}/>
<Route path="/api/react/:environ/portal/reindex" element={
<Page.AuthorizationRequired>
<PortalReindexPage />
</Page.AuthorizationRequired>
}/>
<Route path="/api/react/:environ/ingestion/submissions" element={
<Page.AuthorizationRequired>
<IngestionSubmissionsPage />
Expand Down
2 changes: 2 additions & 0 deletions react/src/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ const MainMenu = ({ header }) => {
<MenuItem path="/info" label="Info" />
<MenuItem path="/checks" label="Checks" />
<MenuSeparator />
<MenuItem path="/portal/reindex" label="Reindex" />
<MenuSeparator />
<MenuItem path="/aws/infrastructure" label="Infrastructure" />
<MenuItem path="/ingestion/submissions" label="Ingestion" />
<MenuItem path="/aws/s3" label="S3" />
Expand Down
2 changes: 1 addition & 1 deletion react/src/css/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
display: block;
cursor: default;
}
.dropdown-content a:hover {background-color: #365e75; color:yellow; cursor:pointer;}
.dropdown-content a:hover {background-color: var(--box-fg); color:yellow; cursor:pointer;}
.dropdown-content span:hover {color:var(--box-fg-darken);}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropdown-button {color: black;}
Expand Down
4 changes: 4 additions & 0 deletions react/src/pages/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const HomePage = (props) => {
<li> To view Foursight <b><Link to="/users">users</Link></b> click <b><Link to="/users"><u>here</u></Link></b>. </li>
<li> To view <b><Link to="/aws/s3">AWS S3</Link></b> info click <b><Link to="/aws/s3"><u>here</u></Link></b>. </li>
<li> To view <b><Link to="/aws/infrastructure">AWS infrastructure</Link></b> info click <b><Link to="/aws/infrastructure"><u>here</u></Link></b>. </li>
<li> To view <b><Link to="/portal/reindex">Reindex Portal</Link></b> info click <b><Link to="/portal/reindex"><u>here</u></Link></b>.
<small style={{position: "relative", top: "1pt", color: "red"}}><b>&nbsp;&nbsp;{Char.LeftArrow} NEW</b></small>
</li>

</ul>
</div>
<div className="box thickborder" style={{margin:"20pt",padding:"10pt",marginTop:"-10pt"}}>
Expand Down
Loading

0 comments on commit f34a6e6

Please sign in to comment.