Skip to content

Commit

Permalink
Merge pull request #101 from polypheny/fix-adapter-deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
vogti authored Dec 16, 2024
2 parents 5ae9f0c + 567203a commit 4e23f7c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/app/services/crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
PartitionFunctionModel,
PartitioningRequest,
PathAccessRequest,
PlacementFieldsModel
PlacementFieldsModel,
RelationalResult
} from '../components/data-view/models/result-set.model';
import {webSocket} from 'rxjs/webSocket';
import {
Expand Down Expand Up @@ -524,8 +525,8 @@ export class CrudService {
return this._http.post(`${this.httpUrl}/getAvailableStoresForIndexes`, request, this.httpOptions);
}

updateAdapterSettings(adapter: AdapterModel) {
return this._http.post(`${this.httpUrl}/updateAdapterSettings`, adapter);
updateAdapterSettings(adapter: AdapterModel): Observable<RelationalResult> {
return this._http.post<RelationalResult>(`${this.httpUrl}/updateAdapterSettings`, adapter);
}

getSources() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/views/adapters/adapters.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ <h2>Adapters</h2>

<span *ngIf="adapter.dataReadOnly"><span class="fa fa-eye"></span> read-only</span>
<span *ngIf="adapter.persistent"><span class="fa fa-floppy-o" style="padding-left: 1px"></span> persistent</span>
<span *ngIf="adapter.settings.hasOwnProperty('host') && adapter.settings.hasOwnProperty('port')">{{ adapter.settings['host'].value }}
<span *ngIf="adapter.settings['mode'] === 'remote'">: {{ adapter.settings['port'] }}</span>
<span *ngIf="adapter.settings.hasOwnProperty('host') && adapter.settings.hasOwnProperty('port')">{{ adapter.settings['host'] }}
<span *ngIf="adapter.mode === DeployMode.REMOTE">: {{ adapter.settings['port'] }}</span>
</span>
</c-card-body>
<c-card-footer class="bg-transparent">
Expand Down
12 changes: 3 additions & 9 deletions src/app/views/adapters/adapters.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export class AdaptersComponent implements OnInit, OnDestroy {

constructor(private injector: Injector) {
this.availableAdapters = computed(() => {
console.log(this.currentRoute());
const route = this.currentRoute();
return this._catalog.getAdapterTemplates().filter(a => a.adapterType === this.getMatchingAdapterType());
});

Expand All @@ -74,7 +72,7 @@ export class AdaptersComponent implements OnInit, OnDestroy {

readonly adapter: WritableSignal<Adapter> = signal(null);
editingAdapterForm: FormGroup;
deletingAdapter;
deletingAdapter: AdapterModel;
deletingInProgress: AdapterModel[];

editingAvailableAdapterForm: UntypedFormGroup;
Expand Down Expand Up @@ -132,7 +130,6 @@ export class AdaptersComponent implements OnInit, OnDestroy {
}

subscribeActiveChange() {

effect(() => {
const mode = this.activeMode();
const adapter = this.adapter();
Expand All @@ -141,10 +138,9 @@ export class AdaptersComponent implements OnInit, OnDestroy {
}
const fc = {};


for (const setting of adapter.settings.values()) {
const validators = [];
if (setting.template.required) {
if (setting.template.required && setting.template.appliesTo.includes(mode)) {
validators.push(Validators.required);
}
let val = setting.template.defaultValue;
Expand All @@ -163,7 +159,6 @@ export class AdaptersComponent implements OnInit, OnDestroy {
if (adapter.task === Task.DEPLOY) {
fc['uniqueName'] = new UntypedFormControl(this.getDefaultUniqueName(), [Validators.required, Validators.pattern(this._crud.getAdapterNameValidationRegex()), validateUniqueName([...this.stores(), ...this.sources()])]);
this.editingAvailableAdapterForm = new UntypedFormGroup(fc);
this.editingAvailableAdapterForm.controls['mode'].setValue(this.activeMode().toLowerCase());
} else {
fc['uniqueName'] = new UntypedFormControl(adapter.uniqueName, [Validators.required, Validators.pattern(this._crud.getAdapterNameValidationRegex()), validateUniqueName([...this.stores(), ...this.sources()].filter(a => a.name !== adapter.uniqueName))]);
this.editingAdapterForm = new UntypedFormGroup(fc);
Expand Down Expand Up @@ -220,8 +215,7 @@ export class AdaptersComponent implements OnInit, OnDestroy {
adapter.settings[k] = v.value;
}
this._crud.updateAdapterSettings(adapter).subscribe({
next: res => {
const result = <RelationalResult>res;
next: result => {
if (result.error) {
this._toast.exception(result);
} else {
Expand Down

0 comments on commit 4e23f7c

Please sign in to comment.