Advertisement
Guest User

Untitled

a guest
May 19th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2016-2017 by Teradata Corporation. All rights reserved.
  3. * TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
  4. */
  5.  
  6. import { Component, AfterViewInit, OnInit } from '@angular/core';
  7. import { Router, ActivatedRoute } from '@angular/router';
  8.  
  9. import { TdLoadingService } from '@covalent/core';
  10.  
  11. import { SystemsService, ISystem, IAddSystemApi, REGION_TYPES,
  12. RegionType, ErrorService, ToastService } from '../../../services';
  13.  
  14. @Component({
  15. selector: 'system-form',
  16. templateUrl: './form.component.html',
  17. styleUrls: ['./form.component.scss'],
  18. viewProviders: [ SystemsService ],
  19. })
  20. export class SystemsFormComponent implements AfterViewInit, OnInit {
  21.  
  22. system: ISystem = {
  23. address: undefined,
  24. name: undefined,
  25. }
  26. types: RegionType[] = REGION_TYPES;
  27. tested: boolean = false;
  28. temp: any = {
  29. username: '',
  30. password: '',
  31. };
  32.  
  33. constructor(private _systemsService: SystemsService,
  34. private _errorService: ErrorService,
  35. private _toastService: ToastService,
  36. private _route: ActivatedRoute,
  37. private _router: Router,
  38. private _loadingService: TdLoadingService) {}
  39. ngOnInit(): void {
  40. this._route.params.subscribe((params: {id: string}) => {
  41. let systemId: string = params.id;
  42. if (systemId) {
  43. this._loadingService.register('system.form');
  44. this._systemsService.query({'system_id': systemId})
  45. .subscribe((system: ISystem) => {
  46. this.system = system;
  47. console.log(this.system);
  48. this._loadingService.resolve('system.form');
  49. }, (error: any) => {
  50. this._errorService.open(error);
  51. this._loadingService.resolve('system.form');
  52. });
  53. }
  54. });
  55. }
  56.  
  57. ngAfterViewInit(): void {
  58.  
  59. }
  60.  
  61. goBack(): void {
  62. this._router.navigate(['/syst']);
  63. }
  64.  
  65. resetTest(): void {
  66. this.tested = false;
  67. }
  68.  
  69.  
  70.  
  71. save(): void {
  72. let system: IAddSystemApi = {
  73. AddSystem: {
  74. system: {
  75. address: "system.address",
  76. name: "system.name",
  77. region: "system.region",
  78. },
  79. unitymgmt_user: "system.unitymgmt_user",
  80. unitymgmt_user_pwd: "system.unitymgmt_user_pwd",
  81. root_password: "system.new_instance_pwd",
  82. },
  83. }
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement