From 9a727b081f849d18fc3637af9edf5b4021ca64ae Mon Sep 17 00:00:00 2001 From: DaveyJonesBitPail <119518234+DaveyJonesBitPail@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:16:57 +0100 Subject: [PATCH] Add direct feedback capability (#45) * Add feedback button * Change feedback button text * Bump version * Add yaml issue and discussion templates * Appease MegaLinter * Adapt ProgramNameAndVersion UT * Add issue labeler for selected tool * Add new line buttons to AboutView * Remove whitespace flagged by linter * Fix typos * Fix more linter complaints * Fix more/new linter errors * Rename GitHub btn * Add test to ensure URL is unchanged * (try to) fix some Linter-complaints * more "lint for yaml"-fixes * one more linter-fix --------- Co-authored-by: ptahmose --- .../czi-compress-feature-requests.yml | 26 +++++ .../czi-compress-feedback.yml | 16 +++ .../czi-compress-questions.yml | 10 ++ .../czi-shrink-feature-requests.yml | 26 +++++ .../czi-shrink-feedback.yml | 16 +++ .../czi-shrink-questions.yml | 10 ++ .github/ISSUE_TEMPLATE/bug_report.md | 38 ------- .github/ISSUE_TEMPLATE/bug_report.yml | 76 +++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 21 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ---- .github/advanced-issue-labeler.yml | 10 ++ .github/workflows/issue_labeler.yml | 30 ++++++ czishrink/Directory.Build.props | 2 +- .../ViewModels/AboutViewModel.cs | 8 ++ .../ViewModels/IAboutViewModel.cs | 2 + .../netczicompress/Views/AboutView.axaml | 102 +++++++++++------- .../Models/ProgramNameAndVersionTests.cs | 6 +- .../ViewModels/AboutViewModelTests.cs | 18 ++++ 18 files changed, 337 insertions(+), 100 deletions(-) create mode 100644 .github/DISCUSSION_TEMPLATE/czi-compress-feature-requests.yml create mode 100644 .github/DISCUSSION_TEMPLATE/czi-compress-feedback.yml create mode 100644 .github/DISCUSSION_TEMPLATE/czi-compress-questions.yml create mode 100644 .github/DISCUSSION_TEMPLATE/czi-shrink-feature-requests.yml create mode 100644 .github/DISCUSSION_TEMPLATE/czi-shrink-feedback.yml create mode 100644 .github/DISCUSSION_TEMPLATE/czi-shrink-questions.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/advanced-issue-labeler.yml create mode 100644 .github/workflows/issue_labeler.yml diff --git a/.github/DISCUSSION_TEMPLATE/czi-compress-feature-requests.yml b/.github/DISCUSSION_TEMPLATE/czi-compress-feature-requests.yml new file mode 100644 index 0000000..a642966 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/czi-compress-feature-requests.yml @@ -0,0 +1,26 @@ +--- +labels: ["czicompress", "enhancement"] +body: + - type: textarea + id: problem + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Ex. I'm always frustrated when... + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + validations: + required: true + + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. + validations: + required: false diff --git a/.github/DISCUSSION_TEMPLATE/czi-compress-feedback.yml b/.github/DISCUSSION_TEMPLATE/czi-compress-feedback.yml new file mode 100644 index 0000000..abba07c --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/czi-compress-feedback.yml @@ -0,0 +1,16 @@ +--- +labels: ["czicompress", "feedback"] +body: + - type: markdown + attributes: + value: | + Thank you for your interest in CZI Compress! + + Your feedback helps us improve 💪 + - type: textarea + id: content + attributes: + label: Feedback + description: Tell us your thoughts! + validations: + required: true diff --git a/.github/DISCUSSION_TEMPLATE/czi-compress-questions.yml b/.github/DISCUSSION_TEMPLATE/czi-compress-questions.yml new file mode 100644 index 0000000..7e3fbf5 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/czi-compress-questions.yml @@ -0,0 +1,10 @@ +--- +labels: ["czicompress", "question"] +body: + - type: textarea + id: question + attributes: + label: Question + description: Please add any screenshots or logs if applicable + validations: + required: true diff --git a/.github/DISCUSSION_TEMPLATE/czi-shrink-feature-requests.yml b/.github/DISCUSSION_TEMPLATE/czi-shrink-feature-requests.yml new file mode 100644 index 0000000..1df0ab9 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/czi-shrink-feature-requests.yml @@ -0,0 +1,26 @@ +--- +labels: ["czishrink", "enhancement"] +body: + - type: textarea + id: problem + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Ex. I'm always frustrated when... + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + validations: + required: true + + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. + validations: + required: false diff --git a/.github/DISCUSSION_TEMPLATE/czi-shrink-feedback.yml b/.github/DISCUSSION_TEMPLATE/czi-shrink-feedback.yml new file mode 100644 index 0000000..284241c --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/czi-shrink-feedback.yml @@ -0,0 +1,16 @@ +--- +labels: ["czishrink", "feedback"] +body: + - type: markdown + attributes: + value: | + Thank you for your interest in CZI Shrink! + + Your feedback helps us improve 💪 + - type: textarea + id: content + attributes: + label: Feedback + description: Tell us your thoughts! + validations: + required: true diff --git a/.github/DISCUSSION_TEMPLATE/czi-shrink-questions.yml b/.github/DISCUSSION_TEMPLATE/czi-shrink-questions.yml new file mode 100644 index 0000000..2d5bb4e --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/czi-shrink-questions.yml @@ -0,0 +1,10 @@ +--- +labels: ["czishrink", "question"] +body: + - type: textarea + id: question + attributes: + label: Question + description: Please add any screenshots or logs if applicable + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea7..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..c53cf01 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,76 @@ +--- +name: "🕷️ Bug report" +description: Create a report to help us improve +labels: + - bug +body: + - type: dropdown + id: toolaffected + attributes: + label: Which tool is affected? + description: CZI Shrink is the GUI application while CZI Compress refers to the CLI tool. + multiple: false + options: + - CZI Compress + - CZI Shrink + validations: + required: true + + - type: textarea + attributes: + label: Description + description: Describe the bug and add screenshots if possible/applicable. + placeholder: A clear and concise description of what the bug is. + validations: + required: true + + - type: textarea + attributes: + label: Steps to reproduce + description: Please include screenshots (if applicable) and relevant logs. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + + - type: textarea + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + + - type: dropdown + attributes: + label: OS + description: What operating system are you using? + multiple: false + options: + - Windows + - MacOS + - Linux + validations: + required: true + + - type: input + attributes: + label: OS Version + description: What version and flavor (if applicable) of your OS are you using? + placeholder: Ubuntu 23.10 | Sonoma 14.1.2 | Windows 11 23H2 + validations: + required: true + + - type: textarea + attributes: + label: Other Context + description: Please add any other context that may be relevant. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..adade0a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,21 @@ +--- +blank_issues_enabled: false +contact_links: + - name: "\U0000270D CZI Shrink Feedback" + url: https://github.com/ZEISS/czicompress/discussions/new?category=czi-shrink-feedback + about: Feedback for the GUI tool CZI Shrink + - name: "\U0001F4A1 CZI Shrink Feature Request" + url: https://github.com/ZEISS/czicompress/discussions/new?category=czi-shrink-feature-requests + about: Feature request for the GUI tool CZI Shrink + - name: "\U0000003F CZI Shrink Questions" + url: https://github.com/ZEISS/czicompress/discussions/new?category=czi-shrink-questions + about: Questions about the GUI tool CZI Shrink + - name: "\U0000270D CZI Compress Feedback" + url: https://github.com/ZEISS/czicompress/discussions/new?category=czi-compress-feedback + about: Feedback for the CLI tool CZI Compress + - name: "\U0001F4A1 CZI Compress Feature Request" + url: https://github.com/ZEISS/czicompress/discussions/new?category=czi-compress-feature-requests + about: Feature request for the CLI tool CZI Compress + - name: "\U0000003F CZI Compress Questions" + url: https://github.com/ZEISS/czicompress/discussions/new?category=czi-compress-questions + about: Questions about the CLI tool CZI Compress diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/advanced-issue-labeler.yml b/.github/advanced-issue-labeler.yml new file mode 100644 index 0000000..1931eb5 --- /dev/null +++ b/.github/advanced-issue-labeler.yml @@ -0,0 +1,10 @@ +--- +policy: + - section: + - id: [toolaffected] + block-list: ['None', 'Other'] + label: + - name: czicompress + keys: ['CZI Compress'] + - name: 'czishrink' + keys: ['CZI Shrink'] diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml new file mode 100644 index 0000000..206c74a --- /dev/null +++ b/.github/workflows/issue_labeler.yml @@ -0,0 +1,30 @@ +--- +name: Bug issue labeler +on: + issues: + types: [opened] + +permissions: + contents: read + +jobs: + label-component: + runs-on: ubuntu-latest + + permissions: + issues: write + + steps: + - uses: actions/checkout@v3 + + - name: Parse issue form + uses: stefanbuck/github-issue-parser@c1a559d78bfb8dd05216dab9ffd2b91082ff5324 + id: issue-parser + with: + template-path: .github/ISSUE_TEMPLATE/bug_report.yml + + - name: Set labels based on toolaffected field + uses: redhat-plumbers-in-action/advanced-issue-labeler@v2 + with: + issue-form: ${{ steps.issue-parser.outputs.jsonString }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/czishrink/Directory.Build.props b/czishrink/Directory.Build.props index dbf09fd..34a37d9 100644 --- a/czishrink/Directory.Build.props +++ b/czishrink/Directory.Build.props @@ -17,6 +17,6 @@ false - 1.1.6 + 1.2.0 diff --git a/czishrink/netczicompress/ViewModels/AboutViewModel.cs b/czishrink/netczicompress/ViewModels/AboutViewModel.cs index 7228770..0ab475c 100644 --- a/czishrink/netczicompress/ViewModels/AboutViewModel.cs +++ b/czishrink/netczicompress/ViewModels/AboutViewModel.cs @@ -24,6 +24,7 @@ public AboutViewModel(IFileLauncher launcher, IProgramNameAndVersion info) this.CloseAboutCommand = ReactiveCommand.Create(() => this.IsVisible = false); this.ShowAboutCommand = ReactiveCommand.Create(() => this.IsVisible = true); this.ShowTextFileCommand = ReactiveCommand.CreateFromTask(this.OpenTextFile); + this.OpenUrlCommand = ReactiveCommand.CreateFromTask(this.OpenUrlLink); this.ProgramVersionAndCopyRight = $"{info}, © 2023 Carl Zeiss Microscopy GmbH and others"; this.launcher = launcher; } @@ -41,9 +42,16 @@ public AboutViewModel(IFileLauncher launcher, IProgramNameAndVersion info) public ICommand ShowTextFileCommand { get; } + public ICommand OpenUrlCommand { get; } + private Task OpenTextFile(string filename) { var fullFilename = System.IO.Path.Combine(AppContext.BaseDirectory, filename); return this.launcher.Launch(fullFilename); } + + private Task OpenUrlLink(string url) + { + return this.launcher.Launch(url); + } } diff --git a/czishrink/netczicompress/ViewModels/IAboutViewModel.cs b/czishrink/netczicompress/ViewModels/IAboutViewModel.cs index 585227e..3f17378 100644 --- a/czishrink/netczicompress/ViewModels/IAboutViewModel.cs +++ b/czishrink/netczicompress/ViewModels/IAboutViewModel.cs @@ -18,4 +18,6 @@ public interface IAboutViewModel string LibraryName { get; } ICommand ShowTextFileCommand { get; } + + ICommand OpenUrlCommand { get; } } \ No newline at end of file diff --git a/czishrink/netczicompress/Views/AboutView.axaml b/czishrink/netczicompress/Views/AboutView.axaml index f412b24..eb5c405 100644 --- a/czishrink/netczicompress/Views/AboutView.axaml +++ b/czishrink/netczicompress/Views/AboutView.axaml @@ -1,41 +1,65 @@ - - - - - - - - - - - This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - - - - - + x:Class="netczicompress.Views.AboutView" + xmlns="https://github.com/avaloniaui" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:vm="clr-namespace:netczicompress.ViewModels" + d:DesignHeight="450" + d:DesignWidth="300" + x:DataType="vm:AboutViewModel" + mc:Ignorable="d"> + + + + + + + + + + + + + + + + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + + + + + diff --git a/czishrink/netczicompressTests/Models/ProgramNameAndVersionTests.cs b/czishrink/netczicompressTests/Models/ProgramNameAndVersionTests.cs index 9251b45..c3208d9 100644 --- a/czishrink/netczicompressTests/Models/ProgramNameAndVersionTests.cs +++ b/czishrink/netczicompressTests/Models/ProgramNameAndVersionTests.cs @@ -9,6 +9,8 @@ namespace netczicompressTests.Models; /// public class ProgramNameAndVersionTests { + private static readonly (int Major, int Minor) Version = (1, 2); + [Fact] public void ToString_WhenCalled_ReturnsExpected() { @@ -16,7 +18,7 @@ public void ToString_WhenCalled_ReturnsExpected() var actual = new ProgramNameAndVersion().ToString(); // ASSERT - actual.Should().MatchRegex(@"^CZI Shrink 1\.1\.\d+(\+\d+)?$"); + actual.Should().MatchRegex($@"^CZI Shrink {Version.Major}\.{Version.Minor}\.\d+(\+\d+)?$"); } [Fact] @@ -36,6 +38,6 @@ public void Version_WhenCalled_ReturnsExpected() var actual = new ProgramNameAndVersion().Version; // ASSERT - actual.Should().MatchRegex(@"^1\.1\.\d+(\+\d+)?$"); + actual.Should().MatchRegex($@"^{Version.Major}\.{Version.Minor}\.\d+(\+\d+)?$"); } } diff --git a/czishrink/netczicompressTests/ViewModels/AboutViewModelTests.cs b/czishrink/netczicompressTests/ViewModels/AboutViewModelTests.cs index 48105f0..44be0e9 100644 --- a/czishrink/netczicompressTests/ViewModels/AboutViewModelTests.cs +++ b/czishrink/netczicompressTests/ViewModels/AboutViewModelTests.cs @@ -106,6 +106,24 @@ public void ShowTextFileCommand_WhenCalled_LaunchesFileFromBaseDirectory() launcherMock.Verify(x => x.Launch(expectedFileName), Times.Once); } + [Fact] + public void OpenUrlCommandCommand_WhenCalled_DoesNotModifyUrl() + { + // ARRANGE + IFixture fixture = CreateFixture(); + var launcherMock = fixture.Freeze>(); + + var sut = fixture.Create(); + const string url = "https://www.test.domain"; + + // ACT + sut.OpenUrlCommand.CanExecute(url).Should().BeTrue(); + sut.OpenUrlCommand.Execute(url); + + // ASSERT + launcherMock.Verify(x => x.Launch(url), Times.Once); + } + private static IFixture CreateFixture() { // ARRANGE