Skip to content

Commit

Permalink
Merge pull request #7 from labbsr0x/settings
Browse files Browse the repository at this point in the history
Settings
  • Loading branch information
eabili0 authored May 20, 2020
2 parents de01bb3 + 7b35eb1 commit 9728e9c
Show file tree
Hide file tree
Showing 18 changed files with 573 additions and 309 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"env": {
"es6": true,
"node": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"__": true,
"describe": true,
"it": true,
"afterEach": true
},
"overrides": [
{
"files": ["*.svelte"],
"processor": "svelte3/svelte3"
}
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"svelte3"
],
"rules": {
"indent": ["error", "tab"],
"no-tabs": "off"
}
}
21 changes: 21 additions & 0 deletions .github/workflows/nodeci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Node.js CI

on: [push]

jobs:
container-job:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.1, 13.7.0]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run lint
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/public/build/

.DS_Store
.vscode/
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv public --single"
"start": "sirv public --single",
"lint": "npx eslint src/"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.0",
"@rollup/plugin-node-resolve": "^7.0.0",
"eslint": "^7.0.0",
"eslint-plugin-svelte3": "^2.7.3",
"rollup": "^1.20.0",
"rollup-plugin-livereload": "^1.0.0",
"rollup-plugin-postcss": "^2.5.0",
Expand Down
Binary file added public/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ dotenv.config()
const fileEnv = process.env.NODE_ENV ? `.env.${process.env.NODE_ENV}` : '.env'

// get the env variables from the .env file relative to the current NODE_ENV
const ENV_VARS = dotenv.parse(fs.readFileSync(path.resolve(__dirname, fileEnv)))

let ENV_VARS = {}
try {
ENV_VARS = dotenv.parse(fs.readFileSync(path.resolve(__dirname, fileEnv)))
} catch (err) {
ENV_VARS = {}
}
const valuesEnvToReplace = () => {
return Object.entries(ENV_VARS).reduce((acc, [key, val]) => {
acc[`process.env.${key}`] = JSON.stringify(val)
return acc
}, {})
return Object.entries(ENV_VARS).reduce((acc, [key, val]) => {
acc[`process.env.${key}`] = JSON.stringify(val)
return acc
}, {})
}

const production = !process.env.ROLLUP_WATCH;
Expand Down
101 changes: 56 additions & 45 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="drawer-container">
<Drawer variant="dismissible" bind:this={myDrawer} bind:open={myDrawerOpen}>
<Header style="padding: 0px">
<Img style="width: 256px; heigth: inherit;" src="/{process.env.IMG_LOGO}" />
<Img style="width: 256px; heigth: inherit;" src="/default.png" />
</Header>
<Content>
<List>
Expand All @@ -27,7 +27,7 @@
<Row>
<Section>
<IconButton on:click={() => myDrawerOpen = !myDrawerOpen} class="material-icons">menu</IconButton>
<Title>{process.env.TITLE}</Title>
<Title>{'TITLE' in process.env ? process.env.TITLE : 'Big Brother Manager'}</Title>
</Section>
</Row>
</TopAppBar>
Expand All @@ -36,9 +36,11 @@
<div class="col-md-6 offset-md-3">
<Router url="{url}">
<Route path="apps" component="{Services}" />
<Route path="settings" component="{Settings}" />
<Route path="ips/:nameApp" component="{Ips}" />
<Route path="versions/:nameApp" component="{Versions}" />
<Route path="newApp" component="{CreateService}" />
<Route path="new/:form" component="{BasicForm}" />
<Route path="/"><Home /></Route>
</Router>
</div>
Expand All @@ -53,49 +55,58 @@
</section>

