Skip to content

Commit

Permalink
Merge pull request #38 from SoftwareAG/fix/fix-alarm-link-on-tooltip
Browse files Browse the repository at this point in the history
fix(datapoints-graph): Fix alarm url

Alarm link on alarm tooltip was not properly created (was not navigating to alarm view).
  • Loading branch information
jdre-c8y authored Sep 23, 2024
2 parents 3cebd43 + f37eb96 commit 8bc0d14
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app/datapoints-graph/charts/echarts-options.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type TooltipPositionCallback = (
} | null // size of chart
) => Partial<Record<'top' | 'bottom' | 'left' | 'right', number>>;

const INDEX_HTML = '/index.html';

@Injectable()
export class EchartsOptionsService {
echartsInstance: ECharts | undefined;
Expand Down Expand Up @@ -527,10 +529,10 @@ export class EchartsOptionsService {
value += `<li class="p-t-4 p-b-4 d-flex separator-bottom text-no-wrap"><label class="text-label-small m-b-0 m-r-8">Last Updated</label><span class="small m-l-auto">${this.datePipe.transform(alarm['lastUpdated'])}</span></li>`;
const exists = await this.alarmRouteExists();
if (exists) {
const currentUrl = this.router.url;
const baseUrlIndex = currentUrl.indexOf('/index.html#');
const baseUrl = currentUrl.substring(0, baseUrlIndex + 11);
value += `<li class="p-t-4 p-b-4 d-flex separator-bottom text-no-wrap"><label class="text-label-small m-b-0 m-r-8">Link</label><span class="small m-l-auto"><a href = "${baseUrl}/alarms/${alarm.id}">Alarm Details</a></span></li>`;
const currentUrl = window.location.href;
const baseUrlIndex = currentUrl.indexOf(INDEX_HTML);
const baseUrl = currentUrl.substring(0, baseUrlIndex + INDEX_HTML.length);
value += `<li class="p-t-4 p-b-4 d-flex separator-bottom text-no-wrap"><label class="text-label-small m-b-0 m-r-8">Link</label><span class="small m-l-auto"><a href="${baseUrl}#/alarms/${alarm.id}">Alarm Details</a></span></li>`;
}
value += `<li class="p-t-4 p-b-4 d-flex text-no-wrap"><label class="text-label-small m-b-0 m-r-8">Alarm count</label><span class="small m-l-auto"><span class="badge badge-info">${alarm.count}</span></span></li>`;
value += `</ul>`;
Expand Down

0 comments on commit 8bc0d14

Please sign in to comment.