-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If plugin fails to update show error menu
- Loading branch information
Showing
5 changed files
with
60 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import SwiftUI | ||
|
||
struct PluginErrorView: View { | ||
var plugin: Plugin | ||
var lastUpdateDate: String { | ||
let date = plugin.lastUpdated ?? Date.distantPast | ||
let formatter = DateFormatter() | ||
formatter.dateStyle = .medium | ||
formatter.timeStyle = .medium | ||
return formatter.string(from: date) | ||
} | ||
var body: some View { | ||
ScrollView(showsIndicators: true) { | ||
Form { | ||
LabelView(label: "Plugin:", value: plugin.name) | ||
LabelView(label: "File:", value: plugin.file) | ||
LabelView(label: "Runned at:", value: lastUpdateDate) | ||
LabelView(label: "Error:", value: plugin.error?.message ?? "none") | ||
LabelView(label: "Script Output:", value:plugin.error?.output ?? "none") | ||
}.padding() | ||
.frame(width: 500) | ||
} | ||
} | ||
} | ||
|
||
struct PluginErrorView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
PluginErrorView(plugin: ExecutablePlugin(fileURL: URL(string:"/Users/melonamin/Downloads/bitbar-scripts-copy/mounted.5s.sh")!)) | ||
} | ||
} |