<script>
import { Router, Link, Route, link, navigate } from "svelte-routing";
import TopAppBar, {Row, Section, Title} from '@smui/top-app-bar';
import IconButton from '@smui/icon-button';
import Drawer, {AppContent, Content, Header, Scrim} from '@smui/drawer';
import Button, {Label} from '@smui/button';
import List, {Item, Text, Graphic, Separator, Subheader} from '@smui/list';
import H6 from '@smui/common/H6.svelte';
import Img from '@smui/common/Img.svelte'
import Home from "./Home.svelte";
import Services from './Services.svelte'
import CreateService from './CreateService.svelte'
import Ips from './Ips.svelte'
import Versions from './Versions.svelte'
export let url = "";
let clicked = 'nothing yet';
let myDrawer;
let myDrawerOpen = false;
let active = 'Gray Kittens';
let myDrawer2;
let myDrawer2Open = false;
let active2 = 'Inbox';
let menus = [
{
icon: 'home',
value: 'home',
text: 'Home',
link: '/',
component: Home
},
{
icon: 'apps',
value: 'apps',
text: 'Aplications',
link: '/apps',
component: Services
}
]
let selected = Home
function setActive(menu) {
navigate(menu.link, { replace: true });
active = menu.value;
myDrawerOpen = false;
}
import { Router, Link, Route, link, navigate } from "svelte-routing";
import TopAppBar, {Row, Section, Title} from '@smui/top-app-bar';
import IconButton from '@smui/icon-button';
import Drawer, {AppContent, Content, Header, Scrim} from '@smui/drawer';
import Button, {Label} from '@smui/button';
import List, {Item, Text, Graphic, Separator, Subheader} from '@smui/list';
import H6 from '@smui/common/H6.svelte';
import Img from '@smui/common/Img.svelte'
import Home from "./Home.svelte";
import Services from './Services.svelte'
import Settings from './Settings.svelte'
import BasicForm from './forms/BasicForm.svelte'
import CreateService from './CreateService.svelte'
import Ips from './Ips.svelte'
import Versions from './Versions.svelte'
export let url = "";
let clicked = 'nothing yet';
let myDrawer;
let myDrawerOpen = false;
let active = 'Gray Kittens';
let myDrawer2;
let myDrawer2Open = false;
let active2 = 'Inbox';
let menus = [
{
icon: 'home',
value: 'home',
text: 'Home',
link: '/',
component: Home
},
{
icon: 'apps',
value: 'apps',
text: 'Aplications',
link: '/apps',
component: Services
},
{
icon: 'settings',
value: 'settings',
text: 'Configurações',
link: '/settings',
component: Services
}
]
let selected = Home
function setActive(menu) {
navigate(menu.link, { replace: true });
active = menu.value;
myDrawerOpen = false;
}
</script>

<style>
Expand Down
54 changes: 27 additions & 27 deletions src/CreateService.svelte
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<script>
import Card, {Content, PrimaryAction, Media, MediaContent, Actions, ActionButtons, ActionIcons} from '@smui/card';
import Button, {Label} from '@smui/button';
import Textfield, {Input, Textarea} from '@smui/textfield'
import HelperText from '@smui/textfield/helper-text/index'
import FloatingLabel from '@smui/floating-label';
import NotchedOutline from '@smui/notched-outline';
import { navigate } from "svelte-routing";
import api from './api/'
let appName = ''
let appDesc = ''
let open = false
const createApp = async () => {
try {
await api.post('/add/app', {
name: appName,
desc: appDesc,
address: ''
})
navigate(`apps`)
} catch (err) {
open = true
console.log(`erro`, err)
}
}
const cancel = async () => {
navigate(`/`)
}
import Card, {Content, PrimaryAction, Media, MediaContent, Actions, ActionButtons, ActionIcons} from '@smui/card';
import Button, {Label} from '@smui/button';
import Textfield, {Input, Textarea} from '@smui/textfield'
import HelperText from '@smui/textfield/helper-text/index'
import FloatingLabel from '@smui/floating-label';
import NotchedOutline from '@smui/notched-outline';
import { navigate } from "svelte-routing";
import api from './api/'
let appName = ''
let appDesc = ''
let open = false
const createApp = async () => {
try {
await api.post('/add/app', {
name: appName,
desc: appDesc,
address: ''
})
navigate(`apps`)
} catch (err) {
open = true
console.log(`erro`, err)
}
}
const cancel = async () => {
navigate(`/`)
}
</script>
<style>
Expand Down
Loading

0 comments on commit 9728e9c

Please sign in to comment.