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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ <h2>DreamFactory {{ 'systemInfo.instance.instance' | transloco }}</h2>
{{ 'version' | transloco }}:
{{ environment.platform?.version }}
</li>
<li>UI {{ 'version' | transloco }}: 1.3.6</li>
<li *ngIf="environment.platform?.dbDriver">
{{ 'systemInfo.instance.systemDatabase' | transloco }}:
{{ environment.platform?.dbDriver }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
>
<df-link-service
[cache]="scriptForm.getRawValue().name"
[storageServiceId]="getControl('storageServiceId')"
[storageServiceId]="selectedServiceItem"
[storagePath]="getControl('storagePath')"
[content]="getControl('content')"></df-link-service>
<df-script-editor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { DfThemeService } from 'src/app/shared/services/df-theme.service';
import { DfLinkServiceComponent } from 'src/app/shared/components/df-link-service/df-link-service.component';
import { camelToSnakeString } from 'src/app/shared/utilities/case';


@UntilDestroy({ checkProperties: true })
@Component({
selector: 'df-script-details',
Expand Down
21 changes: 16 additions & 5 deletions src/app/adf-roles/df-roles-access/df-roles-access.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,23 @@
<mat-label>{{
'roles.accessOverview.tableHeadings.component' | transloco
}}</mat-label>
<mat-select formControlName="component" panelWdith="null">
<mat-select
(openedChange)="onSelectOpened(i)"
panelClass="select-search-panel">
<mat-option>
<mat-form-field>
<input
matInput
(click)="$event.stopPropagation()"
(input)="filterOptions($event, i)"
placeholder="Search" />
</mat-form-field>
</mat-option>
<mat-option
*ngFor="let option of getComponentArray(i)"
[value]="option"
>{{ option }}</mat-option
>
*ngFor="let option of filteredComponentArray[i]"
[value]="option">
{{ option }}
</mat-option>
</mat-select>
</mat-form-field>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ tr.element-row:not(.example-expanded-row):active {
.detail-input {
margin-right: 20px;
}
::ng-deep {
.cdk-overlay-pane {
width: max-content !important;
}
}
60 changes: 48 additions & 12 deletions src/app/adf-roles/df-roles-access/df-roles-access.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FormGroup,
ReactiveFormsModule,
Validators,
FormBuilder,
} from '@angular/forms';
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
import { faPlus, faTrashCan } from '@fortawesome/free-solid-svg-icons';
Expand All @@ -19,6 +20,7 @@ import { MatInputModule } from '@angular/material/input';
import { MatExpansionModule } from '@angular/material/expansion';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { MatButtonModule } from '@angular/material/button';

import { UntilDestroy } from '@ngneat/until-destroy';
import { BehaviorSubject } from 'rxjs';
import { AsyncPipe } from '@angular/common';
Expand Down Expand Up @@ -112,13 +114,24 @@ export class DfRolesAccessComponent implements OnInit {
{ value: 'is null', label: 'is null' },
{ value: 'is not null', label: 'is not null' },
];

form: FormGroup;
constructor(
private activatedRoute: ActivatedRoute,
@Inject(BASE_SERVICE_TOKEN)
private baseService: DfBaseCrudService
) {}

private baseService: DfBaseCrudService,
private fb: FormBuilder
) {
this.form = this.fb.group({
cFormArray: this.fb.array([this.createItem()]),
});
}
createItem(): FormGroup {
return this.fb.group({
service: [''],
component: [''],
});
}
filteredComponentArray: Array<Array<string>> = [];
ngOnInit() {
// get services options
this.activatedRoute.data.subscribe((data: any) => {
Expand Down Expand Up @@ -165,10 +178,41 @@ export class DfRolesAccessComponent implements OnInit {
});
}
});
this.initializeFilteredComponents();

this.updateDataSource();
}
get cFormArray(): FormArray {
return this.form.get('formArray') as FormArray;
}

