Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #135 from VirtoCommerce/dev
Browse files Browse the repository at this point in the history
v1.5.0
  • Loading branch information
pushnitsa authored Nov 26, 2020
2 parents 01cd753 + 54cf3ba commit d736747
Show file tree
Hide file tree
Showing 85 changed files with 3,000 additions and 1,130 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ insert_final_newline = true

# JS, CSS code style settings:
[*.{js,jsx,jsm,ts,tsx,scss,sass,css}]
ident_size = 2
indent_size = 2
quote_type = single
102 changes: 102 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# v0.1
name: Theme deployment
on:
workflow_dispatch:
inputs:
blobUrl:
description: 'Artifact download url'
required: true
artifactVersion:
description: 'Full artifact build number'
required: true
key:
description: 'Deployment config map key'
required: true
appDescriptionRepo:
description: 'ArgoCd repository'
required: true
default: 'VirtoCommerce/vc-deploy-apps'
appDescriptionBranch:
description: 'ArgoCd branch'
required: true
default: 'master'


jobs:
cd:
runs-on: ubuntu-latest
steps:

- name: Start deployment
uses: bobheadxi/deployments@master
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Development
no_override: false

- name: Checkout ArgoCD repository
uses: actions/checkout@v2
with:
token: ${{ secrets.REPO_TOKEN }}
repository: ${{ github.event.inputs.appDescriptionRepo }}
ref: ${{ github.event.inputs.appDescriptionBranch }}

- name: Update deployment-cm
shell: pwsh
run: |
cd ${{ github.workspace }}
cd ./webstore-app/overlays/dev
$fileName = "./deployment-cm.yaml"
$content = Get-Content $fileName
$key = "${{ github.event.inputs.key }}"
$artifactPath = "${{ github.event.inputs.blobUrl }}"
$content -replace "$key\s*:.*", "$key`: $artifactPath" | Set-Content -Path $fileName
- name: Commit deployment-cm change
shell: pwsh
run: |
if(git status --porcelain |Where {$_ -notmatch '^\?\?'}) # uncommitted changes exist
{
git config --global user.name 'GitHub Actions'
git config user.email --global '[email protected]'
git commit -am 'Automated update ${{ github.repository }} to ${{ github.event.inputs.artifactVersion }}'
git push
}
else
{
Write-Output 'Nothing to commit, working tree clean'
}
- name: Wait for environment is up
shell: pwsh
timeout-minutes: 5
run: |
do {
Start-Sleep -s 15
$statusBage = (Invoke-WebRequest -Uri "https://cd.govirto.com/api/badge?name=webstore-app-dev").Content
$syncedAndHealthy = $statusBage.Contains('>Healthy<') -and $statusBage.Contains('>Synced<')
if (-not $syncedAndHealthy) {
Write-Host "Sync pending..."
}
}
while (-not $syncedAndHealthy)
- name: BUILD_STATE::successful
if: success()
run: echo "BUILD_STATE=successful" >> $GITHUB_ENV

- name: BUILD_STATE::failed
if: failure()
run: echo "BUILD_STATE=failed" >> $GITHUB_ENV

- name: Update GitHub deployment status
uses: bobheadxi/deployments@master
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
32 changes: 25 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,29 @@ jobs:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
BLOB_SAS: ${{ secrets.BLOB_TOKEN }}
VERSION_SUFFIX: ""

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup sonarqube
uses: warchant/setup-sonar-scanner@v1
uses: warchant/setup-sonar-scanner@v3

- name: Get Image Version
uses: VirtoCommerce/vc-github-actions/get-image-version@master
uses: VirtoCommerce/vc-github-actions/get-image-version@VP-6093
id: image

- name: Set release variables
run: |
echo "VERSION_SUFFIX=${{ steps.image.outputs.suffix }}" >> $GITHUB_ENV
- name: Set release-alpha variables
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "VERSION_SUFFIX=${{ steps.image.outputs.fullSuffix }}" >> $GITHUB_ENV
- name: Get changelog
id: changelog
uses: VirtoCommerce/vc-github-actions/changelog-generator@master
Expand All @@ -52,12 +62,12 @@ jobs:
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'workflow_dispatch' }}
uses: VirtoCommerce/vc-github-actions/build-theme@master
with:
versionSuffix: ${{ steps.image.outputs.suffix }}
versionSuffix: ${{ env.VERSION_SUFFIX }}

