mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-27 22:39:55 +00:00
Prepare for electron
This commit is contained in:
parent
9ca44ae21b
commit
d2cc41b19b
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/ng-dist
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
40
.yarnclean
Normal file
40
.yarnclean
Normal file
@ -0,0 +1,40 @@
|
||||
# test directories
|
||||
__tests__
|
||||
node_modules/*/test
|
||||
node_modules/*/tests
|
||||
powered-test
|
||||
e2e
|
||||
|
||||
# asset directories
|
||||
docs
|
||||
doc
|
||||
website
|
||||
images
|
||||
|
||||
# examples
|
||||
example
|
||||
examples
|
||||
|
||||
# code coverage directories
|
||||
coverage
|
||||
.nyc_output
|
||||
|
||||
# build scripts
|
||||
Makefile
|
||||
Gulpfile.js
|
||||
Gruntfile.js
|
||||
|
||||
# configs
|
||||
.tern-project
|
||||
.gitattributes
|
||||
.editorconfig
|
||||
.*ignore
|
||||
.eslintrc
|
||||
.jshintrc
|
||||
.flowconfig
|
||||
.documentup.json
|
||||
.yarn-metadata.json
|
||||
|
||||
# misc
|
||||
*.gz
|
||||
*.md
|
19
index.html
Normal file
19
index.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<!-- All of the Node.js APIs are available in this renderer process. -->
|
||||
We are using Node.js <script>document.write(process.versions.node)</script>,
|
||||
Chromium <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
|
||||
<script>
|
||||
// You can also require other files to run in this process
|
||||
require('./renderer.js')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
60
main.js
Normal file
60
main.js
Normal file
@ -0,0 +1,60 @@
|
||||
const electron = require('electron')
|
||||
// Module to control application life.
|
||||
const app = electron.app
|
||||
// Module to create native browser window.
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow
|
||||
|
||||
function createWindow () {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({width: 800, height: 600})
|
||||
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadURL(url.format({
|
||||
pathname: path.join(__dirname, 'ng-dist/index.html'),
|
||||
protocol: 'file:',
|
||||
slashes: true
|
||||
}))
|
||||
|
||||
// Open the DevTools.
|
||||
// mainWindow.webContents.openDevTools()
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', function () {
|
||||
// Dereference the window object, usually you would store windows
|
||||
// in an array if your app supports multi windows, this is the time
|
||||
// when you should delete the corresponding element.
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', createWindow)
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function () {
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', function () {
|
||||
// On OS X it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (mainWindow === null) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
|
||||
// In this file you can include the rest of your app's specific main process
|
||||
// code. You can also put them in separate files and require them here.
|
@ -2,13 +2,15 @@
|
||||
"name": "gns3-web-ui",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e"
|
||||
"e2e": "ng e2e",
|
||||
"build-for-electron": "ng build --prod --output-path ng-dist --base-href ./"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
@ -55,6 +57,8 @@
|
||||
"protractor": "~5.2.0",
|
||||
"ts-node": "~4.1.0",
|
||||
"tslint": "~5.8.0",
|
||||
"typescript": ">=2.4.0 <2.6.0"
|
||||
"typescript": ">=2.4.0 <2.6.0",
|
||||
"popper.js": "^1.12.3",
|
||||
"jquery": "1.9.1 - 3"
|
||||
}
|
||||
}
|
||||
|
3
renderer.js
Normal file
3
renderer.js
Normal file
@ -0,0 +1,3 @@
|
||||
// This file is required by the index.html file and will
|
||||
// be executed in the renderer process for that window.
|
||||
// All of the Node.js APIs are available in this process.
|
@ -42,7 +42,7 @@ import { ProjectsComponent } from './projects/projects.component';
|
||||
import { DefaultLayoutComponent } from './default-layout/default-layout.component';
|
||||
import { ProgressDialogComponent } from './shared/progress-dialog/progress-dialog.component';
|
||||
import { AppComponent } from './app.component';
|
||||
import { MapComponent } from './cartography/map/map.component';
|
||||
//import { MapComponent } from './cartography/map/map.component';
|
||||
import { CreateSnapshotDialogComponent, ProjectMapComponent } from './project-map/project-map.component';
|
||||
import { ServersComponent, AddServerDialogComponent } from './servers/servers.component';
|
||||
import { NodeContextMenuComponent } from './shared/node-context-menu/node-context-menu.component';
|
||||
@ -51,13 +51,12 @@ import { StopNodeActionComponent } from './shared/node-context-menu/actions/stop
|
||||
import { ApplianceComponent } from './appliance/appliance.component';
|
||||
import { ApplianceListDialogComponent } from './appliance/appliance-list-dialog/appliance-list-dialog.component';
|
||||
import { NodeSelectInterfaceComponent } from './shared/node-select-interface/node-select-interface.component';
|
||||
|
||||
import { CartographyModule } from './cartography/cartography.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
MapComponent,
|
||||
ProjectMapComponent,
|
||||
ServersComponent,
|
||||
AddServerDialogComponent,
|
||||
@ -92,7 +91,8 @@ import { NodeSelectInterfaceComponent } from './shared/node-select-interface/nod
|
||||
MatDialogModule,
|
||||
MatProgressBarModule,
|
||||
MatProgressSpinnerModule,
|
||||
CdkTableModule
|
||||
CdkTableModule,
|
||||
CartographyModule
|
||||
],
|
||||
providers: [
|
||||
D3Service,
|
||||
|
@ -6,6 +6,7 @@ import { MapComponent } from './map/map.component';
|
||||
imports: [
|
||||
CommonModule
|
||||
],
|
||||
declarations: [MapComponent]
|
||||
declarations: [MapComponent],
|
||||
exports: [MapComponent]
|
||||
})
|
||||
export class CartographyModule { }
|
||||
|
@ -17,7 +17,7 @@ export class NodeContextMenuComponent implements OnInit {
|
||||
|
||||
private topPosition;
|
||||
private leftPosition;
|
||||
private node: Node;
|
||||
public node: Node;
|
||||
|
||||
constructor(
|
||||
private sanitizer: DomSanitizer,
|
||||
|
@ -17,7 +17,7 @@ export class NodeSelectInterfaceComponent implements OnInit {
|
||||
|
||||
private topPosition;
|
||||
private leftPosition;
|
||||
private node: Node;
|
||||
public node: Node;
|
||||
|
||||
constructor(
|
||||
private sanitizer: DomSanitizer,
|
||||
|
Loading…
x
Reference in New Issue
Block a user