reset current page with every search

This commit is contained in:
Julia Gru
2023-03-03 08:47:15 +01:00
parent 9385b840de
commit e540d1c588
3 changed files with 40 additions and 3 deletions

View File

@@ -124,6 +124,37 @@ export class UmbLogViewerWorkspaceContext {
const { data } = await this.#repository.getSavedSearches({ skip: 0, take: 100 });
if (data) {
this.#savedSearches.next(data);
} else {
//falback to some default searches like in the old backoffice
this.#savedSearches.next({
items: [
{
name: 'Find all logs where the Level is NOT Verbose and NOT Debug',
query: "Not(@Level='Verbose') and Not(@Level='Debug')",
},
{
name: 'Find all logs that has an exception property (Warning, Error & Fatal with Exceptions)',
query: 'Has(@Exception)',
},
{
name: "Find all logs that have the property 'Duration'",
query: 'Has(Duration)',
},
{
name: "Find all logs that have the property 'Duration' and the duration is greater than 1000ms",
query: 'Has(Duration) and Duration > 1000',
},
{
name: "Find all logs that are from the namespace 'Umbraco.Core'",
query: "StartsWith(SourceContext, 'Umbraco.Core')",
},
{
name: 'Find all logs that use a specific log message template',
query: "@MessageTemplate = '[Timing {TimingId}] {EndMessage} ({TimingDuration}ms)'",
},
],
total: 6,
});
}
}
@@ -176,6 +207,7 @@ export class UmbLogViewerWorkspaceContext {
}
togglePolling() {
const isEnabled = !this.#polling.getValue().enabled;
this.#polling.update({
enabled: isEnabled,
@@ -183,6 +215,7 @@ export class UmbLogViewerWorkspaceContext {
if (isEnabled) {
this.#intervalID = setInterval(() => {
this.currentPage = 1;
this.getLogs();
}, this.#polling.getValue().interval) as unknown as number;
return;

View File

@@ -314,6 +314,8 @@ export class UmbLogViewerSearchViewElement extends UmbLitElement {
#setQueryFromSavedSearch(query: string) {
this._inputQuery = query;
this.#logViewerContext?.setFilterExpression(query);
this.#logViewerContext?.setCurrentPage(1);
this.#logViewerContext?.getLogs();
this._savedSearchesPopover.open = false;
}
@@ -325,6 +327,8 @@ export class UmbLogViewerSearchViewElement extends UmbLitElement {
}
#search() {
this.#logViewerContext?.setCurrentPage(1);
this.#logViewerContext?.getLogs();
}
@@ -379,6 +383,8 @@ export class UmbLogViewerSearchViewElement extends UmbLitElement {
#setLogLevel() {
if (!this.#logViewerContext) return;
this.#logViewerContext?.setCurrentPage(1);
const logLevels = Array.from(this._logLevelSelectorCheckboxes)
.filter((checkbox) => checkbox.checked)
.map((checkbox) => checkbox.value as LogLevelModel);
@@ -465,6 +471,7 @@ export class UmbLogViewerSearchViewElement extends UmbLitElement {
#sortLogs() {
this.#logViewerContext?.toggleSortOrder();
this.#logViewerContext?.setCurrentPage(1);
this.#logViewerContext?.getLogs();
}

View File

@@ -7,9 +7,6 @@ export default defineConfig({
build: {
sourcemap: true,
},
server: {
open: '/backoffice',
},
plugins: [
viteStaticCopy({
targets: [