2019-09-30 21:07:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Graphql
|
|
|
|
module Representation
|
|
|
|
class SubmoduleTreeEntry < SimpleDelegator
|
2019-12-04 20:38:33 +05:30
|
|
|
include GlobalID::Identification
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
class << self
|
|
|
|
def decorate(submodules, tree)
|
|
|
|
repository = tree.repository
|
|
|
|
submodule_links = Gitlab::SubmoduleLinks.new(repository)
|
|
|
|
|
|
|
|
submodules.map do |submodule|
|
|
|
|
self.new(submodule, submodule_links.for(submodule, tree.sha))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(submodule, submodule_links)
|
|
|
|
@submodule_links = submodule_links
|
|
|
|
|
|
|
|
super(submodule)
|
|
|
|
end
|
|
|
|
|
|
|
|
def web_url
|
|
|
|
@submodule_links.first
|
|
|
|
end
|
|
|
|
|
|
|
|
def tree_url
|
|
|
|
@submodule_links.last
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|