'use strict';

const angular = require('angular');

import { BakeryReader, Registry } from '@spinnaker/core';

module.exports = angular
  .module('spinnaker.amazon.pipeline.stage.findImageFromTagsStage', [])
  .config(function() {
    Registry.pipeline.registerStage({
      provides: 'findImageFromTags',
      cloudProvider: 'oracle',
      templateUrl: require('./findImageFromTagsStage.html'),
      executionDetailsUrl: require('./findImageFromTagsExecutionDetails.html'),
      executionConfigSections: ['findImageConfig', 'taskStatus'],
      validators: [
        { type: 'requiredField', fieldName: 'regions' },
        { type: 'requiredField', fieldName: 'packageName' },
      ],
    });
  })
  .controller('oracleFindImageFromTagsStageCtrl', function($scope) {
    $scope.stage.packageName = $scope.stage.packageName || '*';
    $scope.stage.tags = $scope.stage.tags || {};
    $scope.stage.regions = $scope.stage.regions || [];
    $scope.stage.cloudProvider = $scope.stage.cloudProvider || 'oracle';

    BakeryReader.getRegions('oracle').then(function(regions) {
      $scope.regions = regions;
    });
  });

@@ -154,14 +154,14 @@
 ker.
-amazon
+oracle
 .pip

Rename ng module to spinnaker.oracle.* (#6219)