@silexlabs/silex-dashboard 1.0.41 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitmodules +2 -2
- package/11ty/eleventy.config.mjs +62 -0
- package/README.md +8 -2
- package/collections/connectors/en.md +70 -0
- package/collections/connectors/fr.md +72 -0
- package/collections/home/en.md +57 -0
- package/{pages/fr/index.md → collections/home/fr.md} +20 -21
- package/collections/languages/en.json +5 -0
- package/collections/languages/fr.json +5 -0
- package/collections/settings/en.json +127 -0
- package/collections/settings/fr.json +131 -0
- package/package.json +17 -8
- package/silex/client-config.js +24 -0
- package/{.silex.js → silex/server-config.js} +8 -16
- package/templates/connectors-en.11tydata.mjs +56 -0
- package/templates/connectors-en.html +440 -0
- package/templates/connectors-fr.11tydata.mjs +56 -0
- package/templates/connectors-fr.html +440 -0
- package/templates/css/connectors-61bd21c2345101e48cc530cacf3afc0156ce7e089fcef3a34f853a537f0c55f2.css +1 -0
- package/templates/css/websites-4b9b2b0a0a907b33eca109d50c2a3eee97f1955c742cef487110d21a0bbf8f50.css +1 -0
- package/templates/websites-en.11tydata.mjs +108 -0
- package/templates/websites-en.html +478 -0
- package/templates/websites-fr.11tydata.mjs +108 -0
- package/templates/websites-fr.html +478 -0
- package/tina/config.ts +258 -0
- package/tina/tina-lock.json +1 -0
- package/.eleventy.js +0 -11
- package/.silex-client.js +0 -22
- package/_data/languages.json +0 -7
- package/_includes/api-connectors.js.html +0 -96
- package/_includes/api-websites.js.html +0 -189
- package/_includes/connectors.html +0 -253
- package/_includes/websites.html +0 -548
- package/_silex/old/assets/alex-hoyau.jpg +0 -0
- package/_silex/old/assets/alex-small.jpg +0 -0
- package/_silex/old/assets/empty-projects.gif +0 -0
- package/_silex/old/assets/gitlab.svg +0 -13
- package/_silex/old/assets/picto-silex.png +0 -0
- package/_silex/old/assets/silex-icon-2018@200px.png +0 -0
- package/_silex/old/meta.json +0 -1
- package/_silex/old/website.json +0 -1
- package/_site/assets/alex-small.jpg +0 -0
- package/_site/assets/bg-purpel-silex.webp +0 -0
- package/_site/assets/bg-silex-purpel.webp +0 -0
- package/_site/assets/empty-projects-sos.gif +0 -0
- package/_site/assets/gitlab.svg +0 -13
- package/_site/assets/logo-silex.svg +0 -1
- package/_site/assets/picto-silex@3x.png +0 -0
- package/_site/assets/silex-dashboard.png +0 -0
- package/_site/assets/silex-icon-2018@200px.png +0 -0
- package/_site/css/connectors.css +0 -1
- package/_site/css/websites.css +0 -1
- package/_site/en/connectors/index.html +0 -376
- package/_site/en/index.html +0 -795
- package/_site/fr/connectors/index.html +0 -376
- package/_site/fr/index.html +0 -795
- package/assets/alex-small.jpg +0 -0
- package/assets/bg-purpel-silex.webp +0 -0
- package/assets/bg-silex-purpel.webp +0 -0
- package/assets/empty-projects-sos.gif +0 -0
- package/assets/favicon-32x32.png +0 -0
- package/assets/gitlab.svg +0 -13
- package/assets/logo-silex.svg +0 -1
- package/assets/picto-silex@3x.png +0 -0
- package/assets/silex-dashboard.png +0 -0
- package/assets/silex-icon-2018@200px.png +0 -0
- package/pages/connectors.css.liquid +0 -4
- package/pages/en/connectors.md +0 -4
- package/pages/en/en.json +0 -72
- package/pages/en/index.md +0 -28
- package/pages/fr/connectors.md +0 -5
- package/pages/fr/fr.json +0 -72
- package/pages/pages.11tydata.js +0 -5
- package/pages/websites.css.liquid +0 -4
- /package/{_data → 11ty/_data}/api-translations.json +0 -0
- /package/{_data → 11ty/_data}/site.js +0 -0
- /package/{_includes → 11ty/_includes}/alternate.liquid +0 -0
- /package/{_silex/old → templates}/assets/bg-purpel-silex.webp +0 -0
- /package/{_silex/old → templates}/assets/bg-silex-purpel.webp +0 -0
- /package/{_silex/old → templates}/assets/empty-projects-sos.gif +0 -0
- /package/{_site → templates}/assets/favicon-32x32.png +0 -0
- /package/{_silex/old → templates}/assets/logo-silex.svg +0 -0
- /package/{_silex/old → templates}/assets/picto-silex@3x.png +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexlabs/silex-dashboard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"description": "Dashboard for Silex v3",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "silex/server-config.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"start": "
|
|
8
|
-
"build": "
|
|
9
|
-
"
|
|
7
|
+
"start": "concurrently --kill-others \"$npm_execpath run silex:dev\" \"$npm_execpath run 11ty:dev\" \"$npm_execpath run tina:dev\"",
|
|
8
|
+
"build": "start-server-and-test tina:dev http://localhost:4001 11ty:build",
|
|
9
|
+
"silex:dev": "silex --cors-url * --fs-root `pwd`/silex/websites --fs-hosting-root `pwd`/templates --server-config `pwd`/silex/server-config.js --client-config `pwd`/silex/client-config.js --debug",
|
|
10
|
+
"11ty:dev": "npm run 11ty:build -- --serve",
|
|
11
|
+
"11ty:build": "eleventy --config=./11ty/eleventy.config.mjs",
|
|
12
|
+
"tina:dev": "tinacms dev",
|
|
13
|
+
"tina:build": "tinacms build"
|
|
10
14
|
},
|
|
11
15
|
"repository": {
|
|
12
16
|
"type": "git",
|
|
@@ -23,13 +27,18 @@
|
|
|
23
27
|
},
|
|
24
28
|
"homepage": "https://github.com/silexlabs/silex-dashboard#readme",
|
|
25
29
|
"devDependencies": {
|
|
26
|
-
"@11ty/eleventy": "^
|
|
27
|
-
"@silexlabs/silex": "^3.0.0-alpha.
|
|
30
|
+
"@11ty/eleventy": "^3.0.0-alpha.5",
|
|
31
|
+
"@silexlabs/silex": "^3.0.0-alpha.151",
|
|
32
|
+
"@silexlabs/silex-cms": "^0.0.112",
|
|
33
|
+
"@tinacms/cli": "^1.5.43",
|
|
34
|
+
"@types/node": "^20.12.7",
|
|
35
|
+
"concurrently": "^8.2.2",
|
|
36
|
+
"start-server-and-test": "^2.0.3"
|
|
28
37
|
},
|
|
29
38
|
"dependencies": {
|
|
30
39
|
"locale": "^0.1.0",
|
|
31
40
|
"node_modules-path": "^2.0.7",
|
|
32
41
|
"serve-static": "^1.15.0",
|
|
33
|
-
"vue": "^3.
|
|
42
|
+
"vue": "^3.4.23"
|
|
34
43
|
}
|
|
35
44
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import SilexCms from './js/silex-cms/client.js'
|
|
2
|
+
|
|
3
|
+
export default async function (config, options) {
|
|
4
|
+
// Defaults
|
|
5
|
+
const opts = {
|
|
6
|
+
...options,
|
|
7
|
+
}
|
|
8
|
+
config.addPlugin(SilexCms, {
|
|
9
|
+
dataSources: [{
|
|
10
|
+
id: 'tina',
|
|
11
|
+
type: 'graphql',
|
|
12
|
+
name: 'Tina (Local Files)',
|
|
13
|
+
url: 'http://localhost:4001/graphql',
|
|
14
|
+
method: 'POST',
|
|
15
|
+
headers: {
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
},
|
|
18
|
+
}],
|
|
19
|
+
imagePlugin: false,
|
|
20
|
+
i18nPlugin: true,
|
|
21
|
+
cacheBuster: false,
|
|
22
|
+
fetchPlugin: false,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -26,12 +26,6 @@ module.exports = async function(config, options) {
|
|
|
26
26
|
...options,
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
config.setHostingConnectors([
|
|
30
|
-
new FsHosting(config, {
|
|
31
|
-
path: process.env.SILEX_FS_ROOT,
|
|
32
|
-
}),
|
|
33
|
-
])
|
|
34
|
-
|
|
35
29
|
//config.addStorageConnector([
|
|
36
30
|
// //new FsStorage(config, {
|
|
37
31
|
// // path: process.env.SILEX_FS_ROOT,
|
|
@@ -48,19 +42,17 @@ module.exports = async function(config, options) {
|
|
|
48
42
|
// Serve vue from node_modules
|
|
49
43
|
config.addPlugin(StaticPlugin, {
|
|
50
44
|
routes: [{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, {
|
|
54
|
-
path: nodeModules('@silexlabs/silex') + '/@silexlabs/silex/dist/plugins/client/plugins/client/',
|
|
55
|
-
route: '/js',
|
|
56
|
-
}, {
|
|
57
|
-
path: nodeModules('lit-html') + '/lit-html/',
|
|
58
|
-
route: '/js/lit-html/',
|
|
45
|
+
route: '/js/silex-cms/',
|
|
46
|
+
path: node_modules('@silexlabs/silex-cms') + '/@silexlabs/silex-cms/dist/',
|
|
59
47
|
}],
|
|
60
48
|
})
|
|
61
49
|
|
|
62
50
|
// Detect language from browser
|
|
63
|
-
|
|
51
|
+
// List of languages from collections/languages/*.json
|
|
52
|
+
const languages = []
|
|
53
|
+
for (const file of await fs.readdir(join(__dirname, '..', 'collections/languages'))) {
|
|
54
|
+
languages.push(JSON.parse(await fs.readFile(join(__dirname, '..', 'collections/languages', file))))
|
|
55
|
+
}
|
|
64
56
|
|
|
65
57
|
// Serve the dashboard and the editor
|
|
66
58
|
config.on(ServerEvent.STARTUP_START, ({app}) => {
|
|
@@ -79,7 +71,7 @@ module.exports = async function(config, options) {
|
|
|
79
71
|
// Serve scripts
|
|
80
72
|
//router.use('/js/vue/', express.static(node_modules('vue') + '/vue'))
|
|
81
73
|
//router.use('/js/@silexlabs/silex/', express.static(node_modules('@silexlabs/silex') + '/@silexlabs/silex'))
|
|
82
|
-
router.use('/', express.static(join(__dirname, '
|
|
74
|
+
router.use('/', express.static(join(__dirname, '..', '_site')))
|
|
83
75
|
|
|
84
76
|
// Serve the editor when the ?id param is present in the URL
|
|
85
77
|
const editorRouter = express.Router()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export default async function (configData) {
|
|
4
|
+
const data = {
|
|
5
|
+
...configData,
|
|
6
|
+
lang: 'en',
|
|
7
|
+
}
|
|
8
|
+
const result = {}
|
|
9
|
+
try {
|
|
10
|
+
result['tina'] = (await (await fetch(`http://localhost:4001/graphql`, {
|
|
11
|
+
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': `application/json`,
|
|
14
|
+
},
|
|
15
|
+
method: 'POST',
|
|
16
|
+
body: JSON.stringify({
|
|
17
|
+
query: `query {
|
|
18
|
+
__typename
|
|
19
|
+
connectorsConnection {
|
|
20
|
+
__typename
|
|
21
|
+
edges {
|
|
22
|
+
__typename
|
|
23
|
+
node {
|
|
24
|
+
__typename
|
|
25
|
+
subtitle
|
|
26
|
+
help
|
|
27
|
+
recommended
|
|
28
|
+
advanced_users
|
|
29
|
+
connectors {
|
|
30
|
+
__typename
|
|
31
|
+
background_color
|
|
32
|
+
color
|
|
33
|
+
auth_url
|
|
34
|
+
description
|
|
35
|
+
icon
|
|
36
|
+
text
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
lang
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}`,
|
|
48
|
+
})
|
|
49
|
+
})).json()).data
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error('11ty plugin for Silex: error fetching graphql data', e, 'tina', 'http://localhost:4001/graphql')
|
|
52
|
+
throw e
|
|
53
|
+
}
|
|
54
|
+
return result
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: "/{{ lang }}/connectors/"
|
|
3
|
+
lang: "en"
|
|
4
|
+
collection: "Connectors"
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
<!DOCTYPE html>
|
|
8
|
+
<html lang="">
|
|
9
|
+
<head>
|
|
10
|
+
<meta charset="UTF-8">
|
|
11
|
+
<link rel="stylesheet" href="/css/connectors-61bd21c2345101e48cc530cacf3afc0156ce7e089fcef3a34f853a537f0c55f2.css" />
|
|
12
|
+
<!-- font google -->
|
|
13
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
14
|
+
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;700&display=swap" rel="stylesheet">
|
|
15
|
+
{% render "alternate.liquid" languages: languages lang: lang page: page %}
|
|
16
|
+
<style>
|
|
17
|
+
.before-js > * {
|
|
18
|
+
visibility: hidden;
|
|
19
|
+
opacity: 0;
|
|
20
|
+
transition: opacity .5s ease;
|
|
21
|
+
}
|
|
22
|
+
.before-js[data-gjs-type] > *, /* This is only inside the editor, .before-js needs to be on the body */
|
|
23
|
+
.after-js > * {
|
|
24
|
+
visibility: visible;
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
.before-js:before {
|
|
28
|
+
content: 'Loading';
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 49%;
|
|
31
|
+
left: 49%;
|
|
32
|
+
}
|
|
33
|
+
.before-js[data-gjs-type]:before, /* This is only inside the editor, .before-js needs to be on the body */
|
|
34
|
+
.after-js:before {
|
|
35
|
+
content: none;
|
|
36
|
+
}
|
|
37
|
+
/*BTNS*/
|
|
38
|
+
.button, .pointer {
|
|
39
|
+
cursor: pointer!important}
|
|
40
|
+
.button{
|
|
41
|
+
min-width:110px;
|
|
42
|
+
}
|
|
43
|
+
/*BTNS*/
|
|
44
|
+
a {
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
color:#8873FE;
|
|
47
|
+
}
|
|
48
|
+
a:hover {
|
|
49
|
+
text-decoration: underline;
|
|
50
|
+
}
|
|
51
|
+
.uppercase {
|
|
52
|
+
text-transform: uppercase;
|
|
53
|
+
}
|
|
54
|
+
.underline:hover{
|
|
55
|
+
text-decoration: underline;
|
|
56
|
+
text-decoration-thickness: from-font;
|
|
57
|
+
text-underline-position: under;
|
|
58
|
+
}
|
|
59
|
+
/*footer position*/
|
|
60
|
+
.main-min-height {
|
|
61
|
+
min-height: calc(100vh - 560px);
|
|
62
|
+
}
|
|
63
|
+
/*footer position*/
|
|
64
|
+
/*label*/
|
|
65
|
+
::placeholder {
|
|
66
|
+
color: #8873FE;
|
|
67
|
+
}
|
|
68
|
+
input:focus {
|
|
69
|
+
border: 2px solid #9977FE;
|
|
70
|
+
background-color:#ffffff;
|
|
71
|
+
}
|
|
72
|
+
:focus {
|
|
73
|
+
outline: none;
|
|
74
|
+
}
|
|
75
|
+
/*label*/
|
|
76
|
+
.skeleton-anim:after {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
content: "";
|
|
83
|
+
background:
|
|
84
|
+
linear-gradient(0.25turn, transparent, rgba(255,255,255,.75), transparent),
|
|
85
|
+
linear-gradient(transparent, transparent),
|
|
86
|
+
radial-gradient(38px circle at 19px 19px, transparent 50%, transparent 51%),
|
|
87
|
+
linear-gradient(transparent, transparent);
|
|
88
|
+
background-repeat: no-repeat;
|
|
89
|
+
background-size: 315px 250px, 315px 180px, 100px 100px, 225px 30px;
|
|
90
|
+
background-position: -315px 0, 0 0, 0px 190px, 50px 195px;
|
|
91
|
+
animation: loading 1.5s infinite;
|
|
92
|
+
}
|
|
93
|
+
@keyframes loading {
|
|
94
|
+
to {
|
|
95
|
+
background-position: 200% 0, 0 0, 0 190px, 50px 195px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/*FX ANIMATIONS*/
|
|
99
|
+
/*scale-round-inside_pour-BTN*/
|
|
100
|
+
.fx-scale-round {
|
|
101
|
+
position:relative;
|
|
102
|
+
z-index: 10;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
.fx-scale-round::after {
|
|
106
|
+
content: "";
|
|
107
|
+
background: #ffffff;
|
|
108
|
+
position: absolute;
|
|
109
|
+
z-index: -1;
|
|
110
|
+
border-radius: 50%;
|
|
111
|
+
left: -50%;
|
|
112
|
+
right: -50%;
|
|
113
|
+
top: -100%;
|
|
114
|
+
bottom: -100%;
|
|
115
|
+
transform: scale(0, 0);
|
|
116
|
+
transform-origin: center bottom;
|
|
117
|
+
transition: all 0.3s ease-out;
|
|
118
|
+
}
|
|
119
|
+
.fx-scale-round:hover {
|
|
120
|
+
transform-origin: center bottom;
|
|
121
|
+
transform: scale(1.1);
|
|
122
|
+
transition: transform 0.2s cubic-bezier(0, -0.530, 0.405, 2.8);
|
|
123
|
+
}
|
|
124
|
+
.fx-scale-round:hover::after {
|
|
125
|
+
transform: scale(1, 1);
|
|
126
|
+
transition: transform 0.2s cubic-bezier(0, -0.530, 0.405, 2.8);
|
|
127
|
+
}
|
|
128
|
+
/*scale-round-inside_pour-BTN*/
|
|
129
|
+
/*scale*/
|
|
130
|
+
.fx-scale:hover {
|
|
131
|
+
transform-origin: center bottom;
|
|
132
|
+
transform: scale(1.1);
|
|
133
|
+
transition: transform 0.2s cubic-bezier(0, -0.530, 0.405, 2.8);
|
|
134
|
+
}
|
|
135
|
+
/*flash*/
|
|
136
|
+
.fx-flash:hover {
|
|
137
|
+
animation: flash-in .25s ;
|
|
138
|
+
}
|
|
139
|
+
/*flash-in animation*/
|
|
140
|
+
@keyframes flash-in{
|
|
141
|
+
0% {
|
|
142
|
+
opacity:.25;
|
|
143
|
+
}
|
|
144
|
+
100% {
|
|
145
|
+
opacity:1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/*flash-in animation*/
|
|
149
|
+
/*FX ANIMATIONS*/
|
|
150
|
+
</style>
|
|
151
|
+
<script src="/js/vue.global.prod.js"></script>
|
|
152
|
+
<script src="/js/main.js"></script>
|
|
153
|
+
<script type="module">
|
|
154
|
+
console.log('xxxxxx')
|
|
155
|
+
const CONNECTORS_PATH = '/connectors/'
|
|
156
|
+
window.addEventListener('load', function() {
|
|
157
|
+
console.log('xxxxxx')
|
|
158
|
+
const { createApp } = Vue;
|
|
159
|
+
const { api, constants, types } = silex;
|
|
160
|
+
const {
|
|
161
|
+
ConnectorType,
|
|
162
|
+
} = types
|
|
163
|
+
const {
|
|
164
|
+
setServerUrl,
|
|
165
|
+
getUser,
|
|
166
|
+
logout,
|
|
167
|
+
websiteDelete,
|
|
168
|
+
websiteDuplicate,
|
|
169
|
+
websiteList,
|
|
170
|
+
websiteCreate,
|
|
171
|
+
websiteMetaWrite,
|
|
172
|
+
} = api
|
|
173
|
+
function toSafeId(name) {
|
|
174
|
+
return name.replace(/[/\\?%*:|"<>]/g, '_')
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const App = {
|
|
178
|
+
data() {
|
|
179
|
+
return {
|
|
180
|
+
websites: [],
|
|
181
|
+
newWebsiteName: '',
|
|
182
|
+
showCreationForm: false,
|
|
183
|
+
error: null,
|
|
184
|
+
message: null,
|
|
185
|
+
loggedIn: false,
|
|
186
|
+
loading: true,
|
|
187
|
+
storage: null,
|
|
188
|
+
user: null,
|
|
189
|
+
showMenu: false,
|
|
190
|
+
empty: false,
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
mounted() {
|
|
194
|
+
this.init()
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
methods: {
|
|
198
|
+
async init() {
|
|
199
|
+
try {
|
|
200
|
+
// Init Silex server path
|
|
201
|
+
// Go up one level because of the language prefix
|
|
202
|
+
setServerUrl(window.location.origin)
|
|
203
|
+
// Start
|
|
204
|
+
const user = await getUser({type: ConnectorType.STORAGE})
|
|
205
|
+
// Escape single quotes in the picture URL and decode the picture URL
|
|
206
|
+
user.picture = decodeURIComponent(user.picture).replace(/'/g, "\\'")
|
|
207
|
+
if(user) {
|
|
208
|
+
this.user = user
|
|
209
|
+
this.loggedIn = true
|
|
210
|
+
this.websites = await websiteList({connectorId: this.user.storage.connectorId})
|
|
211
|
+
this.empty = this.websites.length === 0
|
|
212
|
+
this.loading = false
|
|
213
|
+
} else {
|
|
214
|
+
this.openLogin()
|
|
215
|
+
}
|
|
216
|
+
} catch (error) {
|
|
217
|
+
console.error(error)
|
|
218
|
+
this.loading = false
|
|
219
|
+
if(error.code === 401 || error.httpStatusCode === 401) {
|
|
220
|
+
this.loggedIn = false
|
|
221
|
+
this.openLogin()
|
|
222
|
+
} else {
|
|
223
|
+
this.error = `{{ api-translations[lang]["Failed to start dashboard"] }} - ${error.message}`
|
|
224
|
+
this.message = ''
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
openLogin(id, lang) {
|
|
230
|
+
//throw new Error('debug')
|
|
231
|
+
const path = `/{{lang}}${CONNECTORS_PATH}`
|
|
232
|
+
console.log(window.location.pathname, window.location.path, path)
|
|
233
|
+
if(window.location.pathname === path) return
|
|
234
|
+
window.open(path, '_self')
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
openEditor(id, lang) {
|
|
238
|
+
window.open(`/?id=${id}&lang=${lang}&connectorId=${this.user.storage.connectorId}`, '_self')
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
async logout() {
|
|
242
|
+
await logout({
|
|
243
|
+
type: ConnectorType.STORAGE,
|
|
244
|
+
connectorId: this.user.storage.connectorId,
|
|
245
|
+
})
|
|
246
|
+
window.location.reload()
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
async createWebsite() {
|
|
250
|
+
try {
|
|
251
|
+
if (!this.newWebsiteName) throw new Error('{{ api-translations[lang]["You need to provide a website name"] }}')
|
|
252
|
+
this.loading = true
|
|
253
|
+
const websiteId = toSafeId(this.newWebsiteName)
|
|
254
|
+
const result = await websiteCreate({
|
|
255
|
+
websiteId,
|
|
256
|
+
data: {
|
|
257
|
+
name: this.newWebsiteName,
|
|
258
|
+
imageUrl: null,
|
|
259
|
+
},
|
|
260
|
+
connectorId: this.user.storage.connectorId
|
|
261
|
+
})
|
|
262
|
+
this.message = '{{ api-translations[lang]["Website created successfully"] }}'
|
|
263
|
+
this.error = ''
|
|
264
|
+
this.newWebsiteName = ''
|
|
265
|
+
this.showCreationForm = false;
|
|
266
|
+
this.websites = await websiteList({connectorId: this.user.storage.connectorId})
|
|
267
|
+
this.empty = this.websites.length === 0
|
|
268
|
+
this.loading = false
|
|
269
|
+
return result
|
|
270
|
+
} catch (error) {
|
|
271
|
+
this.loading = false
|
|
272
|
+
console.error(error)
|
|
273
|
+
this.error = `{{ api-translations[lang]["Failed to create website"] }} - ${error.message}`
|
|
274
|
+
this.message = ''
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
async deleteWebsite(websiteId) {
|
|
279
|
+
const ok = confirm('{{ api-translations[lang]["Deleting a website? Are your sure? Really?"] }}')
|
|
280
|
+
if (!ok) return
|
|
281
|
+
this.loading = true
|
|
282
|
+
try {
|
|
283
|
+
const result = await websiteDelete({websiteId, connectorId: this.user.storage.connectorId})
|
|
284
|
+
this.message = '{{ api-translations[lang]["Website deleted successfully"] }}'
|
|
285
|
+
this.error = ''
|
|
286
|
+
this.websites = await websiteList({connectorId: this.user.storage.connectorId})
|
|
287
|
+
this.empty = this.websites.length === 0
|
|
288
|
+
this.loading = false
|
|
289
|
+
return result
|
|
290
|
+
} catch (error) {
|
|
291
|
+
this.loading = false
|
|
292
|
+
this.error = `{{ api-translations[lang]["Failed to delete website"] }} - ${error.message}`
|
|
293
|
+
this.message = ''
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
async duplicateWebsite(websiteId) {
|
|
298
|
+
this.loading = true
|
|
299
|
+
try {
|
|
300
|
+
await websiteDuplicate({websiteId, connectorId: this.user.storage.connectorId, data: { name }})
|
|
301
|
+
this.error = ''
|
|
302
|
+
this.websites = await websiteList({connectorId: this.user.storage.connectorId})
|
|
303
|
+
this.message = '{{ api-translations[lang]["Website duplicated successfully"] }}'
|
|
304
|
+
this.empty = this.websites.length === 0
|
|
305
|
+
this.loading = false
|
|
306
|
+
} catch (error) {
|
|
307
|
+
this.loading = false
|
|
308
|
+
this.error = `{{ api-translations[lang]["Failed to duplicate website"] }} - ${error.message}`
|
|
309
|
+
this.message = ''
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
async renameWebsite(websiteId) {
|
|
314
|
+
const website = this.websites.find(w => w.websiteId === websiteId)
|
|
315
|
+
const name = prompt('{{ api-translations[lang]["New name for this website"] }}', website.name)
|
|
316
|
+
if (!name) return
|
|
317
|
+
this.loading = true
|
|
318
|
+
try {
|
|
319
|
+
const result = await websiteMetaWrite({websiteId, connectorId: this.user.storage.connectorId, data: { name }})
|
|
320
|
+
this.message = '{{ api-translations[lang]["Website renamed successfully"] }}'
|
|
321
|
+
this.error = ''
|
|
322
|
+
this.websites = await websiteList({connectorId: this.user.storage.connectorId})
|
|
323
|
+
this.empty = this.websites.length === 0
|
|
324
|
+
this.loading = false
|
|
325
|
+
return result
|
|
326
|
+
} catch (error) {
|
|
327
|
+
this.loading = false
|
|
328
|
+
this.error = `{{ api-translations[lang]["Failed to rename website"] }} - ${error.message}`
|
|
329
|
+
this.message = ''
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
// Prepare elements for vue
|
|
335
|
+
document.querySelectorAll('[v-text], [v-html]')
|
|
336
|
+
.forEach(el => el.innerText = '')
|
|
337
|
+
|
|
338
|
+
// Create the app
|
|
339
|
+
const app = createApp(App);
|
|
340
|
+
|
|
341
|
+
// Suppress "v-text will override element children" warning
|
|
342
|
+
app.config.compilerOptions.directiveTransforms = {
|
|
343
|
+
text: false,
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Mount the app
|
|
347
|
+
app.mount('.app');
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
// Remove loading
|
|
351
|
+
setTimeout(() => {
|
|
352
|
+
document.querySelector('.before-js').classList.add('after-js')
|
|
353
|
+
}, 100)
|
|
354
|
+
})
|
|
355
|
+
</script>
|
|
356
|
+
|
|
357
|
+
<title>Silex Dashboard</title>
|
|
358
|
+
<link rel="icon" href="/assets/favicon-32x32.png" />
|
|
359
|
+
<meta name="og:title" property="og:title" content="Silex Dashboard"/>
|
|
360
|
+
<link href="https://www.googleapis.com" rel="preconnect" ><link href="https://fonts.gstatic.com" rel="preconnect" crossorigin ><link href="https://www.googleapis.com/css?family=Ubuntu&display=swap" rel="stylesheet" ></head>
|
|
361
|
+
<body id="i2hcfw" class="body app before-js"><A id="ixzhcr" href="/" class="button button-bar__item--secondary">{{ api-translations[lang]["Back to home"] }}</A><div id="imawg3" class="bg-silex-purpel">{% liquid
|
|
362
|
+
assign var_imgx81_241 = tina.connectorsConnection.edges | where: "node.lang", page.lang | first
|
|
363
|
+
assign var_imgx81_242 = var_imgx81_241.node
|
|
364
|
+
assign state_imgx81-1985_imgx81-7uhkrqd2giq = var_imgx81_242
|
|
365
|
+
%}<div id="imgx81" class=""><div id="iikf0s" class="box box_login"><div id="ie0dxn" class="text-centered"><img id="ior0hl" src="/assets/logo-silex.svg"/><p id="it2175" class="subtitle-16">{% liquid
|
|
366
|
+
assign var_it2175_195 = state_imgx81-1985_imgx81-7uhkrqd2giq.subtitle
|
|
367
|
+
echo var_it2175_195
|
|
368
|
+
%}</p><div id="ilq8ui" class="text-centered">{% liquid
|
|
369
|
+
assign var_ilq8ui_196 = state_imgx81-1985_imgx81-7uhkrqd2giq.help
|
|
370
|
+
echo var_ilq8ui_196
|
|
371
|
+
%}</div></div><h3 id="iqc1xf" class="margin-top">{% liquid
|
|
372
|
+
assign var_iqc1xf_197 = state_imgx81-1985_imgx81-7uhkrqd2giq.recommended
|
|
373
|
+
echo var_iqc1xf_197
|
|
374
|
+
%}</h3><div id="in62y2">{% liquid
|
|
375
|
+
assign var_isqe61_218 = state_imgx81-1985_imgx81-7uhkrqd2giq.connectors
|
|
376
|
+
%}
|
|
377
|
+
{% for state_isqe61-589___data in var_isqe61_218 %}
|
|
378
|
+
{% liquid
|
|
379
|
+
assign var_isqe61_216 = forloop.index0
|
|
380
|
+
assign var_isqe61_217 = "0"
|
|
381
|
+
%}
|
|
382
|
+
{% if var_isqe61_216 <= var_isqe61_217 %}
|
|
383
|
+
<div id="isqe61" class="">{% liquid
|
|
384
|
+
assign var_i0vhjr_211 = state_isqe61-589___data.background_color
|
|
385
|
+
assign state_i0vhjr-6879_i0vhjr-uop2xr4ta4 = var_i0vhjr_211
|
|
386
|
+
%}
|
|
387
|
+
{% liquid
|
|
388
|
+
assign var_i0vhjr_212 = state_isqe61-589___data.color
|
|
389
|
+
assign state_i0vhjr-6879_i0vhjr-q0yr34th38p = var_i0vhjr_212
|
|
390
|
+
%}<a id="i0vhjr" href="{% liquid
|
|
391
|
+
assign var_i0vhjr_213 = state_isqe61-589___data.auth_url
|
|
392
|
+
echo var_i0vhjr_213
|
|
393
|
+
%}" class="connector__card" data-style="{% liquid
|
|
394
|
+
assign var_i0vhjr_214 = "background: " | append: state_i0vhjr-6879_i0vhjr-uop2xr4ta4 | append: "; color: " | append: state_i0vhjr-6879_i0vhjr-q0yr34th38p | append: ";"
|
|
395
|
+
echo var_i0vhjr_214
|
|
396
|
+
%}" title="{% liquid
|
|
397
|
+
assign var_i0vhjr_215 = state_isqe61-589___data.description | strip_html
|
|
398
|
+
echo var_i0vhjr_215
|
|
399
|
+
%}"><div id="io3lid" class="button-bar__item__icon">{% liquid
|
|
400
|
+
assign var_io3lid_209 = state_isqe61-589___data.icon
|
|
401
|
+
echo var_io3lid_209
|
|
402
|
+
%}</div><div id="i87asw" class="connector__description">{% liquid
|
|
403
|
+
assign var_i87asw_210 = state_isqe61-589___data.text
|
|
404
|
+
echo var_i87asw_210
|
|
405
|
+
%}</div></a></div>{% endif %}{% endfor %}</div><h3 id="i8w75b" class="margin-30">{% liquid
|
|
406
|
+
assign var_i8w75b_219 = state_imgx81-1985_imgx81-7uhkrqd2giq.advanced_users
|
|
407
|
+
echo var_i8w75b_219
|
|
408
|
+
%}</h3><div id="igp4xl">{% liquid
|
|
409
|
+
assign var_id9k25_240 = state_imgx81-1985_imgx81-7uhkrqd2giq.connectors
|
|
410
|
+
%}
|
|
411
|
+
{% for state_isqe61-589___data in var_id9k25_240 %}
|
|
412
|
+
{% liquid
|
|
413
|
+
assign var_id9k25_238 = forloop.index0
|
|
414
|
+
assign var_id9k25_239 = "0"
|
|
415
|
+
%}
|
|
416
|
+
{% if var_id9k25_238 > var_id9k25_239 %}
|
|
417
|
+
<div id="id9k25" href="" class="">{% liquid
|
|
418
|
+
assign var_irgt6z_233 = state_isqe61-589___data.background_color
|
|
419
|
+
assign state_i0vhjr-6879_i0vhjr-uop2xr4ta4 = var_irgt6z_233
|
|
420
|
+
%}
|
|
421
|
+
{% liquid
|
|
422
|
+
assign var_irgt6z_234 = state_isqe61-589___data.color
|
|
423
|
+
assign state_i0vhjr-6879_i0vhjr-q0yr34th38p = var_irgt6z_234
|
|
424
|
+
%}<a href="{% liquid
|
|
425
|
+
assign var_irgt6z_235 = state_isqe61-589___data.auth_url
|
|
426
|
+
echo var_irgt6z_235
|
|
427
|
+
%}" id="irgt6z" class="connector__card" data-style="{% liquid
|
|
428
|
+
assign var_irgt6z_236 = "background: " | append: state_i0vhjr-6879_i0vhjr-uop2xr4ta4 | append: "; color: " | append: state_i0vhjr-6879_i0vhjr-q0yr34th38p | append: ";"
|
|
429
|
+
echo var_irgt6z_236
|
|
430
|
+
%}" title="{% liquid
|
|
431
|
+
assign var_irgt6z_237 = state_isqe61-589___data.description | strip_html
|
|
432
|
+
echo var_irgt6z_237
|
|
433
|
+
%}"><div class="button-bar__item__icon">{% liquid
|
|
434
|
+
assign var_iwt3h3_231 = state_isqe61-589___data.icon
|
|
435
|
+
echo var_iwt3h3_231
|
|
436
|
+
%}</div><div class="connector__description">{% liquid
|
|
437
|
+
assign var_incxlr_232 = state_isqe61-589___data.text
|
|
438
|
+
echo var_incxlr_232
|
|
439
|
+
%}</div></a></div>{% endif %}{% endfor %}</div><div id="i3cney" class="button-bar"><a id="iacshy" class="button big-button connector__card" v-if="!loading" :key="index" :style="{ backgroundColor: connector.background, color: connector.color }" v-for="(connector, index) in connectors" v-on-click="openLogin(connector)"><div id="iiwn36"><div class="button-bar__item__icon" :style="`background: url('${connector.icon}'); background-repeat: no-repeat; background-size: contain;`"></div><div id="if4gvb" class="" v-text="connector.displayName">Name<br/></div></div><div id="isndui">This connector is about blablabla<br/></div></a></div></div><div id="i9msnk" class="text-white top-space-20" v-if="error" v-text="message" :test="message">Insert your text here</div><div id="i6akll" class="button button--tertiary text-centered" v-if="error" v-on:click="logout()">{{ api-translations[lang]["Logout"] }}</div></div></div></body>
|
|
440
|
+
</html>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export default async function (configData) {
|
|
4
|
+
const data = {
|
|
5
|
+
...configData,
|
|
6
|
+
lang: 'fr',
|
|
7
|
+
}
|
|
8
|
+
const result = {}
|
|
9
|
+
try {
|
|
10
|
+
result['tina'] = (await (await fetch(`http://localhost:4001/graphql`, {
|
|
11
|
+
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': `application/json`,
|
|
14
|
+
},
|
|
15
|
+
method: 'POST',
|
|
16
|
+
body: JSON.stringify({
|
|
17
|
+
query: `query {
|
|
18
|
+
__typename
|
|
19
|
+
connectorsConnection {
|
|
20
|
+
__typename
|
|
21
|
+
edges {
|
|
22
|
+
__typename
|
|
23
|
+
node {
|
|
24
|
+
__typename
|
|
25
|
+
subtitle
|
|
26
|
+
help
|
|
27
|
+
recommended
|
|
28
|
+
advanced_users
|
|
29
|
+
connectors {
|
|
30
|
+
__typename
|
|
31
|
+
background_color
|
|
32
|
+
color
|
|
33
|
+
auth_url
|
|
34
|
+
description
|
|
35
|
+
icon
|
|
36
|
+
text
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
lang
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}`,
|
|
48
|
+
})
|
|
49
|
+
})).json()).data
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error('11ty plugin for Silex: error fetching graphql data', e, 'tina', 'http://localhost:4001/graphql')
|
|
52
|
+
throw e
|
|
53
|
+
}
|
|
54
|
+
return result
|
|
55
|
+
}
|
|
56
|
+
|