qcobjectsnewapp 2.4.36 → 2.4.40-ts

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.
@@ -1,46 +1,198 @@
1
1
  "use strict";
2
2
 
3
- import { Package, Component } from "qcobjects";
3
+ import { Package, Component, ComponentParams, ComponentDoneResponse, logger } from "qcobjects";
4
4
 
5
- Package("org.quickcorp.custom.components", [
6
- class GitHubGrid extends Component {
7
- name = "github-grid";
8
- tplsource = "inline";
9
- template = `
10
- <style>
11
- $layout(landscape,css/desktop/components/github-grid.css)
12
- $layout(portrait,css/mobile/components/github-grid.css)
13
-
14
- :host {
15
- margin:0 auto;
16
- justify-content: center;
5
+ type ComponentServiceData = Component & {
6
+ serviceData:any;
7
+ }
8
+
9
+ class GitHubGrid extends Component {
10
+ name = "github-grid";
11
+ tplsource = "inline";
12
+ template = `
13
+ <style>
14
+ $layout(landscape,css/desktop/components/github-grid.css)
15
+ $layout(portrait,css/mobile/components/github-grid.css)
16
+
17
+ :host {
18
+ margin:0 auto;
19
+ justify-content: center;
20
+ }
21
+ </style>
22
+ $mapper(github-card,result)
23
+ `;
24
+ }
25
+
26
+ class DeployGrid extends Component {
27
+ name = "deploygrid";
28
+ template = `
29
+ <style>
30
+ $layout(landscape,css/desktop/components/deploy-grid.css)
31
+ $layout(portrait,css/mobile/components/deploy-grid.css)
32
+ .deploy-grid{
33
+ display:inline-grid;
34
+ justify-content: space-evenly;
35
+ align-items: center;
36
+ justify-items: stretch;
37
+ }
38
+ </style>
39
+ <div class="deploy-grid">
40
+ <aws-button effectClass=SlideLeftTransitionEffect apply-effect-to=observe></aws-button>
41
+ <gitpod-button effectClass=SlideRightTransitionEffect apply-effect-to=observe></gitpod-button>
42
+ <codespaces-button effectClass=SlideLeftTransitionEffect apply-effect-to=observe></codespaces-button>
43
+ <netlify-button effectClass=SlideRightTransitionEffect apply-effect-to=observe></netlify-button>
44
+ <github-button effectClass=SlideLeftTransitionEffect apply-effect-to=observe></github-button>
45
+ </div>
46
+ `;
47
+ }
48
+
49
+ class AdminCheckComponent extends Component {
50
+ shadowed = true;
51
+ tplsource = "inline";
52
+
53
+ constructor (o:ComponentParams){
54
+ o.body?.setAttribute("serviceClass", "AdminCheckService");
55
+ o.body?.setAttribute("response-to", "data");
56
+ super(o);
57
+ }
58
+
59
+ }
60
+
61
+ class AdminSidebarOption extends AdminCheckComponent {
62
+ name = "admin-sidebar-option";
63
+ template = `
64
+ <style>
65
+ .admin_option_container {
66
+ padding:0;
67
+ }
68
+
69
+ summary {
70
+ list-style: none;
71
+ border: none;
72
+ white-space: nowrap;
73
+ }
74
+
75
+ summary::-webkit-details-marker {
76
+ display: none;
77
+ }
78
+
79
+ details {
80
+ padding: 15px;
81
+ background-color: #222;
82
+ margin-bottom: 3px;
83
+ }
84
+
85
+ summary::before {
86
+ content: url('../img/Q_web.svg'); /* the icon for list in sidebar */
87
+ color: #e5f59d;
88
+ margin-right: 20px;
89
+ }
90
+
91
+ a {
92
+ padding: 8px 8px 8px 32px;
93
+ text-decoration: none;
94
+ font-size: 15px;
95
+ color: #ecffc7;
96
+ display: block;
97
+ transition: 0.3s;
98
+ }
99
+
100
+ a:hover {
101
+ color: #f1f1f1;
102
+ }
103
+
104
+ ul {
105
+ list-style-type: none;
106
+ padding: 0;
107
+ }
108
+
109
+ </style>
110
+ <div class="admin_option_container">
111
+ <details>
112
+ <summary>Admin</summary>
113
+ <ul>
114
+ <li><a onclick="global.sideNavController.close();return true;" href="/admin">Admin Tool</a></li>
115
+ <li><a onclick="global.sideNavController.close();return true;" href="/admin/plugins">Plugins</a></li>
116
+ <li><a onclick="global.sideNavController.close();return true;" href="/admin/handlers">Handlers</a></li>
117
+ <li><a onclick="global.sideNavController.close();return true;" href="/admin/libs">Libs</a></li>
118
+ </ul>
119
+ </details>
120
+
121
+ </div>
122
+ `;
123
+
124
+ done (standardResponse:ComponentDoneResponse):Promise<ComponentDoneResponse>{
125
+ const component = standardResponse.component as ComponentServiceData;
126
+ console.log(component.serviceData);
127
+ try {
128
+ if (JSON.parse(component.serviceData)?.hasAdmin){
129
+ logger.debug("Admin module is present");
130
+ } else {
131
+ logger.debug("Admin module is NOT present. Install admin module in a dynamic served application (non-static server)");
132
+ this.shadowRoot?.querySelector("style")?.remove();
133
+ this.shadowRoot?.querySelector(".admin_option_container")?.remove();
134
+ }
135
+ } catch (e){
136
+ logger.debug(`It was not possible to check if admin module is present: ${e}`);
137
+ this.shadowRoot?.querySelector("style")?.remove();
138
+ this.shadowRoot?.querySelector(".admin_option_container")?.remove();
17
139
  }
18
- </style>
19
- $mapper(github-card,result)
20
- `;
21
- },
22
-
23
- class DeployGrid extends Component {
24
- name = "deploygrid";
25
- template = `
26
- <style>
27
- $layout(landscape,css/desktop/components/deploy-grid.css)
28
- $layout(portrait,css/mobile/components/deploy-grid.css)
29
- .deploy-grid{
30
- display:inline-grid;
31
- justify-content: space-evenly;
32
- align-items: center;
33
- justify-items: stretch;
140
+ return super.done(standardResponse);
141
+ }
142
+ }
143
+
144
+ class AdminButton extends AdminCheckComponent {
145
+ name = "admin-button";
146
+ template = `
147
+ <style>
148
+ .admin_button_container {
149
+ float: left;
150
+ padding:0;
151
+ }
152
+ a {
153
+ float: left;
154
+ display: block;
155
+ text-align: center;
156
+ padding: 14px 16px;
157
+ text-decoration: none;
158
+ font-size: 17px;
159
+ color: #fff;
160
+ }
161
+ a:hover {
162
+ background-color: #312d2d;
163
+ }
164
+
165
+ </style>
166
+ <div class="admin_button_container">
167
+ <a href="/admin" class="topmenu">Admin</a>
168
+ </div>
169
+ `;
170
+
171
+ done (standardResponse:ComponentDoneResponse):Promise<ComponentDoneResponse>{
172
+ const component = standardResponse.component as ComponentServiceData;
173
+ console.log(component.serviceData);
174
+ try {
175
+ if (JSON.parse(component.serviceData)?.hasAdmin){
176
+ logger.debug("Admin module is present");
177
+ } else {
178
+ logger.debug("Admin module is NOT present. Install admin module in a dynamic served application (non-static server)");
179
+ this.shadowRoot?.querySelector("style")?.remove();
180
+ this.shadowRoot?.querySelector(".admin_button_container")?.remove();
181
+ }
182
+ } catch (e){
183
+ logger.debug(`It was not possible to check if admin module is present: ${e}`);
184
+ this.shadowRoot?.querySelector("style")?.remove();
185
+ this.shadowRoot?.querySelector(".admin_button_container")?.remove();
34
186
  }
35
- </style>
36
- <div class="deploy-grid">
37
- <aws-button effectClass=SlideLeftTransitionEffect apply-effect-to=observe></aws-button>
38
- <gitpod-button effectClass=SlideRightTransitionEffect apply-effect-to=observe></gitpod-button>
39
- <codespaces-button effectClass=SlideLeftTransitionEffect apply-effect-to=observe></codespaces-button>
40
- <netlify-button effectClass=SlideRightTransitionEffect apply-effect-to=observe></netlify-button>
41
- <github-button effectClass=SlideLeftTransitionEffect apply-effect-to=observe></github-button>
42
- </div>
43
- `;
187
+ return super.done(standardResponse);
44
188
  }
45
189
 
190
+ }
191
+
192
+
193
+ Package("org.quickcorp.custom.components", [
194
+ AdminButton,
195
+ AdminSidebarOption,
196
+ DeployGrid,
197
+ GitHubGrid
46
198
  ]);
@@ -32,7 +32,7 @@ Package("org.quickcorp.custom.controllers", [
32
32
  },
33
33
 
34
34
  class SideNavController extends Controller {
35
- effect: Effect | null = null;
35
+ effect: Effect | null;
36
36
  visibility!: boolean;
37
37
  componentRoot!: any;
38
38
  component: Component;
@@ -46,14 +46,14 @@ Package("org.quickcorp.custom.controllers", [
46
46
  } else {
47
47
  this.componentRoot = this.component.body;
48
48
  }
49
+ (global as any).sideNavController = this;
50
+ this.effect = new Fade({
51
+ duration: 300
52
+ });
49
53
  }
50
54
 
51
55
  done(...args: any[]) {
52
56
  const _ret_ = super.done(args);
53
- this.effect = New(Fade, {
54
- duration: 300
55
- });
56
- (global as any).sideNavController = this;
57
57
  this.close();
58
58
  return _ret_;
59
59
  }
@@ -77,7 +77,7 @@ Package("org.quickcorp.custom.controllers", [
77
77
  }
78
78
 
79
79
  close() {
80
- if (this.componentRoot !== null) {
80
+ if (typeof this.componentRoot !== "undefined" && this.componentRoot !== null) {
81
81
  if (this.effect != null) {
82
82
  this.effect.apply(this.componentRoot, 1, 0);
83
83
  }
@@ -7,3 +7,4 @@ import "./org.quickcorp.custom.components";
7
7
  import "./org.quickcorp.custom.controllers";
8
8
  import "./org.quickcorp.custom.views";
9
9
  import "./com.qcobjects.services.github";
10
+ import "./com.qcobjects.services.newapp";
@@ -5,6 +5,7 @@
5
5
  div {
6
6
  float: left;
7
7
  }
8
+ p{color: white;}
8
9
  </style>
9
10
  <div>
10
11
  <p>Check out the code of this app in <a aria-label="GitHub" href="https://github.com/QuickCorp/qcobjects-new-app"><b>GitHub</b></a></p>
@@ -20,6 +20,7 @@
20
20
  <li><a onclick="global.sideNavController.close();return true;" href="/signin">Sign In</a></li>
21
21
  </ul>
22
22
  </details>
23
+ <quick-component componentClass="AdminSidebarOption"></quick-component>
23
24
  <details>
24
25
  <summary>Other</summary>
25
26
  <ul>
@@ -1,6 +1,7 @@
1
1
  <a href="/" class="topmenu active">Home</a>
2
2
  <a href="https://qcobjects.com" class="topmenu">QCObjects</a>
3
3
  <a href="/signup" class="topmenu">Contact</a>
4
+ <quick-component componentClass="AdminButton"></quick-component>
4
5
  <a href="/signup" class="topmenu createaccountlink2">Register</a>
5
6
  <div class="login-container">
6
7
  <quick-component name="loginform"></quick-component>