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

Split out Kube code (with Helm & Workloads) into it's own package #475

Merged
merged 104 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
cd44987
Ensure filename/no filename text in connect by file dialog is aligned…
richard-cox Jul 28, 2020
f627688
Add typed entity access and `custom-src` removal to change log (#4496)
richard-cox Aug 7, 2020
d7102e7
Fixes #4335: Create Stratos static web site with better documentation…
Aug 7, 2020
50617f7
Fix and update customization docs (#4478)
richard-cox Aug 7, 2020
b713c78
Update base README, point to website (#4488)
richard-cox Aug 7, 2020
e12f60f
Update developer docs (#4489)
richard-cox Aug 7, 2020
4209358
Fix docs (#4497)
richard-cox Aug 7, 2020
dc2d6d6
Ensure images dependent on techPreview flag are included in imagelist…
richard-cox Aug 18, 2020
4df1516
Improve clean-symlinks script (#4509)
nwmac Aug 18, 2020
3a8cd74
Change nginx ciphers and make configurable via helm chart values (#4507)
nwmac Aug 18, 2020
200726c
Update version to 4.0.1, add change log (#4514)
richard-cox Aug 18, 2020
0285873
Fix deploy from gitlab using a group's repo (#4479)
richard-cox Aug 20, 2020
ad64761
Add additional time ranges to base metrics range selector (#4480)
richard-cox Aug 20, 2020
d27a12d
Add some time saving comments to cf permissions checker (#4508)
richard-cox Aug 20, 2020
8da357a
Move tab-nav and xsrf module source files to the src folder (#4518)
nwmac Aug 21, 2020
286d508
Fix GitHub branch limit (#4510)
richard-cox Aug 21, 2020
9a70ea6
Remove use of nodejs util module (#4521)
nwmac Aug 21, 2020
77d5a20
Remove dependencies between store and core that have crept in (#4517)
nwmac Aug 21, 2020
027f9c3
Fix store testing package (#4520)
nwmac Aug 21, 2020
5214f9f
Fix the position of the header guide array (#4524)
richard-cox Aug 24, 2020
009c203
Metrics: Ensure trailing slashes are ignored when comparing URLs (#4527)
nwmac Aug 24, 2020
da6285c
Remove imports of the form 'frontend/....' (#4519)
nwmac Aug 24, 2020
307fc20
Move endpopints-health-check.ts (#4530)
nwmac Aug 24, 2020
0aefbb1
Add UMD Ids to external modules in store package (#4522)
nwmac Aug 24, 2020
55f2244
Improvements & more checks to autoscaler scheduled date tests (#4535)
richard-cox Aug 25, 2020
a0b338a
Remove api driven views (#4537)
nwmac Aug 25, 2020
0ea6632
Remove logger service and action history (#4538)
nwmac Aug 25, 2020
5eb7f0e
Add support for API keys (#4515)
ikapelyukhin Aug 25, 2020
68d5df7
Update moment imports to remove warning when building library (#4534)
nwmac Aug 25, 2020
3c157d1
Improve presentation and fix issue with development versions
nwmac Aug 25, 2020
46732d8
Merge remote-tracking branch 'origin/improve-monocular-ui' into helm-…
nwmac Aug 25, 2020
641ccf8
WIP
richard-cox Aug 26, 2020
d845669
Fix Helm upgrade bug (#4544)
nwmac Aug 26, 2020
303bbb7
Add support for Helm Upgrade and Helm history
nwmac Aug 27, 2020
62d1a77
Remove console logging
nwmac Aug 27, 2020
d2dbafd
Add comment
nwmac Aug 27, 2020
cc8e2ac
Minor tweaks following self-review
nwmac Aug 27, 2020
dc24e61
Merge remote-tracking branch 'origin/master' into helm-hub
richard-cox Aug 27, 2020
ac18f0b
WIP
richard-cox Aug 27, 2020
d665348
Merge remote-tracking branch 'origin/master' into helm-hub
richard-cox Aug 28, 2020
adcd11a
fix install button
richard-cox Aug 28, 2020
43b2c33
Fix actual helm install
richard-cox Aug 28, 2020
a0ab8b6
Remove helm repos view
richard-cox Aug 28, 2020
f6f2d9f
Store api_keys.last_used in UTC (#4541)
ikapelyukhin Sep 1, 2020
fd2ee0f
Show per endpoint type actions in endpoints table
richard-cox Aug 28, 2020
ffd0de0
Tidy up registration step
richard-cox Sep 1, 2020
8042df9
Tidy up provider interceptor pattern
richard-cox Sep 1, 2020
7916f8a
Tidy up services, fix charts list filter by repo/helm hub
richard-cox Sep 1, 2020
7247090
Add endpoint unRegisterable, make helm types sub types, tidy up
richard-cox Sep 1, 2020
412fbf2
Remove debug logging
nwmac Sep 2, 2020
c8250ee
Merge remote-tracking branch 'origin/master' into helm-features
nwmac Sep 2, 2020
cffb053
Fix whitespace
nwmac Sep 2, 2020
b560761
Add UI for Stratos API Keys (#4523)
richard-cox Sep 2, 2020
20d79e0
Minor tidy ups
nwmac Sep 2, 2020
d1915b8
Merge remote-tracking branch 'origin/master' into helm-features
nwmac Sep 2, 2020
545669a
Add basic e2e tests for API Keys (#4536)
richard-cox Sep 2, 2020
4c09409
Fix compile issue
nwmac Sep 2, 2020
9dcdcce
Fixed versions again, and bugs following subtype split
richard-cox Sep 2, 2020
043c5fd
Merge remote-tracking branch 'origin/master' into helm-hub
richard-cox Sep 2, 2020
509e018
Fix unit tests
richard-cox Sep 2, 2020
e815dc4
Add db migration script to update existing helm endpoints with repo s…
richard-cox Sep 2, 2020
3726821
Bump docusaurus version and add support for versioning (#4506)
richard-cox Sep 3, 2020
9e7e679
Fix front-end unit tests
nwmac Sep 3, 2020
b63e39a
API Keys: Make feature configurable for different user types (#4540)
ikapelyukhin Sep 4, 2020
c767913
Add docs for UAA SSO user permissions management (#4554)
richard-cox Sep 4, 2020
cfbfab8
Add basic developers guide for working with helm (#4511)
richard-cox Sep 4, 2020
0f2e499
Always show upgrade button
nwmac Sep 7, 2020
bb89eb5
Minor entity store type updates
richard-cox Sep 7, 2020
6af9d88
Enable/disable API keys UI given API keys config setting (#4559)
richard-cox Sep 7, 2020
6409469
Convert unRegisterable to registeredLimit
richard-cox Sep 7, 2020
559ecc4
Changes following review
richard-cox Sep 8, 2020
1744b9a
Merge remote-tracking branch 'origin/master' into helm-hub
richard-cox Sep 8, 2020
150da8a
Fix display of helm type in favourite cards
richard-cox Sep 8, 2020
857c54c
Multiple Fixes
richard-cox Sep 8, 2020
b844e8c
Align icons in workload summary page
richard-cox Sep 8, 2020
a987ee7
Enable linting for all packages (#4561)
richard-cox Sep 8, 2020
14125c2
Fix lint failures
richard-cox Sep 8, 2020
f5eb911
Merge remote-tracking branch 'origin/master' into helm-features
nwmac Sep 9, 2020
ed15df6
Address PR feedback
nwmac Sep 9, 2020
ac5625a
Revert
nwmac Sep 9, 2020
7114563
Remove description when checking for similar charts
nwmac Sep 10, 2020
e85f7c2
Only show button when the helm chart is available
nwmac Sep 10, 2020
051338a
Bump angular json schema form (#4564)
nwmac Sep 10, 2020
ef00d18
Docs: Update internal versions & Automate future updates (#4558)
richard-cox Sep 10, 2020
a357a83
Merge remote-tracking branch 'origin/helm-features' into helm-hub
richard-cox Sep 10, 2020
77869e1
Improve types, start work on helm hub upgrade
richard-cox Sep 10, 2020
19c6363
Fixes following merge
richard-cox Sep 10, 2020
d97a270
Merge remote-tracking branch 'origin/master' into helm-hub
richard-cox Sep 10, 2020
520aae9
Remove TODOs
richard-cox Sep 10, 2020
ab83546
Merge remote-tracking branch 'upstream/master' into merge-upstream
richard-cox Sep 10, 2020
b8b019a
Merge fixes, remove fdescribe already in master
richard-cox Sep 10, 2020
058fb38
Fix linting
richard-cox Sep 10, 2020
557778d
Merge remote-tracking branch 'origin/helm-hub' into create-kube-package
richard-cox Sep 10, 2020
2b0772a
Merge remote-tracking branch 'origin/merge-upstream' into create-kube…
richard-cox Sep 10, 2020
853b1be
Create kubernetes package
richard-cox Sep 10, 2020
6ef4327
Fix imports
richard-cox Sep 11, 2020
f9f78cf
Fix unit tests
richard-cox Sep 11, 2020
fdf6538
Merge remote-tracking branch 'origin/master' into create-kube-package
richard-cox Sep 17, 2020
bfccf06
Fixes following review
richard-cox Sep 17, 2020
6ef9d74
Merge remote-tracking branch 'origin/master' into create-kube-package
richard-cox Sep 21, 2020
8b0bf54
Fix unit tests
richard-cox Sep 21, 2020
3540db9
Merge remote-tracking branch 'origin/master' into create-kube-package
richard-cox Sep 25, 2020
2228579
Merge remote-tracking branch 'origin/master' into create-kube-package
nwmac Oct 2, 2020
d68fc84
Fix theming for suse login
nwmac Oct 2, 2020
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
Prev Previous commit
Next Next commit
Show per endpoint type actions in endpoints table
- use for helm sync
  • Loading branch information
richard-cox committed Sep 1, 2020
commit fd2ee0fdd7fa2abfd59b85bb1ec9bb66e4f7a43f
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mat-card class="meta-card {{status$ && statusBackground? (status$ | async): '' }}" [ngClass]="{'meta-card-pointer': clickAction}"
(click)="clickAction ? clickAction() : null">
<mat-card class="meta-card {{status$ && statusBackground? (status$ | async): '' }}"
[ngClass]="{'meta-card-pointer': clickAction}" (click)="clickAction ? clickAction() : null">
<div *ngIf="isDeleting$ | async" class="meta-card__deleting-overlay">
<div class="meta-card__deleting-overlay-inner">
<div class="meta-card__deleting-text">Deleting</div>
Expand All @@ -9,7 +9,8 @@
<app-card-status *ngIf="status$" [status$]="status$">
</app-card-status>
<mat-card-header class="meta-card__header" *ngIf="title">
<div [ngClass]="statusIconByTitle ? 'meta-card__header-container__title--with-icon' : 'meta-card__header-container__title'">
<div
[ngClass]="statusIconByTitle ? 'meta-card__header-container__title--with-icon' : 'meta-card__header-container__title'">
<div
[ngClass]="statusIconByTitle ? 'meta-card__header-container__title__content--with-icon' : 'meta-card__header-container__title__content'">
<ng-container *ngTemplateOutlet="title.content"></ng-container>
Expand All @@ -18,20 +19,24 @@
<ng-container *ngTemplateOutlet="statusIconTmple"></ng-container>
</div>
</div>
<app-entity-favorite-star [confirmRemoval]="confirmFavoriteRemoval" class="meta-card__favorite" *ngIf="favorite" [favorite]="favorite">
<app-entity-favorite-star [confirmRemoval]="confirmFavoriteRemoval" class="meta-card__favorite" *ngIf="favorite"
[favorite]="favorite">
</app-entity-favorite-star>
<div class="meta-card__header-container__actions" *ngIf="actionMenu && (showMenu$ | async)" appClickStopPropagation>
<button mat-icon-button class="meta-card__header__button" color="basic" [matMenuTriggerFor]="menu" [disabled]="isDeleting$ | async">
<button mat-icon-button class="meta-card__header__button" color="basic" [matMenuTriggerFor]="menu"
[disabled]="isDeleting$ | async">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu class="meta-card__header__popup" #menu="matMenu" xPosition="before" >
<mat-menu class="meta-card__header__popup" #menu="matMenu" xPosition="before">
<ng-container *ngFor="let menuItem of actionMenu">
<button class="meta-card__header__popup__btn" [disabled]="menuItem.disabled | async" mat-menu-item *ngIf="menuItem.can | async"
(click)="menuItem.action()">
<mat-icon *ngIf="menuItem.icon">{{menuItem.icon}}</mat-icon>
<span>{{menuItem.label}}</span>
</button>
<div *ngIf="menuItem.separator" class="meta-card__header__popup-separator"></div>
<ng-container *ngIf="menuItem.can | async">
<button *ngIf="!menuItem.separator" class="meta-card__header__popup__btn"
[disabled]="menuItem.disabled | async" mat-menu-item (click)="menuItem.action()">
<mat-icon *ngIf="menuItem.icon">{{menuItem.icon}}</mat-icon>
<span>{{menuItem.label}}</span>
</button>
<div *ngIf="menuItem.separator" class="meta-card__header__popup-separator"></div>
</ng-container>
</ng-container>
</mat-menu>
</div>
Expand All @@ -48,6 +53,7 @@
</mat-card-content>
</mat-card>
<ng-template #statusIconTmple>
<app-application-state-icon *ngIf="statusIcon && status$" [status]="status$ | async" matTooltip="{{statusIconTooltip}}">
<app-application-state-icon *ngIf="statusIcon && status$" [status]="status$ | async"
matTooltip="{{statusIconTooltip}}">
</app-application-state-icon>
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ContentChild, ContentChildren, Input, OnDestroy, QueryList } from '@angular/core';
import { combineLatest, Observable, of as observableOf, Subscription } from 'rxjs';
import { combineLatest, Observable, of as observableOf, of, Subscription } from 'rxjs';
import { first, map, tap } from 'rxjs/operators';

import { FavoritesConfigMapper } from '../../../../../../../../store/src/favorite-config-mapper';
Expand All @@ -13,7 +13,7 @@ import { MetaCardItemComponent } from '../meta-card-item/meta-card-item.componen
import { MetaCardTitleComponent } from '../meta-card-title/meta-card-title.component';


export function createMetaCardMenuItemSeparator() {
export function createMetaCardMenuItemSeparator(): MenuItem {
return {
label: '-',
separator: true,
Expand Down Expand Up @@ -86,15 +86,18 @@ export class MetaCardComponent implements OnDestroy {
this.pActionMenu = actionMenu.map(menuItem => {
if (!menuItem.can) {
menuItem.separator = menuItem.label === '-';
menuItem.can = observableOf(!menuItem.separator);
menuItem.can = of(true);
}
if (!menuItem.disabled) {
menuItem.disabled = observableOf(false);
}
return menuItem;
});

this.showMenu$ = combineLatest(actionMenu.map(menuItem => menuItem.can)).pipe(
const nonSeparators = actionMenu
.filter(menuItem => !menuItem.separator)
.map(menuItem => menuItem.can);
this.showMenu$ = combineLatest(nonSeparators).pipe(
map(cans => cans.some(can => can))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,22 @@ export class EndpointCardComponent extends CardCell<EndpointModel> implements On
@Input('dataSource')
set dataSource(ds: BaseEndpointsDataSource) {
this.pDs = ds;

// TODO: RC need row with endpoint type to create custom actions. can do here, what about list??

// Don't show card menu if the ds only provides a single endpoint type (for instance the cf endpoint page)
if (ds && !ds.dsEndpointType && !this.cardMenu) {
this.cardMenu = this.endpointListHelper.endpointActions().map(endpointAction => ({
label: endpointAction.label,
action: () => endpointAction.action(this.pRow),
can: endpointAction.createVisible(this.rowObs)
}));
const endpointActions = this.endpointListHelper.endpointActions(true);

this.cardMenu = endpointActions.map(endpointAction => {
const separator = endpointAction.label === '-';
return {
label: endpointAction.label,
action: () => endpointAction.action(this.pRow),
can: endpointAction.createVisible ? endpointAction.createVisible(this.rowObs) : null,
separator
};
});

// Add a copy address to clipboard
this.cardMenu.push(createMetaCardMenuItemSeparator());
Expand All @@ -110,6 +119,7 @@ export class EndpointCardComponent extends CardCell<EndpointModel> implements On
});
}


this.updateCardStatus();
}
get dataSource() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentFactoryResolver, ComponentRef, Injectable, ViewContainerRef } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { combineLatest, Observable } from 'rxjs';
import { map, pairwise } from 'rxjs/operators';
import { combineLatest, Observable, of } from 'rxjs';
import { map, pairwise, tap } from 'rxjs/operators';

import { RouterNav } from '../../../../../../../store/src/actions/router.actions';
import { AppState } from '../../../../../../../store/src/app-state';
Expand All @@ -19,6 +19,7 @@ import {
import { SnackBarService } from '../../../../services/snackbar.service';
import { ConfirmationDialogConfig } from '../../../confirmation-dialog.config';
import { ConfirmationDialogService } from '../../../confirmation-dialog.service';
import { createMetaCardMenuItemSeparator } from '../../list-cards/meta-card/meta-card-base/meta-card.component';
import { IListAction } from '../../list.component.types';
import { TableCellCustom } from '../../list.types';

Expand All @@ -37,6 +38,27 @@ function isEndpointListDetailsComponent(obj: any): EndpointListDetailsComponent
return obj ? obj.isEndpointListDetailsComponent ? obj as EndpointListDetailsComponent : null : null;
}

function createCustomActionSeparatorVisibility(
customActions: IListAction<EndpointModel>[]
): (row$: Observable<EndpointModel>) => Observable<boolean> {
const createVisiblesFns = customActions
.map(action => action.createVisible)
.filter(createVisible => !!createVisible);
if (createVisiblesFns.length === 0) {
return () => of(false);
} else {
return (row$: Observable<EndpointModel>) => {
const createVisibles = createVisiblesFns.map(createVisible => createVisible(row$));
return combineLatest(createVisibles).pipe(
map(allRes => allRes.some(res => res)),
tap(console.log)
);
};
}
}

// TODO: RC add check to see if helm hub is already registered... warn against it

@Injectable()
export class EndpointListHelper {
constructor(
Expand All @@ -48,7 +70,23 @@ export class EndpointListHelper {
private snackBarService: SnackBarService,
) { }

endpointActions(): IListAction<EndpointModel>[] {
endpointActions(includeSeparators = false): IListAction<EndpointModel>[] {
// Add any additional actions that are per endpoint type (not sub type)
const customActions = entityCatalog.getAllBaseEndpointTypes()
.map(endpoint => endpoint.definition.endpointListActions)
.filter(endpointListActions => !!endpointListActions)
.map(endpointListActions => endpointListActions(this.store))
.reduce((res, actions) => res.concat(actions), []);

if (includeSeparators && customActions.length) {
// Only show the separator if we have custom actions to separate up AND at least one is visible
const createVisibleFn = createCustomActionSeparatorVisibility(customActions);
customActions.splice(0, 0, {
...createMetaCardMenuItemSeparator(),
createVisible: createVisibleFn
});
}

return [
{
action: (item) => {
Expand Down Expand Up @@ -126,7 +164,8 @@ export class EndpointListHelper {
label: 'Edit endpoint',
description: 'Edit the endpoint',
createVisible: () => this.currentUserPermissionsService.can(StratosCurrentUserPermissions.ENDPOINT_REGISTER)
}
},
...customActions
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class EntityCatalog {
return Array.from(this.endpoints.values());
}

public getAllEndpointTypes(techPreviewEnabled = false) {
public getAllEndpointTypes(techPreviewEnabled = false): StratosCatalogEndpointEntity[] {
const baseEndpoints = Array.from(this.endpoints.values())
.filter(item => !item.definition.techPreview || item.definition.techPreview && techPreviewEnabled);
return baseEndpoints.reduce((allEndpoints, baseEndpoint) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';

import { GeneralEntityAppState } from '../app-state';
import { IListAction } from '../../../core/src/shared/components/list/list.component.types';
import { AppState, GeneralEntityAppState } from '../app-state';
import {
ApiErrorMessageHandler,
EntitiesFetchHandler,
Expand Down Expand Up @@ -125,7 +126,7 @@ export interface IStratosEndpointDefinition<T = EntityCatalogSchemas | EntitySch
readonly techPreview?: boolean;
readonly urlValidationRegexString?: string;
readonly authTypes: EndpointAuthTypeConfig[];
readonly subTypes?: Omit<IStratosEndpointDefinition, 'schema' | 'subTypes'>[];
readonly subTypes?: Omit<IStratosEndpointDefinition, 'schema' | 'subTypes' | 'endpointListActions'>[];

/**
* Allows an entity to manipulate the data that is returned from an api request before it makes it into the store.
Expand All @@ -146,11 +147,12 @@ export interface IStratosEndpointDefinition<T = EntityCatalogSchemas | EntitySch
/**
* Allows the endpoint to fetch user roles, for example when the user loads Stratos or connects an endpoint of this type
*/
readonly userRolesFetch?: EntityUserRolesFetch
readonly userRolesFetch?: EntityUserRolesFetch;
/**
* Allows the user roles to be stored, updated and removed in the current user permissions section of the store
*/
readonly userRolesReducer?: EntityUserRolesReducer
readonly userRolesReducer?: EntityUserRolesReducer;
readonly endpointListActions?: (store: Store<AppState>) => IListAction<EndpointModel>[]
}

export interface StratosEndpointExtensionDefinition extends Omit<IStratosEndpointDefinition, 'schema'> { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { Store } from '@ngrx/store';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';

import { IListAction } from '../../../../core/src/shared/components/list/list.component.types';
import { AppState } from '../../../../store/src/app-state';
import {
StratosBaseCatalogEntity,
StratosCatalogEndpointEntity,
StratosCatalogEntity,
} from '../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity';
import { StratosEndpointExtensionDefinition } from '../../../../store/src/entity-catalog/entity-catalog.types';
import { EndpointModel } from '../../../../store/src/types/endpoint.types';
import { IFavoriteMetadata } from '../../../../store/src/types/user-favorites.types';
import { helmEntityCatalog } from './helm-entity-catalog';
import {
Expand Down Expand Up @@ -39,6 +46,17 @@ export function generateHelmEntities(): StratosBaseCatalogEntity[] {
unConnectable: true,
techPreview: false,
authTypes: [],
endpointListActions: (store: Store<AppState>): IListAction<EndpointModel>[] => {
return [{
action: (item: EndpointModel) => helmEntityCatalog.chart.api.synchronise(item),
label: 'Synchronize',
description: '',
createVisible: row => row.pipe(
map(item => item.cnsi_type === HELM_ENDPOINT_TYPE && !item.sub_type)
),
createEnabled: row => of(true)
}]
},
subTypes: [
{
type: HELM_HUB_ENDPOINT_TYPE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { OrchestratedActionBuilders } from '../../../../../store/src/entity-catalog/action-orchestrator/action-orchestrator';
import { GetHelmVersions, GetMonocularCharts, HelmInstall } from './helm.actions';
import { EndpointModel } from '../../../../../store/src/types/endpoint.types';
import { GetHelmVersions, GetMonocularCharts, HelmInstall, HelmSynchronise } from './helm.actions';
import { HelmInstallValues } from './helm.types';

export interface HelmChartActionBuilders extends OrchestratedActionBuilders {
getMultiple: () => GetMonocularCharts,
// Helm install added to chart action builder and not helm release/workload to ensure action & effect are available in this module
// (others may not have loaded)
install: (values: HelmInstallValues) => HelmInstall
install: (values: HelmInstallValues) => HelmInstall,
synchronise: (endpoint: EndpointModel) => HelmSynchronise
}

export const helmChartActionBuilders: HelmChartActionBuilders = {
getMultiple: () => new GetMonocularCharts(),
install: (values: HelmInstallValues) => new HelmInstall(values)
install: (values: HelmInstallValues) => new HelmInstall(values),
synchronise: (endpoint: EndpointModel) => new HelmSynchronise(endpoint)
}

export interface HelmVersionActionBuilders extends OrchestratedActionBuilders {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { Action } from '@ngrx/store';

import { EndpointModel } from '../../../../../store/src/types/endpoint.types';
import { PaginatedAction } from '../../../../../store/src/types/pagination.types';
import { EntityRequestAction } from '../../../../../store/src/types/request.types';
import {
Expand All @@ -20,6 +23,8 @@ export const HELM_INSTALL = '[Helm] Install';
export const HELM_INSTALL_SUCCESS = '[Helm] Install Success';
export const HELM_INSTALL_FAILURE = '[Helm] Install Failure';

export const HELM_SYNCHRONISE = '[Helm] Synchronise';

export interface MonocularPaginationAction extends PaginatedAction, EntityRequestAction { }

export class GetMonocularCharts implements MonocularPaginationAction {
Expand All @@ -43,6 +48,11 @@ export class GetMonocularCharts implements MonocularPaginationAction {
flattenPagination = true;
}

export class HelmSynchronise implements Action {
type = HELM_SYNCHRONISE;
constructor(public endpoint: EndpointModel) { }
}

export class HelmInstall implements EntityRequestAction {
type = HELM_INSTALL;
endpointType = HELM_ENDPOINT_TYPE;
Expand Down
Loading