Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #790 from cdosborn/remove-unused-use-allocation-so…
Browse files Browse the repository at this point in the history
…urces-var

Remove traces of USE_ALLOCATION_SOURCES
  • Loading branch information
cdosborn authored Sep 6, 2018
2 parents 81fa4a2 + 1ffcbe4 commit 2be08b7
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 331 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
### Removed
- Remove `UI_VERSION` setting that was unused
([#788](https://github.com/cyverse/troposphere/pull/788))
- Remove all traces of USE_ALLOCATION_SOURCES
([#790](https://github.com/cyverse/troposphere/pull/790))

## [v33-0](https://github.com/cyverse/troposphere/compare/v32-0...v33-0) - 2018-08-06
### Changed
Expand Down
3 changes: 0 additions & 3 deletions troposphere/settings/local.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ OAUTH_CLIENT_CALLBACK = "{{ OAUTH_CLIENT_CALLBACK }}"
# load data if available, from mocked collections rather than the api
USE_MOCK_DATA = {{ USE_MOCK_DATA }}

# display AllocationSources rather than Allocation
USE_ALLOCATION_SOURCES = {{ USE_ALLOCATION_SOURCES }}

# whether a site has an external process for managing
EXTERNAL_ALLOCATION = {{ EXTERNAL_ALLOCATION }}

Expand Down
16 changes: 5 additions & 11 deletions troposphere/static/js/AppRoutes.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from "react";
import {Route, IndexRoute, IndexRedirect} from "react-router";

import globals from "globals";

import Master from "./components/Master";
import BadgeMaster from "./components/badges/BadgeMaster";
import MyBadges from "./components/badges/MyBadges";
Expand Down Expand Up @@ -51,14 +49,6 @@ import NotFoundPage from "./components/NotFoundPage";
import ResourceMaster from "./components/admin/ResourceMaster";
import ResourceRequest from "./components/admin/ResourceRequest/ResourceRequest";

const providersRoute = (
<Route path="providers" component={ProvidersMaster}>
<IndexRoute component={ProviderListSection} />
<Route path=":id" component={ProviderDetail} />
<Route path="all" component={ProviderListSection} />
</Route>
);

function AppRoutes(props) {
const {profile} = props;

Expand Down Expand Up @@ -112,7 +102,11 @@ function AppRoutes(props) {
<Route path="tags" component={ImageTagsPage} />
<Route path=":imageId" component={ImageDetailsPage} />
</Route>
{globals.USE_ALLOCATION_SOURCES ? null : providersRoute}
<Route path="providers" component={ProvidersMaster}>
<IndexRoute component={ProviderListSection} />
<Route path=":id" component={ProviderDetail} />
<Route path="all" component={ProviderListSection} />
</Route>
<Route path="help" component={HelpPage} />
<Route path="settings" component={SettingsPage} />
<Route
Expand Down
9 changes: 2 additions & 7 deletions troposphere/static/js/actions/instance/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import ProjectInstanceConstants from "constants/ProjectInstanceConstants";
import Instance from "models/Instance";
import ProjectInstance from "models/ProjectInstance";

import globals from "globals";

function launch(params) {
if (!params.project) throw new Error("Missing project");
if (!params.instanceName) throw new Error("Missing instanceName");
Expand Down Expand Up @@ -93,13 +91,10 @@ function launch(params) {
size_alias: size.get("alias"),
source_alias: machine.uuid,
scripts: scripts,
project: project
project: project,
allocation_source_id: params.allocation_source_uuid
};

if (globals.USE_ALLOCATION_SOURCES) {
payload.allocation_source_id = params.allocation_source_uuid;
}

// Create Instance using the v2 API endpoint
instance
.create(payload)
Expand Down
24 changes: 10 additions & 14 deletions troposphere/static/js/components/Master.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,16 @@ export default React.createClass({

Promise.resolve()
.then(() => {
if (globals.USE_ALLOCATION_SOURCES) {
let profile = context.profile,
username = profile.get("username"),
missing = all_instances.cfilter(
i =>
!i.get("allocation_source") &&
i.get("user").username == username
);

if (missing.length > 0) {
return modals.NoAllocationSourceModal.showModal(
missing
);
}
let profile = context.profile,
username = profile.get("username"),
missing = all_instances.cfilter(
i =>
!i.get("allocation_source") &&
i.get("user").username == username
);

if (missing.length > 0) {
return modals.NoAllocationSourceModal.showModal(missing);
}
})
.then(() => {
Expand Down
5 changes: 1 addition & 4 deletions troposphere/static/js/components/common/InstanceDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ const InstanceDetail = React.createClass({
var metricsSection = globals.SHOW_INSTANCE_METRICS ? (
<InstanceMetricsSection instance={instance} />
) : null;
var allocationSourceSection = globals.USE_ALLOCATION_SOURCES
? this.renderAllocationSourceSection(instance)
: null;
let project = ProjectStore.get(instance.get("project").id);
if (!project) {
return <div className="loading" />;
Expand All @@ -97,7 +94,7 @@ const InstanceDetail = React.createClass({
<div className="col-md-9">
<InstanceInfoSection instance={instance} />
<hr />
{allocationSourceSection}
{this.renderAllocationSourceSection(instance)}
<InstanceDetailsSection instance={instance} />
<hr />
{metricsSection}
Expand Down
13 changes: 1 addition & 12 deletions troposphere/static/js/components/dashboard/DashboardPage.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from "react";
import RaisedButton from "material-ui/RaisedButton";

import globals from "globals";
import context from "context";
import modals from "modals";
import stores from "stores";
import InstanceHistoryList from "./InstanceHistoryList";
import ResourceStatusSummaryPlot from "./plots/ResourceStatusSummaryPlot";
import AllocationSourcePlot from "./plots/AllocationSourcePlot";
import ProviderAllocationPlot from "./plots/ProviderAllocationPlot";
import ProviderSummaryLinePlot from "./plots/ProviderSummaryLinePlot";
import CallToAction from "./CallToAction";
import {trackAction} from "../../utilities/userActivity";
Expand Down Expand Up @@ -85,15 +83,6 @@ export default React.createClass({
return <div className="loading" />;
}

let renderAllocationPlot = globals.USE_ALLOCATION_SOURCES ? (
<AllocationSourcePlot />
) : (
<ProviderAllocationPlot
providers={providers}
identities={identities}
/>
);

return (
<div id="dashboard-view">
<div style={{paddingTop: "30px"}} className="container">
Expand Down Expand Up @@ -143,7 +132,7 @@ export default React.createClass({
</div>
<div className="row">
<div className="col-md-8">
{renderAllocationPlot}
<AllocationSourcePlot />
<ProviderSummaryLinePlot
providers={providers}
identities={identities}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from "react";
import IdentityResourcesWrapper from "./detail/resources/IdentityResourcesWrapper";
import InstanceDetailsView from "./resources/instance/details/InstanceDetailsView";

import globals from "globals";
import stores from "stores";

export default React.createClass({
Expand All @@ -13,20 +12,14 @@ export default React.createClass({
stores.IdentityStore.addChangeListener(this.updateState);
stores.InstanceStore.addChangeListener(this.updateState);
stores.HelpLinkStore.addChangeListener(this.updateState);

if (globals.USE_ALLOCATION_SOURCES) {
stores.AllocationSourceStore.addChangeListener(this.updateState);
}
stores.AllocationSourceStore.addChangeListener(this.updateState);
},

componentWillUnmount() {
stores.IdentityStore.removeChangeListener(this.updateState);
stores.InstanceStore.removeChangeListener(this.updateState);
stores.HelpLinkStore.removeChangeListener(this.updateState);

if (globals.USE_ALLOCATION_SOURCES) {
stores.AllocationSourceStore.removeChangeListener(this.updateState);
}
stores.AllocationSourceStore.removeChangeListener(this.updateState);
},

updateState() {
Expand All @@ -40,11 +33,7 @@ export default React.createClass({
let helpLinks = stores.HelpLinkStore.getAll();
let allocationSources = stores.AllocationSourceStore.getAll();

let requires = [identity, instance, helpLinks];

if (globals.USE_ALLOCATION_SOURCES) {
requires.push(allocationSources);
}
let requires = [identity, instance, helpLinks, allocationSources];

// Use truthy check to see if loaded
let loaded = requires.every(r => Boolean(r));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import CreatedFrom from "../details/sections/details/CreatedFrom";
import Identity from "../details/sections/details/Identity";
import AllocationSource from "../details/sections/details/AllocationSource";
import stores from "stores";
import globals from "globals";

export default React.createClass({
displayName: "InstancePreviewView",
Expand All @@ -25,10 +24,6 @@ export default React.createClass({
? stores.ProviderStore.get(instance.get("provider").id)
: null;

let renderAllocationSource = globals.USE_ALLOCATION_SOURCES ? (
<AllocationSource instance={instance} />
) : null;

if (!instance || !provider) return <div className="loading" />;
return (
<ul>
Expand All @@ -40,7 +35,7 @@ export default React.createClass({
<LaunchDate instance={instance} />
<CreatedFrom instance={instance} />
<Identity instance={instance} provider={provider} />
{renderAllocationSource}
<AllocationSource instance={instance} />
</ul>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import _ from "underscore";

import BootstrapModalMixin from "components/mixins/BootstrapModalMixin";
import stores from "stores";
import globals from "globals";
import SelectMenu from "components/common/ui/SelectMenu";
import InstanceActions from "actions/InstanceActions";

Expand Down Expand Up @@ -231,10 +230,7 @@ const ModalBackend = React.createClass({

componentDidMount() {
stores.ProjectStore.addChangeListener(this.updateState);

if (globals.USE_ALLOCATION_SOURCES) {
stores.AllocationSourceStore.addChangeListener(this.updateState);
}
stores.AllocationSourceStore.addChangeListener(this.updateState);

this.updateState();
},
Expand All @@ -250,10 +246,7 @@ const ModalBackend = React.createClass({

componentWillUnmount() {
stores.ProjectStore.removeChangeListener(this.updateState);

if (globals.USE_ALLOCATION_SOURCES) {
stores.AllocationSourceStore.removeChangeListener(this.updateState);
}
stores.AllocationSourceStore.removeChangeListener(this.updateState);
},

updateState() {
Expand Down
Loading

0 comments on commit 2be08b7

Please sign in to comment.