Skip to content

Commit

Permalink
Merge branch 'ui/refactoring' of github.com:kloudlite/web into ui/ref…
Browse files Browse the repository at this point in the history
…actoring
  • Loading branch information
karthik1729 committed Jun 19, 2024
2 parents 45084aa + 1be6407 commit 4eafebd
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 89 deletions.
12 changes: 8 additions & 4 deletions src/apps/console/routes/_a+/teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,15 @@ const Accounts = () => {
key: generateKey(name, index),
className: 'flex-1',
render: () => (
<div className="flex flex-row items-center gap-lg">
<div className="group flex flex-row items-center gap-lg">
<ConsoleAvatar name={name} />
<div className="text-text-default headingMd flex-1">
{displayName}{' '}
<span className="opacity-60">#{name}</span>
<div className="text-text-default flex-1">
<span className="capitalize headingMd">
{displayName}
</span>{' '}
<span className=" group-hover:text-text-soft text-text-disabled ">
#{name}
</span>
</div>
</div>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const HandleExternalApp = (props: IDialog) => {
return (
<Popup.Root show={visible} onOpenChange={(v) => setVisible(v)}>
<Popup.Header>
{isUpdate ? 'Edit External Name' : 'Add External Name'}
{isUpdate ? 'Edit External App' : 'Add External App'}
</Popup.Header>
{(!isUpdate || (isUpdate && props.data)) && <Root {...props} />}
</Popup.Root>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Button } from '~/components/atoms/button';
import { useState } from 'react';
import { IAccountContext } from '~/console/routes/_main+/$account+/_layout';
import { EmptyManagedResourceImage } from '~/console/components/empty-resource-images';
import { getSearch } from '~/console/server/utils/common';
import Tools from './tools';
import ManagedResourceResourcesV2 from './managed-resources-resource-v2';
import HandleManagedResourceV2 from './handle-managed-resource-v2';
Expand All @@ -22,6 +23,7 @@ export const loader = (ctx: IRemixCtx) => {
ctx.request
).listManagedResources({
search: {
...getSearch(ctx),
envName: {
matchType: 'exact',
exact: environment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ const Tools = ({ viewMode, setViewMode }: IModeProps) => {

const options = useMemo(
() => [
{
name: 'Status',
type: 'text',
search: false,
dataFetcher: async () => {
return [
{ content: 'Active', value: 'active' },
{ content: 'Freezed', value: 'freezed' },
{ content: 'Archived', value: 'archived' },
];
},
},
// {
// name: 'Status',
// type: 'text',
// search: false,
// dataFetcher: async () => {
// return [
// { content: 'Active', value: 'active' },
// { content: 'Freezed', value: 'freezed' },
// { content: 'Archived', value: 'archived' },
// ];
// },
// },
],
[searchParams]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import CommonTools from '~/console/components/common-tools';

const Tools = () => {
const [searchParams] = useSearchParams();
console.log('ee params', searchParams);

const options = useMemo(() => [], [searchParams]);

Expand Down
77 changes: 39 additions & 38 deletions src/apps/console/routes/_main+/$account+/infra+/clusters/tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,22 @@ const FilterByCLusterType = ({ onChange, value }: IFilterByClusterType) => {

const Tools = ({ onChange, value }: IFilterByClusterType) => {
const [searchParams] = useSearchParams();

console.log('cc params', searchParams);
const options = useMemo(
() => [
{
name: 'Provider',
type: 'cloudProviderName',
search: false,
dataFetcher: async () => {
return [
{ content: 'Amazon Web Services', value: 'aws' },
{ content: 'Digital Ocean', value: 'do' },
{ content: 'Google Cloud Platform', value: 'gcp' },
{ content: 'Microsoft Azure', value: 'azure' },
];
},
},

// {
// name: 'Provider',
// type: 'cloudProviderName',
// search: false,
// dataFetcher: async () => {
// return [
// { content: 'Amazon Web Services', value: 'aws' },
// { content: 'Digital Ocean', value: 'do' },
// { content: 'Google Cloud Platform', value: 'gcp' },
// { content: 'Microsoft Azure', value: 'azure' },
// ];
// },
// },
// {
// name: 'Region',
// type: 'region',
Expand All @@ -81,37 +80,39 @@ const Tools = ({ onChange, value }: IFilterByClusterType) => {
// ];
// },
// },

{
name: 'Status',
type: 'isReady',
search: false,
dataFetcher: async () => {
return [
{ content: 'Running', value: true },
{ content: 'Error', value: false },
// { content: 'Freezed', value: false, type: 'freezed' },
];
},
},
// {
// name: 'Status',
// type: 'isReady',
// search: false,
// dataFetcher: async () => {
// return [
// { content: 'Running', value: true },
// { content: 'Error', value: false },
// // { content: 'Freezed', value: false, type: 'freezed' },
// ];
// },
// },
],
[searchParams]
);

return (
<CommonTools
{...{ options }}
commonToolPrefix={
<FilterByCLusterType
onChange={(e) => {
console.log(e);
onChange?.(e);
}}
value={value}
/>
}
// commonToolPrefix={
// <FilterByCLusterType
// onChange={(e) => {
// console.log(e);
// onChange?.(e);
// }}
// value={value}
// />
// }
/>
);

// const [searchParams] = useSearchParams();

// const options = useMemo(() => [], [searchParams]);
};

export default Tools;
36 changes: 19 additions & 17 deletions src/apps/console/routes/_main+/$account+/managed-services/tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ import CommonTools, { IModeProps } from '~/console/components/common-tools';
const Tools = ({ viewMode, setViewMode }: IModeProps) => {
const [searchParams] = useSearchParams();

const options = useMemo(
() => [
{
name: 'Status',
type: 'text',
search: false,
dataFetcher: async () => {
return [
{ content: 'Active', value: 'active' },
{ content: 'Freezed', value: 'freezed' },
{ content: 'Archived', value: 'archived' },
];
},
},
],
[searchParams]
);
const options = useMemo(() => [], [searchParams]);

// const options = useMemo(
// () => [
// {
// name: 'Status',
// type: 'text',
// search: false,
// dataFetcher: async () => {
// return [
// { content: 'Active', value: 'active' },
// { content: 'Freezed', value: 'freezed' },
// { content: 'Archived', value: 'archived' },
// ];
// },
// },
// ],
// [searchParams]
// );

return <CommonTools {...{ viewMode, setViewMode, options }} />;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import fake from '~/root/fake-data-generator/fake';
import { Button } from '~/components/atoms/button';
import { IAccountContext } from '~/console/routes/_main+/$account+/_layout';
import { EmptyManagedResourceImage } from '~/console/components/empty-resource-images';
import { getSearch } from '~/console/server/utils/common';
import Tools from './tools';
import ManagedResourceResourcesV2 from './managed-resources-resource-v2';

Expand All @@ -20,13 +21,10 @@ export const loader = (ctx: IRemixCtx) => {
ctx.request
).listManagedResources({
search: {
managedServiceName: {
matchType: 'exact',
exact: msv,
},
...getSearch(ctx),
managedServiceName: { matchType: 'exact', exact: msv },
},
});

if (mErrors) {
throw mErrors[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ const Tools = ({ viewMode, setViewMode }: IModeProps) => {

const options = useMemo(
() => [
{
name: 'Status',
type: 'text',
search: false,
dataFetcher: async () => {
return [
{ content: 'Active', value: 'active' },
{ content: 'Freezed', value: 'freezed' },
{ content: 'Archived', value: 'archived' },
];
},
},
// {
// name: 'Status',
// type: 'text',
// search: false,
// dataFetcher: async () => {
// return [
// { content: 'Active', value: 'active' },
// { content: 'Freezed', value: 'freezed' },
// { content: 'Archived', value: 'archived' },
// ];
// },
// },
],
[searchParams]
);
Expand Down

0 comments on commit 4eafebd

Please sign in to comment.