Esempio n. 1
0
        runClosure: function($event) {
          $event.stopPropagation();
          $event.preventDefault();

          TemplateActions.openAddClosure(this.model);
          TemplateActions.runClosure(null, this.model, this.model.inputs);
          TemplatesContextToolbarActions.openToolbarClosureResults();
        },
    editKubernetesDescription: function(e) {
      if (e != null) {
          e.preventDefault();
      }

      TemplateActions.openEditKubernetesDefinition(this.model);
    },
Esempio n. 3
0
    it('should initialize network connections in model', function(done) {
      TemplateActions.openTemplateDetails(constants.TEMPLATES.TYPES.TEMPLATE, TemplatesMockData.TemplateWithNetworking.name);

      waitForData(function(data) {
        return data.selectedItemDetails.templateDetails.documentSelfLink ===
          TemplatesMockData.TemplateWithNetworking.documentSelfLink &&
          data.selectedItemDetails.templateDetails.listView.items;
      }).then(function(data) {
        var lv = data.selectedItemDetails.templateDetails.listView;
        expect(lv.networks).toEqual([
          TemplatesMockData.Mynet,
          BRIDGE_NETWORK_DESCRIPTION
        ]);

        expect(lv.networkLinks[TemplatesMockData.WordpressCD.documentSelfLink]).toEqual([
          BRIDGE_NETWORK_DESCRIPTION.documentSelfLink
        ]);

        expect(lv.networkLinks[TemplatesMockData.MysqlCD.documentSelfLink]).toEqual([
          TemplatesMockData.Mynet.documentSelfLink,
          BRIDGE_NETWORK_DESCRIPTION.documentSelfLink
        ]);

        expect(lv.networkLinks[TemplatesMockData.HaproxyCD.documentSelfLink]).toEqual([
          TemplatesMockData.Mynet.documentSelfLink
        ]);

        done();
      });
    });
Esempio n. 4
0
    openCreateTemplate: function($event) {
      $event.stopPropagation();
      $event.preventDefault();

      this.createTemplateName = null;

      TemplateActions.openCreateNewTemplate('templates');
    },
Esempio n. 5
0
        removeClosureDescription: function($event) {
          if ($event != null) {
            $event.stopImmediatePropagation();
            $event.preventDefault();
          }

          TemplateActions.removeClosure(this.model);
        },
