Check-in [c316f97cae]
Overview
Comment:Added more status and action icons
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c316f97cae1767b2ead4792631fb48dfdbd6b7a2c86ce5205ff89ea6908a8723
User & Date: rkeene on 2017-10-26 17:08:32.619
Other Links: manifest | tags
Context
2017-10-26
18:09
Updated to support options for omitting redundant or passing tags check-in: 7931b61ae9 user: rkeene tags: trunk
17:08
Added more status and action icons check-in: c316f97cae user: rkeene tags: trunk
15:35
Added icons check-in: 46b68b63ed user: rkeene tags: trunk
Changes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
RIVET         := /usr/lib64/rivet0.5.0/cgi-bin/rivet.cgi

ACTION_LIST   := build tests
STATUS_LIST   := pass fail
PLATFORM_LIST := x86_64-linux x86_64-macos x86_64-freebsd

ICONS = $(shell for action in $(ACTION_LIST); do for status in $(STATUS_LIST); do for platform in $(PLATFORM_LIST); do echo "static/icon-$${action}-$${status}-$${platform}.svg"; done; done; done)

all: $(ICONS)

static/%.svg: $(RIVET) status-icons.rvt $(shell find os -type f -name '*.svg')
	@if ! test -d static; then mkdir static; fi
	QUERY_STRING='action=$(shell echo '$@' | cut -f 2 -d -)&status=$(shell echo '$@' | cut -f 3 -d -)&os=$(shell echo '$@' | cut -f 5 -d - | cut -f 1 -d .)' PATH_TRANSLATED='$(shell pwd)/status-icons.rvt' '$(RIVET)' ./status-icons.rvt | tail -n +5 > '$@'

static/%.png: static/%.svg
	echo TODO Add support for making '$@' from '$^'
	exit 1





|





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
RIVET         := /usr/lib64/rivet0.5.0/cgi-bin/rivet.cgi

ACTION_LIST   := build tests
STATUS_LIST   := pass fail
PLATFORM_LIST := x86_64-linux x86_64-macos x86_64-freebsd arm-android

ICONS = $(shell for action in $(ACTION_LIST); do for status in $(STATUS_LIST); do for platform in $(PLATFORM_LIST); do echo "static/icon-$${action}-$${status}-$${platform}.svg"; done; done; done)

all: $(ICONS)

static/%.svg: $(RIVET) status-icons.rvt $(shell find os status action -type f -name '*.svg')
	@if ! test -d static; then mkdir static; fi
	QUERY_STRING='action=$(shell echo '$@' | cut -f 2 -d -)&status=$(shell echo '$@' | cut -f 3 -d -)&os=$(shell echo '$@' | cut -f 5 -d - | cut -f 1 -d .)' PATH_TRANSLATED='$(shell pwd)/status-icons.rvt' '$(RIVET)' ./status-icons.rvt | tail -n +5 > '$@'

static/%.png: static/%.svg
	echo TODO Add support for making '$@' from '$^'
	exit 1

1
2



3

4
5
6
7
8
9
10
<?
	proc iconfile {type name {checkUnknown true}} {



		set file [file join [file dirname [info script]] $type "${name}.svg"]

		if {![file exists $file]} {
			if {$checkUnknown} {
				tailcall iconfile $type unknown false
			} else {
				error "No icon available for type=$type name=$name"
			}
		}


>
>
>

>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?
	proc iconfile {type name {checkUnknown true}} {
		if {![regexp {^[a-z]*$} $name]} {
			set name unknown
		}
		set file [file join [file dirname [info script]] $type "${name}.svg"]

		if {![file exists $file]} {
			if {$checkUnknown} {
				tailcall iconfile $type unknown false
			} else {
				error "No icon available for type=$type name=$name"
			}
		}
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
		puts -nonewline [string map [list @@XPOS@@ $x @@YPOS@@ $y @@WIDTH@@ $width @@HEIGHT@@ $height] $data]
	}

	proc textColorFromBackground {color} {
		return "#fff"
	}


	set args(action) [list "build"]
	set args(status) [list "unknown"]
	set args(os)     [list "unknown"]
	set action_color_default "#555"
	set status_color_default "#4c1"
	set mapping([list status_color pass])    #00ff97
	set mapping([list status_color passed])  #00ff97
	set mapping([list status_color passing]) #00ff97
	set mapping([list status_color fail])    #f00
	set mapping([list status_color failed])  #f00
	set mapping([list status_color failing]) #f00
	set mapping([list status_color unknown]) #9932CC
	set errList [list]

	load_response args

	foreach arg {action status status_color action_color os} {
		if {![info exists args($arg)]} {
			continue
		}

		set args($arg) [lindex [set args($arg)] end]
	}








>
















|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
		puts -nonewline [string map [list @@XPOS@@ $x @@YPOS@@ $y @@WIDTH@@ $width @@HEIGHT@@ $height] $data]
	}

	proc textColorFromBackground {color} {
		return "#fff"
	}

	set args(background_color) "#eee"
	set args(action) [list "build"]
	set args(status) [list "unknown"]
	set args(os)     [list "unknown"]
	set action_color_default "#555"
	set status_color_default "#4c1"
	set mapping([list status_color pass])    #00ff97
	set mapping([list status_color passed])  #00ff97
	set mapping([list status_color passing]) #00ff97
	set mapping([list status_color fail])    #f00
	set mapping([list status_color failed])  #f00
	set mapping([list status_color failing]) #f00
	set mapping([list status_color unknown]) #9932CC
	set errList [list]

	load_response args

	foreach arg {action status status_color action_color background_color os} {
		if {![info exists args($arg)]} {
			continue
		}

		set args($arg) [lindex [set args($arg)] end]
	}

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89


