Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/app/adf-config/df-cache/df-cache-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Actions } from 'src/app/shared/types/table';
export class DfCacheTableComponent extends DfManageTableComponent<CacheRow> {
constructor(
@Inject(CACHE_SERVICE_TOKEN)
private cacheService: DfBaseCrudService,
cacheService: DfBaseCrudService,
router: Router,
activatedRoute: ActivatedRoute,
liveAnnouncer: LiveAnnouncer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,17 @@ export class DfManageTablesTableComponent extends DfManageTableComponent<Databas
};
});
}
refreshTable(limit?: number, offset?: number, filter?: string): void {
refreshTable(
limit?: number,
offset?: number,
filter?: string,
refresh?: boolean
): void {
const dbName = this._activatedRoute.snapshot.paramMap.get('name');

this.service
.get(`${dbName}/_schema`, {
fields: ['name', 'label'].join(','),
refresh: refresh,
limit,
offset,
filter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export class DfManageServicesTableComponent extends DfManageTableComponent<Servi
refreshTable(
limit?: number | undefined,
offset?: number | undefined,
filter?: string | undefined
filter?: string | undefined,
refresh?: true
): void {
if (this.serviceTypes && this.serviceTypes.length !== 0) {
filter = `${filter ? `${filter} and ` : ''}(type in ("${this.serviceTypes
Expand All @@ -120,12 +121,12 @@ export class DfManageServicesTableComponent extends DfManageTableComponent<Servi
filter = `${filter ? `${filter} and ` : ''}(created_by_id is${
!this.system ? ' not ' : ' '
}null)`;

this.serviceService
.getAll<GenericListResponse<Service>>({
limit,
offset,
filter,
refresh,
})
.subscribe(data => {
this.dataSource.data = this.mapDataToTable(data.resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
type="button">
<fa-icon [icon]="faPlus" size="xl"></fa-icon>
</button>
<button
*ngIf="schema"
mat-mini-fab
color="alternate"
[attr.aria-label]="'importList' | transloco"
(click)="refreshSchema()"
type="button">
<fa-icon [icon]="faRefresh" size="xl"></fa-icon>
</button>
<ng-content select="[topActions]"></ng-content>
<div class="spacer"></div>
<mat-form-field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
faTriangleExclamation,
faCheckCircle,
faXmarkCircle,
faRefresh,
} from '@fortawesome/free-solid-svg-icons';
import { TranslocoPipe, TranslocoService } from '@ngneat/transloco';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
Expand Down Expand Up @@ -69,9 +70,11 @@ export abstract class DfManageTableComponent<T>
faPlus = faPlus;
faEllipsisV = faEllipsisV;
faTriangleExclamation = faTriangleExclamation;
faRefresh = faRefresh;
allowCreate = true;
allowFilter = true;
currentFilter = new FormControl('');
schema = false;

abstract columns: Array<Column<T>>;

Expand Down Expand Up @@ -100,6 +103,7 @@ export abstract class DfManageTableComponent<T>
},
],
};
cacheService: any;

constructor(
protected router: Router,
Expand All @@ -112,6 +116,7 @@ export abstract class DfManageTableComponent<T>
ngOnInit(): void {
if (!this.tableData) {
this.activatedRoute.data.subscribe(({ data }) => {
this.schema = this.router.url.includes('schema');
if (data && data.resource) {
this.dataSource.data = this.mapDataToTable(data.resource);
}
Expand Down Expand Up @@ -175,7 +180,12 @@ export abstract class DfManageTableComponent<T>

abstract mapDataToTable(data: Array<any>): Array<T>;

abstract refreshTable(limit?: number, offset?: number, filter?: string): void;
abstract refreshTable(
limit?: number,
offset?: number,
filter?: string,
refresh?: true
): void;

abstract filterQuery(value: string): string;

Expand Down Expand Up @@ -243,4 +253,8 @@ export abstract class DfManageTableComponent<T>
!this.actions.default.disabled)
);
}

refreshSchema() {
this.refreshTable(undefined, undefined, undefined, true);
}
}
10 changes: 10 additions & 0 deletions src/app/shared/components/df-side-nav/df-side-nav.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ <h1 class="page-header">
<a [routerLink]="breadcrumb.path" class="breadcrumb-link"
><ng-component
*ngTemplateOutlet="breadcrumbLabel"></ng-component>
</ng-template>
<ng-template #breadcrumbLabel>
<ng-container *ngIf="breadcrumb.translationKey; else label">
<span>{{ breadcrumb.translationKey | transloco }}</span>
</ng-container>
<ng-template #label>
<span>{{ breadcrumb.label }}</span>
</ng-template>
</ng-template>
<span *ngIf="i !== breadCrumbs.length - 1"> / </span>
</a>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
faLanguage,
faMagnifyingGlass,
faUser,
faRefresh,
} from '@fortawesome/free-solid-svg-icons';
import { routes } from 'src/app/routes';
import {
Expand All @@ -35,6 +36,8 @@ import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { DfSearchDialogComponent } from '../df-search-dialog/df-search-dialog.component';
import { UntilDestroy } from '@ngneat/until-destroy';
import { CommonModule } from '@angular/common';
import { DfSearchService } from '../../services/df-search.service';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { DfThemeToggleComponent } from '../df-theme-toggle/df-theme-toggle.component';

@UntilDestroy({ checkProperties: true })
Expand Down Expand Up @@ -74,6 +77,12 @@ export class DfSideNavComponent implements OnInit {
faMagnifyingGlass = faMagnifyingGlass;
faUser = faUser;
faLanguage = faLanguage;
search = new FormControl();
results$ = this.searchService.results$;
recents$ = this.searchService.recents$;
smallScreen$ = this.breakpointService.isSmallScreen;
faPlus = faPlus;
faRefresh = faRefresh;

constructor(
private breakpointService: DfBreakpointService,
Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/services/df-base-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ export class DfBaseCrudService {
if (options.includeCount !== undefined) {
params.include_count = options.includeCount;
}
if (options.refresh) {
params.refresh = options.refresh;
}

if (options.additionalParams) {
options.additionalParams.forEach(param => {
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/types/generic-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface RequestOptions {
additionalParams: KeyValuePair[];
additionalHeaders: KeyValuePair[];
includeCacheControl: boolean;
refresh: boolean;
}

export type GenericCreateResponse = GenericListResponse<{ id: number }>;
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/types/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface Service {
lastModifiedById: number | null;
config: any;
serviceDocByServiceId: number | null;
refresh: boolean;
}

export interface ServiceRow {
Expand Down