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

Appsetui updates #6

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ui/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as React from 'react';
import {Helmet} from 'react-helmet';
import {Redirect, Route, RouteComponentProps, Router, Switch} from 'react-router';
import applications from './applications';
// import applicationsets from './applicationsets';
import help from './help';
import login from './login';
import settings from './settings';
Expand All @@ -30,6 +31,7 @@ type Routes = {[path: string]: {component: React.ComponentType<RouteComponentPro
const routes: Routes = {
'/login': {component: login.component as any, noLayout: true},
'/applications': {component: applications.component},
'/applicationsets': {component: applications.component},
'/settings': {component: settings.component},
'/user-info': {component: userInfo.component},
'/help': {component: help.component}
Expand All @@ -49,9 +51,9 @@ const navItems: NavItem[] = [
path: '/applications',
iconClassName: 'argo-icon argo-icon-application'
},
{
{
title: 'Settings',
tooltip: 'Manage your repositories, projects, settings',
tooltip: 'Manage your repositories, projects, settings, application sets',
path: '/settings',
iconClassName: 'argo-icon argo-icon-settings'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';
import {Context} from '../../../shared/context';
import {services} from '../../../shared/services';

export const ApplicationsDetailsAppDropdown = (props: {appName: string}) => {
export const ApplicationsDetailsAppDropdown = (props: {isAppSet: boolean, appName: string}) => {
const [opened, setOpened] = React.useState(false);
const [appFilter, setAppFilter] = React.useState('');
const ctx = React.useContext(Context);
Expand Down Expand Up @@ -34,7 +34,7 @@ export const ApplicationsDetailsAppDropdown = (props: {appName: string}) => {
}
/>
</li>
<DataLoader load={() => services.applications.list([], {fields: ['items.metadata.name']})}>
<DataLoader load={() => services.applications.list(!props.isAppSet, [], {fields: ['items.metadata.name']})}>
{apps =>
apps.items
.filter(app => {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {Checkbox} from 'argo-ui/v2';
import {ApplicationTree, HealthStatusCode, HealthStatuses, SyncStatusCode, SyncStatuses} from '../../../shared/models';
import {AppDetailsPreferences, services} from '../../../shared/services';
import {AppDetailsPreferences, AppSetDetailsPreferences, services} from '../../../shared/services';
import {Context} from '../../../shared/context';
import {Filter, FiltersGroup} from '../filter/filter';
import {ComparisonStatusIcon, HealthStatusIcon} from '../utils';
Expand All @@ -14,17 +14,25 @@ function toOption(label: string) {
return {label};
}

export interface FiltersProps {
export interface AbstractFiltersProps {
children?: React.ReactNode;
pref: AppDetailsPreferences;
pref: AppDetailsPreferences | AppSetDetailsPreferences;
tree: ApplicationTree;
resourceNodes: models.ResourceStatus[];
onSetFilter: (items: string[]) => void;
onClearFilter: () => void;
collapsed?: boolean;
}

export const Filters = (props: FiltersProps) => {
export interface FiltersProps extends AbstractFiltersProps{
pref: AppDetailsPreferences;
}

export interface AppSetFiltersProps extends AbstractFiltersProps{
pref: AppSetDetailsPreferences;
}

export const Filters = (props: AbstractFiltersProps) => {
const ctx = React.useContext(Context);

const {pref, tree, onSetFilter} = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const ApplicationResourceList = ({
return null;
}
const parentNode = ((resources || []).length > 0 && (getResNode(tree.nodes, nodeKey(resources[0])) as ResourceNode)?.parentRefs?.[0]) || ({} as ResourceRef);
// debugger;

return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Moment from 'react-moment';
import {AppContext} from '../../../shared/context';
import {EmptyState} from '../../../shared/components';
import {Application, ApplicationTree, HostResourceInfo, InfoItem, Node, Pod, ResourceName, ResourceNode, ResourceStatus} from '../../../shared/models';
import {PodViewPreferences, services, ViewPreferences} from '../../../shared/services';
import {AppDetailsPreferences, PodViewPreferences, services, ViewPreferences} from '../../../shared/services';

import {ResourceTreeNode} from '../application-resource-tree/application-resource-tree';
import {ResourceIcon} from '../resource-icon';
Expand All @@ -15,6 +15,7 @@ import {ComparisonStatusIcon, isYoungerThanXMinutes, HealthStatusIcon, nodeKey,

import './pod-view.scss';
import {PodTooltip} from './pod-tooltip';
import { Observable } from 'rxjs';

interface PodViewProps {
tree: ApplicationTree;
Expand Down Expand Up @@ -48,7 +49,7 @@ export class PodView extends React.Component<PodViewProps> {

public render() {
return (
<DataLoader load={() => services.viewPreferences.getPreferences()}>
<DataLoader load={() => services.viewPreferences.getPreferences() as Observable<ViewPreferences>}>
{prefs => {
const podPrefs = prefs.appDetails.podView || ({} as PodViewPreferences);
const groups = this.processTree(podPrefs.sortMode, this.props.tree.hosts || []) || [];
Expand All @@ -75,7 +76,7 @@ export class PodView extends React.Component<PodViewProps> {
style={{border: 'none', width: '170px'}}
onClick={() =>
services.viewPreferences.updatePreferences({
appDetails: {...prefs.appDetails, podView: {...podPrefs, hideUnschedulable: !podPrefs.hideUnschedulable}}
appDetails: {...prefs.appDetails, podView: {...podPrefs, hideUnschedulable: !podPrefs.hideUnschedulable} } as AppDetailsPreferences
})
}>
<i className={`fa fa-${podPrefs.hideUnschedulable ? 'eye-slash' : 'eye'}`} style={{width: '15px', marginRight: '5px'}} />
Expand Down Expand Up @@ -270,7 +271,7 @@ export class PodView extends React.Component<PodViewProps> {
),
action: () => {
this.appContext.apis.navigation.goto('.', {podSortMode: mode});
services.viewPreferences.updatePreferences({appDetails: {...prefs.appDetails, podView: {...podPrefs, sortMode: mode}}});
services.viewPreferences.updatePreferences({appDetails: {...prefs.appDetails, podView: {...podPrefs, sortMode: mode}} as AppDetailsPreferences});
}
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import * as React from 'react';
import {DataLoader, EventsList} from '../../../shared/components';
import {services} from '../../../shared/services';

export const ApplicationResourceEvents = (props: {applicationName: string; applicationNamespace: string; resource?: {namespace: string; name: string; uid: string}}) => (
export const ApplicationResourceEvents = (props: {isApp: boolean, applicationName: string; applicationNamespace: string; resource?: {namespace: string; name: string; uid: string}}) => (
<div className='application-resource-events'>
<DataLoader
load={() =>
props.resource
? services.applications.resourceEvents(props.applicationName, props.applicationNamespace, props.resource)
: services.applications.events(props.applicationName, props.applicationNamespace)
? services.applications.resourceEvents(props.isApp, props.applicationName, props.applicationNamespace, props.resource)
: services.applications.events(props.isApp, props.applicationName, props.applicationNamespace)
}
loadingRenderer={() => <MockupList height={50} marginTop={10} />}>
{events => <EventsList events={events} />}
Expand Down
Loading