Esempio n. 6
0
      }).then(function(data) {
        TemplateActions.attachNetwork(TemplatesMockData.WordpressCD.documentSelfLink,
                                     TemplatesMockData.Mynet.documentSelfLink);

        TemplateActions.attachNetwork(TemplatesMockData.HaproxyCD.documentSelfLink,
                                     BRIDGE_NETWORK_DESCRIPTION.documentSelfLink);

        return waitForData(function(data) {
          var lv = data.selectedItemDetails.templateDetails.listView;
          var wordpress = getItem(lv.items, TemplatesMockData.WordpressCD.documentSelfLink);
          var mysql = getItem(lv.items, TemplatesMockData.MysqlCD.documentSelfLink);
          var haproxy = getItem(lv.items, TemplatesMockData.HaproxyCD.documentSelfLink);

          return wordpress.networkMode === 'bridge' && wordpress.networks['mynet'] &&
            mysql.networkMode === 'bridge' && mysql.networks['mynet'] &&
            haproxy.networkMode === 'bridge' && haproxy.networks['mynet'];
        });
      }).then(function(data) {
    this.networksEditor.$el.on('change', 'select', function() {
      if (this.value === constants.NEW_ITEM_SYSTEM_VALUE) {
        var networks = {};
        thatNetworksEditor.getData().forEach(function(o) {
          networks[o.network] = toNetworkModel(o);
        });

        TemplateActions.openEditNetwork(networks);
      }
    });
Esempio n. 8
0
    createNewTemplate: function($event) {
      $event.preventDefault();
      $event.stopPropagation();

      if (!this.createTemplateName || this.createTemplateName.length === 0) {
        this.showErrorAlert(i18n.t('app.template.details.errorEmptyName'));
        return;
      }

      TemplateActions.createNewTemplate(this.createTemplateName);
    },
Esempio n. 9
0
        createTemplate: function($event) {
          // this does the provisioning of the Application
          $event.stopPropagation();
          $event.preventDefault();

          var template = {
            'documentSelfLink': this.model.documentSelfLink
          };

          TemplateActions.copyTemplate(this.model.type, template);
        },
Esempio n. 10
0
        handleBackButton: function(e) {
          if (e) {
            e.preventDefault();
            e.stopImmediatePropagation();
          }

          var data = this.model || {};
          if (data.addClosureView) {
            TemplateActions.cancelAddClosure(this.model.documentId);
            return true;
          }

          return false;
        },
Esempio n. 11
0
 refresh: function() {
   TemplateActions.openTemplates(this.queryOptions, true);
 },
Esempio n. 12
0
        publishTemplateToCatalog: function($event) {
          $event.stopPropagation();
          $event.preventDefault();

          TemplateActions.publishTemplate(this.model.documentId);
        },
Esempio n. 13
0
        provisionContainer: function($event) {
          $event.stopPropagation();
          $event.preventDefault();

          TemplateActions.createContainer(this.model.type, this.model.documentId);
        },
Esempio n. 14
0
    it('should update when attaching and detachin a network connection', function(done) {
      TemplateActions.openTemplateDetails(constants.TEMPLATES.TYPES.TEMPLATE, TemplatesMockData.TemplateWithNetworking.name);

      waitForData(function(data) {
        return data.selectedItemDetails.templateDetails.documentSelfLink ===
          TemplatesMockData.TemplateWithNetworking.documentSelfLink &&
          data.selectedItemDetails.templateDetails.listView.items;
      }).then(function(data) {
        TemplateActions.attachNetwork(TemplatesMockData.WordpressCD.documentSelfLink,
                                     TemplatesMockData.Mynet.documentSelfLink);

        TemplateActions.attachNetwork(TemplatesMockData.HaproxyCD.documentSelfLink,
                                     BRIDGE_NETWORK_DESCRIPTION.documentSelfLink);

        return waitForData(function(data) {
          var lv = data.selectedItemDetails.templateDetails.listView;
          var wordpress = getItem(lv.items, TemplatesMockData.WordpressCD.documentSelfLink);
          var mysql = getItem(lv.items, TemplatesMockData.MysqlCD.documentSelfLink);
          var haproxy = getItem(lv.items, TemplatesMockData.HaproxyCD.documentSelfLink);

          return wordpress.networkMode === 'bridge' && wordpress.networks['mynet'] &&
            mysql.networkMode === 'bridge' && mysql.networks['mynet'] &&
            haproxy.networkMode === 'bridge' && haproxy.networks['mynet'];
        });
      }).then(function(data) {
        var lv = data.selectedItemDetails.templateDetails.listView;
        var allNetworkLinks = [
          TemplatesMockData.Mynet.documentSelfLink,
          BRIDGE_NETWORK_DESCRIPTION.documentSelfLink
        ];

        expect(lv.networks).toEqual([
          TemplatesMockData.Mynet,
          BRIDGE_NETWORK_DESCRIPTION
        ]);

        expect(lv.networkLinks[TemplatesMockData.WordpressCD.documentSelfLink])
          .toEqual(allNetworkLinks);

        expect(lv.networkLinks[TemplatesMockData.MysqlCD.documentSelfLink])
          .toEqual(allNetworkLinks);

        expect(lv.networkLinks[TemplatesMockData.HaproxyCD.documentSelfLink])
          .toEqual(allNetworkLinks);
      }).then(function() {
        TemplateActions.detachNetwork(TemplatesMockData.WordpressCD.documentSelfLink,
                                     BRIDGE_NETWORK_DESCRIPTION.documentSelfLink);

        TemplateActions.detachNetwork(TemplatesMockData.HaproxyCD.documentSelfLink,
                                     TemplatesMockData.Mynet.documentSelfLink);

        TemplateActions.detachNetwork(TemplatesMockData.MysqlCD.documentSelfLink,
                                     BRIDGE_NETWORK_DESCRIPTION.documentSelfLink);

        TemplateActions.detachNetwork(TemplatesMockData.MysqlCD.documentSelfLink,
                                     TemplatesMockData.Mynet.documentSelfLink);

        return waitForData(function(data) {
          var lv = data.selectedItemDetails.templateDetails.listView;
          var wordpress = getItem(lv.items, TemplatesMockData.WordpressCD.documentSelfLink);
          var mysql = getItem(lv.items, TemplatesMockData.MysqlCD.documentSelfLink);
          var haproxy = getItem(lv.items, TemplatesMockData.HaproxyCD.documentSelfLink);

          return !wordpress.networkMode && wordpress.networks['mynet'] &&
            !mysql.networkMode && !mysql.networks['mynet'] &&
            haproxy.networkMode === 'bridge' && !haproxy.networks['mynet'];
        });
      }).then(function(data) {
        var lv = data.selectedItemDetails.templateDetails.listView;

        expect(lv.networkLinks[TemplatesMockData.WordpressCD.documentSelfLink])
          .toEqual([TemplatesMockData.Mynet.documentSelfLink]);

        expect(lv.networkLinks[TemplatesMockData.MysqlCD.documentSelfLink])
          .toEqual(undefined);

        expect(lv.networkLinks[TemplatesMockData.HaproxyCD.documentSelfLink])
          .toEqual([BRIDGE_NETWORK_DESCRIPTION.documentSelfLink]);

        done();
      });
    });
 removeKubernetesDescription: function() {
   TemplateActions.removeKubernetesDefinition(this.model, this.templateId);
 }
Esempio n. 16
0
 editClosureDescription: function(e) {
   TemplateActions.openAddClosure(e.model);
 },
Esempio n. 17
0
 removeClosure: function(e) {
   TemplateActions.removeClosure(e.model);
 },
Esempio n. 18
0
 importTemplate: function() {
   if (this.templateContent) {
     TemplateActions.importTemplate(this.templateContent);
   }
 }