Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cyclops-ui): Filter Modules by TargetNamespace #666

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

s-vamshi
Copy link
Contributor

closes #640

📑 Description

✅ Checks

  • I have tested my code (provide screenshots or screen recordings of a working solution)
  • I have performed a self-review of my code

ℹ Additional context

screen-capture.1.webm

image

@s-vamshi s-vamshi requested a review from a team as a code owner October 31, 2024 11:34
@s-vamshi
Copy link
Contributor Author

@quest-bot loot #640

@quest-bot quest-bot bot added the ⚔️ Quest Tracks quest-bot quests label Oct 31, 2024
Copy link

quest-bot bot commented Oct 31, 2024

Quest PR submitted! image Quest PR submitted!

@s-vamshi, you are attempting to solve the issue and loot this Quest. Will you be successful?


Questions? Check out the docs.

@s-vamshi
Copy link
Contributor Author

hey @petar-cvit @KaradzaJuraj, can you please review this pr in your free time?

Copy link
Collaborator

@KaradzaJuraj KaradzaJuraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @s-vamshi, the filter resets every 10 seconds because we refresh the module list every 10 seconds.
Use the /api/namespaces endpoint to populate the filter data even before you get the modules.

@@ -24,18 +24,40 @@ import { mapResponseError } from "../../../utils/api/errors";

const { Title } = Typography;

interface ModuleInterface {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this for now, we'd have to implement it in more places. Let's keep the scope of the PR to just what was defined in the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will remove it!

const Modules = () => {
const [allData, setAllData] = useState([]);
const [filteredData, setFilteredData] = useState([]);
const [allData, setAllData] = useState<ModuleInterface[]>([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert to empty array

const [allData, setAllData] = useState([]);
const [filteredData, setFilteredData] = useState([]);
const [allData, setAllData] = useState<ModuleInterface[]>([]);
const [filteredData, setFilteredData] = useState<ModuleInterface[]>([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert to empty array

return self.indexOf(targetNamespace) === index;
});
setNamespaceFilterData(namespaceData);
setModuleNamespaceFilter(namespaceData);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot use setModuleNamespaceFilter here because it is called every 10 seconds and resets the filter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true didnt check this my bad, will update

@@ -49,6 +71,7 @@ const Modules = () => {
.get(`/api/modules/list`)
.then((res) => {
setAllData(res.data);
populateNamespaceData(res.data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the call of this function outside the fetchModules loop.

In this useEffect, before the fetchModules function, create a call towards /api/namespaces. This will return all available namespaces with which you can populate both the namespaceFilterData and the moduleNamespaceFilter

@s-vamshi
Copy link
Contributor Author

s-vamshi commented Nov 1, 2024

hey @KaradzaJuraj thanks for reviewing this, will be pushing the changes soon!

@s-vamshi
Copy link
Contributor Author

s-vamshi commented Nov 2, 2024

hey @KaradzaJuraj made the changes as mentioned can you please review them in your free time?

Copy link
Collaborator

@KaradzaJuraj KaradzaJuraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @s-vamshi, just a few minor tweaks and it should be good to go!

cyclops-ui/src/components/pages/Modules/Modules.tsx Outdated Show resolved Hide resolved
cyclops-ui/src/components/pages/Modules/Modules.tsx Outdated Show resolved Hide resolved
cyclops-ui/src/components/pages/Modules/Modules.tsx Outdated Show resolved Hide resolved
@s-vamshi
Copy link
Contributor Author

s-vamshi commented Nov 6, 2024

hey @KaradzaJuraj, done with the changes! please review them in your free time!!

@s-vamshi s-vamshi requested a review from KaradzaJuraj November 9, 2024 18:18
Copy link
Collaborator

@KaradzaJuraj KaradzaJuraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @s-vamshi, looks great! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚔️ Quest Tracks quest-bot quests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter Modules by TargetNamespace
2 participants