Admin UI for managing ServiceStack Instances (v5.9+)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ | |
var AppSvgs = { | |
'action/home.svg': 'home', | |
'action/bug_report.svg': 'debug', | |
'hardware/cast.svg': 'connect', | |
'hardware/security.svg': 'auth', | |
'toggle/check_box.svg': 'check_box_on', | |
'toggle/check_box_outline_blank.svg': 'check_box_off', | |
'navigation/double_arrow.svg': 'play', | |
'navigation/first_page.svg': 'chevron-first', | |
'navigation/last_page.svg': 'chevron-last', | |
'navigation/expand_more.svg': 'chevron-down', | |
'navigation/chevron_left.svg': 'chevron-left', | |
'navigation/chevron_right.svg': 'chevron-right', | |
'navigation/expand_less.svg': 'chevron-up', | |
'navigation/close.svg': 'close', | |
'action/find_in_page.svg': 'db', | |
'action/delete.svg': 'delete', | |
'action/dns.svg': 'dns', | |
'action/done.svg': 'done', | |
'action/help_outline.svg': 'help', | |
'action/history.svg': 'history', | |
'image/edit.svg': 'update', | |
'content/add.svg': 'create', | |
'content/remove.svg': 'remove', | |
'content/remove_circle.svg': 'remove_circle', | |
'content/save_alt.svg': 'save', | |
'content/block.svg': 'block', | |
'content/content_copy.svg': 'copy', | |
'content/clear.svg': 'clear', | |
'content/filter_list.svg': 'filter', | |
'social/people.svg': 'users', | |
} | |
}} | |
```code | |
#each AppSvgs | |
`/lib/svg/material/${it.Key}` |> svgAddFile(it.Value,'app') | |
/each | |
``` | |
{{#svg fields app}} | |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="48px" height="48px"> | |
<path d="M0 0h24v24H0V0z" fill="none"/> | |
<path d="M4 5v13h17V5H4zm10 2v9h-3V7h3zM6 7h3v9H6V7zm13 9h-3V7h3v9z" fill="#ffffff"/> | |
</svg> | |
{{/svg}} | |
{{#svg lock app}} | |
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"> | |
<g fill="none"> | |
<path d="M0 0h24v24H0V0z"/> | |
<path d="M0 0h24v24H0V0z" opacity=".87"/> | |
</g> | |
<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" fill="#ffffff"/> | |
</svg> | |
{{/svg}} | |
{{#svg external-link app}} | |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/> | |
<polyline points="15 3 21 3 21 9"/> | |
<line x1="10" y1="14" x2="21" y2="3"/> | |
</svg> | |
{{/svg}} | |
{{#svg loading app}} | |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" | |
x="0px" y="0px" width="24px" height="30px" viewBox="0 0 24 30" style="enable-background:new 0 0 50 50" xml:space="preserve"> | |
<rect x="0" y="10" width="4" height="10" fill="#333" opacity="0.2"> | |
<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0s" dur="0.6s" repeatCount="indefinite" /> | |
<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0s" dur="0.6s" repeatCount="indefinite" /> | |
<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0s" dur="0.6s" repeatCount="indefinite" /> | |
</rect> | |
<rect x="8" y="10" width="4" height="10" fill="#333" opacity="0.2"> | |
<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.15s" dur="0.6s" repeatCount="indefinite" /> | |
<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" /> | |
<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" /> | |
</rect> | |
<rect x="16" y="10" width="4" height="10" fill="#333" opacity="0.2"> | |
<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.3s" dur="0.6s" repeatCount="indefinite" /> | |
<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" /> | |
<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" /> | |
</rect> | |
</svg> | |
{{/svg}} | |
{{#svg logo app}} | |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#ffffff" width="48px" height="48px"> | |
<path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"/> | |
<path d="M0 0h24v24H0z" fill="none"/> | |
</svg> | |
{{/svg}} | |
{{#svg excel app}} | |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px"> | |
<path fill="#4CAF50" d="M41,10H25v28h16c0.553,0,1-0.447,1-1V11C42,10.447,41.553,10,41,10z"/> | |
<path fill="#FFF" d="M32 15H39V18H32zM32 25H39V28H32zM32 30H39V33H32zM32 20H39V23H32zM25 15H30V18H25zM25 25H30V28H25zM25 30H30V33H25zM25 20H30V23H25z"/> | |
<path fill="#2E7D32" d="M27 42L6 38 6 10 27 6z"/> | |
<path fill="#FFF" d="M19.129,31l-2.411-4.561c-0.092-0.171-0.186-0.483-0.284-0.938h-0.037c-0.046,0.215-0.154,0.541-0.324,0.979L13.652,31H9.895l4.462-7.001L10.274,17h3.837l2.001,4.196c0.156,0.331,0.296,0.725,0.42,1.179h0.04c0.078-0.271,0.224-0.68,0.439-1.22L19.237,17h3.515l-4.199,6.939l4.316,7.059h-3.74V31z"/> | |
</svg> | |
{{/svg}} | |
{{htmlError}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link href="/metadata/svg/servicestack.svg?fill=%23000" rel="icon"> | |
<link rel="stylesheet" href="/lib/css/bootstrap/bootstrap.css"> | |
<title>{{ title ?? 'Studio' }}</title> | |
</head> | |
<body> | |
{{ 'buttons' |> cssIncludes }} | |
{{ 'svg-auth,app' |> cssIncludes |> svgFill('#212529') }} | |
{{#if fileExists('/bundle.css') }} | |
<link rel="stylesheet" href="/bundle.css"> | |
{{else}} | |
{{ 'content:/src/css/' |> bundleCss({ minify:false, cache:false, out:'/app.bundle.css' }) }} | |
{{/if}} | |
<style> | |
{{ { | |
'.home-link': ['home','#4183B8'], | |
'.first-link': ['chevron-first','#4183B8'], | |
'.left-link': ['chevron-left','#4183B8'], | |
'.right-link': ['chevron-right','#4183B8'], | |
'.last-link': ['chevron-last','#4183B8'], | |
'.db-link': ['db','#4183B8'], | |
'.lock-link': ['lock','#4183B8'], | |
'.save-link': ['save','#4183B8'], | |
'.users-link': ['users','#4183B8'], | |
'.help-muted': ['help','#999'], | |
'.history-muted': ['history','#999'], | |
'.bool-off-muted': ['check_box_off','#999'], | |
'.bool-on-muted': ['check_box_on','#999'], | |
'.db-dark': ['db','#6c757d'], | |
'.lock-dark': ['lock','#6c757d'], | |
'.auth-warning': ['auth','#ffc107'], | |
'.done-success': ['done','#28a745'], | |
'.block-danger': ['block','#dc3545'], | |
} |> toList |> map => `${it.Key} { ${it.Value[0].svgBackgroundImageCss(it.Value[1])} }` |> joinln |> raw }} | |
.text-close::after { content:'\00D7'; } | |
</style> | |
<i hidden>{{ '/js/hot-fileloader.js' |> ifDebugIncludeScript }}</i> | |
<script> | |
CONFIG = { | |
debug: {{ debugMode |> json }}, | |
desktop: {{ desktopInfo |> json }}, | |
hasExcel:{{ (isWin ? typeofProgId('Excel.Application') != null : false) |> json }}, | |
connect: {{ connect |> json }}, | |
nav: {{ 'GetNavItems' |> execService |> json }}, | |
auth: {{ 'Authenticate' |> execService({ ifErrorReturn: "null" }) |> json }} | |
} | |
</script> | |
<noscript>You need to enable JavaScript to run this app.</noscript> | |
{{page}} | |
{{ [ | |
`/lib/js/vue/vue.min.js`, | |
`/lib/js/vue-router/vue-router.min.js`, | |
`/lib/js/vue-class-component/vue-class-component.min.js`, | |
`/lib/js/vue-property-decorator/vue-property-decorator.min.js`, | |
`/lib/js/@servicestack/desktop/servicestack-desktop.min.js`, | |
`/lib/js/@servicestack/client/servicestack-client.min.js`, | |
`/lib/js/@servicestack/vue/servicestack-vue.min.js`, | |
] |> map => `<script src="${it}"></script>` |> joinln |> raw }} | |
<script> | |
var ALIASES = { | |
'vue': { default: Vue }, | |
'vue-router': { default: VueRouter }, | |
'vue-class-component': VueClassComponent, | |
'vue-property-decorator': VuePropertyDecorator, | |
'@servicestack/vue': ServiceStackVue | |
}; | |
var global = window; | |
window.exports = {}; | |
window.require = function(name) { | |
return ALIASES[name] || exports[name] || window[name] || exports; | |
}; | |
Object.assign(window, window["@servicestack/desktop"], window["@servicestack/client"]); | |
</script> | |
{{#if fileExists('/bundle.js') }} | |
<script src="/bundle.js"></script> | |
{{else}} | |
{{ [ | |
'content:/src/components/', | |
'content:/src/shared/', | |
'content:/src/', | |
] |> bundleJs({ minify:false, cache:false, iife:true, out:`/app.bundle.js` }) }} | |
{{/if}} | |
{{ scripts |> raw }} | |
{{initError |> htmlError}} | |
{{htmlError}} | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name Studio | |
port 5002 | |
debug false | |
CefConfig {} | |
appName studio | |
description Admin UI for managing ServiceStack Instances (v5.9+) | |
tags servicestack | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.grid-layout{display:grid;width:100vw;height:100vh;grid-column-gap:5px;grid-template-columns:300px 4fr 1fr;grid-template-rows:80px auto 20%;grid-template-areas:"head head head" "nav main main" "nav foot foot"}.grid-layout.collapse-footer{grid-template-areas:"head head head" "nav main main" "nav main main"}.grid-layout.no-sidebar{grid-template-areas:"head head head" "main main main" "foot foot foot"}.grid-layout.no-sidebar.collapse-footer{grid-template-areas:"head head head" "main main main" "main main main"}.grid-layout.collapse-footer #footer{display:none}header{background:#fff;grid-area:head;display:grid;grid-template-columns:auto auto;grid-template-areas:"breadcrumb auth"}#auth{padding:5px 5px 0 0;text-align:right}.site-breadcrumbs{padding-left:0;height:80px}nav{background:#fff;grid-area:nav;padding:0 2px 0 10px;overflow-x:hidden;overflow-y:auto;display:grid;grid-template-rows:40px auto;grid-template-areas:"filter" "sidebar"}#nav-filter{grid-area:filter;margin:2px 0 0 0}#sidebar{grid-area:sidebar;overflow-x:hidden;overflow-y:scroll}main{background:#fff;grid-area:main;padding:2px;grid-row-gap:5px;overflow:auto;display:grid;grid-template-rows:40px auto;grid-template-areas:"query" "results"}#validation main{grid-template-areas:"results" "results"}.query-form{grid-area:query}.main-query{height:38px;font-size:20px;padding-top:1px}.main-container{grid-area:results;overflow-y:scroll}footer{grid-column:foot;Aoverflow-x:hidden;overflow-y:scroll}#footer{border:1px solid #eee;position:fixed;right:0;bottom:0;width:100%;height:30%;max-height:300px}.collapse-footer #footer .text-close{display:none} | |
::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background-color:#f1f1f1}.navbar{border-radius:0;background:#4183b8 !important}a{color:#4183b8;text-decoration:none}a:hover{text-decoration:none}.sq-xs{width:12px;height:12px}.sq-sm{width:14px;height:14px}.sq-md{width:18px;height:18px}.sq-lg{width:24px;height:24px}.sq-2x{width:32px;height:32px}.sq-3x{width:48px;height:48px}.sq-4x{width:64px;height:64px}.sq-5x{width:80px;height:80px}.sq-6x{width:96px;height:96px}.sq-7x{width:112px;height:112px}.sq-8x{width:128px;height:128px}.sq-9x{width:144px;height:144px}.sq-10x{width:160px;height:160px}.sq-11x{width:180px;height:180px}.sq-12x{width:204px;height:204px}.sq-13x{width:232px;height:232px}.sq-14x{width:264px;height:264px}.form-check.form-control{padding-left:1.75rem;height:auto}span.nav-link{cursor:pointer}.fade-in{animation:fadein 2s;-moz-animation:fadein 2s;-webkit-animation:fadein 2s;-o-animation:fadein 2s}.fadein-5s{animation:fadein 5s;-moz-animation:fadein 5s;-webkit-animation:fadein 5s;-o-animation:fadein 5s}@keyframes fadein{from{opacity:0}to{opacity:1}}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-o-keyframes fadein{from{opacity:0;}to{opacity:1;}}#debug-links{position:absolute;bottom:1em;right:1em}#desktop input[type=number]{width:100px}#sig{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;width:100%;text-align:center;color:#7f8c8d;font-size:.85rem;z-index:1}.result{margin:10px;color:#349268}.site small{color:#999}.modal,.modal-inline{z-index:1}.stacktrace{background:#f1f1f1;padding:1em;margin:1em 0 .5em 0;border-radius:5px;border:1px solid #ccc;white-space:pre-wrap}#authModal{width:760px;height:700px;top:250px;left:50%;margin-left:-350px}#authModal .modal-dialog{max-width:700px;max-height:600px}#authModal .modal-body{padding:0}#authModal iframe{width:700px;height:600px;border:none}#eventsModal{right:10px}.custom-select{min-width:130px}.nav-query .nav-link{padding:.4rem 1rem;cursor:pointer}.nav-query .nav-link:hover{color:rgba(255,255,255,.8) !important}.site-breadcrumbs .breadcrumb{background:none}.site-breadcrumbs .breadcrumb-item+.breadcrumb-item::before{color:#ddd}.results-none{color:#6c757d}table.results{border:1px solid #eee;background:#fefefe}table.results thead tr{background:#eee}table.results th{text-align:left;color:#757575;font-size:13px;line-height:18px;border-bottom:1px solid #e0e0e0;padding:5px;overflow:hidden;white-space:nowrap}table.results td{color:#212121;font-size:12px;padding:5px;max-width:300px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}th .modal-content,td .modal-content{font-size:1rem}table.results .filters td{padding:0 1px;margin:0}.filters input{min-width:50px;width:100%;font-size:11px}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.auth{color:#aaa;pointer-events:none;background-size:22px 22px;background-position:center right;background-repeat:no-repeat;display:block}.lnk-help{width:20px;height:20px;float:right;margin:-1em .25em 0 0;background-size:18px 18px;background-position:center right;background-repeat:no-repeat;display:block}.has-auth .auth a{pointer-events:auto;color:#4183b8}.svg-btn,.btn-link,.th-link{cursor:pointer;user-select:none}.btn-link{text-decoration:none}.results td{background:#f9f9f9}td.partial{border:1px dashed #ccc;background:#fff;cursor:default}table.results td.editing{background:#fff3cd;padding:0}.modal-mini .close{margin-top:-10px;margin-left:-5px}.modal-inline{display:block;position:absolute}.modal-inline .modal-dialog{min-width:500px;margin:-12px 0 0 -31px;white-space:normal}.modal-inline-lg .modal-dialog{min-width:700px}.results tr.selected td{background:#ffffe0}.results tr.selected td.selected{background:#6495ed;color:#fff}.modal-dialog{color:#212121;text-align:left}::placeholder{color:#aaa !important}.disabled.md{font-size:1rem}.disabled.lg{font-size:1.25rem}.confirm-delete .form-check-input{margin:10px 0 0 -10px}.confirm-delete .form-check-label{font-size:1rem;margin:0 .5em;user-select:none;cursor:pointer}#sidebar .selected{font-weight:bold}.close,.text-close{user-select:none}.text-close{cursor:pointer;font-size:1.5em;color:#999}.text-close:hover{color:#666}#footer .text-close{position:fixed;right:10px;margin:-10px 0 0 0}#output-group{position:fixed;right:0;bottom:0;background:#fff}#output-group .btn{border-radius:0}.log-entry,.log-entry h4,.log-entry dl{font-size:13px;line-height:22px}.log-entry{padding:5px 20px 5px 5px}.log-entry h4,.log-entry dl,.log-entry dt,.log-entry dd,dl.h-kvp,ul.event{margin:0;padding:0}.log-entry i{font-style:normal}.log-entry h4 i{display:inline-block;background:#f1f1f1;width:60px;padding:0 5px;border:1px solid #f1f1f1}.log-entry h4 b{display:inline-block;padding:0 10px;border:1px solid #f1f1f1}.log-entry .body{border:1px solid #f1f1f1;padding:0 0 4px 0;margin:-2px 0 0 0}dl.v-kvp{vertical-align:top;border:1px solid #f1f1f1;display:inline-block;margin:4px 0 0 4px}dl.v-kvp>dt{border-bottom:1px solid #f1f1f1;font-weight:normal;background:#f1f1f1}dl.v-kvp>dt,dl.v-kvp>dd{padding:1px 4px;max-width:400px;overflow:hidden;text-overflow:ellipsis}dl.v-kvp.log-response,dl.v-kvp.log-response>dt,dl.v-kvp.log-response>dd,dl.v-kvp.log-response .jsonviewer dd{max-width:none}dl.v-kvp.log-response>dt{cursor:pointer;user-select:none}dl.h-kvp{border:1px solid #f8f9fa;display:inline-block;height:31px}dl.h-kvp>dt,dl.h-kvp>dd{margin:0;padding:.25em .5em;line-height:22px;display:inline-block;max-width:400px;overflow:hidden;text-overflow:ellipsis}dl.h-kvp>dt{border-right:1px solid #f8f9fa;background:#f8f9fa}.rule dl{min-width:300px}.rule dl>dt{min-width:83px}.rule button{vertical-align:top}ul.event,ul.event li{display:inline-block}li.by span,li.on span{padding-left:.5em}li.by b,li.on b{padding-left:.25em}li.on b{font-weight:normal}li.by b i,li.on b i{font-weight:normal;color:#aaa;font-style:normal}.event-line{white-space:nowrap;overflow-x:hidden}.event.summary{cursor:pointer}.event.summary b{font-weight:normal}.event.summary li.on b{font-weight:normal;color:#aaa}.event-detail{margin:0 0 5px 22px}.event .type{min-width:56px}.event .ip{border:1px solid #f1f1f1;padding:0 5px 0 0;margin:2px 0 0 5px}.event .ip span{background:#f1f1f1;padding:1px 5px;margin:0 5px 0 0}.ellipsis{max-width:200px;text-overflow:ellipsis}#validation-rules{width:100%;max-width:900px}#validation-rules th{font-size:1.4em;font-weight:normal;padding:0 0 .5em 0}#validation-rules th,#validation-rules td{width:50%;vertical-align:top}.type-rule{margin-bottom:10px}.datamodel-nav .router-link-exact-active{font-weight:bold}.invalid-feedback{font-size:inherit}.btn-compact.btn-sm{padding:.1rem .4rem}#adminusers #txtQuery{width:290px}em{font-style:normal;line-height:1.5em;padding:2px 5px;margin:0;background-color:rgba(0,0,0,.04);color:#c7254e;border-radius:3px}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.428571429;word-break:break-all;word-wrap:break-word;color:#333;background-color:#f3f4f6;border:1px solid #d1d5db}code,pre{font-family:Monaco,Menlo,Consolas,"Courier New",monospace}pre{white-space:pre-wrap}.copy-cmd i.svg-copy{display:inline-block;vertical-align:middle;background-image:url("data:image/svg+xml,%3Csvg fill='none' stroke='currentColor' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2'%3E%3C/path%3E%3C/svg%3E")}.copy-cmd pre.sh::before{content:"$ ";color:#999}.copy-cmd pre b{visibility:hidden}.copy-cmd pre.copied b{visibility:visible}.copy-cmd pre.copied i.svg-copy{opacity:50%}.copy-cmd pre.sh i:hover{opacity:.5;transition:opacity .4s}.jsonviewer .ib{display:inline-block}.jsonviewer table{border-collapse:collapse;border:solid 1px #ccc;clear:left}.jsonviewer th{text-align:left;padding:4px 8px;text-shadow:#fff 1px 1px -1px;background:#f1f1f1;white-space:nowrap;font-weight:bold}.jsonviewer td{padding:8px 8px 0 8px;vertical-align:top;line-height:18px}.jsonviewer dl{margin:0;clear:left}.jsonviewer dt{font-weight:bold;width:160px;clear:left;float:left;display:block;white-space:nowrap;line-height:26px}.jsonviewer dd{display:block;float:left;line-height:26px;max-width:600px;margin:0}.jsonviewer dl dl dt{font-weight:bold}.jsonviewer hr{display:none}.jsonviewer td dl HR{display:block;padding:0;clear:left;border:none}.jsonviewer td dl{padding:4px;margin:0;height:100%;max-width:700px}.jsonviewer dl td dl dt{padding:2px;margin:0 10px 0 0;font-weight:bold;width:120px;overflow:hidden;clear:left;float:left;display:block}.jsonviewer dl td dl dd{margin:0;padding:2px;display:block;float:left}.jsonviewer tbody>tr:last-child>td{padding:8px} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},__spreadArrays=this&&this.__spreadArrays||function(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u};Object.defineProperty(exports,"__esModule",{value:!0});exports.CreateUserModal=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),CreateUserModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.row=null,t.showAdvanced=!1,t.value="",t.model={},t.roles=[],t.permissions=[],t.newRole=null,t.newPermission=null,t.loading=!1,t.responseStatus=null,t.confirmDelete=!1,t.grid=[["UserName"],["Email"],["FirstName","LastName"],["DisplayName"],["Company"],["Address"],["Address2"],["City","State"],["Country","PostalCode"],["PhoneNumber"],["LockedDate"],],t}return __extends(t,n),Object.defineProperty(t.prototype,"gridProps",{get:function(){return shared_1.gridProps(this.grid,this.type.properties.filter(function(n){return n.name!="LockedDate"&&!n.isPrimaryKey}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){return this.app&&this.app.plugins.adminUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return!!this.plugin},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return"md"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.plugin.userAuth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"missingRoles",{get:function(){var n=this;return this.plugin.allRoles.filter(function(t){return n.roles.indexOf(t)==-1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"missingPermissions",{get:function(){var n=this;return this.plugin.allPermissions.filter(function(t){return n.permissions.indexOf(t)==-1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canSubmit",{get:function(){return(this.model.UserName||this.model.Email)&&this.model.Password},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelButton",{get:function(){return"Create User"},enumerable:!1,configurable:!0}),t.prototype.fieldValue=function(n){return shared_1.editValue(n,this.model[n.name])},t.prototype.humanize=function(n){return client_1.humanize(n)},t.prototype.reset=function(n){return n===void 0&&(n=null),__awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(){return this.row={},this.type.properties.forEach(function(t){n.$set(n.model,t.name,shared_1.editValue(t,client_1.getField(n.row,t.name)))}),this.roles=[],this.permissions=[],[2]})})},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return shared_1.log("EditUserModal.mounted()"),shared_1.initInlineModal("#createUserModal"),[4,this.reset()];case 1:return n.sent(),this.$nextTick(function(){var n;(n=document.querySelector("#createUserModal input:first-child"))===null||n===void 0?void 0:n.select()}),[2]}})})},t.prototype.updateUser=function(n,t){return __awaiter(this,void 0,void 0,function(){var i=this;return __generator(this,function(r){switch(r.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(i,void 0,void 0,function(){return __generator(this,function(i){switch(i.label){case 0:return[4,shared_1.putSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:"AdminUpdateUser",args:__spreadArrays(["Id",this.id],n)}))];case 1:return i.sent(),[4,this.reset(t)];case 2:return i.sent(),[2]}})})})];case 1:return r.sent(),[2]}})})},t.prototype.changePassword=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return shared_1.log("changePassword"),[4,this.updateUser(["Password",this.model.Password],"Password was changed")];case 1:return n.sent(),this.model.Password="",[2]}})})},t.prototype.addRole=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return this.newRole?(this.roles.push(this.newRole),this.newRole=null,[2]):[2]})})},t.prototype.removeRole=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return n?(this.roles=this.roles.filter(function(t){return t!=n}),[2]):[2]})})},t.prototype.addPermission=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return this.newPermission?(this.permissions.push(this.newPermission),this.newPermission=null,[2]):[2]})})},t.prototype.removePermission=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return n?(this.permissions=this.permissions.filter(function(t){return t!=n}),[2]):[2]})})},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return this.canSubmit?[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var r,n,f,u,t,i;return __generator(this,function(e){switch(e.label){case 0:r=shared_1.sanitizedModel(this.model);shared_1.log("CreateUserModal.submit()",r);n=new dtos_1.AdminCreateUser({userAuthProperties:{},roles:this.roles,permissions:this.permissions});f=["id","roles","permissions"];for(u in r)t=u.toLowerCase(),i=r[u],t==="username"&&(n.userName=i),t==="password"?n.password=i:t==="email"?n.email=i:t==="displayname"?n.displayName=i:t==="firstname"?n.firstName=i:t==="lastname"?n.lastName=i:t==="profileurl"?n.profileUrl=i:f.indexOf(t)==-1&&(n.userAuthProperties[u]=i);return[4,shared_1.postSiteProxy(new dtos_1.SiteProxy({slug:this.slug,request:client_1.nameOf(new dtos_1.AdminCreateUser)}),n)];case 1:return e.sent(),this.$emit("done",r),[2]}})})})]:[2];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"id",void 0),__decorate([vue_property_decorator_1.Component({template:'<div id="createUserModal" class="modal-inline modal-inline-lg" tabindex="-1" role="dialog" @keyup.esc="$emit(\'done\')" title="">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">\n Create New User\n <\/h5>\n <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @click="$emit(\'done\')"><\/button>\n <\/div>\n <div class="modal-body">\n <form @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary :except="type.properties.map(x => x.name)" :responseStatus="responseStatus" />\n <\/div>\n <div class="row">\n <div class="col col-7">\n <div class="mb-3">\n <template v-for="rowProps in gridProps">\n <div class="row mb-3">\n <template v-for="f in rowProps">\n <div class="col">\n <v-input-type :property="f" :model="model" :size="size" :responseStatus="responseStatus" />\n <\/div>\n <\/template>\n <\/div>\n <\/template>\n <\/div>\n <\/div>\n <div class="col col-5">\n <div class="row mb-3">\n <div class="col">\n <v-input type="password" id="Password" v-model="model.Password" :responseStatus="responseStatus" \n placeholder="Password" :inputClass="[\'form-control-\' + size]" help="New Password" \n @keypress.enter.native.prevent="changePassword()" /> \n <\/div>\n <\/div>\n <div class="row mb-3" v-if="roles.length">\n <div class="col">\n <h4>Roles<\/h4>\n <div v-for="role in roles">\n <button @click.prevent="removeRole(role)" class="btn btn-sm btn-link" title="Remove Role"><i class="svg svg-md svg-delete"><\/i><\/button> \n <span class="align-middle">{{ role }}<\/span>\n <\/div>\n <\/div>\n <\/div>\n <div class="row mb-3" v-if="missingRoles.length">\n <div class="col col-8">\n <v-select id="roles" :values="[\'\',...missingRoles]" :responseStatus="responseStatus"\n v-model="newRole" selectClass="custom-select" help="Add Role">\n <\/v-select>\n <\/div>\n <div class="col col-4 p-0">\n <button :disabled="!newRole" @click.prevent="addRole()" class="btn btn-outline-secondary" title="Add Role">Add<\/button> \n <\/div>\n <\/div>\n <div class="row mb-3" v-if="permissions.length">\n <div class="col">\n <h4>Permissions<\/h4>\n <div v-for="perm in permissions">\n <button @click.prevent="removePermission(perm)" class="btn btn-sm btn-link" title="Remove Permission"><i class="svg svg-md svg-delete"><\/i><\/button> \n <span class="align-middle">{{ perm }}<\/span>\n <\/div>\n <\/div>\n <\/div>\n <div class="row mb-3" v-if="missingPermissions.length">\n <div class="col col-8">\n <v-select id="permissions" :values="[\'\',...missingPermissions]" :responseStatus="responseStatus"\n v-model="newPermission" selectClass="custom-select" help="Add Permission">\n <\/v-select>\n <\/div>\n <div class="col col-4 p-0">\n <button :disabled="!newPermission" @click.prevent="addPermission()" class="btn btn-outline-secondary" title="Add Permission">Add<\/button> \n <\/div>\n <\/div>\n <\/div> \n <\/div>\n <div class="row pt-3 border-top border-top-primary">\n <div class="col text-end">\n <span class="btn btn-link" @click="$emit(\'done\')">close<\/span>\n <button :disabled="!canSubmit" type="submit" class="btn btn-primary">{{labelButton}}<\/button>\n <\/div>\n <\/div>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.CreateUserModal=CreateUserModal;exports.default=CreateUserModal;vue_property_decorator_1.Vue.component("create-user-modal",CreateUserModal); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},__spreadArrays=this&&this.__spreadArrays||function(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u};Object.defineProperty(exports,"__esModule",{value:!0});exports.EditUserModal=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),EditUserModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.row=null,t.showAdvanced=!1,t.value="",t.model={},t.roles=[],t.permissions=[],t.newRole=null,t.newPermission=null,t.loading=!1,t.responseStatus=null,t.success=null,t.confirmDelete=!1,t.grid=[["UserName"],["Email"],["FirstName","LastName"],["DisplayName"],["Company"],["Address"],["Address2"],["City","State"],["Country","PostalCode"],["PhoneNumber"],["LockedDate"],],t}return __extends(t,n),Object.defineProperty(t.prototype,"gridProps",{get:function(){return shared_1.gridProps(this.grid,this.type.properties.filter(function(n){return n.name!="LockedDate"&&!n.isPrimaryKey}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){return this.app&&this.app.plugins.adminUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return!!this.plugin},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return"md"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.plugin.userAuth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"missingRoles",{get:function(){var n=this;return this.plugin.allRoles.filter(function(t){return n.roles.indexOf(t)==-1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"missingPermissions",{get:function(){var n=this;return this.plugin.allPermissions.filter(function(t){return n.permissions.indexOf(t)==-1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canSubmit",{get:function(){return this.model.UserName||this.model.Email||!this.hasProp("UserName")&&!this.hasProp("Email")},enumerable:!1,configurable:!0}),t.prototype.hasProp=function(n){return this.type.properties.find(function(t){return t.name.toLowerCase()==n.toLowerCase()})!=null},Object.defineProperty(t.prototype,"displayName",{get:function(){var i=client_1.getField(this.row,"displayName")||client_1.getField(this.row,"userName"),n,t;return i?i:(n=client_1.getField(this.row,"firstName"),t=client_1.getField(this.row,"lastName"),n||t)?(n||"")+" "+(t||""):""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelButton",{get:function(){return"Update User"},enumerable:!1,configurable:!0}),t.prototype.fieldValue=function(n){return shared_1.editValue(n,this.model[n.name])},t.prototype.humanize=function(n){return client_1.humanize(n)},t.prototype.reset=function(n){return n===void 0&&(n=null),__awaiter(this,void 0,void 0,function(){var i,r,t=this;return __generator(this,function(u){switch(u.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(t,void 0,void 0,function(){var n,t;return __generator(this,function(i){switch(i.label){case 0:return[4,shared_1.getSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:"AdminGetUser",args:["Id",this.id]}))];case 1:return n=i.sent(),t=JSON.parse(n),this.row=client_1.getField(t,"Result"),[2]}})})})];case 1:return u.sent(),this.success=n,this.type.properties.forEach(function(n){t.$set(t.model,n.name,shared_1.editValue(n,client_1.getField(t.row,n.name)))}),i=client_1.getField(this.row,"Roles"),i&&(this.roles=__spreadArrays(i)),r=client_1.getField(this.row,"Permissions"),r&&(this.permissions=__spreadArrays(r)),[2]}})})},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return shared_1.log("EditUserModal.mounted()"),shared_1.initInlineModal("#editUserModal"),[4,this.reset()];case 1:return n.sent(),this.$nextTick(function(){var n;(n=document.querySelector("#editUserModal input:first-child"))===null||n===void 0?void 0:n.select()}),[2]}})})},t.prototype.updateUser=function(n,t){return __awaiter(this,void 0,void 0,function(){var i=this;return __generator(this,function(r){switch(r.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(i,void 0,void 0,function(){return __generator(this,function(i){switch(i.label){case 0:return[4,shared_1.putSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:"AdminUpdateUser",args:__spreadArrays(["Id",this.id],n)}))];case 1:return i.sent(),[4,this.reset(t)];case 2:return i.sent(),[2]}})})})];case 1:return r.sent(),[2]}})})},t.prototype.lockUser=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return shared_1.log("lockUser"),[4,this.updateUser(["LockUser","true"])];case 1:return n.sent(),[2]}})})},t.prototype.unlockUser=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return shared_1.log("unlockUser"),[4,this.updateUser(["UnlockUser","true"])];case 1:return n.sent(),[2]}})})},t.prototype.changePassword=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return shared_1.log("changePassword"),[4,this.updateUser(["Password",this.model.Password],"Password was changed")];case 1:return n.sent(),this.model.Password="",[2]}})})},t.prototype.addRole=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return this.newRole?(this.roles.push(this.newRole),this.newRole=null,[2]):[2]})})},t.prototype.removeRole=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return n?(this.roles=this.roles.filter(function(t){return t!=n}),[2]):[2]})})},t.prototype.addPermission=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return this.newPermission?(this.permissions.push(this.newPermission),this.newPermission=null,[2]):[2]})})},t.prototype.removePermission=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return n?(this.permissions=this.permissions.filter(function(t){return t!=n}),[2]):[2]})})},t.prototype.deleteUser=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return[4,shared_1.deleteSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:"AdminDeleteUser",args:["Id",this.id]}))];case 1:return n.sent(),this.$emit("done",this.model),[2]}})})})];case 1:return t.sent(),[2]}})})},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return this.canSubmit?[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var r,n,l,u,t,i,f,e,o,s,h,c,a=this;return __generator(this,function(v){switch(v.label){case 0:r=shared_1.sanitizedModel(this.model);shared_1.log("EditUserModal.submit()",r);n=new dtos_1.AdminUpdateUser({id:this.id,userAuthProperties:{}});l=["id","roles","permissions"];for(u in r)t=u.toLowerCase(),i=r[u],t==="username"?n.userName=i:t==="email"?n.email=i:t==="displayname"?n.displayName=i:t==="firstname"?n.firstName=i:t==="lastname"?n.lastName=i:t==="profileurl"?n.profileUrl=i:l.indexOf(t)==-1&&(n.userAuthProperties[u]=i);return f=client_1.getField(this.row,"Roles")||[],e=this.roles.filter(function(n){return f.indexOf(n)==-1}),e.length>0&&(n.addRoles=e),o=f.filter(function(n){return a.roles.indexOf(n)==-1}),o.length>0&&(n.removeRoles=o),s=client_1.getField(this.row,"Permissions")||[],h=this.permissions.filter(function(n){return s.indexOf(n)==-1}),h.length>0&&(n.addPermissions=h),c=s.filter(function(n){return a.permissions.indexOf(n)==-1}),c.length>0&&(n.removePermissions=c),[4,shared_1.putSiteProxy(new dtos_1.SiteProxy({slug:this.slug,request:client_1.nameOf(new dtos_1.AdminUpdateUser)}),n)];case 1:return v.sent(),this.$emit("done",r),[2]}})})})]:[2];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"id",void 0),__decorate([vue_property_decorator_1.Component({template:'<div id="editUserModal" class="modal-inline modal-inline-lg" tabindex="-1" role="dialog" @keyup.esc="$emit(\'done\')" title="">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">\n Edit User {{ getField(row,\'id\') }}: {{ displayName }}\n <\/h5>\n <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @click="$emit(\'done\')"><\/button>\n <\/div>\n <div class="modal-body">\n <form @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <alert-success :message="success" /> \n <error-summary :except="type.properties.map(x => x.name)" :responseStatus="responseStatus" />\n <\/div>\n <div class="row">\n <div class="col col-7">\n <div class="mb-3">\n <template v-for="rowProps in gridProps">\n <div class="row mb-3">\n <template v-for="f in rowProps">\n <div class="col">\n <v-input-type :property="f" :model="model" :size="size" :responseStatus="responseStatus" />\n <\/div>\n <\/template>\n <\/div>\n <\/template>\n <\/div>\n <\/div>\n <div class="col col-5">\n <div class="row mb-3">\n <div class="col col-8">\n <v-input type="password" id="Password" v-model="model.Password" :responseStatus="responseStatus" \n placeholder="Password" :inputClass="[\'form-control-\' + size]" help="New Password" \n @keypress.enter.native.prevent="changePassword()" /> \n <\/div>\n <div class="col col-4 p-0">\n <button @click.prevent="changePassword()" class="btn btn-outline-danger" :disabled="loading">Change<\/button> \n <\/div>\n <\/div>\n <div class="row mb-3">\n <template v-if="model.LockedDate">\n <div class="col col-8 pe-0">\n <label>Locked on {{ model.LockedDate | datefmt }}<\/label>\n <\/div>\n <div class="col col-4 p-0">\n <button @click.prevent="unlockUser()" class="btn btn-outline-danger" :disabled="loading">Unlock<\/button>\n <\/div> \n <\/template>\n <div v-else class="col">\n <button @click.prevent="lockUser()" class="btn btn-outline-danger" :disabled="loading">Lock User<\/button>\n <\/div> \n <\/div>\n <div class="row mb-3" v-if="roles.length">\n <div class="col">\n <h4>Roles<\/h4>\n <div v-for="role in roles">\n <button @click.prevent="removeRole(role)" class="btn btn-sm btn-link" title="Remove Role"><i class="svg svg-md svg-delete"><\/i><\/button> \n <span class="align-middle">{{ role }}<\/span>\n <\/div>\n <\/div>\n <\/div>\n <div class="row mb-3" v-if="missingRoles.length">\n <div class="col col-8">\n <v-select id="roles" :values="[\'\',...missingRoles]" :responseStatus="responseStatus"\n v-model="newRole" selectClass="custom-select" help="Add Role">\n <\/v-select>\n <\/div>\n <div class="col col-4 p-0">\n <button :disabled="!newRole" @click.prevent="addRole()" class="btn btn-outline-secondary" title="Add Role">Add<\/button> \n <\/div>\n <\/div>\n <div class="row mb-3" v-if="permissions.length">\n <div class="col">\n <h4>Permissions<\/h4>\n <div v-for="perm in permissions">\n <button @click.prevent="removePermission(perm)" class="btn btn-sm btn-link" title="Remove Permission"><i class="svg svg-md svg-delete"><\/i><\/button> \n <span class="align-middle">{{ perm }}<\/span>\n <\/div>\n <\/div>\n <\/div>\n <div class="row mb-3" v-if="missingPermissions.length">\n <div class="col col-8">\n <v-select id="permissions" :values="[\'\',...missingPermissions]" :responseStatus="responseStatus"\n v-model="newPermission" selectClass="custom-select" help="Add Permission">\n <\/v-select>\n <\/div>\n <div class="col col-4 p-0">\n <button :disabled="!newPermission" @click.prevent="addPermission()" class="btn btn-outline-secondary" title="Add Permission">Add<\/button> \n <\/div>\n <\/div>\n <\/div>\n <\/div>\n <div class="row mt-3 pt-3 border-top border-top-primary">\n <div class="col-6 confirm-delete ps-4">\n <input id="chkDelete" type="checkbox" class="form-check-input" @change="confirmDelete=!confirmDelete"/> \n <label for="chkDelete" class="form-check-label">confirm<\/label>\n <button class="btn btn-danger" @click.prevent="confirmDelete && deleteUser()" :disabled="!confirmDelete">Delete<\/button>\n <\/div>\n <div class="col text-end"> \n <span class="btn btn-link" @click="$emit(\'done\')">close<\/span>\n <button :disabled="!canSubmit || loading" type="submit" class="btn btn-primary">{{labelButton}}<\/button>\n <\/div>\n <\/div>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.EditUserModal=EditUserModal;exports.default=EditUserModal;vue_property_decorator_1.Vue.component("edit-user-modal",EditUserModal); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.AdminUsers=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),AdminUsers=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.txtQuery="",t.showCreate=!1,t.orderBy="",t.skip=0,t.take=50,t.pageSize=50,t.selectedField=null,t.editingRow=null,t.fields=[],t.results=[],t.loading=!1,t.responseStatus=null,t}return __extends(t,n),t.prototype.onUrlChange=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return shared_1.log("onUrlChange",n),[4,this.reset()];case 1:return t.sent(),[2]}})})},t.prototype.reset=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return shared_1.log("AdminUsers.reset()"),[4,this.search()];case 1:return n.sent(),[2]}})})},t.prototype.clearQuery=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return this.txtQuery="",[4,this.search()];case 1:return n.sent(),[2]}})})},t.prototype.search=function(){return __awaiter(this,void 0,void 0,function(){var n,t=this;return __generator(this,function(i){switch(i.label){case 0:return n=["query",this.txtQuery,"orderBy",this.orderBy,"skip",""+this.skip,"take",""+this.take],shared_1.log("AdminUsers.search(): "+n),[4,shared_1.exec(this,function(){return __awaiter(t,void 0,void 0,function(){var i,t;return __generator(this,function(r){switch(r.label){case 0:return[4,shared_1.getSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:"AdminQueryUsers",args:n}))];case 1:return i=r.sent(),t=JSON.parse(i),console.log(t),this.results=client_1.getField(t,"Results"),[2]}})})})];case 1:return i.sent(),[2]}})})},Object.defineProperty(t.prototype,"store",{get:function(){return shared_1.store},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bus",{get:function(){return shared_1.bus},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"slug",{get:function(){return this.$route.params.slug},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"site",{get:function(){return shared_1.store.getSite(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){var n;if((n=shared_1.store.getApp(this.slug))!==null&&n!==void 0)return n.plugins.adminUsers},enumerable:!1,configurable:!0}),t.prototype.hasFeature=function(n){return this.plugin.enabled.find(function(t){return t===n})!=null},Object.defineProperty(t.prototype,"enabled",{get:function(){return!!this.plugin},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"accessible",{get:function(){return this.enabled&&shared_1.store.hasRole(this.slug,this.plugin.accessRole)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"session",{get:function(){return shared_1.store.getSession(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"windowStyles",{get:function(){return!this.accessible||shared_1.collapsed(this.slug,"footer")?"collapse-footer":""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fieldNames",{get:function(){var i=this,n,t=((n=this.plugin)===null||n===void 0?void 0:n.queryUserAuthProperties)||shared_1.allKeys(this.results);return this.fields.length>0&&(t=t.filter(function(n){return i.fields.indexOf(n)>=0})),t},enumerable:!1,configurable:!0}),t.prototype.show=function(n,t){this.selectedField=null;this.showCreate=!1;this.editingRow=null;n==="Create"?this.showCreate=!0:n=="Edit"&&typeof t=="number"&&(this.editingRow=t)},t.prototype.handleDone=function(n,t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(i){switch(i.label){case 0:return(shared_1.log("handleDone",n,t),this.showCreate=!1,this.editingRow=null,!t)?[3,2]:[4,this.search()];case 1:i.sent();i.label=2;case 2:return[2]}})})},t.prototype.viewNext=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return this.skip+=n,[4,this.search()];case 1:return t.sent(),[2]}})})},t.prototype.setOrderBy=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return this.orderBy=this.orderBy==n?"-"+n:this.orderBy=="-"+n?"":n,[4,this.search()];case 1:return t.sent(),[2]}})})},t.prototype.humanize=function(n){return client_1.humanize(n)},t.prototype.renderValue=function(n){return shared_1.renderValue(n)},t.prototype.getField=function(n,t){return client_1.getField(n,t)},t.prototype.selectedRow=function(n){return this.selectedField&&this.selectedField[0]==n},t.prototype.selectedCell=function(){return!1},t.prototype.selectField=function(n,t){this.selectedField=[n,t]},t.prototype.isEditingRow=function(n){return this.editingRow===n},t.prototype.editRow=function(n){this.editingRow=n;this.selectedField=[n,0]},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return shared_1.log("AdminUsers.mounted()"),[4,shared_1.loadSite(this.slug)];case 1:return t.sent(),[4,this.reset()];case 2:return t.sent(),shared_1.bus.$on("signedin",function(){shared_1.log("signedin");n.reset()}),[2]}})})},__decorate([vue_property_decorator_1.Watch("$route",{immediate:!0,deep:!0})],t.prototype,"onUrlChange",null),__decorate([vue_property_decorator_1.Component({template:'<section v-if="enabled" id="adminusers" :class="[\'grid-layout\',\'no-sidebar\',windowStyles]">\n\n <header id="header">\n <h1 v-if="site">\n <nav class="site-breadcrumbs">\n <ol class="breadcrumb">\n <li class="breadcrumb-item">\n <router-link to="/"><i class="home-link svg-3x mb-1" title="home" /><\/router-link>\n <\/li>\n <li :class="[\'breadcrumb-item\']">\n <img v-if="site.iconUrl" :src="site.iconUrl" class="sq-3x mb-1">\n <span v-else>{{site.name}}<\/span>\n <\/li>\n <li v-if="loading"><i class="svg-loading svg-lg ms-2 mb-1" title="loading..." /><\/li>\n <\/ol>\n <\/nav>\n <\/h1>\n <h1 v-else-if="loading">\n <i class="fab fa-loading"><\/i>\n Loading...\n <\/h1>\n <div v-else-if="responseStatus">\n <error-summary :responseStatus="responseStatus" />\n <router-link to="/">< back to sites<\/router-link>\n <\/div>\n <auth id="auth" v-if="site && app" :slug="slug" feature="adminusers" /> \n <\/header>\n \n <main>\n <div v-if="!loading && session && accessible">\n <div class="main-container p-2">\n <form class="mb-2 row g-1" @submit.prevent="search()">\n <div class="col-auto">\n <i v-if="txtQuery" class="text-close" style="position:absolute;margin:0 0 3px 265px;" title="clear" @click="clearQuery()"><\/i>\n <v-input v-model="txtQuery" id="txtQuery" \n :placeholder="hasFeature(\'query\') ? \'Search Users\' : \'Username or Email\'" inputClass="form-control" />\n <\/div>\n <div class="col-auto">\n <button @click="search()" class="ms-1 btn btn-outline-primary">Go<\/button>\n <\/div>\n <div class="col-auto">\n <span class="main-query ms-2">\n <button class="btn left-link svg-2x" :disabled="skip==0" title="< previous" @click="viewNext(-pageSize)"><\/button>\n <button class="btn right-link svg-2x" :disabled="results.length < take" title="next >" @click="viewNext(pageSize)"><\/button>\n <\/span>\n <span v-if="results.length" class="text-muted">\n Showing results: {{skip+1}}-{{skip+results.length}}\n <\/span>\n <span v-else class="text-muted">No results<\/span>\n <\/div>\n <\/form>\n <div v-if="results.length">\n <table class="results">\n <thead><tr class="noselect">\n <th>\n <i class="svg svg-btn svg-create svg-md" title="New User" @click="show(\'Create\')"/>\n <\/th>\n <th v-for="f in fieldNames" :key="f" @click="setOrderBy(f)" class="th-link">\n <div class="text-nowrap">\n {{ humanize(f) }}\n <span v-if="orderBy==f" class="svg svg-chevron-up svg-md align-top"><\/span>\n <span v-else-if="orderBy==\'-\'+f" class="svg svg-chevron-down svg-md align-top"><\/span>\n <\/div>\n <\/th>\n <\/tr><\/thead>\n <tbody>\n <template v-for="(r,i) in results">\n <tr :key="i" :class="{ selected:selectedRow(i) }">\n <td>\n <span>\n <i class="svg svg-btn svg-update svg-sm" title="Update User" @click="editRow(i)" />\n <\/span>\n <\/td> \n <td v-for="(f,j) in fieldNames" :key="j" :title="renderValue(getField(r,f))" \n :class="{ selected:selectedCell(i,j) }" \n @click="selectField(i,j)"> \n <span v-if="i==0 && j==0 && showCreate">\n <create-user-modal :slug="slug" @done="handleDone(\'Create\',$event)" />\n <\/span>\n <div v-else-if="isEditingRow(i) && j == 0">\n <edit-user-modal :slug="slug" :id="getField(r,\'id\')" @done="handleDone(\'Edit\',$event)" />\n <\/div>\n <format v-else :value="getField(r,f)" />\n <\/td>\n <\/tr>\n <\/template>\n <\/tbody>\n <\/table>\n <error-view :responseStatus="responseStatus" />\n <\/div>\n <div class="actions mt-2">\n <button @click="show(\'Create\')" class="btn btn-outline-primary">\n New User\n <\/button>\n <\/div>\n <\/div>\n <\/div>\n <div v-else-if="!session" class="text-center" style="position:absolute;left:50%;margin:50px 0 0 -100px">\n <i class="svg svg-users svg-10x" />\n <h3 class="mb-4">Manage Users<\/h3>\n <button v-if="!loading" @click="bus.$emit(\'signin\')" class="btn btn-outline-primary">\n Sign In\n <\/button>\n <\/div>\n <div v-else-if="!accessible" class="text-danger"> \n <h4>\n <i class="svg block-danger svg-2x" />\n Only {{plugin.accessRole}} Users can manage all users\n <\/h4> \n <\/div>\n <\/main>\n \n <Footer v-if="app" :slug="slug"/>\n \n <\/section>\n <no-plugin v-else :slug="slug" plugin="adminusers" />'})],t)}(vue_property_decorator_1.Vue);exports.AdminUsers=AdminUsers;exports.default=AdminUsers;vue_property_decorator_1.Vue.component("admin-users",AdminUsers); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u};Object.defineProperty(exports,"__esModule",{value:!0});exports.AuthModal=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),AuthModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.auth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"providerUrl",{get:function(){return this.provider?this.app.app.baseUrl+"/auth/"+this.provider:this.app.app.baseUrl+"/auth?noredirect"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayUrl",{get:function(){return shared_1.splitOnFirst(this.providerUrl,"?")[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){var n=this.app.app.baseUrl,t=this.provider?"/"+this.provider+("?continue="+encodeURIComponent("/auth")+"&"):"?";return n+"/auth"+t+"noredirect"},enumerable:!1,configurable:!0}),t.prototype.mounted=function(){var t=this,n=document.querySelector("#auth-frame");window.addEventListener("message",function(i){var r;i.source==(n===null||n===void 0?void 0:n.contentWindow)&&((r=i.data)===null||r===void 0?void 0:r.copy)&&t.$emit("done",i.data.copy)})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"provider",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled" id="authModal" class="modal" tabindex="-1" role="dialog" style="display:block">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <div v-if="url">\n <h5 class="modal-title">\n Session for <a :href="providerUrl" target="_blank">{{displayUrl}}<\/a>\n <\/h5>\n <\/div>\n <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @click="$emit(\'done\')"><\/button>\n <\/div>\n <div class="modal-body">\n <iframe id="auth-frame" v-if="url" :src="url" />\n <\/div>\n <\/div>\n <\/div>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.AuthModal=AuthModal;exports.default=AuthModal;vue_property_decorator_1.Vue.component("auth-modal",AuthModal); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.AuthSecret=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),AuthSecret=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.token="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!1,configurable:!0}),t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"authsecret",accessToken:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3">\n <v-input id="token" type="password" v-model="token" placeholder="AuthSecret" \n help="The configured AdminAuthSecret" :responseStatus="responseStatus" />\n <a href="https://docs.servicestack.net/debugging#authsecret" class="lnk-help help-muted" target="_blank" title="help"><\/a> \n <\/div>\n <div class="mb-3">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.AuthSecret=AuthSecret;exports.default=AuthSecret;vue_property_decorator_1.Vue.component("auth-secret",AuthSecret); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.BearerToken=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),BearerToken=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.token="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!1,configurable:!0}),t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"bearer",accessToken:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3">\n <v-input id="token" v-model="token" placeholder="Bearer Token" :responseStatus="responseStatus" \n help="Any BearerToken Auth Providers, e.g. JWT or API Key" />\n <\/div>\n <div class="mb-3">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.BearerToken=BearerToken;exports.default=BearerToken;vue_property_decorator_1.Vue.component("bearer-token",BearerToken); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.Credentials=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),Credentials=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.userName="",t.password="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!1,configurable:!0}),t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"credentials",userName:this.userName,password:this.password,rememberMe:!0}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary except="userName,password" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3">\n <v-input id="userName" v-model="userName" placeholder="Username" :responseStatus="responseStatus" \n help="Username or Email you signed up with" />\n <\/div>\n <div class="mb-3">\n <v-input type="password" id="password" v-model="password" placeholder="Password" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.Credentials=Credentials;exports.default=Credentials;vue_property_decorator_1.Vue.component("credentials",Credentials); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.Auth=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),router_1=require("../../shared/router"),Auth=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.showAuthDialog=!1,t.showUserPopup=!1,t.tab="",t.userName="",t.password="",t.rememberMe=!0,t}return __extends(t,n),Object.defineProperty(t.prototype,"store",{get:function(){return shared_1.store},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"site",{get:function(){return shared_1.store.getSite(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"appInfo",{get:function(){return shared_1.store.getApp(this.slug).app},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){var n;if((n=this.app)!==null&&n!==void 0)return n.plugins.auth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"session",{get:function(){return shared_1.store.getSession(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"prefsDirty",{get:function(){return shared_1.store.isDirty(this.slug)},enumerable:!1,configurable:!0}),t.prototype.goto=function(n){switch(n){case"adminusers":this.$router.push(router_1.adminUsersRoute(this.slug,null));break;case"autoquery":this.$router.push(router_1.autoQueryRoute(this.slug,this.op?{op:this.op}:null));break;case"validation":this.$router.push(router_1.validationRoute(this.slug,this.op?{op:this.op}:null))}},Object.defineProperty(t.prototype,"authProviders",{get:function(){var n;return((n=this.plugin)===null||n===void 0?void 0:n.authProviders)||[]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tabActive",{get:function(){var n;if((n=this.authProviders[0])!==null&&n!==void 0)return n.name},enumerable:!1,configurable:!0}),t.prototype.activeTab=function(n){var t;return this.tab?this.tab==n:((t=this.authProviders[0])===null||t===void 0?void 0:t.type)==n},t.prototype.hasProvider=function(n){return this.authProviders.some(function(t){return t.name==n})},Object.defineProperty(t.prototype,"hasBearer",{get:function(){return this.authProviders.some(function(n){return n.type=="Bearer"})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasOAuth",{get:function(){return this.authProviders.some(function(n){return n.type=="oauth"})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"oauthProviders",{get:function(){return this.authProviders.filter(function(n){return n.type=="oauth"})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSession",{get:function(){return this.authProviders.some(function(n){return n.type=="session"||n.type=="credentials"||n.type=="oauth"})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasAuthSecret",{get:function(){return this.plugin.hasAuthSecret},enumerable:!1,configurable:!0}),t.prototype.modalKeyDown=function(n){if(this.showAuthDialog&&n.key=="Escape"){this.showAuthDialog=!1;return}if(n.ctrlKey&&n.key==="s"){this.savePrefs();n.preventDefault();return}},t.prototype.beforeDestroy=function(){window.removeEventListener("keydown",this.modalKeyDown)},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return window.addEventListener("keydown",this.modalKeyDown),shared_1.bus.$on("signin",function(){shared_1.log("signin",n.session);n.session||(n.showAuthDialog=!0)}),[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n,t;return __generator(this,function(i){switch(i.label){case 0:if(!(this.app&&!this.session))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug}))];case 2:return n=i.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),[3,4];case 3:t=i.sent();shared_1.bus.$emit("appSession",{slug:this.slug,result:null});throw t;case 4:return[2]}})})})];case 1:return t.sent(),[2]}})})},t.prototype.savePrefs=function(){var n=this;this.loading=!0;setTimeout(function(){return n.loading=!1},300);shared_1.bus.$emit("savePrefs",{slug:this.slug})},t.prototype.logout=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var t,n=this;return __generator(this,function(i){switch(i.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"logout"}))];case 1:return t=i.sent(),shared_1.bus.$emit("savePrefs",{slug:this.slug,callback:function(){shared_1.bus.$emit("signout",{slug:n.slug});n.showUserPopup=!1}}),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"feature",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"op",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <button v-if="!session && !loading" @click="showAuthDialog=true" class="btn btn-outline-primary">\n Sign In\n <\/button>\n <span v-if="session">\n \n <div class="btn-group" role="group">\n <button v-if="feature != \'adminusers\'" class="btn btn-light btn-sm" @click="goto(\'adminusers\')"\n title="Go to Admin Users"><i class="users-link svg-lg"/><\/button>\n <button v-if="feature != \'autoquery\'" class="btn btn-light btn-sm" @click="goto(\'autoquery\')"\n title="Go to AutoQuery"><i class="db-link svg-lg"/><\/button>\n <button v-if="feature != \'validation\'" class="btn btn-light btn-sm" @click="goto(\'validation\')"\n title="Go to Validation"><i class="lock-link svg-lg"/><\/button>\n <button v-if="prefsDirty || loading" @click="savePrefs()" title="Save Preferences" \n class="btn btn-light btn-sm"><i :class="(loading ? \'svg-loading\' : \'save-link\') + \' svg-lg\'" /><\/button> \n <div class="btn-group" role="group">\n <button @click="showUserPopup=!showUserPopup" id="btnGroupDrop1" type="button" class="btn btn-light dropdown-toggle">\n <img v-if="session.profileUrl" :src="session.profileUrl" class="sq-lg me-1 mb-1">\n <i v-else class="svg-auth svg-2x mb-1" />\n {{session.displayName || session.userName || session.email}}\n <\/button>\n <div :class="[\'dropdown-menu\',{show:showUserPopup}]" style="top:45px;left:auto">\n <a class="dropdown-item" href="javascript:void(0)" @click="logout()">Sign Out<\/a>\n <\/div> \n <\/div>\n <\/div>\n \n <\/span>\n <div v-if="showAuthDialog" id="signInModal" class="modal" tabindex="-1" role="dialog" \n :style="{ display:showAuthDialog?\'block\':\'none\', background:\'rgba(0,0,0,.25)\'}">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">Sign into {{ appInfo.serviceName }}<\/h5>\n <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @click="showAuthDialog=false"><\/button>\n <\/div>\n <div class="modal-body">\n <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">\n <li class="nav-item" v-if="hasProvider(\'credentials\')" @click="tab=\'credentials\'">\n <span :class="[\'nav-link\', {active:activeTab(\'credentials\')}]">Credentials<\/span>\n <\/li>\n <li class="nav-item" v-if="hasOAuth" @click="tab=\'oauth\'">\n <span :class="[\'nav-link\', {active:activeTab(\'oauth\')}]">OAuth<\/span>\n <\/li>\n <li class="nav-item" v-if="hasBearer" @click="tab=\'Bearer\'">\n <span :class="[\'nav-link\', {active:activeTab(\'Bearer\')}]">Token<\/span>\n <\/li>\n <li class="nav-item" v-if="hasSession" @click="tab=\'session\'">\n <span :class="[\'nav-link\', {active:activeTab(\'session\')}]">Session<\/span>\n <\/li>\n <li class="nav-item" v-if="hasAuthSecret" @click="tab=\'authsecret\'">\n <span :class="[\'nav-link\', {active:activeTab(\'authsecret\')}]">AuthSecret<\/span>\n <\/li>\n <\/ul>\n <div class="tab-content" id="pills-tabContent">\n <div v-if="hasProvider(\'credentials\')" :class="[\'tab-pane\', {active:activeTab(\'credentials\')}]" id="pills-credentials" role="tabpanel">\n <credentials :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasOAuth" :class="[\'tab-pane\', {active:activeTab(\'oauth\')}]" id="pills-oauth" role="tabpanel">\n <oauth-secret :slug="slug" :providers="oauthProviders" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasBearer" :class="[\'tab-pane\', {active:activeTab(\'Bearer\')}]" id="pills-bearer" role="tabpanel">\n <bearer-token :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasSession" :class="[\'tab-pane\', {active:activeTab(\'session\')}]" id="pills-session" role="tabpanel">\n <session-id :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasAuthSecret" :class="[\'tab-pane\', {active:activeTab(\'authsecret\')}]" id="pills-authsecret" role="tabpanel">\n <auth-secret :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <\/div>\n <\/div>\n <\/div>\n <\/div>\n <\/div> \n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.Auth=Auth;exports.default=Auth;vue_property_decorator_1.Vue.component("auth",Auth); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},__spreadArrays=this&&this.__spreadArrays||function(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u};Object.defineProperty(exports,"__esModule",{value:!0});exports.OAuthSecret=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),desktop_1=require("@servicestack/desktop"),OAuthSecret=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.showOAuthModal="",t.tab="session",t.tokenProvider="session",t.selectedProvider="session",t.token="",t.sessionId="",t.originalClip="",t.monitorClip=!1,t}return __extends(t,n),Object.defineProperty(t.prototype,"authProviders",{get:function(){return __spreadArrays([{name:"session"}],this.providers.filter(function(n){return n.type=="oauth"}))},enumerable:!1,configurable:!0}),t.prototype.showProvider=function(n){return __awaiter(this,void 0,void 0,function(){var t,i;return __generator(this,function(r){switch(r.label){case 0:return this.monitorClip=!1,this.tokenProvider=n,t=n=="session"?"/auth?noredirect©=session":"/auth/"+n+"?continue="+encodeURIComponent("/auth?noredirect©=session,"+n),[4,shared_1.openUrl(this.app.app.baseUrl+t)];case 1:return(r.sent(),!shared_1.store.desktop)?[3,4]:(this.selectedProvider=this.tokenProvider,this.monitorClip=!0,i=this,[4,desktop_1.clipboard()]);case 2:return i.originalClip=r.sent(),shared_1.log("monitorClipboard originalClip: "+this.originalClip),[4,this.monitorClipboard()];case 3:r.sent();r.label=4;case 4:return[2]}})})},t.prototype.monitorClipboard=function(){return __awaiter(this,void 0,void 0,function(){var n,t,i=this;return __generator(this,function(r){switch(r.label){case 0:return[4,desktop_1.clipboard()];case 1:return(n=r.sent(),!(n&&n!=this.originalClip))?[3,4]:(this.monitorClip=!1,n.length<25?(this.selectedProvider="session",this.sessionId=n):(this.selectedProvider=this.tokenProvider,this.token=n),[4,desktop_1.windowSendToForeground()]);case 2:return t=r.sent(),shared_1.log("monitorClipboard copy detected: '"+n+"', sendToForeground: "+t),[4,this.submit()];case 3:r.sent();r.label=4;case 4:return this.monitorClip&&setTimeout(function(){return i.monitorClipboard()},200),[2]}})})},Object.defineProperty(t.prototype,"oauthModalProvider",{get:function(){return this.showOAuthModal==="session"?"":this.showOAuthModal},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"includesOAuthTokens",{get:function(){return this.app.plugins.auth.includesOAuthTokens},enumerable:!1,configurable:!0}),t.prototype.activeTab=function(n){return this.tab==n},Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.auth},enumerable:!1,configurable:!0}),t.prototype.modalDone=function(n){n&&Object.keys(n).length==1&&(this.tokenProvider=Object.keys(n)[0],this.token=n[this.tokenProvider],this.tokenProvider==="sessionid"&&(this.tokenProvider="session"));this.showOAuthModal=""},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return(this.monitorClip=!1,!this.sessionId&&!this.token)?[2]:[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:this.selectedProvider,accessToken:this.selectedProvider=="session"?this.sessionId:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":[]})],t.prototype,"providers",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3">\n <p class="text-muted">\n 1. Sign In\n <\/p>\n <div class="mb-3">\n <button v-for="x in authProviders" class="btn btn-outline-primary btn-sm me-1" @click="showProvider(x.name)">{{x.name}}<\/button>\n <\/div>\n \n <auth-modal v-if="showOAuthModal" :slug="slug" :provider="oauthModalProvider" @done="modalDone" />\n \n <p class="text-muted">\n 2. Copy Session Id \n <span v-if="includesOAuthTokens">or OAuth AccessToken<\/span>\n <\/p>\n \n <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">\n <li class="nav-item btn-outline-secondary" @click="selectedProvider=\'session\'">\n <span :class="[\'nav-link\',\'btn-outline-secondary\', {active:selectedProvider==\'session\'}]">sessionId<\/span>\n <\/li>\n <li v-if="tokenProvider != \'session\'" class="nav-item btn-outline-secondary" @click="selectedProvider=tokenProvider">\n <span :class="[\'nav-link\',\'btn-outline-secondary\', {active:selectedProvider==tokenProvider}]">{{tokenProvider}}<\/span>\n <\/li>\n <\/ul>\n <div class="tab-content">\n <div :class="[\'tab-pane\', {active:selectedProvider==\'session\'}]" role="tabpanel">\n <div class="mb-3">\n <v-input id="sessionId" v-model="sessionId" placeholder="Session Id" :responseStatus="responseStatus" />\n <\/div>\n <\/div>\n <div v-if="tokenProvider != \'session\'" :class="[\'tab-pane\', {active:selectedProvider==tokenProvider}]" role="tabpanel">\n <div class="mb-3">\n <v-input id="token" v-model="token" placeholder="Token" :responseStatus="responseStatus" />\n <\/div>\n <\/div>\n <div class="mb-3">\n <button class="btn btn-lg btn-outline-primary" @click="submit" :disabled="loading">Login<\/button>\n <i v-if="loading" class="svg-loading svg-lg ms-2"><\/i>\n <\/div>\n <\/div>\n \n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.OAuthSecret=OAuthSecret;exports.default=OAuthSecret;vue_property_decorator_1.Vue.component("oauth-secret",OAuthSecret); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.SessionId=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),SessionId=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.showSessionModal=!1,t.loading=!1,t.responseStatus=null,t.token="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!1,configurable:!0}),t.prototype.modalDone=function(n){this.token=n&&n.sessionid||"";this.showSessionModal=!1},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"session",accessToken:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":!1})],t.prototype,"hideViewSession",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3">\n <span v-if="!hideViewSession" class="btn btn-sm btn-outline-primary mb-2" @click="showSessionModal=!showSessionModal">session<\/span>\n <auth-modal v-if="showSessionModal" :slug="slug" @done="modalDone" />\n <v-input id="token" v-model="token" placeholder="Session Id" :responseStatus="responseStatus" \n help="Copy your Authenticated Session Id" />\n <\/div>\n <div class="mb-3">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.SessionId=SessionId;exports.default=SessionId;vue_property_decorator_1.Vue.component("session-id",SessionId); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.CreateModal=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),CreateModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.value="",t.model={},t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.autoQuery},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"allProperties",{get:function(){return this.op.request.properties},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.allProperties.length<=10?"lg":"md"},enumerable:!1,configurable:!0}),t.prototype.humanize=function(n){return client_1.humanize(n)},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(){return shared_1.log("CreateModal.mounted()",this.op),shared_1.initInlineModal("#createModal"),this.type.properties.forEach(function(t){n.$set(n.model,t.name,shared_1.defaultValue(t))}),this.$nextTick(function(){var n;(n=document.querySelector("#createModal input:first-child"))===null||n===void 0?void 0:n.select()}),[2]})})},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return n=shared_1.sanitizedModel(this.model),shared_1.log("CreateModal.submit()",n),[4,shared_1.postSiteProxy(new dtos_1.SiteProxy({slug:this.slug,request:this.op.request.name}),n)];case 1:return t.sent(),this.$emit("done",n),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"op",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"type",void 0),__decorate([vue_property_decorator_1.Component({template:'<div id="createModal" class="modal-inline" tabindex="-1" role="dialog" @keyup.esc="$emit(\'done\')">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">\n New {{type.name}}\n <\/h5>\n <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @click="$emit(\'done\')"><\/button>\n <\/div>\n <div class="modal-body">\n <form @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary :except="allProperties.map(x => x.name)" :responseStatus="responseStatus" />\n <\/div> \n <div v-for="f in allProperties" :key="f.name" class="mb-3">\n <v-input-type :property="f" :model="model" :size="size" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3 text-end">\n <span class="btn btn-link" @click="$emit(\'done\')">Close<\/span>\n <button type="submit" class="btn btn-primary">Create {{type.name}}<\/button>\n <\/div>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.CreateModal=CreateModal;exports.default=CreateModal;vue_property_decorator_1.Vue.component("create-modal",CreateModal); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.EditModal=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),EditModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.value="",t.model={},t.confirmDelete=!1,t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.autoQuery},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"allProperties",{get:function(){var n,t,i;return(i=(t=(n=this.updateOp)!==null&&n!==void 0?n:this.patchOp)===null||t===void 0?void 0:t.request.properties)!==null&&i!==void 0?i:[]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.allProperties.length<=10?"lg":"md"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelButton",{get:function(){return this.type.name.length<=13?"Update "+this.type.name:"Update"},enumerable:!1,configurable:!0}),t.prototype.humanize=function(n){return client_1.humanize(n)},t.prototype.fieldValue=function(n){return shared_1.editValue(n,this.model[n.name])},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(){return shared_1.log("EditModal.mounted()",this.type,this.model,this.row,this.updateOp,this.patchOp),shared_1.initInlineModal("#editModal"),this.type.properties.forEach(function(t){n.$set(n.model,t.name,client_1.getField(n.row,t.name))}),this.$nextTick(function(){var n;(n=document.querySelector("#createModal input:first-child"))===null||n===void 0?void 0:n.select()}),[2]})})},t.prototype.deleteRow=function(){return __awaiter(this,void 0,void 0,function(){var n,t,i=this;return __generator(this,function(r){switch(r.label){case 0:return n=this.type.properties.find(function(n){return n.isPrimaryKey}),t=n&&client_1.getField(this.row,n.name),[4,shared_1.exec(this,function(){return __awaiter(i,void 0,void 0,function(){var i;return __generator(this,function(r){switch(r.label){case 0:if(shared_1.log("EditModal.deleteRow()"),!t)throw{errorCode:"InvalidState",message:"Could not resolve Primary Key"};return i=[n.name,t],[4,shared_1.deleteSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:this.deleteOp.request.name,args:i}))];case 1:return r.sent(),this.$emit("done",this.model),[2]}})})})];case 1:return r.sent(),[2]}})})},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return!this.updateOp&&!this.patchOp?[2]:[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var t,n,i,r,u=this;return __generator(this,function(f){switch(f.label){case 0:return(t=shared_1.sanitizedModel(this.model),shared_1.log("EditModal.submit("+(this.updateOp?"Update":"Patch")+")",t),!this.updateOp)?[3,2]:[4,shared_1.postSiteProxy(new dtos_1.SiteProxy({slug:this.slug,request:this.updateOp.request.name}),t)];case 1:return f.sent(),[3,4];case 2:return n={},i=[],this.type.properties.forEach(function(t){var f=client_1.getField(u.row,t.name),r;if(t.isPrimaryKey){n[t.name]=f;return}r=u.model[t.name];f!==r&&(r?n[t.name]=r:i.push(t.name))}),r=i.length>0?shared_1.dtoAsArgs({reset:i}):[],shared_1.log("PATCH "+this.patchOp.request.name+": ",n,r),[4,shared_1.putSiteProxy(new dtos_1.SiteProxy({slug:this.slug,request:this.patchOp.request.name,query:r}),n)];case 3:f.sent();f.label=4;case 4:return this.$emit("done",t),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"updateOp",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"patchOp",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"deleteOp",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"type",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"field",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"row",void 0),__decorate([vue_property_decorator_1.Component({template:'<div id="editModal" class="modal-inline" tabindex="-1" role="dialog" @keyup.esc="$emit(\'done\')" title="">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">\n Edit {{type.name}}\n <\/h5>\n <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @click="$emit(\'done\')"><\/button>\n <\/div>\n <div class="modal-body">\n <form @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="mb-3">\n <error-summary :except="allProperties.map(x => x.name)" :responseStatus="responseStatus" />\n <\/div> \n <div v-for="f in allProperties.filter(f => !f.isPrimaryKey)" :key="f.name" class="mb-3">\n <v-input-type :property="f" :model="model" :size="size" :responseStatus="responseStatus" />\n <\/div>\n <div class="mb-3 text-end">\n <span class="btn btn-link" @click="$emit(\'done\')">close<\/span>\n <button v-if="allProperties.length > 0" type="submit" class="btn btn-primary">{{labelButton}}<\/button>\n <\/div>\n <div v-if="deleteOp" class="confirm-delete" style="margin:-54px 0 0 20px">\n <input id="chkDelete" type="checkbox" class="form-check-input" @change="confirmDelete=!confirmDelete"/> \n <label for="chkDelete" class="form-check-label">confirm<\/label>\n <button class="btn btn-danger " @click.prevent="confirmDelete && deleteRow()" :disabled="!confirmDelete">Delete<\/button>\n <\/div>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.EditModal=EditModal;exports.default=EditModal;vue_property_decorator_1.Vue.component("edit-modal",EditModal); | |
})(); | |
(function(){ | |
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});exports.EventsModal=void 0;var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),EventsModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.results=[],t.expandIds=[],t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){var n;if((n=this.app)!==null&&n!==void 0)return n.plugins.autoQuery},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){var n;return this.plugin.crudEventsServices&&shared_1.store.hasRole(this.slug,(n=this.plugin)===null||n===void 0?void 0:n.accessRole)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pk",{get:function(){return this.type.properties.find(function(n){return n.isPrimaryKey})},enumerable:!1,configurable:!0}),t.prototype.dateFmt=function(n){return client_1.dateFmt(client_1.toDate(n))+" "+client_1.timeFmt12(client_1.toDate(n))},t.prototype.expanded=function(n){return this.expandIds.indexOf(n)>=0},t.prototype.toggle=function(n){this.expanded(n)?this.expandIds=this.expandIds.filter(function(t){return t!=n}):this.expandIds.push(n)},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function( |