mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Rework insights popup
This commit is contained in:
parent
752e04b955
commit
c790870ae6
12 changed files with 139 additions and 6 deletions
|
@ -22,6 +22,7 @@ apply from: "$projectDir/gradle_scripts/github-api.gradle"
|
|||
apply from: "$projectDir/gradle_scripts/flexmark.gradle"
|
||||
apply from: "$rootDir/gradle/gradle_scripts/picocli.gradle"
|
||||
apply from: "$rootDir/gradle/gradle_scripts/versioncompare.gradle"
|
||||
apply from: "$rootDir/gradle/gradle_scripts/markdowngenerator.gradle"
|
||||
|
||||
configurations {
|
||||
implementation.extendsFrom(dep)
|
||||
|
|
|
@ -212,7 +212,8 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
|
|||
() -> {
|
||||
return provider.getValue() == null
|
||||
|| store.getValue() == null
|
||||
|| !store.getValue().isComplete();
|
||||
|| !store.getValue().isComplete()
|
||||
|| provider.getValue().createInsightsMarkdown(store.getValue()) == null;
|
||||
},
|
||||
provider,
|
||||
store);
|
||||
|
@ -225,8 +226,8 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
|
|||
.createRegion()
|
||||
: null;
|
||||
}),
|
||||
true)
|
||||
.disable(disable)
|
||||
true)
|
||||
.hide(disable)
|
||||
.styleClass("button-comp");
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public interface DataStoreProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
return createInsightsMarkdown(store.getValue());
|
||||
return "## Insights\n\n" + createInsightsMarkdown(store.getValue());
|
||||
},
|
||||
store);
|
||||
return new MarkdownComp(content, s -> s)
|
||||
|
|
|
@ -104,7 +104,10 @@ public class OptionsComp extends Comp<CompStructure<Pane>> {
|
|||
extendedDescription.getStyleClass().add("long-description");
|
||||
extendedDescription.setAccessibleText("Help");
|
||||
AppFont.header(extendedDescription);
|
||||
extendedDescription.setOnAction(e -> popover.show(extendedDescription));
|
||||
extendedDescription.setOnAction(e -> {
|
||||
popover.show(extendedDescription);
|
||||
e.consume();
|
||||
});
|
||||
|
||||
var descriptionBox = new HBox(description, new Spacer(Orientation.HORIZONTAL), extendedDescription);
|
||||
descriptionBox.setSpacing(5);
|
||||
|
|
50
app/src/main/java/io/xpipe/app/util/MarkdownBuilder.java
Normal file
50
app/src/main/java/io/xpipe/app/util/MarkdownBuilder.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package io.xpipe.app.util;
|
||||
|
||||
import net.steppschuh.markdowngenerator.MarkdownElement;
|
||||
import net.steppschuh.markdowngenerator.text.code.Code;
|
||||
import net.steppschuh.markdowngenerator.text.code.CodeBlock;
|
||||
|
||||
public class MarkdownBuilder {
|
||||
|
||||
public static MarkdownBuilder of() {
|
||||
return new MarkdownBuilder();
|
||||
}
|
||||
|
||||
private final StringBuilder builder = new StringBuilder();
|
||||
|
||||
private MarkdownBuilder() {}
|
||||
|
||||
public MarkdownBuilder add(String t) {
|
||||
builder.append(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MarkdownBuilder line() {
|
||||
builder.append("\n");
|
||||
return this;
|
||||
}
|
||||
|
||||
public MarkdownBuilder addCode(String s) {
|
||||
builder.append(new Code(s).getSerialized(""));
|
||||
return this;
|
||||
}
|
||||
|
||||
public MarkdownBuilder addCodeBlock(String s) {
|
||||
builder.append("\n\n").append(new CodeBlock(s).getSerialized(""));
|
||||
return this;
|
||||
}
|
||||
|
||||
public MarkdownBuilder addLine(MarkdownElement t) {
|
||||
builder.append(t.getSerialized("")).append("\n");
|
||||
return this;
|
||||
}
|
||||
|
||||
public MarkdownBuilder addParagraph(String s) {
|
||||
builder.append("\n\n").append(s);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String build() {
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
|
@ -83,6 +83,7 @@ open module io.xpipe.app {
|
|||
requires jdk.management.agent;
|
||||
requires com.jthemedetector;
|
||||
requires versioncompare;
|
||||
requires net.steppschuh.markdowngenerator;
|
||||
|
||||
// Required by extensions
|
||||
requires java.security.jgss;
|
||||
|
|
|
@ -7,7 +7,7 @@ html {
|
|||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
margin: 0;
|
||||
padding: 1em;
|
||||
padding: 0 1em 1em 1em;
|
||||
color: #c9d1d9;
|
||||
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";
|
||||
font-size: 14px;
|
||||
|
|
21
dist/licenses/javamarkdowngenerator.license
vendored
Normal file
21
dist/licenses/javamarkdowngenerator.license
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016 Stephan Schultz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
4
dist/licenses/javamarkdowngenerator.properties
vendored
Normal file
4
dist/licenses/javamarkdowngenerator.properties
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
name=Java-Markdown-Generator
|
||||
version=1.3.1.1
|
||||
license=MIT License
|
||||
link=https://github.com/Steppschuh/Java-Markdown-Generator
|
|
@ -17,6 +17,7 @@ import io.xpipe.app.fxcomps.impl.DataStoreListChoiceComp;
|
|||
import io.xpipe.app.fxcomps.util.BindingsHelper;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.MarkdownBuilder;
|
||||
import io.xpipe.app.util.OptionsBuilder;
|
||||
import io.xpipe.core.process.ShellDialect;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
|
@ -34,9 +35,29 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SimpleScriptStoreProvider implements DataStoreProvider {
|
||||
|
||||
public String createInsightsMarkdown(DataStore store) {
|
||||
var s = (SimpleScriptStore) store;
|
||||
|
||||
var builder = MarkdownBuilder.of().addParagraph("XPipe will run the script in ")
|
||||
.addCode(s.getMinimumDialect() != null ? s.getMinimumDialect().getDisplayName() : "default").add(" shells");
|
||||
|
||||
if (s.getEffectiveScripts() != null && !s.getEffectiveScripts().isEmpty()) {
|
||||
builder.add(" with the following scripts prior").addCodeBlock(s.getEffectiveScripts().stream()
|
||||
.map(scriptStoreDataStoreEntryRef -> scriptStoreDataStoreEntryRef.get().getName()).collect(
|
||||
Collectors.joining("\n")));
|
||||
}
|
||||
|
||||
if (s.getCommands() != null) {
|
||||
builder.addParagraph("with command contents").addCodeBlock(s.getCommands());
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comp<?> stateDisplay(StoreEntryWrapper w) {
|
||||
return new SystemStateComp(new SimpleObjectProperty<>(SystemStateComp.State.SUCCESS));
|
||||
|
|
BIN
gradle/gradle_scripts/markdowngenerator-1.3.1.1.jar
Normal file
BIN
gradle/gradle_scripts/markdowngenerator-1.3.1.1.jar
Normal file
Binary file not shown.
31
gradle/gradle_scripts/markdowngenerator.gradle
Normal file
31
gradle/gradle_scripts/markdowngenerator.gradle
Normal file
|
@ -0,0 +1,31 @@
|
|||
dependencies {
|
||||
implementation files("${project.layout.buildDirectory.get()}/generated-modules/markdowngenerator-1.3.1.1.jar")
|
||||
}
|
||||
|
||||
addDependenciesModuleInfo {
|
||||
overwriteExistingFiles = true
|
||||
jdepsExtraArgs = ['-q']
|
||||
outputDirectory = file("${project.layout.buildDirectory.get()}/generated-modules")
|
||||
modules {
|
||||
module {
|
||||
artifact (name: "markdowngenerator-1.3.1.1")
|
||||
moduleInfoSource = '''
|
||||
module net.steppschuh.markdowngenerator {
|
||||
exports net.steppschuh.markdowngenerator;
|
||||
exports net.steppschuh.markdowngenerator.image;
|
||||
exports net.steppschuh.markdowngenerator.link;
|
||||
exports net.steppschuh.markdowngenerator.list;
|
||||
exports net.steppschuh.markdowngenerator.progress;
|
||||
exports net.steppschuh.markdowngenerator.rule;
|
||||
exports net.steppschuh.markdowngenerator.table;
|
||||
exports net.steppschuh.markdowngenerator.text;
|
||||
exports net.steppschuh.markdowngenerator.text.code;
|
||||
exports net.steppschuh.markdowngenerator.text.emphasis;
|
||||
exports net.steppschuh.markdowngenerator.text.heading;
|
||||
exports net.steppschuh.markdowngenerator.text.quote;
|
||||
exports net.steppschuh.markdowngenerator.util;
|
||||
}
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue