diff options
Diffstat (limited to 'app/assets/javascripts/groups')
-rw-r--r-- | app/assets/javascripts/groups/components/item_stats.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/groups/groups_list.js | 18 | ||||
-rw-r--r-- | app/assets/javascripts/groups/landing.js | 38 | ||||
-rw-r--r-- | app/assets/javascripts/groups/store/groups_store.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/groups/transfer_edit.js | 11 |
5 files changed, 71 insertions, 1 deletions
diff --git a/app/assets/javascripts/groups/components/item_stats.vue b/app/assets/javascripts/groups/components/item_stats.vue index 46e9d2bec99..c24eeed9f03 100644 --- a/app/assets/javascripts/groups/components/item_stats.vue +++ b/app/assets/javascripts/groups/components/item_stats.vue @@ -83,7 +83,7 @@ export default { <gl-badge variant="warning">{{ __('pending deletion') }}</gl-badge> </div> <div v-if="isProject" class="last-updated"> - <time-ago-tooltip :time="item.updatedAt" tooltip-placement="bottom" /> + <time-ago-tooltip :time="item.lastActivityAt" tooltip-placement="bottom" /> </div> </div> </template> diff --git a/app/assets/javascripts/groups/groups_list.js b/app/assets/javascripts/groups/groups_list.js new file mode 100644 index 00000000000..866dd7a61ff --- /dev/null +++ b/app/assets/javascripts/groups/groups_list.js @@ -0,0 +1,18 @@ +import FilterableList from '~/filterable_list'; + +/** + * Makes search request for groups when user types a value in the search input. + * Updates the html content of the page with the received one. + */ +export default class GroupsList { + constructor() { + const form = document.querySelector('form#group-filter-form'); + const filter = document.querySelector('.js-groups-list-filter'); + const holder = document.querySelector('.js-groups-list-holder'); + + if (form && filter && holder) { + const list = new FilterableList(form, filter, holder); + list.initSearch(); + } + } +} diff --git a/app/assets/javascripts/groups/landing.js b/app/assets/javascripts/groups/landing.js new file mode 100644 index 00000000000..bfb4d9ce67b --- /dev/null +++ b/app/assets/javascripts/groups/landing.js @@ -0,0 +1,38 @@ +import Cookies from 'js-cookie'; +import { parseBoolean } from '~/lib/utils/common_utils'; + +class Landing { + constructor(landingElement, dismissButton, cookieName) { + this.landingElement = landingElement; + this.cookieName = cookieName; + this.dismissButton = dismissButton; + this.eventWrapper = {}; + } + + toggle() { + const isDismissed = this.isDismissed(); + + this.landingElement.classList.toggle('hidden', isDismissed); + if (!isDismissed) this.addEvents(); + } + + addEvents() { + this.eventWrapper.dismissLanding = this.dismissLanding.bind(this); + this.dismissButton.addEventListener('click', this.eventWrapper.dismissLanding); + } + + removeEvents() { + this.dismissButton.removeEventListener('click', this.eventWrapper.dismissLanding); + } + + dismissLanding() { + this.landingElement.classList.add('hidden'); + Cookies.set(this.cookieName, 'true', { expires: 365 }); + } + + isDismissed() { + return parseBoolean(Cookies.get(this.cookieName)); + } +} + +export default Landing; diff --git a/app/assets/javascripts/groups/store/groups_store.js b/app/assets/javascripts/groups/store/groups_store.js index 93fbd8be47d..d3600bd223a 100644 --- a/app/assets/javascripts/groups/store/groups_store.js +++ b/app/assets/javascripts/groups/store/groups_store.js @@ -98,6 +98,9 @@ export default class GroupsStore { updatedAt: rawGroupItem.updated_at, pendingRemoval: rawGroupItem.marked_for_deletion, microdata: this.showSchemaMarkup ? getGroupItemMicrodata(rawGroupItem) : {}, + lastActivityAt: rawGroupItem.last_activity_at + ? rawGroupItem.last_activity_at + : rawGroupItem.updated_at, }; if (!isEmpty(rawGroupItem.compliance_management_framework)) { diff --git a/app/assets/javascripts/groups/transfer_edit.js b/app/assets/javascripts/groups/transfer_edit.js new file mode 100644 index 00000000000..bb15e11fd4c --- /dev/null +++ b/app/assets/javascripts/groups/transfer_edit.js @@ -0,0 +1,11 @@ +import $ from 'jquery'; + +export default function setupTransferEdit(formSelector, targetSelector) { + const $transferForm = $(formSelector); + const $selectNamespace = $transferForm.find(targetSelector); + + $selectNamespace.on('change', () => { + $transferForm.find(':submit').prop('disabled', !$selectNamespace.val()); + }); + $selectNamespace.trigger('change'); +} |