initializeFilteredComponents() {
this.filteredComponentArray = this.formArray.controls.map((_, i) =>
this.getComponentArray(i)
);
}
getComponentArray(index: number): Array<string> {
const serviceId = this.formArray.at(index).get('service')?.value;
const components = this.componentOptions.find(
option => option.serviceId === serviceId
)?.components;
return components || [];
}

filterOptions(event: Event, index: number) {
const input = (event.target as HTMLInputElement).value.toLowerCase();
const serviceId = this.formArray.at(index).get('service')?.value;
const components =
this.componentOptions.find(option => option.serviceId === serviceId)
?.components || [];
this.filteredComponentArray[index] = components.filter(option =>
option.toLowerCase().includes(input)
);
}

onSelectOpened(index: number) {
this.filteredComponentArray[index] = this.getComponentArray(index);
}
async getComponents(index: number) {
const serviceId = this.formArray.controls[index].get('service')?.value;
const service =
Expand Down Expand Up @@ -198,14 +242,6 @@ export class DfRolesAccessComponent implements OnInit {
}
}

getComponentArray(index: number) {
const serviceId = this.formArray.at(index).get('service')?.value;
const components = this.componentOptions.find(
option => option.serviceId === serviceId
)?.components;
return components || [];
}

getExtendOperator(index: number) {
const serviceId = this.serviceAccess.at(index).get('extend-operator')
?.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[formGroup]="serviceForm"
class="details-section"
[class]="(isDarkMode | async) ? 'dark-theme' : ''"
(ngSubmit)="save(false)">
<ng-container *ngIf="this.isDatabase && !this.edit; else notDatabase">
(ngSubmit)="save()">
<ng-container *ngIf="this.isDatabase && !this.edit; else notDatabaseEdit">
<mat-stepper linear #stepper>
<mat-step errorMessage="Service Type is required." [editable]="true">
<ng-template matStepLabel>
Expand Down Expand Up @@ -280,25 +280,47 @@ <h4 class="text-center" style="color: black !important">
</ng-template>
</mat-stepper>
</ng-container>
<ng-template #notDatabase>
<mat-form-field
subscriptSizing="dynamic"
class="dynamic-width"
appearance="outline">
<mat-label>{{
'services.controls.serviceType.label' | transloco
}}</mat-label>
<mat-select formControlName="type">
<mat-option *ngFor="let type of serviceTypes" [value]="type.name">
{{ type.label }}
</mat-option>
</mat-select>
<fa-icon
class="tool-tip-trigger"
matSuffix
[icon]="faCircleInfo"
[matTooltip]="'services.controls.serviceType.tooltip' | transloco" />
</mat-form-field>
<ng-template #notDatabaseEdit>
<ng-container *ngIf="this.isNetworkService; else notNetwork">
<mat-form-field
subscriptSizing="dynamic"
class="dynamic-width"
appearance="outline">
<mat-label>{{
'services.controls.serviceType.label' | transloco
}}</mat-label>
<mat-select formControlName="type">
<mat-option *ngFor="let type of serviceTypes" [value]="type.label">
{{ type.label }}
</mat-option>
</mat-select>
<fa-icon
class="tool-tip-trigger"
matSuffix
[icon]="faCircleInfo"
[matTooltip]="'services.controls.serviceType.tooltip' | transloco" />
</mat-form-field>
</ng-container>
<ng-template #notNetwork>
<mat-form-field
subscriptSizing="dynamic"
class="dynamic-width"
appearance="outline">
<mat-label>{{
'services.controls.serviceType.label' | transloco
}}</mat-label>
<mat-select formControlName="type">
<mat-option *ngFor="let type of serviceTypes" [value]="type.name">
{{ type.label }}
</mat-option>
</mat-select>
<fa-icon
class="tool-tip-trigger"
matSuffix
[icon]="faCircleInfo"
[matTooltip]="'services.controls.serviceType.tooltip' | transloco" />
</mat-form-field>
</ng-template>
<mat-form-field
subscriptSizing="dynamic"
class="dynamic-width"
Expand Down Expand Up @@ -348,6 +370,28 @@ <h4 class="text-center" style="color: black !important">
*ngIf="!subscriptionRequired"
><span>{{ 'active' | transloco }}</span></mat-slide-toggle
>
<div class="full-width">
<ng-container *ngIf="this.edit">
<ng-container *ngIf="this.isDatabase; else notDatabase">
<button
type="button"
mat-flat-button
class="save-btn"
(click)="gotoSchema()">
{{ 'schema' | transloco }}
</button>
</ng-container>
<ng-template #notDatabase>
<button
type="button"
mat-flat-button
class="save-btn"
(click)="gotoAPIDocs()">
{{ 'apiDocs' | transloco }}
</button>
</ng-template>
</ng-container>
</div>
<ng-container *ngIf="viewSchema && !subscriptionRequired">
<ng-container formGroupName="config">
<mat-accordion class="full-width">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ export class DfServiceDetailsComponent implements OnInit {
params
)
.subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.activatedRoute });
this.router.navigate([`/api-connections/api-docs/${data.name}`]);
// this.router.navigate(['../'], { relativeTo: this.activatedRoute });
});
}
}
Expand All @@ -472,6 +473,16 @@ export class DfServiceDetailsComponent implements OnInit {
this.router.navigate(['../'], { relativeTo: this.activatedRoute });
}