- name: Publish to blob storage
if: ${{ github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master')}}
- name: Publish
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master')}}
id: publish
uses: VirtoCommerce/vc-github-actions/publish-theme@master
uses: VirtoCommerce/vc-github-actions/publish-theme@VP-6093

- name: Create Release
if: ${{ github.ref == 'refs/heads/master' }}
Expand All @@ -78,4 +88,12 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.publish.outputs.artifactPath }}
asset_name: ${{ steps.publish.outputs.artifactName }}
asset_content_type: application/zip
asset_content_type: application/zip

- name: Invoke Theme deployment workflow
if: ${{ github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master')}}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Theme deployment
token: ${{ secrets.REPO_TOKEN }}
inputs: '{ "blobUrl": "${{ steps.publish.outputs.blobUrl }}", "artifactVersion": "${{ steps.image.outputs.fullVersion }}", "key": "B2B_THEME_URL" }'
12 changes: 6 additions & 6 deletions .github/workflows/release-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ jobs:
fetch-depth: 0

- name: Setup sonarqube
uses: warchant/setup-sonar-scanner@v1
uses: warchant/setup-sonar-scanner@v3

- name: Get Image Version
uses: VirtoCommerce/vc-github-actions/get-image-version@VP-5059
uses: VirtoCommerce/vc-github-actions/get-image-version@master
id: image

- name: Get changelog
id: changelog
uses: VirtoCommerce/vc-github-actions/changelog-generator@VP-5059
uses: VirtoCommerce/vc-github-actions/changelog-generator@master

- name: SonarCloud Scan
uses: VirtoCommerce/vc-github-actions/sonar-theme@VP-5059
uses: VirtoCommerce/vc-github-actions/sonar-theme@master

- name: Build
uses: VirtoCommerce/vc-github-actions/build-theme@VP-5059
uses: VirtoCommerce/vc-github-actions/build-theme@master
with:
versionSuffix: ${{ steps.image.outputs.fullSuffix }}

- name: Publish
id: publish
uses: VirtoCommerce/vc-github-actions/publish-theme@VP-5059
uses: VirtoCommerce/vc-github-actions/publish-theme@master
Binary file added assets/blocks/1428965138000_1133723.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/coveer-with-form-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/cover-with-image-background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/logo-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/logo-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/logo-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/logo-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/portfolio-woocommerce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<form method="get" action="{{ '/search' | absolute_url }}" role="search" autocomplete="off">
<div class="input-group" uib-dropdown is-open="$ctrl.hasHint" dropdown-append-to-body="true">
<input type="search" name="q" class="form-control border-top-0 border-left-0 border-right-0 border-gray-900 navbar-search-bar" ng-model="$ctrl.query" placeholder="{% raw %}{{ $ctrl.placeholder }}{% endraw %}"
uib-typeahead="suggestion as suggestion.name for suggestion in $ctrl.getSuggestions()" typeahead-is-open="$ctrl.isOpen" typeahead-wait-ms="100" typeahead-loading="$ctrl.isSearching" typeahead-no-results="$ctrl.hasNoResults"
typeahead-focus-first="false" typeahead-template-url="search-bar-match.tpl" typeahead-popup-template-url="search-bar-popup.tpl" typeahead-append-to-body="true">
<ul class="dropdown-menu" uib-dropdown-menu>
<li class="disabled" ng-show="$ctrl.isSearching"><a href="" ng-bind="$ctrl.searching"></a></li>
<li class="disabled" ng-show="$ctrl.hasNoResults"><a href="" ng-bind="$ctrl.noResults"></a></li>
</ul>
<span class="input-group-append">
<button type="submit" class="btn btn-primary rounded-0 border-top-0 border-left-0 border-right-0 border-bottom border-gray-900 px-3 py-2" ng-bind="$ctrl.submitLabel"></button>
</span>
</div>
<script id="search-bar-match.tpl" type="text/ng-template">
<a ng-href="{% raw %}{{ match.model.url }}{% endraw %}"
tabindex="-1"
ng-bind-html="match.label | uibTypeaheadHighlight:query"
ng-attr-title="{{match.label}}"></a>
</script>
<script id="search-bar-popup.tpl" type="text/ng-template">
<ul class="dropdown-menu" ng-show="isOpen() && !moveInProgress" ng-style="{top: position().top+'px', left: position().left+'px'}" role="listbox" aria-hidden="{% raw %}{{!isOpen()}}{% endraw %}">
<li class="dropdown-header" ng-repeat-start="(group, groupMatches) in matches | groupBy: 'model.within'" ng-bind="$parent.$parent.$ctrl[group + 'Label']"></li>
<li class="uib-typeahead-match" ng-repeat="match in groupMatches track by $index" ng-repeat-end ng-class="{active: isActive(match.model.index) }" ng-mouseenter="selectActive(match.model.index)" ng-click="selectMatch(match.model.index, $event)" role="option" id="{% raw %}{{::match.id}}{% endraw %}">
<div uib-typeahead-match index="match.model.index" match="match" query="query" template-url="templateUrl"></div>
</li>
</ul>
</script>
</form>
80 changes: 50 additions & 30 deletions assets/js/common-components/searchBar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
searchBarController.$inject = ['$scope', '$q', 'catalogService'];
function searchBarController($scope, $q, catalogService) {
var $ctrl = this;
$ctrl.hasHint = false;

$scope.$watch('$ctrl.isOpen', function (isOpen) {
$ctrl.hasHint = !!$ctrl.query && !isOpen;
});

$scope.$watch('$ctrl.query', function (query) {
$ctrl.hasHint = !!query && !$ctrl.isOpen;
});

$ctrl.getSuggestions = function () {
var searchCriteria = { keyword: $ctrl.query, start: 0, isFuzzySearch: true };
return $q.all([
catalogService.searchCategories(angular.extend({}, searchCriteria, { pageSize: $ctrl.categoryLimit })),
catalogService.search(angular.extend({}, searchCriteria, { pageSize: $ctrl.productLimit }))
]).then(function (results) {
var process = function (within) {
return (results[0].data[within] || results[1].data[within]).map(function (suggestion) {
suggestion['within'] = within;
return suggestion;
});
}
return process('categories').concat(process('products')).map(function (suggestion, index) {
suggestion['index'] = index;
return suggestion;
});
});
};
}

var storefrontApp = angular.module('storefrontApp');
storefrontApp.component('vcSearchBar', {
templateUrl: "themes/assets/js/common-components/searchBar.tpl.html",
Expand All @@ -13,35 +46,22 @@ storefrontApp.component('vcSearchBar', {
categoryLimit: '@',
productLimit: '@'
},
controller: ['$scope', '$q', 'catalogService', function ($scope, $q, catalogService) {
var $ctrl = this;
$ctrl.hasHint = false;

$scope.$watch('$ctrl.isOpen', function (isOpen) {
$ctrl.hasHint = !!$ctrl.query && !isOpen;
});

$scope.$watch('$ctrl.query', function (query) {
$ctrl.hasHint = !!query && !$ctrl.isOpen;
});
controller: searchBarController
});

$ctrl.getSuggestions = function () {
var searchCriteria = { keyword: $ctrl.query, start: 0, isFuzzySearch: true };
return $q.all([
catalogService.searchCategories(angular.extend({}, searchCriteria, { pageSize: $ctrl.categoryLimit })),
catalogService.search(angular.extend({}, searchCriteria, { pageSize: $ctrl.productLimit }))
]).then(function (results) {
var process = function (within) {
return (results[0].data[within] || results[1].data[within]).map(function (suggestion) {
suggestion['within'] = within;
return suggestion;
});
}
return process('categories').concat(process('products')).map(function (suggestion, index) {
suggestion['index'] = index;
return suggestion;
});
});
};
}]
storefrontApp.component('vcSearchBarMigration', {
templateUrl: "themes/assets/js/bootstrap-migration/common-components/searchBar.tpl.html",
bindings: {
formClass: '<',
placeholder: '<',
searching: '<',
noResults: '<',
query: '@',
categoriesLabel: '<',
productsLabel: '<',
submitLabel: '<',
categoryLimit: '@',
productLimit: '@'
},
controller: searchBarController
});
Loading

0 comments on commit d736747

Please sign in to comment.