Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholder PR from Valley Health #438

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,4 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/node,python,macos,windows,git
Install.sh
14 changes: 5 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exclude: >

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: pretty-format-json
args: [--autofix]
Expand All @@ -30,26 +30,22 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
exclude: migrations* | docs*
additional_dependencies: [toml]
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 24.8.0
hooks:
- id: black
language_version: python3.9
language_version: python3.11
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
rev: v2.14.0
hooks:
- id: pretty-format-toml
args: [--autofix]
- id: pretty-format-ini
args: [--autofix]
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.33.0
hooks:
- id: djlint-jinja
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.12.3
3.0.0
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = function (api) {
api.cache(true);
export default function (api) {
api.cache(false);
const presets = [['@babel/preset-env']];
const plugins = [];
return {
Expand Down
11 changes: 7 additions & 4 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""All prod configuration set here. For dev there are overrides below."""

# pylint: disable=too-few-public-methods
# ruff: noqa: RUF012

ALLOWED_HOSTS = ["*", "localhost"]

Expand Down Expand Up @@ -244,7 +245,7 @@
"""

DEVOPS_URL = "https://dev.azure.com/orgname/"
DEVOPS_TOKEN = r"token"
DEVOPS_TOKEN = r"token" # noqa: S105

"""
Default SQL Connection Settings
Expand Down Expand Up @@ -324,6 +325,8 @@


class DemoConfig(Config):
"""Configuration for a demo."""

DEBUG = False
DEMO = True
AUTH_METHOD = "DEV"
Expand All @@ -348,7 +351,7 @@
# pylint: disable=too-few-public-methods
SQLALCHEMY_DATABASE_URI = os.environ.get(
"DATABASE_URL",
"postgresql+psycopg2://postgres@localhost/atlas_hub_scrap_test"
"postgresql+psycopg2://postgres@localhost/atlas_hub_scrap_test",

Check failure

Code scanning / SonarCloud

A secure password should be used when connecting to a database High

Add password protection to this database. See more on SonarCloud
# "sqlite:///../test.sqlite",
).replace("postgres://", "postgresql://")

Expand All @@ -371,9 +374,9 @@

# docker run -p 22:22 -d emberstack/sftp --name sftp
SFTP_SERVER_USER = "demo"
SFTP_SERVER_PASS = "demo"
SFTP_SERVER_PASS = "demo" # noqa: S105

# docker run -d --name ftpd_server -p 21:21 onekilo79/ftpd_test
# docker run -d --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e FTP_USER_NAME=demo -e FTP_USER_PASS=demo -e FTP_USER_HOME=/home/demo -e "PUBLICHOST=localhost" -e "ADDED_FLAGS=-d -d" stilliard/pure-ftpd
FTP_SERVER_USER = "demo"
FTP_SERVER_PASS = "demo"
FTP_SERVER_PASS = "demo" # noqa: S105
39 changes: 39 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: [
"web/static/**/*.min.*",
"node_modules/*",
"**/.mypy_cache",
"**/.pytest_cache",
"**/.tox",
"web/static/lib/*",
"web/static/fonts/*",
"web/static/css/*",
],
}, ...compat.extends("eslint:recommended"), {
languageOptions: {
globals: {
...globals.browser,
CodeMirror: "readonly",
flatpickr: "readonly",
},

ecmaVersion: 12,
sourceType: "script",
},

rules: {},
}];
96 changes: 70 additions & 26 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
@@ -1,56 +1,100 @@
import gulp from 'gulp';
import pkg from 'gulp';
const { src, dest, task, parallel,series } = pkg;
import autoprefexer from 'gulp-autoprefixer';
import * as dartSass from 'sass';
import gulpSass from 'gulp-sass';
const sass = gulpSass(dartSass);

import postcss from 'gulp-postcss';
import replace from 'gulp-replace';
import fontawesomeSubset from 'fontawesome-subset';
import {fontawesomeSubset} from 'fontawesome-subset';
import {deleteSync} from 'del';
import purgecss from 'gulp-purgecss';
import cssnano from 'gulp-cssnano';
import cssnano from 'cssnano';

gulp.task('font:inter', function() {
return gulp.src('node_modules/@fontsource/inter/**/*').pipe(replace(/\.\/files\//g, '/static/fonts/inter/files/')).pipe(gulp.dest('web/static/fonts/inter'))
task('font:inter', function() {
return src('node_modules/@fontsource/inter/**/*', { removeBOM: false })
.pipe(replace(/\.\/files\//g, '/static/fonts/inter/files/'))
.pipe(dest('web/static/fonts/inter'))
});

gulp.task('font:rasa', function() {
return gulp.src('node_modules/@fontsource/rasa/**/*').pipe(replace(/\.\/files\//g, '/static/fonts/rasa/files/')).pipe(gulp.dest('web/static/fonts/rasa'))
task('font:rasa', function() {
return src('node_modules/@fontsource/rasa/**/*', { removeBOM: false })
.pipe(replace(/\.\/files\//g, '/static/fonts/rasa/files/'))
.pipe(dest('web/static/fonts/rasa'))
});


gulp.task('fontawesome', function(done) {
task('fontawesome', function(done) {
deleteSync('web/static/fonts/fontawesome/webfonts', {force:true});
fontawesomeSubset.fontawesomeSubset({
fontawesomeSubset({
regular:['circle-play', 'circle-question'],
solid: ['triangle-exclamation', 'angle-down', 'circle-pause', 'right-to-bracket', 'users','eye', 'eye-slash', 'arrow-up-right-from-square', 'calendar', 'circle-stop','circle-question', 'circle-notch','circle-xmark', 'circle-check', 'angle-right', 'file-arrow-down', 'circle-info', 'magnifying-glass', 'pen-to-square', 'trash', 'delete-left', 'sort', 'terminal', 'list', 'ban', 'toggle-on', 'toggle-off', 'plus', 'rotate', 'download', 'copy', 'check']
solid: ['triangle-exclamation'
, 'angle-down'
, 'circle-pause'
, 'right-to-bracket'
, 'users'
, 'eye'
, 'eye-slash'
, 'arrow-up-right-from-square'
, 'calendar'
, 'circle-stop'
, 'circle-question'
, 'circle-notch'
, 'circle-xmark'
, 'circle-check'
, 'angle-right'
, 'file-arrow-down'
, 'circle-info'
, 'magnifying-glass'
, 'pen-to-square'
, 'trash'
, 'delete-left'
, 'sort'
, 'terminal'
, 'list'
, 'ban'
, 'toggle-on'
, 'toggle-off'
, 'plus'
, 'rotate'
, 'download'
, 'copy'
, 'check']
}, 'web/static/fonts/fontawesome/webfonts')

done();
});

gulp.task('sass', function() {
return gulp.src("web/static/assets/**/*.scss")
task('sass', function() {
const plugins = [
cssnano({
preset: ['default', { discardComments: false }],
}),
];
return src("web/static/assets/**/*.scss")
.pipe(sass().on('error', sass.logError))
.pipe(postcss(plugins))
.pipe(
purgecss({
content: ['web/static/lib/**/*.js', 'web/static/js/**/*.js', 'web/templates/**/*.html.j2', 'runner/templates/**/*.html.j2', 'scheduler/templates/**/*.html.j2'],
safelist: ['has-text-success', 'mr-3', 'has-text-warning'],
whitelist: ['has-text-success', 'mr-3', 'has-text-warning']
content: ['web/static/lib/**/*.js'
, 'web/static/js/**/*.js'
, 'web/templates/**/*.html.j2'
, 'runner/templates/**/*.html.j2'
, 'scheduler/templates/**/*.html.j2'
, 'web/web/*.py'],
safelist: [],
whitelist: []
})
)
.pipe(autoprefexer({
overrideBrowserslist: ['last 2 versions']
}))
.pipe(cssnano())
.pipe(gulp.dest('web/static/css/'))
.pipe(autoprefexer())
.pipe(dest('web/static/css/'))
});

gulp.task('build', gulp.parallel('font:inter','font:rasa', gulp.series('fontawesome','sass')));
task('build', parallel('font:inter','font:rasa', series('fontawesome','sass')));

gulp.task('watch', gulp.series('build', function (cb) {
gulp.watch('web/static/assets/**/*.scss', gulp.series('sass'));
gulp.watch('web/fonts/fontawesome/**/*.scss', gulp.series('fontawesome','sass'));
gulp.watch('web/**/*.html*', gulp.series('fontawesome', 'sass'));
task('watch', series('build', function (cb) {
watch('web/static/assets/**/*.scss', series('sass'));
watch('web/fonts/fontawesome/**/*.scss', series('fontawesome','sass'));
watch('web/**/*.html*', series('fontawesome', 'sass'));
cb();
}));
14 changes: 7 additions & 7 deletions migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@
def get_engine():
try:
# this works with Flask-SQLAlchemy<3 and Alchemical
return current_app.extensions['migrate'].db.get_engine()
return current_app.extensions["migrate"].db.get_engine()
except TypeError:
# this works with Flask-SQLAlchemy>=3
return current_app.extensions['migrate'].db.engine
return current_app.extensions["migrate"].db.engine


def get_engine_url():
try:
return get_engine().url.render_as_string(hide_password=False).replace(
'%', '%%')
"%", "%%")
except AttributeError:
return str(get_engine().url).replace('%', '%%')
return str(get_engine().url).replace("%", "%%")

config.set_main_option('sqlalchemy.url', get_engine_url())
target_db = current_app.extensions['migrate'].db
config.set_main_option("sqlalchemy.url", get_engine_url())
target_db = current_app.extensions["migrate"].db

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.

def get_metadata():
if hasattr(target_db, 'metadatas'):
if hasattr(target_db, "metadatas"):
return target_db.metadatas[None]
return target_db.metadata

Expand Down
Loading
Loading