90
91



92
93



94
95
96
		}

		if {![info exists args($arg)]} {
			set args($arg) [set ${arg}_default]
		}
	}

	set timestamp "Tue, 24 Oct 2017 00:00:00 GMT"
	set etag [binary encode base64 [list $timestamp $args(action) $args(status) $args(action_color) $args(status_color) $args(os)]]

	set actionTextColor [textColorFromBackground $args(action_color)]
	set statusTextColor [textColorFromBackground $args(status_color)]

	headers type image/svg+xml
	headers add Last-Modified $timestamp
	headers add ETag $etag

	set q [format %c 63]
	puts -nonewline "<${q}xml version=\"1.0\"${q}>"
?>
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20">
<linearGradient id="a" x2="0" y2="100%">
    <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
    <stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="3" width="120" height="20" fill="<? puts -nonewline $args(action_color) ?>"/>
<rect rx="3" x="65" width="55" height="20" fill="<? puts -nonewline $args(status_color) ?>"/>
<rect rx="3" width="120" height="20" fill="url(#a)"/>
<? catch {icon os $args(os)} ?>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">


    <text x="44" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(action) ?></text>
    <text x="44" y="14" fill="<? puts -nonewline $actionTextColor ?>"><? puts -nonewline $args(action) ?></text>



    <text x="92" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(status) ?></text>
    <text x="92" y="14" fill="<? puts -nonewline $statusTextColor ?>"><? puts -nonewline $args(status) ?></text>



</g>
<!-- <? #puts $errList ?> -->
</svg>







|

















|
<
<
<

>
>


>
>
>


>
>
>



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
		}

		if {![info exists args($arg)]} {
			set args($arg) [set ${arg}_default]
		}
	}

	set timestamp "Tue, 26 Oct 2017 00:00:00 GMT"
	set etag [binary encode base64 [list $timestamp $args(action) $args(status) $args(action_color) $args(status_color) $args(os)]]

	set actionTextColor [textColorFromBackground $args(action_color)]
	set statusTextColor [textColorFromBackground $args(status_color)]

	headers type image/svg+xml
	headers add Last-Modified $timestamp
	headers add ETag $etag

	set q [format %c 63]
	puts -nonewline "<${q}xml version=\"1.0\"${q}>"
?>
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20">
<linearGradient id="a" x2="0" y2="100%">
    <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
    <stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="3" width="120" height="20" fill="<? puts -nonewline $args(background_color) ?>"/>



<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<? if {[info exists args(no_action_icon)] || [catch {icon action $args(action) 36}]} { ?>
    <rect rx="3" width="120" height="20" fill="<? puts -nonewline $args(action_color) ?>"/>
    <text x="44" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(action) ?></text>
    <text x="44" y="14" fill="<? puts -nonewline $actionTextColor ?>"><? puts -nonewline $args(action) ?></text>
<? } ?>
<? if {[info exists args(no_status_icon)] || [catch {icon status $args(status) 84}]} { ?>
    <rect rx="3" x="65" width="55" height="20" fill="<? puts -nonewline $args(status_color) ?>"/>
    <text x="92" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(status) ?></text>
    <text x="92" y="14" fill="<? puts -nonewline $statusTextColor ?>"><? puts -nonewline $args(status) ?></text>
<? } ?>
<rect rx="3" width="120" height="20" fill="url(#a)"/>
<? catch {icon os $args(os)} ?>
</g>
<!-- <? #puts $errList ?> -->
</svg>