Skip to content

Commit

Permalink
feat(init): Initial release.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmussig committed Mar 4, 2022
1 parent ed6f638 commit aea8024
Show file tree
Hide file tree
Showing 256 changed files with 201,152 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
33 changes: 33 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ---------------------------------------------------------------------------- #

# The name of the environment
# prod : prod
# dev : dev
# local : local
ENV_NAME='local'

# ---------------------------------------------------------------------------- #

# The path to the GTDB API
# prod : https://api.gtdb.ecogenomic.org
# dev : https://api.gtdb-dev.ecogenomic.org
# local : http://0.0.0.0:9000
API_BASE=http://0.0.0.0:9000

# ---------------------------------------------------------------------------- #

# The public reCaptcha site key
# prod :
# dev :
# local :
CAPTCHA_KEY=

# ---------------------------------------------------------------------------- #

# The google analytics tracking ID.
# prod :
# dev :
# local :
GA_TRACKING_ID=

# ---------------------------------------------------------------------------- #
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
root: true,
env: {
browser: true,
node: true
},
extends: [
'@nuxtjs/eslint-config-typescript',
'plugin:nuxt/recommended'
],
plugins: [
],
// add your custom rules here
rules: {}
}
21 changes: 21 additions & 0 deletions .github/workflows/main-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release
on:
push:
branches:
- main

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
# Semantic release
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
node-version: 16
- run: npm install --only=dev
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# Nuxt generate
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# IDE / Editor
.idea

# Service worker
sw.*

# macOS
.DS_Store

# Vim swap files
*.swp

# Manifest of files to store
.dist-manifest

# Public directory where files are served from
public
public_backup
30 changes: 30 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"tagFormat": "v${version}",
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github"
]
]
}
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# gtdb.ecogenomic.org
https://gtdb.ecogenomic.org/

This repository hosts the GTDB website, the website uses [Vue](https://vuejs.org/guide/quick-start.html), based on
the [Nuxt](https://nuxtjs.org/docs/get-started/installation) framework,
using [TypeScript](https://www.typescriptlang.org/docs/handbook/intro.html).

When the website is deployed, it is statically generated using `nuxt generate`, although this can be run locally with
hot-reload for developing.

## Contributing

This project uses [Semantic Versioning](http://semver.org/) and [Conventional Commits](https://conventionalcommits.org/)
to automatically generate release notes using [Semantic Release](https://semantic-release.gitbook.io/semantic-release/).

Please ensure that your commits are property formatted.

## Getting started

```bash
# install dependencies
npm install

# serve with hot reload at localhost:3000
npm run dev

# build for production and launch server
npm run build
npm run start
```

## Troubleshooting

If you are getting (this as any) errors (or property doesn't exist on this). Then you have untyped computed properties.
72 changes: 72 additions & 0 deletions assets/api/advanced.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import axios from "axios";
import {Dict} from "~/assets/ts/interfaces";

const apiBase = process.env.apiBase;
const apiTimeout = parseInt(process.env.apiTimeout || '30000');


// --------------------------------------------------------------------------------------------
// VIEW
// --------------------------------------------------------------------------------------------

export class AdvancedApi {

getOptions() {
return axios.get<AdvancedSearchOptionsResponse[]>(`${apiBase}/advanced/options`, {timeout: apiTimeout})
}

getOperators() {
return axios.get<AdvancedSearchOperatorResponse[]>(`${apiBase}/advanced/operators`, {timeout: apiTimeout})
}

getColumns() {
return axios.get<AdvancedSearchColumnResponse[]>(`${apiBase}/advanced/columns`, {timeout: apiTimeout})
}

getSearch(payload: Dict<string>) {
return axios.get<AdvancedSearchResult>(`${apiBase}/advanced/search`, {params: payload})
}

getSearchDownloadUrl(payload: Dict<string>) {
return axios.get<AdvancedSearchResult>(`${apiBase}/advanced/search`, {params: payload})
}

}

// --------------------------------------------------------------------------------------------
// MODEL
// --------------------------------------------------------------------------------------------

export interface AdvancedSearchOptionsResponse {
id: number
display: string
}

export interface AdvancedSearchDataTypeResponse {
name: string
value: string
}

export interface AdvancedSearchOperatorResponse {
id: number
display: string
dataType: string
}

export interface AdvancedSearchColumnResponse {
id: number
display: string
dataType: string
options?: AdvancedSearchOptionsResponse[]
group: string
}

export interface AdvancedSearchHeader {
text: string
value: string
}

export interface AdvancedSearchResult {
headers: AdvancedSearchHeader[]
rows: Dict<any>[]
}
48 changes: 48 additions & 0 deletions assets/api/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import axios, {AxiosError} from "axios"
import {FastApiValidationError} from "~/assets/api/models";
import {TaxonomyApi} from "~/assets/api/taxonomy";
import {FastAniApi} from "~/assets/api/fastani";
import {SpeciesApi} from "~/assets/api/species";
import {GenomeApi} from "~/assets/api/genome";
import {SankeyApi} from "~/assets/api/sankey";
import {SearchApi} from "~/assets/api/search";
import {TaxonApi} from "~/assets/api/taxon";
import {AdvancedApi} from "~/assets/api/advanced";
import {UtilApi} from "~/assets/api/util";

export class API {
fastani = new FastAniApi();
genome = new GenomeApi();
sankey = new SankeyApi();
search = new SearchApi();
species = new SpeciesApi();
taxon = new TaxonApi();
taxonomy = new TaxonomyApi();
advanced = new AdvancedApi();
util = new UtilApi();
}

export function getApiErrorMessage(error: Error | AxiosError): string[] {
if (axios.isAxiosError(error)) {
if (error.response && error.response.data && error.response.data.detail) {

// Validation error
if (error.response.status === 422) {
const out = [];
const msg: FastApiValidationError[] = error.response.data.detail;
for (let i = 0; i < msg.length; i++) {
const curMsg = msg[i];
out.push(`${curMsg.loc[curMsg.loc.length - 1]}: ${curMsg.msg}`)
}
return out;
}

return [error.response.data.detail];

} else {
return [error.message];
}
} else {
return [error.message];
}
}
Loading

0 comments on commit aea8024

Please sign in to comment.