Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 345415a

Browse files
committed
Added more utility buttons, rework button layout. Finished better repl connector update.
1 parent a8a0419 commit 345415a

File tree

4 files changed

+94
-30
lines changed

4 files changed

+94
-30
lines changed

src/app/layouts/common-layout/common.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
/* USAGE: button-trans--teal mdl-js-button mdl-js-ripple-effect */
6464
.button-trans {
6565

66+
padding: 0 !important;
67+
6668
&--white {
6769
@extend .mdl-button;
6870
}

src/app/pages/betterrepl/betterrepl.component.html

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ <h2 class="card--title">Connector types</h2>
5757
class="connector-image"></div>
5858
{{ connectorMetadata.get(connectorType)?.displayName }} <span class="type">({{ connectorType }})</span>
5959
<button (click)="copyToAddConnector(connectorType)"
60-
class="button-trans--green mdl-js-button mdl-js-ripple-effect">
60+
class="button-trans--green mdl-js-button mdl-js-ripple-effect mdl-button--icon">
6161
<i class="material-icons">add</i>
6262
</button>
6363
<ul class="typeList">
@@ -121,7 +121,7 @@ <h2 class="card--title">Plugin types</h2>
121121
<ul class="typeList">
122122
<li *ngFor="let pluginType of pluginTypes">{{ pluginType.name }} ({{pluginType.author}})
123123
<button (click)="copyToAddPlugin(pluginType.name, pluginType.author)"
124-
class="button-trans--green mdl-js-button mdl-js-ripple-effect">
124+
class="button-trans--green mdl-js-button mdl-js-ripple-effect mdl-button--icon">
125125
<i class="material-icons">add</i>
126126
</button>
127127
</li>
@@ -145,13 +145,33 @@ <h2 class="mdl-card__title-text">Connectors</h2>
145145
</button>
146146
</div>
147147
<ul>
148-
<li *ngFor="let connectorKey of connectorKeys">{{connectorKey.sourceIdentifier}}
149-
<button class="button-trans--teal mdl-js-button mdl-js-ripple-effect"
150-
(click)="copyConnectorData(connectorKey)">
151-
<i class="material-icons">edit</i>
148+
<li *ngFor="let connectorEntry of connectorData">{{connectorEntry.sourceIdentifier}}
149+
<button (click)="copyConnectorData(connectorEntry)"
150+
class="button-trans--teal mdl-js-button mdl-js-ripple-effect mdl-button--icon">
151+
<i class="material-icons material-li">edit</i>
152152
</button>
153153
<ul>
154-
<li>{{connectorKey.qualifiedConnectorType}}</li>
154+
<li>{{connectorEntry.qualifiedConnectorType}}</li>
155+
<li>
156+
<a (click)="getConnectorDetails(connectorEntry)" *ngIf="connectorEntry.details == null"
157+
class="pointer">Request details...</a>
158+
<p *ngIf="connectorEntry.details != null">Running: {{ connectorEntry.details.isRunning }} - Credentials:
159+
<u *ngFor="let cred of connectorEntry.details.requiredCredentialKeys">{{ cred }}
160+
<button
161+
(click)="copyCredentials(connectorEntry.qualifiedConnectorType, connectorEntry.sourceIdentifier, cred)"
162+
class="button-trans--teal mdl-js-button mdl-js-ripple-effect mdl-button--icon">
163+
<i class="material-icons material-li">edit</i>
164+
</button>
165+
</u>
166+
<span
167+
*ngFor="let optionalCred of connectorEntry.details.optionalCredentialKeys">{{ optionalCred}}
168+
<button
169+
(click)="copyCredentials(connectorEntry.qualifiedConnectorType, connectorEntry.sourceIdentifier, optionalCred)"
170+
class="button-trans--teal mdl-js-button mdl-js-ripple-effect mdl-button--icon">
171+
<i class="material-icons material-li">edit</i>
172+
</button></span>
173+
</p>
174+
</li>
155175
</ul>
156176
</li>
157177
</ul>
@@ -214,14 +234,16 @@ <h2 class="card--title">Manage credentials</h2>
214234
#mcrConnectorType [(ngModel)]="mcrConnectorTypeValue"/>
215235
<label class="mdl-textfield__label" for="manageCredentialsConnectorType">Connector type</label>
216236
</div>
217-
<div class="container--text mdl-js-textfield">
237+
<div [class.is-dirty]="mcrKeyValue.length > 0"
238+
class="container--text mdl-js-textfield">
218239
<input class="mdl-textfield__input" type="text" id="manageCredentialsKey" value=""
219-
#mcrKey/>
240+
#mcrKey [(ngModel)]="mcrKeyValue"/>
220241
<label class="mdl-textfield__label" for="manageCredentialsKey">Key</label>
221242
</div>
222-
<div class="container--text mdl-js-textfield">
243+
<div [class.is-dirty]="mcrValueValue.length > 0"
244+
class="container--text mdl-js-textfield">
223245
<input class="mdl-textfield__input" type="text" id="manageCredentialsValue" value=""
224-
#mcrValue/>
246+
#mcrValue [(ngModel)]="mcrValueValue"/>
225247
<label class="mdl-textfield__label" for="manageCredentialsValue">Value</label>
226248
</div>
227249
<div class="manageButtons">
@@ -266,7 +288,7 @@ <h2 class="card--title">Plugin instances</h2>
266288
[class.button--colored-orange]="!instance.isRunning"
267289
[class.button--colored-green]="instance.isRunning"
268290
(click)="copyInstanceData(instance)">
269-
<i class="material-icons">edit</i>
291+
<i class="material-icons material-li">edit</i>
270292
</button>
271293
<ul>
272294
<li>{{ instance.pluginName }} ({{ instance.pluginAuthor }})</li>
@@ -304,7 +326,8 @@ <h2 class="card--title">Start / Stop / Log</h2>
304326
Show log
305327
</button>
306328
</div>
307-
<div #instanceLog id="instanceLog" style="white-space: pre-wrap" *ngIf="instanceLogOutput?.length > 0">{{ instanceLogOutput.join("\n") }}</div>
329+
<div #instanceLog *ngIf="instanceLogOutput?.length > 0" id="instanceLog"
330+
style="white-space: pre-wrap">{{ instanceLogOutput.join("\n") }}</div>
308331
</base-card-body>
309332
</base-card>
310333
</div>
@@ -369,9 +392,9 @@ <h2 class="card--title">Instance requirements</h2>
369392
<ul>
370393
<li *ngFor="let requirement of instanceRequirements">
371394
{{requirement.uniqueRequirementId}} ({{requirement.name}})
372-
<button class="button-trans--teal mdl-js-button mdl-js-ripple-effect"
395+
<button class="button-trans--teal mdl-js-button mdl-js-ripple-effect mdl-button--icon"
373396
(click)="copyRequirementData(requirement, requirementsInstanceName.value)">
374-
<i class="material-icons">edit</i>
397+
<i class="material-icons material-li">edit</i>
375398
</button>
376399
<ul>
377400
<li>optional: {{requirement.isOptional}} - set: {{requirement.isSet}}</li>
@@ -415,17 +438,17 @@ <h2 class="card--title">Change requirement</h2>
415438
<label class="mdl-textfield__label" for="changeReqValue">Value</label>
416439
</div>
417440

418-
<div class="manageButtons">
419-
<button class="button--green mdl-js-button mdl-js-ripple-effect"
420-
(click)="setRequirement(changeReqInstanceName.value, changeReqID.value,
421-
changeReqType.value, changeReqValue.value)">
422-
PUT
423-
</button>
424-
<button class="button--red mdl-js-button mdl-js-ripple-effect"
425-
(click)="removeRequirement(changeReqInstanceName.value, changeReqID.value)">
426-
DELETE
427-
</button>
428-
</div>
441+
<div class="manageButtons">
442+
<button (click)="setRequirement(changeReqInstanceName.value, changeReqID.value,
443+
changeReqType.value, changeReqValue.value)"
444+
class="button--green mdl-js-button mdl-js-ripple-effect">
445+
PUT
446+
</button>
447+
<button (click)="removeRequirement(changeReqInstanceName.value, changeReqID.value)"
448+
class="button--red mdl-js-button mdl-js-ripple-effect">
449+
DELETE
450+
</button>
451+
</div>
429452
</div>
430453
</base-card-body>
431454
</base-card>

