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

Release v1.0.8 merged to main #322

Merged
merged 60 commits into from
Oct 10, 2024
Merged

Release v1.0.8 merged to main #322

merged 60 commits into from
Oct 10, 2024

Conversation

nxtcoder19
Copy link
Contributor

@nxtcoder19 nxtcoder19 commented Oct 10, 2024

Summary by Sourcery

Merge release v1.0.8 into the main branch, introducing new features like local cluster attachment instructions and video components, enhancing existing GraphQL queries with additional parameters and fields, and fixing issues related to authentication mutations. The build system is updated with new video handling dependencies, and unused IoT console queries are removed.

New Features:

  • Introduce a new GraphQL query consoleSetupDefaultEnvironment to set up a default environment.
  • Add new components EnvIconComponent and EnvTemplateIconComponent for rendering environment-related icons.
  • Implement a new LocalDeviceClusterInstructions component to guide users on attaching local clusters.
  • Add a new PopupVideo component for displaying video content in a popup format.
  • Introduce a new VideoSection component to showcase Kloudlite in action with video content.
  • Add a new NoLogsAndMetricsBanner component to display messages when logs and metrics are unavailable.

Bug Fixes:

  • Fix the issue with the authRequestResetPassword mutation by adding a captchaToken parameter.
  • Correct the authSignUpWithEmail mutation to include a captchaToken parameter.
  • Resolve the issue with the authLogin mutation by adding a token parameter for reCAPTCHA verification.

Enhancements:

  • Refactor the consoleListClusterStatus query to include a search parameter for more flexible querying.
  • Update the consoleGetRegistryImageUrl query to include additional fields like urlExample and klWebhookAuthToken.
  • Enhance the consoleListMembershipsForAccount query to include the id field for user details.
  • Improve the consoleListRegistryImages query to support more detailed image data retrieval.
  • Refactor the consoleListBYOKClusters query to support searching and pagination.
  • Enhance the consoleListGlobalVPNDevices query to include more detailed device information.

Build:

  • Update the pnpm-lock.yaml to include new dependencies like video.js and related packages for video handling.

Chores:

  • Remove unused GraphQL queries related to IoT console operations.
  • Update the Taskfile.yaml to include a new task for pushing dashboard containers.

tulsiojha and others added 30 commits September 23, 2024 11:36
WEB: Update ui related changes of console
WEB: Add templated while account creation and fixes minor ui changes
- cluster status of different account in environment showing correct
- environment listing ui update
- clone environment in template mode
WEB: Console changes and ui fixes
nxtcoder19 and others added 25 commits October 8, 2024 10:55
fixed error that occured while removing the user form the team.
🐛 Fixed issue with user management
WEB: Discard changes working fine when switching tab of app settings
WEB: User Acess management changes
Add no logs and metrics banner when cluster is offline
* fixed profile dropdown menu not closing issue, upgraded react-select and fixed react-select issue for disabled option
Remove delete option for local cluster
Update changes in image discovery and infra cluster listing
Copy link

sourcery-ai bot commented Oct 10, 2024

Reviewer's Guide by Sourcery

This pull request implements several significant changes across multiple files in the Kloudlite project. The changes include updates to the user interface, improvements in functionality, and modifications to the project structure. Key areas affected include the console application, authentication, development documentation, and various components and utilities.

Sequence diagram for Registry Image Instruction

sequenceDiagram
    actor User
    participant RegistryImageInstruction
    participant Popup
    participant CodeView
    participant Banner

    User->>RegistryImageInstruction: Open Instruction
    RegistryImageInstruction->>Popup: Show Popup
    Popup->>CodeView: Display URL/Script
    CodeView-->>User: Copy URL/Script
    Popup->>Banner: Show Info Banner
    Banner-->>User: Display Metadata Info
Loading

Class diagram for updated icon components

classDiagram
    class AvatarNotification {
        +size: number
    }
    class EnvIconComponent {
        +size: number
    }
    class EnvTemplateIconComponent {
        +size: number
    }

    AvatarNotification --> EnvIconComponent : uses
    AvatarNotification --> EnvTemplateIconComponent : uses
Loading

Class diagram for updated Popup Form

classDiagram
    class PopupForm {
        +onSubmit(e)
    }
    class PopupContent {
    }
    class PopupFooter {
    }
    class LocalDeviceClusterInstructions {
        +show: boolean
        +onClose()
    }

    PopupForm --> PopupContent
    PopupForm --> PopupFooter
    PopupForm --> LocalDeviceClusterInstructions : uses
Loading

Class diagram for new DragResize component

classDiagram
    class DragResize {
        +isMouseDown: boolean
        +onMouseMove(e)
        +onMouseDown()
        +onMouseUp()
    }
Loading

File-Level Changes

