Skip to content

Commit

Permalink
Merge branch 'ui-v2' of github.com:IGS/gEAR into ui-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jorvis committed Dec 5, 2023
2 parents e56f7aa + 8e1136d commit 04688d9
Show file tree
Hide file tree
Showing 16 changed files with 848 additions and 453 deletions.
37 changes: 24 additions & 13 deletions docs/setup.new_server.notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@

Instances of a gEAR Portal are most often run within a cloud instance, where you can choose your own operating system and resources. On Google Cloud for a starter instance I chose an e2-standard-2 (2 vCPUs and 48GB RAM) with 300GB of solid state disk space. You'll definitely want to increase the CPU as you gain more simultaneous users and RAM depending on your dataset sizes. Once you create and start the instance:

$ sudo apt update
$ sudo apt upgrade
```bash
sudo apt update
sudo apt upgrade
```

Reboot if there are kernel updates (or just to be safe if you don't know.)

$ cd && mkdir git
$ sudo apt install git
$ git clone https://github.com/jorvis/gEAR.git
```bash
cd && mkdir git
sudo apt install git
git clone https://github.com/jorvis/gEAR.git
```

### Updating Ubuntu version to 22.04 LTS

Expand All @@ -33,7 +37,7 @@ At this point, we could remove the Python2 packages using `sudo apt autoremove`.

### MYSQL

$ sudo apt install mysql-server
sudo apt install mysql-server

Follow instructions in our setup.mysql.md document

Expand All @@ -57,17 +61,17 @@ Follow instructions in setup.python.md document

### APACHE

$ sudo apt install apache2 apache2-dev
sudo apt install apache2 apache2-dev

Follow instructions in setup.apache.md document

### gEAR portal

```bash
$ cd ~/git
$ git clone https://github.com/jorvis/gEAR.git
$ cd /var
$ sudo rm -rf www && sudo ln -s ~/git/gEAR/www
cd ~/git
git clone https://github.com/jorvis/gEAR.git
cd /var
sudo rm -rf www && sudo ln -s ~/git/gEAR/www
```

### Data transfer
Expand All @@ -83,6 +87,13 @@ $HOME/git/gEAR/www/analyses
Permissions need to be writeable for your apache user.

```bash
$ cd /var/www
$ chmod 777 datasets analyses/* uploads/files/
cd /var/www
chmod 777 datasets analyses/* uploads/files/
```

### (For devel servers) Github Actions self-hosted runner

The idea here is that when commiting code, we can use Github Actions to pull the code down on to the server to do things like automated testing.

(to be continued in https://github.com/IGS/gEAR/issues/632)

4 changes: 3 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ None yet listed

* Deleting an account

## UI testing
## UI (acceptance) testing

NOTE: This will be outdated as soon as the new tests are written in `<root>/www/js/test`

We use Selenium for this and these steps can take a while. Automated UI testing isn't necessarily quick, and there are a lot of pages/features to check.

Expand Down
100 changes: 50 additions & 50 deletions www/cgi/search_gene_carts.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -86,58 +86,58 @@ def main():
wheres.append("AND (gc.is_public = 1 OR gc.user_id = %s)")
qry_params.extend([user.id])

if search_terms:
selects.append(' MATCH(gc.label, gc.ldesc) AGAINST("%s" IN BOOLEAN MODE) as rscore')
wheres.append(' AND MATCH(gc.label, gc.ldesc) AGAINST("%s" IN BOOLEAN MODE)')

# this is the only instance where a placeholder can be in the SELECT statement, so it will
# be the first qry param
qry_params.insert(0, ' '.join(search_terms))
qry_params.append(' '.join(search_terms))

if organism_ids:
## only numeric characters and the comma are allowed here
organism_ids = re.sub("[^,0-9]", "", organism_ids)
wheres.append("AND gc.organism_id in ({0})".format(organism_ids))

if date_added:
date_added = re.sub("[^a-z]", "", date_added)
wheres.append("AND gc.date_added BETWEEN date_sub(now(), INTERVAL 1 {0}) AND now()".format(date_added))

if sort_by == 'relevance':
# relevance can only be ordered if a search term was used
if search_terms:
orders_by.append(" rscore DESC")
else:
orders_by.append(" gc.date_added DESC")
elif sort_by == 'title':
orders_by.append(" gc.label")
elif sort_by == 'owner':
orders_by.append(" g.user_name")
else:
orders_by.append(" gc.date_added DESC")
if search_terms:
selects.append(' MATCH(gc.label, gc.ldesc) AGAINST("%s" IN BOOLEAN MODE) as rscore')
wheres.append(' AND MATCH(gc.label, gc.ldesc) AGAINST("%s" IN BOOLEAN MODE)')

# build query
qry = """
SELECT {0}
FROM {1}
WHERE {2}
ORDER BY {3}
""".format(
", ".join(selects),
", ".join(froms),
" ".join(wheres),
" ".join(orders_by)
)
# this is the only instance where a placeholder can be in the SELECT statement, so it will
# be the first qry param
qry_params.insert(0, ' '.join(search_terms))
qry_params.append(' '.join(search_terms))

if organism_ids:
## only numeric characters and the comma are allowed here
organism_ids = re.sub("[^,0-9]", "", organism_ids)
wheres.append("AND gc.organism_id in ({0})".format(organism_ids))

# if a limit is defined, add it to the query
if int(limit):
qry += " LIMIT {0}".format(limit)
if date_added:
date_added = re.sub("[^a-z]", "", date_added)
wheres.append("AND gc.date_added BETWEEN date_sub(now(), INTERVAL 1 {0}) AND now()".format(date_added))

# if a page is defined, add it to the query
if int(page):
offset = int(page) - 1
qry += " OFFSET {0}".format(offset * int(limit))
if sort_by == 'relevance':
# relevance can only be ordered if a search term was used
if search_terms:
orders_by.append(" rscore DESC")
else:
orders_by.append(" gc.date_added DESC")
elif sort_by == 'title':
orders_by.append(" gc.label")
elif sort_by == 'owner':
orders_by.append(" g.user_name")
else:
orders_by.append(" gc.date_added DESC")

# build query
qry = """
SELECT {0}
FROM {1}
WHERE {2}
ORDER BY {3}
""".format(
", ".join(selects),
", ".join(froms),
" ".join(wheres),
" ".join(orders_by)
)

# if a limit is defined, add it to the query
if int(limit):
qry += " LIMIT {0}".format(limit)

# if a page is defined, add it to the query
if int(page):
offset = int(page) - 1
qry += " OFFSET {0}".format(offset * int(limit))

if DEBUG_MODE:
ofh = open('/tmp/debug', 'wt')
Expand All @@ -153,7 +153,7 @@ def main():
gc.user_name = row[1]
gc.gene_count = len(gc.genes)
gc.organism = "{0} {1}".format(row[8], row[9])
gc.is_owner = True if gc.user_id == user.id else False
gc.is_owner = True if user and gc.user_id == user.id else False
gene_carts.append(gc)

# Get count of total results
Expand Down
3 changes: 3 additions & 0 deletions www/dataset_curator.html
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ <h4 class="title is-5 is-clickable js-collapsable-trigger">
</section>
</div>

<!--#include virtual="/include/curator_common.html" -->


<!-- fancy select elements -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/nice-select2.min.js"></script>

Expand Down
Loading

0 comments on commit 04688d9

Please sign in to comment.