Skip to content

Commit

Permalink
Add Package name in admin deeplink UI (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyby authored Jan 16, 2024
1 parent 4005e64 commit 04f75dd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
6 changes: 6 additions & 0 deletions portal-app/src/app/deeplink/deeplink.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.min-client-id-width {
min-width: 160px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
}
5 changes: 4 additions & 1 deletion portal-app/src/app/deeplink/deeplink.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ <h2 class="text-center">
<tbody>
<tr *ngFor="let deeplinkReport of deeplinkReports">
<td *ngFor="let column of columns; let idx=index">
<span *ngIf="idx == 1" class="min-client-id-width">
<button type="button" class="btn btn-secondary" title="Package name: {{deeplinkReport[column]}}">{{packageNameFromId(deeplinkReport[column])}}</button>
</span>
<span *ngIf="idx == 5">
<a href="{{deeplinkReport[column]}}" target="_blank">{{deeplinkReport[column]}}</a>
</span>
<span *ngIf="idx != 5">
<span *ngIf="idx != 1 && idx != 5 ">
{{deeplinkReport[column]}}
</span>
</td>
Expand Down
33 changes: 33 additions & 0 deletions portal-app/src/app/deeplink/deeplink.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,37 @@ export class DeeplinkComponent implements OnInit {
})
};


packageNameFromId(id: string|number): string|number {
if (typeof id === "number") {
return id;
}

const idPrefixes: { [key: string]: string } = {
"ch.rsi.player": "Play RSI Android",
"ch.rsi.rsiplayer": "Play RSI iOS",
"ch.srgssr.rsiplayer": "Play RSI iOS",
"ch.rtr.player": "Play RTR Android",
"ch.rtr.rtrplayer": "Play RTR iOS",
"ch.srgssr.rtrplayer": "Play RTR iOS",
"ch.rts.player": "Play RTS Android",
"ch.rts.rtsplayer": "Play RTS iOS",
"ch.srgssr.rtsplayer": "Play RTS iOS",
"ch.srf.player": "Play SRF Android",
"ch.srf.mobile.srfplayer": "Play SRF Android",
"ch.srf.srfplayer": "Play SRF iOS",
"ch.srgssr.srfplayer": "Play SRF iOS",
"ch.swi.player": "Play SWI Android",
"ch.swi.swiplayer": "Play SWI iOS",
"ch.srgssr.swiplayer": "Play SWI iOS"
};

for (const prefix in idPrefixes) {
if (id === prefix || id.startsWith(prefix + ".")) {
return idPrefixes[prefix];
}
}

return id;
};
}

0 comments on commit 04f75dd

Please sign in to comment.