2fab11837823b68777b7db0bd02c5e4abc3bbfbd
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 /// <reference path="../../../../references"/>
21 module Sdc.ViewModels {
22     'use strict';
23
24     export interface IManagementWorkflowViewModelScope extends IWorkspaceViewModelScope {
25         vendorModel:VendorModel;
26     }
27
28     export class VendorModel {
29         artifacts: Models.ArtifactGroupModel;
30         serviceID: string;
31         readonly: boolean;
32         sessionID: string;
33         requestID: string;
34         diagramType: string;
35         participants:Array<participant>;
36
37         constructor(artifacts: Models.ArtifactGroupModel, serviceID:string, readonly:boolean, sessionID:string,
38                     requestID:string, diagramType:string, participants:Array<participant>){
39             this.artifacts = artifacts;
40             this.serviceID = serviceID;
41             this.readonly = readonly;
42             this.sessionID = sessionID;
43             this.requestID = requestID;
44             this.diagramType = diagramType;
45             this.participants = participants;
46         }
47     }
48
49     export class ManagementWorkflowViewModel {
50
51         static '$inject' = [
52             '$scope',
53             'uuid4'
54         ];
55
56         constructor(private $scope:IManagementWorkflowViewModelScope,
57                     private uuid4:any) {
58
59             this.initScope();
60             this.$scope.updateSelectedMenuItem();
61         }
62
63
64         private static getParticipants():Array<participant> {
65             return [
66                 {
67                     "id": "1",
68                     "name": "Customer"},
69                 {
70                     "id": "2",
71                     "name": "CCD"
72                 },
73                 {
74                     "id": "3",
75                     "name": "Infrastructure"
76                 },
77                 {
78                     "id": "4",
79                     "name": "MSO"
80                 },
81                 {
82                     "id": "5",
83                     "name": "SDN-C"
84                 },
85                 {
86                     "id": "6",
87                     "name": "A&AI"
88                 },
89                 {
90                     "id": "7",
91                     "name": "APP-C"
92                 },
93                 {
94                     "id": "8",
95                     "name": "Cloud"
96                 },
97                 {
98                     "id": "9",
99                     "name": "DCAE"
100                 },
101                 {
102                     "id": "10",
103                     "name": "ALTS"
104                 },
105                 {
106                     "id": "11",
107                     "name": "VF"
108                 }
109             ]
110         }
111
112
113         private initScope():void {
114             this.$scope.vendorModel = new VendorModel(
115                 this.$scope.component.artifacts.filteredByType(Utils.Constants.ArtifactType.THIRD_PARTY_RESERVED_TYPES.WORKFLOW),
116                 this.$scope.component.uniqueId,
117                 this.$scope.isViewMode(),
118                 this.$scope.user.userId,
119                 this.uuid4.generate(),
120                 Utils.Constants.ArtifactType.THIRD_PARTY_RESERVED_TYPES.WORKFLOW,
121                 ManagementWorkflowViewModel.getParticipants()
122             );
123
124             this.$scope.thirdParty = true;
125             this.$scope.setValidState(true);
126         }
127     }
128 }