Esempio n. 1
0
    Em.getWithDefault(json, "ThemeInfo.theme_data.Theme.configuration.placement.configs", []).forEach(function(configLink) {
      var configId = this.getConfigId(configLink);
      var subSectionId = configLink["subsection-name"];
      var subSectionTabId = configLink["subsection-tab-name"];
      if (subSectionTabId) {
        var subSectionTab = App.SubSectionTab.find(subSectionTabId);
      } else if (subSectionId) {
        var subSection = App.SubSection.find(subSectionId);
      }
      var configProperty = App.StackConfigProperty.find(configId);

      var dependsOnConfigs = configLink["depends-on"] || [];

      if (configProperty.get('id') && subSection) {
        subSection.get('configProperties').pushObject(configProperty);
        configProperty.set('subSection', subSection);
      } else if (configProperty.get('id') && subSectionTab) {
        subSectionTab.get('configProperties').pushObject(configProperty);
        configProperty.set('subSectionTab', subSectionTab);
      } else {
        console.log('there is no such property: ' + configId + '. Or subsection: ' + subSectionId);
        var valueAttributes = configLink["property_value_attributes"];
        if (valueAttributes) {
          var isUiOnlyProperty = valueAttributes["ui_only_property"];
          // UI only configs are mentioned in the themes for supporting widgets that is not intended for setting a value
          // And thus is affiliated with fake config property termed as ui only config property
          if (isUiOnlyProperty && subSection) {
            var split = configLink.config.split("/");
            var fileName =  split[0] + '.xml';
            var configName = split[1];
            var uiOnlyConfig = App.uiOnlyConfigDerivedFromTheme.filterProperty('filename', fileName).findProperty('name', configName);
            if (!uiOnlyConfig) {
              var coreObject = {
                id: configName + '_' + split[0],
                isRequiredByAgent: false,
                showLabel: false,
                isOverridable: false,
                recommendedValue: true,
                name: configName,
                isUserProperty: false,
                filename: fileName,
                serviceName: serviceName,
                subSection: subSection
              };
              var uiOnlyConfigDerivedFromTheme = Em.Object.create(App.config.createDefaultConfig(configName, serviceName, fileName, false, coreObject));
              App.uiOnlyConfigDerivedFromTheme.pushObject(uiOnlyConfigDerivedFromTheme);
            }
          }
        }
      }

      // map all the configs which conditionally affect the value attributes of a config
      if (dependsOnConfigs && dependsOnConfigs.length) {
        this.mapThemeConfigConditions(dependsOnConfigs, uiOnlyConfigDerivedFromTheme || configProperty);
      }

    }, this);
Esempio n. 2
0
 loadStacks: function () {
   var stacks = this.get('content.stacks');
   var dfd = $.Deferred();
   App.StackConfigProperty.find().clear();
   App.Section.find().clear();
   App.SubSection.find().clear();
   App.SubSectionTab.find().clear();
   App.Tab.find().clear();
   this.set('stackConfigsLoaded', false);
   if (stacks && stacks.get('length')) {
     App.set('currentStackVersion', App.Stack.find().findProperty('isSelected').get('id'));
     dfd.resolve(true);
   } else {
     App.ajax.send({
       name: 'wizard.stacks',
       sender: this,
       success: 'loadStacksSuccessCallback',
       error: 'loadStacksErrorCallback'
     }).complete(function () {
       dfd.resolve(false);
     });
   }
   return dfd.promise();
 },