]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/path.pipe.ts
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / pipes / path.pipe.ts
1 import { Pipe, PipeTransform } from '@angular/core';
2
3 @Pipe({
4 name: 'path'
5 })
6 export class PathPipe implements PipeTransform {
7 transform(value: unknown): string {
8 if (!value) return '';
9 const splittedPath = value.toString().split('/');
10
11 if (splittedPath[0] === '') {
12 splittedPath.shift();
13 return `/${splittedPath[0]}/.../${splittedPath[splittedPath.length - 1]}`;
14 }
15 return `${splittedPath[0]}/.../${splittedPath[splittedPath.length - 1]}`;
16 }
17 }