Skip to content

Commit

Permalink
Pr local to ksc 20240306 1 (kubesphere#2741)
Browse files Browse the repository at this point in the history
* Fix: Modify repo status

* Fix: kubesphere/project#2961

* Fix: kubesphere/project#2961

* Fix: Modify repo APi params

---------

Co-authored-by: hollisy <jialeiyang@yunify.com>
  • Loading branch information
1216361723 and hollisy authored Mar 6, 2024
1 parent dbe6263 commit 2ef6036
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Props = {
workspaces: FormattedWorkspace[];
namespaces: FormattedNamespace[];
refetchClusters: () => void;
refetchNamespaces: () => void;
refetchNamespaces: (data: { cluster: string }) => void;
workspace?: string;
onConfirm?: () => void;
onCancel?: () => void;
Expand Down Expand Up @@ -104,7 +104,10 @@ function ConfigForm({
</Col>
<Col span={4}>
<FormItem name="cluster" label={t('CLUSTER')}>
<StyledSelect placeholder=" " onSelect={() => refetchNamespaces()}>
<StyledSelect
placeholder=" "
onSelect={(val: string) => refetchNamespaces({ cluster: val })}
>
{clusterOptions.map(({ label, value, notReady, cluster }) => (
<Option key={value} value={value} disabled={notReady}>
<OptionWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ function PlacementConfigForm(
const namespaceAutoFetch = useMemo(() => {
return (
!!(workspace || form.getFieldValue('workspace')) &&
// TODO 冲突 临时移除cluster
// !!confirmedFormData?.cluster &&
!!confirmedPlacementData?.cluster &&
!!form.getFieldValue('cluster') &&
!workspaceLoading
);
Expand Down Expand Up @@ -217,7 +216,14 @@ function PlacementConfigForm(
workspaces={workspaces}
namespaces={namespaces}
refetchClusters={refetchClusters}
refetchNamespaces={refetchNamespace}
refetchNamespaces={(val: any) => {
setConfirmedFormData(prev => ({
...prev,
...val,
namespace: '',
}));
refetchNamespace();
}}
onConfirm={form.submit}
onCancel={closePlacementForm}
/>
Expand Down
6 changes: 5 additions & 1 deletion packages/shared/src/components/Apps/InstanceList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { last } from 'lodash';
import { Link } from 'react-router-dom';
import { Entity, Field } from '@kubed/components';
import { getProjectAliasName } from '../../../utils/caches';
import { getProjectAliasName, getClusterAliasName } from '../../../utils/caches';

import { formatTime, getDisplayName } from '../../../utils';
import StatusIndicator from '../../StatusIndicator';
Expand Down Expand Up @@ -52,6 +52,10 @@ function InstanceItem({ detail, showVersion }: Props): JSX.Element {
) || '-'
}
/>
<Field
label={t('CLUSTER_PL')}
value={getClusterAliasName(detail?.metadata?.labels?.['kubesphere.io/cluster']) || '-'}
/>
<Field
label={t('CREATION_TIME')}
value={formatTime(
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/src/components/Apps/InstanceList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function InstanceList({
appName: defaultAppName,
}: Props): JSX.Element {
const { appName = defaultAppName, workspace, cluster } = useParams();
const hideClusters = location.href.includes('apps-manage/store');
const { clusters } = useClusterStore();
const clusterOptions = (clusters || [])?.map(({ name }: any) => ({
label: getClusterAliasName(name),
Expand All @@ -55,7 +56,7 @@ export function InstanceList({
<Card className={className} sectionTitle={title || t('APP_INSTANCES')}>
{!hideHeader && (
<HeaderContent>
{!isEmpty(clusters) && (
{(!isEmpty(clusters) || hideClusters) && (
<Select
style={{ width: '250px' }}
value={clusterSelected}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function RepoManagementModal({ visible, detail, onCancel, onOk }: Props): JSX.El
}, []);

function getFormData(data: any) {
const labels = workspace ? { 'kubesphere.io/workspace': workspace } : undefined;
const labels = { 'kubesphere.io/workspace': workspace || 'system-workspace' };
const global = workspace ? undefined : true;
return {
apiVersion: 'application.kubesphere.io/v2',
Expand Down
3 changes: 1 addition & 2 deletions packages/shared/src/stores/openpitrix/repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ export function getRepoUrl({ workspace, repo_name, name }: RepoPathParams): stri
if (repo_name) {
return `${prefix}/repos/${repo_name}/${name || ''}`;
}
const isGlobal = workspace ? '' : '?global=true';

return `${prefix}/repos${isGlobal}`;
return `${prefix}/repos`;
}

export function useRepoList(
Expand Down

0 comments on commit 2ef6036

Please sign in to comment.