Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTL (Test > Levelbuilder): 47d176a2 #36786

Merged
merged 72 commits into from Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
a30f263
Create activities editor
dmcavoy Sep 7, 2020
e13b92a
Make toggle expand not required for now
dmcavoy Sep 7, 2020
a4d4560
Added tests for new activities editor components
dmcavoy Sep 8, 2020
f318b98
Update some things in LevelTokenDetailsTest to make pass
dmcavoy Sep 8, 2020
1fc223b
Remove lockable on lesson from script edit gui
dmcavoy Sep 8, 2020
c5a362d
Update button count since only one lesson group
dmcavoy Sep 8, 2020
068cd0f
Add shapes for activity, activity section, and update level
dmcavoy Sep 10, 2020
f7cdce9
Find an available activity key to use for activity
dmcavoy Sep 10, 2020
a3023af
Generate an available activity section key
dmcavoy Sep 10, 2020
4aebae4
Generate key for tips
dmcavoy Sep 10, 2020
7b01b41
Add some TODOs marking the work still to be done on this
dmcavoy Sep 10, 2020
56a8af1
Upgrade to latest version of Drone server.
sureshc Sep 11, 2020
9b0d70b
Configure license key.
sureshc Sep 11, 2020
b9bd9c6
More license key configuration.
sureshc Sep 11, 2020
af3a4bd
Fix syntax.
sureshc Sep 11, 2020
eb7b253
Fix volume/mount syntax.
sureshc Sep 11, 2020
f6a1c48
Revert "Upgrade to latest version of Drone server."
sureshc Sep 11, 2020
b4d6833
License doesn't work because license.drone.io DNS name doesn't resolve.
sureshc Sep 11, 2020
49c5f10
Merge branch 'create-activity-editor' into remove-lockable-script-edit
dmcavoy Sep 11, 2020
a4dceed
Merge branch 'staging' into upgrade-drone-server
sureshc Sep 11, 2020
ff63de4
Revert "Revert "Upgrade to latest version of Drone server.""
sureshc Sep 11, 2020
057e906
Update trademark string in footer
dju90 Sep 11, 2020
db8a5e2
"Hide Toolbar" Helper updates
breville Sep 12, 2020
5e87ec0
"Hide Toolbar" Helper updates
breville Sep 12, 2020
5009006
Upgrade drone worker (runner) to latest.
sureshc Sep 12, 2020
9ca373b
"Hide Toolbar" Helper updates
breville Sep 12, 2020
9959b02
Remove addleveldialog from this PR
dmcavoy Sep 12, 2020
57513ad
Revert "Remove addleveldialog from this PR"
dmcavoy Sep 12, 2020
83ca3ec
Update setting name for new runner version.
sureshc Sep 12, 2020
cf4c1ff
Add comments and clean up generate key methods
dmcavoy Sep 12, 2020
516b555
Add shapes to props where appropriate
dmcavoy Sep 12, 2020
78afe56
Rename TipWithTooltip
dmcavoy Sep 12, 2020
ebce6e2
Merge branch 'staging' into create-activity-editor
dmcavoy Sep 12, 2020
9a86f19
Merge branch 'create-activity-editor' into add-level-dialog
dmcavoy Sep 12, 2020
6676cf1
Merge branch 'add-level-dialog' into remove-lockable-script-edit
dmcavoy Sep 12, 2020
3894332
Update AMI for EC2 Instance running Drone Runner containers to suppor…
sureshc Sep 12, 2020
49d8163
Sign changes to build pipeline.
sureshc Sep 12, 2020
765e6f8
Trigger build
sureshc Sep 14, 2020
f0768ee
Triggers *limit* builds for the conditions specified, unless an `incl…
sureshc Sep 14, 2020
d4c4a75
Fix yaml syntax.
sureshc Sep 14, 2020
44e7c6b
I was wrong. We don't need to use `include` for the branch trigger.
sureshc Sep 14, 2020
28024d5
Fix test
breville Sep 14, 2020
635bf3d
Merge branch 'staging' into create-activity-editor
dmcavoy Sep 14, 2020
761c9c9
Fix a couple suggestions from PR
dmcavoy Sep 14, 2020
5456171
Merge branch 'create-activity-editor' into add-level-dialog
dmcavoy Sep 14, 2020
dd73f33
Merge branch 'add-level-dialog' into remove-lockable-script-edit
dmcavoy Sep 14, 2020
36777f5
Merge branch 'staging' into update-trademark-footer-string
dju90 Sep 14, 2020
e126ac7
Merge branch 'staging' into update-trademark-footer-string
dju90 Sep 14, 2020
fef7310
Merge branch 'staging' into hide-toolbar-helper-updates
breville Sep 15, 2020
38a2145
Removed problematic test assertion.
jmkulwik Sep 15, 2020
079d269
Merge pull request #36766 from code-dot-org/fix-drone
jmkulwik Sep 15, 2020
145b582
Merge branch 'staging' into hide-toolbar-helper-updates
breville Sep 15, 2020
35df969
Merge pull request #36768 from code-dot-org/staging
deploy-code-org Sep 15, 2020
8a6f853
use detected language
molly-moen Sep 15, 2020
e7d7ec7
Merge branch 'staging' into update-trademark-footer-string
dju90 Sep 16, 2020
9dc0f11
Merge branch 'staging' into create-activity-editor
dmcavoy Sep 16, 2020
d25a427
Merge branch 'create-activity-editor' into add-level-dialog
dmcavoy Sep 16, 2020
d6a8a10
Merge branch 'add-level-dialog' into remove-lockable-script-edit
dmcavoy Sep 16, 2020
12ef896
Get drone to run
dmcavoy Sep 16, 2020
5ff9e29
Get drone to run
dmcavoy Sep 16, 2020
f83fee5
Merge pull request #36627 from code-dot-org/create-activity-editor
dmcavoy Sep 16, 2020
e98d275
Merge branch 'staging' into add-level-dialog
dmcavoy Sep 16, 2020
c9b4366
Get drone to run
dmcavoy Sep 16, 2020
3964682
Merge pull request #36771 from code-dot-org/hoc-language
molly-moen Sep 16, 2020
fa4f986
Merge pull request #36732 from code-dot-org/add-level-dialog
dmcavoy Sep 16, 2020
ff2553a
Merge pull request #36643 from code-dot-org/remove-lockable-script-edit
dmcavoy Sep 16, 2020
bacb812
Merge pull request #36712 from code-dot-org/upgrade-drone-server
sureshc Sep 16, 2020
0958c8e
Merge pull request #36731 from code-dot-org/hide-toolbar-helper-updates
breville Sep 16, 2020
5f47d17
staging content changes (-robo-commit)
deploy-code-org Sep 16, 2020
65494f1
Merge pull request #36730 from code-dot-org/update-trademark-footer-s…
dju90 Sep 16, 2020
5e79640
Merge pull request #36777 from code-dot-org/levelbuilder
deploy-code-org Sep 16, 2020
47d176a
Merge pull request #36781 from code-dot-org/staging
davidsbailey Sep 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 3 additions & 37 deletions .drone.yml
@@ -1,5 +1,6 @@
---
kind: pipeline
type: docker
name: unit

clone:
Expand All @@ -15,24 +16,6 @@ steps:
- git remote set-branches --add origin $DRONE_TARGET_BRANCH
- git fetch --depth 100 origin $DRONE_TARGET_BRANCH

- name: verify-pr
image: wjordan/code-dot-org:2020-09-10
pull: always
commands:
- |
if [ -z "$DRONE_PULL_REQUEST" ]; then
echo "Not a pull request."
exit 0
fi
# Check to see if PR is from fork. If so, exit, as the test run provides access to secrets.
- head_repo=$(curl -s "https://api.github.com/repos/code-dot-org/code-dot-org/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.full_name)
- echo $head_repo
- |
if [ "$head_repo" != '"code-dot-org/code-dot-org"' ]; then
echo "Pull request is from fork $head_repo; exiting."
exit 1
fi

- name: restore-cache
image: plugins/s3-cache
settings:
Expand Down Expand Up @@ -100,6 +83,7 @@ trigger:

---
kind: pipeline
type: docker
name: ui

clone:
Expand All @@ -126,24 +110,6 @@ steps:
- git config user.email "drone-fake-user@code.org"
- git merge origin/$DRONE_TARGET_BRANCH

- name: verify-pr
image: wjordan/code-dot-org:2020-09-10
pull: always
commands:
- |
if [ -z "$DRONE_PULL_REQUEST" ]; then
echo "Not a pull request."
exit 0
fi
# Check to see if PR is from fork. If so, exit, as the test run provides access to secrets.
- head_repo=$(curl -s "https://api.github.com/repos/code-dot-org/code-dot-org/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.full_name)
- echo $head_repo
- |
if [ "$head_repo" != '"code-dot-org/code-dot-org"' ]; then
echo "Pull request is from fork $head_repo; exiting."
exit 1
fi

- name: restore-cache
image: plugins/s3-cache
settings:
Expand Down Expand Up @@ -217,6 +183,6 @@ trigger:
- pull_request
---
kind: signature
hmac: c4b01d2892b7314cb674278450cd30e012f01b3d5289eed1d6a2c933947ec623
hmac: b7621086539d5bc60d621e507bab706cad6f36fdd859d8b1d1b18d9670dbe5c6

...
139 changes: 139 additions & 0 deletions apps/src/lib/levelbuilder/lesson-editor/ActivitiesEditor.jsx
@@ -0,0 +1,139 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import color from '@cdo/apps/util/color';
import ActivityCard from '@cdo/apps/lib/levelbuilder/lesson-editor/ActivityCard';
import Activity from '@cdo/apps/templates/lessonOverview/activities/Activity';
import {connect} from 'react-redux';
import {addActivity} from '@cdo/apps/lib/levelbuilder/lesson-editor/activitiesEditorRedux';

const styles = {
activityEditAndPreview: {
display: 'flex',
flexDirection: 'row'
},
editor: {
width: '50%'
},
preview: {
width: '45%',
marginLeft: 20
},
previewBox: {
border: '1px solid black',
padding: 10
},
addActivity: {
fontSize: 14,
color: 'white',
background: color.cyan,
border: `1px solid ${color.cyan}`,
boxShadow: 'none'
}
};

/*
A GUI for editing activities in a lesson. Shows
the editing fields side by side with a preview of how they will
look in the lesson plan.
*/

class ActivitiesEditor extends Component {
static propTypes = {
//redux
activities: PropTypes.array,
addActivity: PropTypes.func
};

constructor(props) {
super(props);

this.state = {
targetActivitySectionPos: null
};
}

handleAddActivity = () => {
this.props.addActivity(
this.props.activities.length,
this.generateActivityKey()
);
};

generateActivityKey = () => {
let activityNumber = this.props.activities.length + 1;
while (
this.props.activities.some(
activity => activity.key === `activity-${activityNumber}`
)
) {
activityNumber++;
}

return `activity-${activityNumber}`;
};

setTargetActivitySection = targetActivitySectionPos => {
this.setState({targetActivitySectionPos});
};

// To be populated with the bounding client rect of each ActivitySectionCard element.
activitySectionMetrics = {};

setActivitySectionMetrics = (metrics, activitySectionPosition) => {
this.activitySectionMetrics[activitySectionPosition] = metrics;
};

render() {
const {activities} = this.props;

return (
<div>
<div style={styles.activityEditAndPreview}>
<div style={styles.editor}>
{activities.map(activity => {
return (
<ActivityCard
activity={activity}
activitiesCount={activities.length}
key={activity.key}
setActivitySectionMetrics={this.setActivitySectionMetrics}
setTargetActivitySection={this.setTargetActivitySection}
targetActivitySectionPos={this.state.targetActivitySectionPos}
activitySectionMetrics={this.activitySectionMetrics}
/>
);
})}
<button
onMouseDown={this.handleAddActivity}
className="btn"
style={styles.addActivity}
type="button"
>
<i style={{marginRight: 7}} className="fa fa-plus-circle" />
Add Activity
</button>
</div>
<div style={styles.preview}>
<h2>Preview</h2>
<div style={styles.previewBox}>
{activities.map(activity => {
return <Activity activity={activity} key={activity.key} />;
})}
</div>
</div>
</div>
</div>
);
}
}

export const UnconnectedActivitiesEditor = ActivitiesEditor;

export default connect(
state => ({
activities: state.activities
}),
{
addActivity
}
)(ActivitiesEditor);
167 changes: 167 additions & 0 deletions apps/src/lib/levelbuilder/lesson-editor/ActivitiesEditor.story.jsx
@@ -0,0 +1,167 @@
import React from 'react';
import ActivitiesEditor from '@cdo/apps/lib/levelbuilder/lesson-editor/ActivitiesEditor';
import {createStoreWithReducers, registerReducers} from '@cdo/apps/redux';
import reducers, {
init
} from '@cdo/apps/lib/levelbuilder/lesson-editor/activitiesEditorRedux';
import {Provider} from 'react-redux';

const activities = [
{
key: 'activity-1',
displayName: 'Main Activity',
position: 1,
time: 20,
activitySections: [
{
key: 'section-3',
position: 1,
displayName: 'Making programs',
remarks: true,
slide: false,
levels: [],
text:
'Today we are going to be looking at some sample apps to explore their purpose and function.',
tips: []
},
{
key: 'section-1',
position: 2,
displayName: '',
remarks: false,
slide: true,
levels: [],
text: 'In this activity you will be learning about making activities.',
tips: [
{
key: 'tip-1',
type: 'teachingTip',
markdown:
'After students are finished writing in their journals, discuss as a class or collect the journals to review student answers. \n- An input could be a user clicking a button or tapping the screen. \n- An output could be an image displayed or a sound played'
}
]
},
{
tips: [],
key: 'progression-1',
position: 3,
displayName: 'Programming Progression',
remarks: false,
slide: false,
text: 'This progression teaches you programming!',
levels: [
{
status: 'not started',
url: 'https://levelbuilder-studio.code.org/levels/598/edit',
name: 'Level 1',
icon: 'fa-desktop',
isUnplugged: false,
levelNumber: 1,
isCurrentLevel: false,
isConceptLevel: true,
sublevels: [],
position: 1,
activeId: 1,
ids: [1],
kind: 'puzzle',
skin: null,
videoKey: null,
concepts: '',
conceptDifficulty: '',
named: false,
assessment: false,
challenge: false
},
{
status: 'not started',
url: 'https://levelbuilder-studio.code.org/levels/598/edit',
icon: 'fa-desktop',
name: 'Level 2',
isUnplugged: false,
levelNumber: 2,
isCurrentLevel: false,
isConceptLevel: false,
sublevels: [],
position: 2,
activeId: 2,
ids: [2, 3],
kind: 'assessment',
skin: null,
videoKey: null,
concepts: '',
conceptDifficulty: '',
named: false,
assessment: true,
challenge: false
}
]
},
{
key: 'section-2',
displayName: 'Discussion',
position: 4,
remarks: false,
slide: false,
levels: [],
text:
'**Prompt:** With a partner, discuss the following and note down in your journal:\n - How does the user interact with the app?\n - What is the overall purpose of this app?\n - Who is the target audience?\n\n**Share Out:** As a class, discuss student answers to the discussion questions.',
tips: [
{
key: 'tip-2',
type: 'discussionGoal',
markdown: 'Make sure to get to the point'
},
{
key: 'tip-3',
type: 'assessmentOpportunity',
markdown: 'Are students getting it?'
}
]
}
]
},
{
key: 'activity-2',
displayName: '',
time: 0,
position: 2,
activitySections: [
{
key: 'section-1',
text: '',
displayName: '',
remarks: false,
slide: false,
tips: [],
levels: [],
position: 1
}
]
}
];

const levelKeyList = {
1: 'Level 1',
2: 'Level 2 - 1',
3: 'Level 2 - 2',
4: 'blockly:Studio:playlab_1'
};

const createStore = () => {
registerReducers({...reducers});
const store = createStoreWithReducers();
store.dispatch(init(activities, levelKeyList));
return store;
};
export default storybook => {
storybook.storiesOf('ActivitiesEditor', module).addStoryTable([
{
name: 'ActivitiesEditor',
story: () => (
<Provider store={createStore()}>
<ActivitiesEditor />
</Provider>
)
}
]);
};