From 393c266de49bedb7d9cc081ec87fcbba6ee9794f Mon Sep 17 00:00:00 2001 From: bmotevalli Date: Fri, 24 May 2024 00:51:29 +0800 Subject: [PATCH 01/12] moving to use static tags for devs. --- .github/workflows/build.yml | 56 ++++++++++++++++++------------------- .gitignore | 1 + 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2edc9a85..447f8918 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,32 +8,32 @@ on: jobs: - build-and-push-ghcr-prod: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true + # build-and-push-ghcr-prod: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # with: + # submodules: true - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v1 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ vars.USERNAME }} - password: ${{ secrets.TOKEN }} + # - name: Log in to GitHub Container Registry + # uses: docker/login-action@v1 + # with: + # registry: ghcr.io + # username: ${{ vars.USERNAME }} + # password: ${{ secrets.TOKEN }} - - name: Build and Push Docker image to GHCR (Prod) - uses: docker/build-push-action@v2 - with: - context: ./ckan - file: ./ckan/Dockerfile - tags: ghcr.io/auscope/auscope-ckan:latest - push: true + # - name: Build and Push Docker image to GHCR (Prod) + # uses: docker/build-push-action@v2 + # with: + # context: ./ckan + # file: ./ckan/Dockerfile + # tags: ghcr.io/auscope/auscope-ckan:latest + # push: true - build-and-push-ghcr-dev: + build-and-push-ghcr: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -50,20 +50,20 @@ jobs: username: ${{ vars.USERNAME }} password: ${{ secrets.TOKEN }} - - name: Extract timestamp - id: timestamp - run: echo "::set-output name=timestamp::$(date +'%Y%m%d%H%M%S')" + # - name: Extract timestamp + # id: timestamp + # run: echo "::set-output name=timestamp::$(date +'%Y%m%d%H%M%S')" - name: Set dynamic tag id: set-tag run: | if [[ "${{ github.ref }}" == "refs/heads/dev-sample" ]]; then - echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan-dev:sample-${{ steps.timestamp.outputs.timestamp }}" + echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan:sample-latest" else - echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan-dev:latest-${{ steps.timestamp.outputs.timestamp }}" + echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan:latest" fi - - name: Build and Push Docker image to GHCR (Dev) + - name: Build and Push Docker image to GHCR uses: docker/build-push-action@v2 with: context: ./ckan diff --git a/.gitignore b/.gitignore index 426d1d52..361dcc5f 100755 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ local/* .vscode/ .env.dev *kill* +.env.local From 28c48e37ac9a8772f5ea9738cb896229ed30f674 Mon Sep 17 00:00:00 2001 From: bmotevalli Date: Fri, 24 May 2024 01:08:19 +0800 Subject: [PATCH 02/12] trigger test for new deployment. --- .github/workflows/build.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 447f8918..403decdd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,31 +8,6 @@ on: jobs: - # build-and-push-ghcr-prod: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # with: - # submodules: true - - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v1 - - # - name: Log in to GitHub Container Registry - # uses: docker/login-action@v1 - # with: - # registry: ghcr.io - # username: ${{ vars.USERNAME }} - # password: ${{ secrets.TOKEN }} - - # - name: Build and Push Docker image to GHCR (Prod) - # uses: docker/build-push-action@v2 - # with: - # context: ./ckan - # file: ./ckan/Dockerfile - # tags: ghcr.io/auscope/auscope-ckan:latest - # push: true - build-and-push-ghcr: runs-on: ubuntu-latest steps: @@ -50,10 +25,6 @@ jobs: username: ${{ vars.USERNAME }} password: ${{ secrets.TOKEN }} - # - name: Extract timestamp - # id: timestamp - # run: echo "::set-output name=timestamp::$(date +'%Y%m%d%H%M%S')" - - name: Set dynamic tag id: set-tag run: | From 79b6d644731bdea0dc9148e79eb36c18144e589d Mon Sep 17 00:00:00 2001 From: bmotevalli Date: Fri, 24 May 2024 01:27:58 +0800 Subject: [PATCH 03/12] another trigger. --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 403decdd..40d15120 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,6 @@ jobs: uses: docker/build-push-action@v2 with: context: ./ckan - file: ./ckan/Dockerfile # Consider using a separate Dockerfile for dev if needed - tags: ${{ steps.set-tag.outputs.tag }} # ghcr.io/auscope/auscope-ckan-dev:latest-${{ steps.timestamp.outputs.timestamp }} + file: ./ckan/Dockerfile + tags: ${{ steps.set-tag.outputs.tag }} push: true From edb2650f8750ddb95056ed0e751f15d232ee2e7f Mon Sep 17 00:00:00 2001 From: root Date: Fri, 24 May 2024 14:17:59 +1000 Subject: [PATCH 04/12] All users can now see private datasets in search, but can only access if creators and/or admins/curators --- .../ckanext/auscope_theme/logic/schema.py | 50 ++++++++++--------- .../ckanext/auscope_theme/plugin.py | 3 -- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/logic/schema.py b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/logic/schema.py index c51b5c1f..26c6202f 100644 --- a/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/logic/schema.py +++ b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/logic/schema.py @@ -54,29 +54,33 @@ def after_dataset_show(context, pkg_dict): pkg_dict['citation'] = citation -@tk.chained_action -def after_dataset_search(search_results, search_params): - """ - Filtered returned search results so that members do not see other user's private datasets. - Editors and admins will still see all datasets. - """ - result_count = search_results['count'] - if result_count > 0: - user = tk.g.userobj - if user: - filtered_results = search_results['results'].copy() - for package in search_results['results']: - if 'owner_org' in package: - # There's only one org so we could probably get away with only doing this once - user_role = authz.users_role_for_group_or_org(package['owner_org'], user.name) - # Filter out any private datasets that the user did not create themselves if they are only a member - if user_role == 'member' and package['private'] and user.id != package['creator_user_id']: - filtered_results.remove(package) - result_count -= 1 - search_results['results'] = filtered_results - search_results['count'] = result_count - - return search_results +#@tk.chained_action +#def after_dataset_search(search_results, search_params): +# """ +# Filter returned search results so that members do not see other user's private datasets. +# Editors and admins will still see all datasets. +# +# Note: We now want everyone to see all private datasets, just not access them. Have left +# this method here in case users don't want datasets advertised before release. +# +# """ +# result_count = search_results['count'] +# if result_count > 0: +# user = tk.g.userobj +# if user: +# filtered_results = search_results['results'].copy() +# for package in search_results['results']: +# if 'owner_org' in package: +# # There's only one org so we could probably get away with only doing this once +# user_role = authz.users_role_for_group_or_org(package['owner_org'], user.name) +# # Filter out any private datasets that the user did not create themselves if they are only a member +# if user_role == 'member' and package['private'] and user.id != package['creator_user_id']: +# filtered_results.remove(package) +# result_count -= 1 +# search_results['results'] = filtered_results +# search_results['count'] = result_count +# +# return search_results def get_admin_dataset_notification_body(context, pkg_dict): diff --git a/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/plugin.py b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/plugin.py index ca2ba9a5..ecb8af69 100644 --- a/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/plugin.py +++ b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/plugin.py @@ -31,9 +31,6 @@ def update_config(self, config_): def after_dataset_show(self, *args, **kwargs): return schema.after_dataset_show(*args, **kwargs) - def after_dataset_search(self, *args, **kwargs): - return schema.after_dataset_search(*args, **kwargs) - def after_dataset_update(self, *args, **kwargs): return schema.after_dataset_update(*args, **kwargs) From a0060633bcf0880a0200b9a7465e7f31d6a3ee6b Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 24 May 2024 05:34:02 +0000 Subject: [PATCH 05/12] =?UTF-8?q?Bump=20version:=200.1.9=20=E2=86=92=200.2?= =?UTF-8?q?.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ckan/setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckan/setup.cfg b/ckan/setup.cfg index 386094ef..bc0108a9 100644 --- a/ckan/setup.cfg +++ b/ckan/setup.cfg @@ -1,4 +1,4 @@ [bumpversion] -current_version = 0.1.9 +current_version = 0.2.0 commit = True tag = True From 371cd418b7c689631a311939194e4156b439f425 Mon Sep 17 00:00:00 2001 From: Neda Taherifar Date: Mon, 27 May 2024 11:32:10 +0800 Subject: [PATCH 06/12] Display the data files as part of the update process #96 --- ckan/src/shared/public/shared_style.css | 18 +++++++++ .../templates/package/new_resource.html | 6 +++ .../package/new_resource_not_draft.html | 6 +++ .../package/snippets/resource_help.html | 40 +++++++++++++++++++ .../package/snippets/resource_item_short.html | 27 +++++++++++++ 5 files changed, 97 insertions(+) create mode 100644 ckan/src/shared/templates/package/new_resource.html create mode 100644 ckan/src/shared/templates/package/new_resource_not_draft.html create mode 100644 ckan/src/shared/templates/package/snippets/resource_help.html create mode 100644 ckan/src/shared/templates/package/snippets/resource_item_short.html diff --git a/ckan/src/shared/public/shared_style.css b/ckan/src/shared/public/shared_style.css index 85935e10..542c0c95 100644 --- a/ckan/src/shared/public/shared_style.css +++ b/ckan/src/shared/public/shared_style.css @@ -792,4 +792,22 @@ body { background-image: url('/base/vendor/leaflet-draw/images/spritesheet.png') !important; background-repeat: no-repeat !important; color: transparent !important; +} + +.nav-resource .resource-item .nav-format-label { + display: flex; + align-items: center; +} + +.nav-resource .resource-item .heading { + color: #000; + font-size: 14px; + font-weight: normal; +} + +.nav-resource .nav-format-label .format-label { + width: 30px; + height: 32.5px; + margin: -14px 0 0 -14px; + font: normal; } \ No newline at end of file diff --git a/ckan/src/shared/templates/package/new_resource.html b/ckan/src/shared/templates/package/new_resource.html new file mode 100644 index 00000000..78105dac --- /dev/null +++ b/ckan/src/shared/templates/package/new_resource.html @@ -0,0 +1,6 @@ +{% ckan_extends %} + +{% block secondary_content %} + {% snippet 'package/snippets/resource_help.html' , pkg=pkg, resources=pkg.resources %} +{% endblock %} + diff --git a/ckan/src/shared/templates/package/new_resource_not_draft.html b/ckan/src/shared/templates/package/new_resource_not_draft.html new file mode 100644 index 00000000..8093383b --- /dev/null +++ b/ckan/src/shared/templates/package/new_resource_not_draft.html @@ -0,0 +1,6 @@ +{% ckan_extends %} + + +{% block secondary_content %} + {% snippet 'package/snippets/resource_help.html' , pkg=pkg, resources=pkg.resources %} +{% endblock %} diff --git a/ckan/src/shared/templates/package/snippets/resource_help.html b/ckan/src/shared/templates/package/snippets/resource_help.html new file mode 100644 index 00000000..34a4e0f5 --- /dev/null +++ b/ckan/src/shared/templates/package/snippets/resource_help.html @@ -0,0 +1,40 @@ +{% set resources = pkg.resources %} + +
+