Change Details Files
Updated environment and cluster management functionality
  • Modified environment creation process to include template options
  • Updated cluster status checking and display logic
  • Improved error handling and user feedback for cluster operations
  • Added new components for displaying cluster and environment information
src/apps/console/routes/_main+/$account+/environments/route.tsx
src/apps/console/routes/_main+/$account+/infra+/byok-cluster/handle-byok-cluster.tsx
src/apps/console/routes/_main+/$account+/environments/environment-resources-v2.tsx
src/apps/console/hooks/use-cluster-status-v3.tsx
Implemented reCAPTCHA integration for enhanced security
  • Added reCAPTCHA to signup and login processes
  • Integrated reCAPTCHA with password reset functionality
  • Updated API calls to include reCAPTCHA token
src/apps/auth/root.tsx
src/apps/auth/routes/_main+/forgot-password.tsx
src/apps/auth/routes/_providers+/login.tsx
src/apps/auth/routes/_providers+/signup.tsx
Refactored and improved user interface components
  • Updated Avatar component to support new styling options
  • Modified Select component to improve accessibility and usability
  • Enhanced Radio component with new layout options
  • Updated Chip component with new size and style variants
src/design-system/components/atoms/avatar.tsx
src/design-system/components/atoms/select.tsx
src/design-system/components/atoms/radio.tsx
src/design-system/components/atoms/chips.tsx
Updated documentation and added new content
  • Added new blog post about development environments and workspaces
  • Updated existing documentation pages with new information
  • Added new video section to the homepage
  • Implemented popup video player component
src/apps/devdoc/pages/blog/network-solution.mdx
src/apps/devdoc/pages/docs/index.mdx
src/apps/devdoc/web/components/website/home/video-section.tsx
src/apps/devdoc/web/components/popup-video.tsx
Improved error handling and user feedback
  • Added new components for displaying error messages
  • Implemented more detailed error logging
  • Updated API error handling to provide more informative user feedback
src/apps/console/page-components/no-logs-banner.tsx
src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/logs-n-metrics/route.tsx
src/apps/console/server/gql/queries/cluster-queries.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@nxtcoder19 nxtcoder19 merged commit 85d94fa into main Oct 10, 2024
7 checks passed
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @nxtcoder19 - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Hard-coded RECAPTCHA_SITE_KEY found. (link)
  • Hard-coded RECAPTCHA_SITE_KEY found in environment file. (link)
  • Hard-coded RECAPTCHA_SITE_KEY found in environment file. (link)

Overall Comments:

  • The new ClusterStatusProvider and useClusterStatusV3 hook look like good improvements to cluster status management. Consider adding some unit tests to ensure their reliability.
  • The updates to environment and app handling with respect to cluster status are a nice enhancement. It might be helpful to add some comments in the code explaining the logic behind these changes for future maintainers.
  • The refinements to user management and permissions are good. Consider creating a separate utility function for checking owner status to reduce code duplication.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🔴 Security: 3 blocking issues, 3 other issues
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +53 to +112
<div className="flex flex-row gap-lg">
<span className="bodySm-semibold text-sm py-md">
Copy your Webhook Token:
</span>
<Chip
item={{ name: 'web token' }}
label={
<CopyContentToClipboard
content={data.klWebhookAuthToken}
toastMessage="Webhook token copied successfully."
/>
}
/>
</div>
<ExtendedFilledTab
value={active}
onChange={setActive}
items={[
{
label: 'Script',
to: 'script-url',
value: 'script-url',
},
{ label: 'cURL Command', to: 'url', value: 'url' },
]}
/>

