X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Fosm-repositories%2FOsmRepositoriesComponent.ts;fp=src%2Fapp%2Fosm-repositories%2FOsmRepositoriesComponent.ts;h=5f42eeef11dbb7eeead9a34b86fb72e1eb5cab1a;hb=403234ed6120ba4bc01578b3ec237fa5fd4c0f6d;hp=0000000000000000000000000000000000000000;hpb=b323b2af218700aa7fb3d911a459fbec8b3f2d59;p=osm%2FNG-UI.git diff --git a/src/app/osm-repositories/OsmRepositoriesComponent.ts b/src/app/osm-repositories/OsmRepositoriesComponent.ts new file mode 100644 index 0000000..5f42eee --- /dev/null +++ b/src/app/osm-repositories/OsmRepositoriesComponent.ts @@ -0,0 +1,55 @@ +/* + Copyright 2020 TATA ELXSI + + Licensed under the Apache License, Version 2.0 (the 'License'); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in) +*/ +/** + * @file OsmRepositoriesComponent.ts + */ +import { Component, Injector } from '@angular/core'; +import { Router, RouterEvent } from '@angular/router'; +/** + * Creating Component + * @Component takes OsmRepositoriesComponent.html as template url + */ +@Component({ + selector: 'app-osmrepositories', + templateUrl: './OsmRepositoriesComponent.html', + styleUrls: ['./OsmRepositoriesComponent.scss'] +}) +/** Exporting a class @exports OsmRepositoriesComponent */ +export class OsmRepositoriesComponent{ + /** Invoke service injectors @public */ + public injector: Injector; + + /** Holds teh instance of router service @private */ + private router: Router; + + /** creates OSM Repo component */ + constructor(injector: Injector) { + this.injector = injector; + this.router = this.injector.get(Router); + this.router.events.subscribe((event: RouterEvent) => { + this.redirectToList(event.url); + }); + } + + /** Return to osm Repo Details list */ + public redirectToList(getURL: string): void { + if (getURL === '/repos') { + this.router.navigate(['/repos/details']).catch(); + } + } +}