コード例 #1
0
 deleteResource: function(resource, project, options) {
     // todo: remove instance from project after deletion
     if (resource instanceof Instance) {
         actions.InstanceActions.destroy(
             {
                 instance: resource,
                 project: project
             },
             options
         );
     } else if (resource instanceof Volume) {
         actions.VolumeActions.destroy(
             {
                 volume: resource,
                 project: project
             },
             options
         );
     } else if (resource instanceof ExternalLink) {
         actions.ExternalLinkActions.destroy_noModal(
             {
                 external_link: resource,
                 project: project
             },
             options
         );
     } else if (resource instanceof Image) {
         actions.ProjectImageActions.removeImageFromProject({
             project: project,
             image: resource
         });
     } else {
         throw new Error("Unknown resource type");
     }
 },
コード例 #2
0
 onDoneEditing: function (text) {
   this.setState({
     name: text,
     isEditing: false
   });
   actions.InstanceActions.update(this.props.instance, {name: text});
 },
コード例 #3
0
ファイル: destroy.js プロジェクト: calvinmclean/troposphere
 ModalHelpers.renderModal(ModalComponent, props, function() {
     attachedVolumes.forEach(volume =>
         VolumeStore.pollUntilDetached(volume)
     );
     actions.InstanceActions.destroy(payload, options);
     if (project) {
         appBrowserHistory.push(`/projects/${project.id}/resources`);
     }
 });
コード例 #4
0
ファイル: launch.js プロジェクト: amit4111989/troposphere
      ModalHelpers.renderModal(InstanceLaunchWizardModal, props, function (launchData) {
        var size = launchData.size,
          version = launchData.version,
          identity = launchData.identity,
          name = launchData.name,
          project = launchData.project;

        actions.InstanceActions.launch({
          project: project,
          instanceName: name,
          identity: identity,
          size: size,
          version: version
        });
      });
コード例 #5
0
 addResourceToProject: function(resource, project, options) {
     // todo: settings projects here is a bad hack - it's because there are a
     // few places in the code that access instance/volume.get('projects')[0]
     // Instead we need to change those places to access a resources project
     // either through stores.ProjectInstanceStore or the route URL (getParams().projectId);
     if (resource instanceof Instance) {
         resource.set("project", project);
         actions.InstanceActions.update(
             resource,
             {
                 project: project
             },
             options
         );
     } else if (resource instanceof Volume) {
         resource.set("project", project);
         actions.VolumeActions.update(
             resource,
             {
                 project: project
             },
             options
         );
     } else if (resource instanceof ExternalLink) {
         resource.set("projects", [project.id]);
         actions.ProjectExternalLinkActions.addExternalLinkToProject(
             {
                 project: project,
                 external_link: resource
             },
             options
         );
     } else if (resource instanceof Image) {
         resource.set("projects", [project.id]);
         actions.ProjectImageActions.addImageToProject(
             {
                 project: project,
                 image: resource
             },
             options
         );
     } else {
         throw new Error("Unknown resource type");
     }
 },
コード例 #6
0
    onSubmitLaunch: function() {
        let licenseList = this.state.imageVersion.get('licenses');
        if (this.canLaunch()) {
            if (licenseList.length >= 1 && this.state.view === 'BASIC_VIEW') {
                this.viewLicense();
                return
            }

            let launchData = {
                project: this.state.project,
                instanceName: this.state.instanceName.trim(),
                identity: this.state.identityProvider,
                size: this.state.providerSize,
                version: this.state.imageVersion,
                scripts: this.state.attachedScripts
            };
            actions.InstanceActions.launch(launchData);
            this.hide();
            return
        }

        this.setState({showValidationErr: true})
    },
コード例 #7
0
 removeResourceFromProject: function(resource, project, options) {
     if (resource instanceof Instance) {
         actions.InstanceActions.update(
             resource,
             {
                 project: null
             },
             options
         );
     } else if (resource instanceof Volume) {
         actions.VolumeActions.update(
             resource,
             {
                 project: project
             },
             options
         );
     } else if (resource instanceof ExternalLink) {
         actions.ProjectExternalLinkActions.removeExternalLinkFromProject(
             {
                 project: project,
                 external_link: resource
             },
             options
         );
     } else if (resource instanceof Image) {
         actions.ProjectImageActions.removeImageFromProject(
             {
                 project: project,
                 image: resource
             },
             options
         );
     } else {
         throw new Error("Unknown resource type");
     }
 },
コード例 #8
0
ファイル: unshelve.js プロジェクト: calvinmclean/troposphere
 ModalHelpers.renderModal(InstanceUnshelveModal, null, function() {
     actions.InstanceActions.unshelve({
         instance: instance
     });
 });
コード例 #9
0
            currentProject = params.currentProject,
            resourcesCount = resources && resources.size ? resources.size() : 0;
        resources.map(r => this.moveResource(r, currentProject, newProject));
        Utils.dispatch(ProjectConstants.EMIT_CHANGE);

        // NOTE: this _completed_ the move selected resources action;
        // interested in how many use this project-related action
        trackAction("moved-project-resources", {
            "number-of-resources": resourcesCount
        });
    },

    moveResource(resource, currentProject, newProject) {
        if (resource instanceof Instance) {
            actions.InstanceActions.update(resource, {
                project: newProject
            });
        } else if (resource instanceof Volume) {
            actions.VolumeActions.update(resource, {
                project: newProject
            });
        } else if (resource instanceof ExternalLink) {
            resource.set("projects", [newProject.id]);
            actions.ProjectExternalLinkActions.addExternalLinkToProject({
                project: newProject,
                external_link: resource
            });
            actions.ProjectExternalLinkActions.removeExternalLinkFromProject({
                project: currentProject,
                external_link: resource
            });
コード例 #10
0
ファイル: start.js プロジェクト: calvinmclean/troposphere
 ModalHelpers.renderModal(InstanceStartModal, null, function() {
     actions.InstanceActions.start({
         instance: instance
     });
 });
コード例 #11
0
ファイル: suspend.js プロジェクト: Duke-GCB/troposphere
 ModalHelpers.renderModal(InstanceSuspendModal, null, function () {
   actions.InstanceActions.suspend({
     instance: instance
   })
 });
コード例 #12
0
ファイル: resume.js プロジェクト: Tharon-C/troposphere
 ModalHelpers.renderModal(InstanceResumeModal, null, function() {
     actions.InstanceActions.resume({
         instance: instance
     })
 });
コード例 #13
0
ファイル: report.js プロジェクト: Duke-GCB/troposphere
 ModalHelpers.renderModal(InstanceReportModal, props, function (reportInfo) {
   actions.InstanceActions.report({
     instance: instance,
     reportInfo: reportInfo
   })
 })
コード例 #14
0
ファイル: redeploy.js プロジェクト: Tharon-C/troposphere
 ModalHelpers.renderModal(InstanceRedeployModal, null, function() {
     actions.InstanceActions.redeploy({
         instance: instance
     });
 });