Skip to content

Commit

Permalink
Merge pull request #380 from NREL/develop
Browse files Browse the repository at this point in the history
Merge 0.4.1 into Main
  • Loading branch information
TShapinsky authored Nov 14, 2022
2 parents c90d064 + cef1282 commit 055e493
Show file tree
Hide file tree
Showing 37 changed files with 646 additions and 503 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
# Reenable pull_request if we start receiving 3rd party contributions.
# Otherwise all pull_requests will also be push test and we are enforcing
# that code must be up to date with parent in the PRs.
# Re-enable pull_request if we start receiving 3rd party contributions.
# Otherwise, all pull_requests will also be push test and we are enforcing
# that code must be up-to-date with parent in the PRs.
#pull_request:

jobs:
Expand Down Expand Up @@ -76,6 +76,8 @@ jobs:
# the webpack calling on the web container for .dev.yml can take some
# time.
- name: Build and run stack
env:
GIT_COMMIT: ${{ github.sha }}
run: |
printenv
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d worker
Expand All @@ -90,11 +92,11 @@ jobs:

- name: Run modelica job tests in Docker worker container
run: |
docker exec alfalfa_worker bash -c "cd /alfalfa && pytest -m docker tests/jobs/modelica -o log_cli=true -o log_level=info"
docker exec alfalfa_worker_1 bash -c "cd /alfalfa && pytest -m docker tests/jobs/modelica -o log_cli=true -o log_level=info"
- name: Run openstudio job tests in Docker worker container
run: |
docker exec alfalfa_worker bash -c "cd /alfalfa && pytest -m docker tests/jobs/openstudio -o log_cli=true -o log_level=info"
docker exec alfalfa_worker_1 bash -c "cd /alfalfa && pytest -m docker tests/jobs/openstudio -o log_cli=true -o log_level=info"
- name: Dump docker logs on failure
if: failure()
Expand Down Expand Up @@ -122,6 +124,8 @@ jobs:
poetry-version: 1.2.1

- name: Build and run stack
env:
GIT_COMMIT: ${{ github.sha }}
run: |
printenv
docker-compose up --build -d
Expand Down Expand Up @@ -173,6 +177,8 @@ jobs:
poetry-version: 1.2.1

- name: Build and run stack
env:
GIT_COMMIT: ${{ github.sha }}
run: |
export HISTORIAN_ENABLE=true
printenv
Expand Down
2 changes: 2 additions & 0 deletions alfalfa_web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:16 AS base
ARG GIT_COMMIT
ENV GIT_COMMIT=$GIT_COMMIT

RUN apt-get update && apt-get install -y \
ca-certificates \
Expand Down
21 changes: 9 additions & 12 deletions alfalfa_web/components/Sims/Sims.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,23 @@ class Sims extends React.Component {
selected: []
};

isSelected = (simRef) => {
return this.state.selected.indexOf(simRef) !== -1;
isSelected = (id) => {
return this.state.selected.indexOf(id) !== -1;
};

selectedSims = () => {
return this.props.data.viewer.sims.filter((sim) => {
return this.state.selected.some((simRef) => {
return simRef === sim.simRef;
});
return this.state.selected.some((id) => id === sim.siteRef);
});
};

handleRowClick = (event, simRef) => {
handleRowClick = (event, id) => {
const { selected } = this.state;
const selectedIndex = selected.indexOf(simRef);
const selectedIndex = selected.indexOf(id);
let newSelected = [];

if (selectedIndex === -1) {
newSelected = newSelected.concat(selected, simRef);
newSelected = newSelected.concat(selected, id);
} else if (selectedIndex === 0) {
newSelected = newSelected.concat(selected.slice(1));
} else if (selectedIndex === selected.length - 1) {
Expand Down Expand Up @@ -156,12 +154,12 @@ class Sims extends React.Component {
</TableHead>
<TableBody>
{sims.map((sim) => {
const isSelected = this.isSelected(sim.simRef);
const isSelected = this.isSelected(sim.siteRef);
return (
<TableRow
key={sim.simRef}
key={sim.siteRef}
style={{ cursor: "default" }}
onClick={(event) => this.handleRowClick(event, sim.simRef)}>
onClick={(event) => this.handleRowClick(event, sim.siteRef)}>
<TableCell padding="checkbox">
<Checkbox checked={isSelected} />
</TableCell>
Expand Down Expand Up @@ -214,7 +212,6 @@ const simsQL = gql`
query SimsQuery {
viewer {
sims {
simRef
name
simStatus
siteRef
Expand Down
4 changes: 2 additions & 2 deletions alfalfa_web/components/Sites/Sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class Sites extends React.Component {
};

handleRemoveSite = () => {
this.selectedSites().map((item) => {
this.props.removeSiteProp(item.siteRef);
this.selectedSites().map(({ siteRef }) => {
this.props.removeSiteProp(siteRef);
});
};

Expand Down
12 changes: 10 additions & 2 deletions alfalfa_web/generate-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@ const openapiSpecification = swaggerJsdoc({
],
components: {
schemas: {
Model: {
Error: {
type: "object",
properties: {
error: {
type: "string"
}
}
},
Site: {
type: "object",
properties: {
id: {
type: "string"
},
description: {
name: {
type: "string"
},
uploadTimestamp: {
Expand Down
Loading

0 comments on commit 055e493

Please sign in to comment.