Skip to content

Commit

Permalink
Adapt OSSMC to PF5 (#278)
Browse files Browse the repository at this point in the history
* I18n Support PoC

* Create ossmc i18n files and combine with kiali ones

* Don't add locales in Dockerfile, added in webpack bundle

* Copy of Kiali frontend source code
Kiali frontend source originated from:
* git ref:    master
* git commit: 01f6db8f071dfe0e893d9e072f4150e3a7bdf168
* GitHub URL: https://github.com/kiali/kiali/tree/01f6db8f071dfe0e893d9e072f4150e3a7bdf168/frontend/src

Signed-off-by: Fernando Hoyos <fhoyosle@redhat.com>

* Adapt OSSMC to PF5

* Reverse i18n changes (separated PR)

* Remove i18n support libraries

* Remove i18n from IstioConfigListPage

* Update console dynamic plugin libraries

* Fix traffic graph context menu

* Update kiali source code

* Add kiosk action condition to history.push

* Fix API JSON body issues

* Copy of Kiali frontend source code
Kiali frontend source originated from:
* git ref:    master
* git commit: 4c8625dc2003d52a4320c2449136c382ce0d987b
* GitHub URL: https://github.com/kiali/kiali/tree/4c8625dc2003d52a4320c2449136c382ce0d987b/frontend/src

Signed-off-by: Fernando Hoyos <fhoyosle@redhat.com>

* Add new graph routes with params

* Downgrade patternfly to version 5.1.1 to avoid Modal issue

* Fix lint issues

* Copy of Kiali frontend source code
Kiali frontend source originated from:
* git ref:    master
* git commit: d757d2adc9526804db9bb40fcf65ae390b055ba0
* GitHub URL: https://github.com/kiali/kiali/tree/d757d2adc9526804db9bb40fcf65ae390b055ba0/frontend/src

Signed-off-by: Fernando Hoyos <fhoyosle@redhat.com>

* Small adjustment to overview page style

* Fix rebase conflicts

* Navigates to the proper OpenShift Console

* Fix get istio config list for all namespaces

* Fix ul css style within tooltip

* Add i18n support

* Copy of Kiali frontend source code
Kiali frontend source originated from:
* git ref:    master
* git commit: bcdf8823294e6732b63cf57287edff9c25286807
* GitHub URL: https://github.com/kiali/kiali/tree/bcdf8823294e6732b63cf57287edff9c25286807/frontend/src

Signed-off-by: Fernando Hoyos <fhoyosle@redhat.com>

* Add chinese translation

* Update React routing to 'react-router-dom-v5-compat' library

* Wait for security info before setting Kiali as loaded

* Override some console styles that affect OSSMC

* Copy of Kiali frontend source code
Kiali frontend source originated from:
* git ref:    master
* git commit: e8752fcd2af859f38ef69335535bbd56806facab
* GitHub URL: https://github.com/kiali/kiali/tree/e8752fcd2af859f38ef69335535bbd56806facab/frontend/src

Signed-off-by: Fernando Hoyos <fhoyosle@redhat.com>

---------

Signed-off-by: Fernando Hoyos <fhoyosle@redhat.com>
  • Loading branch information
ferhoyos authored Apr 26, 2024
1 parent df5154f commit e85c7fb
Show file tree
Hide file tree
Showing 519 changed files with 30,285 additions and 19,259 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ plugin/src/kiali/**/*.css.map
!plugin/src/kiali/components/IstioWizards/Slider/styles/default.css

# Cypress
frontend/cypress/videos
frontend/cypress/screenshots
frontend/cypress/results
plugin/cypress/results

# i18n
plugin/src/kiali/locales/en
plugin/src/openshift/locales/en

# files generated by builds and tests
_output
4 changes: 4 additions & 0 deletions hack/copy-frontend-src-to-ossmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ mkdir -p "${TMP_DIR}"
SOURCE_REPO="${TMP_DIR}/kiali-source"

# SOURCE_DIR = Relative directory inside the local Kiali repo whose content will be copied.
# SOURCE_LOCALES_DIR = Relative directory inside the local Kiali repo whose locales will be copied.
# DEST_DIR = Relative directory inside the local OSSM repo where the new files will be copied.
SOURCE_DIR="frontend/src"
SOURCE_LOCALES_DIR="frontend/public/locales"
DEST_DIR="plugin/src/kiali"

# The URL of the remote git repo to clone
Expand Down Expand Up @@ -82,6 +84,7 @@ done
# The absolute source and destination directories

ABS_SOURCE_DIR="${SOURCE_REPO}/${SOURCE_DIR}"
ABS_SOURCE_LOCALES_DIR="${SOURCE_REPO}/${SOURCE_LOCALES_DIR}"
ABS_DEST_DIR="${DEST_REPO}/${DEST_DIR}"

# Validate the dest directories exist
Expand Down Expand Up @@ -154,6 +157,7 @@ cd ${ABS_DEST_DIR}
git checkout -b ${DEST_BRANCH}
rm -rf ${ABS_DEST_DIR}/{*,.[!.]*}
cp -R ${ABS_SOURCE_DIR}/* ${ABS_DEST_DIR}
cp -R ${ABS_SOURCE_LOCALES_DIR} ${ABS_DEST_DIR}
cat > ${ABS_DEST_DIR}/README.md <<EOM
**WARNING**: The code in this directory comes from the kiali/kiali repository and should never be modified here.
Expand Down
5 changes: 4 additions & 1 deletion plugin/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ NODE_ENV=development
API_PROXY=http://localhost:3001

# Prefix added to all CSS classnames to fulfill Openshift plugin requirements
CSS_PREFIX=kiali
CSS_PREFIX=ossmconsole_

# I18N namespace to fulfill Openshift plugin requirements
I18N_NAMESPACE=plugin__ossmconsole

# Let Kiali knows if the global scrollbar is enabled or not
GLOBAL_SCROLLBAR=true
7 changes: 5 additions & 2 deletions plugin/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ NODE_ENV=production
API_PROXY=/api/proxy/plugin/ossmconsole/kiali

# Prefix added to all CSS classnames to fulfill Openshift plugin requirements
CSS_PREFIX=ossmc_plugin_
CSS_PREFIX=ossmconsole_

# I18N namespace to fulfill Openshift plugin requirements
I18N_NAMESPACE=plugin__ossmconsole

# Let Kiali knows if the global scrollbar is enabled or not
GLOBAL_SCROLLBAR=true
GLOBAL_SCROLLBAR=true
13 changes: 12 additions & 1 deletion plugin/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
"no-used-before-declare": "off",
"no-unused-variable": "off",
"no-restricted-globals": ["error", "event"],
"no-undef": "off"
"no-undef": "off",
"no-var": "error",
"prefer-template": "error",
"prefer-arrow-callback": "error",
"@typescript-eslint/member-ordering": ["error", {
"default": {},
"interfaces": {"order": "alphabetically"},
"typeLiterals": {"order": "alphabetically"}
}],
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
"@typescript-eslint/explicit-module-boundary-types": ["error", { "allowArgumentsExplicitlyTypedAsAny": true }]
}
}
3 changes: 1 addition & 2 deletions plugin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ FROM registry.access.redhat.com/ubi8/nginx-120:1-38.1655143357
USER 0

COPY --from=build /usr/src/app/dist /usr/share/nginx/html/
# add locales
ADD ./locales /usr/share/nginx/html/locales

RUN chown -R 1001:0 /usr/share/nginx/html/

ARG VERSION_PLUGIN
Expand Down
86 changes: 63 additions & 23 deletions plugin/console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"properties": {
"id": "ossmconsole",
"perspective": "admin",
"name": "Service Mesh"
"name": "%plugin__ossmconsole~Service Mesh%"
}
},
{
Expand All @@ -26,7 +26,7 @@
"type": "console.navigation/href",
"properties": {
"id": "ossmconsoleoverview",
"name": "Overview",
"name": "%plugin__ossmconsole~Overview%",
"href": "/ossmconsole/overview",
"perspective": "admin",
"section": "ossmconsole"
Expand All @@ -36,15 +36,55 @@
"type": "console.page/route",
"properties": {
"exact": true,
"path": "/ossmconsole/graph",
"path": ["/ossmconsole/graph"],
"component": { "$codeRef": "GraphPage" }
}
},
{
"type": "console.page/route",
"properties": {
"exact": true,
"path": ["/ossmconsole/graph/ns/:namespace/aggregates/:aggregate/:aggregateValue"],
"component": { "$codeRef": "GraphPage" }
}
},
{
"type": "console.page/route",
"properties": {
"exact": true,
"path": ["/ossmconsole/graph/ns/:namespace/applications/:app/versions/:version"],
"component": { "$codeRef": "GraphPage" }
}
},
{
"type": "console.page/route",
"properties": {
"exact": true,
"path": ["/ossmconsole/graph/ns/:namespace/applications/:app"],
"component": { "$codeRef": "GraphPage" }
}
},
{
"type": "console.page/route",
"properties": {
"exact": true,
"path": ["/ossmconsole/graph/ns/:namespace/services/:service"],
"component": { "$codeRef": "GraphPage" }
}
},
{
"type": "console.page/route",
"properties": {
"exact": true,
"path": ["/ossmconsole/graph/ns/:namespace/workloads/:workload"],
"component": { "$codeRef": "GraphPage" }
}
},
{
"type": "console.navigation/href",
"properties": {
"id": "ossmconsolegraph",
"name": "Graph",
"name": "%plugin__ossmconsole~Graph%",
"href": "/ossmconsole/graph",
"perspective": "admin",
"section": "ossmconsole"
Expand All @@ -62,7 +102,7 @@
"type": "console.navigation/href",
"properties": {
"id": "istioconfig",
"name": "Istio Config",
"name": "%plugin__ossmconsole~Istio Config%",
"href": "/k8s/all-namespaces/istio",
"perspective": "admin",
"section": "ossmconsole"
Expand All @@ -77,7 +117,7 @@
"version": "v1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "ProjectMeshTab" }
Expand All @@ -92,7 +132,7 @@
"version": "v1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "WorkloadMeshTab" }
Expand All @@ -107,7 +147,7 @@
"version": "v1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "WorkloadMeshTab" }
Expand All @@ -122,7 +162,7 @@
"version": "v1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "WorkloadMeshTab" }
Expand All @@ -137,7 +177,7 @@
"version": "v1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "WorkloadMeshTab" }
Expand All @@ -152,7 +192,7 @@
"version": "v1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "ServiceMeshTab" }
Expand All @@ -167,7 +207,7 @@
"version": "v1alpha3"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -182,7 +222,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -197,7 +237,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -212,7 +252,7 @@
"version": "v1alpha3"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -227,7 +267,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -242,7 +282,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -257,7 +297,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -272,7 +312,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -287,7 +327,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -302,7 +342,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -317,7 +357,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand All @@ -332,7 +372,7 @@
"version": "v1beta1"
},
"page": {
"name": "Service Mesh",
"name": "%plugin__ossmconsole~Service Mesh%",
"href": "ossmconsole"
},
"component": { "$codeRef": "IstioMeshTab" }
Expand Down
49 changes: 49 additions & 0 deletions plugin/i18next-parser.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// I18next parser configuration

const i18nextParserConfig = {
createOldCatalogs: false,
// Save the \_old files

defaultNamespace: 'translation',
// Default namespace used in your i18next config

defaultValue: (_locale: string, _namespace: string, key: string, value: string): string => {
return value || key;
},
// Default value to give to keys with no value
// You may also specify a function accepting the locale, namespace, key, and value as arguments

keySeparator: false,
// Key separator used in your translation keys
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.

// see below for more details
lexers: {
hbs: ['HandlebarsLexer'],
handlebars: ['HandlebarsLexer'],

htm: ['HTMLLexer'],
html: ['HTMLLexer'],

mjs: ['JavascriptLexer'],
js: ['JavascriptLexer'], // if you're writing jsx inside .js files, change this to JsxLexer
ts: ['JavascriptLexer'],
jsx: ['JsxLexer'],
tsx: ['JsxLexer'],

default: ['JavascriptLexer']
},

locales: ['en', 'zh'],
// An array of the locales in your applications

namespaceSeparator: '~',
// Namespace separator used in your translation keys
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.

sort: true
// Whether or not to sort the catalog. Can also be a [compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters)
};

/* eslint-disable import/no-default-export*/
export default i18nextParserConfig;
1 change: 0 additions & 1 deletion plugin/locales/en/plugin__ossmconsole.json

This file was deleted.

Loading

0 comments on commit e85c7fb

Please sign in to comment.