Skip to content

Commit

Permalink
removed commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
Davo00 committed Oct 9, 2023
1 parent 6e388b5 commit 7f62e0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@
</mat-select>
</mat-form-field>

<!--
<button mat-button [disabled]="form.invalid" (click)="save()" color="primary" class="inline-btn">
<mat-icon>save</mat-icon>
</button>
<button mat-button [disabled]="selectedPlugin.value === 'create new (unsaved)'" (click)="delete()" color="primary"
class="inline-btn">
<mat-icon>delete</mat-icon>
</button>
<button mat-button [disabled]="(selectedPlugin.value !== 'create new (unsaved)') || (disableEditor$ | async)"
(click)="createNewFromTemplate()" color="primary" class="inline-btn">
<mat-icon>insert_drive_file</mat-icon>
</button>
-->

</div>
</section>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export interface PluginEditorData {
pluginCode: string;
}

// const CREATE_NEW = 'Select a plugin';
const BUILD_IN = ['Quickest', 'Best', 'SkillsAndDistance', 'Nearest'];
// const DEFAULT: PluginEditorData = { id: null, name: null, description: null, pluginCode: null };
const DEFAULT_BUILD_IN = 'DistanceAndSkills';
@Component({
selector: 'plugin-editor',
Expand Down Expand Up @@ -109,7 +107,7 @@ export class PluginEditorComponent implements OnInit, OnDestroy, AfterContentIni
setTimeout(() => this.selectedPlugin.patchValue(defaultPlugin.name), 500);
}

return [/*{ text: CREATE_NEW, value: CREATE_NEW }*/]
return []
.concat(
list
.map(it => ({ text: it.name, value: it.name }))
Expand All @@ -118,7 +116,7 @@ export class PluginEditorComponent implements OnInit, OnDestroy, AfterContentIni
})
);

this.selectedPlugin = this.fb.control('' /*CREATE_NEW*/, Validators.required);
this.selectedPlugin = this.fb.control('', Validators.required);

this.form = this.fb.group({
id: [],
Expand All @@ -144,11 +142,6 @@ export class PluginEditorComponent implements OnInit, OnDestroy, AfterContentIni
this.selectedPlugin.valueChanges.pipe(
switchMap((name) => {

/*if (name === CREATE_NEW) {
this.form.patchValue(DEFAULT);
return of(undefined);
}*/

this.isLoading$.next(true);
return this.service.fetchByName(name).pipe(
take(1),
Expand All @@ -171,7 +164,6 @@ export class PluginEditorComponent implements OnInit, OnDestroy, AfterContentIni
if (this.form.invalid || !this.form.value.id) { return; }

const id = this.form.value.id;
// this.selectedPlugin.patchValue(CREATE_NEW);
this.service.delete(id).pipe(take(1)).subscribe(
() => {
this.refresh.next(true);
Expand All @@ -191,7 +183,7 @@ export class PluginEditorComponent implements OnInit, OnDestroy, AfterContentIni

this.isLoading$.next(true);

const work = id && name /*&& name !== CREATE_NEW*/
const work = id && name
? this.service.update({ id, pluginCode, name, description } as Partial<PluginDto>)
: this.dialog.open(SaveDialog, { disableClose: true }).afterClosed().pipe(
switchMap((newName: string) => {
Expand Down

0 comments on commit 7f62e0e

Please sign in to comment.