gotoSchema() {
const data = this.serviceForm.getRawValue();
this.router.navigate([`/admin-settings/schema/${data.name}`]);
}

gotoAPIDocs() {
const data = this.serviceForm.getRawValue();
this.router.navigate([`/api-connections/api-docs/${data.name}`]);
}

getBackgroundImage(typeLabel: string) {
const image = this.images?.find(img => img.label == typeLabel);
if (!image) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
<ng-container *ngIf="selectType">
<form
[formGroup]="roleForm"
class="details-section"
[class]="(isDarkMode | async) ? 'dark-theme' : ''">
<mat-accordion>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title> Link to Service </mat-panel-title>
<mat-panel-description> </mat-panel-description>
</mat-expansion-panel-header>
<mat-form-field
appearance="outline"
class="full-width form-field-gap"
subscriptSizing="dynamic">
<mat-label>Select Service</mat-label>
<mat-select formControlName="serviceList">
<mat-option
*ngFor="let service of storageServices"
[value]="service.label">
{{ service.label }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field
appearance="outline"
subscriptSizing="dynamic"
class="full-width form-field-gap">
<mat-label>Repository: </mat-label>
<input
matInput
type="text"
placeholder="path"
formControlName="repoInput" />
</mat-form-field>
<mat-form-field
appearance="outline"
subscriptSizing="dynamic"
class="full-width form-field-gap">
<mat-label>Branch/Tag: </mat-label>
<input
matInput
type="text"
placeholder="path"
formControlName="branchInput" />
</mat-form-field>
<mat-form-field
appearance="outline"
subscriptSizing="dynamic"
class="full-width form-field-gap">
<mat-label>Path</mat-label>
<input
matInput
type="text"
placeholder="path"
formControlName="pathInput" />
</mat-form-field>
<div class="full-width action-bar">
<button
class="save-btn"
mat-flat-button
type="button"
(click)="onViewLatest()"
color="primary">
<i class="fa fa-refresh"></i>
View Latest
</button>
<button
class="save-btn"
mat-flat-button
type="button"
(click)="onDeleteCache()"
color="primary">
<i class="fa fa-refresh"></i>
Delete Cache
</button>
</div>
</mat-expansion-panel>
</mat-accordion>
</form>
</ng-container>
=======
<form
[formGroup]="roleForm"
class="details-section"
Expand Down
Loading