Skip to content

Commit cc01a0f

Browse files
committed
Show installed version and latest version on the download preview
1 parent d8dc3d0 commit cc01a0f

4 files changed

Lines changed: 91 additions & 3 deletions

File tree

fileVersionManagement.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,29 @@ def deleteLocalVersionFileIfExists(localVersionFolder):
223223
if os.path.exists(localVersionFilePathToDelete):
224224
os.remove(localVersionFilePathToDelete)
225225

226+
def getLocalVersionOrStatusString(self, fileID):
227+
#type: (str) -> str
228+
if self.localVersionInfo is None:
229+
return "Mod Not Installed"
230+
231+
fileVersion = self.localVersionInfo.fileVersionsDict.get(fileID)
232+
233+
if fileVersion is None:
234+
return "Not Installed".format(fileID)
235+
236+
return fileVersion.version
237+
238+
def getLatestVersionOrStatusString(self, fileID):
239+
#type: (str) -> str
240+
if self.remoteVersionInfo is None:
241+
return "Remote ver data missing"
242+
243+
fileVersion = self.remoteVersionInfo.fileVersionsDict.get(fileID)
244+
245+
if fileVersion is None:
246+
return "Remote id [{}] ver missing".format(fileID)
247+
248+
return fileVersion.version
226249

227250
def installNewerThanDate(versionDataJsonPath, date):
228251
# type: (str, datetime) -> Tuple[bool, str]

httpGUI.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ def getPreviewAsDict(self, downloadFolder, downloadManually):
592592
"url": item.url,
593593
"manualDownloadStatus": None,
594594
"fileName": None,
595+
"localVersion": self.fileVersionManager.getLocalVersionOrStatusString(item.modFileID),
596+
"remoteVersion": self.fileVersionManager.getLatestVersionOrStatusString(item.modFileID),
595597
}
596598
)
597599
else:
@@ -631,6 +633,8 @@ def getPreviewAsDict(self, downloadFolder, downloadManually):
631633
"url": extractableItem.fileURL,
632634
"manualDownloadStatus": manualDownloadStatus,
633635
"fileName": extractableItem.filename,
636+
"localVersion": self.fileVersionManager.getLocalVersionOrStatusString(item.modFileID),
637+
"remoteVersion": self.fileVersionManager.getLatestVersionOrStatusString(item.modFileID),
634638
}
635639
)
636640

httpGUI/installer.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,27 +680,33 @@ <h4 class="uppercase mt40">Please confirm your install settings:</h4>
680680
<span>Rows will turn green when downloaded correctly.</span>
681681
</div>
682682
<div v-bind:class="{ 'greyed-out': startInstallInProgressFiltered }">
683-
<table class="umineko-image-table-content">
683+
<table class="download-preview-table">
684684
<thead>
685685
<tr>
686686
<th style="width: 100px">File</th>
687687
<th style="width: 80px">Size</th>
688688
<th style="width: 100%">Update Reason</th>
689+
<th style="width: 100px">Installed Version</th>
690+
<th style="width: 100px">Latest Version</th>
689691
<th v-if="downloadItemsPreview.downloadManually" style="width: 200%">Manual Download Status</th>
690692
</tr>
691693
</thead>
692694
<tbody>
693695
<tr v-for="fileInfo in downloadItemsPreview.downloadItems"
694-
v-bind:class="{ active: fileInfo.rowClass === 'active', inactive: fileInfo.rowClass === 'inactive', warning: fileInfo.rowClass === 'warning' }">
696+
v-bind:class="{ active: fileInfo.rowClass === 'active', inactive: fileInfo.rowClass === 'inactive', warningMinor: fileInfo.rowClass === 'warning' }">
695697
<td>{{ fileInfo.id }}</td>
696698
<td>{{ fileInfo.fileSize }}</td>
697699
<td>{{ fileInfo.updateReason }}</td>
698-
<td v-if="downloadItemsPreview.downloadManually"><span class="rendered-markdown" v-html="renderMarkdown(fileInfo.manualDownloadStatus)"></span> </td>
700+
<td>{{ fileInfo.localVersion }}</td>
701+
<td>{{ fileInfo.remoteVersion }}</td>
702+
<td v-if="downloadItemsPreview.downloadManually" v-bind:class="{ warning: fileInfo.rowClass === 'warning' }"><span class="rendered-markdown" v-html="renderMarkdown(fileInfo.manualDownloadStatus)"></span> </td>
699703
</tr>
700704
<tr>
701705
<td>Total Download Size</td>
702706
<td>{{ downloadItemsPreview.totalDownload }}</td>
703707
<td>{{ downloadItemsPreview.updateTypeDescription }}</td>
708+
<td></td>
709+
<td></td>
704710
<td v-if="downloadItemsPreview.downloadManually"></td>
705711
</tr>
706712
</tbody>

httpGUI/style.css

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,61 @@ h1, h2, h3, h4, h5, h6 {
204204
border-color: black;
205205
}
206206

207+
.download-preview-table {
208+
width: 100%;
209+
table-layout: fixed; /* Setting width: 100% and table-layout:fixed achieves equally sized columns */
210+
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);
211+
/* border-radius: 8px; */
212+
overflow: hidden; /* Fix top of table not being rounded */
213+
margin-top: 20px;
214+
margin-bottom: 20px;
215+
}
216+
217+
.download-preview-table th {
218+
background-color: #47b475;
219+
color: #fff;
220+
font-size: 16px;
221+
padding: 2px 10px 2px 10px;
222+
font-weight: bold;
223+
border-width: 1px;
224+
border-style: solid;
225+
border-color: black;
226+
}
227+
228+
.download-preview-table td {
229+
padding: 2px 10px 2px 10px;
230+
231+
border-width: 1px;
232+
border-style: solid;
233+
border-color: black;
234+
}
235+
236+
.download-preview-table tr.inactive {
237+
background-color: lightgray;
238+
}
239+
240+
.download-preview-table tr.active {
241+
background-color: lightgreen;
242+
}
243+
244+
.download-preview-table tr.warningMinor {
245+
background-color: lightyellow;
246+
}
247+
248+
.download-preview-table tr.warning {
249+
background-color: yellow;
250+
border-width: 4px;
251+
border-style: solid;
252+
border-color: black;
253+
}
254+
255+
.download-preview-table td.warning {
256+
background-color: yellow;
257+
border-width: 4px;
258+
border-style: solid;
259+
border-color: black;
260+
}
261+
207262
.warning-text {
208263
background-color: yellow;
209264
border-width: 4px;

0 commit comments

Comments
 (0)