mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
add functioncomponent
This commit is contained in:
31897
Accounts/package-lock.json
generated
31897
Accounts/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import React, { ReactElement } from 'react';
|
||||
import React, { FunctionComponent, ReactElement } from 'react';
|
||||
import { Formik, Form, Field, ErrorMessage, FormikErrors } from 'formik';
|
||||
import Button from '../Basic/Button/Button';
|
||||
import FormValues from './Types/FormValues'
|
||||
@@ -18,7 +18,7 @@ export interface ComponentProps<T> {
|
||||
model: T
|
||||
}
|
||||
|
||||
const BasicForm = <T,>(props: ComponentProps<T>) => {
|
||||
const BasicForm: FunctionComponent<ComponentProps<Object>> = <T,>(props: ComponentProps<T>) => {
|
||||
|
||||
const getFormField = (field: DataField<T>): ReactElement => {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { FunctionComponent, ReactElement } from 'react';
|
||||
import { FormikErrors } from 'formik';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import FormValues from './Types/FormValues';
|
||||
@@ -13,24 +13,23 @@ export interface ComponentProps<T extends BaseModel> {
|
||||
fields: Fields<T>
|
||||
}
|
||||
|
||||
const BasicModelForm = <TBaseModel extends BaseModel>(props: ComponentProps<TBaseModel>) => {
|
||||
const BasicModelForm: FunctionComponent<ComponentProps<BaseModel>> = <TBaseModel extends BaseModel>(props: ComponentProps<TBaseModel>): ReactElement => {
|
||||
|
||||
const initialValues: FormValues<TBaseModel> = {};
|
||||
|
||||
// Prep
|
||||
for (const field of props.fields) {
|
||||
|
||||
// // Prep
|
||||
// for (const field of props.fields) {
|
||||
if (Object.keys(field.field).length > 0){
|
||||
if (props.model.getDisplayColumnTitleAs(Object.keys(field.field)[0] as string)) {
|
||||
field.title = props.model.getDisplayColumnTitleAs(Object.keys(field.field)[0] as string) as string;
|
||||
}
|
||||
|
||||
// if (Object.keys(field.field).length > 0){
|
||||
// if (props.model.getDisplayColumnTitleAs(Object.keys(field.field)[0] as string)) {
|
||||
// field.title = props.model.getDisplayColumnTitleAs(Object.keys(field.field)[0] as string) as string;
|
||||
// }
|
||||
|
||||
// if (props.model.getDisplayColumnDescriptionAs(Object.keys(field.field)[0] as string)) {
|
||||
// field.description = props.model.getDisplayColumnDescriptionAs(Object.keys(field.field)[0] as string) as string;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (props.model.getDisplayColumnDescriptionAs(Object.keys(field.field)[0] as string)) {
|
||||
field.description = props.model.getDisplayColumnDescriptionAs(Object.keys(field.field)[0] as string) as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (<BasicForm
|
||||
fields={props.fields}
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
"count-total-lines-of-code": "git grep ^ | wc -l",
|
||||
"uninstall": "docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)",
|
||||
"delete-all-local-branches": "git branch | grep -v 'master' | xargs git branch -D",
|
||||
"lint": "ejslint home/views/*.ejs && eslint '**/*.ts' -c .eslintrc.json --ignore-path .eslintignore",
|
||||
"fix-lint": "eslint '**/*.ts' -c .eslintrc.json --ignore-path .eslintignore --fix",
|
||||
"lint": "ejslint home/views/*.ejs && eslint '**/*.ts' -c .eslintrc.json --ignore-path .eslintignore --resolve-plugins-relative-to .",
|
||||
"fix-lint": "eslint '**/*.ts' -c .eslintrc.json --ignore-path .eslintignore --fix --resolve-plugins-relative-to .",
|
||||
"fix": "npm run fix-lint",
|
||||
"build": "docker-compose --env-file ./docker-enterprise.env build",
|
||||
"build-ci": "docker-compose --env-file ./docker-enterprise.env -f docker-compose.ci.yml build $npm_config_services",
|
||||
|
||||
Reference in New Issue
Block a user