Skip to content

Commit

Permalink
Merge branch 'develop' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredeen committed Nov 29, 2023
2 parents ef723f5 + a60966a commit 9894b68
Show file tree
Hide file tree
Showing 32 changed files with 135 additions and 74 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ repos:
- id: end-of-file-fixer
exclude: static/vendor/
- id: pretty-format-json
exclude: ^fixtures/
args: [--autofix]


Expand Down
2 changes: 1 addition & 1 deletion charts/apps/dash/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
image: {{ .Values.appconfig.image }}
imagePullPolicy: IfNotPresent
ports:
- containerPort: {{ .Values.service.targetport }}
- containerPort: {{ .Values.appconfig.port }}
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
resources:
Expand Down
2 changes: 1 addition & 1 deletion charts/apps/dash/chart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ spec:
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetport }}
targetPort: {{ .Values.appconfig.port }}
selector:
release: {{ $.Release.Name }}
2 changes: 1 addition & 1 deletion charts/apps/shiny/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ spec:
resources:
{{- toYaml .Values.flavor | nindent 10 }}
ports:
- containerPort: {{ .Values.service.targetport }}
- containerPort: {{ .Values.appconfig.port }}
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
2 changes: 1 addition & 1 deletion charts/apps/shiny/chart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ spec:
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetport }}
targetPort: {{ .Values.appconfig.port }}
selector:
release: {{ $.Release.Name }}
3 changes: 1 addition & 2 deletions charts/apps/shinyproxy/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ spec:
- containerPort: {{ .Values.appconfig.proxyport }}
volumeMounts:
- name: application-conf-{{ .Release.Name }}
mountPath: /opt/shinyproxy/application.yml
subPath: application.yml
mountPath: /opt/shinyproxy/config
imagePullPolicy: IfNotPresent
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/apps/shinyproxy/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project:
slug: project-slug

