Change extension of export file from csv to txt.
This commit is contained in:
@@ -12,7 +12,7 @@ const useDownload = (url) => {
|
|||||||
var url = window.URL.createObjectURL(blob);
|
var url = window.URL.createObjectURL(blob);
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
a.download = "export.csv";
|
a.download = "export.txt";
|
||||||
document.body.appendChild(a); // we need to append the element to the dom -> otherwise it will not work in firefox
|
document.body.appendChild(a); // we need to append the element to the dom -> otherwise it will not work in firefox
|
||||||
a.click();
|
a.click();
|
||||||
a.remove(); //afterwards we remove the element again
|
a.remove(); //afterwards we remove the element again
|
||||||
|
|||||||
+15
-15
@@ -75,21 +75,6 @@ public class ExportConcordancesHandler : BaseSearchConcordancesHandler, IRequest
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Dictionary<Guid, string>> GetSources(List<SearchConcordancesResponseItem> items)
|
|
||||||
{
|
|
||||||
var paragraphIds = items.Select(i => i.ParagraphId).ToList();
|
|
||||||
var sources = await dbContext.Paragraph.Include(p => p.Text)
|
|
||||||
.Where(p => paragraphIds.Contains(p.Id))
|
|
||||||
.Select(
|
|
||||||
p => new
|
|
||||||
{
|
|
||||||
p.Id,
|
|
||||||
p.Text.SourceFile,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
return sources.ToDictionary(x => x.Id, x => Path.GetFileNameWithoutExtension(x.SourceFile));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task WriteContext(StreamWriter writer, List<ConcordanceToken> tokens)
|
private static async Task WriteContext(StreamWriter writer, List<ConcordanceToken> tokens)
|
||||||
{
|
{
|
||||||
if (tokens != null)
|
if (tokens != null)
|
||||||
@@ -132,4 +117,19 @@ public class ExportConcordancesHandler : BaseSearchConcordancesHandler, IRequest
|
|||||||
await writer.WriteAsync(source);
|
await writer.WriteAsync(source);
|
||||||
await writer.WriteLineAsync();
|
await writer.WriteLineAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<Dictionary<Guid, string>> GetSources(List<SearchConcordancesResponseItem> items)
|
||||||
|
{
|
||||||
|
var paragraphIds = items.Select(i => i.ParagraphId).ToList();
|
||||||
|
var sources = await dbContext.Paragraph.Include(p => p.Text)
|
||||||
|
.Where(p => paragraphIds.Contains(p.Id))
|
||||||
|
.Select(
|
||||||
|
p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.Text.SourceFile,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return sources.ToDictionary(x => x.Id, x => Path.GetFileNameWithoutExtension(x.SourceFile));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user