Skip to content

Commit

Permalink
Merge branch 'release/2.0.0rc3'
Browse files Browse the repository at this point in the history
  • Loading branch information
acunniffe committed Oct 28, 2018
2 parents ed4aed6 + 92225de commit fc8b456
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 3,351 deletions.
6 changes: 3 additions & 3 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "optic-cli",
"version": "2.0.0rc1",
"version": "2.0.0rc3",
"description": "",
"main": "./lib/Cli.js",
"scripts": {
Expand All @@ -21,7 +21,7 @@
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"mocha": "^3.4.2"
"mocha": "^5.2.0"
},
"dependencies": {
"ajv": "^5.2.3",
Expand Down Expand Up @@ -52,7 +52,7 @@
"node-persist": "2.1.0",
"object-path": "^0.11.4",
"opn": "^5.4.0",
"optic-editor-sdk": "^0.3.0",
"optic-editor-sdk": "^0.3.2",
"os": "^0.1.1",
"platform": "^1.3.5",
"progress": "^1.1.8",
Expand Down
2 changes: 1 addition & 1 deletion cli/src/Cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ commands.attachCommand(refreshCmd)
// commands.attachCommand(createuserCmd)
// commands.attachCommand(adduserCmd)

export const standardHelp = program.helpInformation()
export const standardHelp = () => program.helpInformation()

if (!notifier.update || isDev) { //let's force updates
processInput()
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {driver} from './jre/jre-install'
import "regenerator-runtime/runtime";

export const isDev = true
export const isDev = false

export default (() => {

Expand Down
8 changes: 7 additions & 1 deletion cli/src/interactive/Interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ global.destructiveLogger = (log) => {
const editorDisplayManager = new EditorDisplayManager()

const defaultState = {
inspectMode: false,
inputValue: '',
ide: '',
context: null,
Expand All @@ -51,7 +52,7 @@ export function shouldStart() {
resolve()
})

agentC.onError(() => {
agentC.onError((e) => {
console.error(colors.red(`Current directory does not include Optic project. Run 'optic init' to create one`))
process.exit(0)
})
Expand Down Expand Up @@ -110,6 +111,11 @@ export function startInteractive(initialState = {}) {
})

agentConnection().onContextFound((data) => {

if (!getState().inspectMode) {
return
}

if (data.results.models.length) {

const currentIntent = getState().intent
Expand Down
6 changes: 6 additions & 0 deletions cli/src/interactive/actions/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export const actionHandler = (setState, getCurrentState) => {
setState({contentMode: contentModesEnum.SYNC, inputValue: '', intent: sync})
sync.start()
break;
case 'inspect':
setState({inspectMode: true, inputValue: ''})
break;
case 'no inspect':
setState({inspectMode: false, inputValue: ''})
break;
default:
if (getCurrentState().contentMode === contentModesEnum.EMPTY) {
const searchItem = getCurrentState().selectedSearchItem
Expand Down
1 change: 0 additions & 1 deletion cli/src/interactive/components/BottomInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const bottomInput = () => new Child((initialState, setState, actionHandle
const input = blessed.textbox({
style: {
fg: 'default',
bg: '#e2e2e2',
bar: {
bg: 'default',
fg: 'blue'
Expand Down
4 changes: 2 additions & 2 deletions cli/src/interactive/components/Content.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import blessed from "blessed";
import {Child} from "../reactive-blessed/Child";
import {contentModesEnum} from "../constants/ContentModes";
import {helpText} from "../constants/Help";
import {searchList} from "./SearchList";
import {atBottomAndDown, jsonForm} from "./form/JSONForm";
import {toggleOnAssertion} from "../util/ToggleOnAssertion";
import {topFormHelp} from "./form/TopFormHelp";
import {indicatorContent} from "./IndicatorContent";
import {standardHelp} from "../../Cli";

let lastState = {}
let lastIsConfirm = false
Expand Down Expand Up @@ -75,7 +75,7 @@ export const content = () => new Child((initialState, setState, actionHandler) =
function contentForMode(state) {
switch (state.contentMode) {
case contentModesEnum.HELP:
return helpText
return standardHelp()
break;
default:
return ''
Expand Down
5 changes: 1 addition & 4 deletions cli/src/interactive/components/SearchList.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ export const searchList = () => new Child((initialState, setState, actionHandler

const knowledgeGraphToSearchResults = (inputValue, knowledgeGraph) => {

if (!inputValue) {
return []
}
const nodes = knowledgeGraph.nodes.filter((i) => !i.internal)
const nodes = knowledgeGraph.nodes.filter((i) => !i.internal && i.name.includes(' '))
const relationships = knowledgeGraph.edges.filter((i) => i.isTransformation)

const array = nodes.map((i) => {
Expand Down
1 change: 0 additions & 1 deletion cli/src/interactive/components/form/BottomFormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const bottomFormInput = () => new Child((initialState, setState, actionHa
const input = blessed.textbox({
style: {
fg: 'default',
bg: '#e2e2e2',
bar: {
bg: 'default',
fg: 'blue'
Expand Down
3 changes: 0 additions & 3 deletions cli/src/interactive/constants/Help.js

This file was deleted.

3 changes: 1 addition & 2 deletions cli/src/interactive/intent/GenerateIntent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {IntentBase} from "./base/IntentBase";
import {JSONStage} from "./stages/JSONStage";
import {routeSchema} from "../json-editor/test/ExampleSchemas";
import {IndicatorStage} from "./stages/IndicatorStage";
import {resetToMain} from "../actions/StateMutations";
import {AsChildOf, Clipboard} from "../../optic/PostChangesInterfaces";
Expand All @@ -15,7 +14,7 @@ export class GenerateIntent extends IntentBase {
super({stages: [
new JSONStage({
initialValue: {},
schema: routeSchema
schema: searchItem.schema
}),
new IndicatorStage(() => {
const jsonStage = this.stages[0]
Expand Down
7 changes: 7 additions & 0 deletions cli/src/interactive/reactive-blessed/Child.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ export class Child {
return process.exit(0);
});

node.key(['escape'], (ch, key) => {
const intent = screen.currentState().intent
if (intent) {
intent.finish()
}
});

this._blessedInstance = node
this.addChildren(this._children, screen)
screen.registerChild(this)
Expand Down
4 changes: 4 additions & 0 deletions cli/src/optic/AgentSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ let _agentConnection = null
export function agentConnection(connectCallback) {
if (!_agentConnection) {
_agentConnection = AgentConnection({name: config.projectDirectory})

setInterval(() => {
_agentConnection.socket.send('ping')
}, 30000)
}

if (typeof connectCallback === 'function') {
Expand Down
Loading

0 comments on commit fc8b456

Please sign in to comment.