From c10e8788d8e0fba484554d7e8d1c25a67135ca2f Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 8 Oct 2020 07:39:15 +1100 Subject: [PATCH] Add logging to kitchen sink --- v2/test/kitchensink/basic.go | 35 ---------------- .../kitchensink/frontend/package-lock.json | 9 ++++ v2/test/kitchensink/frontend/package.json | 1 + v2/test/kitchensink/frontend/rollup.config.js | 4 ++ v2/test/kitchensink/frontend/src/App.svelte | 4 +- .../kitchensink/frontend/src/MainPage.svelte | 5 ++- .../frontend/src/components/CodeBlock.svelte | 35 +++++++++++++--- .../src/pages/{ => logging}/Logging.svelte | 17 +++++++- .../frontend/src/pages/logging/code.go | 42 +++++++++++++++++++ .../frontend/src/pages/logging/code.jsx | 18 ++++++++ v2/test/kitchensink/logger.go | 42 +++++++++++++++++++ v2/test/kitchensink/main.go | 2 +- 12 files changed, 166 insertions(+), 48 deletions(-) delete mode 100644 v2/test/kitchensink/basic.go rename v2/test/kitchensink/frontend/src/pages/{ => logging}/Logging.svelte (74%) create mode 100644 v2/test/kitchensink/frontend/src/pages/logging/code.go create mode 100644 v2/test/kitchensink/frontend/src/pages/logging/code.jsx create mode 100644 v2/test/kitchensink/logger.go diff --git a/v2/test/kitchensink/basic.go b/v2/test/kitchensink/basic.go deleted file mode 100644 index 65b980c5..00000000 --- a/v2/test/kitchensink/basic.go +++ /dev/null @@ -1,35 +0,0 @@ -package main - -import ( - "fmt" - - wails "github.com/wailsapp/wails/v2" -) - -// Basic application struct -type Basic struct { - runtime *wails.Runtime -} - -// newBasic creates a new Basic application struct -func newBasic() *Basic { - return &Basic{} -} - -// WailsInit is called at application startup -func (b *Basic) WailsInit(runtime *wails.Runtime) error { - // Perform your setup here - b.runtime = runtime - runtime.Window.SetTitle("kitchensink") - return nil -} - -// WailsShutdown is called at application termination -func (b *Basic) WailsShutdown() { - // Perform your teardown here -} - -// Greet returns a greeting for the given name -func (b *Basic) Greet(name string) string { - return fmt.Sprintf("Hello %s!", name) -} diff --git a/v2/test/kitchensink/frontend/package-lock.json b/v2/test/kitchensink/frontend/package-lock.json index 4673a432..be9cccb5 100644 --- a/v2/test/kitchensink/frontend/package-lock.json +++ b/v2/test/kitchensink/frontend/package-lock.json @@ -3121,6 +3121,15 @@ } } }, + "rollup-plugin-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-string/-/rollup-plugin-string-3.0.0.tgz", + "integrity": "sha512-vqyzgn9QefAgeKi+Y4A7jETeIAU1zQmS6VotH6bzm/zmUQEnYkpIGRaOBPY41oiWYV4JyBoGAaBjYMYuv+6wVw==", + "dev": true, + "requires": { + "rollup-pluginutils": "^2.4.1" + } + }, "rollup-plugin-svelte": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/rollup-plugin-svelte/-/rollup-plugin-svelte-5.2.3.tgz", diff --git a/v2/test/kitchensink/frontend/package.json b/v2/test/kitchensink/frontend/package.json index 623fd4ad..25b0c5aa 100644 --- a/v2/test/kitchensink/frontend/package.json +++ b/v2/test/kitchensink/frontend/package.json @@ -18,6 +18,7 @@ "rollup": "^2.0.0", "rollup-plugin-livereload": "^1.0.0", "rollup-plugin-postcss": "^3.1.8", + "rollup-plugin-string": "^3.0.0", "rollup-plugin-svelte": "^5.0.3", "rollup-plugin-terser": "^5.1.2", "sirv-cli": "^0.4.4", diff --git a/v2/test/kitchensink/frontend/rollup.config.js b/v2/test/kitchensink/frontend/rollup.config.js index 873b7603..c49c2e7e 100644 --- a/v2/test/kitchensink/frontend/rollup.config.js +++ b/v2/test/kitchensink/frontend/rollup.config.js @@ -5,6 +5,7 @@ import livereload from 'rollup-plugin-livereload'; import { terser } from 'rollup-plugin-terser'; import postcss from 'rollup-plugin-postcss'; import autoPreprocess from 'svelte-preprocess'; +import { string } from "rollup-plugin-string"; const production = !process.env.ROLLUP_WATCH; @@ -18,6 +19,9 @@ export default { }, onwarn: handleRollupWarning, plugins: [ + string({ + include: ["**/*.jsx","**/*.go"], + }), svelte({ preprocess: autoPreprocess(), // enable run-time checks when not in production diff --git a/v2/test/kitchensink/frontend/src/App.svelte b/v2/test/kitchensink/frontend/src/App.svelte index 1b1472e7..b89f54ce 100644 --- a/v2/test/kitchensink/frontend/src/App.svelte +++ b/v2/test/kitchensink/frontend/src/App.svelte @@ -93,8 +93,8 @@ /* Switch */ --dm-switch-bg-color: rgb(28,173,213); --lm-switch-bg-color: rgb(28,173,213); - --dm-switch-bg-color-checked: rgb(239,218,91); - --lm-switch-bg-color-checked: rgb(239,218,91); + --dm-switch-bg-color-checked: rgb(186,167,49); + --lm-switch-bg-color-checked: rgb(186,167,49); --lm-switch-slider-bg-color: #FFF; --dm-switch-slider-bg-color: #FFF; } diff --git a/v2/test/kitchensink/frontend/src/MainPage.svelte b/v2/test/kitchensink/frontend/src/MainPage.svelte index 5feb94ee..a37f3780 100644 --- a/v2/test/kitchensink/frontend/src/MainPage.svelte +++ b/v2/test/kitchensink/frontend/src/MainPage.svelte @@ -2,13 +2,13 @@ import {selectedPage} from './Store'; import TitlePage from './pages/TitlePage.svelte'; - import Logging from './pages/Logging.svelte'; + import Logging from './pages/logging/Logging.svelte'; import Events from './pages/Events.svelte';
- {#if $selectedPage == undefined} {/if} + {#if $selectedPage == undefined} {/if} {#if $selectedPage == "Logging"} {/if} {#if $selectedPage == "Events"} {/if}
@@ -18,5 +18,6 @@ margin-top: 60px; margin-left: 45px; margin-right: 45px; + margin-bottom: 60px; } \ No newline at end of file diff --git a/v2/test/kitchensink/frontend/src/components/CodeBlock.svelte b/v2/test/kitchensink/frontend/src/components/CodeBlock.svelte index 3d532cc0..6a518f9c 100644 --- a/v2/test/kitchensink/frontend/src/components/CodeBlock.svelte +++ b/v2/test/kitchensink/frontend/src/components/CodeBlock.svelte @@ -2,17 +2,29 @@ -
+
- Title + Title Go @@ -21,13 +33,17 @@
+ {#if !hidden} + {/if}
\ No newline at end of file diff --git a/v2/test/kitchensink/frontend/src/pages/Logging.svelte b/v2/test/kitchensink/frontend/src/pages/logging/Logging.svelte similarity index 74% rename from v2/test/kitchensink/frontend/src/pages/Logging.svelte rename to v2/test/kitchensink/frontend/src/pages/logging/Logging.svelte index b4c4945a..f650c19d 100644 --- a/v2/test/kitchensink/frontend/src/pages/Logging.svelte +++ b/v2/test/kitchensink/frontend/src/pages/logging/Logging.svelte @@ -1,15 +1,27 @@