summaryrefslogtreecommitdiffstats
path: root/gui/app/scripts/controllers/task.controller.js
blob: 05546f9bf27754fee469fa421681d3ef33596f29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
'use strict';

angular.module('yardStickGui2App')
    .controller('TaskController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', 'ngDialog',
        function($scope, $state, $stateParams, mainFactory, Upload, toaster, ngDialog) {


            init();


            function init() {
                getDetailTaskForList();

            }

            function getDetailTaskForList() {
                mainFactory.getTaskDetail().get({
                    'taskId': $stateParams.taskId
                }).$promise.then(function(response) {
                    if (response.status == 1) {
                        if (response.result.task.status == -1) {
                            response.result.task['stausWidth'] = '5%';
                        } else if (response.result.task.status == 0) {
                            response.result.task['stausWidth'] = '50%';
                        } else if (response.result.task.status == 1) {
                            response.result.task['stausWidth'] = '100%';
                        } else if (response.result.task.status == 2) {
                            response.result.task['stausWidth'] = 'red';
                        }

                        $scope.taskDetailData = response.result.task;
                        if ($scope.taskDetailData.environment_id != null) {
                            getItemIdDetail($scope.taskDetailData.environment_id);
                        }

                    }
                }, function(error) {
                    toaster.pop({
                        type: 'error',
                        title: 'fail',
                        body: 'unknow error',
                        timeout: 3000
                    });
                })
            }


            function getItemIdDetail(id) {
                mainFactory.ItemDetail().get({
                    'envId': id
                }).$promise.then(function(response) {
                    if (response.status == 1) {
                        $scope.displayEnv = response.result.environment;

                        if (response.result.environment.pod_id != null) {
                            getPodDetail(response.result.environment.pod_id);
                        } else if (response.result.environment.image_id != null) {
                            getImageDetail(response.result.environment.image_id);
                        } else if (response.result.environment.openrc_id != null) {
                            getOpenrcDetail(response.result.environment.openrc_id != null);
                        } else if (response.result.environment.container_id.length != 0) {
                            $scope.displayContainerDetail = [];
                            var containerArray = response.result.environment.container_id;
                            for (var i = 0; i < containerArray.length; i++) {
                                getContainerId(containerArray[i]);
                            }

                        }
                    } else {
                        toaster.pop({
                            type: 'error',
                            title: 'fail',
                            body: response.error_msg,
                            timeout: 3000
                        });
                    }
                }, function(error) {
                    toaster.pop({
                        type: 'error',
                        title: 'fail',
                        body: 'unknow error',
                        timeout: 3000
                    });
                })
            }

            //getopenRcid
            function getOpenrcDetail(openrcId) {
                mainFactory.getEnvironmentDetail().get({
                    'openrc_id': openrcId
                }).$promise.then(function(response) {
                    //openrc数据
                    $scope.openrcInfo = response.result;
                    // buildToEnvInfo($scope.openrcInfo.openrc)
                }, function(response) {

                })
            }


            //getImgDetail
            function getImageDetail(id) {
                mainFactory.ImageDetail().get({
                    'image_id': id
                }).$promise.then(function(response) {
                    if (response.status == 1) {
                        $scope.imageDetail = response.result.image;

                    }
                }, function(error) {
                    toaster.pop({
                        type: 'error',
                        title: 'fail',
                        body: 'unknow error',
                        timeout: 3000
                    });
                })
            }

            //getPodDetail
            function getPodDetail(id) {
                mainFactory.podDeatil().get({
                    'podId': id
                }).$promise.then(function(response) {
                    if (response.status == 1) {
                        $scope.podDetail = response.result.pod;
                    }
                }, function(error) {
                    toaster.pop({
                        type: 'error',
                        title: 'fail',
                        body: 'unknow error',
                        timeout: 3000
                    });
                })
            }
            //getContainerDetail
            function getContainerId(containerId) {
                mainFactory.containerDetail().get({
                    'containerId': containerId
                }).$promise.then(function(response) {
                    if (response.status == 1) {
                        $scope.container = response.result.container;
                        $scope.displayContainerDetail.push($scope.container);

                    } else {
                        toaster.pop({
                            type: 'error',
                            title: 'fail',
                            body: response.error_msg,
                            timeout: 3000
                        });
                    }
                }, function(error) {
                    toaster.pop({
                        type: 'error',
                        title: 'fail',
                        body: 'unknow error',
                        timeout: 3000
                    });
                })
            }
            $scope.goBack = function goBack() {
                window.history.back();
            }








        }
    ]);
ot;{{ image_first_partition_device }}" name: "{{ mountdir }}" # fstype is required fstype: "{{ image_fs_type }}" # !!!!!!! this is required otherwise we add entries to /etc/fstab # and prevent the system from booting fstab: "{{ fake_fstab }}" state: mounted - name: mount chroot /proc mount: src: none name: "{{ mountdir }}/proc" fstype: proc # !!!!!!! this is required otherwise we add entries to /etc/fstab # and prevent the system from booting fstab: "{{ fake_fstab }}" state: mounted - name: if arm copy qemu-aarch64-static into chroot copy: src: /usr/bin/qemu-aarch64-static dest: "{{ mountdir }}/usr/bin" when: 'YARD_IMG_ARCH == "arm64"' - name: create ubuntu policy-rc.d workaround copy: content: "{{ '#!/bin/sh\nexit 101\n' }}" dest: "{{ mountdir }}/usr/sbin/policy-rc.d" mode: 0755 when: "target_os == 'Ubuntu'" - name: add chroot as host add_host: name: "{{ mountdir }}" groups: chroot_image,image_builder connection: chroot ansible_python_interpreter: /usr/bin/python3 # set this host variable here nameserver_ip: "{{ ansible_dns.nameservers[0] }}" image_type: vm - name: include ubuntu_server_cloudimg_modify.yml include: ubuntu_server_cloudimg_modify.yml when: img_property == "normal" - name: include ubuntu_server_cloudimg_modify_samplevnfs.yml include: ubuntu_server_cloudimg_modify_samplevnfs.yml when: img_property == "nsb" - hosts: localhost tasks: - name: convert image to image file command: "qemu-img convert -c -o compat=0.10 -O qcow2 {{ raw_imgfile }} {{ imgfile }}" - name: run post build tasks include: post_build_yardstick_image.yml - hosts: localhost tasks: - debug: msg: "yardstick image = {{ imgfile }}"