-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* style:extension-detail * style: optimizi * feat: update UI * test: publish * test: build * chore: update .gitignore * testt: publish * test: relese * feat: check eoapi client is install * test: relese * feat: add save * feat: clickExtension tab query params * fix: update code * add i18n * chore: merge code * feat: extension support swtich enable status * fix: extension name not sure * fix: css style * chore: update desc * fix: some css style * feat: add single instance lock Co-authored-by: buqiyuan <1743369777@qq.com>
- Loading branch information
Showing
47 changed files
with
736 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
!macro customInstall | ||
DetailPrint "Register eoapi URI Handler" | ||
DeleteRegKey HKCR "eoapi" | ||
WriteRegStr HKCR "eoapi" "" "URL:eoapi" | ||
WriteRegStr HKCR "eoapi" "URL Protocol" "" | ||
WriteRegStr HKCR "eoapi\shell" "" "" | ||
WriteRegStr HKCR "eoapi\shell\Open" "" "" | ||
WriteRegStr HKCR "eoapi\shell\Open\command" "" "$INSTDIR\${APP_EXECUTABLE_FILENAME} %1" | ||
!macroend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ registerLocaleData(zh); | |
} | ||
}, | ||
deps: [LOCALE_ID], | ||
} | ||
}, | ||
], | ||
bootstrap: [AppComponent], | ||
}) | ||
|
6 changes: 3 additions & 3 deletions
6
src/workbench/browser/src/app/pages/api/overview/api-overview.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
src/workbench/browser/src/app/pages/extension/detail/components/extensions.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; | ||
import { LanguageService } from 'eo/workbench/browser/src/app/core/services/language/language.service'; | ||
import { SettingService } from 'eo/workbench/browser/src/app/core/services/settings/settings.service'; | ||
import { NzMessageService } from 'ng-zorro-antd/message'; | ||
|
||
@Component({ | ||
selector: 'eo-extension-setting', | ||
template: ` | ||
<div | ||
class="bg-white sticky top-0 py-[10px] border-solid border-0 border-b-[1px] z-10 mb-[3px]" | ||
style="border-color: var(--BORDER)" | ||
> | ||
<button nz-button nzType="primary" (click)="handleSave()">Save</button> | ||
</div> | ||
<form nz-form [nzLayout]="'vertical'" [formGroup]="validateForm" class="form"> | ||
<nz-form-item nz-col class="fg1" *ngFor="let field of objectKeys(properties)"> | ||
<ng-container *ngIf="properties[field]?.label"> | ||
<nz-form-label nzFor="{{ field }}" [nzRequired]="properties[field]?.required" class="label"> | ||
{{ properties[field]?.label }} | ||
</nz-form-label> | ||
</ng-container> | ||
<!-- 二级说明 --> | ||
<div | ||
*ngIf="properties[field]?.type !== 'boolean' && properties[field]?.description" | ||
class="text-[12px] mb-[8px] text-gray-400" | ||
> | ||
{{ properties[field]?.description }} | ||
</div> | ||
<nz-form-control i18n-nzErrorTip nzErrorTip="Please Enter {{ properties[field]?.label }}" class="form-control"> | ||
<!-- 字符串类型 --> | ||
<!-- <ng-container *ngIf="properties[field]?.type === 'string'"> --> | ||
<input | ||
type="text" | ||
nz-input | ||
id="{{ field }}" | ||
[disabled]="properties[field]?.disabled" | ||
i18n-placeholder | ||
placeholder="{{ properties[field]?.placeholder ?? 'Please Enter ' + properties[field]?.label }}" | ||
formControlName="{{ field }}" | ||
[(ngModel)]="localSettings[field]" | ||
/> | ||
<!-- </ng-container> --> | ||
<!-- 布尔类型 --> | ||
<ng-container *ngIf="properties[field]?.type === 'boolean'"> | ||
<label | ||
nz-checkbox | ||
[(ngModel)]="localSettings[field]" | ||
id="{{ field }}" | ||
[nzDisabled]="properties[field]?.disabled" | ||
formControlName="{{ field }}" | ||
>{{ properties[field]?.description }}</label | ||
> | ||
</ng-container> | ||
<!-- 数字类型 --> | ||
<ng-container *ngIf="properties[field]?.type === 'number'"> | ||
<nz-input-number | ||
[(ngModel)]="localSettings[field]" | ||
id="{{ field }}" | ||
[nzDisabled]="properties[field]?.disabled" | ||
formControlName="{{ field }}" | ||
> | ||
{{ properties[field]?.description }}</nz-input-number | ||
> | ||
</ng-container> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</form> | ||
`, | ||
}) | ||
export class ExtensionSettingComponent implements OnInit { | ||
@Input() configuration = {} as any; | ||
localSettings = {} as Record<string, any>; | ||
validateForm!: FormGroup; | ||
objectKeys = Object.keys; | ||
get properties() { | ||
return this.configuration?.properties || {}; | ||
} | ||
|
||
constructor( | ||
public languageService: LanguageService, | ||
private fb: FormBuilder, | ||
private settingService: SettingService, | ||
private message: NzMessageService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.init(); | ||
} | ||
|
||
private init() { | ||
this.localSettings = this.settingService.getSettings(); | ||
const controls = {}; | ||
|
||
this.setSettingsModel(this.configuration.properties, controls); | ||
|
||
this.validateForm = this.fb.group(controls); | ||
} | ||
|
||
/** | ||
* set data | ||
* | ||
* @param properties | ||
*/ | ||
private setSettingsModel(properties, controls) { | ||
// Flat configuration object | ||
Object.keys(properties).forEach((fieldKey) => { | ||
const props = properties[fieldKey]; | ||
this.localSettings[fieldKey] ??= props.default; | ||
// Extensible to add more default checks | ||
if (props.required) { | ||
controls[fieldKey] = [null, [Validators.required]]; | ||
} else { | ||
controls[fieldKey] = [null]; | ||
} | ||
}); | ||
} | ||
|
||
handleSave = () => { | ||
this.settingService.saveSetting(this.localSettings); | ||
window.eo?.saveSettings?.({ ...this.localSettings }); | ||
this.message.create('success', `Save Success`); | ||
}; | ||
} |
Oops, something went wrong.