{/* {data.url} */}
{active === 'script-url' && (
<div className="flex flex-col gap-3xl">
{data.scriptUrl &&
data.scriptUrl.map((u) => (
<CodeView
key={u}
preClassName="!overflow-none text-wrap break-words"
copy={false}
data={u}
language="sh"
/>
))}
<Banner
type="info"
body={
<div className="flex flex-col gap-md">
<span className="bodyMd-medium">
Shell Script Example with Image and Meta
Information:
</span>
{data.scriptUrlExample &&
data.scriptUrlExample.map((d) => (
<span
className="font-mono text-text-default"
key={d}
>
{d}
</span>
))}
</div>
}
/>
</div>
Copy link

Choose a reason for hiding this comment

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

🚨 suggestion (security): Added UI for displaying and copying webhook token

The new UI for webhook token management improves user experience. Ensure that the token is properly secured and that its exposure in the UI doesn't pose any security risks.

<div className="flex flex-row gap-lg">
  <span className="bodySm-semibold text-sm py-md">Webhook Token:</span>
  <Chip
    item={{ name: 'web token' }}
    label={
      <CopyContentToClipboard
        content={data.klWebhookAuthToken}
        toastMessage="Webhook token copied securely."
      />
    }
  />
</div>
<ProtectedContent>
  <ExtendedFilledTab
    value={active}
    onChange={setActive}
    items={[
      { label: 'Script', to: 'script-url', value: 'script-url' },
      { label: 'cURL Command', to: 'url', value: 'url' },
    ]}
  />
  {/* Rest of the code remains unchanged */}
</ProtectedContent>

]}
onChange={({ value }) => {
handleChange('clusterName')(dummyEvent(value));
<Radio.Root
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): New feature for Environment/Template selection added

A new radio button selection for Environment vs Environment Template has been added. Ensure that this new feature is thoroughly tested and that it integrates well with existing functionality.

            <Radio.Root
              direction="horizontal"
              value={values.radioType}
              onValueChange={(value) => handleChange('radioType')(dummyEvent(value))}
              aria-label="Select environment type"
            >
              <Radio.Item value="environment" label="Environment" />
              <Radio.Item value="template" label="Environment Template" />
            </Radio.Root>

@@ -101,7 +120,8 @@
metadata: {
name: val.name,
},
clusterName: val.clusterName || '',
clusterName:
Copy link

Choose a reason for hiding this comment

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

suggestion: Conditional cluster selection based on radioType

The clusterName is now conditionally set based on the new radioType field. Verify that this logic works as intended and doesn't introduce any edge cases or bugs.

              clusterName:
                val.radioType === 'template'
                  ? ''
                  : val.clusterName || '',

/>
),
render: () => {
if (item.role === 'account_owner') return null;
Copy link

Choose a reason for hiding this comment

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

🚨 suggestion (security): New check for account owner role

A new check for the account_owner role has been added. Ensure that this properly restricts actions for account owners and doesn't introduce any security vulnerabilities.

<script
async
defer
src={`https://www.google.com/recaptcha/enterprise.js?render=${process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || ''}`}
Copy link

Choose a reason for hiding this comment

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

🚨 suggestion (security): Consider error handling for missing reCAPTCHA key

While using an empty string as a fallback is safe, it might be better to throw an error if the NEXT_PUBLIC_RECAPTCHA_SITE_KEY is not set. This would prevent the application from running without proper reCAPTCHA configuration, which could lead to unexpected behavior.

Suggested change
src={`https://www.google.com/recaptcha/enterprise.js?render=${process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || ''}`}
src={`https://www.google.com/recaptcha/enterprise.js?render=${
process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY ||
(() => {
throw new Error('NEXT_PUBLIC_RECAPTCHA_SITE_KEY is not set');
})()
}`}

Comment on lines +122 to +138
const resp = clusterNames.reduce((acc, curr) => {
if (!curr) {
return acc;
}

if (acc[curr] && acc[curr] >= 1) {
acc[curr] -= acc[curr];
}

if (acc[curr] === 0) {
delete acc[curr];
}

return acc;
}, s);

return resp;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Inline variable that is immediately returned (inline-immediately-returned-variable)

Suggested change
const resp = clusterNames.reduce((acc, curr) => {
if (!curr) {
return acc;
}
if (acc[curr] && acc[curr] >= 1) {
acc[curr] -= acc[curr];
}
if (acc[curr] === 0) {
delete acc[curr];
}
return acc;
}, s);
return resp;
return clusterNames.reduce((acc, curr) => {
if (!curr) {
return acc;
}
if (acc[curr] && acc[curr] >= 1) {
acc[curr] -= acc[curr];
}
if (acc[curr] === 0) {
delete acc[curr];
}
return acc;
}, s);


ExplanationSomething that we often see in people's code is assigning to a result variable
and then immediately returning it.

Returning the result directly shortens the code and removes an unnecessary
variable, reducing the mental load of reading the function.

Where intermediate variables can be useful is if they then get used as a
parameter or a condition, and the name can act like a comment on what the
variable represents. In the case where you're returning it from a function, the
function name is there to tell you what the result is, so the variable name
is unnecessary.

);

const isOwner = useCallback(() => {
if (!teamMembers || !currentUser) return false;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (!teamMembers || !currentUser) return false;
if (!teamMembers || !currentUser) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

@@ -72,6 +74,12 @@ const SettingGeneral = () => {
},
});

const isOwner = useMemo(() => {
if (!teamMembers || !currentUser) return false;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (!teamMembers || !currentUser) return false;
if (!teamMembers || !currentUser) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

}
);
const isOwner = useMemo(() => {
if (!teamMembers || !currentUser) return false;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (!teamMembers || !currentUser) return false;
if (!teamMembers || !currentUser) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

/>
),
render: () => {
if (item.role === 'account_owner') return null;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (item.role === 'account_owner') return null;
if (item.role === 'account_owner') {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants