Compare commits
102 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a277b7c00e | ||
|
|
26d7d1620e | ||
|
|
e7b65efc7a | ||
|
|
3884eb9648 | ||
|
|
c1a02644b6 | ||
|
|
63135ded8a | ||
|
|
ded48ab821 | ||
|
|
c014837e41 | ||
|
|
c0768d7843 | ||
|
|
32a6fe1d91 | ||
|
|
6187483bc2 | ||
|
|
59143841c9 | ||
|
|
f9f22dbdf2 | ||
|
|
3da3a319af | ||
|
|
2d5a9a2b42 | ||
|
|
50d34442b7 | ||
|
|
d52a4d86e9 | ||
|
|
0b18c00db3 | ||
|
|
561c8372da | ||
|
|
db32fa51aa | ||
|
|
6a28fd9474 | ||
|
|
d52961e06e | ||
|
|
969728eb69 | ||
|
|
5001340f0d | ||
|
|
7d21f2d5db | ||
|
|
58613fe771 | ||
|
|
62ab55b1e4 | ||
|
|
6dc0c93588 | ||
|
|
84e24b9ec8 | ||
|
|
f689e9c3d3 | ||
|
|
054f1c616f | ||
|
|
8bfe5b5193 | ||
|
|
120f70d39a | ||
|
|
66f5fcd06b | ||
|
|
e934639220 | ||
|
|
52a8d6489d | ||
|
|
4176202bcc | ||
|
|
09731be502 | ||
|
|
aea496422a | ||
|
|
8970bb7db9 | ||
|
|
f4fbdaa42f | ||
|
|
07330ecabe | ||
|
|
c5a3e2a7e7 | ||
|
|
de0de15b5b | ||
|
|
b8bd70adc3 | ||
|
|
ff11f8e0cc | ||
|
|
7d118fd162 | ||
|
|
6a01e0ca16 | ||
|
|
12ec8189f3 | ||
|
|
9b62073ce6 | ||
|
|
579df88946 | ||
|
|
3f27e988ed | ||
|
|
e5a40d4f5f | ||
|
|
2e86873908 | ||
|
|
90fefe660a | ||
|
|
b0c2b60ecf | ||
|
|
0a49f55ebe | ||
|
|
fc25775754 | ||
|
|
07dc02403d | ||
|
|
2b9bba4ba0 | ||
|
|
fdec2c3d71 | ||
|
|
e8ec89f99a | ||
|
|
3899ecda5a | ||
|
|
495b97d655 | ||
|
|
c91e63ee4c | ||
|
|
466b47c623 | ||
|
|
23430d9cdf | ||
|
|
1b9d35fa12 | ||
|
|
4589399ecf | ||
|
|
73a8cd32cf | ||
|
|
f808926dbb | ||
|
|
27f20a3d78 | ||
|
|
4fdd851242 | ||
|
|
62898eae41 | ||
|
|
91b779db43 | ||
|
|
f6a934e013 | ||
|
|
42d53004eb | ||
|
|
66310ffd8a | ||
|
|
4578e6c895 | ||
|
|
8bfff2c601 | ||
|
|
ca7f91ad3b | ||
|
|
c98e90f89b | ||
|
|
78268ae2fd | ||
|
|
783c8bdcf5 | ||
|
|
d0f776fe2f | ||
|
|
aa7169f535 | ||
|
|
b98bae89c0 | ||
|
|
8681ff042e | ||
|
|
07800c3ffc | ||
|
|
d9c6df4f81 | ||
|
|
3b7631a424 | ||
|
|
df74eb3c72 | ||
|
|
be6f78f760 | ||
|
|
11a70e22bc | ||
|
|
024dd22896 | ||
|
|
564d089172 | ||
|
|
87ade43fb7 | ||
|
|
04aac0c4f9 | ||
|
|
ee90ab021f | ||
|
|
8c5cd12a30 | ||
|
|
86bc413695 | ||
|
|
e7606fd960 |
@@ -4,3 +4,5 @@ node_modules
|
||||
dist
|
||||
.git
|
||||
static
|
||||
integration
|
||||
demo.gif
|
||||
22
.github/workflows/push.yml
vendored
22
.github/workflows/push.yml
vendored
@@ -2,17 +2,19 @@ on: push
|
||||
name: Test
|
||||
jobs:
|
||||
npm-test:
|
||||
name: npm test
|
||||
name: JavaScript Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: npm test
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v1
|
||||
- name: npm it
|
||||
run: npm it
|
||||
- name: Install depdencies
|
||||
run: yarn
|
||||
- name: Run Tests
|
||||
run: yarn test
|
||||
go-test:
|
||||
name: go test
|
||||
name: Go Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
@@ -21,5 +23,13 @@ jobs:
|
||||
go-version: 1.14.x
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
- name: Run Go Tests with Coverage
|
||||
run: go test -cover ./...
|
||||
docker-build:
|
||||
name: Integration Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: docker-compose -f integration/docker-compose.test.yml run integration
|
||||
|
||||
3
.htmlnanorc.js
Normal file
3
.htmlnanorc.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
minifySvg: false,
|
||||
};
|
||||
3
.prettierrc.js
Normal file
3
.prettierrc.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
printWidth: 120,
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"printWidth": 120
|
||||
}
|
||||
10
Dockerfile
10
Dockerfile
@@ -6,14 +6,18 @@ RUN apk add --no-cache git openssh python make g++ util-linux
|
||||
WORKDIR /build
|
||||
|
||||
# Install dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY package*.json yarn.lock ./
|
||||
RUN yarn install --network-timeout 1000000
|
||||
|
||||
# Copy config files
|
||||
COPY .* ./
|
||||
|
||||
# Copy assets to build
|
||||
COPY assets ./assets
|
||||
|
||||
|
||||
# Do the build
|
||||
RUN npm run build
|
||||
RUN yarn build
|
||||
|
||||
|
||||
FROM golang:1.14-alpine AS builder
|
||||
|
||||
@@ -44,9 +44,6 @@ dozzle will be available at [http://localhost:8888/](http://localhost:8888/). Yo
|
||||
dozzle:
|
||||
container_name: dozzle
|
||||
image: amir20/dozzle:latest
|
||||
environment:
|
||||
- DOZZLE_TAILSIZE=100
|
||||
- DOZZLE_FILTER=status=running
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
ports:
|
||||
|
||||
@@ -8,7 +8,7 @@ const localVue = createLocalVue();
|
||||
localVue.use(Vuex);
|
||||
|
||||
describe("<App />", () => {
|
||||
const stubs = { RouterLink: RouterLinkStub, "router-view": true, "ion-icon": true };
|
||||
const stubs = { RouterLink: RouterLinkStub, "router-view": true, icon: true };
|
||||
let store;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -17,18 +17,18 @@ describe("<App />", () => {
|
||||
const state = {
|
||||
containers: [
|
||||
{ id: "abc", name: "Test 1" },
|
||||
{ id: "xyz", name: "Test 2" }
|
||||
{ id: "xyz", name: "Test 2" },
|
||||
],
|
||||
settings: { menuWidth: 15 }
|
||||
settings: { menuWidth: 15 },
|
||||
};
|
||||
|
||||
const actions = {
|
||||
FETCH_CONTAINERS: () => Promise.resolve()
|
||||
FETCH_CONTAINERS: () => Promise.resolve(),
|
||||
};
|
||||
|
||||
store = new Vuex.Store({
|
||||
state,
|
||||
actions
|
||||
actions,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<mobile-menu v-if="isMobile"></mobile-menu>
|
||||
|
||||
<splitpanes @resized="onResized($event)">
|
||||
<pane min-size="10" :size="settings.menuWidth" v-if="!isMobile" v-show="!collapseNav">
|
||||
<pane min-size="10" :size="settings.menuWidth" v-if="!isMobile && !collapseNav">
|
||||
<side-menu></side-menu>
|
||||
</pane>
|
||||
<pane min-size="10">
|
||||
@@ -31,7 +31,7 @@
|
||||
v-if="!isMobile"
|
||||
>
|
||||
<span class="icon">
|
||||
<ion-icon :name="collapseNav ? 'arrow-dropright' : 'arrow-dropleft'" size="large"></ion-icon>
|
||||
<icon :name="collapseNav ? 'chevron-right' : 'chevron-left'"></icon>
|
||||
</span>
|
||||
</button>
|
||||
</main>
|
||||
@@ -47,10 +47,12 @@ import SideMenu from "./components/SideMenu";
|
||||
import MobileMenu from "./components/MobileMenu";
|
||||
import Search from "./components/Search";
|
||||
import ContainerTitle from "./components/ContainerTitle";
|
||||
import Icon from "./components/Icon";
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
components: {
|
||||
Icon,
|
||||
LogViewerWithSource,
|
||||
SideMenu,
|
||||
MobileMenu,
|
||||
@@ -58,18 +60,18 @@ export default {
|
||||
Splitpanes,
|
||||
Pane,
|
||||
Search,
|
||||
ContainerTitle
|
||||
ContainerTitle,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: "",
|
||||
collapseNav: false
|
||||
collapseNav: false,
|
||||
};
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.title,
|
||||
titleTemplate: "%s - Dozzle"
|
||||
titleTemplate: "%s - Dozzle",
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
@@ -89,27 +91,27 @@ export default {
|
||||
} else {
|
||||
document.documentElement.classList.remove("has-custom-scrollbars");
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(["containers", "activeContainers", "isMobile", "settings"]),
|
||||
hasSmallerScrollbars() {
|
||||
return this.settings.smallerScrollbars;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
fetchContainerList: "FETCH_CONTAINERS",
|
||||
removeActiveContainer: "REMOVE_ACTIVE_CONTAINER",
|
||||
updateSetting: "UPDATE_SETTING"
|
||||
updateSetting: "UPDATE_SETTING",
|
||||
}),
|
||||
onResized(e) {
|
||||
if (e.length == 2) {
|
||||
const menuWidth = e[0].size;
|
||||
this.updateSetting({ menuWidth });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -45,9 +45,8 @@ exports[`<App /> renders correctly 1`] = `
|
||||
<span
|
||||
class="icon"
|
||||
>
|
||||
<ion-icon-stub
|
||||
name="arrow-dropleft"
|
||||
size="large"
|
||||
<icon-stub
|
||||
name="chevron-left"
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -13,10 +13,10 @@ export default {
|
||||
value: String,
|
||||
closable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
name: "ContainerTitle"
|
||||
name: "ContainerTitle",
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
33
assets/components/Icon.vue
Normal file
33
assets/components/Icon.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<svg class="icomoon" :class="['icon-' + name]">
|
||||
<use :href="'#icon-' + name"></use>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
functional: true,
|
||||
props: {
|
||||
name: {
|
||||
required: true,
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
name: "Icon",
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.icomoon {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
stroke-width: 0;
|
||||
stroke: currentColor;
|
||||
fill: currentColor;
|
||||
|
||||
.icon:not(.keep-size) & {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,16 +7,16 @@ export default {
|
||||
name: "InfiniteLoader",
|
||||
data() {
|
||||
return {
|
||||
isLoading: false
|
||||
isLoading: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
onLoadMore: Function,
|
||||
enabled: Boolean
|
||||
enabled: Boolean,
|
||||
},
|
||||
mounted() {
|
||||
const intersectionObserver = new IntersectionObserver(
|
||||
async entries => {
|
||||
async (entries) => {
|
||||
if (entries[0].intersectionRatio <= 0) return;
|
||||
if (this.onLoadMore && this.enabled) {
|
||||
const scrollingParent = this.$el.closest("[data-scrolling]") || document.documentElement;
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
);
|
||||
|
||||
intersectionObserver.observe(this.$refs.observer);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import debounce from "lodash.debounce";
|
||||
import EventSource from "eventsourcemock";
|
||||
import { sources } from "eventsourcemock";
|
||||
import { shallowMount, mount, createLocalVue } from "@vue/test-utils";
|
||||
import Vuex from "vuex";
|
||||
import MockDate from "mockdate";
|
||||
import debounce from "lodash.debounce";
|
||||
import LogEventSource from "./LogEventSource.vue";
|
||||
import LogViewer from "./LogViewer.vue";
|
||||
|
||||
jest.mock("lodash.debounce", () => jest.fn(fn => fn));
|
||||
jest.mock("lodash.debounce", () =>
|
||||
jest.fn((fn) => {
|
||||
return fn;
|
||||
})
|
||||
);
|
||||
|
||||
describe("<LogEventSource />", () => {
|
||||
beforeEach(() => {
|
||||
@@ -20,7 +24,7 @@ describe("<LogEventSource />", () => {
|
||||
const unobserve = jest.fn();
|
||||
global.IntersectionObserver = jest.fn(() => ({
|
||||
observe,
|
||||
unobserve
|
||||
unobserve,
|
||||
}));
|
||||
debounce.mockClear();
|
||||
});
|
||||
@@ -31,13 +35,12 @@ describe("<LogEventSource />", () => {
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Vuex);
|
||||
|
||||
localVue.component("log-event-source", LogEventSource);
|
||||
localVue.component("log-viewer", LogViewer);
|
||||
|
||||
const state = { searchFilter, settings: { size: "medium" } };
|
||||
const state = { searchFilter, settings: { size: "medium", showTimestamp: true } };
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state
|
||||
state,
|
||||
});
|
||||
|
||||
return mount(LogEventSource, {
|
||||
@@ -46,9 +49,9 @@ describe("<LogEventSource />", () => {
|
||||
scopedSlots: {
|
||||
default: `
|
||||
<log-viewer :messages="props.messages"></log-viewer>
|
||||
`
|
||||
`,
|
||||
},
|
||||
propsData: { id: "abc" }
|
||||
propsData: { id: "abc" },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -125,6 +128,7 @@ describe("<LogEventSource />", () => {
|
||||
sources["/api/logs/stream?id=abc"].emitOpen();
|
||||
sources["/api/logs/stream?id=abc"].emitMessage({ data: `2019-06-12T10:55:42.459034602Z "This is a message."` });
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
|
||||
<ul class="events medium">
|
||||
<li><span class="date">today at 10:55 AM</span> <span class="text">"This is a message."</span></li>
|
||||
@@ -136,9 +140,10 @@ describe("<LogEventSource />", () => {
|
||||
const wrapper = createLogEventSource();
|
||||
sources["/api/logs/stream?id=abc"].emitOpen();
|
||||
sources["/api/logs/stream?id=abc"].emitMessage({
|
||||
data: `2019-06-12T10:55:42.459034602Z \x1b[30mblack\x1b[37mwhite`
|
||||
data: `2019-06-12T10:55:42.459034602Z \x1b[30mblack\x1b[37mwhite`,
|
||||
});
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
|
||||
<ul class="events medium">
|
||||
<li><span class="date">today at 10:55 AM</span> <span class="text"><span style="color:#000">black<span style="color:#AAA">white</span></span></span></li>
|
||||
@@ -150,9 +155,10 @@ describe("<LogEventSource />", () => {
|
||||
const wrapper = createLogEventSource();
|
||||
sources["/api/logs/stream?id=abc"].emitOpen();
|
||||
sources["/api/logs/stream?id=abc"].emitMessage({
|
||||
data: `2019-06-12T10:55:42.459034602Z <test>foo bar</test>`
|
||||
data: `2019-06-12T10:55:42.459034602Z <test>foo bar</test>`,
|
||||
});
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
|
||||
<ul class="events medium">
|
||||
<li><span class="date">today at 10:55 AM</span> <span class="text"><test>foo bar</test></span></li>
|
||||
@@ -164,12 +170,13 @@ describe("<LogEventSource />", () => {
|
||||
const wrapper = createLogEventSource("test");
|
||||
sources["/api/logs/stream?id=abc"].emitOpen();
|
||||
sources["/api/logs/stream?id=abc"].emitMessage({
|
||||
data: `2019-06-11T10:55:42.459034602Z Foo bar`
|
||||
data: `2019-06-11T10:55:42.459034602Z Foo bar`,
|
||||
});
|
||||
sources["/api/logs/stream?id=abc"].emitMessage({
|
||||
data: `2019-06-12T10:55:42.459034602Z This is a test <hi></hi>`
|
||||
data: `2019-06-12T10:55:42.459034602Z This is a test <hi></hi>`,
|
||||
});
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
|
||||
<ul class="events medium">
|
||||
<li><span class="date">today at 10:55 AM</span> <span class="text">This is a <mark>test</mark> <hi></hi></span></li>
|
||||
|
||||
@@ -16,7 +16,7 @@ function parseMessage(data) {
|
||||
return {
|
||||
key,
|
||||
date,
|
||||
message
|
||||
message,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ export default {
|
||||
props: ["id"],
|
||||
name: "LogEventSource",
|
||||
components: {
|
||||
InfiniteLoader
|
||||
InfiniteLoader,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
messages: [],
|
||||
buffer: []
|
||||
buffer: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -52,11 +52,11 @@ export default {
|
||||
250,
|
||||
{ maxWait: 1000 }
|
||||
);
|
||||
this.es.onmessage = e => {
|
||||
this.es.onmessage = (e) => {
|
||||
this.buffer.push(parseMessage(e.data));
|
||||
flushBuffer();
|
||||
};
|
||||
this.es.onerror = e => console.log("EventSource failed." + e);
|
||||
this.es.onerror = (e) => console.log("EventSource failed." + e);
|
||||
this.$once("hook:beforeDestroy", () => this.es.close());
|
||||
},
|
||||
async loadOlderLogs() {
|
||||
@@ -73,17 +73,17 @@ export default {
|
||||
const newMessages = logs
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map(line => parseMessage(line));
|
||||
.map((line) => parseMessage(line));
|
||||
this.messages.unshift(...newMessages);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
id(newValue, oldValue) {
|
||||
if (oldValue !== newValue) {
|
||||
this.loadLogs(newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template lang="html">
|
||||
<ul class="events" :class="settings.size">
|
||||
<li v-for="item in filtered" :key="item.key">
|
||||
<span class="date">{{ item.date | relativeTime }}</span>
|
||||
<span class="date" v-if="settings.showTimestamp">{{ item.date | relativeTime }}</span>
|
||||
<span class="text" v-html="colorize(item.message)"></span>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -20,16 +20,13 @@ export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
showSearch: false
|
||||
showSearch: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
colorize: function(value) {
|
||||
return ansiConvertor
|
||||
.toHtml(value)
|
||||
.replace("<mark>", "<mark>")
|
||||
.replace("</mark>", "</mark>");
|
||||
}
|
||||
colorize: function (value) {
|
||||
return ansiConvertor.toHtml(value).replace("<mark>", "<mark>").replace("</mark>", "</mark>");
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(["searchFilter", "settings"]),
|
||||
@@ -40,10 +37,10 @@ export default {
|
||||
try {
|
||||
const regex = isSmartCase ? new RegExp(searchFilter, "i") : new RegExp(searchFilter);
|
||||
return messages
|
||||
.filter(d => d.message.match(regex))
|
||||
.map(d => ({
|
||||
.filter((d) => d.message.match(regex))
|
||||
.map((d) => ({
|
||||
...d,
|
||||
message: d.message.replace(regex, "<mark>$&</mark>")
|
||||
message: d.message.replace(regex, "<mark>$&</mark>"),
|
||||
}));
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
@@ -54,13 +51,13 @@ export default {
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
relativeTime(date) {
|
||||
return formatRelative(date, new Date());
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@@ -71,6 +68,10 @@ export default {
|
||||
& > li {
|
||||
word-wrap: break-word;
|
||||
line-height: 130%;
|
||||
&:last-child {
|
||||
scroll-snap-align: end;
|
||||
scroll-margin-block-end: 5rem;
|
||||
}
|
||||
}
|
||||
|
||||
&.small {
|
||||
|
||||
@@ -13,7 +13,7 @@ export default {
|
||||
name: "LogViewerWithSource",
|
||||
components: {
|
||||
LogEventSource,
|
||||
LogViewer
|
||||
}
|
||||
LogViewer,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -34,22 +34,22 @@ export default {
|
||||
name: "MobileMenu",
|
||||
data() {
|
||||
return {
|
||||
showNav: false
|
||||
showNav: false,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(["containers"]),
|
||||
...mapGetters(["activeContainersById"])
|
||||
...mapGetters(["activeContainersById"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions({})
|
||||
...mapActions({}),
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
this.showNav = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
@click="scrollToBottom('instant')"
|
||||
v-show="paused"
|
||||
>
|
||||
<ion-icon name="download"></ion-icon>
|
||||
<icon name="download"></icon>
|
||||
</button>
|
||||
</transition>
|
||||
</div>
|
||||
@@ -23,23 +23,28 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Icon from "./Icon";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
scrollable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
Icon,
|
||||
},
|
||||
name: "ScrollableView",
|
||||
data() {
|
||||
return {
|
||||
paused: false,
|
||||
hasMore: false
|
||||
hasMore: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
const { content } = this.$refs;
|
||||
new MutationObserver(e => {
|
||||
new MutationObserver((e) => {
|
||||
if (!this.paused) {
|
||||
this.scrollToBottom("instant");
|
||||
} else {
|
||||
@@ -48,7 +53,7 @@ export default {
|
||||
}).observe(content, { childList: true, subtree: true });
|
||||
|
||||
const intersectionObserver = new IntersectionObserver(
|
||||
entries => (this.paused = entries[0].intersectionRatio == 0),
|
||||
(entries) => (this.paused = entries[0].intersectionRatio == 0),
|
||||
{ threshholds: [0, 1], rootMargin: "80px 0px" }
|
||||
);
|
||||
|
||||
@@ -59,8 +64,8 @@ export default {
|
||||
scrollToBottom(behavior = "instant") {
|
||||
this.$refs.scrollObserver.scrollIntoView({ behavior });
|
||||
this.hasMore = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@@ -75,6 +80,7 @@ section {
|
||||
main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
scroll-snap-type: y proximity;
|
||||
}
|
||||
|
||||
.scroll-bar-notification {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
v-model="filter"
|
||||
@keyup.esc="resetSearch()"
|
||||
/>
|
||||
<span class="icon is-small is-left">
|
||||
<ion-icon name="search"></ion-icon>
|
||||
<span class="icon is-left">
|
||||
<icon name="search"></icon>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -24,13 +24,17 @@
|
||||
<script>
|
||||
import { mapActions, mapState } from "vuex";
|
||||
import hotkeys from "hotkeys-js";
|
||||
import Icon from "./Icon";
|
||||
|
||||
export default {
|
||||
props: [],
|
||||
name: "Search",
|
||||
components: {
|
||||
Icon,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSearch: false
|
||||
showSearch: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -45,12 +49,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
updateSearchFilter: "SET_SEARCH"
|
||||
updateSearchFilter: "SET_SEARCH",
|
||||
}),
|
||||
resetSearch() {
|
||||
this.showSearch = false;
|
||||
this.filter = "";
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(["searchFilter", "settings"]),
|
||||
@@ -60,9 +64,9 @@ export default {
|
||||
},
|
||||
set(value) {
|
||||
this.updateSearchFilter(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -80,4 +84,8 @@ export default {
|
||||
.delete {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.icon {
|
||||
padding: 10px 3px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
active-class="is-active"
|
||||
class="button is-small is-rounded is-settings-control"
|
||||
>
|
||||
<span class="icon"><ion-icon name="settings" size="large"></ion-icon></span>
|
||||
<span class="icon">
|
||||
<icon name="cog"></icon>
|
||||
</span>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,7 +30,7 @@
|
||||
class="icon is-small will-append-container"
|
||||
:class="{ 'is-active': activeContainersById[item.id] }"
|
||||
>
|
||||
<ion-icon name="ios-add-circle"></ion-icon>
|
||||
<icon name="pin"></icon>
|
||||
</span>
|
||||
{{ item.name }}
|
||||
</div>
|
||||
@@ -41,21 +43,26 @@
|
||||
<script>
|
||||
import { mapActions, mapGetters, mapState } from "vuex";
|
||||
|
||||
import Icon from "./Icon";
|
||||
|
||||
export default {
|
||||
props: [],
|
||||
name: "SideMenu",
|
||||
components: {
|
||||
Icon,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["containers", "activeContainers"]),
|
||||
...mapGetters(["activeContainersById"])
|
||||
...mapGetters(["activeContainersById"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
appendActiveContainer: "APPEND_ACTIVE_CONTAINER"
|
||||
})
|
||||
}
|
||||
appendActiveContainer: "APPEND_ACTIVE_CONTAINER",
|
||||
}),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -12,11 +12,62 @@
|
||||
window["BASE_PATH"] = "{{ .Base }}";
|
||||
window["VERSION"] = "{{ .Version }}";
|
||||
</script>
|
||||
<script type="module" src="https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.esm.js"></script>
|
||||
<script nomodule="" src="https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
style="position: absolute; width: 0; height: 0; overflow: hidden;"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
>
|
||||
<defs>
|
||||
<symbol id="icon-check" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M19.293 5.293l-10.293 10.293-4.293-4.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414l5 5c0.391 0.391 1.024 0.391 1.414 0l11-11c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0z"
|
||||
></path>
|
||||
</symbol>
|
||||
<symbol id="icon-chevron-down" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M5.293 9.707l6 6c0.391 0.391 1.024 0.391 1.414 0l6-6c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-5.293 5.293-5.293-5.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"
|
||||
></path>
|
||||
</symbol>
|
||||
<symbol id="icon-chevron-left" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M15.707 17.293l-5.293-5.293 5.293-5.293c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-6 6c-0.391 0.391-0.391 1.024 0 1.414l6 6c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z"
|
||||
></path>
|
||||
</symbol>
|
||||
<symbol id="icon-chevron-right" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M9.707 18.707l6-6c0.391-0.391 0.391-1.024 0-1.414l-6-6c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414l5.293 5.293-5.293 5.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0z"
|
||||
></path>
|
||||
</symbol>
|
||||
<symbol id="icon-chevrons-down" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M6.293 13.707l5 5c0.391 0.391 1.024 0.391 1.414 0l5-5c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-4.293 4.293-4.293-4.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414zM6.293 6.707l5 5c0.391 0.391 1.024 0.391 1.414 0l5-5c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-4.293 4.293-4.293-4.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"
|
||||
></path>
|
||||
</symbol>
|
||||
<symbol id="icon-download" viewBox="0 0 24 24">
|
||||
<path d="M15.6 9.6v-7.2h-7.2v7.2h-6l9.6 9.6 9.6-9.6h-6zM0 21.6h24v2.4h-24v-2.4z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-pin" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M13.2 14.4h7.2v-1.2l-3.6-1.2v-9.6l3.6-1.2v-1.2h-16.8v1.2l3.6 1.2v9.6l-3.6 1.2v1.2h7.2v8.4l1.2 1.2 1.2-1.2v-8.4z"
|
||||
></path>
|
||||
</symbol>
|
||||
<symbol id="icon-search" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M15.48 17.184c-1.608 1.259-3.66 2.019-5.889 2.019-5.302 0-9.6-4.298-9.6-9.6s4.298-9.6 9.6-9.6c5.302 0 9.6 4.298 9.6 9.6 0 2.229-0.76 4.281-2.035 5.91l0.016-0.021 6.42 6.396-1.704 1.704-6.396-6.408zM9.6 16.8c3.976 0 7.2-3.224 7.2-7.2s-3.224-7.2-7.2-7.2v0c-3.976 0-7.2 3.224-7.2 7.2s3.224 7.2 7.2 7.2v0z"
|
||||
></path>
|
||||
</symbol>
|
||||
<symbol id="icon-cog" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M21.886 14.303c-1.259-2.181-0.502-4.976 1.691-6.246l-2.358-4.085c-0.674 0.395-1.457 0.622-2.293 0.622-2.52 0-4.563-2.057-4.563-4.594h-4.717c0.006 0.783-0.189 1.577-0.608 2.303-1.259 2.181-4.058 2.923-6.255 1.658l-2.358 4.085c0.679 0.386 1.267 0.951 1.685 1.675 1.257 2.178 0.504 4.967-1.681 6.24l2.358 4.085c0.671-0.391 1.451-0.615 2.283-0.615 2.512 0 4.55 2.044 4.563 4.569h4.717c-0.002-0.775 0.194-1.56 0.609-2.279 1.257-2.177 4.049-2.92 6.244-1.664l2.358-4.085c-0.675-0.386-1.258-0.949-1.674-1.669zM12 16.859c-2.684 0-4.859-2.176-4.859-4.859s2.176-4.859 4.859-4.859c2.684 0 4.859 2.176 4.859 4.859s-2.176 4.859-4.859 4.859z"
|
||||
></path>
|
||||
</symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
<div id="app"></div>
|
||||
<script src="main.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -13,35 +13,33 @@ Vue.use(Meta);
|
||||
Vue.use(Dropdown);
|
||||
Vue.use(Switch);
|
||||
|
||||
Vue.config.ignoredElements = [/^ion-/];
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
component: Index,
|
||||
name: "default"
|
||||
name: "default",
|
||||
},
|
||||
{
|
||||
path: "/container/:id",
|
||||
component: Container,
|
||||
name: "container",
|
||||
props: true
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "/settings",
|
||||
component: Settings,
|
||||
name: "settings"
|
||||
}
|
||||
name: "settings",
|
||||
},
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: "history",
|
||||
base: BASE_PATH + "/",
|
||||
routes
|
||||
routes,
|
||||
});
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
render: (h) => h(App),
|
||||
}).$mount("#app");
|
||||
|
||||
@@ -20,16 +20,16 @@ export default {
|
||||
components: {
|
||||
LogViewerWithSource,
|
||||
ScrollableView,
|
||||
ContainerTitle
|
||||
ContainerTitle,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: "loading"
|
||||
title: "loading",
|
||||
};
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.title
|
||||
title: this.title,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -39,7 +39,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState(["activeContainers"]),
|
||||
...mapGetters(["allContainersById"])
|
||||
...mapGetters(["allContainersById"]),
|
||||
},
|
||||
watch: {
|
||||
id() {
|
||||
@@ -47,7 +47,7 @@ export default {
|
||||
},
|
||||
allContainersById() {
|
||||
this.title = this.allContainersById[this.id].name;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<script>
|
||||
export default {
|
||||
props: [],
|
||||
name: "Default"
|
||||
name: "Default",
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
@@ -31,19 +31,25 @@
|
||||
</b-switch>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<b-switch v-model="showTimestamp">
|
||||
Show timestamps
|
||||
</b-switch>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h2 class="title is-6 is-marginless">Font size</h2>
|
||||
Modify the font size when viewing logs.
|
||||
|
||||
<b-dropdown v-model="size" aria-role="list" style="margin:-8px 10px 0">
|
||||
<b-dropdown v-model="size" aria-role="list" style="margin: -8px 10px 0;">
|
||||
<button class="button is-primary" type="button" slot="trigger">
|
||||
<span class="is-capitalized">{{ size }}</span>
|
||||
<span class="icon"><ion-icon name="ios-arrow-down"></ion-icon></span>
|
||||
<span class="icon"><icon name="chevron-down"></icon></span>
|
||||
</button>
|
||||
<b-dropdown-item :value="value" aria-role="listitem" v-for="value in ['small', 'medium', 'large']">
|
||||
<div class="media">
|
||||
<span class="icon">
|
||||
<ion-icon name="checkmark" v-if="value == size"></ion-icon>
|
||||
<span class="icon keep-size">
|
||||
<icon name="check" v-if="value == size"></icon>
|
||||
</span>
|
||||
<div class="media-content">
|
||||
<h3 class="is-capitalized">{{ value }}</h3>
|
||||
@@ -60,16 +66,19 @@
|
||||
import gt from "semver/functions/gt";
|
||||
import valid from "semver/functions/valid";
|
||||
import { mapActions, mapState } from "vuex";
|
||||
import Icon from "../components/Icon";
|
||||
|
||||
export default {
|
||||
props: [],
|
||||
name: "Settings",
|
||||
components: {},
|
||||
components: {
|
||||
Icon,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentVersion: VERSION,
|
||||
nextRelease: null,
|
||||
hasUpdate: false
|
||||
hasUpdate: false,
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
@@ -79,28 +88,28 @@ export default {
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: "Settings"
|
||||
title: "Settings",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
updateSetting: "UPDATE_SETTING"
|
||||
})
|
||||
updateSetting: "UPDATE_SETTING",
|
||||
}),
|
||||
},
|
||||
computed: {
|
||||
...mapState(["settings"]),
|
||||
...["search", "size", "smallerScrollbars"].reduce((map, name) => {
|
||||
...["search", "size", "smallerScrollbars", "showTimestamp"].reduce((map, name) => {
|
||||
map[name] = {
|
||||
get() {
|
||||
return this.settings[name];
|
||||
},
|
||||
set(value) {
|
||||
this.updateSetting({ [name]: value });
|
||||
}
|
||||
},
|
||||
};
|
||||
return map;
|
||||
}, {})
|
||||
}
|
||||
}, {}),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
@@ -14,7 +14,7 @@ const state = {
|
||||
activeContainers: [],
|
||||
searchFilter: null,
|
||||
isMobile: mql.matches,
|
||||
settings: storage.get(DOZZLE_SETTINGS_KEY)
|
||||
settings: storage.get(DOZZLE_SETTINGS_KEY),
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
@@ -36,7 +36,7 @@ const mutations = {
|
||||
UPDATE_SETTINGS(state, newValues) {
|
||||
state.settings = { ...state.settings, ...newValues };
|
||||
storage.set(DOZZLE_SETTINGS_KEY, state.settings);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const actions = {
|
||||
@@ -55,7 +55,7 @@ const actions = {
|
||||
},
|
||||
UPDATE_SETTING({ commit }, setting) {
|
||||
commit("UPDATE_SETTINGS", setting);
|
||||
}
|
||||
},
|
||||
};
|
||||
const getters = {
|
||||
activeContainersById(state) {
|
||||
@@ -69,18 +69,18 @@ const getters = {
|
||||
map[obj.id] = obj;
|
||||
return map;
|
||||
}, {});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const es = new EventSource(`${BASE_PATH}/api/events/stream`);
|
||||
es.addEventListener("containers-changed", e => setTimeout(() => store.dispatch("FETCH_CONTAINERS"), 1000), false);
|
||||
mql.addListener(e => store.commit("SET_MOBILE_WIDTH", e.matches));
|
||||
es.addEventListener("containers-changed", (e) => setTimeout(() => store.dispatch("FETCH_CONTAINERS"), 1000), false);
|
||||
mql.addListener((e) => store.commit("SET_MOBILE_WIDTH", e.matches));
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
mutations,
|
||||
});
|
||||
|
||||
export default store;
|
||||
|
||||
@@ -3,5 +3,6 @@ export const DEFAULT_SETTINGS = {
|
||||
search: true,
|
||||
size: "medium",
|
||||
menuWidth: 15,
|
||||
smallerScrollbars: false
|
||||
smallerScrollbars: false,
|
||||
showTimestamp: true,
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@ h1.title {
|
||||
html {
|
||||
overflow-x: unset;
|
||||
overflow-y: unset;
|
||||
scroll-snap-type: y proximity;
|
||||
}
|
||||
|
||||
html.has-custom-scrollbars {
|
||||
@@ -55,7 +56,7 @@ html.has-custom-scrollbars {
|
||||
}
|
||||
|
||||
.is-settings-control {
|
||||
|
||||
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
color: #fff;
|
||||
border-color: transparent;
|
||||
@@ -72,3 +73,4 @@ html.has-custom-scrollbars {
|
||||
border-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ func NewClientWithFilters(f map[string]string) Client {
|
||||
|
||||
log.Debugf("filterArgs = %v", filterArgs)
|
||||
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
2
go.mod
2
go.mod
@@ -39,7 +39,7 @@ require (
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/spf13/viper v1.6.2
|
||||
github.com/spf13/viper v1.6.3
|
||||
github.com/stretchr/objx v0.2.0 // indirect
|
||||
github.com/stretchr/testify v1.5.1
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect
|
||||
|
||||
8
go.sum
8
go.sum
@@ -32,6 +32,7 @@ github.com/containerd/containerd v1.3.3 h1:LoIzb5y9x5l8VKAlyrbusNPXqBY0+kviRloxF
|
||||
github.com/containerd/containerd v1.3.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
@@ -100,6 +101,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
@@ -118,6 +120,7 @@ github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht
|
||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
@@ -143,6 +146,9 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
|
||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE=
|
||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
@@ -227,6 +233,8 @@ github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=
|
||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||
github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E=
|
||||
github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k=
|
||||
github.com/spf13/viper v1.6.3 h1:pDDu1OyEDTKzpJwdq4TiuLyMsUgRa/BT5cn5O62NoHs=
|
||||
github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||
|
||||
1
integration/.gitignore
vendored
Normal file
1
integration/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
__diff_output__
|
||||
8
integration/Dockerfile
Normal file
8
integration/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM amir20/docker-alpine-puppeteer:edge
|
||||
|
||||
COPY --chown=pptruser:pptruser package*.json /app/
|
||||
RUN yarn
|
||||
|
||||
COPY --chown=pptruser:pptruser . /app/
|
||||
|
||||
CMD [ "yarn", "test"]
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
18
integration/docker-compose.test.yml
Normal file
18
integration/docker-compose.test.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
version: "3.4"
|
||||
services:
|
||||
dozzle:
|
||||
container_name: dozzle
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
- DOZZLE_FILTER=name=dozzle
|
||||
build:
|
||||
context: ..
|
||||
integration:
|
||||
build:
|
||||
context: .
|
||||
command: npm test
|
||||
environment:
|
||||
- BASE=http://dozzle:8080/
|
||||
depends_on:
|
||||
- dozzle
|
||||
9
integration/jest-puppeteer.config.js
Normal file
9
integration/jest-puppeteer.config.js
Normal file
@@ -0,0 +1,9 @@
|
||||
module.exports = {
|
||||
launch: {
|
||||
headless: process.env.HEADLESS !== "false",
|
||||
defaultViewport: { width: 1920, height: 1200 },
|
||||
args: ["--no-sandbox", "--disable-setuid-sandbox"],
|
||||
executablePath: process.env.CHROME_EXE_PATH || "",
|
||||
},
|
||||
browserContext: "incognito",
|
||||
};
|
||||
5
integration/jest-setup.js
Normal file
5
integration/jest-setup.js
Normal file
@@ -0,0 +1,5 @@
|
||||
const { toMatchImageSnapshot } = require("jest-image-snapshot");
|
||||
|
||||
expect.extend({ toMatchImageSnapshot });
|
||||
|
||||
jest.setTimeout(5000);
|
||||
24
integration/package.json
Normal file
24
integration/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"jest": "^25.2.6",
|
||||
"jest-image-snapshot": "^3.0.1",
|
||||
"puppeteer": "^2.1.1"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "jest-puppeteer",
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest-setup.js"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest-puppeteer": "^4.4.0"
|
||||
}
|
||||
}
|
||||
65
integration/test.js
Normal file
65
integration/test.js
Normal file
@@ -0,0 +1,65 @@
|
||||
const puppeteer = require("puppeteer");
|
||||
const iPhoneX = puppeteer.devices["iPhone X"];
|
||||
const iPadLandscape = puppeteer.devices["iPad landscape"];
|
||||
|
||||
const { BASE } = process.env;
|
||||
|
||||
describe("home page", () => {
|
||||
beforeEach(async () => {
|
||||
await page.goto(BASE, { waitUntil: "networkidle2" });
|
||||
});
|
||||
|
||||
it("renders full page on desktop", async () => {
|
||||
const image = await page.screenshot({ fullPage: true });
|
||||
|
||||
expect(image).toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("renders ipad viewport", async () => {
|
||||
await page.emulate(iPadLandscape);
|
||||
const image = await page.screenshot();
|
||||
|
||||
expect(image).toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("renders iphone viewport", async () => {
|
||||
await page.emulate(iPhoneX);
|
||||
const image = await page.screenshot();
|
||||
|
||||
expect(image).toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
describe("has menu visible", () => {
|
||||
beforeAll(async () => {
|
||||
await jestPuppeteer.resetBrowser();
|
||||
// await page.setViewport({ width: 1920, height: 1200 });
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.goto(BASE, { waitUntil: "networkidle2" });
|
||||
});
|
||||
|
||||
it("and shows one container with correct title", async () => {
|
||||
const menuTitle = await page.$eval("aside ul.menu-list li a", (e) => e.title);
|
||||
|
||||
expect(menuTitle).toEqual("dozzle");
|
||||
});
|
||||
|
||||
it("and menu is clickable", async () => {
|
||||
await page.click("aside ul.menu-list li a");
|
||||
|
||||
const className = await page.$eval("aside ul.menu-list li a", (e) => e.className);
|
||||
|
||||
expect(className).toContain("router-link-exact-active");
|
||||
});
|
||||
|
||||
it("and when clicked shows logs", async () => {
|
||||
await page.click("aside ul.menu-list li a");
|
||||
|
||||
await page.waitForSelector("ul.events li span.text");
|
||||
const text = await page.$eval("ul.events li:nth-child(2) span.text", (e) => e.textContent);
|
||||
|
||||
expect(text).toContain("Dozzle version dev");
|
||||
});
|
||||
});
|
||||
});
|
||||
3888
integration/yarn.lock
Normal file
3888
integration/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
15781
package-lock.json
generated
15781
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dozzle",
|
||||
"version": "1.21.7",
|
||||
"version": "1.22.2",
|
||||
"description": "Realtime log viewer for docker containers. ",
|
||||
"scripts": {
|
||||
"prestart": "npm run clean",
|
||||
@@ -11,7 +11,8 @@
|
||||
"build": "npx parcel build --no-source-maps --public-url '__BASE__' assets/index.html -d static",
|
||||
"clean": "rm -rf static/ a_main-packr.go",
|
||||
"release": "release-it",
|
||||
"test": "jest"
|
||||
"test": "jest",
|
||||
"integration": "docker-compose -f integration/docker-compose.test.yml run --rm integration"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -25,13 +26,13 @@
|
||||
"homepage": "https://github.com/amir20/dozzle#readme",
|
||||
"dependencies": {
|
||||
"ansi-to-html": "^0.6.14",
|
||||
"buefy": "^0.8.13",
|
||||
"bulma": "^0.8.1",
|
||||
"caniuse-lite": "^1.0.30001038",
|
||||
"date-fns": "^2.11.1",
|
||||
"buefy": "^0.8.15",
|
||||
"bulma": "^0.8.2",
|
||||
"caniuse-lite": "^1.0.30001042",
|
||||
"date-fns": "^2.12.0",
|
||||
"hotkeys-js": "^3.7.6",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"semver": "^7.1.3",
|
||||
"semver": "^7.3.2",
|
||||
"splitpanes": "^2.2.1",
|
||||
"store": "^2.0.12",
|
||||
"vue": "^2.6.11",
|
||||
@@ -42,21 +43,21 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/plugin-transform-runtime": "^7.9.0",
|
||||
"@vue/component-compiler-utils": "^3.1.1",
|
||||
"@vue/test-utils": "^1.0.0-beta.29",
|
||||
"@vue/component-compiler-utils": "^3.1.2",
|
||||
"@vue/test-utils": "^1.0.0-beta.33",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-jest": "^25.2.3",
|
||||
"babel-jest": "^25.3.0",
|
||||
"concurrently": "^5.1.0",
|
||||
"eventsourcemock": "^2.0.0",
|
||||
"husky": "^4.2.3",
|
||||
"jest": "^25.2.3",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^25.3.0",
|
||||
"jest-serializer-vue": "^2.0.2",
|
||||
"lint-staged": "^10.0.9",
|
||||
"lint-staged": "^10.1.3",
|
||||
"mockdate": "^2.0.5",
|
||||
"node-fetch": "^2.6.0",
|
||||
"parcel-bundler": "^1.12.4",
|
||||
"prettier": "^2.0.2",
|
||||
"release-it": "^13.4.0",
|
||||
"prettier": "^2.0.4",
|
||||
"release-it": "^13.5.2",
|
||||
"sass": "^1.26.3",
|
||||
"vue-hot-reload-api": "^2.3.4",
|
||||
"vue-jest": "^3.0.5",
|
||||
@@ -76,7 +77,7 @@
|
||||
">5%"
|
||||
],
|
||||
"alias": {
|
||||
"vue": "./node_modules/vue/dist/vue.esm.js"
|
||||
"vue": "./node_modules/vue/dist/vue.runtime.esm.js"
|
||||
},
|
||||
"jest": {
|
||||
"clearMocks": true,
|
||||
@@ -89,7 +90,8 @@
|
||||
"node_modules"
|
||||
],
|
||||
"testPathIgnorePatterns": [
|
||||
"node_modules"
|
||||
"node_modules",
|
||||
"<rootDir>/integration/"
|
||||
],
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules"
|
||||
|
||||
Reference in New Issue
Block a user