Skip to content

Commit

Permalink
Reformats code
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 committed Mar 30, 2020
1 parent 564d089 commit 024dd22
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 84 deletions.
16 changes: 8 additions & 8 deletions assets/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,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() {
Expand All @@ -89,27 +89,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>

Expand Down
6 changes: 3 additions & 3 deletions assets/components/ContainerTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export default {
value: String,
closable: {
type: Boolean,
default: false
}
default: false,
},
},
name: "ContainerTitle"
name: "ContainerTitle",
};
</script>

Expand Down
8 changes: 4 additions & 4 deletions assets/components/InfiniteLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -31,7 +31,7 @@ export default {
);
intersectionObserver.observe(this.$refs.observer);
}
},
};
</script>
<style scoped lang="scss"></style>
18 changes: 9 additions & 9 deletions assets/components/LogEventSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ function parseMessage(data) {
return {
key,
date,
message
message,
};
}
export default {
props: ["id"],
name: "LogEventSource",
components: {
InfiniteLoader
InfiniteLoader,
},
data() {
return {
messages: [],
buffer: []
buffer: [],
};
},
created() {
Expand All @@ -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() {
Expand All @@ -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>
23 changes: 10 additions & 13 deletions assets/components/LogViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ export default {
components: {},
data() {
return {
showSearch: false
showSearch: false,
};
},
methods: {
colorize: function(value) {
return ansiConvertor
.toHtml(value)
.replace("&lt;mark&gt;", "<mark>")
.replace("&lt;/mark&gt;", "</mark>");
}
colorize: function (value) {
return ansiConvertor.toHtml(value).replace("&lt;mark&gt;", "<mark>").replace("&lt;/mark&gt;", "</mark>");
},
},
computed: {
...mapState(["searchFilter", "settings"]),
Expand All @@ -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) {
Expand All @@ -54,13 +51,13 @@ export default {
}
}
return messages;
}
},
},
filters: {
relativeTime(date) {
return formatRelative(date, new Date());
}
}
},
},
};
</script>
<style scoped lang="scss">
Expand Down
4 changes: 2 additions & 2 deletions assets/components/LogViewerWithSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
name: "LogViewerWithSource",
components: {
LogEventSource,
LogViewer
}
LogViewer,
},
};
</script>
10 changes: 5 additions & 5 deletions assets/components/MobileMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
14 changes: 7 additions & 7 deletions assets/components/ScrollableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ export default {
props: {
scrollable: {
type: Boolean,
default: true
}
default: true,
},
},
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 {
Expand All @@ -48,7 +48,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" }
);
Expand All @@ -59,8 +59,8 @@ export default {
scrollToBottom(behavior = "instant") {
this.$refs.scrollObserver.scrollIntoView({ behavior });
this.hasMore = false;
}
}
},
},
};
</script>
<style scoped lang="scss">
Expand Down
12 changes: 6 additions & 6 deletions assets/components/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
name: "Search",
data() {
return {
showSearch: false
showSearch: false,
};
},
mounted() {
Expand All @@ -45,12 +45,12 @@ export default {
},
methods: {
...mapActions({
updateSearchFilter: "SET_SEARCH"
updateSearchFilter: "SET_SEARCH",
}),
resetSearch() {
this.showSearch = false;
this.filter = "";
}
},
},
computed: {
...mapState(["searchFilter", "settings"]),
Expand All @@ -60,9 +60,9 @@ export default {
},
set(value) {
this.updateSearchFilter(value);
}
}
}
},
},
},
};
</script>

Expand Down
8 changes: 4 additions & 4 deletions assets/components/SideMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ export default {
},
computed: {
...mapState(["containers", "activeContainers"]),
...mapGetters(["activeContainersById"])
...mapGetters(["activeContainersById"]),
},
methods: {
...mapActions({
appendActiveContainer: "APPEND_ACTIVE_CONTAINER"
})
}
appendActiveContainer: "APPEND_ACTIVE_CONTAINER",
}),
},
};
</script>
<style scoped lang="scss">
Expand Down
12 changes: 6 additions & 6 deletions assets/pages/Container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -39,15 +39,15 @@ export default {
},
computed: {
...mapState(["activeContainers"]),
...mapGetters(["allContainersById"])
...mapGetters(["allContainersById"]),
},
watch: {
id() {
this.title = this.allContainersById[this.id].name;
},
allContainersById() {
this.title = this.allContainersById[this.id].name;
}
}
},
},
};
</script>
2 changes: 1 addition & 1 deletion assets/pages/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script>
export default {
props: [],
name: "Default"
name: "Default",
};
</script>
<style scoped>
Expand Down
Loading

0 comments on commit 024dd22

Please sign in to comment.