ran typescript migrate and fixed some issues w/ burnettk

This commit is contained in:
jasquat 2022-07-05 11:50:55 -04:00
parent 6353073189
commit 59d6192229
39 changed files with 1091 additions and 381 deletions

View File

@ -11,7 +11,11 @@ module.exports = {
'plugin:jest/recommended', 'plugin:jest/recommended',
'plugin:prettier/recommended', 'plugin:prettier/recommended',
'plugin:sonarjs/recommended', 'plugin:sonarjs/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
], ],
parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {
ecmaFeatures: { ecmaFeatures: {
jsx: true, jsx: true,
@ -19,15 +23,36 @@ module.exports = {
ecmaVersion: 'latest', ecmaVersion: 'latest',
sourceType: 'module', sourceType: 'module',
}, },
plugins: ['react', 'sonarjs'], plugins: ['react', 'sonarjs', '@typescript-eslint'],
rules: { rules: {
'jest/expect-expect': 'off', 'jest/expect-expect': 'off',
'react/jsx-no-bind': 'off', 'react/jsx-no-bind': 'off',
'jsx-a11y/no-autofocus': 'off', 'jsx-a11y/no-autofocus': 'off',
'jsx-a11y/label-has-associated-control': 'off', 'jsx-a11y/label-has-associated-control': 'off',
'no-console': 'off', 'no-console': 'off',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], 'react/jsx-filename-extension': [
1,
{ extensions: ['.js', '.jsx', '.tsx', '.ts'] },
],
'react/react-in-jsx-scope': 'off', 'react/react-in-jsx-scope': 'off',
'no-unused-vars': ['error', { destructuredArrayIgnorePattern: '^_' }], 'react/require-default-props': 'off',
'no-unused-vars': [
'error',
{
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '_',
argsIgnorePattern: '^_',
},
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
}, },
}; };

View File

@ -2,7 +2,7 @@ module.exports = {
module: { module: {
rules: [ rules: [
{ {
test: /\.m?js$/, test: /\.m?[jt]sx?$/,
exclude: /node_modules/, exclude: /node_modules/,
use: { use: {
loader: 'babel-loader', loader: 'babel-loader',
@ -16,6 +16,7 @@ module.exports = {
}, },
], ],
'@babel/preset-react', '@babel/preset-react',
'@babel/plugin-transform-typescript',
], ],
}, },
}, },
@ -42,6 +43,7 @@ module.exports = {
presets: [ presets: [
'@babel/preset-env', '@babel/preset-env',
['@babel/preset-react', { runtime: 'automatic' }], ['@babel/preset-react', { runtime: 'automatic' }],
'@babel/preset-typescript',
], ],
// plugins: [], // plugins: [],
loaderOptions: (babelLoaderOptions) => { loaderOptions: (babelLoaderOptions) => {

575
package-lock.json generated
View File

@ -45,6 +45,8 @@
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"cypress": "^10.3.0", "cypress": "^10.3.0",
"eslint": "^8.19.0", "eslint": "^8.19.0",
"eslint_d": "^12.2.0", "eslint_d": "^12.2.0",
@ -4643,13 +4645,13 @@
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.27.1", "version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.5.tgz",
"integrity": "sha512-6dM5NKT57ZduNnJfpY81Phe9nc9wolnMCnknb1im6brWi1RYv84nbMS3olJa27B6+irUVV1X/Wb+Am0FjJdGFw==", "integrity": "sha512-lftkqRoBvc28VFXEoRgyZuztyVUQ04JvUnATSPtIRFAccbXTWL6DEtXGYMcbg998kXw1NLUJm7rTQ9eUt+q6Ig==",
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "5.27.1", "@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/type-utils": "5.27.1", "@typescript-eslint/type-utils": "5.30.5",
"@typescript-eslint/utils": "5.27.1", "@typescript-eslint/utils": "5.30.5",
"debug": "^4.3.4", "debug": "^4.3.4",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"ignore": "^5.2.0", "ignore": "^5.2.0",
@ -4674,6 +4676,119 @@
} }
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz",
"integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz",
"integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz",
"integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.5.tgz",
"integrity": "sha512-o4SSUH9IkuA7AYIfAvatldovurqTAHrfzPApOZvdUq01hHojZojCFXx06D/aFpKCgWbMPRdJBWAC3sWp3itwTA==",
"dependencies": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/typescript-estree": "5.30.5",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz",
"integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"engines": {
"node": ">=4.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": {
"version": "7.3.7", "version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
@ -4707,13 +4822,13 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "5.27.1", "version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.5.tgz",
"integrity": "sha512-7Va2ZOkHi5NP+AZwb5ReLgNF6nWLGTeUJfxdkVUAPPSaAdbWNnFZzLZ4EGGmmiCTg+AwlbE1KyUYTBglosSLHQ==", "integrity": "sha512-zj251pcPXI8GO9NDKWWmygP6+UjwWmrdf9qMW/L/uQJBM/0XbU2inxe5io/234y/RCvwpKEYjZ6c1YrXERkK4Q==",
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "5.27.1", "@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/types": "5.27.1", "@typescript-eslint/types": "5.30.5",
"@typescript-eslint/typescript-estree": "5.27.1", "@typescript-eslint/typescript-estree": "5.30.5",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@ -4732,6 +4847,90 @@
} }
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz",
"integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz",
"integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz",
"integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz",
"integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "5.27.1", "version": "5.27.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.27.1.tgz",
@ -4749,11 +4948,11 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "5.27.1", "version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.30.5.tgz",
"integrity": "sha512-+UC1vVUWaDHRnC2cQrCJ4QtVjpjjCgjNFpg8b03nERmkHv9JV9X5M19D7UFMd+/G7T/sgFwX2pGmWK38rqyvXw==", "integrity": "sha512-k9+ejlv1GgwN1nN7XjVtyCgE0BTzhzT1YsQF0rv4Vfj2U9xnslBgMYYvcEYAFVdvhuEscELJsB7lDkN7WusErw==",
"dependencies": { "dependencies": {
"@typescript-eslint/utils": "5.27.1", "@typescript-eslint/utils": "5.30.5",
"debug": "^4.3.4", "debug": "^4.3.4",
"tsutils": "^3.21.0" "tsutils": "^3.21.0"
}, },
@ -4773,6 +4972,133 @@
} }
} }
}, },
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/scope-manager": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz",
"integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz",
"integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz",
"integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/utils": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.5.tgz",
"integrity": "sha512-o4SSUH9IkuA7AYIfAvatldovurqTAHrfzPApOZvdUq01hHojZojCFXx06D/aFpKCgWbMPRdJBWAC3sWp3itwTA==",
"dependencies": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/typescript-estree": "5.30.5",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz",
"integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==",
"dependencies": {
"@typescript-eslint/types": "5.30.5",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"engines": {
"node": ">=4.0"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "5.27.1", "version": "5.27.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.27.1.tgz",
@ -29112,13 +29438,13 @@
} }
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "5.27.1", "version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.5.tgz",
"integrity": "sha512-6dM5NKT57ZduNnJfpY81Phe9nc9wolnMCnknb1im6brWi1RYv84nbMS3olJa27B6+irUVV1X/Wb+Am0FjJdGFw==", "integrity": "sha512-lftkqRoBvc28VFXEoRgyZuztyVUQ04JvUnATSPtIRFAccbXTWL6DEtXGYMcbg998kXw1NLUJm7rTQ9eUt+q6Ig==",
"requires": { "requires": {
"@typescript-eslint/scope-manager": "5.27.1", "@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/type-utils": "5.27.1", "@typescript-eslint/type-utils": "5.30.5",
"@typescript-eslint/utils": "5.27.1", "@typescript-eslint/utils": "5.30.5",
"debug": "^4.3.4", "debug": "^4.3.4",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"ignore": "^5.2.0", "ignore": "^5.2.0",
@ -29127,6 +29453,70 @@
"tsutils": "^3.21.0" "tsutils": "^3.21.0"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz",
"integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5"
}
},
"@typescript-eslint/types": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz",
"integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw=="
},
"@typescript-eslint/typescript-estree": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz",
"integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/utils": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.5.tgz",
"integrity": "sha512-o4SSUH9IkuA7AYIfAvatldovurqTAHrfzPApOZvdUq01hHojZojCFXx06D/aFpKCgWbMPRdJBWAC3sWp3itwTA==",
"requires": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/typescript-estree": "5.30.5",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz",
"integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"eslint-visitor-keys": "^3.3.0"
}
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
"requires": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
}
},
"estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="
},
"semver": { "semver": {
"version": "7.3.7", "version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
@ -29146,14 +29536,61 @@
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "5.27.1", "version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.5.tgz",
"integrity": "sha512-7Va2ZOkHi5NP+AZwb5ReLgNF6nWLGTeUJfxdkVUAPPSaAdbWNnFZzLZ4EGGmmiCTg+AwlbE1KyUYTBglosSLHQ==", "integrity": "sha512-zj251pcPXI8GO9NDKWWmygP6+UjwWmrdf9qMW/L/uQJBM/0XbU2inxe5io/234y/RCvwpKEYjZ6c1YrXERkK4Q==",
"requires": { "requires": {
"@typescript-eslint/scope-manager": "5.27.1", "@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/types": "5.27.1", "@typescript-eslint/types": "5.30.5",
"@typescript-eslint/typescript-estree": "5.27.1", "@typescript-eslint/typescript-estree": "5.30.5",
"debug": "^4.3.4" "debug": "^4.3.4"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz",
"integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5"
}
},
"@typescript-eslint/types": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz",
"integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw=="
},
"@typescript-eslint/typescript-estree": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz",
"integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz",
"integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"eslint-visitor-keys": "^3.3.0"
}
},
"semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"requires": {
"lru-cache": "^6.0.0"
}
}
} }
}, },
"@typescript-eslint/scope-manager": { "@typescript-eslint/scope-manager": {
@ -29166,13 +29603,87 @@
} }
}, },
"@typescript-eslint/type-utils": { "@typescript-eslint/type-utils": {
"version": "5.27.1", "version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.27.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.30.5.tgz",
"integrity": "sha512-+UC1vVUWaDHRnC2cQrCJ4QtVjpjjCgjNFpg8b03nERmkHv9JV9X5M19D7UFMd+/G7T/sgFwX2pGmWK38rqyvXw==", "integrity": "sha512-k9+ejlv1GgwN1nN7XjVtyCgE0BTzhzT1YsQF0rv4Vfj2U9xnslBgMYYvcEYAFVdvhuEscELJsB7lDkN7WusErw==",
"requires": { "requires": {
"@typescript-eslint/utils": "5.27.1", "@typescript-eslint/utils": "5.30.5",
"debug": "^4.3.4", "debug": "^4.3.4",
"tsutils": "^3.21.0" "tsutils": "^3.21.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz",
"integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5"
}
},
"@typescript-eslint/types": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz",
"integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw=="
},
"@typescript-eslint/typescript-estree": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz",
"integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/visitor-keys": "5.30.5",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/utils": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.5.tgz",
"integrity": "sha512-o4SSUH9IkuA7AYIfAvatldovurqTAHrfzPApOZvdUq01hHojZojCFXx06D/aFpKCgWbMPRdJBWAC3sWp3itwTA==",
"requires": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.30.5",
"@typescript-eslint/types": "5.30.5",
"@typescript-eslint/typescript-estree": "5.30.5",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.30.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz",
"integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==",
"requires": {
"@typescript-eslint/types": "5.30.5",
"eslint-visitor-keys": "^3.3.0"
}
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
"requires": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
}
},
"estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="
},
"semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"requires": {
"lru-cache": "^6.0.0"
}
}
} }
}, },
"@typescript-eslint/types": { "@typescript-eslint/types": {

View File

@ -67,6 +67,8 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"cypress": "^10.3.0", "cypress": "^10.3.0",
"eslint": "^8.19.0", "eslint": "^8.19.0",
"eslint_d": "^12.2.0", "eslint_d": "^12.2.0",

View File

@ -20,6 +20,7 @@ export default function App() {
let errorTag = ''; let errorTag = '';
if (errorMessage !== '') { if (errorMessage !== '') {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
errorTag = ( errorTag = (
<div id="filter-errors" className="mt-4 alert alert-danger" role="alert"> <div id="filter-errors" className="mt-4 alert alert-danger" role="alert">
{errorMessage} {errorMessage}
@ -37,7 +38,9 @@ export default function App() {
<Routes> <Routes>
<Route path="/" element={<AdminRoutes />} /> <Route path="/" element={<AdminRoutes />} />
<Route path="/admin/*" element={<AdminRoutes />} /> <Route path="/admin/*" element={<AdminRoutes />} />
{/* @ts-expect-error TS(2786): 'TaskList' cannot be used as a JSX component. */}
<Route path="/tasks" element={<TaskList />} /> <Route path="/tasks" element={<TaskList />} />
{/* @ts-expect-error TS(2786): 'TaskShow' cannot be used as a JSX component. */}
<Route path="/tasks/:task_id" element={<TaskShow />} /> <Route path="/tasks/:task_id" element={<TaskShow />} />
</Routes> </Routes>
</BrowserRouter> </BrowserRouter>

View File

@ -1,18 +1,23 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
class ErrorBoundary extends React.Component { type Props = {
constructor(props) { children?: React.ReactNode;
};
type State = any;
class ErrorBoundary extends React.Component<Props, State> {
constructor(props: Props) {
super(props); super(props);
this.state = { hasError: false }; this.state = { hasError: false };
} }
static getDerivedStateFromError(error) { static getDerivedStateFromError(error: any) {
// Update state so the next render will show the fallback UI. // Update state so the next render will show the fallback UI.
return { hasError: true, error }; return { hasError: true, error };
} }
componentDidCatch(error, errorInfo) { componentDidCatch(error: any, errorInfo: any) {
// You can also log the error to an error reporting service // You can also log the error to an error reporting service
console.log('HELLO: ', error, errorInfo); console.log('HELLO: ', error, errorInfo);
} }
@ -31,7 +36,3 @@ class ErrorBoundary extends React.Component {
} }
export default ErrorBoundary; export default ErrorBoundary;
ErrorBoundary.propTypes = {
children: PropTypes.string.isRequired,
};

View File

@ -1,10 +1,20 @@
import React from 'react'; import React from 'react';
import axios from 'axios'; import axios from 'axios';
import PropTypes from 'prop-types';
import { BACKEND_BASE_URL, HOT_AUTH_TOKEN } from '../config'; import { BACKEND_BASE_URL, HOT_AUTH_TOKEN } from '../config';
export default class FileInput extends React.Component { type Props = {
constructor({ processGroupId, processModelId }) { processGroupId: string;
processModelId: string;
};
export default class FileInput extends React.Component<Props> {
fileInput: any;
processGroupId: any;
processModelId: any;
constructor({ processGroupId, processModelId }: Props) {
super({ processGroupId, processModelId }); super({ processGroupId, processModelId });
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
this.fileInput = React.createRef(); this.fileInput = React.createRef();
@ -12,7 +22,7 @@ export default class FileInput extends React.Component {
this.processModelId = processModelId; this.processModelId = processModelId;
} }
handleSubmit(event) { handleSubmit(event: any) {
event.preventDefault(); event.preventDefault();
const url = `${BACKEND_BASE_URL}/process-models/${this.processGroupId}/${this.processModelId}/file`; const url = `${BACKEND_BASE_URL}/process-models/${this.processGroupId}/${this.processModelId}/file`;
const formData = new FormData(); const formData = new FormData();
@ -60,8 +70,3 @@ export default class FileInput extends React.Component {
); );
} }
} }
FileInput.propTypes = {
processGroupId: PropTypes.string.isRequired,
processModelId: PropTypes.string.isRequired,
};

View File

@ -1,35 +0,0 @@
import { Navbar, Nav, Container } from 'react-bootstrap';
import { capitalizeFirstLetter } from '../helpers';
import logo from '../logo.svg';
// for ref: https://react-bootstrap.github.io/components/navbar/
export default function NavigationBar() {
const navItems = ['/admin', '/tasks'];
const navElements = navItems.map((navItem) => {
let className = '';
if (window.location.pathname.startsWith(navItem)) {
className = 'active';
}
const title = capitalizeFirstLetter(navItem.replace(/\/*/, ''));
return (
<Nav.Link href={navItem} className={className}>
{title}
</Nav.Link>
);
});
return (
<Navbar bg="dark" expand="lg" variant="dark">
<Container>
<Navbar.Brand href="/admin">
<img src={logo} className="app-logo" alt="logo" />
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="me-auto">{navElements}</Nav>
</Navbar.Collapse>
</Container>
</Navbar>
);
}

View File

@ -0,0 +1,44 @@
import { Navbar, Nav, Container } from 'react-bootstrap';
import { capitalizeFirstLetter } from '../helpers';
// @ts-expect-error TS(2307): Cannot find module '../logo.svg' or its correspond... Remove this comment to see the full error message
import logo from '../logo.svg';
// for ref: https://react-bootstrap.github.io/components/navbar/
export default function NavigationBar() {
const navItems = ['/admin', '/tasks'];
const navElements = navItems.map((navItem) => {
let className = '';
if (window.location.pathname.startsWith(navItem)) {
className = 'active';
}
const title = capitalizeFirstLetter(navItem.replace(/\/*/, ''));
return (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<Nav.Link href={navItem} className={className}>
{title}
</Nav.Link>
);
});
return (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<Navbar bg="dark" expand="lg" variant="dark">
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Container>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Navbar.Brand href="/admin">
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<img src={logo} className="app-logo" alt="logo" />
</Navbar.Brand>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Navbar.Toggle aria-controls="basic-navbar-nav" />
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Navbar.Collapse id="basic-navbar-nav">
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Nav className="me-auto">{navElements}</Nav>
</Navbar.Collapse>
</Container>
</Navbar>
);
}

View File

@ -2,19 +2,29 @@ import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Dropdown, Stack } from 'react-bootstrap'; import { Dropdown, Stack } from 'react-bootstrap';
import PropTypes from 'prop-types';
export const DEFAULT_PER_PAGE = 50; export const DEFAULT_PER_PAGE = 50;
export const DEFAULT_PAGE = 1; export const DEFAULT_PAGE = 1;
type OwnProps = {
page: number;
perPage: number;
pagination: {
[key: string]: number;
};
tableToDisplay: string;
queryParamString?: string;
path: string;
};
export default function PaginationForTable({ export default function PaginationForTable({
page, page,
perPage, perPage,
pagination, pagination,
tableToDisplay, tableToDisplay,
queryParamString, queryParamString = '',
path, path,
}) { }: OwnProps) {
const PER_PAGE_OPTIONS = [2, 10, 50, 100]; const PER_PAGE_OPTIONS = [2, 10, 50, 100];
const buildPerPageDropdown = () => { const buildPerPageDropdown = () => {
@ -58,6 +68,7 @@ export default function PaginationForTable({
const buildPaginationNav = () => { const buildPaginationNav = () => {
let previousPageTag = ''; let previousPageTag = '';
if (page === 1) { if (page === 1) {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
previousPageTag = ( previousPageTag = (
<li <li
data-qa="pagination-previous-button-inactive" data-qa="pagination-previous-button-inactive"
@ -70,6 +81,7 @@ export default function PaginationForTable({
</li> </li>
); );
} else { } else {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
previousPageTag = ( previousPageTag = (
<li className="page-item" key="previous"> <li className="page-item" key="previous">
<Link <Link
@ -88,6 +100,7 @@ export default function PaginationForTable({
let nextPageTag = ''; let nextPageTag = '';
if (page >= pagination.pages) { if (page >= pagination.pages) {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
nextPageTag = ( nextPageTag = (
<li <li
data-qa="pagination-next-button-inactive" data-qa="pagination-next-button-inactive"
@ -100,6 +113,7 @@ export default function PaginationForTable({
</li> </li>
); );
} else { } else {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
nextPageTag = ( nextPageTag = (
<li className="page-item" key="next"> <li className="page-item" key="next">
<Link <Link
@ -151,16 +165,3 @@ export default function PaginationForTable({
</main> </main>
); );
} }
PaginationForTable.propTypes = {
page: PropTypes.number.isRequired,
perPage: PropTypes.number.isRequired,
pagination: PropTypes.objectOf(PropTypes.number).isRequired,
tableToDisplay: PropTypes.string.isRequired,
queryParamString: PropTypes.string,
path: PropTypes.string.isRequired,
};
PaginationForTable.defaultProps = {
queryParamString: '',
};

View File

@ -1,69 +0,0 @@
import { Link } from 'react-router-dom';
import Breadcrumb from 'react-bootstrap/Breadcrumb';
import PropTypes from 'prop-types';
export default function ProcessBreadcrumb({
processModelId,
processGroupId,
linkProcessModel,
}) {
let processGroupBreadcrumb = '';
let processModelBreadcrumb = '';
if (processModelId) {
if (linkProcessModel) {
processModelBreadcrumb = (
<Breadcrumb.Item
linkAs={Link}
linkProps={{
to: `/admin/process-models/${processGroupId}/${processModelId}`,
}}
>
Process Model: {processModelId}
</Breadcrumb.Item>
);
} else {
processModelBreadcrumb = (
<Breadcrumb.Item active>
Process Model: {processModelId}
</Breadcrumb.Item>
);
}
processGroupBreadcrumb = (
<Breadcrumb.Item
linkAs={Link}
linkProps={{ to: `/admin/process-groups/${processGroupId}` }}
>
Process Group: {processGroupId}
</Breadcrumb.Item>
);
} else if (processGroupId) {
processGroupBreadcrumb = (
<Breadcrumb.Item active>Process Group: {processGroupId}</Breadcrumb.Item>
);
}
return (
<main style={{ padding: '1rem 0' }}>
<Breadcrumb>
<Breadcrumb.Item linkAs={Link} linkProps={{ to: '/admin' }}>
Home
</Breadcrumb.Item>
{processGroupBreadcrumb}
{processModelBreadcrumb}
</Breadcrumb>
</main>
);
}
ProcessBreadcrumb.propTypes = {
processModelId: PropTypes.string,
processGroupId: PropTypes.string,
linkProcessModel: PropTypes.bool,
};
ProcessBreadcrumb.defaultProps = {
processGroupId: null,
processModelId: null,
linkProcessModel: false,
};

View File

@ -4,7 +4,9 @@ import ProcessBreadcrumb from './ProcessBreadcrumb';
test('renders home link', () => { test('renders home link', () => {
render( render(
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<BrowserRouter> <BrowserRouter>
{/* @ts-expect-error TS(2322): Type '{}' is not assignable to type 'never'. */}
<ProcessBreadcrumb /> <ProcessBreadcrumb />
</BrowserRouter> </BrowserRouter>
); );
@ -14,7 +16,9 @@ test('renders home link', () => {
test('renders process group when given processGroupId', async () => { test('renders process group when given processGroupId', async () => {
render( render(
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<BrowserRouter> <BrowserRouter>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<ProcessBreadcrumb processGroupId="group-a" /> <ProcessBreadcrumb processGroupId="group-a" />
</BrowserRouter> </BrowserRouter>
); );
@ -28,7 +32,9 @@ test('renders process group when given processGroupId', async () => {
test('renders process model when given processModelId', async () => { test('renders process model when given processModelId', async () => {
render( render(
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<BrowserRouter> <BrowserRouter>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<ProcessBreadcrumb processGroupId="group-b" processModelId="model-c" /> <ProcessBreadcrumb processGroupId="group-b" processModelId="model-c" />
</BrowserRouter> </BrowserRouter>
); );

View File

@ -0,0 +1,73 @@
import { Link } from 'react-router-dom';
import Breadcrumb from 'react-bootstrap/Breadcrumb';
type OwnProps = {
processModelId?: string;
processGroupId?: string;
linkProcessModel?: boolean;
};
export default function ProcessBreadcrumb({
processModelId,
processGroupId,
linkProcessModel = false,
}: OwnProps) {
let processGroupBreadcrumb = '';
let processModelBreadcrumb = '';
if (processModelId) {
if (linkProcessModel) {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
processModelBreadcrumb = (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<Breadcrumb.Item
linkAs={Link}
linkProps={{
to: `/admin/process-models/${processGroupId}/${processModelId}`,
}}
>
Process Model: {processModelId}
</Breadcrumb.Item>
);
} else {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
processModelBreadcrumb = (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<Breadcrumb.Item active>
Process Model: {processModelId}
</Breadcrumb.Item>
);
}
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
processGroupBreadcrumb = (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<Breadcrumb.Item
linkAs={Link}
linkProps={{ to: `/admin/process-groups/${processGroupId}` }}
>
Process Group: {processGroupId}
</Breadcrumb.Item>
);
} else if (processGroupId) {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
processGroupBreadcrumb = (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<Breadcrumb.Item active>Process Group: {processGroupId}</Breadcrumb.Item>
);
}
return (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<main style={{ padding: '1rem 0' }}>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Breadcrumb>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Breadcrumb.Item linkAs={Link} linkProps={{ to: '/admin' }}>
Home
</Breadcrumb.Item>
{processGroupBreadcrumb}
{processModelBreadcrumb}
</Breadcrumb>
</main>
);
}

View File

@ -1,22 +1,27 @@
/* eslint-disable sonarjs/cognitive-complexity */ /* eslint-disable sonarjs/cognitive-complexity */
// @ts-expect-error TS(7016): Could not find a declaration file for module 'bpmn... Remove this comment to see the full error message
import BpmnModeler from 'bpmn-js/lib/Modeler'; import BpmnModeler from 'bpmn-js/lib/Modeler';
import { import {
BpmnPropertiesPanelModule, BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule, BpmnPropertiesProviderModule,
// @ts-expect-error TS(7016): Could not find a declaration file for module 'bpmn... Remove this comment to see the full error message
} from 'bpmn-js-properties-panel'; } from 'bpmn-js-properties-panel';
// @ts-expect-error TS(7016): Could not find a declaration file for module 'dmn-... Remove this comment to see the full error message
import DmnModeler from 'dmn-js/lib/Modeler'; import DmnModeler from 'dmn-js/lib/Modeler';
import { import {
DmnPropertiesPanelModule, DmnPropertiesPanelModule,
DmnPropertiesProviderModule, DmnPropertiesProviderModule,
// @ts-expect-error TS(7016): Could not find a declaration file for module 'dmn-... Remove this comment to see the full error message
} from 'dmn-js-properties-panel'; } from 'dmn-js-properties-panel';
import React, { useRef, useEffect, useState } from 'react'; import React, { useRef, useEffect, useState } from 'react';
// @ts-expect-error TS(7016): Could not find a declaration file for module 'bpmn... Remove this comment to see the full error message
import spiffworkflowIO from 'bpmn-js-spiffworkflow/app/spiffworkflow/InputOutput'; import spiffworkflowIO from 'bpmn-js-spiffworkflow/app/spiffworkflow/InputOutput';
// @ts-expect-error TS(7016): Could not find a declaration file for module 'bpmn... Remove this comment to see the full error message
import spiffworkflowPanel from 'bpmn-js-spiffworkflow/app/spiffworkflow/PropertiesPanel'; import spiffworkflowPanel from 'bpmn-js-spiffworkflow/app/spiffworkflow/PropertiesPanel';
import Button from 'react-bootstrap/Button'; import Button from 'react-bootstrap/Button';
import PropTypes from 'prop-types';
import { HOT_AUTH_TOKEN, BACKEND_BASE_URL } from '../config'; import { HOT_AUTH_TOKEN, BACKEND_BASE_URL } from '../config';
import 'bpmn-js/dist/assets/diagram-js.css'; import 'bpmn-js/dist/assets/diagram-js.css';
@ -36,6 +41,17 @@ import 'dmn-js-properties-panel/dist/assets/properties-panel.css';
import 'bpmn-js-spiffworkflow/app/css/app.css'; import 'bpmn-js-spiffworkflow/app/css/app.css';
type OwnProps = {
processModelId: string;
processGroupId: string;
saveDiagram: (..._args: any[]) => any;
diagramType: string;
diagramXML?: string;
fileName?: string;
onLaunchScriptEditor?: (..._args: any[]) => any;
url?: string;
};
// https://codesandbox.io/s/quizzical-lake-szfyo?file=/src/App.js was a handy reference // https://codesandbox.io/s/quizzical-lake-szfyo?file=/src/App.js was a handy reference
export default function ReactDiagramEditor({ export default function ReactDiagramEditor({
processModelId, processModelId,
@ -46,7 +62,7 @@ export default function ReactDiagramEditor({
fileName, fileName,
onLaunchScriptEditor, onLaunchScriptEditor,
url, url,
}) { }: OwnProps) {
const [diagramXMLString, setDiagramXMLString] = useState(''); const [diagramXMLString, setDiagramXMLString] = useState('');
const [diagramModelerState, setDiagramModelerState] = useState(null); const [diagramModelerState, setDiagramModelerState] = useState(null);
const [performingXmlUpdates, setPerformingXmlUpdates] = useState(false); const [performingXmlUpdates, setPerformingXmlUpdates] = useState(false);
@ -58,6 +74,7 @@ export default function ReactDiagramEditor({
return; return;
} }
// @ts-expect-error TS(2531): Object is possibly 'null'.
document.getElementById('diagram-container').innerHTML = ''; document.getElementById('diagram-container').innerHTML = '';
const temp = document.createElement('template'); const temp = document.createElement('template');
@ -70,9 +87,10 @@ export default function ReactDiagramEditor({
`; `;
const frag = temp.content; const frag = temp.content;
// @ts-expect-error TS(2531): Object is possibly 'null'.
document.getElementById('diagram-container').appendChild(frag); document.getElementById('diagram-container').appendChild(frag);
let diagramModeler = null; let diagramModeler: any = null;
if (diagramType === 'bpmn') { if (diagramType === 'bpmn') {
diagramModeler = new BpmnModeler({ diagramModeler = new BpmnModeler({
@ -108,7 +126,7 @@ export default function ReactDiagramEditor({
}); });
} }
function handleLaunchScriptEditor(element) { function handleLaunchScriptEditor(element: any) {
if (onLaunchScriptEditor) { if (onLaunchScriptEditor) {
setPerformingXmlUpdates(true); setPerformingXmlUpdates(true);
const modeling = diagramModeler.get('modeling'); const modeling = diagramModeler.get('modeling');
@ -118,7 +136,7 @@ export default function ReactDiagramEditor({
setDiagramModelerState(diagramModeler); setDiagramModelerState(diagramModeler);
diagramModeler.on('launch.script.editor', (event) => { diagramModeler.on('launch.script.editor', (event: any) => {
const { error, element } = event; const { error, element } = event;
if (error) { if (error) {
console.log(error); console.log(error);
@ -135,11 +153,11 @@ export default function ReactDiagramEditor({
return undefined; return undefined;
} }
function handleError(err) { function handleError(err: any) {
console.log('ERROR:', err); console.log('ERROR:', err);
} }
function onImportDone(event) { function onImportDone(event: any) {
const { error } = event; const { error } = event;
if (error) { if (error) {
@ -149,20 +167,26 @@ export default function ReactDiagramEditor({
let modeler = diagramModelerState; let modeler = diagramModelerState;
if (diagramType === 'dmn') { if (diagramType === 'dmn') {
// @ts-expect-error TS(2531): Object is possibly 'null'.
modeler = diagramModelerState.getActiveViewer(); modeler = diagramModelerState.getActiveViewer();
} }
// only get the canvas if the dmn active viewer is actually // only get the canvas if the dmn active viewer is actually
// a Modeler and not an Editor which is what it will when we are // a Modeler and not an Editor which is what it will when we are
// actively editing a decision table // actively editing a decision table
// @ts-expect-error TS(2531): Object is possibly 'null'.
if (modeler.constructor.name === 'Modeler') { if (modeler.constructor.name === 'Modeler') {
// @ts-expect-error TS(2531): Object is possibly 'null'.
modeler.get('canvas').zoom('fit-viewport'); modeler.get('canvas').zoom('fit-viewport');
} }
} }
diagramModelerState.on('import.done', onImportDone); (diagramModelerState as any).on('import.done', onImportDone);
function displayDiagram(diagramModelerToUse, diagramXMLToDisplay) { function displayDiagram(
diagramModelerToUse: any,
diagramXMLToDisplay: any
) {
if (alreadyImportedXmlRef.current) { if (alreadyImportedXmlRef.current) {
return; return;
} }
@ -170,7 +194,7 @@ export default function ReactDiagramEditor({
alreadyImportedXmlRef.current = true; alreadyImportedXmlRef.current = true;
} }
function fetchDiagramFromURL(urlToUse) { function fetchDiagramFromURL(urlToUse: any) {
fetch(urlToUse) fetch(urlToUse)
.then((response) => response.text()) .then((response) => response.text())
.then((text) => setDiagramXMLString(text)) .then((text) => setDiagramXMLString(text))
@ -218,7 +242,7 @@ export default function ReactDiagramEditor({
} }
return () => { return () => {
diagramModelerState.destroy(); (diagramModelerState as any).destroy();
}; };
}, [ }, [
diagramModelerState, diagramModelerState,
@ -233,7 +257,8 @@ export default function ReactDiagramEditor({
]); ]);
function handleSave() { function handleSave() {
diagramModelerState.saveXML({ format: true }).then((xmlObject) => { // @ts-expect-error TS(2531): Object is possibly 'null'.
diagramModelerState.saveXML({ format: true }).then((xmlObject: any) => {
saveDiagram(xmlObject.xml); saveDiagram(xmlObject.xml);
}); });
} }
@ -246,22 +271,3 @@ export default function ReactDiagramEditor({
</div> </div>
); );
} }
ReactDiagramEditor.propTypes = {
processModelId: PropTypes.string.isRequired,
processGroupId: PropTypes.string.isRequired,
saveDiagram: PropTypes.func.isRequired,
diagramType: PropTypes.string.isRequired,
diagramXML: PropTypes.string,
fileName: PropTypes.string,
onLaunchScriptEditor: PropTypes.func,
url: PropTypes.string,
};
ReactDiagramEditor.defaultProps = {
diagramXML: null,
fileName: null,
onLaunchScriptEditor: null,
url: null,
};

View File

@ -1,4 +1,5 @@
import { createContext } from 'react'; import { createContext } from 'react';
// @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
const ErrorContext = createContext(); const ErrorContext = createContext();
export default ErrorContext; export default ErrorContext;

View File

@ -1,5 +1,5 @@
// https://www.30secondsofcode.org/js/s/slugify // https://www.30secondsofcode.org/js/s/slugify
export const slugifyString = (str) => { export const slugifyString = (str: any) => {
return str return str
.toLowerCase() .toLowerCase()
.trim() .trim()
@ -9,11 +9,11 @@ export const slugifyString = (str) => {
.replace(/-+$/g, ''); .replace(/-+$/g, '');
}; };
export const capitalizeFirstLetter = (string) => { export const capitalizeFirstLetter = (string: any) => {
return string.charAt(0).toUpperCase() + string.slice(1); return string.charAt(0).toUpperCase() + string.slice(1);
}; };
export const convertDateToSeconds = (date, onChangeFunction) => { export const convertDateToSeconds = (date: any, onChangeFunction: any) => {
let dateInSeconds = date; let dateInSeconds = date;
if (date !== null) { if (date !== null) {
let dateInMilliseconds = date; let dateInMilliseconds = date;

View File

@ -7,6 +7,7 @@ import './index.css';
import reportWebVitals from './reportWebVitals'; import reportWebVitals from './reportWebVitals';
// @ts-expect-error TS(2345): Argument of type 'HTMLElement | null' is not assig... Remove this comment to see the full error message
const root = ReactDOMClient.createRoot(document.getElementById('root')); const root = ReactDOMClient.createRoot(document.getElementById('root'));
root.render( root.render(
<React.StrictMode> <React.StrictMode>
@ -17,4 +18,5 @@ root.render(
// If you want to start measuring performance in your app, pass a function // If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log)) // to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
// @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
reportWebVitals(); reportWebVitals();

View File

@ -1,4 +1,4 @@
const reportWebVitals = (onPerfEntry) => { const reportWebVitals = (onPerfEntry: any) => {
if (onPerfEntry && onPerfEntry instanceof Function) { if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry); getCLS(onPerfEntry);

View File

@ -1,65 +0,0 @@
import { Routes, Route } from 'react-router-dom';
import ProcessGroups from './ProcessGroups';
import ProcessGroupShow from './ProcessGroupShow';
import ProcessGroupNew from './ProcessGroupNew';
import ProcessGroupEdit from './ProcessGroupEdit';
import ProcessModelShow from './ProcessModelShow';
import ProcessModelEditDiagram from './ProcessModelEditDiagram';
import ProcessInstanceList from './ProcessInstanceList';
import ProcessInstanceReport from './ProcessInstanceReport';
import ProcessModelNew from './ProcessModelNew';
import ProcessModelEdit from './ProcessModelEdit';
import ProcessInstanceShow from './ProcessInstanceShow';
export default function AdminRoutes() {
return (
<Routes>
<Route path="/" element={<ProcessGroups />} />
<Route path="process-groups" element={<ProcessGroups />} />
<Route
path="process-groups/:process_group_id"
element={<ProcessGroupShow />}
/>
<Route path="process-groups/new" element={<ProcessGroupNew />} />
<Route
path="process-groups/:process_group_id/edit"
element={<ProcessGroupEdit />}
/>
<Route
path="process-models/:process_group_id/new"
element={<ProcessModelNew />}
/>
<Route
path="process-models/:process_group_id/:process_model_id"
element={<ProcessModelShow />}
/>
<Route
path="process-models/:process_group_id/:process_model_id/file"
element={<ProcessModelEditDiagram />}
/>
<Route
path="process-models/:process_group_id/:process_model_id/file/:file_name"
element={<ProcessModelEditDiagram />}
/>
<Route
path="process-models/:process_group_id/:process_model_id/process-instances"
element={<ProcessInstanceList />}
/>
<Route
path="process-models/:process_group_id/:process_model_id/process-instances/report"
element={<ProcessInstanceReport />}
/>
<Route
path="process-models/:process_group_id/:process_model_id/edit"
element={<ProcessModelEdit />}
/>
<Route
path="process-models/:process_group_id/:process_model_id/process-instances/:process_instance_id"
element={<ProcessInstanceShow />}
/>
</Routes>
);
}

View File

@ -0,0 +1,89 @@
import { Routes, Route } from 'react-router-dom';
import ProcessGroups from './ProcessGroups';
import ProcessGroupShow from './ProcessGroupShow';
import ProcessGroupNew from './ProcessGroupNew';
import ProcessGroupEdit from './ProcessGroupEdit';
import ProcessModelShow from './ProcessModelShow';
import ProcessModelEditDiagram from './ProcessModelEditDiagram';
import ProcessInstanceList from './ProcessInstanceList';
import ProcessInstanceReport from './ProcessInstanceReport';
import ProcessModelNew from './ProcessModelNew';
import ProcessModelEdit from './ProcessModelEdit';
import ProcessInstanceShow from './ProcessInstanceShow';
export default function AdminRoutes() {
return (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<Routes>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route path="/" element={<ProcessGroups />} />
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route path="process-groups" element={<ProcessGroups />} />
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-groups/:process_group_id"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessGroupShow />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route path="process-groups/new" element={<ProcessGroupNew />} />
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-groups/:process_group_id/edit"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessGroupEdit />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/new"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessModelNew />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/:process_model_id"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessModelShow />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/:process_model_id/file"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessModelEditDiagram />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/:process_model_id/file/:file_name"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessModelEditDiagram />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/:process_model_id/process-instances"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessInstanceList />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/:process_model_id/process-instances/report"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessInstanceReport />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/:process_model_id/edit"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessModelEdit />}
/>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<Route
path="process-models/:process_group_id/:process_model_id/process-instances/:process_instance_id"
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
element={<ProcessInstanceShow />}
/>
</Routes>
);
}

View File

@ -27,9 +27,10 @@ export default function ProcessGroupEdit() {
); );
}, [params]); }, [params]);
const updateProcessGroup = (event) => { const updateProcessGroup = (event: any) => {
event.preventDefault(); event.preventDefault();
// @ts-expect-error TS(2531): Object is possibly 'null'.
fetch(`${BACKEND_BASE_URL}/process-groups/${processGroup.id}`, { fetch(`${BACKEND_BASE_URL}/process-groups/${processGroup.id}`, {
headers: new Headers({ headers: new Headers({
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -38,10 +39,12 @@ export default function ProcessGroupEdit() {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({
display_name: displayName, display_name: displayName,
// @ts-expect-error TS(2531): Object is possibly 'null'.
id: processGroup.id, id: processGroup.id,
}), }),
}).then( }).then(
() => { () => {
// @ts-expect-error TS(2531): Object is possibly 'null'.
navigate(`/admin/process-groups/${processGroup.id}`); navigate(`/admin/process-groups/${processGroup.id}`);
}, },
// Note: it's important to handle errors here // Note: it's important to handle errors here
@ -54,6 +57,7 @@ export default function ProcessGroupEdit() {
}; };
const deleteProcessGroup = () => { const deleteProcessGroup = () => {
// @ts-expect-error TS(2531): Object is possibly 'null'.
fetch(`${BACKEND_BASE_URL}/process-groups/${processGroup.id}`, { fetch(`${BACKEND_BASE_URL}/process-groups/${processGroup.id}`, {
headers: new Headers({ headers: new Headers({
Authorization: `Bearer ${HOT_AUTH_TOKEN}`, Authorization: `Bearer ${HOT_AUTH_TOKEN}`,
@ -69,15 +73,15 @@ export default function ProcessGroupEdit() {
); );
}; };
const onDisplayNameChanged = (newDisplayName) => { const onDisplayNameChanged = (newDisplayName: any) => {
setDisplayName(newDisplayName); setDisplayName(newDisplayName);
}; };
if (processGroup) { if (processGroup) {
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
<ProcessBreadcrumb processGroupId={processGroup.id} /> <ProcessBreadcrumb processGroupId={(processGroup as any).id} />
<h2>Edit Process Group: {processGroup.id}</h2> <h2>Edit Process Group: {(processGroup as any).id}</h2>
<form onSubmit={updateProcessGroup}> <form onSubmit={updateProcessGroup}>
<label>Display Name:</label> <label>Display Name:</label>
<input <input
@ -92,7 +96,7 @@ export default function ProcessGroupEdit() {
<Button type="submit">Submit</Button> <Button type="submit">Submit</Button>
<Button <Button
variant="secondary" variant="secondary"
href={`/admin/process-groups/${processGroup.id}`} href={`/admin/process-groups/${(processGroup as any).id}`}
> >
Cancel Cancel
</Button> </Button>

View File

@ -10,7 +10,7 @@ export default function ProcessGroupNew() {
const [displayName, setDisplayName] = useState(''); const [displayName, setDisplayName] = useState('');
const navigate = useNavigate(); const navigate = useNavigate();
const addProcessGroup = (event) => { const addProcessGroup = (event: any) => {
event.preventDefault(); event.preventDefault();
fetch(`${BACKEND_BASE_URL}/process-groups`, { fetch(`${BACKEND_BASE_URL}/process-groups`, {
@ -36,7 +36,7 @@ export default function ProcessGroupNew() {
); );
}; };
const onDisplayNameChanged = (newDisplayName) => { const onDisplayNameChanged = (newDisplayName: any) => {
setDisplayName(newDisplayName); setDisplayName(newDisplayName);
if (!idHasBeenUpdatedByUser) { if (!idHasBeenUpdatedByUser) {
setIdentifier(slugifyString(newDisplayName)); setIdentifier(slugifyString(newDisplayName));

View File

@ -17,8 +17,10 @@ export default function ProcessGroupShow() {
const [pagination, setPagination] = useState(null); const [pagination, setPagination] = useState(null);
useEffect(() => { useEffect(() => {
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
@ -59,13 +61,16 @@ export default function ProcessGroupShow() {
const buildTable = () => { const buildTable = () => {
const rows = processModels.map((row) => { const rows = processModels.map((row) => {
return ( return (
<tr key={row.id}> <tr key={(row as any).id}>
<td> <td>
<Link to={`/admin/process-models/${processGroup.id}/${row.id}`}> <Link
{row.id} // @ts-expect-error TS(2531): Object is possibly 'null'.
to={`/admin/process-models/${processGroup.id}/${(row as any).id}`}
>
{(row as any).id}
</Link> </Link>
</td> </td>
<td>{row.display_name}</td> <td>{(row as any).display_name}</td>
</tr> </tr>
); );
}); });
@ -87,21 +92,26 @@ export default function ProcessGroupShow() {
if (processGroup && pagination) { if (processGroup && pagination) {
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
<ProcessBreadcrumb processGroupId={processGroup.id} /> {/* @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'. */}
<h2>Process Group: {processGroup.id}</h2> <ProcessBreadcrumb processGroupId={(processGroup as any).id} />
<h2>Process Group: {(processGroup as any).id}</h2>
<ul> <ul>
<Stack direction="horizontal" gap={3}> <Stack direction="horizontal" gap={3}>
<Button href={`/admin/process-models/${processGroup.id}/new`}> <Button
href={`/admin/process-models/${(processGroup as any).id}/new`}
>
Add a process model Add a process model
</Button> </Button>
<Button <Button
href={`/admin/process-groups/${processGroup.id}/edit`} href={`/admin/process-groups/${(processGroup as any).id}/edit`}
variant="secondary" variant="secondary"
> >
Edit process group Edit process group
@ -113,8 +123,9 @@ export default function ProcessGroupShow() {
page={page} page={page}
perPage={perPage} perPage={perPage}
pagination={pagination} pagination={pagination}
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
tableToDisplay={buildTable()} tableToDisplay={buildTable()}
path={`/admin/process-groups/${processGroup.id}`} path={`/admin/process-groups/${(processGroup as any).id}`}
/> />
</ul> </ul>
</main> </main>

View File

@ -17,8 +17,10 @@ export default function ProcessGroups() {
const [pagination, setPagination] = useState(null); const [pagination, setPagination] = useState(null);
useEffect(() => { useEffect(() => {
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
@ -45,11 +47,13 @@ export default function ProcessGroups() {
const buildTable = () => { const buildTable = () => {
const rows = processGroups.map((row) => { const rows = processGroups.map((row) => {
return ( return (
<tr key={row.id}> <tr key={(row as any).id}>
<td> <td>
<Link to={`/admin/process-groups/${row.id}`}>{row.id}</Link> <Link to={`/admin/process-groups/${(row as any).id}`}>
{(row as any).id}
</Link>
</td> </td>
<td>{row.display_name}</td> <td>{(row as any).display_name}</td>
</tr> </tr>
); );
}); });
@ -68,22 +72,28 @@ export default function ProcessGroups() {
const processGroupsDisplayArea = () => { const processGroupsDisplayArea = () => {
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
let displayText = ''; let displayText = '';
if (processGroups?.length > 0) { if (processGroups?.length > 0) {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
displayText = ( displayText = (
<PaginationForTable <PaginationForTable
page={page} page={page}
perPage={perPage} perPage={perPage}
// @ts-expect-error TS(2322): Type 'null' is not assignable to type '{ [key: str... Remove this comment to see the full error message
pagination={pagination} pagination={pagination}
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
tableToDisplay={buildTable()} tableToDisplay={buildTable()}
path="/admin/process-groups" path="/admin/process-groups"
/> />
); );
} else { } else {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
displayText = <p>No Groups To Display</p>; displayText = <p>No Groups To Display</p>;
} }
return displayText; return displayText;
@ -92,6 +102,7 @@ export default function ProcessGroups() {
if (pagination) { if (pagination) {
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
{/* @ts-expect-error TS(2322): Type '{}' is not assignable to type 'never'. */}
<ProcessBreadcrumb /> <ProcessBreadcrumb />
<h2>Process Groups</h2> <h2>Process Groups</h2>
<Button href="/admin/process-groups/new">Add a process group</Button> <Button href="/admin/process-groups/new">Add a process group</Button>

View File

@ -7,6 +7,7 @@ import {
} from 'react-router-dom'; } from 'react-router-dom';
import { Button, Table, Stack, Dropdown } from 'react-bootstrap'; import { Button, Table, Stack, Dropdown } from 'react-bootstrap';
// @ts-expect-error TS(7016): Could not find a declaration file for module 'reac... Remove this comment to see the full error message
import DatePicker from 'react-datepicker'; import DatePicker from 'react-datepicker';
import { format } from 'date-fns'; import { format } from 'date-fns';
import { import {
@ -41,7 +42,7 @@ export default function ProcessInstanceList() {
const [endFrom, setEndFrom] = useState(null); const [endFrom, setEndFrom] = useState(null);
const [endTill, setEndTill] = useState(null); const [endTill, setEndTill] = useState(null);
const setErrorMessage = useContext(ErrorContext)[1]; const setErrorMessage = (useContext as any)(ErrorContext)[1];
const [processStatus, setProcessStatus] = useState(PROCESS_STATUSES[0]); const [processStatus, setProcessStatus] = useState(PROCESS_STATUSES[0]);
const parametersToAlwaysFilterBy = useMemo(() => { const parametersToAlwaysFilterBy = useMemo(() => {
@ -57,12 +58,14 @@ export default function ProcessInstanceList() {
function getProcessInstances() { function getProcessInstances() {
const page = searchParams.get('page') || DEFAULT_PAGE; const page = searchParams.get('page') || DEFAULT_PAGE;
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
let queryParamString = `per_page=${perPage}&page=${page}`; let queryParamString = `per_page=${perPage}&page=${page}`;
Object.keys(parametersToAlwaysFilterBy).forEach((paramName) => { Object.keys(parametersToAlwaysFilterBy).forEach((paramName) => {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const functionToCall = parametersToAlwaysFilterBy[paramName]; const functionToCall = parametersToAlwaysFilterBy[paramName];
const searchParamValue = searchParams.get(paramName); const searchParamValue = searchParams.get(paramName);
if (searchParamValue) { if (searchParamValue) {
@ -75,6 +78,7 @@ export default function ProcessInstanceList() {
queryParamString += `&process_status=${searchParams.get( queryParamString += `&process_status=${searchParams.get(
'process_status' 'process_status'
)}`; )}`;
// @ts-expect-error TS(2345): Argument of type 'string | null' is not assignable... Remove this comment to see the full error message
setProcessStatus(searchParams.get('process_status')); setProcessStatus(searchParams.get('process_status'));
} }
@ -110,7 +114,7 @@ export default function ProcessInstanceList() {
// does the comparison, but also returns false if either argument // does the comparison, but also returns false if either argument
// is not truthy and therefore not comparable. // is not truthy and therefore not comparable.
const isTrueComparison = (param1, operation, param2) => { const isTrueComparison = (param1: any, operation: any, param2: any) => {
if (param1 && param2) { if (param1 && param2) {
switch (operation) { switch (operation) {
case '<': case '<':
@ -125,10 +129,11 @@ export default function ProcessInstanceList() {
} }
}; };
const handleFilter = (event) => { const handleFilter = (event: any) => {
event.preventDefault(); event.preventDefault();
const page = searchParams.get('page') || DEFAULT_PAGE; const page = searchParams.get('page') || DEFAULT_PAGE;
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
@ -173,7 +178,12 @@ export default function ProcessInstanceList() {
); );
}; };
const dateComponent = (labelString, name, initialDate, onChangeFunction) => { const dateComponent = (
labelString: any,
name: any,
initialDate: any,
onChangeFunction: any
) => {
let selectedDate = null; let selectedDate = null;
if (initialDate) { if (initialDate) {
selectedDate = new Date(initialDate * 1000); selectedDate = new Date(initialDate * 1000);
@ -184,7 +194,7 @@ export default function ProcessInstanceList() {
<DatePicker <DatePicker
id={`date-picker-${name}`} id={`date-picker-${name}`}
selected={selectedDate} selected={selectedDate}
onChange={(date) => convertDateToSeconds(date, onChangeFunction)} onChange={(date: any) => convertDateToSeconds(date, onChangeFunction)}
showTimeSelect showTimeSelect
dateFormat={DATE_FORMAT} dateFormat={DATE_FORMAT}
/> />
@ -270,32 +280,34 @@ export default function ProcessInstanceList() {
const buildTable = () => { const buildTable = () => {
const rows = processInstances.map((row) => { const rows = processInstances.map((row) => {
let formattedStartDate = '-'; let formattedStartDate = '-';
if (row.start_in_seconds) { if ((row as any).start_in_seconds) {
const startDate = new Date(row.start_in_seconds * 1000); const startDate = new Date((row as any).start_in_seconds * 1000);
formattedStartDate = format(startDate, DATE_FORMAT); formattedStartDate = format(startDate, DATE_FORMAT);
} }
let formattedEndDate = '-'; let formattedEndDate = '-';
if (row.end_in_seconds) { if ((row as any).end_in_seconds) {
const endDate = new Date(row.end_in_seconds * 1000); const endDate = new Date((row as any).end_in_seconds * 1000);
formattedEndDate = format(endDate, DATE_FORMAT); formattedEndDate = format(endDate, DATE_FORMAT);
} }
return ( return (
<tr key={row.id}> <tr key={(row as any).id}>
<td> <td>
<Link <Link
data-qa="process-instance-show-link" data-qa="process-instance-show-link"
to={`/admin/process-models/${params.process_group_id}/${params.process_model_id}/process-instances/${row.id}`} to={`/admin/process-models/${params.process_group_id}/${
params.process_model_id
}/process-instances/${(row as any).id}`}
> >
{row.id} {(row as any).id}
</Link> </Link>
</td> </td>
<td>{row.process_model_identifier}</td> <td>{(row as any).process_model_identifier}</td>
<td>{row.process_group_identifier}</td> <td>{(row as any).process_group_identifier}</td>
<td>{formattedStartDate}</td> <td>{formattedStartDate}</td>
<td>{formattedEndDate}</td> <td>{formattedEndDate}</td>
<td data-qa={`process-instance-status-${row.status}`}> <td data-qa={`process-instance-status-${(row as any).status}`}>
{row.status} {(row as any).status}
</td> </td>
</tr> </tr>
); );
@ -319,15 +331,20 @@ export default function ProcessInstanceList() {
if (pagination) { if (pagination) {
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
return ( return (
<main> <main>
<ProcessBreadcrumb <ProcessBreadcrumb
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
processModelId={params.process_model_id} processModelId={params.process_model_id}
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
processGroupId={params.process_group_id} processGroupId={params.process_group_id}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
linkProcessModel="true" linkProcessModel="true"
/> />
<h2>Process Instances for {params.process_model_id}</h2> <h2>Process Instances for {params.process_model_id}</h2>
@ -336,6 +353,7 @@ export default function ProcessInstanceList() {
page={page} page={page}
perPage={perPage} perPage={perPage}
pagination={pagination} pagination={pagination}
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
tableToDisplay={buildTable()} tableToDisplay={buildTable()}
queryParamString={getSearchParamsAsQueryString()} queryParamString={getSearchParamsAsQueryString()}
path={`/admin/process-models/${params.process_group_id}/${params.process_model_id}/process-instances`} path={`/admin/process-models/${params.process_group_id}/${params.process_model_id}/process-instances`}

View File

@ -22,6 +22,7 @@ export default function ProcessInstanceReport() {
function getProcessInstances() { function getProcessInstances() {
const page = searchParams.get('page') || DEFAULT_PAGE; const page = searchParams.get('page') || DEFAULT_PAGE;
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
@ -55,13 +56,13 @@ export default function ProcessInstanceReport() {
const buildTable = () => { const buildTable = () => {
const rows = processInstances.map((row) => { const rows = processInstances.map((row) => {
return ( return (
<tr key={row.id}> <tr key={(row as any).id}>
<td>{row.id}</td> <td>{(row as any).id}</td>
<td>{row.data.month}</td> <td>{(row as any).data.month}</td>
<td>{row.data.milestone}</td> <td>{(row as any).data.milestone}</td>
<td>{row.data.req_id}</td> <td>{(row as any).data.req_id}</td>
<td>{row.data.feature}</td> <td>{(row as any).data.feature}</td>
<td>{row.data.priority}</td> <td>{(row as any).data.priority}</td>
</tr> </tr>
); );
}); });
@ -84,15 +85,20 @@ export default function ProcessInstanceReport() {
if (pagination) { if (pagination) {
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
return ( return (
<main> <main>
<ProcessBreadcrumb <ProcessBreadcrumb
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
processModelId={params.process_model_id} processModelId={params.process_model_id}
// @ts-expect-error TS(2322): Type 'null' is not assignable to type 'never'.
processGroupId={processGroupId} processGroupId={processGroupId}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
linkProcessModel="true" linkProcessModel="true"
/> />
<h2>Process Instances for {params.process_model_id}</h2> <h2>Process Instances for {params.process_model_id}</h2>
@ -100,6 +106,7 @@ export default function ProcessInstanceReport() {
page={page} page={page}
perPage={perPage} perPage={perPage}
pagination={pagination} pagination={pagination}
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
tableToDisplay={buildTable()} tableToDisplay={buildTable()}
path={`/admin/process-models/${params.process_group_id}/${params.process_model_id}/process-instances/report`} path={`/admin/process-models/${params.process_group_id}/${params.process_model_id}/process-instances/report`}
/> />

View File

@ -55,14 +55,17 @@ export default function ProcessInstanceShow() {
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
<ProcessBreadcrumb <ProcessBreadcrumb
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
processModelId={params.process_model_id} processModelId={params.process_model_id}
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
processGroupId={params.process_group_id} processGroupId={params.process_group_id}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
linkProcessModel="true" linkProcessModel="true"
/> />
<h2>Process Instance Id: {processInstance.id}</h2> <h2>Process Instance Id: {(processInstance as any).id}</h2>
<h2>Data</h2> <h2>Data</h2>
<div> <div>
<pre>{JSON.stringify(processInstance.data, null, 2)}</pre> <pre>{JSON.stringify((processInstance as any).data, null, 2)}</pre>
</div> </div>
<Button onClick={deleteProcessInstance} variant="danger"> <Button onClick={deleteProcessInstance} variant="danger">
Delete process instance Delete process instance

View File

@ -26,7 +26,7 @@ export default function ProcessModelEdit() {
); );
}, [processModelPath]); }, [processModelPath]);
const updateProcessModel = (event) => { const updateProcessModel = (event: any) => {
event.preventDefault(); event.preventDefault();
fetch(`${BACKEND_BASE_URL}/${processModelPath}`, { fetch(`${BACKEND_BASE_URL}/${processModelPath}`, {
@ -36,12 +36,18 @@ export default function ProcessModelEdit() {
}), }),
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({
// @ts-expect-error TS(2531): Object is possibly 'null'.
id: processModel.id, id: processModel.id,
display_name: displayName, display_name: displayName,
// @ts-expect-error TS(2531): Object is possibly 'null'.
description: processModel.description, description: processModel.description,
// @ts-expect-error TS(2531): Object is possibly 'null'.
process_group_id: processModel.process_group_id, process_group_id: processModel.process_group_id,
// @ts-expect-error TS(2531): Object is possibly 'null'.
is_master_spec: processModel.is_master_spec, is_master_spec: processModel.is_master_spec,
// @ts-expect-error TS(2531): Object is possibly 'null'.
standalone: processModel.standalone, standalone: processModel.standalone,
// @ts-expect-error TS(2531): Object is possibly 'null'.
library: processModel.library, library: processModel.library,
}), }),
}).then( }).then(
@ -59,7 +65,10 @@ export default function ProcessModelEdit() {
const deleteProcessModel = () => { const deleteProcessModel = () => {
fetch( fetch(
`${BACKEND_BASE_URL}/process-models/${processModel.process_group_id}/${processModel.id}`, `${BACKEND_BASE_URL}/process-models/${
// @ts-expect-error TS(2531): Object is possibly 'null'.
processModel.process_group_id
}/${processModel.id}`,
{ {
headers: new Headers({ headers: new Headers({
Authorization: `Bearer ${HOT_AUTH_TOKEN}`, Authorization: `Bearer ${HOT_AUTH_TOKEN}`,
@ -76,15 +85,16 @@ export default function ProcessModelEdit() {
); );
}; };
const onDisplayNameChanged = (newDisplayName) => { const onDisplayNameChanged = (newDisplayName: any) => {
setDisplayName(newDisplayName); setDisplayName(newDisplayName);
}; };
if (processModel) { if (processModel) {
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
<ProcessBreadcrumb processGroupId={processModel.id} /> {/* @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'. */}
<h2>Edit Process Group: {processModel.id}</h2> <ProcessBreadcrumb processGroupId={(processModel as any).id} />
<h2>Edit Process Group: {(processModel as any).id}</h2>
<form onSubmit={updateProcessModel}> <form onSubmit={updateProcessModel}>
<label>Display Name:</label> <label>Display Name:</label>
<input <input

View File

@ -54,7 +54,7 @@ export default function ProcessModelEditDiagram() {
setNewFileName(''); setNewFileName('');
}; };
const saveDiagram = (bpmnXML, fileName = params.file_name) => { const saveDiagram = (bpmnXML: any, fileName = params.file_name) => {
setBpmnXmlForDiagramRendering(bpmnXML); setBpmnXmlForDiagramRendering(bpmnXML);
let url = `${BACKEND_BASE_URL}/process-models/${params.process_group_id}/${params.process_model_id}/file`; let url = `${BACKEND_BASE_URL}/process-models/${params.process_group_id}/${params.process_model_id}/file`;
@ -96,7 +96,7 @@ export default function ProcessModelEditDiagram() {
); );
}; };
const handleFileNameSave = (event) => { const handleFileNameSave = (event: any) => {
event.preventDefault(); event.preventDefault();
setShowFileNameEditor(false); setShowFileNameEditor(false);
saveDiagram(bpmnXmlForDiagramRendering); saveDiagram(bpmnXmlForDiagramRendering);
@ -134,7 +134,7 @@ export default function ProcessModelEditDiagram() {
); );
}; };
const onLaunchScriptEditor = (element, modeling) => { const onLaunchScriptEditor = (element: any, modeling: any) => {
setScriptText(element.businessObject.script || ''); setScriptText(element.businessObject.script || '');
setScriptModeling(modeling); setScriptModeling(modeling);
setScriptElement(element); setScriptElement(element);
@ -143,8 +143,9 @@ export default function ProcessModelEditDiagram() {
const handleScriptEditorClose = () => { const handleScriptEditorClose = () => {
setShowScriptEditor(false); setShowScriptEditor(false);
}; };
const handleEditorChange = (value) => { const handleEditorChange = (value: any) => {
setScriptText(value); setScriptText(value);
// @ts-expect-error TS(2531): Object is possibly 'null'.
scriptModeling.updateProperties(scriptElement, { scriptModeling.updateProperties(scriptElement, {
scriptFormat: 'python', scriptFormat: 'python',
script: value, script: value,
@ -153,7 +154,7 @@ export default function ProcessModelEditDiagram() {
const scriptEditor = () => { const scriptEditor = () => {
let scriptName = ''; let scriptName = '';
if (scriptElement) { if (scriptElement) {
scriptName = scriptElement.di.bpmnElement.name; scriptName = (scriptElement as any).di.bpmnElement.name;
} }
return ( return (
<Modal size="xl" show={showScriptEditor} onHide={handleScriptEditorClose}> <Modal size="xl" show={showScriptEditor} onHide={handleScriptEditorClose}>
@ -185,23 +186,36 @@ export default function ProcessModelEditDiagram() {
if (isDmn()) { if (isDmn()) {
return ( return (
<ReactDiagramEditor <ReactDiagramEditor
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
process_model_id={params.process_model_id} process_model_id={params.process_model_id}
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
process_group_id={params.process_group_id} process_group_id={params.process_group_id}
// @ts-expect-error TS(2322): Type '(bpmnXML: any, fileName?: string | undefined... Remove this comment to see the full error message
saveDiagram={saveDiagram} saveDiagram={saveDiagram}
// @ts-expect-error TS(2322): Type 'null' is not assignable to type 'never'.
diagramXML={bpmnXmlForDiagramRendering} diagramXML={bpmnXmlForDiagramRendering}
fileName={processModelFile ? processModelFile.name : null} // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
fileName={processModelFile ? (processModelFile as any).name : null}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
diagramType="dmn" diagramType="dmn"
/> />
); );
} }
return ( return (
<ReactDiagramEditor <ReactDiagramEditor
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
process_model_id={params.process_model_id} process_model_id={params.process_model_id}
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
process_group_id={params.process_group_id} process_group_id={params.process_group_id}
// @ts-expect-error TS(2322): Type '(bpmnXML: any, fileName?: string | undefined... Remove this comment to see the full error message
saveDiagram={saveDiagram} saveDiagram={saveDiagram}
// @ts-expect-error TS(2322): Type 'null' is not assignable to type 'never'.
diagramXML={bpmnXmlForDiagramRendering} diagramXML={bpmnXmlForDiagramRendering}
fileName={processModelFile ? processModelFile.name : null} // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
fileName={processModelFile ? (processModelFile as any).name : null}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
diagramType="bpmn" diagramType="bpmn"
// @ts-expect-error TS(2322): Type '(element: any, modeling: any) => void' is no... Remove this comment to see the full error message
onLaunchScriptEditor={onLaunchScriptEditor} onLaunchScriptEditor={onLaunchScriptEditor}
/> />
); );
@ -212,13 +226,16 @@ export default function ProcessModelEditDiagram() {
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
<ProcessBreadcrumb <ProcessBreadcrumb
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
processGroupId={params.process_group_id} processGroupId={params.process_group_id}
// @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
processModelId={params.process_model_id} processModelId={params.process_model_id}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'never'.
linkProcessModel="true" linkProcessModel="true"
/> />
<h2> <h2>
Process Model File Process Model File
{processModelFile ? `: ${processModelFile.name}` : ''} {processModelFile ? `: ${(processModelFile as any).name}` : ''}
</h2> </h2>
{appropriateEditor()} {appropriateEditor()}
{newFileNameBox()} {newFileNameBox()}

View File

@ -12,7 +12,7 @@ export default function ProcessModelNew() {
const [displayName, setDisplayName] = useState(''); const [displayName, setDisplayName] = useState('');
const navigate = useNavigate(); const navigate = useNavigate();
const addProcessModel = (event) => { const addProcessModel = (event: any) => {
event.preventDefault(); event.preventDefault();
fetch(`${BACKEND_BASE_URL}/process-models`, { fetch(`${BACKEND_BASE_URL}/process-models`, {
@ -45,7 +45,7 @@ export default function ProcessModelNew() {
); );
}; };
const onDisplayNameChanged = (newDisplayName) => { const onDisplayNameChanged = (newDisplayName: any) => {
setDisplayName(newDisplayName); setDisplayName(newDisplayName);
if (!idHasBeenUpdatedByUser) { if (!idHasBeenUpdatedByUser) {
setIdentifier(slugifyString(newDisplayName)); setIdentifier(slugifyString(newDisplayName));
@ -54,6 +54,7 @@ export default function ProcessModelNew() {
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
{/* @ts-expect-error TS(2322): Type '{}' is not assignable to type 'never'. */}
<ProcessBreadcrumb /> <ProcessBreadcrumb />
<h2>Add Process Model</h2> <h2>Add Process Model</h2>
<form onSubmit={addProcessModel}> <form onSubmit={addProcessModel}>

View File

@ -31,8 +31,9 @@ export default function ProcessModelShow() {
); );
}, [params]); }, [params]);
const processModelRun = (processInstance) => { const processModelRun = (processInstance: any) => {
fetch( fetch(
// @ts-expect-error TS(2531): Object is possibly 'null'.
`${BACKEND_BASE_URL}/process-models/${processModel.process_group_id}/${processModel.id}/process-instances/${processInstance.id}/run`, `${BACKEND_BASE_URL}/process-models/${processModel.process_group_id}/${processModel.id}/process-instances/${processInstance.id}/run`,
{ {
headers: new Headers({ headers: new Headers({
@ -54,6 +55,7 @@ export default function ProcessModelShow() {
const processInstanceCreateAndRun = () => { const processInstanceCreateAndRun = () => {
fetch( fetch(
// @ts-expect-error TS(2531): Object is possibly 'null'.
`${BACKEND_BASE_URL}/process-models/${processModel.process_group_id}/${processModel.id}`, `${BACKEND_BASE_URL}/process-models/${processModel.process_group_id}/${processModel.id}`,
{ {
headers: new Headers({ headers: new Headers({
@ -75,19 +77,21 @@ export default function ProcessModelShow() {
let processInstanceResultTag = ''; let processInstanceResultTag = '';
if (processInstanceResult) { if (processInstanceResult) {
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
processInstanceResultTag = ( processInstanceResultTag = (
<pre> <pre>
{processInstanceResult.status}:{' '} {(processInstanceResult as any).status}:{' '}
{JSON.stringify(processInstanceResult.data)} {JSON.stringify((processInstanceResult as any).data)}
</pre> </pre>
); );
} }
if (processModel) { if (processModel) {
let processModelFilesTag = ''; const processModelFilesTag = (processModel as any).files.map(
processModelFilesTag = processModel.files.map((fileBpmn) => { (fileBpmn: any) => {
if (fileBpmn.name.match(/\.(dmn|bpmn)$/)) { if (fileBpmn.name.match(/\.(dmn|bpmn)$/)) {
let primarySuffix = ''; let primarySuffix = '';
// @ts-expect-error TS(2339): Property 'primary_file_name' does not exist on typ... Remove this comment to see the full error message
if (fileBpmn.name === processModel.primary_file_name) { if (fileBpmn.name === processModel.primary_file_name) {
primarySuffix = '- Primary File'; primarySuffix = '- Primary File';
} }
@ -103,19 +107,20 @@ export default function ProcessModelShow() {
); );
} }
return <li key={fileBpmn.name}>{fileBpmn.name}</li>; return <li key={fileBpmn.name}>{fileBpmn.name}</li>;
}); }
);
return ( return (
<main style={{ padding: '1rem 0' }}> <main style={{ padding: '1rem 0' }}>
<ProcessBreadcrumb <ProcessBreadcrumb
processGroupId={processModel.process_group_id} processGroupId={(processModel as any).process_group_id}
processModelId={processModel.id} processModelId={(processModel as any).id}
/> />
<h2>Process Model: {processModel.id}</h2> <h2>Process Model: {(processModel as any).id}</h2>
{processInstanceResultTag} {processInstanceResultTag}
<FileInput <FileInput
processModelId={processModel.id} processModelId={(processModel as any).id}
processGroupId={processModel.process_group_id} processGroupId={(processModel as any).process_group_id}
/> />
<br /> <br />
<Stack direction="horizontal" gap={3}> <Stack direction="horizontal" gap={3}>
@ -123,19 +128,25 @@ export default function ProcessModelShow() {
Run Run
</Button> </Button>
<Button <Button
href={`/admin/process-models/${processModel.process_group_id}/${processModel.id}/edit`} href={`/admin/process-models/${
(processModel as any).process_group_id
}/${(processModel as any).id}/edit`}
variant="secondary" variant="secondary"
> >
Edit process model Edit process model
</Button> </Button>
<Button <Button
href={`/admin/process-models/${processModel.process_group_id}/${processModel.id}/file?file_type=bpmn`} href={`/admin/process-models/${
(processModel as any).process_group_id
}/${(processModel as any).id}/file?file_type=bpmn`}
variant="warning" variant="warning"
> >
Add New BPMN File Add New BPMN File
</Button> </Button>
<Button <Button
href={`/admin/process-models/${processModel.process_group_id}/${processModel.id}/file?file_type=dmn`} href={`/admin/process-models/${
(processModel as any).process_group_id
}/${(processModel as any).id}/file?file_type=dmn`}
variant="success" variant="success"
> >
Add New DMN File Add New DMN File
@ -144,7 +155,9 @@ export default function ProcessModelShow() {
<br /> <br />
<br /> <br />
<Link <Link
to={`/admin/process-models/${processModel.process_group_id}/${processModel.id}/process-instances`} to={`/admin/process-models/${
(processModel as any).process_group_id
}/${(processModel as any).id}/process-instances`}
> >
Process Instances Process Instances
</Link> </Link>

View File

@ -13,8 +13,10 @@ export default function TaskList() {
const [pagination, setPagination] = useState(null); const [pagination, setPagination] = useState(null);
useEffect(() => { useEffect(() => {
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
@ -41,14 +43,14 @@ export default function TaskList() {
const buildTable = () => { const buildTable = () => {
const rows = tasks.map((row) => { const rows = tasks.map((row) => {
return ( return (
<tr key={row.id}> <tr key={(row as any).id}>
<td> <td>
<Link to={`/tasks/${row.id}`}>{row.id}</Link> <Link to={`/tasks/${(row as any).id}`}>{(row as any).id}</Link>
</td> </td>
<td>{row.process_instance_id}</td> <td>{(row as any).process_instance_id}</td>
<td>{row.status}</td> <td>{(row as any).status}</td>
<td> <td>
<Button variant="primary" href={`/tasks/${row.id}`}> <Button variant="primary" href={`/tasks/${(row as any).id}`}>
Start Start
</Button> </Button>
</td> </td>
@ -72,9 +74,11 @@ export default function TaskList() {
if (pagination) { if (pagination) {
const perPage = parseInt( const perPage = parseInt(
// @ts-expect-error TS(2345): Argument of type 'string | 50' is not assignable t... Remove this comment to see the full error message
searchParams.get('per_page') || DEFAULT_PER_PAGE, searchParams.get('per_page') || DEFAULT_PER_PAGE,
10 10
); );
// @ts-expect-error TS(2345): Argument of type 'string | 1' is not assignable to... Remove this comment to see the full error message
const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10); const page = parseInt(searchParams.get('page') || DEFAULT_PAGE, 10);
return ( return (
<main> <main>
@ -83,6 +87,7 @@ export default function TaskList() {
page={page} page={page}
perPage={perPage} perPage={perPage}
pagination={pagination} pagination={pagination}
// @ts-expect-error TS(2322): Type 'Element' is not assignable to type 'string'.
tableToDisplay={buildTable()} tableToDisplay={buildTable()}
path="/tasks" path="/tasks"
/> />

View File

@ -11,6 +11,7 @@ export default function TaskShow() {
const navigate = useNavigate(); const navigate = useNavigate();
useEffect(() => { useEffect(() => {
// @ts-expect-error TS(2345): Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
const taskId = parseInt(params.task_id, 10); const taskId = parseInt(params.task_id, 10);
fetch(`${BACKEND_BASE_URL}/tasks/${taskId}`, { fetch(`${BACKEND_BASE_URL}/tasks/${taskId}`, {
headers: new Headers({ headers: new Headers({
@ -28,7 +29,8 @@ export default function TaskShow() {
); );
}, [params.task_id]); }, [params.task_id]);
const handleFormSubmit = (event) => { const handleFormSubmit = (event: any) => {
// @ts-expect-error TS(2531): Object is possibly 'null'.
fetch(`${BACKEND_BASE_URL}/tasks/${task.id}/submit`, { fetch(`${BACKEND_BASE_URL}/tasks/${task.id}/submit`, {
headers: new Headers({ headers: new Headers({
Authorization: `Bearer ${HOT_AUTH_TOKEN}`, Authorization: `Bearer ${HOT_AUTH_TOKEN}`,
@ -51,13 +53,13 @@ export default function TaskShow() {
return ( return (
<main> <main>
<Button href="/tasks">Go Back</Button> <Button href="/tasks">Go Back</Button>
<h1>Task ID: {task.id}</h1> <h1>Task ID: {(task as any).id}</h1>
<h3>process_instance_id: {task.process_instance_id}</h3> <h3>process_instance_id: {(task as any).process_instance_id}</h3>
<h3>status: {task.status}</h3> <h3>status: {(task as any).status}</h3>
<Form <Form
formData={JSON.parse(task.spiffworkflow_task_data)} formData={JSON.parse((task as any).spiffworkflow_task_data)}
onSubmit={handleFormSubmit} onSubmit={handleFormSubmit}
schema={JSON.parse(task.form_json)} schema={JSON.parse((task as any).form_json)}
/> />
</main> </main>
); );

View File

@ -1,7 +0,0 @@
export default function Expenses() {
return (
<main style={{ padding: '1rem 0' }}>
<h2>Expenses</h2>
</main>
);
}

9
src/routes/expenses.tsx Normal file
View File

@ -0,0 +1,9 @@
export default function Expenses() {
return (
// @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message
<main style={{ padding: '1rem 0' }}>
{/* @ts-expect-error TS(2686): 'React' refers to a UMD global, but the current fi... Remove this comment to see the full error message */}
<h2>Expenses</h2>
</main>
);
}

4
tsfixme.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
// declare global {
type $TSFixMe = any;
type $TSFixMeFunction = (...args: any[]) => any;
// }