Skip to content

Commit

Permalink
adds the resource-optimization plugin files
Browse files Browse the repository at this point in the history
adds placeholder for the FE and Common plug-ins

adds app-config.yaml


adds react-related missing peer-deps


adds resource-optimization-common as a dependency to the FE plug-in


adds a sample app and backend for showcase purposes

Adds also a PoC for the plugin icon

migrates the old common package to resource-optimization

uncomment catalog and other entries in app-config.yaml


fixes an eslint issue related to lodash


updates the icon snapshot


updates json.test.ts


adds initial code for the BE plugin

fixes the plugin icon


changes the plugin name in the navbar

adds 2 variants for the plugin icon

It now uses the 'outlined' variant by default


added UI for the first page of resource optimization plugin & fixed endpoint in config (#2)


fixes an issue in toCamelCaseObjectKeys function


introduces the resource-optimization-backend

Changelog:
- Solved the token renewal
- Improved the keys serialization/deserialization issue (use camelCase when receiving, but snake_case when sending data)
- The plugin can read the clientId and clientSecret from the app-config.yaml
- Cleans up the ExampleComponent.tsx

makes ssoBaseUrl config optional


cleans up ExampleComponent.tsx a bit more 


add assertion to ensure config is defined


replaces json utils with jsr:@y0n1/json


fix: fix missing query params after token expires


RHINENG-10603 first page table functionality - Pagination + Sorting (#3)

* RHINENG-10603 first page table functionality

* minor fixes

* code refactoring for landing page table

* handling offset and sorting query params and code cleanup

* disable third sort on table component

* added unit tests and code cleanup

* improved landing page layout

* fixed unit test
RHINENG-10603 landing page filters functionality (#4)

* RHINENG-10603 added search filter component and filters functionality

* passing id to detail page

* reading id from route params
fixes the issue with the query params in getRecommendationsList


RHINENG-10787 detail page top section and recommendation section (#5)

* RHINENG-10787 detail page top section and UI

* removed memoryUnit & cpuUnit from query

* code cleanup

* handling multiple filter values

* fixed cluster filter and detail page values

* added util method to handle YAML code generation from API response
ignores dynamic-plugins dist directory globally


adds janus-cli and export-dynamic scripts

removes ExampleFetchComponent

updates apis.ts

do not conver the recommendations_id param to snake case

fixes tsc, linting and formatting issues

fixes some issues related to different types  of dependencies


pathes PlotDetails model


stop depending on @mui/material and remove white bg from search filters


patches all the parameters of getRecommendationById


WIP on breakdown charts

Applies required refactors for compatibility with dynamic plugins (#6)

* adds @backstage/backend-dynamic-feature-service


* WIP

* adds rhdh theme


* adds devcontainer config


deletes code-workspace file


* removes leftovers froms the cost-management workspace


* updates resource-optimization frontend

* adds configuration files for rhdh

* Update workspaces/resource-optimization/plugins/resource-optimization/src/plugin.ts


---------

adds devcontainer config

adds deployment scripts

adds export-dynamic top-level script

fixes issues related to dependencies

removes the dynamic-plugins integration from the backend package

organizes the backend plugin exports

fixes linting and type-checking issues

exports the icon from the front-end plugin

Updates yarn.lock

fixes some type-only import statements

sync @backstage-community/plugin-resource-optimization-backend


Fixes style issues


fixes an issue related to the api-report generation

- see: backstage/backstage#25671

renames useRhdhTheme.ts to rhdh-theme.ts

cleans up devcontainer settings and code-workspace file


fixes style issues and generates api-report


fixes code style and adds the api-report


fixes code style and adds the api-report


Updates resource-optimization-common

Changelog:
- Patches the generated client code with ts-morph
- The code now complies with the rules of the api-report (produced by: `yarn build:api-reports`)
- Adds the api-report
- Updates the openapi.yaml
- Renames OrchestratorClient to OrchestratorApiClientProxy


Updates resource-optimization

Changelog:
- Aligns the code according to the refactor in resource-optimization-common


fix: detail page tab routing (#8)

* fix: detail page tab routing

* yarn fix: resource-optimization-common

* fix prettier & add prettier format script

* Update workspaces/resource-optimization/package.json

Co-authored-by: Jonathan Kilzi <jkilzi@redhat.com>
Signed-off-by: Preeti Wadhwani <preeti.dev.git@gmail.com>

* updated api-reports.md

---------

Signed-off-by: Preeti Wadhwani <preeti.dev.git@gmail.com>
Co-authored-by: Jonathan Kilzi <jkilzi@redhat.com>
Bug fixes & refactor (#10)

* WIP @ resource-optimization/fixes


* updates api-reports


* fixes the presentation in the last_reported column


* after yarn dedupe


* fixes code style issues


* dedupe packages


* fix code-style


* Renames serializer.mjs to yaml.mjs


* Bumps Backstage to 1.29.2

See: https://backstage.io/docs/releases/v1.28.0


* Fixes the "publish check" CI step failure


* bug fixes

- Solves an issue related to the recommendation plotData object where the object keys were transformed incorrectly
- Bumps @y0n1/json to 2.0.0
- Adds msw for writing tests for the client proxy module


---------

RHINENG-10789 added compont for showing box plot charts (#12)

* RHINENG-10789 added compont for showing box plot charts

* added missing keys for messages

* prettier format and fix

* fixed types errors

* minor fixes

* minor fixes for showing YAML code

* added charts for limit and request data, performace section

* fixed yarn.lock

* fixed types errors

* fix styles for chart y axis numbering

* minor fixes
Adds tests for OptimizationsApiClientProxy.ts (#14)

WIP: Adds READMEs and legal stuff (#15)

* WIP: Adds READMEs and legal stuff


* fixes a typo


* updates the readme


* adds missing info about the service account role


---------

Updates useRhdhTheme.ts (#16)

Changelog:
- Removes the logic involved in enabling the RHDH theme based on an environment variable

Adds postCreate script for the devcontainer

The script handles marking the repo as safe in git due to the owner and the internal container user having different UIDs

Updates the codeowners file

Signed-off-by: Jonathan Kilzi <jkilzi@redhat.com>
  • Loading branch information
jkilzi committed Aug 5, 2024
1 parent fe8683b commit b9a9900
Show file tree
Hide file tree
Showing 257 changed files with 53,742 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ yarn.lock @backstage/community-plugins
/workspaces/sonarqube @backstage/community-plugins-maintainers @backstage/sda-se-reviewers
/workspaces/user-settings @backstage/community-plugins-maintainers @backstage/sda-se-reviewers
/workspaces/tech-insights @backstage/community-plugins-maintainers @xantier
/workspaces/resource-optimization @backstage/community-plugins-maintainers @jkilzi @PreetiW
8 changes: 8 additions & 0 deletions workspaces/resource-optimization/.changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
10 changes: 10 additions & 0 deletions workspaces/resource-optimization/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch"
}
9 changes: 9 additions & 0 deletions workspaces/resource-optimization/.changeset/shy-cooks-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@backstage-community/plugin-resource-optimization-backend': major
'@backstage-community/plugin-resource-optimization-common': major
'@backstage-community/plugin-resource-optimization': major
---

Adds the resource-optimization plugin

This is the first iteration for this plugin. Your feedback is more than welcome!
39 changes: 39 additions & 0 deletions workspaces/resource-optimization/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Ubuntu",
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers/features/java:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers-contrib/features/fzf:1": {},
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {},
"ghcr.io/dhoeric/features/act:1": {}
},
"forwardPorts": [3000, 7007],
"postCreateCommand": "/workspaces/community-plugins/workspaces/resource-optimization/.devcontainer/scripts/post_create_command.sh",
"customizations": {
"vscode": {
"settings": {
"git.alwaysSignOff": true,
"jest.jestCommandLine": "node_modules/.bin/jest --config node_modules/@backstage/cli/config/jest.js",
"jest.runMode": {
"type": "on-demand"
},
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"redhat.vscode-yaml",
"orta.vscode-jest",
"rangav.vscode-thunder-client",
"eamodio.gitlens",
"-vscjava.vscode-java-pack",
"Intility.vscode-backstage"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Oh My Zsh! theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
__zsh_prompt() {
local prompt_username
if [ ! -z "${GITHUB_USER}" ]; then
prompt_username="@${GITHUB_USER}"
else
prompt_username="%n"
fi
PROMPT="%{$fg[green]%}${prompt_username} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" # User/exit code arrow
PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' # cwd
PROMPT+='`\
if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
export BRANCH=$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null); \
if [ "${BRANCH}" != "" ]; then \
echo -n "%{$fg_bold[cyan]%}(%{$fg_bold[red]%}${BRANCH}" \
&& if [ "$(git config --get devcontainers-theme.show-dirty 2>/dev/null)" = 1 ] && \
git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
echo -n " %{$fg_bold[yellow]%}✗"; \
fi \
&& echo -n "%{$fg_bold[cyan]%})%{$reset_color%} "; \
fi; \
fi`'
PROMPT+=$'\n''%{$fg[white]%}$ %{$reset_color%}'
unset -f __zsh_prompt
}
__zsh_prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Marks the project's directory as safe in Git.
# Inside a devcontainer, the container's user (vscode) and the host user both
# have different UID/GIDs, leading Git to consider the ownership as dubious.
if [[ -z "$(git config --global safe.directory)" ]]; then
git config --global --add safe.directory /workspaces/community-plugins
fi

# Replace the default ZSH theme with a custom version the adds a newline before
# the user's prompt sign
mv \
/home/vscode/.oh-my-zsh/custom/themes/devcontainers.zsh-theme \
/home/vscode/.oh-my-zsh/custom/themes/devcontainers.zsh-theme.backup
cp \
/workspaces/community-plugins/workspaces/resource-optimization/.devcontainer/scripts/devcontainers.zsh-theme \
/home/vscode/.oh-my-zsh/custom/themes/devcontainers.zsh-theme
8 changes: 8 additions & 0 deletions workspaces/resource-optimization/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.yarn/cache
.yarn/install-state.gz
node_modules
packages/*/src
packages/*/node_modules
plugins
*.local.yaml
1 change: 1 addition & 0 deletions workspaces/resource-optimization/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
playwright.config.ts
3 changes: 3 additions & 0 deletions workspaces/resource-optimization/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
root: true,
};
56 changes: 56 additions & 0 deletions workspaces/resource-optimization/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# macOS
.DS_Store

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

# Coverage directory generated when running tests with coverage
coverage

# Dependencies
node_modules/

# Yarn 3 files
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Node version directives
.nvmrc

# dotenv environment variables file
.env
.env.test

# Build output
dist/
dist-types/
dist-dynamic/
dynamic-plugins-root/

# Temporary change files created by Vim
*.swp

# MkDocs build output
site

# Local configuration files
*.local.yaml

# Sensitive credentials
*-credentials.yaml

# vscode database functionality support files
*.session.sql

# E2E test reports
e2e-test-report/
5 changes: 5 additions & 0 deletions workspaces/resource-optimization/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
dist-types
coverage
.vscode
.eslintrc.js
3 changes: 3 additions & 0 deletions workspaces/resource-optimization/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npmScopes:
jsr:
npmRegistryServer: 'https://npm.jsr.io'
36 changes: 36 additions & 0 deletions workspaces/resource-optimization/DCO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Loading

0 comments on commit b9a9900

Please sign in to comment.