Skip to content

Commit

Permalink
Linters
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog committed Dec 19, 2023
1 parent fdb0ba5 commit f31058e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
from dataclasses import dataclass

from sqlalchemy import UniqueConstraint

from spiffworkflow_backend.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.db import db


#@dataclass
# @dataclass
class JSONDataStoreModel(SpiffworkflowBaseDBModel):
__tablename__ = "json_data_store"
__table_args__ = (UniqueConstraint("identifier", "location", name="_identifier_location_unique"),)
__tablename__ = "json_data_store"
__table_args__ = (UniqueConstraint("identifier", "location", name="_identifier_location_unique"),)

id: int = db.Column(db.Integer, primary_key=True)
name: str = db.Column(db.String(255), index=True, nullable=False)
identifier: str = db.Column(db.String(255), index=True, nullable=False)
location: str = db.Column(db.String(255), nullable=False)
schema: dict = db.Column(db.JSON, nullable=False)
data: dict = db.Column(db.JSON, nullable=False)
description: str = db.Column(db.String(255))
updated_at_in_seconds: int = db.Column(db.Integer, nullable=False)
created_at_in_seconds: int = db.Column(db.Integer, nullable=False)

id: int = db.Column(db.Integer, primary_key=True)
name: str = db.Column(db.String(255), index=True, nullable=False)
identifier: str = db.Column(db.String(255), index=True, nullable=False)
location: str = db.Column(db.String(255), nullable=False)
schema: dict = db.Column(db.JSON, nullable=False)
data: dict = db.Column(db.JSON, nullable=False)
description: str = db.Column(db.String(255))
updated_at_in_seconds: int = db.Column(db.Integer, nullable=False)
created_at_in_seconds: int = db.Column(db.Integer, nullable=False)
41 changes: 22 additions & 19 deletions spiffworkflow-frontend/src/components/DataStoreForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
} from '@carbon/react';
import HttpService from '../services/HttpService';
import { DataStore, DataStoreType } from '../interfaces';
import { modifyProcessIdentifierForPathParam, truncateString, slugifyString } from '../helpers';
import {
modifyProcessIdentifierForPathParam,
truncateString,
} from '../helpers';

type OwnProps = {
mode: string;
Expand All @@ -36,14 +39,13 @@ export default function DataStoreForm({
const [selectedDataStoreType, setSelectedDataStoreType] =
useState<DataStoreType | null>(null);
const navigate = useNavigate();
const newDataStoreId = dataStore.id;

const dataStoreLocation = () => {
const dataStoreLocation = () => {
const searchParams = new URLSearchParams(document.location.search);
const parentGroupId = searchParams.get('parentGroupId');

return parentGroupId ?? "/";
};
return parentGroupId ?? '/';
};

useEffect(() => {
const handleSetDataStoreTypesCallback = (result: any) => {
Expand All @@ -58,9 +60,11 @@ return parentGroupId ?? "/";
}, [setDataStoreTypes]);

const navigateToDataStores = (_result: any) => {
const location = dataStoreLocation();
if (location != "/") {
navigate(`/process-groups/${modifyProcessIdentifierForPathParam(location)}`);
const location = dataStoreLocation();
if (location !== '/') {
navigate(
`/process-groups/${modifyProcessIdentifierForPathParam(location)}`
);
} else {
navigate(`/process-groups`);
}
Expand Down Expand Up @@ -107,7 +111,7 @@ return parentGroupId ?? "/";
description: dataStore.description,
type: dataStore.type,
schema: dataStore.schema,
location: parentGroupId ?? "/",
location: parentGroupId ?? '/',
};

HttpService.makeCallToBackend({
Expand All @@ -126,16 +130,15 @@ return parentGroupId ?? "/";
setDataStore(dataStoreToCopy);
};


const makeIdentifier = (str: any) => {
return str
.toLowerCase()
.trim()
.replace(/[^\w\s-]/g, '')
.replace(/[\s-]+/g, '_')
.replace(/^[-\d]+/g, '')
.replace(/-+$/g, '');
};
const makeIdentifier = (str: any) => {
return str
.toLowerCase()
.trim()
.replace(/[^\w\s-]/g, '')
.replace(/[\s-]+/g, '_')
.replace(/^[-\d]+/g, '')
.replace(/-+$/g, '');
};

const onNameChanged = (newName: any) => {
setNameInvalid(false);
Expand Down

0 comments on commit f31058e

Please sign in to comment.