Skip to content

Commit 4f427d6

Browse files
committed
feat: enhance file write feedback and add refresh option in updateFileContent
1 parent 01ca0ba commit 4f427d6

File tree

9 files changed

+155
-181
lines changed

9 files changed

+155
-181
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"mitt": "^3.0.1",
4444
"ng-zorro-antd": "^19.2.2",
4545
"nprogress": "^0.2.0",
46-
"puppeteer": "^24.8.1",
46+
"puppeteer": "^24.8.2",
4747
"qs": "^6.14.0",
4848
"rough-notation": "^0.5.1",
4949
"rxjs": "~7.8.2",
@@ -54,7 +54,7 @@
5454
"@angular-devkit/build-angular": "^19.2.11",
5555
"@angular/cli": "^19.2.11",
5656
"@angular/compiler-cli": "^19.2.10",
57-
"@tailwindcss/postcss": "^4.1.5",
57+
"@tailwindcss/postcss": "^4.1.6",
5858
"@types/compression": "^1.7.5",
5959
"@types/file-saver": "^2.0.7",
6060
"@types/jasmine": "~5.1.8",
@@ -68,12 +68,12 @@
6868
"cors": "^2.8.5",
6969
"info-web": "^0.0.46",
7070
"jasmine-core": "~5.7.1",
71-
"lint-staged": "^15.5.2",
72-
"nodemailer": "^7.0.2",
71+
"lint-staged": "^16.0.0",
72+
"nodemailer": "^7.0.3",
7373
"pm2": "^6.0.5",
7474
"postcss": "^8.5.3",
7575
"prettier": "^3.5.3",
76-
"tailwindcss": "^4.1.5",
76+
"tailwindcss": "^4.1.6",
7777
"tslib": "^2.8.1",
7878
"tsx": "^4.19.4",
7979
"typescript": "~5.8.3"

pnpm-lock.yaml

Lines changed: 133 additions & 170 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ export async function fileWriteStream(path: string, data: object | string) {
630630
const stream1 = fs.createWriteStream(path)
631631

632632
const stream1Promise = new Promise((resolve, reject) => {
633-
stream1.on('finish', () => resolve('file1 written'))
633+
stream1.on('finish', () => resolve(`${path} written`))
634634
stream1.on('error', (err) => reject(err))
635635
})
636636

src/api/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,15 @@ type Iupdate = {
191191
path: string
192192
branch?: string
193193
isEncode?: boolean
194+
refresh?: boolean
194195
}
195196
export async function updateFileContent({
196197
message = 'update',
197198
content,
198199
path,
199200
branch = DEFAULT_BRANCH,
200201
isEncode = true,
202+
refresh = true,
201203
}: Iupdate) {
202204
if (isSelfDevelop) {
203205
if (!isLogin) {
@@ -209,7 +211,7 @@ export async function updateFileContent({
209211
content,
210212
})
211213
.then((res) => {
212-
getContentes()
214+
refresh && getContentes()
213215
requestActionUrl()
214216
return res
215217
})

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class AppComponent {
129129
},
130130
])
131131
}
132-
if (isHome) {
132+
if (isHome && !location.href.includes('system')) {
133133
this.router.navigate([defaultTheme])
134134
}
135135
this.updateDocumentTitle()

src/components/login/login.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<ng-container *nzModalContent>
99
<p>{{ $t('_inputTokenMsg') }}</p>
1010
<input
11-
autofocus
1211
nz-input
1312
[(ngModel)]="token"
1413
autofocus

src/components/login/login.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class LoginComponent {
6565
private inputFocus(): void {
6666
setTimeout(() => {
6767
this.input?.nativeElement?.focus()
68-
}, 300)
68+
}, 500)
6969
}
7070

7171
onKey(event: KeyboardEvent): void {

src/view/system/index.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
{{ $t('_confInfo') }}
8787
</li>
8888
<li
89+
*ngIf="!isSelfDevelop"
8990
nz-menu-item
9091
[nzSelected]="currentMenu === 'info'"
9192
(click)="goRoute('/system/info')"

src/view/system/web/index.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ export default class WebpComponent {
296296
message: 'import db',
297297
content: JSON.stringify(data.db),
298298
path: DB_PATH,
299+
refresh: false,
299300
})
300301
that.notification.success('OK', 'DB import successful')
301302
} catch {
@@ -311,6 +312,7 @@ export default class WebpComponent {
311312
...data.settings,
312313
}),
313314
path: SETTING_PATH,
315+
refresh: false,
314316
})
315317
that.notification.success('OK', 'settings import successful')
316318
} catch {
@@ -323,6 +325,7 @@ export default class WebpComponent {
323325
message: 'import tag',
324326
content: JSON.stringify(data.tag),
325327
path: TAG_PATH,
328+
refresh: false,
326329
})
327330
that.notification.success('OK', 'tag import successful')
328331
} catch {
@@ -338,6 +341,7 @@ export default class WebpComponent {
338341
...data.search,
339342
}),
340343
path: SEARCH_PATH,
344+
refresh: false,
341345
})
342346
that.notification.success('OK', 'search import successful')
343347
} catch {
@@ -353,6 +357,7 @@ export default class WebpComponent {
353357
...data.component,
354358
}),
355359
path: COMPONENT_PATH,
360+
refresh: false,
356361
})
357362
that.notification.success('OK', 'component import successful')
358363
} catch {
@@ -361,9 +366,13 @@ export default class WebpComponent {
361366
})
362367
}
363368

364-
that.message.success($t('_syncSuccessTip'))
369+
setTimeout(() => {
370+
location.reload()
371+
}, 2000)
365372
} catch (error: any) {
366373
that.notification.error($t('_error'), error.message)
374+
} finally {
375+
e.target.value = ''
367376
}
368377
}
369378
}

0 commit comments

Comments
 (0)