blob: 7641aa5266b2d334a761a119ca91bc2f901bd663 [file] [log] [blame]
Skip Wonnell2c977e22018-03-01 08:30:15 -06001/*
2============LICENSE_START==========================================
3===================================================================
4Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
5===================================================================
6
7Unless otherwise specified, all software contained herein is licensed
8under the Apache License, Version 2.0 (the License);
9you may not use this software except in compliance with the License.
10You may obtain a copy of the License at
11
12 http://www.apache.org/licenses/LICENSE-2.0
13
14Unless required by applicable law or agreed to in writing, software
15distributed under the License is distributed on an "AS IS" BASIS,
16WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17See the License for the specific language governing permissions and
18limitations under the License.
19
20ECOMP is a trademark and service mark of AT&T Intellectual Property.
21============LICENSE_END============================================
22*/
23
24import { Component, OnInit } from '@angular/core';
25import { Router } from '@angular/router';
26import * as _ from 'underscore';
27
28@Component({ selector: 'app-build-design', templateUrl: './build-artifacts.component.html', styleUrls: ['./build-artifacts.component.css'] })
29export class BuildDesignComponent implements OnInit {
30 tabs: Array<Object> = [];
31 private allowOtherUpdates: boolean = true;
32
33 constructor (private router: Router) {
34 }
35
36 ngOnInit() {
37 this.tabs = [
38 {
39 type: 'dropdown',
40 name: 'Reference Data',
41 url: 'references',
42 }, {
43 name: 'Template',
44 type: 'dropdown',
45 url: 'templates/myTemplates',
46 }, {
47 name: 'Parameter Definition',
48 type: 'dropdown',
49 url: 'parameterDefinitions/create'
50 } /*, {
51 name: "Test",
52 url: 'test',
53 }*/
54 ];
55 }
56
57 public setAllowOtherUpdates(allowOtherUpdates: boolean) {
58 this.allowOtherUpdates = allowOtherUpdates;
59 }
60
61 // Allow / block access to the update pages of GT and PD if no reference data present
62 public updateAccessUpdatePages(selectedAction, referenceList) {
63 // Disable/enable the menu items for update pages of GT and PD.
64 if (this.isReferenceFound(selectedAction, referenceList)) {
65 this.setAllowOtherUpdates(true);
66 } else {
67 //alert("false")
68 this.setAllowOtherUpdates(false);
69 }
70 }
71
72 public isReferenceFound(selectedAction, referenceList) {
73 let selectedActioneObject = _.find(referenceList, function (obj) {
74 return obj['action'] == selectedAction;
75 });
76 if (selectedActioneObject) {
77 return true;
78 } else {
79 return false;
80 }
81 }
82}