Skip to content

Commit

Permalink
Certificates > admin ui certificates warning (#486)
Browse files Browse the repository at this point in the history
* build(ui): upgrade dependencies

this acts as a foundation for #469

* fix(ui): tackle deprecation warnings

unlocking ESLint showed some warnings that were easy to fix

* feat(ui): add status filter buttons

* feat(ui): add warn box
  • Loading branch information
NiccoMlt authored Aug 30, 2024
1 parent ae167f4 commit d720d24
Show file tree
Hide file tree
Showing 12 changed files with 939 additions and 2,031 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ fabric.properties

.idea/*

!.idea/codeStyles
!.idea/runConfigurations
#!.idea/codeStyles
#!.idea/runConfigurations

### Java ###
# Compiled class file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum DynamicCertificateState {
/** Certificate domain reported as unreachable for issuing/renewing */
DOMAIN_UNREACHABLE,

/** For dns-challenge, wait for dns propagation */
/** For DNS-01 challenge, wait for DNS propagation before checking CA. */
DNS_CHALLENGE_WAIT,

/** Challenge verification by LE pending */
Expand Down
93 changes: 30 additions & 63 deletions carapace-server/src/main/java/org/carapaceproxy/utils/APIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,79 +44,46 @@ public abstract class APIUtils {
private APIUtils() {
}

/*
* Utilities for CertificatesResource
*/
public static String certificateStateToString(DynamicCertificateState state) {
if (state == null) {
return "unknown";
}
switch (state) {
case WAITING:
return "waiting"; // certificate waiting for issuing/renews
case DOMAIN_UNREACHABLE:
return "domain unreachable"; // certificate domain reported as unreachable for issuing/renewing
case DNS_CHALLENGE_WAIT:
return "dns-challenge-wait"; // dns challenge waiting to be visible before CA checking
case VERIFYING:
return "verifying"; // challenge verification by LE pending
case VERIFIED:
return "verified"; // challenge succeded
case ORDERING:
return "ordering"; // certificate order pending
case REQUEST_FAILED:
return "request failed"; // challenge/order failed
case AVAILABLE:
return "available";// certificate available(saved) and not expired
case EXPIRED: // certificate expired
return "expired";
default:
return "unknown";
}
return switch (state) {
case null -> "unknown";
case WAITING -> "waiting";
case DOMAIN_UNREACHABLE -> "domain unreachable";
case DNS_CHALLENGE_WAIT -> "dns-challenge-wait";
case VERIFYING -> "verifying";
case VERIFIED -> "verified";
case ORDERING -> "ordering";
case REQUEST_FAILED -> "request failed";
case AVAILABLE -> "available";
case EXPIRED -> "expired";
};
}

public static DynamicCertificateState stringToCertificateState(String state) {
if (state == null) {
return null;
}
switch (state.toLowerCase()) {
case "waiting":
return WAITING;
case "domain unreachable":
return DOMAIN_UNREACHABLE;
case "dns-challenge-wait":
return DNS_CHALLENGE_WAIT;
case "verifying":
return VERIFYING;
case "verified":
return VERIFIED;
case "ordering":
return ORDERING;
case "request failed":
return REQUEST_FAILED;
case "available":
return AVAILABLE;
case "expired":
return EXPIRED;
default:
return null;
}
return switch (state.toLowerCase()) {
case "waiting" -> WAITING;
case "domain unreachable" -> DOMAIN_UNREACHABLE;
case "dns-challenge-wait" -> DNS_CHALLENGE_WAIT;
case "verifying" -> VERIFYING;
case "verified" -> VERIFIED;
case "ordering" -> ORDERING;
case "request failed" -> REQUEST_FAILED;
case "available" -> AVAILABLE;
case "expired" -> EXPIRED;
default -> null;
};
}

public static String certificateModeToString(SSLCertificateConfiguration.CertificateMode mode) {
if (mode == null) {
return "unknown";
}
switch (mode) {
case STATIC:
return "static";
case ACME:
return "acme";
case MANUAL:
return "manual";
default:
return "unknown";
}
return switch (mode) {
case STATIC -> "static";
case ACME -> "acme";
case MANUAL -> "manual";
case null -> "unknown";
};
}

public static SSLCertificateConfiguration.CertificateMode stringToCertificateMode(String mode) {
Expand Down
16 changes: 16 additions & 0 deletions carapace-ui/src/main/webapp/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"root": true,
"env": {
"node": true
},
"extends": [
"eslint:recommended",
"plugin:vue/essential"
],
"rules": {
"vue/multi-word-component-names": "off"
},
"parserOptions": {
"parser": "@babel/eslint-parser"
}
}
166 changes: 15 additions & 151 deletions carapace-ui/src/main/webapp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,166 +1,30 @@
# Created by https://www.toptal.com/developers/gitignore/api/node,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=node,visualstudiocode

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

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

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

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

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

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

# node-waf configuration
.lock-wscript

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

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

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

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
node_modules
.DS_Store
dist
dist-ssr
*.local

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
/cypress/videos/
/cypress/screenshots/

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
# Editor directories and files
.vscode
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/node,visualstudiocode
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

/node
/ui
46 changes: 15 additions & 31 deletions carapace-ui/src/main/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,34 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@babel/core": "^7.0.0",
"@babel/eslint-parser": "^7.17.0",
"@fortawesome/fontawesome-svg-core": "6.1.1",
"@fortawesome/free-regular-svg-icons": "6.1.1",
"@fortawesome/free-solid-svg-icons": "6.1.1",
"@fortawesome/vue-fontawesome": "2.0.6",
"ansi-regex": "6.0.1",
"bootstrap": "4.5.3",
"bootstrap-vue": "^2.21.2",
"eslint": "^8.12.0",
"eslint-plugin-vue": "^8.5.0",
"jquery": "^3.6.0",
"moment": "2.29.4",
"popper.js": "^1.16.1",
"serialize-javascript": "6.0.0",
"vue": "2.6.14",
"vue-router": "3.5.3",
"webpack": "^5.94.0",
"yarn-deduplicate": "^4.0.0"
"vue": "^2.6.14",
"vue-router": "3.5.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "5.0.4",
"@vue/cli-plugin-eslint": "5.0.4",
"@vue/cli-service": "5.0.4",
"node-sass": "7.0.3",
"sass-loader": "12.6.0",
"vue-template-compiler": "2.6.14",
"yarn-audit-fix": "^9.2.1"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"vue/multi-word-component-names": "off"
},
"parserOptions": {
"parser": "@babel/eslint-parser"
}
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^8.0.0",
"eslint-plugin-vue": "^9.27.0",
"sass": "^1.77.8",
"sass-loader": "^16.0.1",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.94.0",
"yarn-audit-fix": "^10.0.9",
"yarn-deduplicate": "^6.0.2"
},
"postcss": {
"plugins": {
Expand Down
Loading

0 comments on commit d720d24

Please sign in to comment.