Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ed344e503 | |||
| 0460846dac | |||
| a6d9526d73 | |||
| 617945c730 |
@@ -1,8 +1,17 @@
|
||||
name: cabinet-ci-cd
|
||||
|
||||
# CI/CD: только push git-тега (ручное тегирование на ветке prod|test|stage).
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Ветка для прогона тестов'
|
||||
required: true
|
||||
default: test
|
||||
type: choice
|
||||
options:
|
||||
- prod
|
||||
- test
|
||||
- stage
|
||||
push:
|
||||
tags:
|
||||
- 'cabinet-v*'
|
||||
@@ -14,9 +23,12 @@ env:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/cabinet-v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }}
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
@@ -31,6 +43,7 @@ jobs:
|
||||
- run: composer audit || true
|
||||
|
||||
parse-tag:
|
||||
if: startsWith(github.ref, 'refs/tags/cabinet-v')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
full_tag: ${{ steps.meta.outputs.full_tag }}
|
||||
@@ -47,6 +60,7 @@ jobs:
|
||||
|
||||
build-and-push:
|
||||
needs: [test, parse-tag]
|
||||
if: startsWith(github.ref, 'refs/tags/cabinet-v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -65,6 +79,7 @@ jobs:
|
||||
|
||||
deploy-gitops:
|
||||
needs: [build-and-push, parse-tag]
|
||||
if: startsWith(github.ref, 'refs/tags/cabinet-v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Bump image tag in sova-deploy
|
||||
|
||||
+1
-1
@@ -25,6 +25,6 @@ yarn-error.log
|
||||
###< symfony/webpack-encore-bundle ###
|
||||
/*.md
|
||||
/*.lock
|
||||
!/yarn.lock
|
||||
/symfony.lock
|
||||
/yarn.lock
|
||||
/service.sh
|
||||
+10
@@ -1,5 +1,14 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:24-alpine AS assets
|
||||
WORKDIR /app
|
||||
COPY package.json yarn.lock* ./
|
||||
RUN corepack enable && if [ -f yarn.lock ]; then yarn install --frozen-lockfile; else yarn install; fi
|
||||
COPY webpack.config.js ./
|
||||
COPY assets ./assets
|
||||
COPY public ./public
|
||||
RUN yarn build
|
||||
|
||||
FROM composer:2 AS vendor
|
||||
WORKDIR /app
|
||||
COPY composer.json composer.lock* ./
|
||||
@@ -29,6 +38,7 @@ RUN cp /usr/share/zoneinfo/$TZ /etc/localtime && echo "$TZ" > /etc/timezone
|
||||
|
||||
COPY docker/fpm-pool.conf /usr/local/etc/php-fpm.d/zz-docker.conf
|
||||
COPY --from=vendor /app /app
|
||||
COPY --from=assets /app/public/build /app/public/build
|
||||
|
||||
RUN mkdir -p var/cache var/log public/uploads public/banners \
|
||||
&& chown -R www-data:www-data var public/uploads public/banners \
|
||||
|
||||
@@ -207,7 +207,15 @@ function countDown(options) {
|
||||
};
|
||||
}
|
||||
|
||||
function isTestContour() {
|
||||
return /\.sova\.local$/i.test(location.hostname);
|
||||
}
|
||||
|
||||
function getApiHostname() {
|
||||
if (isTestContour()) {
|
||||
return 'http://api.test.sova.local';
|
||||
}
|
||||
|
||||
if (/sovamed\.ru/m.test(location.hostname)) {
|
||||
return 'https://api.sovamed.ru';
|
||||
}
|
||||
@@ -216,6 +224,10 @@ function getApiHostname() {
|
||||
}
|
||||
|
||||
function getHostname() {
|
||||
if (isTestContour()) {
|
||||
return location.origin;
|
||||
}
|
||||
|
||||
if (/sovamed\.ru/m.test(location.hostname)) {
|
||||
return 'https://cabinet.sovamed.ru';
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const helper = require("./helper.js");
|
||||
const testSdk = require("./testSdk.js");
|
||||
|
||||
function esia() {
|
||||
if (document.location.search == '?esia=true') {
|
||||
@@ -39,6 +40,14 @@ function esia() {
|
||||
|
||||
function loadSDK(controller) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (testSdk.install()) {
|
||||
console.log(controller + ' - test sdk (sova.local)');
|
||||
window.webSDK = new WrSDK();
|
||||
esia();
|
||||
resolve(window.webSDK);
|
||||
return;
|
||||
}
|
||||
|
||||
var script = document.getElementById('sdk-infoclinica');
|
||||
|
||||
if (script == null) {
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Test-contour shim for the MIS webSDK (WrSDK) and Yandex SmartCaptcha.
|
||||
*
|
||||
* Production keeps loading the real SDK from widget.sovamed.ru / widget.wmtmed.ru
|
||||
* and the real captcha from smartcaptcha.yandexcloud.net. Those hosts are not
|
||||
* reachable from the isolated *.sova.local test contour and their captcha sitekey
|
||||
* is bound to production domains, so patient registration cannot complete there.
|
||||
*
|
||||
* This module is a no-op unless the page is served from a *.sova.local host.
|
||||
*/
|
||||
|
||||
function isTestContour() {
|
||||
return typeof location !== 'undefined' && /\.sova\.local$/i.test(location.hostname);
|
||||
}
|
||||
|
||||
function resolveLater(value, ms) {
|
||||
return new Promise(function(resolve) {
|
||||
setTimeout(function() { resolve(value); }, ms || 150);
|
||||
});
|
||||
}
|
||||
|
||||
function rejectLater(value, ms) {
|
||||
return new Promise(function(_, reject) {
|
||||
setTimeout(function() { reject(value); }, ms || 150);
|
||||
});
|
||||
}
|
||||
|
||||
function TestWrSDK() {
|
||||
this.data = { user: { authenticated: false } };
|
||||
this.sdkOrigin = location.origin;
|
||||
}
|
||||
|
||||
TestWrSDK.prototype.on = function(event, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
setTimeout(callback, 0);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
TestWrSDK.prototype.isLoggedIn = function() {
|
||||
return resolveLater({ authenticated: false });
|
||||
};
|
||||
|
||||
// New patient: report "not found" so the UI switches to the registration form.
|
||||
TestWrSDK.prototype.recoveryInit = function() {
|
||||
return rejectLater({ data: { message: 'Пользователь не найден в базе данных (тестовый контур)' } });
|
||||
};
|
||||
|
||||
TestWrSDK.prototype.registerInit = function() {
|
||||
return resolveLater({ data: { rToken: 'test-rtoken-' + Date.now(), email: 'false' } });
|
||||
};
|
||||
|
||||
TestWrSDK.prototype.registerComplete = function() {
|
||||
return resolveLater({ data: { text: 'Тестовый контур: аккаунт создан. Код подтверждения — любой.' } });
|
||||
};
|
||||
|
||||
TestWrSDK.prototype.recoveryComplete = function() {
|
||||
return resolveLater({ data: { message: 'Тестовый контур: пароль установлен.' } });
|
||||
};
|
||||
|
||||
TestWrSDK.prototype.changeTempPassword = function() {
|
||||
return resolveLater({ data: { success: 'Тестовый контур: пароль изменён.' } });
|
||||
};
|
||||
|
||||
TestWrSDK.prototype.loadLoginView = function() {};
|
||||
|
||||
TestWrSDK.prototype.loginClient = function() {
|
||||
return rejectLater({ data: { message: 'Вход в тестовом контуре недоступен: МИС замокана.' } });
|
||||
};
|
||||
|
||||
function installSmartCaptcha() {
|
||||
if (window.smartCaptcha && window.smartCaptcha.__test) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.smartCaptcha = {
|
||||
__test: true,
|
||||
render: function(container) {
|
||||
if (container) {
|
||||
container.innerHTML =
|
||||
'<div class="alert alert-info py-1 mb-0" style="font-size:12px">' +
|
||||
'Тестовый контур: проверка капчи отключена</div>';
|
||||
}
|
||||
return 'test-captcha-widget';
|
||||
},
|
||||
getResponse: function() { return 'test-captcha-token'; },
|
||||
subscribe: function(widgetId, event, callback) {
|
||||
if (event === 'success' && typeof callback === 'function') {
|
||||
setTimeout(callback, 0);
|
||||
}
|
||||
},
|
||||
reset: function() {},
|
||||
execute: function() {}
|
||||
};
|
||||
}
|
||||
|
||||
function install() {
|
||||
if (!isTestContour()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
window.WrSDK = TestWrSDK;
|
||||
installSmartCaptcha();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isTestContour()) {
|
||||
installSmartCaptcha();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isTestContour: isTestContour,
|
||||
install: install
|
||||
};
|
||||
@@ -1,16 +1,13 @@
|
||||
import { Controller } from 'stimulus';
|
||||
import 'owl.carousel2/dist/assets/owl.carousel.css';
|
||||
import 'owl.carousel2/dist/assets/owl.theme.default.css';
|
||||
import 'owl.carousel2';
|
||||
|
||||
/*
|
||||
* This is an example Stimulus controller!
|
||||
*
|
||||
* Any element with a data-controller="hello" attribute will cause
|
||||
* this controller to be executed. The name "hello" comes from the filename:
|
||||
* hello_controller.js -> "hello"
|
||||
*
|
||||
* Delete this file or adapt it for your use!
|
||||
* owl.carousel2 is a legacy jQuery plugin that reads `window.jQuery` at module
|
||||
* evaluation time. When statically imported it lands in the eager shared chunk,
|
||||
* and depending on webpack chunk ordering it can evaluate before jQuery is ready,
|
||||
* throwing and breaking the whole Stimulus bootstrap. Load it lazily inside
|
||||
* connect() so it can never break unrelated controllers (e.g. registration).
|
||||
*/
|
||||
export default class extends Controller {
|
||||
static targets = ["showid"];
|
||||
@@ -18,6 +15,7 @@ export default class extends Controller {
|
||||
connect() {
|
||||
var slideshow = this.element;
|
||||
|
||||
import('owl.carousel2').then(function() {
|
||||
$(slideshow).owlCarousel({
|
||||
nav: true,
|
||||
margin: 15,
|
||||
@@ -42,6 +40,10 @@ export default class extends Controller {
|
||||
});
|
||||
|
||||
slideshow.classList.remove('hide');
|
||||
}).catch(function(e) {
|
||||
console.warn('owl.carousel failed to load', e);
|
||||
slideshow.classList.remove('hide');
|
||||
});
|
||||
|
||||
slideshow.querySelectorAll('.show-msg').forEach(function (el) {
|
||||
el.addEventListener('click', function (evn) {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
},
|
||||
"license": "UNLICENSED",
|
||||
"private": true,
|
||||
"packageManager": "yarn@1.22.22",
|
||||
"scripts": {
|
||||
"dev-server": "encore dev-server",
|
||||
"dev": "encore dev",
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
{% block title %}Регистрация пациента{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{% if 'sova.local' not in app.request.host %}
|
||||
<script id="smartCaptcha" src="https://smartcaptcha.yandexcloud.net/captcha.js"></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block top %}
|
||||
|
||||
Reference in New Issue
Block a user