{{ _('Data and Resources') }}

+
+ {% block resource_list %} + {% if resources %} + {% set can_edit = can_edit or h.check_access('package_update', {'id': pkg.id}) %} + + {% if resources|length > 10 %} + Load More + {% endif %} + {% else %} + {% block resource_list_empty %} + {% if h.check_access('resource_create', {'package_id': pkg['id']}) %} + {% trans url=h.url_for(pkg.type ~ '_resource.new', id=pkg.name) %} +

This dataset has no data, why not add some?

+ {% endtrans %} + {% else %} +

{{ _('This dataset has no data') }}

+ {% endif %} + {% endblock %} + {% endif %} + {% endblock %} +
+ +

{{ _('What\'s a resource?') }}

+
+

{{ _('A resource can be any file or link to a file containing useful data.') }}

+
+
diff --git a/ckan/src/shared/templates/package/snippets/resource_item_short.html b/ckan/src/shared/templates/package/snippets/resource_item_short.html new file mode 100644 index 00000000..dc181c8f --- /dev/null +++ b/ckan/src/shared/templates/package/snippets/resource_item_short.html @@ -0,0 +1,27 @@ +{% extends 'package/snippets/resource_item.html' %} + +{% set url_action = pkg.type ~ ('_resource.edit' if url_is_edit and can_edit else '_resource.read') %} +{% set url = url or h.url_for(url_action, id=pkg.name, resource_id=res.id) %} + + +{% block content %} +
  • + {% block resource_item_title %} + + {% endblock %} + {% block resource_item_description %} +

    + {% if res.description %} + {{ h.markdown_extract(h.get_translated(res, 'description'), extract_length=80) }} + {% endif %} +

    + {% endblock %} + {% block resource_item_explore %}{% endblock %} +
  • +{% endblock %} \ No newline at end of file From a495ee3c7916250500ba32088972bb721c189842 Mon Sep 17 00:00:00 2001 From: bmotevalli Date: Mon, 27 May 2024 11:35:52 +0800 Subject: [PATCH 07/12] updating build.yml to deploy back dev images to dev repository. --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40d15120..22f7246b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,15 +29,15 @@ jobs: id: set-tag run: | if [[ "${{ github.ref }}" == "refs/heads/dev-sample" ]]; then - echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan:sample-latest" + echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan-dev:sample-latest" else - echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan:latest" + echo "::set-output name=tag::ghcr.io/auscope/auscope-ckan-dev:latest" fi - name: Build and Push Docker image to GHCR uses: docker/build-push-action@v2 with: context: ./ckan - file: ./ckan/Dockerfile + file: ./ckan/Dockerfile # Consider using a separate Dockerfile for dev if needed tags: ${{ steps.set-tag.outputs.tag }} push: true From 0e4d370d53724e862011696464da1999d151634b Mon Sep 17 00:00:00 2001 From: Neda Taherifar Date: Mon, 27 May 2024 11:39:03 +0800 Subject: [PATCH 08/12] Replace the term tags with keywords #180 --- ckan/src/shared/templates/home/snippets/search.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckan/src/shared/templates/home/snippets/search.html b/ckan/src/shared/templates/home/snippets/search.html index 24d5c1bf..35d7335d 100644 --- a/ckan/src/shared/templates/home/snippets/search.html +++ b/ckan/src/shared/templates/home/snippets/search.html @@ -18,7 +18,7 @@

    {{ _("Search data") }}

    -

    {{ _('Popular tags') }}

    +

    {{ _('Popular keywords') }}

    {% for tag in tags %} {{ tag.display_name|truncate(22) }} {% endfor %} From 32d1f7a53c6ee5ab57832cca2c7082545a44c509 Mon Sep 17 00:00:00 2001 From: Neda Taherifar Date: Mon, 27 May 2024 14:31:42 +0800 Subject: [PATCH 09/12] Include Request Types in subject field of the contact form #192 After merging into the master branch, the variable CKAN__PLUGINS should be updated so that the contact plugin is placed after the auscope plugin.This ensures that the auscope plugin can inherit from the contact plugin and apply our custom changes. --- .env.dev | 4 +-- .env.example | 4 +-- .../templates/contact/snippets/form.html | 26 +++++++++++++++++++ .../auscope_theme/templates/header.html | 7 ----- .../templates/contact/snippets/form.html | 26 +++++++++++++++++++ .../ckanext/igsn_theme/templates/header.html | 6 ----- ckan/src/shared/templates/header.html | 16 +++++++++++- 7 files changed, 71 insertions(+), 18 deletions(-) create mode 100644 ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/contact/snippets/form.html create mode 100644 ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/templates/contact/snippets/form.html diff --git a/.env.dev b/.env.dev index cc56bad2..2641126d 100644 --- a/.env.dev +++ b/.env.dev @@ -86,8 +86,8 @@ CKAN__LICENSES_GROUP_URL= file:///shared/public/licenses.json CKAN__DISPLAY_TIMEZONE=Australia/Sydney # Extensions -CKAN__PLUGINS="envvars oidc_pkce contact auscope_theme scheming_datasets composite image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi s3filestore" -# CKAN__PLUGINS="envvars oidc_pkce contact igsn_theme scheming_datasets composite image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi s3filestore" +CKAN__PLUGINS="envvars oidc_pkce auscope_theme contact scheming_datasets composite image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi s3filestore" +# CKAN__PLUGINS="envvars oidc_pkce igsn_theme contact scheming_datasets composite image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi s3filestore" CKAN__HARVEST__MQ__TYPE=redis CKAN__HARVEST__MQ__HOSTNAME=redis diff --git a/.env.example b/.env.example index e7952742..272b4286 100644 --- a/.env.example +++ b/.env.example @@ -88,10 +88,10 @@ CKAN__LICENSES_GROUP_URL= file:///shared/public/licenses.json # To switch themes between igsn-theme and auscope-theme, # comment out one CKAN__PLUGINS line and uncomment the other. # For Auscope Theme -CKAN__PLUGINS="envvars contact oidc_pkce auscope_theme scheming_datasets composite zip_view image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi" +CKAN__PLUGINS="envvars oidc_pkce auscope_theme contact scheming_datasets composite zip_view image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi" # For IGSN Theme -# CKAN__PLUGINS="envvars contact oidc_pkce igsn_theme scheming_datasets composite zip_view image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi" +# CKAN__PLUGINS="envvars oidc_pkce igsn_theme contact scheming_datasets composite zip_view image_view text_view recline_view datastore datapusher spatial_metadata spatial_query doi" CKAN__HARVEST__MQ__TYPE=redis CKAN__HARVEST__MQ__HOSTNAME=redis diff --git a/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/contact/snippets/form.html b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/contact/snippets/form.html new file mode 100644 index 00000000..eadce51a --- /dev/null +++ b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/contact/snippets/form.html @@ -0,0 +1,26 @@ +{% ckan_extends %} + +{% block contact_form_fields %} + + {{ form.select('subject', label=_('Subject'), id='field-subject', + selected=data.subject, error=errors.subject, classes=['control-medium'], + options=[ + {'text': _('General/Other Enquiry'), 'value': 'General/Other Enquiry'}, + {'text': _('Large Data Upload'), 'value': 'Large Data Upload'}, + {'text': _('Data Updates'), 'value': 'Data Updates'}, + {'text': _('Data Access'), 'value': 'Data Access'} + ], + is_required=true) }} + + + {{ form.input('name', label=_('Contact Name'), id='field-name', value=data.name, + error=errors.name, classes=['control-medium'], is_required=true) }} + + {{ form.input('email', label=_('Email'), id='field-email', type='email', + value=data.email, error=errors.email, classes=['control-medium'], + is_required=true) }} + + {{ form.textarea('content', label=_('Your Request'), id='field-content', + value=data.content, error=errors.content, + placeholder=_('What do you have to tell us?'), is_required=true) }} +{% endblock %} \ No newline at end of file diff --git a/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/header.html b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/header.html index b8cc1fa2..db7f01fd 100644 --- a/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/header.html +++ b/ckan/src/ckanext-auscope-theme/ckanext/auscope_theme/templates/header.html @@ -1,12 +1,5 @@ {% ckan_extends %} - - - - -{% asset 'ckanext-contact/main' %} - - {% block header_logo %} - - - -{% asset 'ckanext-contact/main' %} - {% block header_logo %}
  • Don't have AAF?
  • +
  • {% link_for _('Log in'), named_route='user.login' %}
  • + +
  • + + {% if c.userobj %} + + {% else %} + {{ _('Contact') }} + {% endif %} + +
  • + {% if h.check_access('user_create') %} {% endif %} @@ -28,6 +41,7 @@
    + {% endblock %} {% block header_site_navigation_tabs %} @@ -36,7 +50,7 @@ "resource"]), ('home.about', _('About')) ) }}