Skip to content

Commit e632620

Browse files
committed
[overlay] refine message when log view is empty
some more win stuff too
1 parent 52a78b0 commit e632620

8 files changed

Lines changed: 102 additions & 22 deletions

File tree

.github/workflows/bins.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,13 @@ jobs:
324324
github-artifact-id: "${{steps.upload-unsigned-artifact.outputs.artifact-id}}"
325325
wait-for-completion: true
326326
output-artifact-directory: 'lnav-signed'
327+
- name: upload-unsigned-artifact
328+
id: upload-unsigned-artifact
329+
uses: actions/upload-artifact@v4
330+
with:
331+
name: lnav-signed-windows-${{ matrix.arch }}.zip
332+
path: "lnav-signed"
333+
if-no-files-found: error
327334
- name: Upload windows archive
328335
uses: actions/upload-release-asset@v1.0.2
329336
if: ${{ inputs.upload_url != '' }}

.signpath/artifact-configurations/default.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
</for-each>
1010
</pe-file-set>
1111
</directory>
12-
<authenticode-sign/>
1312
</zip-file>
1413
</artifact-configuration>

appveyor.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/base/fs_util.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ path_transcoder::to_native(std::string arg)
268268

269269
if (arg[0] == '/') {
270270
arg.erase(0, 1);
271-
arg.insert(1, ":");
271+
if (cget(arg, 1).value_or('\0') == '/') {
272+
arg.insert(1, ":");
273+
}
272274
}
273275
if (this->pt_root_name_capitalized.value()) {
274276
arg[0] = toupper(arg[0]);

src/field_overlay_source.cc

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,17 @@ field_overlay_source::list_value_for_overlay(
765765
this->build_meta_line(lv, value_out, row);
766766
}
767767

768+
field_overlay_source::lss_state
769+
field_overlay_source::lss_state::from(logfile_sub_source& lss)
770+
{
771+
return {
772+
lss.get_filters().fs_generation,
773+
lss.get_min_row_time(),
774+
lss.get_max_row_time(),
775+
lss.get_min_log_level(),
776+
};
777+
}
778+
768779
bool
769780
field_overlay_source::list_static_overlay(const listview_curses& lv,
770781
int y,
@@ -773,11 +784,60 @@ field_overlay_source::list_static_overlay(const listview_curses& lv,
773784
{
774785
const std::vector<attr_line_t>* lines = nullptr;
775786
if (this->fos_lss.text_line_count() == 0) {
776-
if (this->fos_tss.empty()) {
787+
if (this->fos_lss.file_count() > 0) {
788+
auto curr_state = lss_state::from(this->fos_lss);
789+
if (this->fos_static_lines.empty()
790+
|| curr_state != this->fos_static_lines_state)
791+
{
792+
auto msg = lnav::console::user_message::info(
793+
"All log messages are currently hidden");
794+
if (curr_state.ls_min_time) {
795+
msg.with_note(attr_line_t("Logs before ")
796+
.append_quoted(lnav::to_rfc3339_string(
797+
curr_state.ls_min_time.value()))
798+
.append(" are not being shown"));
799+
}
800+
if (curr_state.ls_max_time) {
801+
msg.with_note(attr_line_t("Logs after ")
802+
.append_quoted(lnav::to_rfc3339_string(
803+
curr_state.ls_max_time.value()))
804+
.append(" are not being shown"));
805+
}
806+
if (curr_state.ls_min_level > log_level_t::LEVEL_UNKNOWN) {
807+
msg.with_note(
808+
attr_line_t("Logs with a level below ")
809+
.append_quoted(
810+
level_names[this->fos_lss.get_min_log_level()])
811+
.append(" are not being shown"));
812+
}
813+
auto& fs = this->fos_lss.get_filters();
814+
for (const auto& filt : fs) {
815+
auto hits = this->fos_lss.get_filtered_count_for(
816+
filt->get_index());
817+
if (filt->get_type() == text_filter::EXCLUDE && hits == 0) {
818+
continue;
819+
}
820+
auto cmd = attr_line_t(":" + filt->to_command());
821+
readline_command_highlighter(cmd, std::nullopt);
822+
msg.with_note(
823+
attr_line_t("Filter ")
824+
.append_quoted(cmd)
825+
.append(" matched ")
826+
.append(lnav::roles::number(fmt::to_string(hits)))
827+
.append(" message(s) "));
828+
}
829+
this->fos_static_lines = msg.to_attr_line().split_lines();
830+
this->fos_static_lines_state = curr_state;
831+
}
832+
833+
lines = &this->fos_static_lines;
834+
} else if (this->fos_tss.empty()) {
777835
lines = lnav::messages::view::no_files();
778836
} else {
779837
lines = lnav::messages::view::only_text_files();
780838
}
839+
} else {
840+
this->fos_static_lines.clear();
781841
}
782842

783843
if (lines != nullptr && y < (ssize_t) lines->size()) {

src/field_overlay_source.hh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242

4343
class field_overlay_source : public text_overlay_menu {
4444
public:
45-
explicit field_overlay_source(logfile_sub_source& lss,
46-
text_sub_source& tss)
45+
explicit field_overlay_source(logfile_sub_source& lss, text_sub_source& tss)
4746
: fos_lss(lss), fos_tss(tss), fos_log_helper(lss)
4847
{
4948
}
@@ -100,6 +99,28 @@ public:
10099
bool c_show_applicable_annotations{true};
101100
};
102101

102+
struct lss_state {
103+
static lss_state from(logfile_sub_source& lss);
104+
105+
uint32_t ls_filter_generation{0};
106+
std::optional<timeval> ls_min_time;
107+
std::optional<timeval> ls_max_time;
108+
log_level_t ls_min_level{log_level_t::LEVEL_UNKNOWN};
109+
110+
friend bool operator==(const lss_state& lhs, const lss_state& rhs)
111+
{
112+
return lhs.ls_filter_generation == rhs.ls_filter_generation
113+
&& lhs.ls_min_time == rhs.ls_min_time
114+
&& lhs.ls_max_time == rhs.ls_max_time
115+
&& lhs.ls_min_level == rhs.ls_min_level;
116+
}
117+
118+
friend bool operator!=(const lss_state& lhs, const lss_state& rhs)
119+
{
120+
return !(lhs == rhs);
121+
}
122+
};
123+
103124
std::stack<context> fos_contexts;
104125
logfile_sub_source& fos_lss;
105126
text_sub_source& fos_tss;
@@ -109,6 +130,8 @@ public:
109130
log_data_helper fos_log_helper;
110131
int fos_known_key_size{0};
111132
int fos_unknown_key_size{0};
133+
std::vector<attr_line_t> fos_static_lines;
134+
lss_state fos_static_lines_state;
112135
std::vector<attr_line_t> fos_lines;
113136
std::vector<attr_line_t> fos_meta_lines;
114137

src/textview_curses.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,7 @@ filter_stack::delete_filter(const std::string& id)
12631263
}
12641264
if (iter != this->fs_filters.end()) {
12651265
this->fs_filters.erase(iter);
1266+
this->fs_generation += 1;
12661267
return true;
12671268
}
12681269

@@ -1328,6 +1329,7 @@ void
13281329
filter_stack::add_filter(const std::shared_ptr<text_filter>& filter)
13291330
{
13301331
this->fs_filters.push_back(filter);
1332+
this->fs_generation += 1;
13311333
}
13321334

13331335
void

src/textview_curses.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public:
226226
while (!this->fs_filters.empty()) {
227227
this->fs_filters.pop_back();
228228
}
229+
this->fs_generation += 1;
229230
}
230231

231232
void set_filter_enabled(const std::shared_ptr<text_filter>& filter,
@@ -236,6 +237,7 @@ public:
236237
} else {
237238
filter->disable();
238239
}
240+
this->fs_generation += 1;
239241
}
240242

241243
std::shared_ptr<text_filter> get_filter(const std::string& id);
@@ -246,6 +248,8 @@ public:
246248

247249
void get_enabled_mask(uint32_t& filter_in_mask, uint32_t& filter_out_mask);
248250

251+
uint32_t fs_generation{0};
252+
249253
private:
250254
const size_t fs_reserved;
251255
std::vector<std::shared_ptr<text_filter>> fs_filters;

0 commit comments

Comments
 (0)