src/app/pages/betterrepl/betterrepl.component.ts

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ import {
2525
import {CryptoService} from "../../../crypto.service";
2626
import {EventService} from "../../../event.service";
2727

28+
class ConnectorData implements ConnectorKey {
29+
public constructor(public qualifiedConnectorType: string,
30+
public sourceIdentifier: string,
31+
public details: ConnectorDetails) {
32+
}
33+
}
34+
2835
@Component({
2936
selector: 'better-repl',
3037
templateUrl: './betterrepl.component.html',
@@ -46,7 +53,7 @@ export class BetterREPLComponent extends UpgradableComponent {
4653
private requirementTypes: RequirementTypes;
4754
private pluginTypes: Array<PluginType>;
4855

49-
private connectorKeys: Array<ConnectorKey>;
56+
private connectorData: Array<ConnectorData>;
5057
private pluginInstances: Array<PluginInstance>;
5158

5259
private instanceLogOutput: Array<string>;
@@ -56,6 +63,8 @@ export class BetterREPLComponent extends UpgradableComponent {
5663
private mcConnectorTypeValue = "";
5764
private mcrSourceIdentifierValue = "";
5865
private mcrConnectorTypeValue = "";
66+
private mcrKeyValue = "";
67+
private mcrValueValue = "";
5968

6069
private instanceNameSSValue = "";
6170
private miPluginNameValue = "";
@@ -86,6 +95,8 @@ export class BetterREPLComponent extends UpgradableComponent {
8695
this.mcConnectorTypeValue = "";
8796
this.mcrSourceIdentifierValue = "";
8897
this.mcrConnectorTypeValue = "";
98+
this.mcrKeyValue = "";
99+
this.mcrValueValue = "";
89100

90101
this.instanceNameSSValue = "";
91102
this.miPluginNameValue = "";
@@ -103,7 +114,7 @@ export class BetterREPLComponent extends UpgradableComponent {
103114
this.requirementTypes = null;
104115
this.pluginTypes = [];
105116
this.pluginInstances = [];
106-
this.connectorKeys = [];
117+
this.connectorData = [];
107118

108119
} else {
109120

@@ -273,10 +284,10 @@ export class BetterREPLComponent extends UpgradableComponent {
273284
}
274285

275286
getRegisteredConnectors() {
276-
this.connectorKeys = [];
287+
this.connectorData = [];
277288
this.connectorService.getConnectors(this.authKey).subscribe((response: Array<ConnectorKey>) => {
278289
this.logRequest("getConnectors", true, JSON.stringify(response));
279-
this.connectorKeys = response;
290+
response.forEach(key => this.connectorData.push(new ConnectorData(key.qualifiedConnectorType, key.sourceIdentifier, null)));
280291
}, error => this.logGenericError("getConnectors"));
281292
}
282293

@@ -351,6 +362,8 @@ export class BetterREPLComponent extends UpgradableComponent {
351362
this.mcrSourceIdentifierValue = connectorKey.sourceIdentifier;
352363
this.mcConnectorTypeValue = connectorKey.qualifiedConnectorType;
353364
this.mcrConnectorTypeValue = connectorKey.qualifiedConnectorType;
365+
this.mcrKeyValue = "";
366+
this.mcrValueValue = "";
354367
}
355368

356369
copyToAddConnector(connectorType: string) {
@@ -470,4 +483,20 @@ export class BetterREPLComponent extends UpgradableComponent {
470483
this.changeReqValueValue = requirement.value;
471484
}
472485

486+
getConnectorDetails(connectorKey: ConnectorData) {
487+
this.connectorService.getConnector(connectorKey.qualifiedConnectorType, connectorKey.sourceIdentifier, this.authKey)
488+
.subscribe((response: ConnectorDetails) => {
489+
this.logRequest("getConnector", true, JSON.stringify(response));
490+
491+
connectorKey.details = response;
492+
}, error => this.logGenericError("getConnector"));
493+
}
494+
495+
copyCredentials(connectorType: string, sourceIdentifier: string, key: string) {
496+
this.mcrConnectorTypeValue = connectorType;
497+
this.mcrSourceIdentifierValue = sourceIdentifier;
498+
this.mcrKeyValue = key;
499+
this.mcrValueValue = "";
500+
}
501+
473502
}

src/app/pages/betterrepl/betterrepl.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
font-size: 6pt !important;
3838
}
3939

40+
.material-li {
41+
font-size: 14pt !important;
42+
}
43+
44+
.pointer {
45+
cursor: pointer;
46+
font-size: 14px !important;
47+
font-weight: 300 !important;
48+
}
49+
4050
.connector-image {
4151
height: 16px;
4252
width: 16px;

0 commit comments

Comments
 (0)