Skip to content

Commit

Permalink
fix(deps): update dependency ansi_up to v6 (#2683)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency ansi_up to v6

* fix(build): adapt changes required by new version

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Stephan Köninger <stephan.koeninger@codecentric.de>
  • Loading branch information
renovate[bot] and SteKoe committed Aug 22, 2023
1 parent 5d578ee commit 506e0b0
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 96 deletions.
8 changes: 4 additions & 4 deletions spring-boot-admin-server-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spring-boot-admin-server-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@stekoe/vue-toast-notificationcenter": "https://github.com/SteKoe/vue-toast-notificationcenter/archive/refs/tags/1.0.0-RC5.tar.gz",
"@tailwindcss/forms": "0.5.4",
"@tailwindcss/typography": "0.5.9",
"ansi_up": "5.2.1",
"ansi_up": "6.0.0",
"autolinker": "4.0.0",
"axios": "0.27.2",
"chart.js": "4.3.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,103 +20,96 @@
<sba-sticky-subnav>
<div class="flex items-center justify-end gap-1">
<div class="flex-1">
<span v-text="$t('instances.logfile.label')" />&nbsp;
<small class="hidden md:block" v-text="skippedBytesString" />
<span v-text="$t('instances.logfile.label')"/>&nbsp;
<small class="hidden md:block" v-text="skippedBytesString"/>
</div>
<div class="flex items-start">
<div class="flex items-center h-5">
<input
id="wraplines"
v-model="wrapLines"
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
name="wraplines"
type="checkbox"
id="wraplines"
v-model="wrapLines"
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
name="wraplines"
type="checkbox"
/>
</div>
<div class="ml-3 text-sm">
<label
class="font-medium text-gray-700"
for="wraplines"
v-text="$t('instances.logfile.wrap_lines')"
class="font-medium text-gray-700"
for="wraplines"
v-text="$t('instances.logfile.wrap_lines')"
/>
</div>
</div>

<div class="mx-3 btn-group">
<sba-button :disabled="atTop" @click="scrollToTop">
<svg
class="h-4 w-4"
fill="none"
stroke="currentColor"
stroke-width="2"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
class="h-4 w-4"
fill="none"
stroke="currentColor"
stroke-width="2"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7 11l5-5m0 0l5 5m-5-5v12"
stroke-linecap="round"
stroke-linejoin="round"
d="M7 11l5-5m0 0l5 5m-5-5v12"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</sba-button>
<sba-button :disabled="atBottom" @click="scrollToBottom">
<svg
class="h-4 w-4"
fill="none"
stroke="currentColor"
stroke-width="2"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
class="h-4 w-4"
fill="none"
stroke="currentColor"
stroke-width="2"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M17 13l-5 5m0 0l-5-5m5 5V6"
stroke-linecap="round"
stroke-linejoin="round"
d="M17 13l-5 5m0 0l-5-5m5 5V6"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</sba-button>
</div>

<sba-button class="hidden md:block" @click="downloadLogfile()">
<font-awesome-icon icon="download" />&nbsp;
<span v-text="$t('instances.logfile.download')" />
<font-awesome-icon icon="download"/>&nbsp;
<span v-text="$t('instances.logfile.download')"/>
</sba-button>
</div>
</sba-sticky-subnav>
</template>

<div
:class="{ 'wrap-lines': wrapLines }"
class="log-viewer overflow-x-auto text-sm -mx-6 -my-20 pt-14"
:class="{ 'wrap-lines': wrapLines }"
class="log-viewer overflow-x-auto text-sm -mx-6 -my-20 pt-14"
>
<table class="table-striped" />
<table class="table-striped"/>
</div>
</sba-instance-section>
</template>

<script>
import AnsiUp from 'ansi_up';
import { chunk } from 'lodash-es';
import {chunk} from 'lodash-es';
import prettyBytes from 'pretty-bytes';
import { debounceTime, fromEvent } from 'rxjs';
import {debounceTime, fromEvent} from 'rxjs';
import subscribing from '@/mixins/subscribing';
import sbaConfig from '@/sba-config';
import Instance from '@/services/instance';
import autolink from '@/utils/autolink';
import {
animationFrameScheduler,
concatAll,
concatMap,
map,
of,
tap,
} from '@/utils/rxjs';
import { VIEW_GROUP } from '@/views/ViewGroup';
import {animationFrameScheduler, concatAll, concatMap, map, of, tap,} from '@/utils/rxjs';
import {VIEW_GROUP} from '@/views/ViewGroup';
import SbaInstanceSection from '@/views/instances/shell/sba-instance-section';
import {AnsiUp} from "ansi_up/ansi_up";
export default {
components: { SbaInstanceSection },
components: {SbaInstanceSection},
mixins: [subscribing],
props: {
instance: {
Expand Down Expand Up @@ -144,17 +137,17 @@ export default {
created() {
this.ansiUp = new AnsiUp();
this.scrollSubcription = fromEvent(window, 'scroll')
.pipe(
debounceTime(25),
map((event) => event.target.scrollingElement.scrollTop)
)
.subscribe((scrollTop) => {
this.atTop = scrollTop === 0;
this.atBottom =
document.scrollingElement.clientHeight ===
document.scrollingElement.scrollHeight -
document.scrollingElement.scrollTop;
});
.pipe(
debounceTime(25),
map((event) => event.target.scrollingElement.scrollTop)
)
.subscribe((scrollTop) => {
this.atTop = scrollTop === 0;
this.atBottom =
document.scrollingElement.clientHeight ===
document.scrollingElement.scrollHeight -
document.scrollingElement.scrollTop;
});
},
beforeUnmount() {
if (this.scrollSubcription) {
Expand All @@ -170,51 +163,51 @@ export default {
createSubscription() {
this.error = null;
return this.instance
.streamLogfile(sbaConfig.uiSettings.pollTimer.logfile)
.pipe(
tap(
(part) => (this.skippedBytes = this.skippedBytes || part.skipped)
),
concatMap((part) => chunk(part.addendum.split(/\r?\n/), 250)),
map((lines) => of(lines, animationFrameScheduler)),
concatAll()
)
.subscribe({
next: (lines) => {
this.hasLoaded = true;
lines.forEach((line) => {
const row = document.createElement('tr');
const col = document.createElement('td');
const pre = document.createElement('pre');
pre.innerHTML = autolink(this.ansiUp.ansi_to_html(line));
col.appendChild(pre);
row.appendChild(col);
document.querySelector('.log-viewer > table')?.appendChild(row);
});
.streamLogfile(sbaConfig.uiSettings.pollTimer.logfile)
.pipe(
tap(
(part) => (this.skippedBytes = this.skippedBytes || part.skipped)
),
concatMap((part) => chunk(part.addendum.split(/\r?\n/), 250)),
map((lines) => of(lines, animationFrameScheduler)),
concatAll()
)
.subscribe({
next: (lines) => {
this.hasLoaded = true;
lines.forEach((line) => {
const row = document.createElement('tr');
const col = document.createElement('td');
const pre = document.createElement('pre');
pre.innerHTML = autolink(this.ansiUp.ansi_to_html(line));
col.appendChild(pre);
row.appendChild(col);
document.querySelector('.log-viewer > table')?.appendChild(row);
});
if (this.atBottom) {
this.scrollToBottom();
}
},
error: (error) => {
this.hasLoaded = true;
console.warn('Fetching logfile failed:', error);
this.error = error;
},
});
if (this.atBottom) {
this.scrollToBottom();
}
},
error: (error) => {
this.hasLoaded = true;
console.warn('Fetching logfile failed:', error);
this.error = error;
},
});
},
scrollToTop() {
document.scrollingElement.scrollTop = 0;
},
scrollToBottom() {
document.scrollingElement.scrollTop =
document.scrollingElement.scrollHeight;
document.scrollingElement.scrollHeight;
},
downloadLogfile() {
window.open(`instances/${this.instance.id}/actuator/logfile`, '_blank');
},
},
install({ viewRegistry }) {
install({viewRegistry}) {
viewRegistry.addView({
name: 'instances/logfile',
parent: 'instances',
Expand All @@ -223,7 +216,7 @@ export default {
label: 'instances.logfile.label',
group: VIEW_GROUP.LOGGING,
order: 200,
isEnabled: ({ instance }) => instance.hasEndpoint('logfile'),
isEnabled: ({instance}) => instance.hasEndpoint('logfile'),
});
},
};
Expand Down

0 comments on commit 506e0b0

Please sign in to comment.