Skip to content

Commit

Permalink
Many small UI bugfixes (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
akochari authored Dec 21, 2023
1 parent 321d147 commit 2edb299
Show file tree
Hide file tree
Showing 237 changed files with 25,173 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
- id: detect-private-key
- id: mixed-line-ending
- id: end-of-file-fixer
exclude: static/vendor/
exclude: static/vendor/|static/wiki/
- id: pretty-format-json
exclude: ^fixtures/
args: [--autofix]
Expand Down
2 changes: 1 addition & 1 deletion common/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class EmailVerificationTableInline(admin.StackedInline):

class UserAdmin(DefaultUserAdmin):
inlines = (UserProfileInline, EmailVerificationTableInline)
list_display = ("username", "email", "first_name", "last_name", "is_staff", "get_affiliation")
list_display = ("email", "first_name", "last_name", "is_active", "is_staff", "get_affiliation", "date_joined")
list_select_related = ("userprofile",)

def get_affiliation(self, instance):
Expand Down
33 changes: 17 additions & 16 deletions cypress/e2e/ui-tests/test-deploy-app.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ describe("Test deploying app", () => {
})
})

it("can deploy a private and public app", { defaultCommandTimeout: 100000 }, () => {
it("can deploy a project and public app", { defaultCommandTimeout: 100000 }, () => {
// Names of objects to create
const project_name = "e2e-deploy-app-test"
const app_name_public = "e2e-streamlit-example-public"
const app_name_public_2 = "e2e-streamlit-example-2-public"
const app_name_private = "e2e-streamlit-example-private"
const app_name_project = "e2e-streamlit-example-project"
const app_description = "e2e-streamlit-description"
const app_description_2 = "e2e-streamlit-2-description"
const image_name = "ghcr.io/scilifelabdatacentre/example-streamlit:latest"
Expand All @@ -56,39 +56,40 @@ describe("Test deploying app", () => {
cy.visit("/projects/")
cy.contains('.card-title', project_name).parents('.card-body').siblings('.card-footer').find('a:contains("Open")').first().click()

// Create an app with private or project permissions
cy.log("Now creating a private or project app")
// Create an app with project permissions
cy.log("Now creating a project app")
cy.get('div.card-body:contains("' + app_type + '")').find('a:contains("Create")').click()
cy.get('input[name=app_name]').type(app_name_private)
cy.get('input[name=app_name]').type(app_name_project)
cy.get('textarea[name=app_description]').type(app_description)
cy.get('#permission').select('project')
cy.get('input[name="appconfig.port"]').clear().type("8501")
cy.get('input[name="appconfig.image"]').clear().type(image_name)
cy.get('input[name="appconfig.path"]').clear().type("/home")
cy.get('button').contains('Create').click()
// check that the app was created
cy.get('tr:contains("' + app_name_private + '")').find('span').should('contain', 'Running')
cy.get('tr:contains("' + app_name_private + '")').find('span').should('contain', 'project')
cy.get('tr:contains("' + app_name_project + '")').find('span').should('contain', 'Running')
cy.get('tr:contains("' + app_name_project + '")').find('span').should('contain', 'project')
// check that the app is not visible under public apps
cy.visit('/apps/')
cy.get('h3').should('contain', 'Public apps')
cy.get('h5.card-title').should('not.exist')

// make this app public as an update and check that it works
cy.log("Now making the private or project app public")
cy.log("Now making the project app public")
cy.visit("/projects/")
cy.contains('.card-title', project_name).parents('.card-body').siblings('.card-footer').find('a:contains("Open")').first().click()
cy.get('tr:contains("' + app_name_private + '")').find('i.bi-three-dots-vertical').click()
cy.get('tr:contains("' + app_name_private + '")').find('a').contains('Settings').click()
cy.get('tr:contains("' + app_name_project + '")').find('i.bi-three-dots-vertical').click()
cy.get('tr:contains("' + app_name_project + '")').find('a').contains('Settings').click()
cy.get('#permission').select('public')
cy.get('button').contains('Update').click()
cy.get('tr:contains("' + app_name_private + '")').find('span').should('contain', 'Running')
cy.get('tr:contains("' + app_name_private + '")').find('span').should('contain', 'public')
cy.get('tr:contains("' + app_name_project + '")').find('span').should('contain', 'Running')
cy.get('tr:contains("' + app_name_project + '")').find('span').should('contain', 'public')

cy.log("Now deleting the private or project app (by now public)")
cy.get('tr:contains("' + app_name_private + '")').find('i.bi-three-dots-vertical').click()
cy.get('tr:contains("' + app_name_private + '")').find('a.confirm-delete').click()
cy.log("Now deleting the project app (by now public)")
cy.get('tr:contains("' + app_name_project + '")').find('i.bi-three-dots-vertical').click()
cy.get('tr:contains("' + app_name_project + '")').find('a.confirm-delete').click()
cy.get('button').contains('Delete').click()
cy.get('tr:contains("' + app_name_private + '")').find('span').should('contain', 'Deleted')
cy.get('tr:contains("' + app_name_project + '")').find('span').should('contain', 'Deleted')

// Create a public app and verify that it is displayed on the public apps page
cy.log("Now creating a public app")
Expand Down
5 changes: 4 additions & 1 deletion news/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import markdown
from django.shortcuts import render

from .models import NewsObject


def news(request):
news_objects = NewsObject.objects.all().order_by("-created_on")
return render(request, "portal/news.html", locals())
for news in news_objects:
news.body_html = markdown.markdown(news.body)
return render(request, "news/news.html", {"news_objects": news_objects})
3 changes: 3 additions & 0 deletions portal/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import markdown
from django.apps import apps
from django.conf import settings
from django.db.models import Q
Expand Down Expand Up @@ -105,6 +106,8 @@ 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")
for news in news_objects:
news.body_html = markdown.markdown(news.body)
link_all_news = False
if published_models.count() >= 3:
published_models = published_models[:3]
Expand Down
22 changes: 22 additions & 0 deletions static/wiki/bootstrap/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2011-2019 Twitter, Inc.
Copyright (c) 2011-2019 The Bootstrap Authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
20 changes: 20 additions & 0 deletions static/wiki/bootstrap/css/wiki-bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions static/wiki/bootstrap/css/wiki-bootstrap.min.css.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions static/wiki/bootstrap/js/bootstrap.bundle.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions static/wiki/bootstrap/js/bootstrap.bundle.min.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions static/wiki/bootstrap/js/bootstrap.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions static/wiki/bootstrap/js/bootstrap.min.js.map

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions static/wiki/bootstrap/scss/_admonition.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@mixin admonition_colors_default($color) {
color: darken($color, 40%);
background-color: lighten($color, 25%);
border-color: $color;
}

@mixin admon-color($background, $border, $color) {
color: $color;
@include gradient-bg($background);
border-color: $border;

hr {
border-top-color: darken($border, 5%);
}

.alert-link {
color: darken($color, 10%);
}
}

.admonition {
padding: 0 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
text-align: left;
@include admonition_colors_default($gray-600);
&-title {
font-weight: bold;
text-align: left;
}
&.primary, &.important {
@include admon-color(theme-color-level("primary", $alert-bg-level),
theme-color-level("primary", $alert-border-level),
theme-color-level("primary", $alert-color-level));
}
&.secondary, &.attention {
@include admon-color(theme-color-level("secondary", $alert-bg-level),
theme-color-level("secondary", $alert-border-level),
theme-color-level("secondary", $alert-color-level));
}
&.success, &.tip {
@include admon-color(theme-color-level("success", $alert-bg-level),
theme-color-level("success", $alert-border-level),
theme-color-level("success", $alert-color-level));
}
&.info, &.note, &.hint {
@include admon-color(theme-color-level("info", $alert-bg-level),
theme-color-level("info", $alert-border-level),
theme-color-level("info", $alert-color-level));
}
&.warning, &.caution {
@include admon-color(theme-color-level("warning", $alert-bg-level),
theme-color-level("warning", $alert-border-level),
theme-color-level("warning", $alert-color-level));
}
&.danger, &.critical {
@include admon-color(theme-color-level("danger", $alert-bg-level),
theme-color-level("danger", $alert-border-level),
theme-color-level("danger", $alert-color-level));
}
&.light {
@include admon-color(theme-color-level("light", $alert-bg-level),
theme-color-level("light", $alert-border-level),
theme-color-level("light", $alert-color-level));
}
&.dark {
@include admon-color(theme-color-level("dark", $alert-bg-level),
theme-color-level("dark", $alert-border-level),
theme-color-level("dark", $alert-color-level));
}
}
52 changes: 52 additions & 0 deletions static/wiki/bootstrap/scss/_alert.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// Base styles
//

.alert {
position: relative;
padding: $alert-padding-y $alert-padding-x;
margin-bottom: $alert-margin-bottom;
border: $alert-border-width solid transparent;
@include border-radius($alert-border-radius);
}

// Headings for larger alerts
.alert-heading {
// Specified to prevent conflicts of changing $headings-color
color: inherit;
}

// Provide class for links that match alerts
.alert-link {
font-weight: $alert-link-font-weight;
}


// Dismissible alerts
//
// Expand the right padding and account for the close button's positioning.

.alert-dismissible {
padding-right: $close-font-size + $alert-padding-x * 2;

// Adjust close link position
.close {
position: absolute;
top: 0;
right: 0;
z-index: 2;
padding: $alert-padding-y $alert-padding-x;
color: inherit;
}
}


// Alternate styles
//
// Generate contextual modifier classes for colorizing the alert.

@each $color, $value in $theme-colors {
.alert-#{$color} {
@include alert-variant(theme-color-level($color, $alert-bg-level), theme-color-level($color, $alert-border-level), theme-color-level($color, $alert-color-level));
}
}
54 changes: 54 additions & 0 deletions static/wiki/bootstrap/scss/_badge.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Base class
//
// Requires one of the contextual, color modifier classes for `color` and
// `background-color`.

.badge {
display: inline-block;
padding: $badge-padding-y $badge-padding-x;
@include font-size($badge-font-size);
font-weight: $badge-font-weight;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
@include border-radius($badge-border-radius);
@include transition($badge-transition);

@at-root a#{&} {
@include hover-focus() {
text-decoration: none;
}
}

// Empty badges collapse automatically
&:empty {
display: none;
}
}

// Quick fix for badges in buttons
.btn .badge {
position: relative;
top: -1px;
}

// Pill badges
//
// Make them extra rounded with a modifier to replace v3's badges.

.badge-pill {
padding-right: $badge-pill-padding-x;
padding-left: $badge-pill-padding-x;
@include border-radius($badge-pill-border-radius);
}

// Colors
//
// Contextual variations (linked badges get darker on :hover).

@each $color, $value in $theme-colors {
.badge-#{$color} {
@include badge-variant($value);
}
}
42 changes: 42 additions & 0 deletions static/wiki/bootstrap/scss/_breadcrumb.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.breadcrumb {
display: flex;
flex-wrap: wrap;
padding: $breadcrumb-padding-y $breadcrumb-padding-x;
margin-bottom: $breadcrumb-margin-bottom;
@include font-size($breadcrumb-font-size);
list-style: none;
background-color: $breadcrumb-bg;
@include border-radius($breadcrumb-border-radius);
}

.breadcrumb-item {
// The separator between breadcrumbs (by default, a forward-slash: "/")
+ .breadcrumb-item {
padding-left: $breadcrumb-item-padding;

&::before {
float: left; // Suppress inline spacings and underlining of the separator
padding-right: $breadcrumb-item-padding;
color: $breadcrumb-divider-color;
content: escape-svg($breadcrumb-divider);
}
}

// IE9-11 hack to properly handle hyperlink underlines for breadcrumbs built
// without `<ul>`s. The `::before` pseudo-element generates an element
// *within* the .breadcrumb-item and thereby inherits the `text-decoration`.
//
// To trick IE into suppressing the underline, we give the pseudo-element an
// underline and then immediately remove it.
+ .breadcrumb-item:hover::before {
text-decoration: underline;
}
// stylelint-disable-next-line no-duplicate-selectors
+ .breadcrumb-item:hover::before {
text-decoration: none;
}

&.active {
color: $breadcrumb-active-color;
}
}
Loading

0 comments on commit 2edb299

Please sign in to comment.