-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
728 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2023 Marcus Furlong <furlongm@gmail.com> | ||
# | ||
# This file is part of Patchman. | ||
# | ||
# Patchman is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, version 3 only. | ||
# | ||
# Patchman is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Patchman. If not, see <http://www.gnu.org/licenses/> | ||
|
||
from django.contrib import admin | ||
from modules.models import Module | ||
|
||
admin.site.register(Module) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Marcus Furlong <furlongm@gmail.com> | ||
# | ||
# This file is part of Patchman. | ||
# | ||
# Patchman is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, version 3 only. | ||
# | ||
# Patchman is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Patchman. If not, see <http://www.gnu.org/licenses/> | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class ModulesConfig(AppConfig): | ||
name = 'modules' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2023 Marcus Furlong <furlongm@gmail.com> | ||
# | ||
# This file is part of Patchman. | ||
# | ||
# Patchman is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, version 3 only. | ||
# | ||
# Patchman is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Patchman. If not, see <http://www.gnu.org/licenses/> | ||
|
||
from django.db import models | ||
|
||
|
||
class ModuleManager(models.Manager): | ||
def get_queryset(self): | ||
return super().get_queryset().select_related() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2023 Marcus Furlong <furlongm@gmail.com> | ||
# | ||
# This file is part of Patchman. | ||
# | ||
# Patchman is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, version 3 only. | ||
# | ||
# Patchman is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Patchman. If not, see <http://www.gnu.org/licenses/> | ||
|
||
from django.db import models | ||
from django.urls import reverse | ||
|
||
from arch.models import PackageArchitecture | ||
from packages.models import Package | ||
from repos.models import Repository | ||
|
||
|
||
class Module(models.Model): | ||
|
||
name = models.CharField(unique=True, max_length=255) | ||
stream = models.CharField(unique=True, max_length=255) | ||
version = models.CharField(max_length=255) | ||
context = models.CharField(unique=True, max_length=255) | ||
arch = models.ForeignKey(PackageArchitecture, on_delete=models.CASCADE) | ||
repo = models.ForeignKey(Repository, on_delete=models.CASCADE) | ||
packages = models.ManyToManyField(Package, blank=True) | ||
|
||
class Meta: | ||
verbose_name = 'Module' | ||
verbose_name_plural = 'Modules' | ||
ordering = ('name',) | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
def get_absolute_url(self): | ||
return reverse('modules:module_detail', args=[str(self.id)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2023 Marcus Furlong <furlongm@gmail.com> | ||
# | ||
# This file is part of Patchman. | ||
# | ||
# Patchman is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, version 3 only. | ||
# | ||
# Patchman is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Patchman. If not, see <http://www.gnu.org/licenses/> | ||
|
||
from rest_framework import serializers | ||
|
||
from modules.models import Module | ||
|
||
|
||
class ModuleSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = Module | ||
fields = ('id', 'name', 'stream', 'version', 'context', 'arch', 'repo', 'packages') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load common bootstrap3 %} | ||
|
||
{% block page_title %}Module - {{ module }} {% endblock %} | ||
|
||
{% block breadcrumbs %} {{ block.super }} <li><a href="{% url 'modules:module_list' %}">Modules</a></li><li class="active">{{ module }}</li>{% endblock %} | ||
|
||
{% block content_title %}Module - {{ module }} {% endblock %} | ||
|
||
{% block content %} | ||
|
||
<ul class="nav nav-tabs"> | ||
<li class="active"><a data-toggle="tab" href="#module_details">Details</a></li> | ||
<li><a data-toggle="tab" href="#module_packages">Packages</a></li> | ||
<li><a data-toggle="tab" href="#module_hosts">Hosts with this Module Enabled</a></li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<div class="tab-pane fade in active" id="module_details"> | ||
<div class="well well-sm"> | ||
<table class="table table-striped table-bordered table-hover table-condensed table-responsive"> | ||
<tr><th>Name</th><td> {{ module.name }} </td></tr> | ||
<tr><th>ID</th><td> {{ module.id }} </td></tr> | ||
<tr><th>Stream</th><td> {{ module.stream }} </td></tr> | ||
<tr><th>Version</th><td> {{ module.version }} </td></tr> | ||
<tr><th>Context</th><td> {{ module.context }} </td></tr> | ||
<tr><th>Architecture</th><td> {{ module.arch }} </td></tr> | ||
<tr><th>Repo</th><td><a href="{{ module.repo.get_absolute_url }}">{{ module.repo }}</a></td></tr> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<div class="tab-pane fade in" id="module_packages"> | ||
<div class="well well-sm"> | ||
<table class="table table-striped table-bordered table-hover table-condensed table-responsive"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Epoch</th> | ||
<th>Version</th> | ||
<th>Release</th> | ||
<th>Arch</th> | ||
<th>Type</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for package in module.packages.all %} | ||
<tr> | ||
<td> {{ package.name }} </td> | ||
<td> {{ package.epoch }} </td> | ||
<td> {{ package.version }} </td> | ||
<td> {{ package.release }} </td> | ||
<td> {{ package.arch }} </td> | ||
<td> {{ package.get_packagetype_display }} </td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<div class="tab-pane fade in" id="module_hosts"> | ||
<div class="well well-sm"> | ||
{% gen_table module.host_set.all.distinct %} | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% extends "objectlist.html" %} | ||
|
||
{% block page_title %}Modules{% endblock %} | ||
|
||
{% block breadcrumbs %} {{ block.super }} <li class="active"><a href="{% url 'modules:module_list' %}">Modules</a></li>{% endblock %} | ||
|
||
{% block content_title %} Modules {% endblock %} |
Oops, something went wrong.