appconfig:
proxyimage: ghcr.io/scilifelabdatacentre/serve-shinyproxy:231030-1144
proxyimage: ghcr.io/scilifelabdatacentre/serve-shinyproxy:231124-2126
proxyport: 8080
port: 3838
image:
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/ui-tests/test-deploy-app.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("Test deploying app", () => {
cy.get('tr:contains("' + app_name_public + '")').find('span').should('contain', 'Running')

cy.visit("/apps")
cy.get("title").should("have.text", "Apps | SciLifeLab Serve")
cy.get("title").should("have.text", "Apps | SciLifeLab Serve (beta)")
cy.get('h3').should('contain', 'Public apps')
cy.get('h5.card-title').should('contain', app_name_public)

Expand All @@ -104,7 +104,7 @@ describe("Test deploying app", () => {
cy.get('button').contains('Delete').click()
cy.get('tr:contains("' + app_name_public + '")').find('span').should('contain', 'Deleted')
cy.visit("/apps")
cy.get("title").should("have.text", "Apps | SciLifeLab Serve")
cy.get("title").should("have.text", "Apps | SciLifeLab Serve (beta)")
cy.get('h3').should('contain', 'Public apps')
cy.get('h5.card-title').should('not.exist')

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ui-tests/test-homepage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ describe("Test of the home page", () => {
})

it("should have proper title", () => {
cy.get("title").should("have.text", "Home | SciLifeLab Serve")
cy.get("title").should("have.text", "Home | SciLifeLab Serve (beta)")
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/ui-tests/test-login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ describe("Test login", () => {

it("Should have proper title", () => {
cy.visit("accounts/login/")
cy.get("title").should("have.text", "Login | SciLifeLab Serve")
cy.get("title").should("have.text", "Login | SciLifeLab Serve (beta)")
})
})
8 changes: 4 additions & 4 deletions cypress/e2e/ui-tests/test-project-as-contributor.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ describe("Test project contributor user functionality", () => {

// Names of objects to create
const project_name = "e2e-create-default-proj-test"
const project_title_name = project_name + " | SciLifeLab Serve"
const project_title_name = project_name + " | SciLifeLab Serve (beta)"

cy.visit("/projects/")
cy.get("title").should("have.text", "My projects | SciLifeLab Serve")
cy.get("title").should("have.text", "My projects | SciLifeLab Serve (beta)")

// Click button for UI to create a new project
cy.get("a").contains('New project').click()
Expand Down Expand Up @@ -106,10 +106,10 @@ describe("Test project contributor user functionality", () => {

// Names of objects to create
const project_name = "e2e-create-ml-proj-test"
const project_title_name = project_name + " | SciLifeLab Serve"
const project_title_name = project_name + " | SciLifeLab Serve (beta)"

cy.visit("/projects/")
cy.get("title").should("have.text", "My projects | SciLifeLab Serve")
cy.get("title").should("have.text", "My projects | SciLifeLab Serve (beta)")

// Click button for UI to create a new project
cy.get("a").contains('New project').click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ui-tests/test-project-as-superuser.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("Test superuser access", () => {
// Names of objects to create
const project_name = "e2e-create-proj-test"
const volume_name = "e2e-project-vol"
const project_title_name = project_name + " | SciLifeLab Serve"
const project_title_name = project_name + " | SciLifeLab Serve (beta)"
const createResources = Cypress.env('create_resources');

if (createResources === 'true') {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ui-tests/test-public-apps-page.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Test of the public apps page", () => {
it("should contain header with text Apps", () => {

cy.get('h3').should('contain', 'apps')
cy.get("title").should("have.text", "Apps | SciLifeLab Serve")
cy.get("title").should("have.text", "Apps | SciLifeLab Serve (beta)")
})

})
2 changes: 1 addition & 1 deletion cypress/e2e/ui-tests/test-public-models-page.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Test of the public models page", () => {
it("should contain header with text Models", () => {

cy.get('h3').should('contain', 'Models')
cy.get("title").should("have.text", "Models | SciLifeLab Serve")
cy.get("title").should("have.text", "Models | SciLifeLab Serve (beta)")
})

it("should contain text about no public models", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ui-tests/test-signup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Test sign up", () => {
it("should create new user account with valid form input", () => {

cy.visit("/signup/");
cy.get("title").should("have.text", "Register | SciLifeLab Serve")
cy.get("title").should("have.text", "Register | SciLifeLab Serve (beta)")

cy.get('input[name=email]').type(users.signup_user.email);
cy.get('input[name=first_name]').type("first name");
Expand Down
8 changes: 4 additions & 4 deletions fixtures/apps_fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
"category": "serve",
"chart": "apps/custom-app/chart",
"created_on": "2023-08-25T21:34:37.815Z",
"description": "",
"description": "Apps built with Gradio, Streamlit, Flask, etc.",
"logo": "default-logo.png",
"name": "Custom App",
"priority": "400",
Expand Down Expand Up @@ -594,12 +594,12 @@
},
{
"fields": {
"category": "admin-apps",
"category": "serve",
"chart": "apps/shiny/chart",
"created_on": "2023-08-25T21:34:37.815Z",
"description": "Shiny app without ShinyProxy as a middle layer.",
"description": "Shiny app without ShinyProxy as a middle layer. [admins only]",
"logo": "shinyapp-logo.png",
"name": "Shiny App",
"name": "Shiny App (single copy)",
"priority": "400",
"settings": {
"appconfig": {
Expand Down
18 changes: 9 additions & 9 deletions fixtures/projects_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@
"slug": "default",
"template": {
"apps": {
"project-minio": {
"app:volumeK8s": [
"project-vol"
],
"credentials.access_key": "accesskey",
"credentials.secret_key": "secretkey123",
"permission": "project",
"slug": "minio"
},
"project-netpolicy": {
"slug": "netpolicy"
},
Expand All @@ -85,6 +76,15 @@
"volume.accessModes": "ReadWriteMany",
"volume.size": "1Gi",
"volume.storageClass": "microk8s-hostpath"
},
"project-minio": {
"app:volumeK8s": [
"project-vol"
],
"credentials.access_key": "accesskey",
"credentials.secret_key": "secretkey123",
"permission": "project",
"slug": "minio"
}
},
"environments": {
Expand Down
12 changes: 6 additions & 6 deletions models/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_models_view(self):

# Check status code
assert response.status_code == 200
assert "<title>Models | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Models | SciLifeLab Serve (beta)</title>" in response.content.decode()

@pytest.mark.skip(reason="It's not working")
def test_public_model_details_view(self):
Expand All @@ -128,7 +128,7 @@ def test_public_model_details_view(self):
assert response.status_code == 200
self.assertTemplateUsed(response, "models/models_details_public.html")
assert "Model Details" in response.content.decode()
assert "<title>Model public Details | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Model public Details | SciLifeLab Serve (beta)</title>" in response.content.decode()

@pytest.mark.skip(reason="Could not make this work")
def test_private_model_details_view(self):
Expand All @@ -143,7 +143,7 @@ def test_private_model_details_view(self):
assert response.status_code == 200
self.assertTemplateUsed(response, "models/models_details_private.html")
assert "Model Details" in response.content.decode()
assert "<title>Private model test Details | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Private model test Details | SciLifeLab Serve (beta)</title>" in response.content.decode()

@pytest.mark.skip(reason="I am even not sure that it's being invoked")
def test_model_create_view(self):
Expand All @@ -153,7 +153,7 @@ def test_model_create_view(self):
assert response.status_code == 200
self.assertTemplateUsed(response, "models/models_details_private.html")
assert "Model Details" in response.content.decode()
assert "<title>Private model test Details | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Private model test Details | SciLifeLab Serve (beta)</title>" in response.content.decode()

@pytest.mark.skip(reason="I think that the project is not created for this")
def test_models_list_view(self):
Expand All @@ -162,7 +162,7 @@ def test_models_list_view(self):
assert response.status_code == 200
self.assertTemplateUsed(response, "models/models_list.html")
assert "Models" in response.content.decode()
assert f"<title>{self.project.name} - Models | SciLifeLab Serve</title>" in response.content.decode()
assert f"<title>{self.project.name} - Models | SciLifeLab Serve (beta)</title>" in response.content.decode()


class ModelViewForbidden(TestCase):
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_forbidden_models_list(self):
response = self.client.get(reverse("models:list", kwargs={"user": owner, "project": project.slug}))
self.assertTemplateUsed(response, "403.html")
self.assertEqual(response.status_code, 403)
assert "<title>Forbidden | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Forbidden | SciLifeLab Serve (beta)</title>" in response.content.decode()

def test_forbidden_models_create(self):
"""
Expand Down
10 changes: 5 additions & 5 deletions portal/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_index():

# Check if it returns the correct status code
assert response.status_code == 200
assert "<title>Apps | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Apps | SciLifeLab Serve (beta)</title>" in response.content.decode()


@pytest.mark.django_db
Expand All @@ -41,7 +41,7 @@ def test_home_view_class():

# Check status code
assert response.status_code == 200
assert "<title>Home | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Home | SciLifeLab Serve (beta)</title>" in response.content.decode()


def test_about_view():
Expand All @@ -51,7 +51,7 @@ def test_about_view():

# Check status code
assert response.status_code == 200
assert "<title>About | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>About | SciLifeLab Serve (beta)</title>" in response.content.decode()


def test_teaching_view():
Expand All @@ -61,7 +61,7 @@ def test_teaching_view():

# Check status code
assert response.status_code == 200
assert "<title>Teaching | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Teaching | SciLifeLab Serve (beta)</title>" in response.content.decode()


def test_privacy_view():
Expand All @@ -71,4 +71,4 @@ def test_privacy_view():

# Check status code
assert response.status_code == 200
assert "<title>Privacy policy | SciLifeLab Serve</title>" in response.content.decode()
assert "<title>Privacy policy | SciLifeLab Serve (beta)</title>" in response.content.decode()
2 changes: 2 additions & 0 deletions portal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ def get(self, request, id=0):
published_apps, request = get_public_apps(request, id=id, get_all=False)
published_models = PublishedModel.objects.all()
news_objects = NewsObject.objects.all().order_by("-created_on")
link_all_news = False
if published_models.count() >= 3:
published_models = published_models[:3]
else:
published_models = published_models

if news_objects.count() >= 3:
news_objects = news_objects[:3]
link_all_news = True
else:
news_objects = news_objects

Expand Down
2 changes: 1 addition & 1 deletion projects/tests/test_project_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_project_overview(self):
resp = self.get_project_page("details")
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, "projects/overview.html")
assert f"<title>{self.project_name} | SciLifeLab Serve</title>" in resp.content.decode()
assert f"<title>{self.project_name} | SciLifeLab Serve (beta)</title>" in resp.content.decode()


class FrobiddenProjectViewTestCase(TestCase):
Expand Down
7 changes: 6 additions & 1 deletion static/css/serve-elements.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

.btn:focus,
.btn:hover {

box-shadow: 0 0.5rem 1rem rgba(var(--bs-body-color-rgb), .15) !important;
text-decoration: none;
}
Expand Down Expand Up @@ -158,6 +157,12 @@ h6 {
}

/* main navigation */

a.navbar-brand::after,
a.tag::after {
display:none;
}

.nav .nav-item .nav-link {
color: var(--serve-teal);
font-weight: 500;
Expand Down
4 changes: 4 additions & 0 deletions studio/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@
# then setting BigAutoField on app level (ex /projects/apps.py)
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

# Allow all clients to make requests to the OpenAPI
CORS_URLS_REGEX = r"^/openapi/.*$"
CORS_ALLOW_ALL_ORIGINS = True

# https://www.django-rest-framework.org/api-guide/authentication/#setting-the-authentication-scheme
# DEFAULT_VERSIONING_CLASS: NamespaceVersioning uses the URL path scheme, e.g. /v1/
# https://www.django-rest-framework.org/api-guide/versioning/
Expand Down
Loading

0 comments on commit 9894b68

Please sign in to comment.