diff --git a/lib/plugin/blueprints/tymly-blueprint/card-templates/clear-registry-key.json b/lib/plugin/blueprints/tymly-blueprint/card-templates/clear-registry-key.json new file mode 100644 index 00000000..39ae47c5 --- /dev/null +++ b/lib/plugin/blueprints/tymly-blueprint/card-templates/clear-registry-key.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "version": "1.0", + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "weight": "bolder", + "text": "Are you sure you want to clear the '{{ data.key }}' registry key?" + } + ], + "actions": [ + { + "type": "Action.Cancel", + "title": "No" + }, + { + "type": "Action.Submit", + "title": "Yes" + } + ], + "templateMeta": { + "name": "clear-registry-key", + "title": "Clear Registry Key", + "category": "system" + }, + "hooks": { + "afterSubmit": { + "actions": [ + { + "type": "Action.PushCard", + "stateMachineName": "tymly_viewRegistryKeys_1_0", + "input": {} + } + ] + } + } +} diff --git a/lib/plugin/blueprints/tymly-blueprint/card-templates/view-registry-key.json b/lib/plugin/blueprints/tymly-blueprint/card-templates/view-registry-key.json new file mode 100644 index 00000000..a39574ce --- /dev/null +++ b/lib/plugin/blueprints/tymly-blueprint/card-templates/view-registry-key.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "version": "1.0", + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "weight": "bolder", + "size": "medium", + "text": "{{ data.key }}" + }, + { + "type": "TextBlock", + "text": "
{{ JSON.stringify(data.registryValue, null, 2) }}"
+ }
+ ],
+ "actions": [
+ {
+ "type": "Action.Cancel",
+ "title": "Close"
+ },
+ {
+ "type": "Action.PushCard",
+ "title": "Clear registry key",
+ "stateMachineName": "tymly_clearRegistryKey_1_0",
+ "input": {
+ "key": "$.key"
+ }
+ }
+
+ ],
+ "templateMeta": {
+ "name": "view-registry-key",
+ "title": "View Registry Key",
+ "category": "system"
+ }
+}
diff --git a/lib/plugin/blueprints/tymly-blueprint/card-templates/view-registry-keys.json b/lib/plugin/blueprints/tymly-blueprint/card-templates/view-registry-keys.json
new file mode 100644
index 00000000..25fc7a49
--- /dev/null
+++ b/lib/plugin/blueprints/tymly-blueprint/card-templates/view-registry-keys.json
@@ -0,0 +1,49 @@
+{
+ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
+ "version": "1.0",
+ "type": "AdaptiveCard",
+ "body": [
+ {
+ "id": "regKeysTable",
+ "type": "Table",
+ "showLaunches": true,
+ "arrayPath": "data.regKeys",
+ "columns": [
+ {
+ "title": "Key",
+ "field": "key"
+ },
+ {
+ "title": "Created By",
+ "field": "createdBy"
+ },
+ {
+ "title": "Created At",
+ "field": "created",
+ "format": "formatDate(item.created, 'DD MMM YYYY HH:mm')"
+ },
+ {
+ "title": "Modified By",
+ "field": "modifiedBy"
+ },
+ {
+ "title": "Modified At",
+ "field": "modified",
+ "format": "formatDate(item.modified, 'DD MMM YYYY HH:mm')"
+ }
+ ]
+ }
+ ],
+ "actions": [
+ {
+ "type": "Action.Cancel",
+ "title": "Close"
+ }
+ ],
+ "templateMeta": {
+ "name": "view-registry-keys",
+ "title": "View Registry Keys",
+ "category": "system",
+ "customMaxWidthPx": 1200
+ }
+}
diff --git a/lib/plugin/blueprints/tymly-blueprint/functions/get-registry-keys.js b/lib/plugin/blueprints/tymly-blueprint/functions/get-registry-keys.js
new file mode 100644
index 00000000..0ad43fd5
--- /dev/null
+++ b/lib/plugin/blueprints/tymly-blueprint/functions/get-registry-keys.js
@@ -0,0 +1,19 @@
+module.exports = function getRegistryKeys () {
+ return async function (env) {
+ const model = env.bootedServices.storage.models.tymly_registryKey
+ const records = await model.find({
+ fields: ['key', 'created', 'createdBy', 'modified', 'modifiedBy'],
+ orderBy: ['key']
+ })
+ return records.map(r => {
+ r.launches = [
+ {
+ title: 'View',
+ stateMachineName: 'tymly_viewRegistryKey_1_0',
+ input: { key: r.key }
+ }
+ ]
+ return r
+ })
+ }
+}
diff --git a/lib/plugin/blueprints/tymly-blueprint/state-machines/clear-registry-key.json b/lib/plugin/blueprints/tymly-blueprint/state-machines/clear-registry-key.json
new file mode 100644
index 00000000..c32dbd7e
--- /dev/null
+++ b/lib/plugin/blueprints/tymly-blueprint/state-machines/clear-registry-key.json
@@ -0,0 +1,35 @@
+{
+ "Comment": "Clear Registry Key",
+ "name": "Clear Registry Key",
+ "version": "1.0",
+ "categories": [
+ "system"
+ ],
+ "StartAt": "AwaitingHumanInput",
+ "States": {
+ "AwaitingHumanInput": {
+ "Type": "Task",
+ "Resource": "module:awaitingHumanInput",
+ "ResourceConfig": {
+ "uiType": "form",
+ "uiName": "tymly_clearRegistryKey",
+ "dataPath": "$"
+ },
+ "Next": "Clear"
+ },
+ "Clear": {
+ "Type": "Task",
+ "InputPath": "$",
+ "Resource": "module:clearRegistryKey",
+ "End": true
+ }
+ },
+ "restrictions": [
+ {
+ "roleId": "tymly_system",
+ "allows": [
+ "*"
+ ]
+ }
+ ]
+}
diff --git a/lib/plugin/blueprints/tymly-blueprint/state-machines/view-registry-key.json b/lib/plugin/blueprints/tymly-blueprint/state-machines/view-registry-key.json
new file mode 100644
index 00000000..7a4093e6
--- /dev/null
+++ b/lib/plugin/blueprints/tymly-blueprint/state-machines/view-registry-key.json
@@ -0,0 +1,36 @@
+{
+ "Comment": "View Registry Key",
+ "name": "View Registry Key",
+ "version": "1.0",
+ "categories": [
+ "system"
+ ],
+ "StartAt": "Get",
+ "States": {
+ "Get": {
+ "Type": "Task",
+ "InputPath": "$",
+ "Resource": "module:getRegistryKey",
+ "ResultPath": "$",
+ "Next": "AwaitingHumanInput"
+ },
+ "AwaitingHumanInput": {
+ "Type": "Task",
+ "Resource": "module:awaitingHumanInput",
+ "ResourceConfig": {
+ "uiType": "form",
+ "uiName": "tymly_viewRegistryKey",
+ "dataPath": "$"
+ },
+ "End": true
+ }
+ },
+ "restrictions": [
+ {
+ "roleId": "tymly_system",
+ "allows": [
+ "*"
+ ]
+ }
+ ]
+}
diff --git a/lib/plugin/blueprints/tymly-blueprint/state-machines/view-registry-keys.json b/lib/plugin/blueprints/tymly-blueprint/state-machines/view-registry-keys.json
new file mode 100644
index 00000000..2372b94b
--- /dev/null
+++ b/lib/plugin/blueprints/tymly-blueprint/state-machines/view-registry-keys.json
@@ -0,0 +1,39 @@
+{
+ "Comment": "View Registry Keys",
+ "name": "View Registry Keys",
+ "version": "1.0",
+ "categories": [
+ "system"
+ ],
+ "instigators": [
+ "user"
+ ],
+ "instigatorGroup": "app",
+ "StartAt": "Finding",
+ "States": {
+ "Finding": {
+ "Type": "Task",
+ "Resource": "function:tymly_getRegistryKeys",
+ "ResultPath": "$.regKeys",
+ "Next": "AwaitingHumanInput"
+ },
+ "AwaitingHumanInput": {
+ "Type": "Task",
+ "Resource": "module:awaitingHumanInput",
+ "ResourceConfig": {
+ "uiType": "form",
+ "uiName": "tymly_viewRegistryKeys",
+ "dataPath": "$"
+ },
+ "End": true
+ }
+ },
+ "restrictions": [
+ {
+ "roleId": "tymly_system",
+ "allows": [
+ "*"
+ ]
+ }
+ ]
+}
diff --git a/lib/plugin/blueprints/tymly-blueprint/template-roles/system.json b/lib/plugin/blueprints/tymly-blueprint/template-roles/system.json
new file mode 100644
index 00000000..a62d04c3
--- /dev/null
+++ b/lib/plugin/blueprints/tymly-blueprint/template-roles/system.json
@@ -0,0 +1,6 @@
+{
+ "label": "System",
+ "description": "System Operations",
+ "roleMemberships": [],
+ "grants": []
+}
diff --git a/lib/plugin/components/state-resources/clear-registry-key/index.js b/lib/plugin/components/state-resources/clear-registry-key/index.js
index c91fde36..a1eef847 100644
--- a/lib/plugin/components/state-resources/clear-registry-key/index.js
+++ b/lib/plugin/components/state-resources/clear-registry-key/index.js
@@ -1,5 +1,4 @@
-
-module.exports = class GetRegistryKey {
+module.exports = class ClearRegistryKey {
init (resourceConfig, env) {
this.registry = env.bootedServices.registry
}
@@ -9,4 +8,4 @@ module.exports = class GetRegistryKey {
.then(() => context.sendTaskSuccess())
.catch(err => context.sendTaskFailure({ error: 'ClearRegistryKeyFail', cause: err }))
} // run
-} // GetRegistryKey
+} // ClearRegistryKey
diff --git a/lib/plugin/components/state-resources/get-registry-key/index.js b/lib/plugin/components/state-resources/get-registry-key/index.js
index 9262849e..a42ac102 100644
--- a/lib/plugin/components/state-resources/get-registry-key/index.js
+++ b/lib/plugin/components/state-resources/get-registry-key/index.js
@@ -1,4 +1,3 @@
-
module.exports = class GetRegistryKey {
init (resourceConfig, env) {
this.registry = env.bootedServices.registry