-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add minimal process applications frontend
- Loading branch information
1 parent
2bf52ec
commit 01fa2dd
Showing
6 changed files
with
240 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
client/src/app/process-applications/ProcessApplications.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. | ||
* | ||
* Camunda licenses this file to you under the MIT; you may not use this file | ||
* except in compliance with the MIT License. | ||
*/ | ||
|
||
export default class ProcessApplications { | ||
constructor(app) { | ||
this._app = app; | ||
|
||
this._processApplication = null; | ||
} | ||
|
||
/** | ||
* @param {string} path | ||
*/ | ||
async open(path) { | ||
try { | ||
const file = await this._app.getGlobal('fileSystem').readFile(path); | ||
|
||
this._processApplication = this._createFromFile(file); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
|
||
this._app.emit('process-applications:changed'); | ||
} | ||
|
||
_createFromFile(file) { | ||
return { | ||
...JSON.parse(file.contents), | ||
file | ||
}; | ||
} | ||
|
||
get() { | ||
return this._processApplication; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
client/src/app/process-applications/components/ProcessApplicationsStatusBar.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. | ||
* | ||
* Camunda licenses this file to you under the MIT; you may not use this file | ||
* except in compliance with the MIT License. | ||
*/ | ||
|
||
import React, { useRef, useState } from 'react'; | ||
|
||
import { Fill } from '../../slot-fill'; | ||
|
||
import { Overlay, Section } from '../../../shared/ui'; | ||
|
||
export default function ProcessApplicationStatusBar(props) { | ||
const ref = useRef(); | ||
|
||
const [ isOpen, setIsOpen ] = useState(false); | ||
|
||
const { processApplication } = props; | ||
|
||
if (!processApplication) { | ||
return null; | ||
} | ||
|
||
return <> | ||
<Fill slot="status-bar__file" group="0_process-application"> | ||
<button className="btn" ref={ ref } onClick={ () => setIsOpen(!isOpen) }> | ||
Process application | ||
</button> | ||
</Fill> | ||
{ | ||
isOpen && <Overlay id="process-application-overlay" anchor={ ref.current }> | ||
<Section> | ||
<Section.Header> | ||
Files | ||
</Section.Header> | ||
<Section.Body> | ||
<ul className="dashed"> | ||
{ | ||
processApplication.files.map(file => { | ||
return <li key={ file.path } title={ file.path }>{ file.name }</li>; | ||
}) | ||
} | ||
</ul> | ||
</Section.Body> | ||
</Section> | ||
</Overlay> | ||
} | ||
</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. | ||
* | ||
* Camunda licenses this file to you under the MIT; you may not use this file | ||
* except in compliance with the MIT License. | ||
*/ | ||
|
||
export { default as ProcessApplicationsStatusBar } from './ProcessApplicationsStatusBar'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. | ||
* | ||
* Camunda licenses this file to you under the MIT; you may not use this file | ||
* except in compliance with the MIT License. | ||
*/ | ||
|
||
export { default } from './ProcessApplications'; |